/**
  * Renders default template views, based on the model and action supplied (including
  * header and footer views).
  *
  * @param   $model              The name of the model file
  * @param   $action             When specified, name of the file ($file used as dir name)
  * @param   $html               When specified, name of the file ($file used as dir name)
  * @param   $caching_enabled    (optional): When specified, name of the file ($file used as dir name)
  */
 function render($model, $action = null, $html = false, $caching_enabled = true)
 {
     $this->load("header");
     // Start caching everything rendered.  We start this after the
     // header, since the header may contain user session information
     // that shouldn't be cached.
     if ($caching_enabled) {
         $cache = new CacheModel();
         $cache->start();
     }
     // Add a container DIV to the view HTML about to be inclued.
     if ($html) {
         echo '<div class="' . $model . '">';
     }
     // Load this specific view
     $this->load($model, $action);
     // Close the container DIV.
     if ($html) {
         echo '</div>';
     }
     $this->load("footer");
     // Stop caching.
     if ($caching_enabled) {
         $cache->end();
     }
 }
Esempio n. 2
0
 /**
  * Renders default template views, based on the model and action supplied (including
  * header and footer views).
  * @param   $model              The name of the model file
  * @param   $action             When specified, name of the file ($file used as dir name)
  * @param   $html               When specified, name of the file ($file used as dir name)
  * @param   $caching_enabled    (optional): When specified, name of the file ($file used as dir name)
  */
 public function render($model, $action = null, $html = false, $caching_enabled = true)
 {
     $this->loadView("head");
     if ($model == 'site' && $action == 'home') {
     } else {
         if ($model == 'enterprise') {
             if ($action != 'login') {
                 $this->loadView("enterprise_header");
             }
         } else {
             $this->loadView("header");
         }
     }
     // Start caching everything rendered.  We start this after the
     // header, since the header may contain user session information
     // that shouldn't be cached.
     if ($caching_enabled) {
         $cache = new CacheModel();
         $cache->start();
     }
     // Add a container DIV to the view HTML about to be inclued.
     if ($html) {
         echo "\n";
         echo '<div data-role="content" class="ui-content2">';
         echo "\n";
         echo '<div class="' . $model . '"> <div id="header_msg" >' . $this->get_msg() . '</div>';
         echo "\n";
     }
     // Load this specific view
     $this->model = $model;
     $this->action = $action;
     $this->loadView($this->model, $this->action);
     // Close the container DIV.
     if ($html) {
         echo "\n";
         echo '</div>';
         echo "\n";
         echo '</div><!--data-role="content"-->';
         echo "\n";
     }
     $this->loadView("footer");
     if ($model == 'enterprise') {
         $this->loadView("enterprise_panel");
     } else {
         $this->loadView("panel");
     }
     // Stop caching.
     if ($caching_enabled) {
         $cache->end();
     }
 }