/** * Get instance * * @return Cms_Model_CategoryMapper */ public static function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
protected function _fetchCategories($criteria, $orderBy, &$paging) { return Cms_Model_CategoryMapper::getInstance()->fetchAll($criteria, $orderBy, $paging); }
public function categoriesAction() { if ($this->getRequest()->isXmlHttpRequest()) { $this->getHelper('layout')->disableLayout(); } $typeId = $this->getRequest()->getParam('type_id'); $pageId = $this->getRequest()->getParam('page_id'); //get all categories $categories = Cms_Model_CategoryMapper::getInstance()->fetchZendNavigationArray(array('type_id' => $typeId), array('parent_id ASC')); //get defined categories $checked = array(); if (isset($pageId) && $pageId > 0) { $page = new Cms_Model_Page(); if (Cms_Model_PageMapper::getInstance()->find($pageId, $page)) { $checked = Cms_Model_PageMapper::getInstance()->fetchCategories($page); } } $this->_helper->json(array('categories' => $categories, 'checked' => $checked)); }
public function categoryDeleteAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $data = $this->getRequest()->getPost('data'); $id = $this->_getParam('id'); //delete category Cms_Model_CategoryMapper::getInstance()->delete($id); $data = array('success' => true, 'message' => $this->translate("Category deleted")); $this->_helper->json->sendJson($data); }