コード例 #1
0
ファイル: AdminController.php プロジェクト: keyanmca/yoga
 public function listpaymentsAction()
 {
     if ($this->isLoggedIn() == 0) {
         $this->_redirect('/admin/index');
     }
     $this->view->loginStatus = $this->isLoggedIn();
     $fitnessPyaments = new FitnessWebsitePaymentDetails();
     $fitnessAppPayments = new FitnessAppPaymentDetails();
     $fitnessWorkouts = new FitnessWorkouts();
     $fitnessUser = new FitnessUserGeneral();
     $paymentRecord = array();
     $apppaymentRecord = array();
     $payments = $fitnessPyaments->getAllPayments();
     $apppayments = $fitnessAppPayments->getAllPayments();
     $i = 0;
     foreach ($payments as $payment) {
         $userDetails = $fitnessUser->getUser($payment['user_id']);
         $paymentRecord[$i]['user'] = $userDetails['user_first_name'] . " " . $userDetails['user_surname'];
         if ($payment['payment_method'] == 1) {
             $paymentRecord[$i]['payment_method'] = "Paypal";
         } else {
             $paymentRecord[$i]['payment_method'] = "Google";
         }
         $paymentRecord[$i]['status'] = $payment['payment_status'];
         $paymentRecord[$i]['type'] = $payment['payment_type_workouts'];
         $paymentRecord[$i]['amount'] = $payment['payment_amount'];
         $paymentRecord[$i]['trxn'] = $payment['payment_transaction_id'];
         $paymentRecord[$i]['date'] = $payment['payment_date'];
         $i = $i + 1;
     }
     $i = 0;
     foreach ($apppayments as $apppayment) {
         $userDetails = $fitnessUser->getUser($apppayment['user_id']);
         $apppaymentRecord[$i]['user'] = $userDetails['user_first_name'] . " " . $userDetails['user_surname'];
         if ($apppayment['payment_method'] == 1) {
             $apppaymentRecord[$i]['payment_method'] = "Paypal";
         }
         $apppaymentRecord[$i]['status'] = $apppayment['payment_status'];
         $apppaymentRecord[$i]['amount'] = $apppayment['amount'];
         $apppaymentRecord[$i]['trxn'] = $apppayment['transaction_id'];
         $apppaymentRecord[$i]['date'] = $apppayment['payment_date'];
         $i = $i + 1;
     }
     //get iphone purchases data
     $iphonePurchase = $fitnessUser->getIphonePremiumUsers();
     $androidPurchase = $fitnessUser->getAndroidPremiumUsers();
     $iphoneCount = count($iphonePurchase);
     $this->view->payments = $paymentRecord;
     $this->view->apppayments = $apppaymentRecord;
     $this->view->iphonePurchase = $iphonePurchase;
     $this->view->androidPurchase = $androidPurchase;
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: keyanmca/yoga
 /**
  * function that displays the workout information before the video
  * @params workout id
  * @author lekha
  * @date 4/25/2012
  */
 public function playvideoAction()
 {
     $this->view->loginStatus = $this->isLoggedIn();
     //$this->_helper->layout()->setLayout('layout_workouts');
     $this->_helper->layout()->disableLayout();
     if ($this->isLoggedIn() == 0) {
         $this->_redirect('/index/login');
     }
     $this->view->workoutid = $this->_request->getParam('workout_id');
     $fitnessWorkouts = new FitnessWorkouts();
     $fitnessWorkoutsMulti = new FitnessWorkoutsMultilang();
     $fitnessWorkoutsUnlocked = new FitnessUserWorkoutsUnlocked();
     $fitnessDocuments = new FitnessExerciseDocuments();
     $fitnessRepetition = new FitnessExerciseRepetition();
     $fitnessExercises = new FitnessExerciseGeneral();
     $fitnessExerciseEquipments = new FitnessExerciseEquipments();
     $fitnessEquipmentsMulti = new FitnessEquipmentsMultilang();
     $fitnessDevices = new AppleDevices();
     $fitnessKeys = new FitnessAndroidKey();
     $fitnessFavWorkouts = new FitnessUserFavWorkouts();
     $fitnessUserSettings = new FitnessUserSettings();
     $fitnessUser = new FitnessUserGeneral();
     // get workout info
     $workoutInfo = $fitnessWorkouts->getWorkout($this->_request->getParam('workout_id'));
     $workoutMulti = $fitnessWorkoutsMulti->getWorks($this->_request->getParam('workout_id'), $this->getDefaultLanguage());
     $user_level = $this->_request->getParam('userlevel');
     $userid = $this->_request->getParam('userid');
     $userDetails = $fitnessUser->getUser($userid);
     $userSettings = $fitnessUserSettings->getUserSettings($userid);
     if ($userSettings['address_check'] != 1) {
         $this->_redirect('user/checksettings');
     }
     $defaultLang = $this->getDefaultLanguage();
     $workoutData = $fitnessWorkouts->listWorkouts($defaultLang, $user_level);
     $favWorkouts = $fitnessFavWorkouts->getFavWorkouts($userid);
     foreach ($favWorkouts as $fav) {
         $favIds[] = $fav['workout_id'];
     }
     $workout_id = $workoutInfo['id'];
     if (in_array($workout_id, $favIds)) {
         $this->view->favstatus = 1;
     } else {
         $this->view->favstatus = 0;
     }
     //get props used if any
     $exerciseList = $fitnessWorkouts->getExercises($workout_id);
     $exerArray = explode(",", $exerciseList['work_exercises']);
     foreach ($exerArray as $exer) {
         $equipmentsList = $fitnessExerciseEquipments->getEquipment($exer);
         $equipmentArray[] = explode(",", $equipmentsList['equipments_home']);
     }
     $result = array();
     foreach ($equipmentArray as $key => $value) {
         if (is_array($value)) {
             $result = array_merge($result, $value);
         } else {
             $result[$key] = $value;
         }
     }
     $equipmentArray = array_unique($result);
     $b = 0;
     foreach ($equipmentArray as $equip) {
         if ($equip != "") {
             $equipName = $fitnessEquipmentsMulti->getEquipmentById($equip, $this->getDefaultLanguage());
             if ($equipName['equipment_name'] == "chair") {
                 $equipName['equipment_name'] = "chair/s maximum no 2";
             }
             $equipments .= $equipName['equipment_name'] . ",";
             $b = $b + 1;
         }
     }
     $equipmentsStr = rtrim($equipments, ",");
     $workoutArray = $fitnessWorkouts->getWorkout($workout_id);
     if ($workoutArray['work_exercises_order'] == "") {
         $exerciseArray = explode(",", rtrim($workoutArray['work_exercises'], ','));
     } else {
         $exerciseArray = explode(",", rtrim($workoutArray['work_exercises_order'], ','));
     }
     $totalExerciseCount = count($exerciseArray);
     //build the repetition array for the videos
     $m = 1;
     foreach ($exerciseArray as $exercise) {
         $repetition = $fitnessRepetition->getRecord($exercise, $user_level);
         $video = $fitnessDocuments->getRecord($exercise);
         if ($repetition['repetitions'] > 0) {
             $repetitionArray[] = 1;
             $repetitionArray[] = 1;
             $repetitionArray[] = 1;
             if ($this->getDefaultLanguage() == 2) {
                 $intro_array = explode('.mp4', $video['poster_video']);
                 $intro_video = "intro/de/" . $intro_array[0] . "_de.mp4";
                 $stopvideo = "test/de/stop_exercise_de.mp4";
                 $otherSide = "test/de/otherside_exercise_de.mp4";
                 $recovery = "recovery/de/recovery_" . $workoutInfo['work_recovery_time'] . "_de.mp4";
                 $next = "test/de/next_exercise_de.mp4";
                 $completed = "test/de/completed_exercise_de.mp4";
             } else {
                 $intro_video = "intro/" . $video['poster_video'];
                 $stopvideo = "test/stop_exercise.mp4";
                 $otherSide = "test/otherside_exercise.mp4";
                 $recovery = "recovery/recovery_" . $workoutInfo['work_recovery_time'] . ".mp4";
                 $next = "test/next_exercise.mp4";
                 $completed = "test/completed_exercise.mp4";
             }
             $videoArray[] = $intro_video;
             $videoArray[] = $video['workout_video_file'] . "-" . $repetition['repetitions'] . ".mp4";
             $videoArray[] = $stopvideo;
             //insert the recovery here
             $videoexplode = $video['workout_video_file'] . "-" . $repetition['repetitions'];
             if (file_exists('./public/js_old/old_files/web/' . $videoexplode . '-2.mp4')) {
                 $repetitionArray[] = 1;
                 $repetitionArray[] = 1;
                 $repetitionArray[] = 1;
                 //$repetitionArray[] =  1;
                 $videoArray[] = $otherSide;
                 $videoArray[] = $videoexplode . '-2.mp4';
                 $videoArray[] = $stopvideo;
                 //$videoArray[]    =   "test/next_exercise.mp4";
             }
             //else
             //{
             if ($workoutInfo['work_recovery_interval'] == 1 && $m != $totalExerciseCount) {
                 $repetitionArray[] = 1;
                 $videoArray[] = $recovery;
             }
             if ($workoutInfo['work_recovery_interval'] == 2 && $m != $totalExerciseCount) {
                 if ($m % 2 == 0) {
                     $repetitionArray[] = 1;
                     $videoArray[] = $recovery;
                 }
             }
             if ($workoutInfo['work_recovery_interval'] == 3 && $m != $totalExerciseCount) {
                 if ($m % 3 == 0) {
                     $repetitionArray[] = 1;
                     $videoArray[] = $recovery;
                 }
             }
             //}
             if ($m != $totalExerciseCount) {
                 $repetitionArray[] = 1;
                 $videoArray[] = $next;
             }
         }
         $m = $m + 1;
     }
     array_push($repetitionArray, 1);
     array_push($videoArray, $completed);
     $videoStr = implode(",", $videoArray);
     $repsStr = implode(",", $repetitionArray);
     $this->view->description = $workoutMulti['description_big'];
     $this->view->name = $workoutMulti['work_name'];
     $this->view->benefits = $workoutInfo['work_filter'];
     $this->view->image = $workoutInfo['work_image_list'];
     $this->view->videoStr = $videoStr;
     $this->view->repStr = $repsStr;
     $this->view->siteurl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $this->view->baseUrl();
     $this->view->userid = $userid;
     $this->view->userlevel = $user_level;
     $this->view->workoutid = $workout_id;
     $this->view->props = $equipmentsStr;
     $this->view->defaultLang = $defaultLang;
     $this->view->fullpurchase = $userDetails['workout_purchase'];
     $this->view->workoutStatus = $workoutInfo['status'];
 }