Пример #1
0
 public static function getInstance()
 {
     if (self::$instancia == NULL) {
         self::$instancia = new CatalogManager();
     }
     return self::$instancia;
 }
Пример #2
0
 public function show($logicPath, $type, $vars, $permision, $styles, $scripts)
 {
     $_CATALOGS = CatalogManager::getInstance();
     $root = "templates/" . $this->template . "/";
     switch ($type) {
         case "view":
             $viewId = $logicPath;
             //El name logico de la view
             $openView = $this->getURLFromView($viewId, $this->bindings);
             //Obtengo el name url de esta view
             if (strlen($openView) > 0) {
                 $view = $this->viewDirectory . $openView;
             } else {
                 $view = $this->viewDirectory . "error/404.php";
             }
             if (!file_exists($view)) {
                 $view = $this->viewDirectory . "error/404.php";
             }
             //echo "Loading $view";
             if (file_exists("templates/" . $this->template . "/template.php")) {
                 require "templates/" . $this->template . "/template.php";
             } else {
                 $this->errors->addError(ErrorManager::CANIS_FATAL, "Invalid template " . $this->template);
             }
             break;
         case "panel":
             $panelId = $logicPath;
             $openView = $this->getURLFromView($panelId, $this->bindings);
             if (strlen($openView) > 0) {
                 $view = $this->panelDirectory . $openView;
             } else {
                 $view = $this->panelDirectory . "error/404.php";
             }
             require_once 'templates/head.php';
             require $view;
             break;
         default:
             $view = $this->viewDirectory . "error/404.php";
             require "templates/" . $this->template . "/template.php";
             break;
     }
     return $view;
 }