public function archiveYearAction($year) { $this->setTitle('Archiwum ' . $year . 'r.'); $this->setUrl('archiwum' . $year . '.html'); $this->setTemplate('news/index.html'); $newsService = new Wsm_Db_News(); $list = $newsService->getListByYear($year); $this->addToView('newsList', $list); }
public function saveAction() { $news = new Wsm_News(); if ($this->has('id')) { $news->setId($this->get('id')); } $news->setTitle($this->get('title')); $news->setContent($this->get('content')); $news->setSignature($this->get('signature')); $news->setDate($this->get('date')); $newsDb = new Wsm_Db_News(); try { $newsDb->save($news); $this->redirect('news/index?msg=saved'); } catch (Exception $e) { $this->redirect('news/index?msg=save_error'); } }