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

// Entete
    buildHeader("Constitution des groupes");

// Verification de la session
	$autorisation_list[0]=0; // Administrateur
	$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,"departement.php3",false);
// Ouverture de la connexion avec la base de donnees
	    $connection = openConnection($databaseName);
		$G_departement = new Departement(-1,"",-1);

function remplir_formulaire($index, $result)
{
        global $G_departement;
     
        if (mysql_data_seek($result,$index))
        {
          $un_departement = mysql_fetch_array($result);   
          $G_departement->id_departement = $un_departement["id_departement"];
          $G_departement->libelle = $un_departement["libelle"];
          $G_departement->id_professeur = $un_departement["id_professeur"];
        }
        else
          print("Error: mysql_data_seek"); 
      }

      function selectRecords()
      {
        return mysql_query("SELECT * FROM departement ORDER BY libelle");
      }
    
      function deleteRecord($keyValue)
      {
        mysql_query("DELETE FROM departement WHERE (id_departement='$keyValue')");
      }

      function modifyRecord($keyValue)
      {
 	    global $libelle;
		global $id_professeur;

        mysql_query("UPDATE departement SET libelle='$libelle',id_professeur='$id_professeur' WHERE id_departement=$keyValue");
      }

      function newRecord()
      {
		global $id_departement;
	    global $libelle;
		global $id_professeur;
		global $G_departement;

        if ($libelle != "" && $libelle != "- Obligatoire -")
		{
			$id_departement = getKeyValue("id_departement");
			mysql_query("INSERT INTO departement VALUES('$id_departement','$libelle','$id_professeur')");
			return $id_departement;
		}
		else
		{
			$G_departement->libelle = "- Obligatoire -";
			return -1;
		}
      }

//***********************************************************************************************
//* Navigation et rechercheId
//***********************************************************************************************

     perform($id_departement,"id_departement");

//***********************************************************************************************
//* Fin de la navigation
//***********************************************************************************************

// Formulaire de saisie

      function buildCustomFields()
	  {
	  }

	  $form["Name"]=array("","Libell&eacute;","Directeur du d&eacute;partement");
	  $form["Type"]=array(0,1,5);
	  $form["FieldName"]=array("id_departement","libelle","id_professeur");
	  $form["Value"]=array($G_departement->id_departement,$G_departement->libelle,$G_departement->id_professeur);
	  $form["KeyName"]=array("","","id_professeur");
	  $form["Request"]=array("","","select * from professeur");
	  $form["Fields"]=array("","",array("nom","prenom"));
	  $form["Length"]=array(0,32,1);
	  $form["NewLine"]=array(false,true,false);

	  buildForm("departement.php3",$form,$id_session,0,$user_type,$user_id,$display);
  }
  buildEndOfPage();
?>    
Return current item: EmploiNet : a timetable web manager