Browse Source

Fixes on Three Year Plans and Transformative Actions

-Added comments on various controllers on what each function does.
-Removed some unused commented code.
onielm 3 years ago
parent
commit
c4c0b708dc

+ 19
- 36
app/controllers/ThreeYearPlanController.php View File

5
 class ThreeYearPlanController extends \BaseController
5
 class ThreeYearPlanController extends \BaseController
6
 {
6
 {
7
 
7
 
8
+  // load the Three year Plan page
8
   public function threeYearsReport()
9
   public function threeYearsReport()
9
   {
10
   {
10
       $user_id = auth::user()->id;
11
       $user_id = auth::user()->id;
19
           ->where('deactivation_date','=','0000-00-00')
20
           ->where('deactivation_date','=','0000-00-00')
20
           ->orWhereNull('deactivation_date')
21
           ->orWhereNull('deactivation_date')
21
           ->get();
22
           ->get();
22
-      // $outcomes = DB::table('outcomes')
23
-      //     ->orderBy('name', 'asc')
24
-      //     ->get();
25
       $typs = DB::table('three_year_plan')
23
       $typs = DB::table('three_year_plan')
26
           ->orderBy('year_start', 'asc')
24
           ->orderBy('year_start', 'asc')
27
           ->get();
25
           ->get();
28
       $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
26
       $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
29
-      // $criteria = DB::table('criteria')
30
-      //     ->orderBy('name', 'asc')
31
-      //     ->get();
32
       $program_id = DB::table('program_user')
27
       $program_id = DB::table('program_user')
33
       ->where('user_id',$user_id)
28
       ->where('user_id',$user_id)
34
-      // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
35
       ->select('program_id')
29
       ->select('program_id')
36
       ->get();
30
       ->get();
37
-      $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
31
+      $program_id = $program_id[0]->program_id;
38
 
32
 
39
       // se annadio la nueva variable
33
       // se annadio la nueva variable
40
       return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
34
       return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
42
   }
36
   }
43
 
37
 
44
 
38
 
39
+  //when the user select a three year period from the left column, load the corresponding info
45
   public function fetchThreeYears()
40
   public function fetchThreeYears()
46
   {
41
   {
47
       $id = Input::get('id');
42
       $id = Input::get('id');
49
       $semesters = DB::table('typ_semesters')
44
       $semesters = DB::table('typ_semesters')
50
           ->join('semesters','semesters.id','=','typ_semesters.semester_id')
45
           ->join('semesters','semesters.id','=','typ_semesters.semester_id')
51
           ->where('typ_semesters.typ_id',$id)
46
           ->where('typ_semesters.typ_id',$id)
52
-          // ->select('semesters.*')
53
           ->orderBy('typ_semesters.semester_id', 'asc')
47
           ->orderBy('typ_semesters.semester_id', 'asc')
54
           ->get();
48
           ->get();
55
       $typs = DB::table('three_year_plan')
49
       $typs = DB::table('three_year_plan')
66
       );
60
       );
67
   }
61
   }
68
 
62
 
63
+  // add or remove a semester associated with an outcome when a user selects a checkbox
69
   public function update_typ_outcomes_semesters()
64
   public function update_typ_outcomes_semesters()
70
   {
65
   {
71
     $outcomeSemesterArray = json_decode(Input::get('outcomeSemesterArray'), true);
66
     $outcomeSemesterArray = json_decode(Input::get('outcomeSemesterArray'), true);
72
     $typ_id = Input::get('typ_id');
67
     $typ_id = Input::get('typ_id');
73
 
68
 
74
-    $user_id = auth::user()->id; //ya, tester es 60
69
+    $user_id = auth::user()->id;
75
     $program_id = DB::table('program_user')
70
     $program_id = DB::table('program_user')
76
     ->where('user_id',$user_id)
71
     ->where('user_id',$user_id)
77
-    // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
78
     ->select('program_id')
72
     ->select('program_id')
79
     ->get();
73
     ->get();
80
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
74
+    $program_id = $program_id[0]->program_id;
81
 
75
 
82
 
76
 
83
     $result = DB::table('typ_program')
77
     $result = DB::table('typ_program')
158
     return;
152
     return;
159
   }
153
   }
160
 
154
 
155
+  // load semesters asociated with the outcomes if previously selected
161
   public function lookup_typ_semester_outcome()
156
   public function lookup_typ_semester_outcome()
162
   {
157
   {
163
     $box_value = array();
158
     $box_value = array();
200
     );
195
     );
201
   }
196
   }
202
 
197
 
198
+  // save or delete Objectives associated with the outcomes and semsters
203
   public function section2_on_change()
199
   public function section2_on_change()
204
   {
200
   {
205
     $typ_id = Input::get('typ_id');
201
     $typ_id = Input::get('typ_id');
206
-    // typ_id: (typ_id),
207
     $outcome_id = Input::get('outcome_id');
202
     $outcome_id = Input::get('outcome_id');
208
-    // outcome_id: (outcome_id),
209
     $semester_id = Input::get('semester_id');
203
     $semester_id = Input::get('semester_id');
210
-    // semester_id: (semester_id),
211
     $previous_objective_id = Input::get('previous_objective_id');
204
     $previous_objective_id = Input::get('previous_objective_id');
212
-    // previous_objective_id: (previous_objective_id),
213
     $new_objective_id = Input::get('new_objective_id');
205
     $new_objective_id = Input::get('new_objective_id');
214
-    // new_objective_id: (new_objective_id)
215
 
206
 
216
     // get program_id
207
     // get program_id
217
-    $user_id = auth::user()->id; //ya, tester es 60
208
+    $user_id = auth::user()->id;
218
     $program_id = DB::table('program_user')
209
     $program_id = DB::table('program_user')
219
         ->where('user_id',$user_id)
210
         ->where('user_id',$user_id)
220
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
221
         ->select('program_id')
211
         ->select('program_id')
222
         ->get();
212
         ->get();
223
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
213
+    $program_id = $program_id[0]->program_id;
224
 
214
 
225
     // get typ_program_id
215
     // get typ_program_id
226
     $result = DB::table('typ_program')
216
     $result = DB::table('typ_program')
268
     return 'update was succes';
258
     return 'update was succes';
269
   }
259
   }
270
 
260
 
261
+  // load the corresponding info after associating semesters with outcomes
271
   public function section2_arrive()
262
   public function section2_arrive()
272
   {
263
   {
273
     // get program_id
264
     // get program_id
274
-    $user_id = auth::user()->id; //ya, tester es 60
265
+    $user_id = auth::user()->id;
275
     $program_id = DB::table('program_user')
266
     $program_id = DB::table('program_user')
276
         ->where('user_id',$user_id)
267
         ->where('user_id',$user_id)
277
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
278
         ->select('program_id')
268
         ->select('program_id')
279
         ->get();
269
         ->get();
280
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
270
+    $program_id = $program_id[0]->program_id;
281
 
271
 
282
     // get typ_program_id
272
     // get typ_program_id
283
     $typ_id = Input::get('typ_id');
273
     $typ_id = Input::get('typ_id');
363
     return $info;
353
     return $info;
364
   }
354
   }
365
 
355
 
356
+  // load the corresponding info after associating objectives to semesters outcomes
366
   public function section3_arrive()
357
   public function section3_arrive()
367
   {
358
   {
368
     // get program_id
359
     // get program_id
369
-    $user_id = auth::user()->id; //ya, tester es 60
360
+    $user_id = auth::user()->id;
370
     $program_id = DB::table('program_user')
361
     $program_id = DB::table('program_user')
371
         ->where('user_id',$user_id)
362
         ->where('user_id',$user_id)
372
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
373
         ->select('program_id')
363
         ->select('program_id')
374
         ->get();
364
         ->get();
375
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
365
+    $program_id = $program_id[0]->program_id;
376
 
366
 
377
     // get typ_program_id
367
     // get typ_program_id
378
     $typ_id = Input::get('typ_id');
368
     $typ_id = Input::get('typ_id');
473
     return $info;
463
     return $info;
474
   }
464
   }
475
 
465
 
476
-
466
+  // save or delete courses associated with objectives
477
   public function section3_on_change()
467
   public function section3_on_change()
478
   {
468
   {
479
     $typ_id = Input::get('typ_id');
469
     $typ_id = Input::get('typ_id');
480
-    // typ_id: (typ_id),
481
     $outcome_id = Input::get('outcome_id');
470
     $outcome_id = Input::get('outcome_id');
482
-    // outcome_id: (outcome_id),
483
     $semester_id = Input::get('semester_id');
471
     $semester_id = Input::get('semester_id');
484
-    // semester_id: (semester_id),
485
     $objective_id = Input::get('objective_id');
472
     $objective_id = Input::get('objective_id');
486
-    // objective_id: (objective_id),
487
     $previous_course_id = Input::get('previous_course_id');
473
     $previous_course_id = Input::get('previous_course_id');
488
-    // previous_course_id: (previous_course_id),
489
     $new_course_id = Input::get('new_course_id');
474
     $new_course_id = Input::get('new_course_id');
490
-    // new_course_id: (new_course_id)
491
 
475
 
492
     // get program_id
476
     // get program_id
493
-    $user_id = auth::user()->id; //ya, tester es 60
477
+    $user_id = auth::user()->id;
494
     $program_id = DB::table('program_user')
478
     $program_id = DB::table('program_user')
495
         ->where('user_id',$user_id)
479
         ->where('user_id',$user_id)
496
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
497
         ->select('program_id')
480
         ->select('program_id')
498
         ->get();
481
         ->get();
499
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
482
+    $program_id = $program_id[0]->program_id;
500
 
483
 
501
     // get typ_program_id
484
     // get typ_program_id
502
     $result = DB::table('typ_program')
485
     $result = DB::table('typ_program')

+ 9
- 15
app/controllers/TransformativeActionsController.php View File

5
 class TransformativeActionsController extends \BaseController
5
 class TransformativeActionsController extends \BaseController
6
 {
6
 {
7
 
7
 
8
+    // load the Tranformative actions page
8
     public function editTA()
9
     public function editTA()
9
     {
10
     {
10
         $title = "Transformative Action";
11
         $title = "Transformative Action";
190
       ));
191
       ));
191
     }
192
     }
192
 
193
 
193
-
194
     private function cleanInput()
194
     private function cleanInput()
195
     {
195
     {
196
         $clean_input = array();
196
         $clean_input = array();
262
     }
262
     }
263
 
263
 
264
 
264
 
265
-    /**
266
-     * Create a new transformative action.
267
-     *
268
-     * @return Redirect Redirect back to form page
269
-     */
265
+    // Create a Transformative Action
270
     public function createTA()
266
     public function createTA()
271
     {
267
     {
272
         $clean_input = $this->cleanInput();
268
         $clean_input = $this->cleanInput();
350
         }
346
         }
351
     }
347
     }
352
 
348
 
353
-
349
+    // apporve a Transformative Action
354
     public function approveTA()
350
     public function approveTA()
355
     {
351
     {
356
       $role = Auth::user()['role'];
352
       $role = Auth::user()['role'];
391
     }
387
     }
392
 
388
 
393
 
389
 
394
-
395
-
396
-
397
-
390
+    // update a Tranformative Action
398
     public function updateTA()
391
     public function updateTA()
399
     {
392
     {
400
       $clean_input = $this->cleanInput();
393
       $clean_input = $this->cleanInput();
539
       }
532
       }
540
     }
533
     }
541
 
534
 
542
-
535
+    // delete a Transformative Action
543
     public function deleteTA()
536
     public function deleteTA()
544
     {
537
     {
545
       $ta_id = array(Input::get('ta_id'));
538
       $ta_id = array(Input::get('ta_id'));
600
 
593
 
601
 
594
 
602
 
595
 
603
-
604
-
596
+    // load the information of a Tranformative Action when its
597
+    //  selected on the approve or edit panel
605
     public function selectTA()
598
     public function selectTA()
606
     {
599
     {
607
       $ta_id = Input::get("ta_id");
600
       $ta_id = Input::get("ta_id");
676
       );
669
       );
677
     }
670
     }
678
 
671
 
672
+    // load the available objectieves from an outcome when creating a Tranformative Action
679
     public function objectivesFromOutcome()
673
     public function objectivesFromOutcome()
680
     {
674
     {
681
       $user_id = Auth::user()->id;
675
       $user_id = Auth::user()->id;
701
       );
695
       );
702
     }
696
     }
703
 
697
 
704
-    // return TA filtered by the user on the approve or edit panel
698
+    // return Transformative Actions that meet the filter criterias
705
     public function filterTA()
699
     public function filterTA()
706
     {
700
     {
707
       $user_id = Auth::user()->id;
701
       $user_id = Auth::user()->id;

+ 1
- 7
app/views/global/view-three-year-plan.blade.php View File

9
 @stop
9
 @stop
10
 
10
 
11
 @section('main')
11
 @section('main')
12
-  {{-- TODO: look where to place this script.
13
-          if placed inside .ready() or before it,
14
-            an error that the function is not defined occurs. --}}
15
-  {{-- TODO: no reconoce acentos --}}
16
   <script type="text/javascript">
12
   <script type="text/javascript">
17
     function filterCycles() {
13
     function filterCycles() {
18
       // Declare variables
14
       // Declare variables
121
                 </style>
117
                 </style>
122
                 <thead>
118
                 <thead>
123
                   <tr style="background-color:#FDD8B5;">
119
                   <tr style="background-color:#FDD8B5;">
124
-                    {{-- <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Dominios de aprendizaje</th> --}}
125
                     <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Learning Outcomes</th>
120
                     <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Learning Outcomes</th>
126
                     <th colspan="2" class="text-center" id="cycle1"></th>
121
                     <th colspan="2" class="text-center" id="cycle1"></th>
127
                     <th colspan="2" class="text-center" id="cycle2"></th>
122
                     <th colspan="2" class="text-center" id="cycle2"></th>
139
                 <tfoot>
134
                 <tfoot>
140
                 </tfoot>
135
                 </tfoot>
141
                 <input type="text" id="cycle_id" name="cycle_id" value="getsReplacedWithJS" hidden>
136
                 <input type="text" id="cycle_id" name="cycle_id" value="getsReplacedWithJS" hidden>
142
-                      {{-- <label for="profesores">Profesores (pares)</label> --}}
143
                 <tbody id="outcome-semesters-body" onchange="update_outcome_semesters()">
137
                 <tbody id="outcome-semesters-body" onchange="update_outcome_semesters()">
144
                   @foreach ($outcomes as $outcome)
138
                   @foreach ($outcomes as $outcome)
145
                     <tr data-id="{{$outcome->id}}">
139
                     <tr data-id="{{$outcome->id}}">
208
               </div>
202
               </div>
209
             <hr>
203
             <hr>
210
             <div class="">
204
             <div class="">
211
-              <button class="btn-lg btn-primary pull-right go-to-temp" style="margin:5px;">Go to TYP evaluation page</button>
205
+              {{-- <button class="btn-lg btn-primary pull-right go-to-temp" style="margin:5px;">Go to TYP evaluation page</button> --}}
212
               <button class="btn-lg btn-primary pull-right back-to-2" style="margin:5px;">Back to Objective Selection</button>
206
               <button class="btn-lg btn-primary pull-right back-to-2" style="margin:5px;">Back to Objective Selection</button>
213
             </div>
207
             </div>
214
             </div>
208
             </div>