Пример #1
0
 /**
  * Méthode public de rendu de la page en cours
  * @param bool $pDisplay
  * @return string
  */
 public function render($pDisplay = true)
 {
     $smarty = new Smarty();
     Core::setupSmarty($smarty);
     if (!$smarty->template_exists($this->template)) {
         if (Core::debug()) {
             trigger_error("Le template <b>" . $this->template . "</b> est introuvable", E_USER_ERROR);
         } else {
             Go::to404();
         }
     }
     $conf = get_class_vars('core\\application\\Configuration');
     $terms = Dictionary::terms();
     $globalVars = $this->getGlobalVars();
     $smarty->assign_by_ref("configuration", $conf);
     $smarty->assign_by_ref("request_async", Core::$request_async);
     $smarty->assign_by_ref("dictionary", $terms);
     foreach ($this->forms as $n => &$form) {
         $smarty->register_object("form_" . $n, $form, array("display", "name", "getValue", "getLabel", "getOptions", "isChecked"));
     }
     foreach ($globalVars as $n => &$v) {
         $smarty->assign_by_ref($n, $v);
     }
     if (!Core::debug()) {
         $smarty->load_filter('output', 'gzip');
     }
     return $smarty->fetch($this->template, null, null, $pDisplay);
 }
Пример #2
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->smarty = new Smarty();
     $this->smarty->assign("path_to_theme", Core::$path_to_theme);
     $this->smarty->assign("server_url", Configuration::$server_url);
     Core::setupSmarty($this->smarty);
     $this->phpmailer = new PHPMailer();
 }