Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/gdn/admin_typeNote.php3
<?



	

	include("../BarreDeMenu.php3");

	

	include("../Session/security.php");



// Entete

    buildHeader("Administration des types de notes");



// 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,"gdn/admin_typenote.php3",false);

// Ouverture de la connexion

	    $connection = openConnection($databaseName);


    	if (!isset($index)) $index=1;

//***********************************************************************************************

//*  Debut du formulaire

//***********************************************************************************************



    print("<form name=\"form1\" action=\"admin_typenote.php3\" method=post>\n");



    print("  <input type=\"hidden\" name=\"login\" value=\"$login\">\n");

	print("  <input type=\"hidden\" name=\"index\" value=\"$index\">\n");	

	print("  <input type=\"hidden\" name=\"choice\" value=\"0\">\n");	

    print("  <input type=\"hidden\" name=\"id_session\" value=\"$id_session\">\n");

    print("  <input type=\"hidden\" name=\"user_type\" value=\"$user_type\">\n");

    print("  <input type=\"hidden\" name=\"user_id\" value=\"$user_id\">\n");

    print("  <input type=\"hidden\" name=\"display\" value=\"$display\">\n");

    print("  <input type=\"hidden\" name=\"id_typenote\" value=\"$id_typenote\">\n");





if($index!=2){

	$res = mysql_query("SELECT id_typenote, libelle FROM typenote ");



	print("  <table align=center border=1 cellspacing=0 cellpading=0 width=402> <tr><td>\n");

	print("  <table align=center border=1 cellspacing=0 cellpading=0 width=400>\n");

	print("  <tr>\n");

	print("    <td COLSPAN=4 bgcolor=\"#C0C000\"> <font size=3><b> LES TYPES DE NOTE </b></font> </td> \n");

	print("  </tr>\n");

	print("  <tr>\n");

	print("    <td width=250 ><i> &nbsp;Libell&eacute;  </i></td> \n");

	print("    <td width=150 align=center> &nbsp; </td> \n");

	print("  </tr>\n");

	for($i=0;$i<mysql_num_rows($res);$i++){

		$typenote = mysql_fetch_row($res);

		print("  <tr> \n");

		print("    <td> &nbsp; <INPUT type=text name=\"libelle_$typenote[0]\" VALUE=\"$typenote[1]\" size=30> </td> \n");

		print("    <td align=center> <font face=\"arial\" size=1><a href=\"Javascript:document.form1.index.value=2;document.form1.choice.value=1;document.form1.id_typenote.value=$typenote[0];document.form1.submit();\">modifier</a> | <a href=\"Javascript:document.form1.index.value=2;document.form1.choice.value=2;document.form1.id_typenote.value=$typenote[0];document.form1.submit();\">supprimer</a> </font></td> ");

		print("  </tr>\n");

	}

	print("  <tr>\n");

    print("    <td> &nbsp; <INPUT type=text name=\"libelle\" size=30>  </td> \n");

	print("    <td align=center> <font face=\"arial\" size=1> <a href=\"Javascript:document.form1.index.value=2;document.form1.choice.value=3;document.form1.submit();\">a j o u t e r</a> </td> \n");

    print("  </tr>\n");

	print(" </TABLE>	</td></tr></TABLE> <BR> \n");



	print(" <br> \n");

	print(" <div align=center> <font face=\"arial\" size=3> <b> \n");

	print(" Attention : supprimer un type de note supprimera d&eacute;finitivement <br>\n");

	print(" tous les r&eacute;sultats des notes associ&eacute;es !\n");

	print(" </b></font></div> \n");



}



//***********************************************************************************************

//********		INDEX = 2 : MODIFICATION, SUPPRESSION OU AJOUT D'UN TYPE DE NOTE		*********

//***********************************************************************************************



if($index==2){

	

	switch($choice){

		case 1 : //MODIFICATION D'UN TYPE DE NOTE

					$libelle = "$" . "libelle_" . $id_typenote;

					eval( "\$libelle = \"$libelle\";" );

					mysql_query("UPDATE typenote SET  libelle='$libelle' WHERE id_typenote=$id_typenote");

					break;

		case 2 : //SUPPRESSION D'UN TYPE DE NOTE

					mysql_query("DELETE FROM typenote WHERE id_typenote=$id_typenote ");

					break;

		case 3 : //AJOUT D'UN TYPE DE NOTE

					mysql_query("INSERT INTO typenote VALUES ('','$libelle')");

					break;

	}





	print(" <SCRIPT LANGUAGE=javascript> \n");

	print("		document.form1.index.value=\"1\"; \n");		//	IL FAUT RECHARGER LE FORMULAIRE

	print("		document.form1.submit(); \n");

	print(" </SCRIPT> \n");

	print("  \n");

}



//***********************************************************************************************

//*  Fin du formulaire

//***********************************************************************************************



	print("</form> \n");



//***********************************************************************************************

//***********************************************************************************************

//***********************************************************************************************

}

	

	buildEndOfPage();	



?>

Return current item: EmploiNet : a timetable web manager