public function showAction() { $pageMapper = new PageMapper(); $id = $this->getRequest()->getParam('id'); $locale = $this->getRequest()->getParam('locale'); $page = $pageMapper->getPageByIdLocale($id, $locale); if ($page == null) { $this->getView()->set('content', 'page not found'); } else { $this->getLayout()->set('metaTitle', $page->getTitle()); $this->getLayout()->set('metaDescription', $page->getDescription()); $this->getLayout()->getHmenu()->add($page->getTitle(), $page->getPerma()); $this->getView()->set('content', $page->getContent()); } }
public function treatAction() { if ($this->getRequest()->getParam('id')) { $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('menuSite'), array('action' => 'index'))->add($this->getTranslator()->trans('editPage'), array('action' => 'treat', 'id' => $this->getRequest()->getParam('id'))); } else { $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('menuSite'), array('action' => 'index'))->add($this->getTranslator()->trans('menuActionNewSite'), array('action' => 'treat')); } $this->getView()->set('contentLanguage', $this->getConfig()->get('content_language')); $pageMapper = new PageMapper(); if ($this->getRequest()->getParam('id')) { if ($this->getRequest()->getParam('locale') == '') { $locale = ''; } else { $locale = $this->getRequest()->getParam('locale'); } $this->getView()->set('page', $pageMapper->getPageByIdLocale($this->getRequest()->getParam('id'), $locale)); } $this->getView()->set('languages', $this->getTranslator()->getLocaleList()); $this->getView()->set('multilingual', (bool) $this->getConfig()->get('multilingual_acp')); if ($this->getRequest()->isPost()) { $model = new PageModel(); if ($this->getRequest()->getParam('id')) { $model->setId($this->getRequest()->getParam('id')); } $model->setDescription($this->getRequest()->getPost('description')); $model->setTitle($this->getRequest()->getPost('pageTitle')); $model->setContent($this->getRequest()->getPost('pageContent')); if ($this->getRequest()->getPost('pageLanguage') != '') { $model->setLocale($this->getRequest()->getPost('pageLanguage')); } else { $model->setLocale(''); } $model->setPerma($this->getRequest()->getPost('pagePerma')); $pageMapper->save($model); $this->redirect(array('action' => 'index')); } }