Browse Source

Merge branch 'Merge_gabriel_mayo' of https://git.ccom.uprrp.edu/CDCC/OLAS into Merge_gabriel_mayo

varias cosas
parent
commit
8f5ce1f2d7

+ 78
- 36
app/controllers/AnnualPlansController.php View File

@@ -788,44 +788,86 @@ class AnnualPlansController extends \BaseController
788 788
     $objective_id = Input::get('objective_id');
789 789
     $course_code = Input::get('course_code');
790 790
     $course_number = Input::get('course_number');
791
-
792
-    $newTransId = DB::table('transformative_actions')
793
-      ->insertGetId(array(
794
-        'is_custom' => $is_custom,
795
-        'at_text' => $at_text,
796
-        'description' => $description,
797
-        'type_of_TA' => $type_of_ta,
798
-        'user_id' => Auth::user()->id,
799
-        'program_id' => $program_id,
800
-        'by_professor' => 0,
801
-        'created_at' => date('Y-m-d H:i:s'),
802
-        'updated_at' => date('Y-m-d H:i:s')
803
-      ));
804
-    DB::table('ta_course')->insert(array(
805
-      'ta_id' => $newTransId,
806
-      'course_number' => $course_number,
807
-      'course_code' => $course_code
808
-    ));
809
-    DB::table('transformative_objective')->insert(array(
810
-      'ta_id' => $newTransId,
811
-      'objective_id' => $objective_id
812
-    ));
813
-    foreach ($future_typ_course_id as $index => $typ_future_course_id) {
814
-      $annual_plan = DB::table('annual_cycle')
815
-        ->join('annual_plans', 'annual_plans.annual_cycle_id', '=', 'annual_cycle.id')
816
-        ->where('program_id', $program_id)
817
-        ->where(function ($query) use (&$future_semesters, &$index) {
818
-          $query->where('semester_start', $future_semesters[$index])
819
-            ->orWhere('semester_end', $future_semesters[$index]);
820
-        })->first();
791
+    $edit_ta_id = Input::get('edit_ta_id');
792
+
793
+    if ($edit_ta_id) {
794
+      DB::table('transformative_actions')
795
+        ->where('id', $edit_ta_id)->update(array(
796
+          'is_custom' => $is_custom,
797
+          'at_text' => $at_text,
798
+          'description' => $description,
799
+          'type_of_TA' => $type_of_ta,
800
+          'user_id' => Auth::user()->id,
801
+          'program_id' => $program_id,
802
+          //'by_professor' => 0,
803
+          //'created_at' => date('Y-m-d H:i:s'),
804
+          'updated_at' => date('Y-m-d H:i:s')
805
+        ));
821 806
       DB::table('annual_plan_transformative')
822
-        ->insert(array(
823
-          'annual_plan_id' => $annual_plan->id,
824
-          'trans_id' => $newTransId,
825
-          'typ_semester_course_id' => $typ_future_course_id,
826
-          'proposing_coordinator_id' => Auth::user()->id,
827
-          'proposed_date' => date('Y-m-d H:i:s')
807
+        ->where('trans_id', $edit_ta_id)
808
+        ->delete();
809
+      foreach ($future_typ_course_id as $index => $typ_future_course_id) {
810
+        $annual_plan = DB::table('annual_cycle')
811
+          ->join('annual_plans', 'annual_plans.annual_cycle_id', '=', 'annual_cycle.id')
812
+          ->where('program_id', $program_id)
813
+          ->where(function ($query) use (&$future_semesters, &$index) {
814
+            $query->where('semester_start', $future_semesters[$index])
815
+              ->orWhere('semester_end', $future_semesters[$index]);
816
+          })->first();
817
+        DB::table('annual_plan_transformative')
818
+          ->insert(array(
819
+            'annual_plan_id' => $annual_plan->id,
820
+            'trans_id' => $edit_ta_id,
821
+            'typ_semester_course_id' => $typ_future_course_id,
822
+            'proposing_coordinator_id' => Auth::user()->id,
823
+            'proposed_date' => date('Y-m-d H:i:s')
824
+          ));
825
+      }
826
+      $transformative_action = TransformativeAction::getTypCoursesWithSemesters($edit_ta_id);
827
+      $transformative_action[0]->updated = 1;
828
+      return $transformative_action;
829
+    } else {
830
+      $newTransId = DB::table('transformative_actions')
831
+        ->insertGetId(array(
832
+          'is_custom' => $is_custom,
833
+          'at_text' => $at_text,
834
+          'description' => $description,
835
+          'type_of_TA' => $type_of_ta,
836
+          'user_id' => Auth::user()->id,
837
+          'program_id' => $program_id,
838
+          'by_professor' => 0,
839
+          'created_at' => date('Y-m-d H:i:s'),
840
+          'updated_at' => date('Y-m-d H:i:s')
828 841
         ));
842
+      DB::table('ta_course')->insert(array(
843
+        'ta_id' => $newTransId,
844
+        'course_number' => $course_number,
845
+        'course_code' => $course_code
846
+      ));
847
+      DB::table('transformative_objective')->insert(array(
848
+        'ta_id' => $newTransId,
849
+        'objective_id' => $objective_id
850
+      ));
851
+      foreach ($future_typ_course_id as $index => $typ_future_course_id) {
852
+        $annual_plan = DB::table('annual_cycle')
853
+          ->join('annual_plans', 'annual_plans.annual_cycle_id', '=', 'annual_cycle.id')
854
+          ->where('program_id', $program_id)
855
+          ->where(function ($query) use (&$future_semesters, &$index) {
856
+            $query->where('semester_start', $future_semesters[$index])
857
+              ->orWhere('semester_end', $future_semesters[$index]);
858
+          })->first();
859
+        DB::table('annual_plan_transformative')
860
+          ->insert(array(
861
+            'annual_plan_id' => $annual_plan->id,
862
+            'trans_id' => $newTransId,
863
+            'typ_semester_course_id' => $typ_future_course_id,
864
+            'proposing_coordinator_id' => Auth::user()->id,
865
+            'proposed_date' => date('Y-m-d H:i:s')
866
+          ));
867
+      }
868
+
869
+
870
+      return TransformativeAction::getTypCoursesWithSemesters($newTransId);
829 871
     }
830 872
   }
831 873
 

+ 13
- 10
app/controllers/Objective2Controller.php View File

@@ -122,7 +122,7 @@ class Objective2Controller extends \BaseController
122 122
 
123 123
 		$json['assoc_criteria'] = DB::select("select name from criteria where id in(select criterion_id from criterion_objective_outcome where objective_id =?)", array(Input::get('id')));
124 124
 		Log::info('is here');
125
-// 		Log::info(json_encode($json));
125
+		// 		Log::info(json_encode($json));
126 126
 		return json_encode($json);
127 127
 	}
128 128
 	public function fetchAllobjectives()
@@ -137,7 +137,7 @@ class Objective2Controller extends \BaseController
137 137
 		Log::info($json);
138 138
 		return json_encode($json);
139 139
 	}
140
-	
140
+
141 141
 	public function delete()
142 142
 	{
143 143
 		DB::delete("delete from objectives where id = ?", array(Input::get('deleteObj')));
@@ -223,11 +223,14 @@ class Objective2Controller extends \BaseController
223 223
 			/** If Objective is saved, send success message */
224 224
 			if ($objective->save()) {
225 225
 				$objectiveId = $objective->id;
226
+
227
+
226 228
 				foreach ($clean_input['program_id'] as $program_id) {
227 229
 					DB::insert("insert into objective_program (objective_id, program_id) values({$objectiveId},{$program_id})");
228 230
 				}
229 231
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
230 232
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
233
+
231 234
 					/*if (!($objectiveOutcome->save())) {
232 235
 						Session::flash('status', 'danger');
233 236
 						Session::flash('message', '<p>Error creating objective. Please try again later.</p>');
@@ -235,13 +238,13 @@ class Objective2Controller extends \BaseController
235 238
 					}*/
236 239
 				}
237 240
 				DB::table('criterion_objective_outcome')
238
-				->join('program_criterion' , 'criterion_objective_outcome.criterion_id',"=",'program_criterion.criterion_id')
239
-				->whereIn('program_id',$clean_input['program_id'])
240
-				->whereIn('outcome_id',$clean_input['outcome_id'])
241
-				->where('objective_id','=',0)
242
-				->update(array('objective_id'=>$objectiveId));
243
-// 				update("update criterion_objective_outcome coo join program_criterion pc on coo.criterion_id=pc.criterion_id set 
244
-// 				objective_id= {$objectiveId} where program_id in (".$clean_input['program_id'].") and objective_id=0 and outcome_id in (".$clean_input['outcome_id'].")");
241
+					->join('program_criterion', 'criterion_objective_outcome.criterion_id', "=", 'program_criterion.criterion_id')
242
+					->whereIn('program_id', $clean_input['program_id'])
243
+					->whereIn('outcome_id', $clean_input['outcome_id'])
244
+					->where('objective_id', '=', 0)
245
+					->update(array('objective_id' => $objectiveId));
246
+				// 				update("update criterion_objective_outcome coo join program_criterion pc on coo.criterion_id=pc.criterion_id set 
247
+				// 				objective_id= {$objectiveId} where program_id in (".$clean_input['program_id'].") and objective_id=0 and outcome_id in (".$clean_input['outcome_id'].")");
245 248
 
246 249
 				Session::flash('status', 'success');
247 250
 				Session::flash('message', 'Objective created: "' . $objective->text . '".');
@@ -348,7 +351,7 @@ class Objective2Controller extends \BaseController
348 351
 		$objectives_from_school = DB::table('programs')
349 352
 			->join('objective_program', 'objective_program.program_id', '=', 'programs.id')
350 353
 			->where('programs.school_id', $userSchool)
351
-			->where('objective_program.objective_id', "<>" , 0)
354
+			->where('objective_program.objective_id', "<>", 0)
352 355
 			->lists('objective_id');
353 356
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->whereIn('id', $objectives_from_school)->get();
354 357
 		$programs = Program::where("school_id", "=", $userSchool)->orderBy('name', 'ASC')->get();

+ 4
- 3
app/controllers/OutcomesController.php View File

@@ -922,9 +922,10 @@ class OutcomesController extends \BaseController
922 922
     /**
923 923
      * School Assessment Reports
924 924
      */
925
-private function cmp($a, $b) {
926
-    return strcmp($a->name, $b->name);
927
-}
925
+    private function cmp($a, $b)
926
+    {
927
+        return strcmp($a->name, $b->name);
928
+    }
928 929
     public function schoolAssessmentReport()
929 930
     {
930 931
 

+ 8
- 1
app/controllers/RubricsController.php View File

@@ -19,6 +19,11 @@ class RubricsController extends \BaseController
19 19
         $title = 'Rubric for <em>' . $activity->name . '</em>';
20 20
 
21 21
         // Select templates that belong to everyone or belong to the activity's course's school
22
+        $usable_templates = DB::table('templates')->join('template_criterion', 'template_criterion.template_id', '=', 'templates.id')
23
+            ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'template_criterion.criterion_id')
24
+            ->where('objective_id', '<>', 0)
25
+            ->groupBy('template_id')
26
+            ->lists('template_id');
22 27
         $templates = Template::where('is_visible', '=', 1)
23 28
             ->where(function ($query) use ($activity) {
24 29
                 if (Auth::user()->role != 1) {
@@ -27,6 +32,8 @@ class RubricsController extends \BaseController
27 32
                         ->orWhere('school_id', '=', NULL);
28 33
                 }
29 34
             })
35
+            ->whereIn('templates.id', $usable_templates)
36
+
30 37
             ->orderBy('name', 'ASC')->get();
31 38
 
32 39
         $rubrics = Auth::user()->rubrics;
@@ -494,4 +501,4 @@ class RubricsController extends \BaseController
494 501
         //        return json_encode($criterion);
495 502
         //    }
496 503
     }
497
-}
504
+}

+ 5
- 5
app/controllers/TransformativeActionsController.php View File

@@ -634,7 +634,7 @@ class TransformativeActionsController extends \BaseController
634 634
       Session::flash('status', 'danger');
635 635
       Session::flash('message', $message);
636 636
 
637
-      $role = Auth::user()['role'];
637
+      //$role = Auth::user()['role'];
638 638
       return Redirect::to('transformativeAction')->withInput();
639 639
     }
640 640
 
@@ -718,7 +718,7 @@ class TransformativeActionsController extends \BaseController
718 718
       ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
719 719
       ->join('objectives', 'objectives.id', '=', 'transformative_objective.objective_id')
720 720
       ->where('transformative_actions.id', $ta_id)
721
-      ->where('objectives.id', '<>',0)
721
+      ->where('objectives.id', '<>', 0)
722 722
       ->select('objectives.text as text', 'objectives.id as id')
723 723
       ->orderBy('objectives.text', 'ASC')
724 724
       ->get();
@@ -726,7 +726,7 @@ class TransformativeActionsController extends \BaseController
726 726
       ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
727 727
       ->join('objectives', 'objectives.id', '=', 'transformative_objective.objective_id')
728 728
       ->where('transformative_actions.id', $ta_id)
729
-      ->where('objectives.id', '<>',0)
729
+      ->where('objectives.id', '<>', 0)
730 730
       ->select('objectives.text as text', 'objectives.id as id')
731 731
       ->orderBy('objectives.text', 'ASC')
732 732
       ->lists('objectives.id');
@@ -745,7 +745,7 @@ class TransformativeActionsController extends \BaseController
745 745
       ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
746 746
       ->whereIn('objective_outcome.outcome_id', $outcome_ids)
747 747
       ->whereIn('objective_program.program_id', $program_ids)
748
-      ->where('objective_outcome.objective_id', '<>',0)
748
+      ->where('objective_outcome.objective_id', '<>', 0)
749 749
       ->orderBy('objectives.text', 'ASC')
750 750
       ->select('objectives.text as text', 'objectives.id as id')
751 751
       ->distinct()
@@ -833,7 +833,7 @@ class TransformativeActionsController extends \BaseController
833 833
       ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
834 834
       ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
835 835
       ->where('objective_outcome.outcome_id', $outcome_id)
836
-      ->where('objective_outcome.objective_id','<>',0 )
836
+      ->where('objective_outcome.objective_id', '<>', 0)
837 837
       ->whereIn('objective_program.program_id', $program_ids)
838 838
       ->orderBy('objectives.text', 'ASC')
839 839
       ->select('objectives.text as text', 'objectives.id as id')

+ 52
- 6
app/models/Course.php View File

@@ -59,7 +59,8 @@ class Course extends Eloquent
59 59
 
60 60
   public static function getFutureTypSemesterCourses($typ_semester_course_id, $program_id)
61 61
   {
62
-    $typ_info = DB::table('typ_semester_outcome')
62
+    $typ_info = new stdClass();
63
+    $typ_info->future_semesters = DB::table('typ_semester_outcome')
63 64
       ->join('typ_semester_objectives', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
64 65
       ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
65 66
       ->join('typ_semester_outcome as typ_o_2', 'typ_o_2.outcome_id', '=', 'typ_semester_outcome.outcome_id')
@@ -74,6 +75,8 @@ class Course extends Eloquent
74 75
       })
75 76
       ->join('typ_program', 'typ_o_2.typ_program_id', '=', 'typ_program.id')
76 77
       ->join('semesters', 'semesters.id', '=', 'typ_o_2.semester_id')
78
+      ->leftJoin('annual_plan_transformative', 'annual_plan_transformative.typ_semester_course_id', '=', 'typ_course_2.id')
79
+      ->leftJoin('transformative_actions', 'transformative_actions.id', '=', 'annual_plan_transformative.trans_id')
77 80
 
78 81
       ->where('typ_semester_courses.id', $typ_semester_course_id)
79 82
       ->where('typ_program.program_id', $program_id)
@@ -88,13 +91,56 @@ class Course extends Eloquent
88 91
         'typ_ob_2.id as typ_future_objective_id',
89 92
         'typ_course_2.id as typ_future_course_id',
90 93
         'semesters.name as semester_name',
91
-        'semesters.code as semester_code'
92
-      );
94
+        'semesters.code as semester_code',
95
+        'transformative_actions.id as trans_id',
96
+        'transformative_actions.type_of_TA',
97
+        'transformative_actions.at_text',
98
+        'transformative_actions.description'
99
+
100
+      )->get();
93 101
     //Log::info('El sql');
102
+    $typ_info->future_transformative_actions  = DB::table('typ_semester_outcome')
103
+      ->join('typ_semester_objectives', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
104
+      ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
105
+      ->join('typ_semester_outcome as typ_o_2', 'typ_o_2.outcome_id', '=', 'typ_semester_outcome.outcome_id')
106
+      ->join('semesters as sem1', 'sem1.id', '=', 'typ_semester_outcome.semester_id')
107
+      ->join('typ_semester_objectives as typ_ob_2', function ($query) {
108
+        $query->on('typ_ob_2.typ_semester_outcome_id', '=', 'typ_o_2.id')
109
+          ->on('typ_semester_objectives.objective_id', '=', 'typ_ob_2.objective_id');
110
+      })
111
+      ->join('typ_semester_courses as typ_course_2', function ($join) {
112
+        $join->on('typ_course_2.typ_semester_objective_id', '=', 'typ_ob_2.id')
113
+          ->on('typ_semester_courses.course_id', '=', 'typ_course_2.course_id');
114
+      })
115
+      ->join('typ_program', 'typ_o_2.typ_program_id', '=', 'typ_program.id')
116
+      ->join('semesters', 'semesters.id', '=', 'typ_o_2.semester_id')
117
+      ->leftJoin('annual_plan_transformative', 'annual_plan_transformative.typ_semester_course_id', '=', 'typ_course_2.id')
118
+      ->leftJoin('transformative_actions', 'transformative_actions.id', '=', 'annual_plan_transformative.trans_id')
119
+
120
+      ->where('typ_semester_courses.id', $typ_semester_course_id)
121
+      ->where('typ_program.program_id', $program_id)
122
+      ->whereRaw('sem1.code < semesters.code')
123
+      //->groupBy('typ_o_2.semester_id')
124
+      ->select(
125
+        'typ_o_2.semester_id',
126
+        'typ_o_2.outcome_id',
127
+        'typ_o_2.id',
128
+        'typ_semester_courses.course_id',
129
+        'typ_semester_objectives.objective_id',
130
+        'typ_ob_2.id as typ_future_objective_id',
131
+        'typ_course_2.id as typ_future_course_id',
132
+        'semesters.name as semester_name',
133
+        'semesters.code as semester_code',
134
+        'transformative_actions.id as trans_id',
135
+        'transformative_actions.type_of_TA',
136
+        'transformative_actions.at_text',
137
+        'transformative_actions.description'
138
+
139
+      )->get();
94 140
     //Log::info($typ_info->toSql());
95
-    //Log::info($typ_semester_course_id);
96
-    //Log::info($program_id);
97
-    return $typ_info->get();
141
+    Log::info($typ_semester_course_id);
142
+    Log::info($program_id);
143
+    return $typ_info;
98 144
   }
99 145
   public function publishedActivities()
100 146
   {

+ 20
- 1
app/models/TransformativeAction.php View File

@@ -12,6 +12,25 @@ class TransformativeAction extends Eloquent
12 12
             ->first();
13 13
     }
14 14
 
15
+    public static function getTypCoursesWithSemesters($trans_id)
16
+    {
17
+        return DB::table('transformative_actions')
18
+            ->join('annual_plan_transformative', 'annual_plan_transformative.trans_id', '=', 'transformative_actions.id')
19
+            ->join('typ_semester_courses', 'typ_semester_courses.id', '=', 'annual_plan_transformative.typ_semester_course_id')
20
+            ->join('typ_semester_objectives', 'typ_semester_objectives.id', '=', 'typ_semester_courses.typ_semester_objective_id')
21
+            ->join('typ_semester_outcome', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
22
+            ->join('semesters', 'semesters.id', '=', 'typ_semester_outcome.semester_id')
23
+            ->where('transformative_actions.id', $trans_id)
24
+            ->select(
25
+                'transformative_actions.*',
26
+                'transformative_actions.id as trans_id',
27
+                'semesters.id',
28
+                'semesters.code',
29
+                'typ_semester_course_id as typ_future_course_id'
30
+            )
31
+            ->get();
32
+    }
33
+
15 34
     public static function getCategoriesHtml($program_id)
16 35
     {
17 36
         $categories = "<option value='0'>Nothing Selected</option>";
@@ -27,7 +46,7 @@ class TransformativeAction extends Eloquent
27 46
             ->groupBy('type_of_TA')
28 47
             ->get();
29 48
         $optGroupGeneral = "<optgroup label='General Transformative Actions'>";
30
-        $optGroupCustom = "<optgroup label ='Program Custom Actions'>";
49
+        $optGroupCustom = "<optgroup label ='Program Custom Actions' id = 'program_custom_action'>";
31 50
         foreach ($types as $type) {
32 51
 
33 52
             if ($type->is_custom) {

+ 4
- 1
app/views/local/managers/admins/criteria.blade.php View File

@@ -92,7 +92,7 @@
92 92
                     </div>
93 93
                     <div class="form-group form_validation maximum_form ">
94 94
                         {{ Form::label('maximum_score', 'Maximum Score') }}
95
-                        {{ Form::text('maximum_score', '1', ['class' => 'form-control', 'id' => 'maximum_score', 'oninput' => 'addOptions("Num_scale", "maximum_score", "Scales")']) }}
95
+                        {{ Form::text('maximum_score', '8', ['class' => 'form-control', 'id' => 'maximum_score', 'oninput' => 'addOptions("Num_scale", "maximum_score", "Scales")']) }}
96 96
                     </div>
97 97
                     <div class="form-group form_validation number_of_scales">
98 98
                         {{ Form::label('scales', 'Number of Scales') }}
@@ -296,7 +296,10 @@
296 296
 
297 297
         $(document).ready(function() {
298 298
             addOptions('Num_scale', 'maximum_score', 'Scales');
299
+            $('#Num_scale').val('4');
299 300
             numberOfScales('Num_scale', 'Scales');
301
+            
302
+            $('.selectpicker').selectpicker('refresh');
300 303
         });
301 304
 
302 305
         //Input Validation function to client side

+ 922
- 892
app/views/local/managers/pCoords/criteria.blade.php
File diff suppressed because it is too large
View File


+ 937
- 931
app/views/local/managers/sCoords/criteria.blade.php
File diff suppressed because it is too large
View File


+ 3
- 2
app/views/local/managers/shared/annual-plans.blade.php View File

@@ -1250,8 +1250,9 @@
1250 1250
                         'id': 'list'
1251 1251
                     });
1252 1252
                     var onclick = "";
1253
-                    if (json.annual_plans.is_submitted==1)
1254
-                        onclick = "fetchEverythingSubmitted(this)";
1253
+                    //TODO CHange this
1254
+                    if (json.annual_plans.is_submitted!=2 )
1255
+                        onclick = "fetchEverything(this)";
1255 1256
                     else onclick = "fetchEverything(this)";
1256 1257
                     if (json.outcomes.first) {
1257 1258
                         header5 = $('<h5/>', {

+ 802
- 550
app/views/local/managers/shared/annual_report.blade.php
File diff suppressed because it is too large
View File


+ 1
- 1
app/views/local/managers/shared/rubrics.blade.php View File

@@ -485,7 +485,7 @@ function fetchObjective(outcome){
485 485
 
486 486
 }
487 487
 // Fetch criteria associated to a specific learning outcome 
488
-
488
+//here
489 489
 function fetchCriteria(outcome, objective)
490 490
 {
491 491
     amount_of_scales = parseInt($('#number_of_scales').find(':selected').val());