Example #1
0
 public function editratesAction()
 {
     if ($this->isLoggedIn() == 0) {
         $this->_redirect('/admin/index');
     }
     $workrateData = array();
     $fitnessRates = new FitnessWorkoutRates();
     $this->view->workoutrateId = $this->_request->getParam('rateId');
     $this->view->rateDetails = $fitnessRates->getRateDetails($this->_request->getParam('rateId'));
     if ($this->_request->isPost()) {
         $rateId = $this->_request->getPost('rateId');
         $workrateData['app_version'] = $this->_request->getPost('app_version');
         $workrateData['rate_single_workout'] = $this->_request->getPost('workout_single_rate');
         $workrateData['rate_total_workout'] = $this->_request->getPost('workout_total_rate');
         $where = "id='" . $rateId . "'";
         $fitnessRates->update($workrateData, $where);
         $this->_redirect('/admin/listworkoutrates');
     }
 }
Example #2
0
 /**
  * function that handles the paypal payment method
  * @params amount, userid,workout id
  * @author lekha
  * @date 3/22/2012
  * 
  */
 public function paymentpaypalAction()
 {
     $this->view->loginStatus = $this->isLoggedIn();
     //if($this->view->loginStatus == 1)
     //$this->view->memberStatus = $this->checkUserMembership();
     if ($this->isLoggedIn() == 0) {
         $this->_redirect('/index/login');
     }
     $fitnessUser = new FitnessUserGeneral();
     $fitnessWorkout = new FitnessWorkouts();
     $fitnessworkoutRate = new FitnessWorkoutRates();
     $fitnessPromotion = new FitnessPromotionCodes();
     $promotionUsers = new FitnessPromotionUsers();
     $fitnessUserSettings = new FitnessUserSettings();
     $sess = new Zend_Session_Namespace('UserSession');
     $userDetails = $fitnessUser->getUserbyUsername($sess->username);
     $workout_id = $this->_request->getParam('workout_id');
     $purchaseType = $this->_request->getParam('type');
     //get workout rate
     $workoutDetails = $fitnessWorkout->getWorkout($workout_id);
     $workoutrate = $fitnessworkoutRate->getRateByVersion(1);
     $userSettings = $fitnessUserSettings->getUserSettings($userDetails['user_id']);
     if ($userSettings['address_check'] != 1) {
         $this->_redirect('user/settings/details/1');
     }
     $this->view->loginStatus = $this->isLoggedIn();
     $this->view->siteurl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $this->view->baseUrl();
     $this->view->user_id = $userDetails['user_id'];
     $this->view->workout_id = $workout_id;
     $this->view->purchaseType = $purchaseType;
     if ($this->_request->getPost('promotion_code') != "") {
         //check if user has used this promotion code
         //check if promotion code is active
         $checkStatus = $fitnessPromotion->checkStatus($this->_request->getPost('promotion_code'));
         if ($checkStatus['status'] == 1) {
             $checkUser = $promotionUsers->checkUser($userDetails['user_id'], $this->_request->getPost('promotion_code'));
             if ($checkUser['count'] < 1) {
                 //get the reduction in price for this promotion
                 $promoDetails = $fitnessPromotion->getpromoByCode($this->_request->getPost('promotion_code'));
                 //insert user in promo table
                 $promouserArray = array();
                 $promouserArray['promotion_id'] = $promoDetails['id'];
                 $promouserArray['promotion_code'] = $promoDetails['promotion_code'];
                 $promouserArray['user_id'] = $userDetails['user_id'];
                 $promotionUsers->addData($promouserArray);
                 $this->view->reduction = $promoDetails['price_reduction'];
                 $this->view->message = "Your discount has been applied.";
             } else {
                 $this->view->message = "You have used a promotion code previously.";
             }
         } else {
             $this->view->message = "This promotion code is not active anymore.";
         }
     }
     if ($purchaseType == 1) {
         $this->view->workout_rate = $workoutrate['rate_single_workout'];
     } else {
         $this->view->workout_rate = $workoutrate['rate_total_workout'];
     }
     $this->view->lang = $this->getDefaultLanguage();
 }