/** * @return array */ public function getCategoryArray() { $manufactureCategoryMapper = new Manufacture_Model_Mapper_ManufactureCategories(); $categoryArray = array(); $categoryArray[] = 'нет'; foreach ($manufactureCategoryMapper->fetchAll() as $category) { $categoryArray[$category->getId()] = $category->getTitle(); } return $categoryArray; }
public function editAction() { if ($this->_request->getParam('dataPage')) { $dataPage = $this->_request->getParam('dataPage'); $id = $this->_request->getParam('id'); $categories = $this->_modelMapper->find($id, $this->_model); $categories->setOptions($dataPage); $this->setUploadImage($categories); $markdown = $dataPage['contentMarkdown']; $context_html = Michelf\MarkdownExtra::defaultTransform($markdown); $categories->setContentHtml($context_html); $this->_modelMapper->save($categories); $this->_redirector->gotoUrlAndExit('/manufacture/' . $categories->getPath()); } parent::editAction(); }
public function viewAction() { $request = $this->getRequest(); $fullPath = $request->getParam('fullPath'); $manufactureMapper = new Manufacture_Model_Mapper_Manufacture(); $manufacture = $manufactureMapper->findByFullPath($fullPath, new Manufacture_Model_Manufacture()); if (is_null($manufacture)) { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } if (!is_null($this->getRequest()->getParam('json')) && Zend_Auth::getInstance()->hasIdentity()) { $this->forward('json', 'manufacture', 'admin', array('id' => $manufacture->getId())); return; } if (Zend_Auth::getInstance()->hasIdentity()) { $this->_request->setParams(array('dataItem' => array('controller' => 'manufacture', 'id' => $manufacture->getId(), 'active' => $manufacture->getActive(), 'deleted' => $manufacture->getDeleted()))); } $manufactureCategoryMapper = new Manufacture_Model_Mapper_ManufactureCategories(); $manufactureCategory = $manufactureCategoryMapper->find($manufacture->getCategoryId(), new Manufacture_Model_ManufactureCategories()); if ($manufacture->getDeleted() != '0') { if (!Zend_Auth::getInstance()->hasIdentity() && $manufacture->getDeleted() != '0') { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } $this->_redirector->gotoRouteAndExit(array('module' => 'admin', 'controller' => 'manufacture-categories', 'action' => 'list', 'id' => $manufactureCategory->getId()), 'adminEdit', true); } $this->view->assign(array('manufacture' => $manufacture, 'meta_description' => $manufacture->getMetaDescription(), 'meta_keywords' => $manufacture->getMetaKeywords(), 'adminPath' => 'manufacture/edit/' . $manufacture->getId(), 'category' => $manufactureCategory)); if ($manufacture->getActive() != '1' && !Zend_Auth::getInstance()->hasIdentity()) { $this->view->assign(array('title' => $manufacture->getTitle())); throw new Zend_Controller_Action_Exception("Страница временно не доступна", 403); } }
function getManufactureCategory($category_id) { $manufactureCategoryMapper = new Manufacture_Model_Mapper_ManufactureCategories(); $manufactureCategory = $manufactureCategoryMapper->find($category_id, new Manufacture_Model_ManufactureCategories()); return $manufactureCategory; }