public static function current_status($id = false) { if ($id == false) { $id = Session::get('id'); } $progress = (array) MfrUsersProgress::where('user_id', $id)->as_array()->last(); return array(array('key' => Lang::get('current-objective'), 'value' => $progress['objective'], 'prefix' => ''), array('key' => Lang::get('cardio'), 'value' => $progress['cardio'] . ' ' . Lang::get('days'), 'prefix' => Lang::get('per-week')), array('key' => Lang::get('kcals'), 'value' => $progress['kcals'], 'prefix' => 'kcals'), array('key' => Lang::get('protein'), 'value' => $progress['protein'], 'prefix' => 'g/' . Lang::get('day')), array('key' => Lang::get('carbs'), 'value' => $progress['carbs'], 'prefix' => 'g/' . Lang::get('day')), array('key' => Lang::get('fats'), 'value' => $progress['fats'], 'prefix' => 'g/' . Lang::get('day')), array('key' => Lang::get('macros'), 'value' => $progress['macros'], 'prefix' => 'HC/P/G')); }
/** * Default method; */ public function basicPlan() { $user_id = Session::get('id'); $user_current_situation = MfrUsersProgress::where('user_id', $user_id)->as_array()->last(); $recipe_array = array(1, 2, 3, 4); $recipe_num = sizeof($recipe_array); $carbs_per_recipe = $user_current_situation->carbs / $recipe_num; $protein_per_recipe = $user_current_situation->protein / $recipe_num; $fat_per_recipe = $user_current_situation->fats / $recipe_num; $scope['success'] = 'ok'; $scope['title'] = Lang::get('basic-diet-plan'); $scope['content'] = $this->organizeRecipe($recipe_array, $carbs_per_recipe, $protein_per_recipe, $fat_per_recipe); echo json_encode($scope); }