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'); } }
function settingsAction() { $this->view->loginStatus = $this->isLoggedIn(); $this->_helper->layout()->setLayout('layout_workouts'); $translate = Zend_Registry::get('Zend_Translate'); //if($this->view->loginStatus == 1) //$this->view->memberStatus = $this->checkUserMembership(); $userArray = array(); $usersettingsArray = array(); if ($this->isLoggedIn() == 0) { $this->_redirect('/index/login'); } $fitnessUser = new FitnessUserGeneral(); $fitnessTargets = new FitnessTargetsMultilang(); $fitnessInterests = new FitnessInterestsMultilang(); $fitnessUserSettings = new FitnessUserSettings(); $fitnessCountries = new Countries(); $fitnessDevices = new AppleDevices(); $fitnessKeys = new FitnessAndroidKey(); $fitnessFeatured = new FitnessFeaturedWorkout(); $defaultLanguage = $this->getDefaultLanguage(); $sess = new Zend_Session_Namespace('UserSession'); $this->view->countries = $fitnessCountries->getAllCountries(); $this->view->listTargets = $fitnessTargets->getAllTargets($defaultLanguage); $this->view->listInterests = $fitnessInterests->getAllInterests($defaultLanguage); $this->view->userDetails = $fitnessUser->getUserbyUsername($sess->username); if ($this->_request->getParam('details') != "") { $this->view->warning = $translate->translate("Please fill out the missing information on the settings page before continuing"); } if ($this->_request->isPost()) { $userId = $this->_request->getPost('user_id'); $userArray['user_first_name'] = $this->_request->getPost('user_fname'); $userArray['user_surname'] = $this->_request->getPost('user_surname'); $userArray['user_email'] = $this->_request->getPost('user_email'); if ($this->_request->getPost('user_password') != "") { $userArray['user_password'] = md5($this->_request->getPost('user_password')); } $levelChnage = 1; if ($this->view->userDetails['user_workout_level'] != $this->_request->getPost('user_level')) { $devicetokenDetail = $fitnessDevices->getDeviceByUser($userId); $androidKey = $fitnessKeys->getKeyByUser($userId); if ($devicetokenDetail['devicetoken'] != "") { $this->sendNotification('lekha', "User workout level has been changed in fitness4.me", $devicetokenDetail['devicetoken'], '', $this->_request->getPost('user_level'), $this->view->userDetails['plan']); } if ($androidKey['android_key'] != "") { $this->sentandroid($androidKey['android_key'], "User workout level has been changed in fitness4.me", $this->_request->getPost('user_level')); } $fitnessFeatured->deleteData(); } if ($levelChnage == 1) { $userArray['user_workout_level'] = $this->_request->getPost('user_level'); } $userArray['user_gender'] = $this->_request->getPost('user_gender'); $userArray['user_dob'] = $this->_request->getPost('user_dob'); $userArray['terms_conditions'] = $this->_request->getPost('terms'); $where = " user_id='" . $userId . "'"; $fitnessUser->update($userArray, $where); if ($this->_request->getPost('user_targets') != "") { $usersettingsArray['workout_targets'] = rtrim($this->_request->getPost('user_targets'), ","); } if ($this->_request->getPost('user_interests') != "") { $usersettingsArray['workout_interests'] = rtrim($this->_request->getPost('user_interests'), ","); } $usersettingsArray['member_fitnessclub'] = $this->_request->getPost('club_member'); $usersettingsArray['offers'] = $this->_request->getPost('offers'); $usersettingsArray['updates'] = $this->_request->getPost('updates'); $usersettingsArray['dnb'] = $this->_request->getPost('dnb'); $usersettingsArray['address1'] = $this->_request->getPost('address1'); $usersettingsArray['address2'] = $this->_request->getPost('address2'); $usersettingsArray['city'] = $this->_request->getPost('city'); $usersettingsArray['country'] = $this->_request->getPost('country'); $usersettingsArray['zipcode'] = $this->_request->getPost('zipcode'); $usersettingsArray['telephone'] = $this->_request->getPost('telephone'); if ($usersettingsArray['address1'] != "" && $usersettingsArray['country'] != "" && $usersettingsArray['zipcode'] != "" && $userArray['user_first_name'] != "" && $userArray['user_gender'] != "" && $userArray['terms_conditions'] != "") { $usersettingsArray['address_check'] = 1; } //check if record exists $checkRecords = $fitnessUserSettings->getCount($userId); if ($checkRecords['count'] < 1) { $usersettingsArray['user_id'] = $userId; $fitnessUserSettings->addData($usersettingsArray); } else { $where = " user_id='" . $userId . "'"; $fitnessUserSettings->update($usersettingsArray, $where); } $this->_redirect('/user/listworkouts'); } $this->view->userDetails = $fitnessUser->getUserbyUsername($sess->username); $this->view->userSettings = $fitnessUserSettings->getUserSettings($this->view->userDetails['user_id']); $this->view->defaultLang = $defaultLanguage; }