Location: PHPKode > projects > PhpScheduler > PhpScheduler/template/admin.template.php
<?php
/**
 * Generation de l'affichage HTML de la partie administration
 */
$basedir = dirname( __FILE__ ) . '/..';
require_once( $basedir . "/lib/select_utils.php" );
require_once( $basedir . "/lib/mysql.php" );
class Admin_Template {
	function print_admin()
	{
		echo "<div class=\"cat_title\">Administration</div>";
		echo "<table width=\"100%\" cellspacing=\"5\">\n";
		echo "<tr>\n";
		echo "<td class=\"adminbox\">\n";
		echo "<div class=\"subcat_title\">Cr&eacute;er un cours</div>\n";
		echo "<div id=\"result\">\n";
		echo "<div class=\"subcat_title\">R&eacute;sultat</div>\n";
		echo "<div>&nbsp;</div>\n";
		echo "<div id=\"resultat\">Le cours a &eacute;t&eacute; ajouter</div>";
		echo "<div>&nbsp;</div>\n";
		echo "<div class=\"button\" onclick=\"resultat_close();\">Fermer</div>\n";
		echo "</div>\n";
		echo "<div class=\"admintext\">Date</div>\n";
		echo "<div>";

		echo "<select class=\"login_input\" id=\"jour_cours\" name=\"jour\">\n";
		for( $i = 1;$i < 32;$i++ ) {
			if ( $i == date( "d" ) ) {
				echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
			}else {
				echo "<option value=\"$i\">$i</option>\n";
			}
		}
		echo "</select>\n";

		echo "<select class=\"login_input\" id=\"mois_cours\" name=\"mois\">\n";
		for( $i = 1;$i < 13;$i++ ) {
			if ( $i == date( "m" ) ) {
				echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
			}else {
				echo "<option value=\"$i\">$i</option>\n";
			}
		}
		echo "</select>\n";

		echo "<select class=\"login_input\" id=\"year_cours\" name=\"year\">\n";
		for( $i = date( "Y" )-2;$i < date( "Y" ) + 3;$i++ ) {
			if ( $i == date( "Y" ) ) {
				echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
			}else {
				echo "<option value=\"$i\">$i</option>\n";
			}
		}
		echo "</select>\n";

		echo "</div>\n";
		echo "<div class=\"admintext\">Heure</div>\n";
		echo "<div>";

		echo "<select class=\"login_input\" id=\"heure_debut\" name=\"heure_debut\">\n";
		for( $i = 8;$i < 19;$i++ ) {
			echo "<option value=\"$i\">$i</option>\n";
		}
		echo "</select>H\n";
		echo "<select class=\"login_input\" id=\"min_debut\" name=\"minute_debut\">\n";
		for( $i = 0;$i < 46;$i = $i + 15 ) {
			echo "<option value=\"$i\">$i</option>\n";
		}
		echo "</select>Min =====>\n";
		echo "<select class=\"login_input\" id=\"heure_fin\" name=\"heure_fin\">\n";
		for( $i = 9;$i < 20;$i++ ) {
			echo "<option value=\"$i\">$i</option>\n";
		}
		echo "</select>H\n";
		echo "<select class=\"login_input\" id=\"min_fin\" name=\"minute_fin\">\n";
		for( $i = 0;$i < 46;$i = $i + 15 ) {
			echo "<option value=\"$i\">$i</option>\n";
		}
		echo "</select>Min\n";
		echo "</div>\n";
		echo "<div class=\"admintext\">Information sur le cours</div>\n";
		echo "<div>";
		
		$select_utils = new Select_Utils();
		echo "<table>\n";
		echo "<tr><td>";
		echo "Professeur : ";
		echo "</td><td>";
		$select_utils->select_professeur();
		echo "</td></tr>\n";
		echo "<tr><td>";
		echo "Matiere : ";
		echo "</td><td>";
		$select_utils->select_matiere();
		echo "</td></tr>\n";
		echo "<tr><td>";
		echo "Salle : ";
		echo "</td><td>";
		$select_utils->select_salle();
		echo "</td></tr>\n";
		echo "<tr><td>";
		echo "Groupe : ";
		echo "</td><td>";
		$select_utils->select_groupe();
		echo "</td></tr>\n";
		echo "<tr><td>";
		echo "Type : ";
		echo "</td><td>";
		$select_utils->select_type();
		echo "</td></tr>\n";
		echo "</table>\n";
		
		echo "Commentaire : <input id=\"commentaire_cours\" class=\"login_input\" type=\"text\" /><br />\n";
		echo "<div class=\"button\" onclick=\"create_cours();\">Ajouter</div>\n";
		echo "</div>\n";
		echo "</td>\n";

		echo "<td class=\"adminbox\">\n";
		echo "<div class=\"subcat_title\">Gestion des caches</div>\n";
		echo "<div class=\"button\" onclick=\"regenerate_cache(" . date( 'Y' ) . ");\">Reg&eacute;n&eacute;rer les caches de " . date( 'Y' ) . "</div>\n";
		echo "<div>&nbsp;</div>\n";
		echo "<div class=\"button\" onclick=\"regenerate_pdf(" . date( 'Y' ) . ");\">Reg&eacute;n&eacute;rer les pdf de " . date( 'Y' ) . "</div>\n";
		echo "<div>&nbsp;</div>\n";
		echo "<div class=\"button\" onclick=\"regenerate_ics(" . date( 'Y' ) . ");\">Reg&eacute;n&eacute;rer les iCalendar de " . date( 'Y' ) . "</div>\n";
		echo "</td>\n";

		echo "<td class=\"adminbox\">\n";
		echo "<div class=\"subcat_title\">&nbsp;</div>\n";
		echo "</td>\n";

		echo "</tr>\n";
		
		echo "<tr>\n";
		echo "<td class=\"adminbox\">\n";
		echo "<div class=\"subcat_title\">Liste des professeurs</div>\n";
		$mysql = new mysql();
		$table_name = $mysql -> get_table( "Professeurs" );
		$profs = $mysql -> select_query( "SELECT * FROM $table_name" );
		if( $profs != null ) {
			echo "<table width=\"100%\">\n";
			echo "<tr><td>id</td><td>Nom</td><td>Prenom</td></tr>\n";
			foreach( $profs as $professeur ) {
				echo "<tr>";
				echo "<td>" . $professeur["id_professeur"] . "</td>\n";
				echo "<td>" . $professeur["nom"] . "</td>\n";
				echo "<td>" . $professeur["prenom"] . "</td>\n";
				echo "</tr>\n";
			}
			echo "</table>\n";
		}
		echo "</td>\n";
		
		echo "<td class=\"adminbox\">\n";
		echo "<div class=\"subcat_title\">Liste des Matieres</div>\n";
		$table_name = $mysql -> get_table( "Matieres" );
		$matieres = $mysql -> select_query( "SELECT * FROM $table_name" );
		if( $matieres != null ) {
			echo "<table width=\"100%\">\n";
			echo "<tr><td>id</td><td>Intitul&eacute;</td></tr>\n";
			foreach( $matieres as $matiere ) {
				echo "<tr>";
				echo "<td>" . $matiere["id_matiere"] . "</td>\n";
				echo "<td>" . $matiere["intitule"] . "</td>\n";
				echo "</tr>\n";
			}
			echo "</table>\n";
		}
		echo "</td>\n";
		
		echo "<td class=\"adminbox\">\n";
		echo "<div class=\"subcat_title\">Liste des Salles</div>\n";
		$table_name = $mysql -> get_table( "Salles" );
		$salles = $mysql -> select_query( "SELECT * FROM $table_name" );
		if( $salles != null ) {
			echo "<table width=\"100%\">\n";
			echo "<tr><td>id</td><td>Num&eacute;ro</td><td>Battiment</td><td>Nom</td></tr>\n";
			foreach( $salles as $salle ) {
				echo "<tr>";
				echo "<td>" . $salle["id_salle"] . "</td>\n";
				echo "<td>" . $salle["numero"] . "</td>\n";
				echo "<td>" . $salle["battiment"] . "</td>\n";
				echo "<td>" . $salle["nom"] . "</td>\n";
				echo "</tr>\n";
			}
			echo "</table>\n";
		}
		echo "</td>\n";
		
		echo "</tr>\n";
		echo "</table>\n";
	}
}
?>
Return current item: PhpScheduler