Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/edt/ModifRapide/modifie_chgt_salle.php3
<?
	    // ***************************************************************************************************
	    // *************************************** Changement de salles **************************************
	    // ***************************************************************************************************
			print(" <input type=\"hidden\" name=\"sem\" value=\"$s_semaine\">\n");
			print(" <input type=\"hidden\" name=\"nb_val_1\" value=\"$nb_val_1\">\n"); // nombre de cours dans la salle 1
			print("<script language=\"JavaScript\">\n");
			print(" document.form1.tableau1.value=''\n;");
			print("</script>\n\n");

			// Variables
	        $x_jour = array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
	        print("<table align=center border=0 cellspacing=0 cellpading=0 width=700 bgcolor=\"#ffcc33\">\n");
	        print("<tr>\n");
			if(isset($id_salle[1]) && isset($id_salle[2]) && isset($s_semaine) && isset($s_jour) && $id_salle[1]!=-1 && $id_salle[2]!=-1 && $s_semaine!=-1 && $s_jour!=-1)
			{
				print("<td align=center><a href=\"choix_modif.php3?id_session=$id_session&user_type=$user_type&user_id=$user_id\">Autres modifications</a></td>\n");
				print("<td align=center><a href=\"javascript:document.form1.choice.value=5; document.form1.submit();\">Echanger</a></td>\n");
			}
			else
			{
				print("<td align=center><a href=\"choix_modif.php3?id_session=$id_session&user_type=$user_type&user_id=$user_id\">Autres modifications</a></td>\n");
			}
	        print("</tr>\n");
			print("  </table>\n");	
			print("<table align=center>\n");
			print("<tr>\n");
			print(" <td nowrap ><font size=3><i>Salle 1 :</i></font></td>\n");
			print(" <td>\n");
			print(" <select tabindex=-1 name=\"id_salle[1]\" size=1 width=200 OnChange=\"document.form1.choice.value = 0; document.form1.submit();\">\n");
			if(!isset($id_salle[1]) || $id_salle[1]==-1)
				print("<option value=-1 selected>\n");
			$request="select id_salle, numero from salle";
			$result=mysql_query($request);
			while($une_salle=mysql_fetch_array($result))
			{
				if($id_salle[1]==$une_salle["id_salle"])
					print("<option value=".$une_salle["id_salle"]." selected>".$une_salle["numero"]);
				else 
					print("<option value=".$une_salle["id_salle"]." >".$une_salle["numero"]);
				print("\n");
			}
			print("</select>\n");
			print("</td>\n");
			print(" <td nowrap ><font size=3><i>Salle 2 :</i></font></td>\n");
			print(" <td>\n");
			print(" <select tabindex=-1 name=\"id_salle[2]\" size=1 width=200 OnChange=\"document.form1.choice.value = 0; document.form1.submit();\">\n");
			if(!isset($id_salle[2]) || $id_salle[2]==-1)
				print("<option value=-1 selected>\n");
			$request="select id_salle, numero from salle";
			$result=mysql_query($request);
			while($une_salle=mysql_fetch_array($result))
			{
				if($id_salle[2]==$une_salle["id_salle"])
					print("<option value=".$une_salle["id_salle"]." selected>".$une_salle["numero"]);
				else 
					print("<option value=".$une_salle["id_salle"]." >".$une_salle["numero"]);
				print("\n");
			}
			print("</select>\n");
			print("</td>\n");
			print(" <td nowrap ><font size=3><i>Semaine :</i></font></td>\n");
			print(" <td>\n");
			print(" <select tabindex=-1 name=\"s_semaine\" size=1 width=200 OnChange=\"document.form1.choice.value = 0; document.form1.submit();\">\n");
			$max=-1;
			$request1=mysql_query("SELECT min(numero_semaine_debut), nb_semaines
								   FROM periode
								   WHERE numero=1");
			$result1=mysql_fetch_row($request1);
			$first_week=$result1[0];
			$request5=mysql_query("SELECT id_promotion,numero_semaine_debut
								   FROM periode
								   GROUP BY id_promotion");
			while($p=mysql_fetch_row($request5))
			{
				$request4=mysql_query("SELECT sum(nb_semaines)
									   FROM periode
									   WHERE id_promotion=$p[0]");
				$result4=mysql_fetch_array($request4);
				$total=$p[1]+$result4[0];
				if($total>$max)
					$max=$total;							
			}
			if(!isset($s_semaine) || $s_semaine==-1)
					print("<option value=-1 selected>\n");
			for($i=$first_week;$i<=$max;$i++)
			{
				$s=($i>52)?($i-52):$i;
				if($s_semaine==$s)
					print("<option value=$s selected>$s");
				else 
					print("<option value=$s>$s");
				print("\n");
			}
			print("</select>\n");
			print("</td>\n");
			print(" <td nowrap ><font size=3><i>Jour :</i></font></td>\n");
			print(" <td>\n");
			print(" <select tabindex=-1 name=\"s_jour\" size=1 width=200 OnChange=\"document.form1.choice.value = 0; document.form1.submit();\">\n");
			if(!isset($s_jour) || $s_jour==-1)
				print("<option value=-1>\n");
			for($i=1;$i<7;$i++)
			{
				if($s_jour==$i)
					print("<option value=$i selected>$x_jour[$i]");
				else 
					print("<option value=$i>$x_jour[$i]");
				print("\n");
			}
			print("</td>\n");
			print("</tr>\n");
			print("</table>\n");
			if(isset($id_salle[1]) && isset($id_salle[2]) && isset($s_semaine) && isset($s_jour) && $id_salle[1]!=-1 && $id_salle[2]!=-1 && $s_semaine!=-1 && $s_jour!=-1)
			{
			    print("<p><table width=700 border=1 CELLSPACING=0 align=center bordercolor=black>\n");
		        print("<tr align=center>\n");
				print("<td bgcolor=#C0C0C0><b>-</td>\n");
		        print("<td bgcolor=#C0C0C0><b>S&eacute;lection</td>\n");
		        print("<td bgcolor=#C0C0C0><b>Promotion</td>\n");
				print("<td bgcolor=#C0C0C0><b>Mati&egrave;re</td>\n");
		        print("<td bgcolor=#C0C0C0><b>Type</td>\n");
		        print("<td bgcolor=#C0C0C0><b>Professeur</td>\n");
		        print("<td bgcolor=#C0C0C0><b>D&eacute;but</td>\n");
		        print("<td bgcolor=#C0C0C0><b>Fin</td>\n");
				print("</tr>");
				$NombreDeNiveau=1;			
				$nb=0;
				for($i=1;$i<=2;$i++)
				{
					$request="SELECT distinct(id_planifie)
							  FROM planifie
							  WHERE id_salle=$id_salle[$i] 
							    AND jour_semaine=$s_jour 
								AND semaine=$s_semaine";
					$result=mysql_query($request);
					$num=mysql_num_rows($result);
					$nb=$nb+$num;
					if($i==1)
					{
						print("<script language=\"JavaScript\">\n");
						print("document.form1.nb_val_1.value=$nb;\n");
						print("</script>\n");
					}
				}
				for($i=1;$i<=2;$i++)
				{
					$requete1=mysql_query("SELECT numero FROM salle WHERE id_salle=$id_salle[$i]");
					$resultat1=mysql_fetch_array($requete1);
					print("<tr align=center bgcolor=#CAD4EC><td colspan=8><b>Salle ".$resultat1[0]."</b></td></tr>\n");
					$request="SELECT distinct(id_planifie), id_professeur, id_type_seance, id_matiere, heure_debut, heure_fin
							  FROM planifie
							  WHERE id_salle=$id_salle[$i] 

							    AND jour_semaine=$s_jour 

								AND semaine=$s_semaine

							  ORDER BY heure_debut";

					$result=mysql_query($request);

					

					while($un_cours=mysql_fetch_array($result))

					{

						print("<script language=\"JavaScript\">\n");

						print(" document.form1.tableau1.value='0'+document.form1.tableau1.value\n;");

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

	

						$request_matiere="SELECT m.nom FROM matiere m WHERE m.id_matiere=".$un_cours["id_matiere"];

				        $result_matiere=mysql_query($request_matiere);

						$une_mat=mysql_fetch_row($result_matiere);

	

						$request_professeur="SELECT p.nom FROM professeur p WHERE p.id_professeur=".$un_cours["id_professeur"];

						$result_professeur=mysql_query($request_professeur);

						$un_prof=mysql_fetch_row($result_professeur);

	

						$request_type="SELECT type FROM typeseance WHERE id_type_seance=".$un_cours["id_type_seance"];

						$result_type=mysql_query($request_type);

						$un_type=mysql_fetch_row($result_type);

			

						print("<tr align=center>\n");

						print("<td bgcolor=#C0C0C0>$NombreDeNiveau</td>\n");

						print("<input type=\"hidden\" name=\"ValId[$NombreDeNiveau]\" value=\"$un_cours[0]\">\n");

						print("<td> <a href=\"javascript:changerImage('ImageSelection$NombreDeNiveau'); modifierChaineMult($NombreDeNiveau-1,$nb);\" ><IMG SRC=\"img/ellipse.gif\"  NAME=\"ImageSelection$NombreDeNiveau\" border=0 border=no></a> </td>\n");

	

						$request_promo="SELECT p.sigle FROM promotion p, suiviparpromotion spp 

										WHERE spp.id_promotion=p.id_promotion

										  AND spp.id_matiere=".$un_cours["id_matiere"];

						$result_promo=mysql_query($request_promo);

						$une_promo=mysql_fetch_row($result_promo);

			

						if(mysql_num_rows($result_promo)==0)

						{

							$request_groupe="SELECT p.sigle, g.nom, g.type from promotion p, groupe g, associer a, suivipargroupe spg

											 WHERE a.id_promotion=p.id_promotion

											   AND a.id_groupe=g.id_groupe

											   AND spg.id_groupe=g.id_groupe

											   AND spg.id_matiere=".$un_cours["id_matiere"];

							$result_groupe=mysql_query($request_groupe);

							$un_groupe=mysql_fetch_row($result_groupe);

				

							print("<td>$un_groupe[0] - $un_groupe[1]($un_groupe[2])</td>\n");

						}

						else

							print("<td>$une_promo[0]</td>\n");

							

						print("<td>".$une_mat[0]."</td>\n");

						print("<td>".$un_type[0]."</td>\n");

						if(isset($un_prof[0]))

							print("<td>".$un_prof[0]."</td>\n");

						else

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

						print("<td>".$un_cours["heure_debut"]."</td>\n");

						print("<input type=\"hidden\" name=\"heure_deb[$NombreDeNiveau]\" value=\"$un_cours[4]\">\n");

						print("<td>".$un_cours["heure_fin"]."</td>\n");

						print("<input type=\"hidden\" name=\"heure_fin[$NombreDeNiveau]\" value=\"$un_cours[5]\">\n");

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

						$NombreDeNiveau++;

					}

				}

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

			}

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



?>
Return current item: EmploiNet : a timetable web manager