Example #1
0
 public function before()
 {
     parent::before();
     if (!$this->execute) {
         return;
     }
     $params = $this->pixie->config->get('parameters');
     $this->titleBase = trim($params['page_title_base']);
     $this->initView($this->mainView);
     if (!$this->installationProcess) {
         $className = isset($this->modelName) && $this->modelName ? $this->modelName : $this->get_real_class($this);
         $category = new Category($this->pixie);
         $this->view->sidebar = $category->getCategoriesSidebar();
         $this->view->search_category = $this->getSearchCategory($className);
         $this->view->search_subcategories = $this->getAllCategories($this->view->sidebar);
         $this->view->pages = $this->pixie->orm->get('page')->where('is_active', 1)->find_all()->as_array();
         $this->view->cart = $this->getCart();
         $this->view->cartItems = $this->getCart()->items->find_all()->as_array();
         if ($className != "Home") {
             $this->view->categories = $category->getRootCategories();
         }
         $classModel = "App\\Model\\" . $className;
         if (class_exists($classModel)) {
             $this->model = new $classModel($this->pixie);
         } else {
             $this->model = null;
         }
     }
 }
Example #2
0
 public function before()
 {
     parent::before();
     if (!$this->execute) {
         return;
     }
     $this->initView('main');
     if (!$this->installationProcess) {
         $className = $this->get_real_class($this);
         $category = new Category($this->pixie);
         $this->view->sidebar = $category->getCategoriesSidebar();
         $this->view->search_category = $this->getSearchCategory($className);
         $this->view->search_subcategories = $this->getAllCategories($this->view->sidebar);
         if ($className != "Home") {
             $this->view->categories = $category->getRootCategories();
         }
         $classModel = "App\\Model\\" . $className;
         if (class_exists($classModel)) {
             $this->model = new $classModel($this->pixie);
         } else {
             $this->model = null;
         }
     }
 }