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

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

@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Input;
5 5
 class TransformativeActionsController extends \BaseController
6 6
 {
7 7
 
8
+    // load the Tranformative actions page
8 9
     public function editTA()
9 10
     {
10 11
         $title = "Transformative Action";
@@ -190,7 +191,6 @@ class TransformativeActionsController extends \BaseController
190 191
       ));
191 192
     }
192 193
 
193
-
194 194
     private function cleanInput()
195 195
     {
196 196
         $clean_input = array();
@@ -262,11 +262,7 @@ class TransformativeActionsController extends \BaseController
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 266
     public function createTA()
271 267
     {
272 268
         $clean_input = $this->cleanInput();
@@ -350,7 +346,7 @@ class TransformativeActionsController extends \BaseController
350 346
         }
351 347
     }
352 348
 
353
-
349
+    // apporve a Transformative Action
354 350
     public function approveTA()
355 351
     {
356 352
       $role = Auth::user()['role'];
@@ -391,10 +387,7 @@ class TransformativeActionsController extends \BaseController
391 387
     }
392 388
 
393 389
 
394
-
395
-
396
-
397
-
390
+    // update a Tranformative Action
398 391
     public function updateTA()
399 392
     {
400 393
       $clean_input = $this->cleanInput();
@@ -539,7 +532,7 @@ class TransformativeActionsController extends \BaseController
539 532
       }
540 533
     }
541 534
 
542
-
535
+    // delete a Transformative Action
543 536
     public function deleteTA()
544 537
     {
545 538
       $ta_id = array(Input::get('ta_id'));
@@ -600,8 +593,8 @@ class TransformativeActionsController extends \BaseController
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 598
     public function selectTA()
606 599
     {
607 600
       $ta_id = Input::get("ta_id");
@@ -676,6 +669,7 @@ class TransformativeActionsController extends \BaseController
676 669
       );
677 670
     }
678 671
 
672
+    // load the available objectieves from an outcome when creating a Tranformative Action
679 673
     public function objectivesFromOutcome()
680 674
     {
681 675
       $user_id = Auth::user()->id;
@@ -701,7 +695,7 @@ class TransformativeActionsController extends \BaseController
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 699
     public function filterTA()
706 700
     {
707 701
       $user_id = Auth::user()->id;

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

@@ -9,10 +9,6 @@
9 9
 @stop
10 10
 
11 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 12
   <script type="text/javascript">
17 13
     function filterCycles() {
18 14
       // Declare variables
@@ -121,7 +117,6 @@
121 117
                 </style>
122 118
                 <thead>
123 119
                   <tr style="background-color:#FDD8B5;">
124
-                    {{-- <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Dominios de aprendizaje</th> --}}
125 120
                     <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Learning Outcomes</th>
126 121
                     <th colspan="2" class="text-center" id="cycle1"></th>
127 122
                     <th colspan="2" class="text-center" id="cycle2"></th>
@@ -139,7 +134,6 @@
139 134
                 <tfoot>
140 135
                 </tfoot>
141 136
                 <input type="text" id="cycle_id" name="cycle_id" value="getsReplacedWithJS" hidden>
142
-                      {{-- <label for="profesores">Profesores (pares)</label> --}}
143 137
                 <tbody id="outcome-semesters-body" onchange="update_outcome_semesters()">
144 138
                   @foreach ($outcomes as $outcome)
145 139
                     <tr data-id="{{$outcome->id}}">
@@ -208,7 +202,7 @@
208 202
               </div>
209 203
             <hr>
210 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 206
               <button class="btn-lg btn-primary pull-right back-to-2" style="margin:5px;">Back to Objective Selection</button>
213 207
             </div>
214 208
             </div>