function removenewsAction() { $delete_id = $this->_request->getParam('delete'); if ($delete_id != "") { $fitnessNews = new FitnessNews(); $fitnessNews->find($delete_id)->current()->delete(); $this->_redirect('/admin/listnews'); } }
/** * function that displays the news template * @author lekha * @date 8/21/2012 * */ public function newsAction() { $this->_helper->layout()->setLayout('layout_news'); $this->view->loginStatus = $this->isLoggedIn(); $fitnessPages = new FitnessWebsitePages(); $fitnessPagesMulti = new FitnessWebsitePagesMultilang(); $fitnessNews = new FitnessNews(); $fitnessNewsMulti = new FitnessNewsMultilang(); $lang = $this->getDefaultLanguage(); if ($this->_request->getParam('category') != "") { $category = $this->_request->getParam('category'); $getNews = $fitnessNews->getNewsByCategory($category); foreach ($getNews as $catN) { $newsCatList[] = $fitnessNewsMulti->getNews($catN['id'], $lang); } $this->view->newsList = $newsCatList; } else { if ($this->_request->getParam('date') != "") { $getNews = $fitnessNews->getNewsByDate($this->_request->getParam('date')); foreach ($getNews as $catN) { $newsCatList[] = $fitnessNewsMulti->getNews($catN['id'], $lang); } $this->view->newsList = $newsCatList; } else { $this->view->newsList = $fitnessNewsMulti->getAllInterests($lang); } } //get the date range() $dateFirst = date('Y-m-d'); $dateSecond = date('Y-m-d', strtotime('-2 month')); $this->view->dateRange = $this->get_months($dateSecond, $dateFirst); //get the news subtext $pageId = $fitnessPages->getPageByName('News'); $pageContent = $fitnessPagesMulti->getPage($pageId['page_id'], $lang); $this->view->newsSub = $pageContent['page_content_sub']; $this->view->newsSub = $pageContent['page_content_sub']; $this->view->defaultLang = $lang; }