Ejemplo n.º 1
0
 function editpageAction()
 {
     if ($this->isLoggedIn() == 0) {
         $this->_redirect('/admin/index');
     }
     $this->view->langId = $this->_request->getParam('langId');
     $this->view->pageId = $this->_request->getParam('pageId');
     $fitnessPages = new FitnessWebsitePages();
     $fitnessPagesMulti = new FitnessWebsitePagesMultilang();
     $pageArray = array();
     $pageMultilangData = array();
     $this->view->fitnessMultiPageData = $fitnessPagesMulti->getPage($this->_request->getParam('pageId'), $this->_request->getParam('langId'));
     if ($this->_request->getParam('langId') != '1') {
         $this->view->fitnessTranslation = $fitnessPagesMulti->getPage($this->_request->getParam('pageId'), 1);
     }
     if ($this->_request->isPost()) {
         $pageMultilangData['page_id'] = $this->_request->getPost('pageId');
         $pageMultilangData['lang_id'] = $this->_request->getPost('langId');
         $pageMultilangData['page_title'] = $this->_request->getPost('page_title');
         $pageMultilangData['page_content'] = $this->_request->getPost('page_content');
         $pageMultilangData['page_content_sub'] = $this->_request->getPost('page_content_sub');
         $pageMultilangData['page_section1'] = $this->_request->getPost('page_section1');
         $pageMultilangData['page_section2'] = $this->_request->getPost('page_section2');
         $pageMultilangData['page_section1_title'] = $this->_request->getPost('page_section1_title');
         $pageMultilangData['page_section2_title'] = $this->_request->getPost('page_section2_title');
         $checkRecords = $fitnessPagesMulti->getLangRecord($this->_request->getParam('pageId'), $this->_request->getParam('langId'));
         if ($checkRecords['count'] > 0) {
             $fitnessPagesMulti->update($pageMultilangData, array('page_id = ?' => $this->_request->getPost('pageId'), 'lang_id = ?' => $this->_request->getPost('langId')));
         } else {
             $fitnessPagesMulti->addData($pageMultilangData);
         }
         $this->_redirect('/admin/listpages');
     }
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }