public function editworkoutAction() { if ($this->isLoggedIn() == 0) { $this->_redirect('/admin/index'); } $this->view->loginStatus = $this->isLoggedIn(); $musclesDataList = new FitnessBodyAreas(); $musclesData = new FitnessBodyAreasMultilang(); $equipmentData = new FitnessEquipmentsMultilang(); $timeframesData = new FitnessWorkoutTimeframes(); $fitnessGeneral = new FitnessExerciseGeneral(); $fitnessGeneralMultiLang = new FitnessExerciseGeneralMultilang(); $musclesData = new FitnessBodyAreasMultilang(); $workoutEquipments = new FitnessExerciseEquipments(); $workoutRanking = new FitnessExerciseRanking(); $workoutRepetition = new FitnessExerciseRepetition(); $workoutDegreeDiff = new FitnessExerciseDiffDegree(); $workoutDocuments = new FitnessExerciseDocuments(); $workoutDocumentsMulti = new FitnessExerciseDocumentsMultilang(); $workoutexercises = new FitnessWorkouts(); $adminData = new FitnessAdminAccounts(); $sess = new Zend_Session_Namespace('AdminSession'); $adminType = $adminData->getTypeByUsername($sess->username); $this->view->musclesList = $musclesDataList->listMuscles(); $this->view->equipmentList = $equipmentData->listEquipments(); $this->view->timeframesList = $timeframesData->listTimeframes(); $this->view->exerciseList = $workoutexercises->listWorkouts(); $this->view->adminType = $adminType['admin_user_type']; $workoutId = $this->_request->getParam('workoutId'); $langId = $this->_request->getParam('langId'); $getWorkoutGeneralData = $fitnessGeneral->getRecord($workoutId); if ($langId == 1) { $this->view->getGermanDescription = $fitnessGeneralMultiLang->getRecord($workoutId, 2); } $getWorkoutGeneralMultilangData = $fitnessGeneralMultiLang->getRecord($workoutId, $langId); $workoutEquipmentsData = $workoutEquipments->getRecord($workoutId); $workoutRankingData = $workoutRanking->getRecord($workoutId); $workoutDegreeData = $workoutDegreeDiff->getRecord($workoutId); $workoutDocumentsData = $workoutDocuments->getRecord($workoutId); $workoutDocumentsMultiData = $workoutDocumentsMulti->getRecord($workoutId, $langId); $workoutRepetitionBeginner = $workoutRepetition->getRecord($workoutId, 1); $workoutRepetitionAdvanced = $workoutRepetition->getRecord($workoutId, 2); $workoutRepetitionProfessn = $workoutRepetition->getRecord($workoutId, 3); $exerciseArray = explode(",", $getWorkoutGeneralData['workout_exercises']); $getPrimaryMuscleArray = $musclesData->getMuscles($getWorkoutGeneralData['workout_primary_muscles']); $secondary_muscleArray = explode(",", $getWorkoutGeneralData['workout_secondary_muscles']); $this->view->primary_muscle = $getPrimaryMuscleArray['bodyarea_id']; $this->view->sec_muscle = $secondary_muscleArray; $this->view->exercises = $exerciseArray; $this->view->workoutID = $workoutId; $this->view->langID = $langId; $this->view->workoutName = $fitnessGeneralMultiLang->getWorkoutName($workoutId, $langId); $this->view->workoutGeneralMultilang = $getWorkoutGeneralMultilangData; $this->view->workoutEquipments = $workoutEquipmentsData; $this->view->workoutRanking = $workoutRankingData; $this->view->repetitionBeginner = $workoutRepetitionBeginner['repetitions']; $this->view->repetitionAdvanced = $workoutRepetitionAdvanced['repetitions']; $this->view->repetitionProfessn = $workoutRepetitionProfessn['repetitions']; $this->view->workoutDegree = $workoutDegreeData; $this->view->workoutDocuments = $workoutDocumentsData; $this->view->workoutDocumentsMulti = $workoutDocumentsMultiData; $this->view->workoutGeneralData = $getWorkoutGeneralData; }
/** * 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']; }