Example #1
0
 function editinterestAction()
 {
     if ($this->isLoggedIn() == 0) {
         $this->_redirect('/admin/index');
     }
     $this->view->langId = $this->_request->getParam('langId');
     $this->view->intId = $this->_request->getParam('intId');
     $fitnessInterest = new FitnessInterests();
     $fitnessInterestMulti = new FitnessInterestsMultilang();
     $interestData = array();
     $intereseMultilangData = array();
     $this->view->fitnessMultiIntData = $fitnessInterestMulti->getInterests($this->_request->getParam('intId'), $this->_request->getParam('langId'));
     if ($this->_request->isPost()) {
         $intereseMultilangData['interest_id'] = $this->_request->getPost('intId');
         $intereseMultilangData['lang_id'] = $this->_request->getPost('langId');
         $intereseMultilangData['interest_name'] = $this->_request->getPost('interest_name');
         $checkRecords = $fitnessInterestMulti->getLangRecord($this->_request->getPost('intId'), $this->_request->getPost('langId'));
         if ($checkRecords['count'] > 0) {
             $fitnessInterestMulti->update($intereseMultilangData, array('interest_id = ?' => $this->_request->getPost('intId'), 'lang_id = ?' => $this->_request->getPost('langId')));
         } else {
             $fitnessInterestMulti->addData($intereseMultilangData);
         }
         $this->_redirect('/admin/listinterests');
     }
 }