Skip to content
Snippets Groups Projects
Commit ce1e779f authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Recréation du code terminé.

parent 2313b3d2
No related branches found
No related tags found
No related merge requests found
......@@ -11,13 +11,11 @@ class ControleurAuteur
public static function lireAuteur()
{
$titre = "un auteur";
$numAuteur = $_GET["numAuteur"];
$auteur = Auteur::getAuteurByNum($numAuteur);
include("resources/views/debut.php");
include("resources/views/menu.html");
include("resources/views/unAuteur.php");
include("resources/views/fin.html");
if(empty($_GET["numAuteur"])){
die("Le paramètre numAuteur n'est pas spécifié.");
}
$auteur = Auteur::getAuteurByNum($_GET["numAuteur"]);
return view('auteurs.auteur-info', ['auteur' => $auteur]);
}
}
......
<?php
function view(string $viewName, array $args = []): bool
function view(string $viewName, array $args = []): string
{
$viewPathParts = explode(".", $viewName);
$viewPath = "";
......@@ -10,9 +10,8 @@ function view(string $viewName, array $args = []): bool
if(file_exists($viewPath)){
extract($args);
include $viewPath;
return true;
return "";
}else{
echo "La vue " . $viewName . " est introuvable.";
return false;
return "La vue " . $viewName . " est introuvable.";
}
}
\ No newline at end of file
......@@ -9,9 +9,13 @@ require_once("controller/ControleurAuteur.php");
Database::connect();
$action = "lireAuteurs";
if (isset($_GET["action"]) && in_array($_GET["action"], get_class_methods('ControleurAuteur'))) {
if(empty($_GET["action"])){
ControleurAuteur::lireAuteurs();
}else{
if(in_array($_GET["action"], get_class_methods('ControleurAuteur'))){
$action = $_GET["action"];
}
ControleurAuteur::$action();
}
}
?>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Info de l'auteur</title>
<?=view('layouts.head')?>
</head>
<body class="">
<div class="container">
<h1>Information de l'auteur</h1>
<?=$auteur->afficher()?>
</div>
<?=view('layouts.footer')?>
</body>
</html><?php
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title><?php echo $titre; ?></title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
</body>
</html>
<?php
foreach ($tableauAffichage as $ligne) {
echo $ligne;
}
?>
<nav>
<a href="index.php?action=lireAuteurs">tous les auteurs</a>
</nav>
<?php
$auteur->afficher();
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment