Copie propre du code final de Folliow (projet d'équipe DWWM)
This commit is contained in:
commit
eed64cfeb6
67 changed files with 17897 additions and 0 deletions
52
controllers/MotherCtrl.php
Normal file
52
controllers/MotherCtrl.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
namespace Controllers;
|
||||
|
||||
use Smarty\Smarty;
|
||||
|
||||
/**
|
||||
* Controller Mère qui permet de gèrer l'affichage des pages
|
||||
* @author Yasser
|
||||
*/
|
||||
|
||||
class MotherCtrl {
|
||||
|
||||
protected array $_arrData = array(); // ou = []
|
||||
|
||||
/**
|
||||
* Méthode d'affichage des pages
|
||||
* @param string $strView Le fichier a afficher
|
||||
* @param bool $boolDisplay Booléen pour afficher web ou mail
|
||||
* @return page|object affiche la page ou retourne l'objet pour le mail
|
||||
*/
|
||||
protected function _display($strView, bool $boolDisplay = true){
|
||||
|
||||
$objSmarty = new Smarty();
|
||||
$objSmarty->registerPlugin('modifier', 'vardump', 'var_dump');
|
||||
$objSmarty->registerPlugin('modifier', 'file_exists', 'file_exists');
|
||||
$objSmarty->registerPlugin('modifier', 'stripos', 'stripos');
|
||||
$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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue