Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/Salle/salle.php3
<?
    
    include("../Administration/Functions.php3");
    include("../Administration/Navigation.php3");
    include("../BarreDeMenu.php3");
    include("../Administration/class_salle.php3");
    
    include("../Session/security.php");

// Entete
    buildHeader("Salle");
// Verification de la session
	$autorisation_list[0]=0; // Administrateur
	$autorisation_list[1]=3; // Gestionnaire
	$user_type = validateSession($id_session);
	if ($user_type == -1 || !security($id_session,$autorisation_list)) print("Accès refusé");
    else
    {
// Barre de menu
		buildMenuBar($id_session,$user_type,"salle.php3",false);
// Ouverture de la connexion avec la base de donnees
	    $connection = openConnection($databaseName);
	    $G_salle = new Salle(-1,"","",0);
      function remplir_formulaire($index, $result)
      {
		global $G_salle;
        if (mysql_data_seek($result,$index))
        {
          $une_salle = mysql_fetch_array($result);   
          $G_salle->id_salle = $une_salle["id_salle"];
          $G_salle->nom = $une_salle["numero"];
          $G_salle->id_type_salle = $une_salle["id_type_salle"]; 
          $G_salle->nb_places = $une_salle["nb_places"]; 
        }
        else
          print("Error: mysql_data_seek"); 
      }
	function selectRecords()
	{
		return mysql_query("SELECT * FROM salle ORDER BY numero");
	}

      function deleteRecord($keyValue)
      {
        mysql_query("DELETE FROM salle WHERE (id_salle='$keyValue')");
      }

     function modifyRecord($keyValue)
      {
 	    global $nom;
		global $id_type_salle;
		global $nb_places;
        mysql_query("UPDATE salle SET numero='$nom',id_type_salle='$id_type_salle',nb_places='nb_places' WHERE id_salle=$keyValue");
      }

      function newRecord()
      {
		global $id_salle;
	    global $nom;
	    global $id_type_salle;
	    global $nb_places;
		global $G_salle;
        if ($nom != "" && $nom != "- Obligatoire -")
		{
		  $id_salle = getKeyValue("id_salle");
		  mysql_query("INSERT INTO salle VALUES('$id_salle','$nom','$id_type_salle','$nb_places')");
		  return $id_salle;
		}
		else
		{
		  $G_salle->nom = "- Obligatoire -";
		  return -1;
		}
      }

//***********************************************************************************************
//* Navigation et rechercheId
//***********************************************************************************************
      perform($id_salle,"id_salle");
//***********************************************************************************************
//* Fin de la navigation
//***********************************************************************************************
// Formulaire de saisie

      function buildCustomFields()
	  {
	  }

	  $form["Name"]=array("","Nom","Type","Nombre de places");
	  $form["Type"]=array(0,1,5,1);
	  $form["FieldName"]=array("id_salle","nom","id_type_salle",'nb_places');
	  $form["Value"]=array($G_salle->id_salle,$G_salle->nom,$G_salle->id_type_salle,$G_salle->nb_places);
	  $form["KeyName"]=array("","","id_type_salle","");
	  $form["Request"]=array("","","SELECT id_type_salle,libelle FROM typesalle ORDER BY libelle");
	  $form["Fields"]=array("","",array("libelle"));
	  $form["Length"]=array(0,32,1,16);
	  $form["NewLine"]=array(false,true,true,false);
	  buildForm("salle.php3",$form,$id_session,0,$user_type,$user_id,$display);
  }

  buildEndOfPage();
?>
Return current item: EmploiNet : a timetable web manager