|
@@ -206,7 +206,7 @@ class AnnualPlansController extends \BaseController
|
206
|
206
|
$an_plan = DB::table("annual_plans")
|
207
|
207
|
->join('annual_cycle', 'annual_cycle.id', '=', 'annual_plans.annual_cycle_id')
|
208
|
208
|
->where('annual_plans.id', '=', Input::get('id'))
|
209
|
|
- ->select('annual_plans.id as id', 'program_id', 'academic_year', 'semester_start', 'semester_end')
|
|
209
|
+ ->select('annual_plans.id as id', 'program_id', 'academic_year', 'semester_start', 'semester_end', 'is_submitted')
|
210
|
210
|
->first();
|
211
|
211
|
|
212
|
212
|
$years = explode('-', $an_plan->academic_year);
|
|
@@ -232,18 +232,26 @@ class AnnualPlansController extends \BaseController
|
232
|
232
|
|
233
|
233
|
$json_to_send["outcomes"]["first"] = DB::table('outcomes')
|
234
|
234
|
->join('typ_semester_outcome', 'typ_semester_outcome.outcome_id', '=', 'outcomes.id')
|
|
235
|
+ ->join('typ_semester_objectives', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
|
|
236
|
+ ->join('typ_semester_courses', 'typ_semester_objectives.id', '=', 'typ_semester_courses.typ_semester_objective_id')
|
235
|
237
|
->where('semester_id', $an_plan->semester_start)
|
236
|
238
|
->where('typ_program_id', $current_typ_program->id)
|
|
239
|
+
|
237
|
240
|
->select('outcomes.*', 'typ_semester_outcome.id as typ_semester_outcome_id')
|
|
241
|
+ ->groupBy('typ_semester_outcome_id')
|
238
|
242
|
->get();
|
239
|
243
|
|
240
|
244
|
//DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id = {$current_typ_program->id})");
|
241
|
245
|
$json_to_send["allSemesterOrder"]["first"] = DB::select("select * from semesters where id = {$an_plan->semester_start}")[0];
|
242
|
246
|
$json_to_send["outcomes"]["second"] = DB::table('outcomes')
|
243
|
247
|
->join('typ_semester_outcome', 'typ_semester_outcome.outcome_id', '=', 'outcomes.id')
|
|
248
|
+ ->join('typ_semester_objectives', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
|
|
249
|
+ ->join('typ_semester_courses', 'typ_semester_objectives.id', '=', 'typ_semester_courses.typ_semester_objective_id')
|
|
250
|
+
|
244
|
251
|
->where('semester_id', $an_plan->semester_end)
|
245
|
252
|
->where('typ_program_id', $current_typ_program->id)
|
246
|
253
|
->select('outcomes.*', 'typ_semester_outcome.id as typ_semester_outcome_id')
|
|
254
|
+ ->groupBy('typ_semester_outcome_id')
|
247
|
255
|
->get();
|
248
|
256
|
|
249
|
257
|
//DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id ={$an_plan->semester_end} and typ_program_id = {$current_typ_program->id})");
|
|
@@ -346,17 +354,34 @@ class AnnualPlansController extends \BaseController
|
346
|
354
|
$typ_info['transformative_actions_for_outcome'] = DB::table('transformative_actions')
|
347
|
355
|
->join('transformative_typ_outcome', 'transformative_typ_outcome.trans_id', '=', 'transformative_actions.id')
|
348
|
356
|
->where('transformative_typ_outcome.typ_semester_outcome_id', $typ_semester_outcome_id)
|
|
357
|
+
|
349
|
358
|
->get();
|
350
|
359
|
$typ_info['categories'] = "<option value='0'>Nothing Selected</option>";
|
351
|
360
|
|
352
|
361
|
$types = DB::table('transformative_actions')
|
353
|
|
- ->select('type_of_TA')
|
|
362
|
+ ->select('type_of_TA', 'is_custom')
|
354
|
363
|
->where('type_of_TA', '<>', '')
|
355
|
|
- ->distinct()
|
|
364
|
+ ->where(function ($query) use (&$program_id) {
|
|
365
|
+ $query->whereNull('program_id')
|
|
366
|
+ ->orWhere('program_id', $program_id);
|
|
367
|
+ })
|
|
368
|
+ ->where('by_professor', 0)
|
|
369
|
+ ->groupBy('type_of_TA')
|
356
|
370
|
->get();
|
|
371
|
+ $optGroupGeneral = "<optgroup label='General Transformative Actions'>";
|
|
372
|
+ $optGroupCustom = "<optgroup label ='Program Custom Actions'>";
|
357
|
373
|
foreach ($types as $type) {
|
358
|
|
- $typ_info['categories'] .= "<option value = '" . $type->type_of_TA . "'>" . $type->type_of_TA . "</option>";
|
|
374
|
+
|
|
375
|
+ if ($type->is_custom) {
|
|
376
|
+ $optGroupCustom .= "<option value = '" . $type->type_of_TA . "' data-is-custom = '1'>" . $type->type_of_TA . "</option>";
|
|
377
|
+ } else {
|
|
378
|
+ $optGroupGeneral .= "<option value = '" . $type->type_of_TA . "' data-is-custom = '0'>" . $type->type_of_TA . "</option>";
|
|
379
|
+ }
|
359
|
380
|
}
|
|
381
|
+ $typ_info['categories'] .= $optGroupGeneral . '</optgroup>';
|
|
382
|
+ $typ_info['categories'] .= $optGroupCustom . '</optgroup>';
|
|
383
|
+
|
|
384
|
+
|
360
|
385
|
$typ_info['categories'] .= '<option value ="new"> New Type of Transformative Action</option>';
|
361
|
386
|
return json_encode($typ_info);
|
362
|
387
|
}
|
|
@@ -670,6 +695,7 @@ class AnnualPlansController extends \BaseController
|
670
|
695
|
$semester_id = Input::get('semester_id');
|
671
|
696
|
$annual_plan_id = Input::get('annual_plan_id');
|
672
|
697
|
$outcome_id = Input::get('outcome_id');
|
|
698
|
+ $typ_semester_outcome_id = Input::get('typ_semester_outcome_id');
|
673
|
699
|
|
674
|
700
|
$outcome = Outcome::where('id', $outcome_id)->first();
|
675
|
701
|
$outcome->objectives = $outcome->fetchObjectivesReport($semester_id, $program_id);
|
|
@@ -677,6 +703,11 @@ class AnnualPlansController extends \BaseController
|
677
|
703
|
->where('program_id', $program_id)
|
678
|
704
|
->where('semester_id', $semester_id)
|
679
|
705
|
->first();
|
|
706
|
+ $outcome->transforming_actions = DB::table('transformative_typ_outcome')
|
|
707
|
+ ->join('transformative_actions', 'transformative_actions.id', '=', 'transformative_typ_outcome.trans_id')
|
|
708
|
+ ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
|
|
709
|
+ ->select('transformative_actions.*')
|
|
710
|
+ ->get();
|
680
|
711
|
|
681
|
712
|
foreach ($outcome->objectives as $index => $objective) {
|
682
|
713
|
$objective->courses = Objective::getPlanReport($objective);
|
|
@@ -721,4 +752,66 @@ class AnnualPlansController extends \BaseController
|
721
|
752
|
}
|
722
|
753
|
return $courses;
|
723
|
754
|
}
|
|
755
|
+
|
|
756
|
+ public function submitAnnualPlan()
|
|
757
|
+ {
|
|
758
|
+ $annual_plan_id = Input::get('annual_plan_id');
|
|
759
|
+ DB::table('annual_plans')->where('id', $annual_plan_id)->update(array(
|
|
760
|
+ 'is_submitted' => 1,
|
|
761
|
+ 'submitted_on' => date('Y-m-d H:i:s')
|
|
762
|
+ ));
|
|
763
|
+ return;
|
|
764
|
+ }
|
|
765
|
+
|
|
766
|
+ public function fetchTheAnnualPlan()
|
|
767
|
+ {
|
|
768
|
+ $outcome_id = Input::get('id');
|
|
769
|
+ $semester_id = Input::get('semester');
|
|
770
|
+ $typ_semester_outcome_id = Input::get('typ_semester_outcome_id');
|
|
771
|
+ $program_id = Input::get('program_id');
|
|
772
|
+
|
|
773
|
+ $outcome = Outcome::find($outcome_id);
|
|
774
|
+
|
|
775
|
+ //El nombre es annual_plan_objective, fue cambiado como mil veces por Arlene y su combo
|
|
776
|
+ // Así que está mal escrito. Sorry future programmer
|
|
777
|
+
|
|
778
|
+ $array_to_send = [];
|
|
779
|
+ $array_to_send['typ_objectives'] = DB::table('typ_semester_objectives')
|
|
780
|
+ ->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
|
|
781
|
+ ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
|
|
782
|
+ ->select('objectives.*', 'typ_semester_outcome_id', 'typ_semester_objectives.id as typ_semester_objective_id')
|
|
783
|
+ ->get();
|
|
784
|
+ $array_to_send['typ_courses'] = DB::table('typ_semester_objectives')
|
|
785
|
+ ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
|
|
786
|
+ ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
|
|
787
|
+ ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
|
|
788
|
+ ->select('courses.*', 'typ_semester_objective_id', 'typ_semester_courses.id as typ_semester_course_id')
|
|
789
|
+ ->get();
|
|
790
|
+ $array_to_send['courses_criteria'] = DB::table('typ_semester_objectives')
|
|
791
|
+ ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
|
|
792
|
+ ->join('annual_plan_objective', 'annual_plan_objective.typ_semester_course_id', '=', 'typ_semester_courses.id')
|
|
793
|
+ ->join('criteria', 'criteria.id', '=', 'annual_plan_objective.criteria_id')
|
|
794
|
+ ->select('typ_semester_course_id', 'annual_plan_objective.*', 'criteria.*')
|
|
795
|
+ ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
|
|
796
|
+ ->groupBy('typ_semester_course_id')
|
|
797
|
+ ->get();
|
|
798
|
+ $array_to_send['courses_transformative_actions'] = DB::table('typ_semester_objectives')
|
|
799
|
+ ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
|
|
800
|
+ ->join('annual_plan_transformative', 'annual_plan_transformative.typ_semester_course_id', '=', 'typ_semester_courses.id')
|
|
801
|
+ ->join('transformative_actions', 'transformative_actions.id', '=', 'annual_plan_transformative.trans_id')
|
|
802
|
+ ->select('typ_semester_course_id', 'annual_plan_transformative.*', 'transformative_actions.*')
|
|
803
|
+ ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
|
|
804
|
+ ->groupBy('typ_semester_course_id')
|
|
805
|
+ ->get();
|
|
806
|
+ $array_to_send['transformative_outcome'] = DB::table('transformative_actions')
|
|
807
|
+ ->join('transformative_typ_outcome', 'transformative_actions.id', '=', 'transformative_typ_outcome.trans_id')
|
|
808
|
+ ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
|
|
809
|
+ ->get();
|
|
810
|
+
|
|
811
|
+ $array_to_send['expected_target'] = DB::table('target_outcomes_program')
|
|
812
|
+ ->where('program_id', $program_id)
|
|
813
|
+ ->where('semester_id', $semester_id)
|
|
814
|
+ ->first();
|
|
815
|
+ return $array_to_send;
|
|
816
|
+ }
|
724
|
817
|
}
|