Переглянути джерело

Update ThreeYearPlanController.php

Gabriel Santiago Plaza 3 роки тому
джерело
коміт
2abde9480d
1 змінених файлів з 40 додано та 40 видалено
  1. 40
    40
      app/controllers/ThreeYearPlanController.php

+ 40
- 40
app/controllers/ThreeYearPlanController.php Переглянути файл

@@ -8,14 +8,14 @@ class ThreeYearPlanController extends \BaseController
8 8
   // load the Three year Plan page
9 9
   public function threeYearsReport()
10 10
   {
11
-    $user_id = auth::user()->id;
11
+    $user_id = Auth::user()->id;
12 12
 
13 13
     // el ID de los semestres que el usuario tiene seleccionado.
14 14
     $semesters_ids = Session::get('semesters_ids');
15 15
     // buscar informacion de los semestres seleccionados
16 16
     $semesters = Semester::whereIn('id', $semesters_ids)->get();
17 17
 
18
-
18
+    $title = "Three Year Plans";
19 19
     $typs = DB::table('three_year_plan')
20 20
       ->orderBy('year_start', 'asc')
21 21
       ->get();
@@ -25,7 +25,7 @@ class ThreeYearPlanController extends \BaseController
25 25
       ->select('program_id')
26 26
       ->get();
27 27
     $program_id = $program_id[0]->program_id;
28
-
28
+    $outcomes = DB::table('outcomes')->where('deactivation_date', '=', null)->orderBy('name', 'ASC')->get();
29 29
     // se annadio la nueva variable
30 30
     return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
31 31
   }
@@ -36,15 +36,15 @@ class ThreeYearPlanController extends \BaseController
36 36
   {
37 37
     $id = Input::get('id');
38 38
 
39
-      $semesters = DB::table('typ_semesters')
40
-          ->join('semesters','semesters.id','=','typ_semesters.semester_id')
41
-          ->where('typ_semesters.typ_id',$id)
42
-          ->orderBy('typ_semesters.semester_id', 'asc')
43
-          ->get();
44
-      $typs = DB::table('three_year_plan')
45
-          ->where('id',$id)
46
-          ->orderBy('year_start', 'asc')
47
-          ->get();
39
+    $semesters = DB::table('typ_semesters')
40
+      ->join('semesters', 'semesters.id', '=', 'typ_semesters.semester_id')
41
+      ->where('typ_semesters.typ_id', $id)
42
+      ->orderBy('typ_semesters.semester_id', 'asc')
43
+      ->get();
44
+    $typs = DB::table('three_year_plan')
45
+      ->where('id', $id)
46
+      ->orderBy('year_start', 'asc')
47
+      ->get();
48 48
 
49 49
     $typs  = $typs[0];
50 50
     $typs->semesters = $semesters;
@@ -62,9 +62,9 @@ class ThreeYearPlanController extends \BaseController
62 62
 
63 63
     $user_id = auth::user()->id;
64 64
     $program_id = DB::table('program_user')
65
-    ->where('user_id',$user_id)
66
-    ->select('program_id')
67
-    ->get();
65
+      ->where('user_id', $user_id)
66
+      ->select('program_id')
67
+      ->get();
68 68
     $program_id = $program_id[0]->program_id;
69 69
 
70 70
 
@@ -202,9 +202,9 @@ class ThreeYearPlanController extends \BaseController
202 202
     // get program_id
203 203
     $user_id = auth::user()->id;
204 204
     $program_id = DB::table('program_user')
205
-        ->where('user_id',$user_id)
206
-        ->select('program_id')
207
-        ->get();
205
+      ->where('user_id', $user_id)
206
+      ->select('program_id')
207
+      ->get();
208 208
     $program_id = $program_id[0]->program_id;
209 209
 
210 210
     // get typ_program_id
@@ -260,9 +260,9 @@ class ThreeYearPlanController extends \BaseController
260 260
     // get program_id
261 261
     $user_id = auth::user()->id;
262 262
     $program_id = DB::table('program_user')
263
-        ->where('user_id',$user_id)
264
-        ->select('program_id')
265
-        ->get();
263
+      ->where('user_id', $user_id)
264
+      ->select('program_id')
265
+      ->get();
266 266
     $program_id = $program_id[0]->program_id;
267 267
 
268 268
     // get typ_program_id
@@ -326,14 +326,14 @@ class ThreeYearPlanController extends \BaseController
326 326
 
327 327
           // lookup available objectives
328 328
           $result_objectives = DB::table('objective_outcome')
329
-              ->join('outcomes','outcomes.id','=','objective_outcome.outcome_id')
330
-              ->join('objectives','objectives.id','=','objective_outcome.objective_id')
331
-              ->join('objective_program','objective_program.objective_id','=','objectives.id')
332
-              ->where('objective_program.program_id',$program_id)
333
-              ->where('objective_outcome.outcome_id',$outcome_id)
334
-              ->select('objectives.id','objectives.text','outcomes.name as outcome_name')
335
-              ->orderBy('objectives.text', 'asc')
336
-              ->get();
329
+            ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
330
+            ->join('objectives', 'objectives.id', '=', 'objective_outcome.objective_id')
331
+            ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
332
+            ->where('objective_program.program_id', $program_id)
333
+            ->where('objective_outcome.outcome_id', $outcome_id)
334
+            ->select('objectives.id', 'objectives.text', 'outcomes.name as outcome_name')
335
+            ->orderBy('objectives.text', 'asc')
336
+            ->get();
337 337
 
338 338
           $semesters_->available_objectives = array();
339 339
           foreach ($result_objectives as $objectives_) {
@@ -355,9 +355,9 @@ class ThreeYearPlanController extends \BaseController
355 355
     // get program_id
356 356
     $user_id = auth::user()->id;
357 357
     $program_id = DB::table('program_user')
358
-        ->where('user_id',$user_id)
359
-        ->select('program_id')
360
-        ->get();
358
+      ->where('user_id', $user_id)
359
+      ->select('program_id')
360
+      ->get();
361 361
     $program_id = $program_id[0]->program_id;
362 362
 
363 363
     // get typ_program_id
@@ -414,11 +414,11 @@ class ThreeYearPlanController extends \BaseController
414 414
           $semesters_->selected_objectives = array();
415 415
           foreach ($result_objectives as $objectives_) {
416 416
             $result_courses = DB::table('courses')
417
-                ->where('courses.program_id', $program_id)
418
-                ->select('courses.id as course_id','courses.name','courses.code','courses.program_id')
419
-                ->orderBy('courses.name', 'asc')
420
-                ->groupBy('courses.name','courses.code')
421
-                ->get();
417
+              ->where('courses.program_id', $program_id)
418
+              ->select('courses.id as course_id', 'courses.name', 'courses.code', 'courses.program_id')
419
+              ->orderBy('courses.name', 'asc')
420
+              ->groupBy('courses.name', 'courses.code')
421
+              ->get();
422 422
             #los cursos resultantes creo que deberian ser: todos los que se estan dando en mi programa
423 423
 
424 424
             $objectives_->available_courses = array();
@@ -464,9 +464,9 @@ class ThreeYearPlanController extends \BaseController
464 464
     // get program_id
465 465
     $user_id = auth::user()->id;
466 466
     $program_id = DB::table('program_user')
467
-        ->where('user_id',$user_id)
468
-        ->select('program_id')
469
-        ->get();
467
+      ->where('user_id', $user_id)
468
+      ->select('program_id')
469
+      ->get();
470 470
     $program_id = $program_id[0]->program_id;
471 471
 
472 472
     // get typ_program_id