} elseif (isset($_GET['idecrivain'])) { // require all links in menu $periode_m = new PeriodeManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $menu = $periode_m->recupTous(); // récupération de l'écrivain en question $id = (int) $_GET['idecrivain']; $ecrivain_a_m = new EcrivainAdminManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $ecrivain = $ecrivain_a_m->recupJointure($id); $ids = explode('||', $ecrivain['ids']); $titres = explode('||', $ecrivain['titres']); $descriptions = explode('||', $ecrivain['descriptions']); include 'view/ecrivain.php'; } elseif (isset($_GET['idlivre'])) { // require all links in menu $periode_m = new PeriodeManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $menu = $periode_m->recupTous(); // récupération du livre $id = (int) $_GET['idlivre']; $livre_m = new LivreManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $livre = $livre_m->recupUn($id); include 'view/livre.php'; } else { // accueil // require all links in menu $periode_m = new PeriodeManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $menu = $periode_m->recupTous(); // random writer $ecrivain_m = new EcrivainManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $ecrivain_random = $ecrivain_m->recupUnRandom(); include 'view/accueil.php'; }
require 'model/EcrivainManager.php'; require 'model/EcrivainAdminManager.php'; require 'model/Periode.php'; require 'model/PeriodeManager.php'; require 'model/Livre.php'; require 'model/LivreManager.php'; require 'model/LivreAdminManager.php'; $manager = new EcrivainAdminManager(DB_SELECT, DB_USER, DB_PWD, true); $menu = new PeriodeManager(DB_SELECT, DB_USER, DB_PWD, true); $bonjour = new UserManagerClass(DB_SELECT, DB_USER, DB_PWD, true); $salut = $bonjour->recupUser(); $recup_menu = $menu->recupTousPeriode(); $auteur = new EcrivainManager(DB_SELECT, DB_USER, DB_PWD, true); $hasardecrivain = $auteur->hasardEcrivain(); $epoque = new PeriodeManager(DB_SELECT, DB_USER, DB_PWD, true); $bouquin = new LivreManager(DB_SELECT, DB_USER, DB_PWD, true); if (isset($_GET['idperiode'])) { $periode = $_GET['idperiode']; $ere = $epoque->recupUnPeriode($periode); require_once 'view/PeriodeVue.php'; } if (isset($_GET['idecrivain'])) { $numauteur = $_GET['idecrivain']; $recupauteur = $manager->detailEcrivain($numauteur); require_once 'view/EcrivainVue.php'; } if (isset($_GET['idlivre'])) { $id = $_GET['idlivre']; $livre = $bouquin->recupUnLivre($id); require_once 'view/LivreVue.php'; }
<?php // Contrôleur de l'affichage hors connexion // dependencies require 'model/MaPDOClass.php'; require 'model/Periode.php'; require 'model/Livre.php'; require 'model/Ecrivain.php'; // managers require 'model/PeriodeManager.php'; require 'model/LivreManager.php'; require 'model/EcrivainManager.php'; $periode_m = new PeriodeManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $ecrivain_m = new EcrivainManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $livre_m = new LivreManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $obj = $periode_m->recupUn(1); var_dump($obj); $obj = $ecrivain_m->recupUn(1); var_dump($obj); $obj = $livre_m->recupUn(1); var_dump($obj); header('Content-Type: text/html; charset=utf-8');
} // traitement modification livre if (isset($_POST['submitmodifierlivre'])) { $id = (int) $_POST['id']; $letitre = htmlentities(strip_tags($_POST['letitre']), ENT_QUOTES, "UTF-8"); $ladescription = htmlentities(strip_tags($_POST['ladescription']), ENT_QUOTES, "UTF-8"); $lasortie = htmlentities(strip_tags($_POST['lasortie']), ENT_QUOTES, "UTF-8"); $lecrivain = (int) htmlentities(strip_tags($_POST['lecrivain']), ENT_QUOTES, "UTF-8"); $livre_a_m = new LivreAdminManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $livre_a_m->updateBook($letitre, $ladescription, $lasortie, $lecrivain, $id); } } // affichage de la liste $ecrivain_m = new EcrivainAdminManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $ecrivains = $ecrivain_m->recupTous(); $livre_m = new LivreManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $livres = $livre_m->recupTous(); include 'view/manage.php'; } else { // treat add writer and add book if (isset($_POST['submitajouterecrivain'])) { $lenom = htmlentities(strip_tags($_POST['lenom']), ENT_QUOTES, "UTF-8"); $labio = htmlentities(strip_tags($_POST['labio']), ENT_QUOTES, "UTF-8"); $siecle = (int) htmlentities(strip_tags($_POST['siecle']), ENT_QUOTES, "UTF-8"); // traitement ajout écrivain $ecrivain_a_m = new EcrivainAdminManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE)); $ecrivain_a_m->insertWriter($lenom, $labio, $siecle); } elseif (isset($_POST['submitajouterlivre'])) { $letitre = htmlentities(strip_tags($_POST['letitre']), ENT_QUOTES, "UTF-8"); $ladescription = htmlentities(strip_tags($_POST['ladescription']), ENT_QUOTES, "UTF-8"); $lasortie = htmlentities(strip_tags($_POST['lasortie']), ENT_QUOTES, "UTF-8");