public function editAction() { if (Zend_Auth::getInstance()->getIdentity()->role != 'admin') { $this->_forms['edit']->removeElement('path'); } $id = $this->_request->getParam('id'); $page = $this->_modelMapper->find($id, new Pages_Model_Pages()); if (is_null($page)) { $this->_redirector->gotoSimpleAndExit('index'); } if ($this->_request->getParam('dataPage')) { $dataPage = $this->_request->getParam('dataPage'); $page->setOptions($dataPage); $this->setUploadImage($page); $markdown = $dataPage['contentMarkdown']; $context_html = Michelf\MarkdownExtra::defaultTransform($markdown); $page->setContentHtml($context_html); $this->_modelMapper->save($page); $this->_redirector->gotoUrlAndExit($this->_request->getParam('currentUrl')); } parent::editAction(); $config = array(Zend_Navigation_Page_Mvc::factory(array('label' => 'На сайт', 'uri' => $page->getPath() != 'home' ? '/' . $page->getPath() . '/' : '/'))); $containerNav = new Zend_Navigation($config); $this->view->container_nav = $containerNav; }
public function indexAction() { parent::indexAction(); $config = array(Zend_Navigation_Page_Mvc::factory(array('label' => 'На сайт', 'uri' => '/pipeline/'))); $containerNav = new Zend_Navigation($config); $editUrlOptions = array('module' => 'admin', 'controller' => 'pages', 'action' => 'edit', 'id' => $this->getPageModule('pipeline')->getId()); $this->view->assign(array('editUrlOptions' => $editUrlOptions, 'container_nav' => $containerNav)); }
public function listAction() { $this->view->assign(array('breadcrumbs' => $this->containerNavigation($this->_request->getParam('id')), 'current_category' => $this->_request->getParam('id'))); $editUrlOptions = array('module' => 'admin', 'controller' => 'pages', 'action' => 'edit', 'id' => $this->getPageModule('catalog')->getId()); $config = array(Zend_Navigation_Page_Mvc::factory(array('label' => 'На сайт', 'uri' => '/catalog/' . $this->_modelMapper->getFullPathById($this->_request->getParam('id'))))); $containerNav = new Zend_Navigation($config); $this->view->assign(array('editUrlOptions' => $editUrlOptions, 'container_nav' => $containerNav)); $this->forward('index', 'products', 'admin', array('category_id' => $this->_getParam('id'))); return; }
public function indexAction() { if ($this->_request->getParam('page')) { $this->view->assign('currentPage', $this->_request->getParam('page')); } $noReply = $this->getNoReply(); if (!empty($noReply)) { $this->view->assign('no_reply', $noReply); } $pageItems = $this->getForums(); if (!empty($pageItems)) { $pageItems = $this->paginationView($pageItems); $this->view->assign('forums', $pageItems); } $config = array(Zend_Navigation_Page_Mvc::factory(array('label' => 'На сайт', 'uri' => $this->getRequest()->getParam('page') ? '/forum/?page=' . $this->getRequest()->getParam('page') : '/forum/'))); $containerNav = new Zend_Navigation($config); $editUrlOptions = array('module' => 'admin', 'controller' => 'pages', 'action' => 'edit', 'id' => $this->getPageModule('forum')->getId()); $this->view->assign(array('editUrlOptions' => $editUrlOptions, 'container_nav' => $containerNav)); }
public function editAction() { $request = $this->getRequest(); $itemId = $request->getParam('id'); if (is_null($itemId)) { $this->_redirector->gotoRouteAndExit(array('module' => 'admin', 'controller' => 'pipeline-property', 'action' => 'index'), 'adminEdit', true); } $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $pipelineProperty = $pipelinePropertyMapper->find($itemId, new Pipeline_Model_PipelineProperty()); if (is_null($pipelineProperty)) { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } $form = new Admin_Form_PipelinePropertyEdit(); $dataPage = $pipelineProperty->getOptions(); foreach ($dataPage as $key => $value) { $form->setDefault($key, $value); } if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $pipelineProperty = new Pipeline_Model_PipelineProperty($form->getValues()); $pipelinePropertyMapper = new Pipeline_Model_Mapper_PipelineProperty(); $pipelineProperty->setSistemName(strtolower($form->getValue('sistemName'))); $pipelinePropertyMapper->save($pipelineProperty); $this->_redirector->gotoRouteAndExit(array('module' => 'admin', 'controller' => 'pipeline-property', 'action' => 'index'), 'adminEdit', true); } $form->setDefaults($request->getPost()); $this->view->formData = $form->getValues(); } $this->view->form = $form; $config = array(Zend_Navigation_Page_Mvc::factory(array('label' => 'Отменить', 'module' => 'admin', 'controller' => 'pipeline-property', 'route' => 'adminEdit', 'resource' => 'pipeline-property'))); $containerNav = new Zend_Navigation($config); $this->view->container_nav = $containerNav; }
public function editAction() { $itemId = $this->_request->getParam('id'); if (is_null($itemId)) { $this->getRedirector()->gotoSimpleAndExit('index'); } $page = $this->getModelMapper()->find($itemId, $this->getModel()); if (is_null($page)) { throw new Zend_Controller_Action_Exception("Страница не найдена", 404); } //$this->view->item = $page; $form = $this->getForm('edit'); $form->addElement('hidden', 'currentUrl'); $element = $form->getElement('currentUrl'); $element->setValue($this->_hostHttp->getServer('REQUEST_URI')); $form->getDisplayGroup('basic')->addElement($element); $dataPage = $page->getOptions(); foreach ($dataPage as $key => $value) { $form->setDefault($key, $value); } foreach ($form->getElements() as $key => $element) { if ($element instanceof Zend_Form_Element_Image) { $imageValue = $form->getValue($element->getAttrib('data-input')) != '' ? $form->getValue($element->getAttrib('data-input')) : '/files/images/product/2012-05-22_foto_nv.jpg'; $form->setDefault($element->getName(), $imageValue); } } if ($this->_hostHttp->isPost()) { if ($form->isValid($this->_hostHttp->getPost())) { $this->saveFormData($form); $this->clearCache($this->_getNamespace()); $this->getRedirector()->gotoUrlAndExit($this->_request->getParam('currentUrl')); } $form->setDefaults($form->getValues()); } $colsTable = $this->getModelMapper()->getDbTable()->info('cols'); $uri = in_array('full_path', $colsTable) ? $page->getFullPath() : $page->getPath(); $config = array(Zend_Navigation_Page_Mvc::factory(array('label' => 'На сайт', 'uri' => '/' . strtolower($this->getNameModule()) . '/' . $uri . '/'))); $containerNav = new Zend_Navigation($config); $this->view->assign(array('item' => $page, 'form' => $form, 'container_nav' => $containerNav)); }