function getListe( $online='' ) { $categorie = new promotion(); $requete = "SELECT * FROM promotion"; $requete .= " WHERE num_promotion > 0"; if ( $online != '' ) $requete .= " AND online = '" . $online . "'"; $requete .= " ORDER BY titre ASC"; //echo $requete . "<br>"; $liste = mysql_query($requete); // Retourne un tableau $tableau = array(); if (mysql_num_rows($liste) != 0) { $i = 0; while($data = mysql_fetch_assoc($liste)) { // Tentative de chargement du commande if ( $categorie->load( $data["num_promotion"] ) ) { $tableau[$i] = new promotion(); $tableau[$i]->num_promotion = $categorie->num_promotion; $tableau[$i]->titre = $categorie->titre; $tableau[$i]->sous_titre = $categorie->sous_titre; $tableau[$i]->reduction = $categorie->reduction; $tableau[$i]->texte = $categorie->texte; $tableau[$i]->online = $categorie->online; $i++; } } } return $tableau; }
$mon_action = $_POST["mon_action"]; $num_promotion = $_POST["num_promotion"]; $promotion = new promotion(); //echo "--- mon_action : " . $mon_action . "<br>"; // On souhaite une modification if ($mon_action == "modification") { // Mise à jour de la base $promotion->gererDonnee( $_POST ); header("Location: ./liste.php"); } if ( $promotion->load( $num_promotion ) ) { $titre_page = "Modification d'une promotion"; $titre = stripcslashes( utf8_encode( $promotion->titre ) ); $sous_titre = stripcslashes( utf8_encode( $promotion->sous_titre ) ); $reduction = stripcslashes( utf8_encode( $promotion->reduction ) ); $texte = str_replace("\\", "", $promotion->texte); $checked_oui = ( $promotion->online == '1') ? "checked" : ""; $checked_non = ( $promotion->online == '1') ? "" : "checked"; } else { $titre_page = "Ajout d'une promotion"; $titre = ""; $sous_titre = ""; $reduction = ""; $texte = "";
<? include('../../include_connexion/connexion_site_on.php'); ?> <? // Récupération des données passées en paramètres $mon_action = $_POST["mon_action"]; $num_promotion = $_POST["num_promotion"]; $ordre = $_POST["ordre"]; $mouvement = $_POST["mouvement"]; $id_changement = $_POST["id_changement"]; $promotion = new promotion(); // Suppression d'un cours if ($mon_action == "suppression") { //echo "Suppression...<br>"; if ( $promotion->load( $num_promotion ) ) $promotion->supprimer(); } // Liste des promotions disponibles $liste_promotion = $promotion->getListe(); $menu = "promotion"; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <!-- Titre de la page et CSS --> <? include_once('../includes/head.php'); ?> <link rel="stylesheet" href="../css/modal-message.css" type="text/css">