Ejemplo n.º 1
0
} 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';
}
Ejemplo n.º 2
0
    // 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");
        $lecrivain = (int) htmlentities(strip_tags($_POST['lecrivain']), ENT_QUOTES, "UTF-8");
        // traitement ajout livres
        $livre_a_m = new LivreAdminManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE));
        $livre_a_m->insertBook($letitre, $ladescription, $lasortie, $lecrivain);
    }
    // to show form select fields
    $periode_m = new PeriodeManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE));
    $siecles = $periode_m->recupTous();
    $ecrivain_m = new EcrivainManager(MaPDO::getConnection(DB_SELECT, DB_USER, DB_PWD, TRUE));
    $ecrivains = $ecrivain_m->recupTous();
    include 'view/admin.php';
}