public function deleteAction($id) { $model = Publication::findFirst($id); if ($this->request->isPost()) { $model->delete(); $this->redirect('/publication/admin'); } $this->view->model = $model; $this->view->title = 'Удаление публикации'; $this->helper->title('Удаление публикации'); }
public function publicationAction() { $slug = $this->dispatcher->getParam('slug', 'string'); $type = $this->dispatcher->getParam('type', 'string'); $publication = Publication::findCachedBySlug($slug); if (!$publication) { throw new Exception("Publication '{$slug}.html' not found"); } if ($publication->getTypeSlug() != $type) { throw new Exception("Publication type <> {$type}"); } $this->helper->title()->append($publication->getMeta_title()); $this->helper->meta()->set('description', $publication->getMeta_description()); $this->helper->meta()->set('keywords', $publication->getMeta_keywords()); $this->view->publication = $publication; $this->helper->menu->setActive($type); }
public function deleteAction($id) { $model = Publication::findFirst($id); if ($this->request->isPost()) { $model->delete(); if ($model->getType_id()) { $this->redirect($this->url->get() . 'publication/admin/' . $model->getType()->getSlug()); } else { $this->redirect($this->url->get() . 'publication/admin'); } } $this->view->model = $model; $this->helper->title($this->helper->at('Unpublishing'), true); }