public function viewAction() { $pageItem = $this->_itemMapper->findByFullPath($this->_request->getParam('fullPath'), new Oil_Model_Oil()); if (is_null($pageItem)) { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } $this->getJson($pageItem); $this->setParamsDataItem($pageItem); $this->checkDeleted($pageItem); $category = $this->_categoriesMapper->find($pageItem->getCategoryId(), new Oil_Model_OilCategories()); $this->setMetaHead($pageItem); $this->view->assign(array('category' => $category, 'title' => $pageItem->getTitle(), 'pageItem' => $pageItem)); $this->checkActive($pageItem); }
public function editAction() { if ($this->_request->getParam('dataPage')) { $dataPage = $this->_request->getParam('dataPage'); $id = $this->_request->getParam('id'); $item = $this->_modelMapper->find($id, $this->_model); $item->setOptions($dataPage); $this->setUploadImage($item); if ($markdown = $dataPage['contentMarkdown']) { $context_html = Michelf\MarkdownExtra::defaultTransform($markdown); $item->setContentHtml($context_html); } $category = $this->_modelCategoriesMapper->find($item->getCategoryId(), new Oil_Model_OilCategories()); $fullPath = $category ? $category->getPath() . '/' . $item->getPath() : $item->getPath(); $item->setFullPath($fullPath); $url = '/oil/' . $fullPath; $this->_modelMapper->save($item); $this->getRedirector()->gotoUrlAndExit($url); } parent::editAction(); }