/** * * @param type $urlkey */ public function detail($urlkey) { $view = $this->getActionView(); $layoutView = $this->getLayoutView(); $news = App_Model_News::first(array('urlKey = ?' => $urlkey, 'active = ?' => true)); if (null === $news) { $view->warningMessage(self::ERROR_MESSAGE_2); $this->_willRenderActionView = false; self::redirect('/aktuality'); } $this->_checkMetaData($layoutView, $news); $layoutView->set('article', 1)->set('artcreated', $news->getCreated())->set('artmodified', $news->getModified()); $view->set('news', $news); }
/** * @before _secured, _admin */ public function delete($id) { $this->willRenderActionView = false; $this->willRenderLayoutView = false; $news = App_Model_News::first(array('id = ?' => (int) $id), array('id')); if (NULL === $news) { echo self::ERROR_MESSAGE_2; } else { if ($news->delete()) { Event::fire('admin.log', array('success', 'News id: ' . $id)); echo 'success'; } else { Event::fire('admin.log', array('fail', 'News id: ' . $id)); echo self::ERROR_MESSAGE_1; } } }