From 7ead111a3bb589d978d9ef57cfc42f7a689c030a Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Sun, 6 Sep 2015 16:20:20 -0700 Subject: [PATCH] More work on the generator, not quite finished but the exercises are getting pulled from the database according to the user's preferences at least. --- app/Http/Controllers/GeneratorController.php | 123 ++++++++++++------- exercises.dump | 0 public/assets/css/styles.css | 2 +- resources/views/generate.blade.php | 102 --------------- resources/views/generate.blade.php~ | 100 --------------- resources/views/generator/generate.blade.php | 20 +-- resources/views/generator/workout.blade.php | 21 ++-- workoutgenerator.dump | Bin 0 -> 8268 bytes 8 files changed, 106 insertions(+), 262 deletions(-) create mode 100644 exercises.dump delete mode 100644 resources/views/generate.blade.php delete mode 100644 resources/views/generate.blade.php~ create mode 100644 workoutgenerator.dump diff --git a/app/Http/Controllers/GeneratorController.php b/app/Http/Controllers/GeneratorController.php index 3419733..eaf7692 100644 --- a/app/Http/Controllers/GeneratorController.php +++ b/app/Http/Controllers/GeneratorController.php @@ -24,23 +24,21 @@ class GeneratorController extends Controller { $input = Request::all(); $goal = Request::get('goal'); - $sets = 0; - $reps = ""; switch ($goal) { case "strength": - $sets = 8; + $sets = "5-8"; $reps = "1-6"; break; case "endurance": - $sets = 3; + $sets = "3"; $reps = "15-25"; break; case "definition": - $sets = 4; + $sets = "4"; $reps = "8-12"; break; default: - $sets = 3; + $sets = "3"; $reps = "10"; }; $preferences = [ @@ -55,16 +53,16 @@ class GeneratorController extends Controller foreach (array_keys($preferences, '') as $key) { unset($preferences[$key]); }; - $chest_exercises = []; - $back_exercises = []; - $legs_exercises = []; - $lower_legs_exercises = []; - $biceps_exercises = []; - $triceps_exercises = []; - $shoulders_exercises = []; - $forearms_exercises = []; - $abs_exercises = []; - #$_exercises = []; + $chestExercises = []; + $backExercises = []; + $legsExercises = []; + $lowerLegsExercises = []; + $bicepsExercises = []; + $tricepsExercises = []; + $shouldersExercises = []; + $forearmsExercises = []; + $absExercises = []; + #$Exercises = []; function getExercises($muscle, $preference) { $exercises = DB::table('exercises') ->where('exercise_type', $preference) @@ -73,48 +71,89 @@ class GeneratorController extends Controller return $exercises; }; foreach ($preferences as $preference) { - $chest_exercises = array_merge($chest_exercises, getExercises('chest', $preference)); - $back_exercises = array_merge($back_exercises, getExercises('back', $preference)); - $legs_exercises = array_merge($legs_exercises, getExercises('legs', $preference)); - $lower_legs_exercises = array_merge($lower_legs_exercises, getExercises('lower_legs', $preference)); - $biceps_exercises = array_merge($biceps_exercises, getExercises('biceps', $preference)); - $triceps_exercises = array_merge($triceps_exercises, getExercises('triceps', $preference)); - $shoulders_exercises = array_merge($shoulders_exercises, getExercises('shoulders', $preference)); - $forearms_exercises = array_merge($forearms_exercises, getExercises('forearms', $preference)); - $abs_exercises = array_merge($abs_exercises, getExercises('abs', $preference)); + $chestExercises = array_merge($chestExercises, getExercises('chest', $preference)); + $backExercises = array_merge($backExercises, getExercises('back', $preference)); + $legsExercises = array_merge($legsExercises, getExercises('legs', $preference)); + $lowerLegsExercises = array_merge($lowerLegsExercises, getExercises('lowerLegs', $preference)); + $bicepsExercises = array_merge($bicepsExercises, getExercises('biceps', $preference)); + $tricepsExercises = array_merge($tricepsExercises, getExercises('triceps', $preference)); + $shouldersExercises = array_merge($shouldersExercises, getExercises('shoulders', $preference)); + $forearmsExercises = array_merge($forearmsExercises, getExercises('forearms', $preference)); + $absExercises = array_merge($absExercises, getExercises('abs', $preference)); }; }; + $cardio = DB::table('exercises') + ->where('exercise_type', 'cardio') + ->lists('exercise_name'); $years = intval(Request::get('years')); $months = intval(Request::get('months')); + $frequency = intval(Request::get('frequency')); $total = ($years * 12) + $months; - $experience = 0; switch ($total) { case ($total >= 24): - $experience = 3; + $experience = "Advanced"; break; case ($total > 6): - $experience = 2; + $experience = "Intermediate"; break; default: - $experience = 1; + $experience = "Beginner"; + $largeMuscleExercises = 1; + $smallMuscleExercises = 1; + $headers = ["Full Body Day"]; + }; + function fullBodyDay () { + + }; + function upperBodyDay () { + + }; + function lowerBodyDay () { + + }; + function chestDay ($frequency, $largeMuscleExercises, $smallMuscleExercises) { + + }; + function backDay () { + + }; + function legDay () { + + }; + function armDay () { + + }; + function createWorkout () { + + } + $listsOfExercises = [ + $chestExercises, + $backExercises, + $legsExercises, + $lowerLegsExercises, + $bicepsExercises, + $tricepsExercises, + $shouldersExercises, + $forearmsExercises, + $absExercises, + $cardio + ]; + for ($i = 0; $i < count($listsOfExercises); $i++) { + shuffle($listsOfExercises[$i]); + }; + for ($i = 0; $i < 3; $i++) { + $listsOfExercises[$i] = array_slice($listsOfExercises[$i], 0, $largeMuscleExercises); + }; + for ($i = 3; $i < count($listsOfExercises); $i++) { + $listsOfExercises[$i] = array_slice($listsOfExercises[$i], 0, $smallMuscleExercises); }; - $frequency = intval(Request::get('frequency')); - $large_muscle = 3; - $small_muscle = 2; return view('generator/workout', [ - 'goal' => $goal, + 'goal' => ucfirst($goal), 'preferences' => implode(', ', $preferences), 'experience' => $experience, 'frequency' => $frequency, - 'chest_exercises' => array_slice($chest_exercises, 0, $large_muscle), - 'back_exercises' => array_slice($back_exercises, 0, $large_muscle), - 'legs_exercises' => array_slice($legs_exercises, 0, $large_muscle), - 'lower_legs_exercises' => array_slice($lower_legs_exercises, 0, $small_muscle), - 'biceps_exercises' => array_slice($biceps_exercises, 0, $small_muscle), - 'triceps_exercises' => array_slice($triceps_exercises, 0, $small_muscle), - 'shoulders_exercises' => array_slice($shoulders_exercises, 0, $small_muscle), - 'forearms_exercises' => array_slice($forearms_exercises, 0, $small_muscle), - 'abs_exercises' => array_slice($abs_exercises, 0, $small_muscle) + 'listsOfExercises' => $listsOfExercises, + 'headers' => $headers ]); } } \ No newline at end of file diff --git a/exercises.dump b/exercises.dump new file mode 100644 index 0000000..e69de29 diff --git a/public/assets/css/styles.css b/public/assets/css/styles.css index afcba2a..2306183 100644 --- a/public/assets/css/styles.css +++ b/public/assets/css/styles.css @@ -200,7 +200,7 @@ body { .workout { width:75%; border:1px solid black; - margin:auto; + margin:10px auto; text-align:center; } diff --git a/resources/views/generate.blade.php b/resources/views/generate.blade.php deleted file mode 100644 index 1ea35a3..0000000 --- a/resources/views/generate.blade.php +++ /dev/null @@ -1,102 +0,0 @@ -@extends('layouts.master') - -@section('title', 'Generate') - -@section('content') -
-

Workout Generator

-
-
-
-
- - Background Info: - -
-
- -
-
-
- -
-
- Free Weights -
- Dumbbells -
- Barbells -
- Selectorized Equipment -
- Cable Equipment -
- Calisthenics -
-
-
- -
-
- - -
-
-
- -
-
- -
-
- -
-
-
-
-
- -@endsection diff --git a/resources/views/generate.blade.php~ b/resources/views/generate.blade.php~ deleted file mode 100644 index 12f68a8..0000000 --- a/resources/views/generate.blade.php~ +++ /dev/null @@ -1,100 +0,0 @@ -@extends('layouts.master') - -@section('title', 'Generate') - -@section('header') - -@section('content') -
-

Workout Generator

-
-
- Background Info: - -
-
- -
-
-
- -
-
- Free Weights -
- Dumbbells -
- Barbells -
- Selectorized Equipment -
- Cable Equipment -
- Calisthenics -
-
-
- -
-
- - -
-
-
- -
-
- -
-
- -
-
-
-
- -@endsection diff --git a/resources/views/generator/generate.blade.php b/resources/views/generator/generate.blade.php index cc7f068..28cc5a5 100644 --- a/resources/views/generator/generate.blade.php +++ b/resources/views/generator/generate.blade.php @@ -14,7 +14,8 @@

- + @@ -42,15 +43,17 @@

- + + + + - + {$i} months"; + echo ""; } ?> @@ -60,7 +63,8 @@

- + {$i}"; diff --git a/resources/views/generator/workout.blade.php b/resources/views/generator/workout.blade.php index 8dd88fb..61a235c 100644 --- a/resources/views/generator/workout.blade.php +++ b/resources/views/generator/workout.blade.php @@ -6,21 +6,24 @@ @section('content')
-

Your Workout, Should You Choose to Accept It...

+

{{ $goal }} - {{ $experience }} - {{ $frequency }} Day Split


This part is still under development, but check back soon!

- {{-- - - - - + + @for ($i = 0; $i < $frequency; $i++) +
Your Goal:Your Preferred Workout Types:Your Experience:Your Desired Workout Frequency:
+

{{ $headers[$i] }}

+ + + + @for ($i = 0; $i < count) - + -
ExerciseSets:Reps:
{{ $goal }} {{ $preferences }}{{ $experience }} months{{ $experience }} {{ $frequency }} days per week
--}} -
+ + @endfor
@endsection \ No newline at end of file diff --git a/workoutgenerator.dump b/workoutgenerator.dump new file mode 100644 index 0000000000000000000000000000000000000000..23bd1d269773b093b3eda812ba54f495a993140c GIT binary patch literal 8268 zcmcIp3tZFH9v?_5C|AVL;AWi6V&ufV7@%-8ttS1;rISIU z(>k;!ivc44803MG_i&)r_<9B;Wdw}XTYiB@xyXmJFZg318D$LwzRwD5fNbdqt3f$I z3amDZj?g=8S`#p7%?78|Km;-aBM0y-5s8D#-H3fz={83y2E)B~g0K^O=dwu)RWm9p@Ji%?_MmJmQ!thH%% z4oEdkYnu+!6O)^m7*AVL;^E*Qb6DHt5Wa8kqWJ+{xN(YD9+ZQA3-v079 znSrP%NTNl-ZNCBR7bFzbE|7pCS1uMo4auC81gC^jl{g2u3FsKRS9oAdFzTVo=pkiC zjSH!6U|q;q7SOb)#az&fW^rC}B5oB*j0T(5VYHZig4qBUbqHn;DHYA`fzE|rq1K@* z_KAP&_o!R)^?Nt}hj#pr5CZt2!NBM782#XcRcp7GT3}~nBkY932Me^m0~R!T3J_QT zji%0l;jp|&m^(+>^&EsTeG1C#iz!WT-)O-o1&$V)e{Cem;hPRDm+S(acEaWZr;J`F zFx8*ch|ZUWF4)0^haXc2V4g?4gQrT_h!Uctkg#b2S&zeJ$CCxE>qaBjb+d3p`!zO( z^~(hV0bV2KNJhM>${UKRV=*s^~EJ{az)K^B2_5(v=C_b zTPS>hc|egE0lCwPgtwrc0)a=nUmSQe$(?S=QSfpFZ1T9qfsLL3moK9p_ogE8SfN^~ zA}d;fTUfG3QOKqFp2`JCJ>Y>%Et8{m4;?$H^}tM&Ii_h%%s6@pj2k)9Mi_J^n1oRm zG>Wzbz0&(^g3}zeOIOTF*32Zzuz~=cfFmGG+{Az|Jx9|4!-VbUBfVdUyd8iBkEf^T z&?Wk3{&3LnDM)w$eE%wf1_cLxv2ocz?n6H(pk{^?79I34G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