Example #1
0
 public function renderizar($vista, $item = false, $noLayout = false)
 {
     if ($item) {
         self::$_item = $item;
     }
     $widgets = $this->getWidgets();
     $acl = $this->_acl;
     $js = array();
     if (count($this->_js)) {
         $js = $this->_js;
     }
     $_layoutParams = array('ruta_css' => BASE_URL . 'views/layout/' . $this->_template . '/css/', 'fonts' => BASE_URL . 'views/layout/' . $this->_template . '/fonts/', 'ruta_img' => BASE_URL . 'views/layout/' . $this->_template . '/img/', 'ruta_js' => BASE_URL . 'views/layout/' . $this->_template . '/js/', 'item' => self::$_item, 'js' => $js);
     //$widgets = $this->getWidgets();
     //$acl = $this->_acl;
     $rutaView = $this->_rutas['view'] . $vista . '.phtml';
     if (is_readable($rutaView)) {
         if ($noLayout) {
             include_once $rutaView;
             exit;
         }
         include_once ROOT . 'views' . DS . 'layout' . DS . $this->_template . DS . 'header.php';
         include_once $rutaView;
         include_once ROOT . 'views' . DS . 'layout' . DS . $this->_template . DS . 'footer.php';
     } else {
         throw new Exception('Error de vista');
     }
 }
Example #2
0
 public function renderizar($vista, $item = false, $noLayout = false)
 {
     if ($item) {
         self::$_item = $item;
     }
     $this->template_dir = ROOT . 'views' . DS . 'layout' . DS . $this->_template . DS;
     $this->config_dir = ROOT . 'views' . DS . 'layout' . DS . $this->_template . DS . 'configs' . DS;
     $this->cache_dir = ROOT . 'tmp' . DS . 'cache' . DS;
     $this->compile_dir = ROOT . 'tmp' . DS . 'template' . DS;
     $_params = array('ruta_css' => BASE_URL . 'views/layout/' . $this->_template . '/css/', 'ruta_img' => BASE_URL . 'views/layout/' . $this->_template . '/img/', 'ruta_js' => BASE_URL . 'views/layout/' . $this->_template . '/js/', 'js' => $this->_js, 'js_plugin' => $this->_jsPlugin, 'link_plugin' => $this->_linkPlugin, 'root' => BASE_URL, 'configs' => array('app_name' => APP_NAME, 'app_slogan' => APP_SLOGAN, 'app_company' => APP_COMPANY));
     if (is_readable($this->_rutas['view'] . $vista . '.tpl')) {
         if ($noLayout) {
             $this->template_dir = $this->_rutas['view'];
             $this->display($this->_rutas['view'] . $vista . '.tpl');
             exit;
         }
         $this->assign('_contenido', $this->_rutas['view'] . $vista . '.tpl');
     } else {
         throw new Exception('Error de vista');
     }
     $this->assign('widgets', $this->getWidgets());
     $this->assign('_acl', $this->_acl);
     $this->assign('_layoutParams', $_params);
     $this->display('template.tpl');
 }
Example #3
0
 public function renderizar($vista, $item = false, $noLayout = FALSE)
 {
     //para saber cuando va ha salir un menu seleccionado
     if ($item) {
         self::$_item = $item;
     }
     //Establece los directorios necesarios para la plantilla.
     $this->template_dir = ROOT . 'layouts' . DS . $this->_template . DS;
     $this->config_dir = ROOT . 'layouts' . DS . $this->_template . DS . 'configs' . DS;
     //throw new Exception(print_r($this->template_dir));
     $this->cache_dir = ROOT . 'tmp' . DS . 'cache' . DS;
     $this->compile_dir = ROOT . 'tmp' . DS . 'template' . DS;
     /*Si no esta autenticado entonces los valores del menu principal seran los de registro
       if(!Session::get('autenticado')){
           $menu[] = array(
               'id' => 'registro',
               'titulo' => 'Registro',
               'enlace' => BASE_URL . 'usuarios/registro',
               'imagen' => 'icon-book'
               );
       */
     //Establece los parametros para renderizar la vista
     $_params = array('ruta_css' => BASE_URL . 'layouts/' . $this->_template . '/css/', 'ruta_js' => BASE_URL . 'layouts/' . $this->_template . '/js/', 'js' => $this->_js, 'js_plugin' => $this->_jsPlugin, 'root' => BASE_URL, 'configs' => array('app_name' => APP_NAME, 'app_slogan' => APP_SLOGAN, 'app_company' => APP_COMPANY), 'user' => Session::get('usuario'));
     /*
     if (Session::get('autenticado') == true){
     $_params = array_merge($_params, array(
         'usuario' => ucwords(strtolower(session::get('nombre') . " " . session::get('ape_pat') . " " . session::get('ape_mat'))),
         'cetpro_clave' => implode($this->_modelo->getClaveCetpro(session::get('id_cetpro'))),
         'cetpro' => implode($this->_modelo->getCetpro(session::get('id_cetpro'))),
         'role' => implode($this->_modelo->getRole(session::get('level'))),
     ));
     }
     */
     //si existe el archivo de la vista se asigna ha este y si no hay se coloca el predeterminado
     if (is_readable($this->_rutas['view'] . $vista . '.tpl')) {
         if ($noLayout) {
             //throw new Exception('no hay layout');
             $this->template_dir = $this->_rutas['view'];
             //el metodo 'display' muestra la vista predeterminada en pantalla
             $this->display($this->_rutas['view'] . $vista . '.tpl');
             exit;
         }
         //el metodo 'assign' asigna la vista hallada al contenido.
         $this->assign('_contenido', $this->_rutas['view'] . $vista . '.tpl');
     } else {
         throw new Exception('Error de vista');
     }
     //Envia los widges a la vista (principalisimo)
     $this->assign('widgets', $this->getWidgets());
     //el metodo 'assign' asigna los permisos a la variable '_acl'.
     $this->assign('_acl', $this->_acl);
     //el metodo 'assign' asigna los parametros a la variable '_layoutParams'.
     $this->assign('_layoutParams', $_params);
     //el metodo 'display' de Smarty muestra la plantilla con la vista y todo.
     $this->display('template.tpl');
 }