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

View helper.

parent 3166b233
Branches
No related tags found
No related merge requests found
<?php
class ControleurAdherants
{
}
\ No newline at end of file
<?php
require_once("models/Auteur.php");
class ControleurAuteur {
class ControleurAuteur
{
public static function lireAuteurs() {
public static function lireAuteurs()
{
$titre = "les auteurs";
$tableau = Auteur::getAllAuteurs();
$tableauAffichage = array();
......@@ -20,7 +22,8 @@
include("resources/views/fin.html");
}
public static function lireAuteur() {
public static function lireAuteur()
{
$titre = "un auteur";
$numAuteur = $_GET["numAuteur"];
$auteur = Auteur::getAuteurByNum($numAuteur);
......
<?php
function view(string $viewName, array $args): bool
{
$viewPathParts = explode(".", $viewName);
$viewPath = "";
foreach ($viewPathParts as $pathPart){
$viewPath .= "/" . $pathPart;
}
$viewPath = "resources/views" . $viewPath . ".php";
if(file_exists($viewPath)){
extract($args);
include $viewPath;
return true;
}else{
echo "La vue " . $viewName . " est introuvable.";
return false;
}
}
\ No newline at end of file
......@@ -2,12 +2,16 @@
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once("config/Database.php");
Database::connect();
require_once("helpers/views.php");
require_once("controller/ControleurAuteur.php");
Database::connect();
$action = "lireAuteurs";
if (isset($_GET["action"]) && in_array($_GET["action"], get_class_methods('ControleurAuteur'))) {
$action = $_GET["action"];
}
controleurAuteur::$action();
ControleurAuteur::$action();
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment