コード例 #1
0
 public function indexAction()
 {
     $fullPath = $this->getFullPath();
     $categoriesMapper = new Pipeline_Model_Mapper_PipelineCategories();
     //Получаем категорию по переданному url
     $category = $categoriesMapper->findByFulPath($fullPath, new Pipeline_Model_PipelineCategories());
     //Если нет категории с таким url
     if (is_null($category)) {
         //throw new Zend_Controller_Action_Exception("Страница не найдена", 404);
         //перенаправляем в товар, может быть это товар
         $this->forward('view', 'pipeline');
         return;
     }
     $this->getJson($category);
     $this->setParamsDataItem($category);
     $this->checkDeleted($category);
     $this->view->assign(array('category' => $category, 'title' => $category->getTitle(), 'adminPath' => 'pipeline-categories/list/' . $category->getId()));
     $this->checkActive($category);
     if ($category->getId() !== 0) {
         $select = $categoriesMapper->getDbTable()->select();
         $select->where('parent_id = ?', $category->getId())->where('deleted != ?', 1)->where('active != ?', 0)->order('sorting ASC');
         $categories = $categoriesMapper->fetchAll($select);
         if (empty($categories)) {
             $this->forward('index', 'pipeline');
             return;
         }
         $this->view->assign('categories', $categories);
     } else {
         $this->redirect('/pipeline/', array('code' => 301));
         return;
     }
 }
コード例 #2
0
 public function indexAction()
 {
     $fullPath = $this->getFullPath();
     $categoriesMapper = new Pipeline_Model_Mapper_PipelineCategories();
     $category = $categoriesMapper->findByFulPath($fullPath, new Pipeline_Model_PipelineCategories());
     if (is_null($category)) {
         throw new Zend_Controller_Action_Exception("Страница не найдена", 404);
     }
     $this->view->category = $category;
     $this->view->title = $category->getTitle();
     $current_category_id = $category->getId();
     $pipelineMapper = new Pipeline_Model_Mapper_Pipeline();
     $select = $pipelineMapper->getDbTable()->select()->where('deleted != ?', 1)->where('active != ?', 0)->where('category_id = ?', $current_category_id)->order('sorting ASC');
     $pipelineItems = $pipelineMapper->fetchAll($select);
     if (!empty($pipelineItems)) {
         $this->view->listItems = $pipelineItems;
     } else {
         $this->forward('view', 'categories');
         return;
     }
 }