47 lines
No EOL
1 KiB
PHP
47 lines
No EOL
1 KiB
PHP
<?php
|
|
namespace Controllers;
|
|
|
|
use Smarty\Smarty;
|
|
|
|
/**
|
|
* Le controller de la partie accessible uniquement par l'admin
|
|
* @author Yasser
|
|
*/
|
|
|
|
class MotherCtrl {
|
|
|
|
protected array $_arrData = array(); // ou = []
|
|
|
|
/**
|
|
* Méthode d'affichage des pages
|
|
*/
|
|
protected function _display($strView, bool $boolDisplay = true){
|
|
|
|
$objSmarty = new Smarty();
|
|
$objSmarty->registerPlugin('modifier', 'vardump', 'var_dump');
|
|
$objSmarty->caching = false;
|
|
|
|
$objSmarty->force_compile = true;
|
|
|
|
$objSmarty->compile_check = true;
|
|
|
|
foreach($this->_arrData as $key=>$value){
|
|
$objSmarty->assign($key, $value);
|
|
}
|
|
|
|
$objSmarty->assign("success_message", $_SESSION['success']??'');
|
|
unset($_SESSION['success']);
|
|
|
|
if (isset($_SESSION['error'])){
|
|
$objSmarty->assign("arrError", array($_SESSION['error']));
|
|
unset($_SESSION['error']);
|
|
}
|
|
|
|
if ($boolDisplay){
|
|
$objSmarty->display("views/".$strView.".tpl");
|
|
}else{
|
|
return $objSmarty->fetch("views/".$strView.".tpl");
|
|
}
|
|
}
|
|
|
|
} |