예제 #1
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();
 }
예제 #2
0
 public function viewuserAction()
 {
     if ($this->isLoggedIn() == 0) {
         $this->_redirect('/admin/index');
     }
     $this->view->loginStatus = $this->isLoggedIn();
     $fitnessUserGeneral = new FitnessUserGeneral();
     $fitnessUserSettings = new FitnessUserSettings();
     $fitnessTargets = new FitnessTargets();
     $fitnessInterest = new FitnessInterests();
     $fitnessworkoutsDone = new FitnessUserWorkoutsDone();
     $fitnessworkoutGeneralMulti = new FitnessExerciseGeneralMultilang();
     $fitnessworkoutsUnlocked = new FitnessUserWorkoutsUnlocked();
     $fitnessworkoutsCustom = new FitnessUserCustomWorkouts();
     $fitnessworkoutsMembership = new FitnessUserMembership();
     $fitnessMembershipPlans = new FitnessMembershipPlans();
     $userId = $this->_request->getParam('userId');
     $userSettingsData = $fitnessUserSettings->getUserSettings($userId);
     $usertargets = explode(",", $userSettingsData["workout_targets"]);
     $userinterests = explode(",", $userSettingsData["workout_interests"]);
     $userworkouts = $fitnessworkoutsDone->getUserWorkoutsDone($userId);
     $userworkoutsUnlocked = $fitnessworkoutsUnlocked->getUserWorkoutsUnlocked($userId);
     $userworkoutsCustom = $fitnessworkoutsCustom->getUserWorkoutCustom($userId);
     $userworkoutsMembership = $fitnessworkoutsMembership->getUserMembership($userId);
     $membershipPlan = $fitnessMembershipPlans->getPlans($userworkoutsMembership['membership_plan']);
     $userworkoutArray = array();
     $userworkoutUnlockedArray = array();
     $userworkoutCustomArray = array();
     foreach ($usertargets as $targetId) {
         $targets = $fitnessTargets->getTarget($targetId);
         $targetName[] = $targets['target_name'];
     }
     foreach ($userinterests as $interestId) {
         $interest = $fitnessInterest->getInterest($interestId);
         $interestName[] = $interest['interest_name'];
     }
     $i = 0;
     foreach ($userworkouts as $workout) {
         $workoutData = $fitnessworkoutGeneralMulti->getWorkoutName($workout['workout_id']);
         $userworkoutArray[$i]['workout_name'] = $workoutData['workout_name'];
         $userworkoutArray[$i]['workout_time'] = $workout['workout_time'];
         $userworkoutArray[$i]['workout_date'] = $workout['workout_done_date'];
         $i = $i + 1;
     }
     $k = 0;
     foreach ($userworkoutsUnlocked as $workout) {
         $workoutData = $fitnessworkoutGeneralMulti->getWorkoutName($workout['workout_id']);
         $userworkoutUnlockedArray[$k]['workout_name'] = $workoutData['workout_name'];
         $userworkoutUnlockedArray[$k]['workout_status'] = $workout['workout_purchase_status'];
         $userworkoutUnlockedArray[$k]['workout_date'] = $workout['unlocked_date'];
         $k = $k + 1;
     }
     $j = 0;
     foreach ($userworkoutsCustom as $custom) {
         $userworkoutCustomArray[$j]['workout_name'] = $custom['custom_workout_name'];
         $userworkoutCustomArray[$j]['workout_time'] = $workout['total_workout_time'];
         $userworkoutCustomArray[$j]['workout_date'] = $workout['date_created'];
         $j = $j + 1;
     }
     $this->view->userGeneralData = $fitnessUserGeneral->getUser($userId);
     $this->view->userTargetData = implode(",", $targetName);
     $this->view->userInterestData = implode(",", $interestName);
     $this->view->userSettingsData = $userSettingsData;
     $this->view->userWorkoutData = $userworkoutArray;
     $this->view->userWorkoutUnlockedData = $userworkoutUnlockedArray;
     $this->view->userWorkoutCustomData = $userworkoutCustomArray;
     $this->view->userWorkoutMembershipData = $userworkoutsMembership;
     $this->view->userMembershipName = $membershipPlan['membership_plan'];
     //get targets from the target model
 }
예제 #3
0
 /**
  * function that displays the workout statistics of a user
  * @author lekha
  * @date 4/9/2012
  * 
  */
 public function viewstatsAction()
 {
     $this->view->loginStatus = $this->isLoggedIn();
     $fitnessWorkouts = new FitnessWorkouts();
     $fitnessWorkoutsMulti = new FitnessWorkoutsMultilang();
     $fitnessFeatured = new FitnessFeaturedWorkout();
     $fitnessUser = new FitnessUserGeneral();
     $fitnessUserSettings = new FitnessUserSettings();
     $featuredArray = array();
     //if($this->view->loginStatus == 1)
     //$this->view->memberStatus = $this->checkUserMembership();
     $sess = new Zend_Session_Namespace('UserSession');
     $userDetails = $fitnessUser->getUserbyUsername($sess->username);
     $user_id = $userDetails['user_id'];
     $userSettings = $fitnessUserSettings->getUserSettings($user_id);
     if ($userSettings['address_check'] != 1) {
         $this->_redirect('user/checksettings');
     }
     $defaultLang = $this->getDefaultLanguage();
     $this->view->userid = $user_id;
     $this->view->defaultLang = $defaultLang;
 }