Browse Source

El big update por si mi compu muere

parent
commit
defbbd42a7

+ 227
- 2
app/controllers/AnnualPlansController.php View File

@@ -1,8 +1,10 @@
1 1
 <?php
2 2
 
3
+use Barryvdh\DomPDF\PDF as PDF;
3 4
 use Illuminate\Support\Facades\Auth;
4 5
 use Illuminate\Support\Facades\Input;
5 6
 
7
+
6 8
 class AnnualPlansController extends \BaseController
7 9
 {
8 10
 
@@ -728,6 +730,8 @@ class AnnualPlansController extends \BaseController
728 730
     return $outcome;
729 731
   }
730 732
 
733
+
734
+
731 735
   public function fetchObjectiveInfo()
732 736
   {
733 737
     $typ_objective_id = Input::get('typ_objective_id');
@@ -765,7 +769,7 @@ class AnnualPlansController extends \BaseController
765 769
     return $courses;
766 770
   }
767 771
 
768
-  public function submitAnnualPlan()
772
+  /* public function submitAnnualPlan()
769 773
   {
770 774
     $annual_plan_id = Input::get('annual_plan_id');
771 775
     DB::table('annual_plans')->where('id', $annual_plan_id)->update(array(
@@ -773,7 +777,7 @@ class AnnualPlansController extends \BaseController
773 777
       'submitted_on' => date('Y-m-d H:i:s')
774 778
     ));
775 779
     return;
776
-  }
780
+  }*/
777 781
 
778 782
   public function futureTransformative()
779 783
   {
@@ -954,4 +958,225 @@ class AnnualPlansController extends \BaseController
954 958
     DB::table('typ_outcome_report_comments')->where('id', $comment_id)->delete();
955 959
     return;
956 960
   }
961
+
962
+  //Print annual report
963
+  public function printAnnualReport($annual_id = null)
964
+  {
965
+
966
+
967
+    //$download = 0;
968
+
969
+    $annualPlan = AnnualPlan::find($annual_id);
970
+
971
+    //$pdf =  new PDF();
972
+    /*$pdf = new PDF(app('config'), app("Filesystem"), app('view'), '/storage/plan_pdf');
973
+    $pdf = $pdf->loadView('local.managers.shared.print_annual_report', compact('annualPlan', 'download'))
974
+      ->setOrientation("landscape")
975
+
976
+      ->setPaper('legal', 'landscape');
977
+
978
+    $pdf->save(app_path() . '/storage/annual_pdfs/' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf');
979
+    return $pdf->download(date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf');
980
+    */ //pdf = $pdf->setOrientation("landscape");
981
+    return View::make('local.managers.shared.print_annual_report', compact('annualPlan'));
982
+  }
983
+
984
+  public function postAnnualReport($annual_id)
985
+  {
986
+
987
+    $annualPlan = AnnualPlan::findOrFail($annual_id);
988
+    $pdf = new PDF(app('config'), app("Filesystem"), app('view'), '/storage/plan_pdf');
989
+    $pdf = $pdf->loadView('local.managers.shared.print_annual_report', compact('annualPlan', 'download'))
990
+      ->setOrientation("landscape")
991
+
992
+      ->setPaper('legal', 'landscape');
993
+    $path = app_path() . '/storage/annual_pdfs/' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
994
+    $pdf->save($path);
995
+    $name = date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
996
+    $pdf->download($name);
997
+
998
+    //is a path already there
999
+
1000
+    $it_exists = DB::table("paths_for_annual_plans")
1001
+      ->where('path_to_pdf', $path)
1002
+      ->first();
1003
+
1004
+    if (isset($it_exists)) {
1005
+      return '200';
1006
+    }
1007
+
1008
+    DB::table("paths_for_annual_plans")
1009
+      ->where('annual_plan_id', $annual_id)
1010
+      ->where('report', 1)
1011
+      ->update(array(
1012
+        'last' => 0
1013
+      ));
1014
+
1015
+    DB::table('paths_for_annual_plans')->insert(array(
1016
+      "path_to_pdf" => $path,
1017
+      'annual_plan_id' => $annual_id,
1018
+      'last' => 1,
1019
+      'report' => 1,
1020
+    ));
1021
+
1022
+
1023
+    return '200';
1024
+  }
1025
+
1026
+  public function checkIfPlanReady()
1027
+  {
1028
+    $annual_plan = AnnualPlan::findOrFail(Input::get("annual_id"));
1029
+
1030
+    /*
1031
+      error = [
1032
+        [
1033
+        outcome, objective, course
1034
+      ]
1035
+        ]
1036
+    */
1037
+    $error_array = [];
1038
+
1039
+    foreach ($annual_plan->courses as $index => $course) {
1040
+      Log::info('paired Criteria');
1041
+      Log::info($course->paired_criteria);
1042
+      if (count($course->paired_criteria) <= 0) {
1043
+        $outcome = $course->paired_objective->paired_outcome;
1044
+        $objective = $course->paired_objective;
1045
+        $array_to_be_appended = [
1046
+          "outcome_name" => $outcome->name,
1047
+          "objective_text" => $objective->text,
1048
+          "course_code" => $course->code . '-' . $course->number,
1049
+          'typ_semester_course_id' => $course->typ_semester_course_id,
1050
+          'typ_semester_objective_id' => $objective->typ_semester_objective_id,
1051
+          'typ_semester_outcome_id' => $outcome->typ_semester_outcome_id
1052
+        ];
1053
+
1054
+        $error_array[] = $array_to_be_appended;
1055
+      }
1056
+    }
1057
+
1058
+    return $error_array;
1059
+  }
1060
+
1061
+  public function checkIfReady()
1062
+  {
1063
+    $annual_plan = AnnualPlan::find(Input::get('annual_id'));
1064
+
1065
+    /*Error message schema
1066
+    
1067
+      courses_where_missing_data = [
1068
+        course_1=>[
1069
+          info, info
1070
+          objective => {
1071
+            typ_semester_objective_id,
1072
+            objective_text
1073
+          }
1074
+          outcome => {
1075
+            typ_semester_outcome_id,
1076
+            outcome_name
1077
+          }
1078
+        ]
1079
+      ]
1080
+    
1081
+
1082
+    */
1083
+
1084
+    $courses_where_missing_data = [
1085
+      'courses' => [],
1086
+      'outcomes' => []
1087
+    ];
1088
+    Log::info($annual_plan->courses_with_transformative_actions);
1089
+    foreach ($annual_plan->courses_with_transformative_actions as $course) {
1090
+
1091
+      foreach ($course->proposed_transformative_actions as $ta) {
1092
+        if (!isset($ta->status)) {
1093
+          $objective = $course->paired_objective;
1094
+          $objective_info = [
1095
+            'typ_semester_objective_id' => $objective->typ_semester_objective_id,
1096
+            'text' => $objective->text
1097
+          ];
1098
+          $outcome = $objective->paired_outcome;
1099
+          $outcome_info = [
1100
+            'typ_semester_outcome_id' => $outcome->typ_semester_outcome_id,
1101
+            'name' => $outcome->name
1102
+          ];
1103
+          $array_to_be_appended = [
1104
+            'course_name' => $course->code . '-' . $course->number,
1105
+            'objective' => $objective_info,
1106
+            'outcome' => $outcome_info,
1107
+            'transformative_action_title' => $ta->at_text,
1108
+            'transformative_action_description' => $ta->description,
1109
+            'typ_semester_course_id' => $course->typ_semester_course_id
1110
+          ];
1111
+          $courses_where_missing_data['courses'][] = $array_to_be_appended;
1112
+        }
1113
+      }
1114
+    }
1115
+    foreach ($annual_plan->outcomes as $outcome) {
1116
+      foreach ($outcome->program_transformative_actions as $ta) {
1117
+        if (!isset($ta->status)) {
1118
+          $array_to_be_appended = [
1119
+            'typ_semester_outcome_id' => $outcome->typ_semester_outcome_id,
1120
+            'outcome_name' => $outcome->name,
1121
+            'transformative_action_title' => $ta->at_text,
1122
+            'transformative_action_description' => $ta->description
1123
+          ];
1124
+          $courses_where_missing_data['outcomes'][] = $array_to_be_appended;
1125
+        }
1126
+      }
1127
+    }
1128
+    return $courses_where_missing_data;
1129
+  }
1130
+
1131
+
1132
+  function printAnnualPlan($annual_id)
1133
+  {
1134
+    $alphabet = range("A", "Z");
1135
+    $annualPlan = AnnualPlan::findOrFail($annual_id);
1136
+    $small_alphabet = range('a', 'z');
1137
+    return View::make('local.managers.shared.print_annual_plan', compact('annualPlan', 'alphabet', 'small_alphabet'));
1138
+  }
1139
+
1140
+  function submitAnnualPlan($annual_id)
1141
+  {
1142
+    $alphabet = range("A", "Z");
1143
+    $small_alphabet = range('a', 'z');
1144
+    $annualPlan = AnnualPlan::findOrFail($annual_id);
1145
+    $pdf = new PDF(app('config'), app("Filesystem"), app('view'), '/storage/plan_pdf');
1146
+    $pdf = $pdf->loadView('local.managers.shared.print_annual_plan', compact('annualPlan', 'alphabet', 'small_alphabet'))
1147
+      ->setOrientation("landscape")
1148
+
1149
+      ->setPaper('legal', 'landscape');
1150
+    $path = app_path() . '/storage/annual_pdfs/plan-on-' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
1151
+    $pdf->save($path);
1152
+    $name = "plan-on-" . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
1153
+    $pdf->download($name);
1154
+
1155
+    //is a path already there
1156
+
1157
+    $it_exists = DB::table("paths_for_annual_plans")
1158
+      ->where('path_to_pdf', $path)
1159
+      ->first();
1160
+
1161
+    if (isset($it_exists)) {
1162
+      return '200';
1163
+    }
1164
+
1165
+    DB::table("paths_for_annual_plans")
1166
+      ->where('annual_plan_id', $annual_id)
1167
+      ->where('report', 0)
1168
+      ->update(array(
1169
+        'last' => 0
1170
+      ));
1171
+
1172
+    DB::table('paths_for_annual_plans')->insert(array(
1173
+      "path_to_pdf" => $path,
1174
+      'annual_plan_id' => $annual_id,
1175
+      'last' => 1,
1176
+      'report' => 0,
1177
+    ));
1178
+
1179
+
1180
+    return '200';
1181
+  }
957 1182
 }

+ 4
- 4
app/controllers/Objective2Controller.php View File

@@ -181,7 +181,7 @@ class Objective2Controller extends \BaseController
181 181
 			/** Send error message and old data */
182 182
 			Session::flash('status', 'danger');
183 183
 			Session::flash('message', $message);
184
-			return Redirect::to('objective')->withInput();
184
+			return Redirect::to('objectives')->withInput();
185 185
 			/*$role = Auth::user()['role'];
186 186
 			switch ($role) {
187 187
 				case 1:
@@ -199,7 +199,7 @@ class Objective2Controller extends \BaseController
199 199
 				/** Send error message and old data */
200 200
 				Session::flash('status', 'danger');
201 201
 				Session::flash('message', "This objective is a duplicate of an already saved Objective because it's and associated program are the same.");
202
-				return Redirect::to('objective')->withInput();
202
+				return Redirect::to('objectives')->withInput();
203 203
 				/*$role = Auth::user()['role'];
204 204
 				switch ($role) {
205 205
 					case 1:
@@ -251,7 +251,7 @@ class Objective2Controller extends \BaseController
251 251
 
252 252
 				Session::flash('status', 'success');
253 253
 				Session::flash('message', 'Objective created: "' . $objective->text . '".');
254
-				return Redirect::to('objective')->withInput(Input::only('outcome_id'));
254
+				return Redirect::to('objectives')->withInput(Input::only('outcome_id'));
255 255
 				/*$role = Auth::user()['role'];
256 256
 				switch ($role) {
257 257
 					case 1:
@@ -505,7 +505,7 @@ class Objective2Controller extends \BaseController
505 505
 				switch ($role) {
506 506
 					case 1:
507 507
 						return $MessageArray;
508
-						return Redirect::to('objective')->withInput();
508
+						return Redirect::to('objectives')->withInput();
509 509
 
510 510
 					case 2:
511 511
 						return $MessageArray;

+ 5
- 2
app/controllers/TemplatesController.php View File

@@ -48,6 +48,7 @@ class TemplatesController extends \BaseController
48 48
 			->orderBy('name')
49 49
 			->get();
50 50
 		$role = Auth::user()->role;
51
+
51 52
 		switch ($role) {
52 53
 			case 1:
53 54
 				$templates = Template::orderBy('name')->get();
@@ -79,11 +80,13 @@ class TemplatesController extends \BaseController
79 80
 					->orWhere(function ($query) use (&$program_ids, &$school_ids) {
80 81
 						$query->where('school_id', $school_ids)
81 82
 							->where('program_id', $program_ids);
82
-					})
83
+					});
84
+				Log::info($templates->toSql());
83 85
 
84
-					->get();
86
+				$templates =  $templates->get();
85 87
 				break;
86 88
 		}
89
+		Log::info($templates);
87 90
 		//$templates = Template::orderBy('name')->get();
88 91
 
89 92
 		return View::make('local.managers.shared.rubric_list', compact('title', 'global_templates', 'schools', 'templates', 'role'));

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

@@ -1497,13 +1497,15 @@ class TransformativeActionsController extends \BaseController
1497 1497
       ->where('trans_id', $trans_id)
1498 1498
       ->first();
1499 1499
     if ($existing_status) {
1500
-      DB::table('transformative_action_status')->update(array(
1501
-        'results' => $results,
1502
-        'comments' => $comments,
1503
-        'accomplished' => $accomplished,
1504
-        'it_was_useful' => $was_it_useful,
1505
-        'supervised_coordinator_id' => Auth::user()->id
1506
-      ));
1500
+      DB::table('transformative_action_status')
1501
+        ->where('trans_id', $trans_id)
1502
+        ->update(array(
1503
+          'results' => $results,
1504
+          'comments' => $comments,
1505
+          'accomplished' => $accomplished,
1506
+          'it_was_useful' => $was_it_useful,
1507
+          'supervised_coordinator_id' => Auth::user()->id
1508
+        ));
1507 1509
     } else {
1508 1510
       DB::table('transformative_action_status')->insert(array(
1509 1511
         'trans_id' => $trans_id,

+ 32
- 0
app/database/migrations/2022_04_04_153807_add_report_to_pdf_annual_plans.php View File

@@ -0,0 +1,32 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class AddReportToPdfAnnualPlans extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::table('paths_for_annual_plans', function (Blueprint $table) {
17
+			$table->boolean('report');
18
+		});
19
+	}
20
+
21
+	/**
22
+	 * Reverse the migrations.
23
+	 *
24
+	 * @return void
25
+	 */
26
+	public function down()
27
+	{
28
+		Schema::table('paths_for_annual_plans', function (Blueprint $table) {
29
+			$table->dropColumn('report');
30
+		});
31
+	}
32
+}

+ 23
- 0
app/models/AnnualCycle.php View File

@@ -0,0 +1,23 @@
1
+<?php
2
+
3
+class AnnualCycle extends \Eloquent
4
+{
5
+    protected $fillable = [];
6
+    protected $table = 'annual_cycle';
7
+    //protected $appends = ["outcomes"];
8
+
9
+    // return outcomes in annual plan to
10
+    public function annual_plans()
11
+    {
12
+        return $this->hasMany('AnnualPlan');
13
+    }
14
+
15
+    public function semester_start()
16
+    {
17
+        return $this->belongsTo("Semester", "annual_cycle_semester_start_foreign", "semester_start");
18
+    }
19
+    public function semester_end()
20
+    {
21
+        return $this->belongsTo("Semester", "annual_cycle_semester_end_foreign", "semester_end");
22
+    }
23
+}

+ 215
- 7
app/models/AnnualPlan.php View File

@@ -1,17 +1,225 @@
1 1
 <?php
2 2
 
3
-class AnnualPlan extends \Eloquent {
3
+class AnnualPlan extends \Eloquent
4
+{
4 5
 	protected $fillable = [];
6
+	protected $table = 'annual_plans';
7
+	protected $appends = ["outcomes"];
5 8
 
6
-	// return the quinquennium the annual plan belongs to
7
-	public function quinquennium()
9
+	// return outcomes in annual plan to
10
+	public function program()
8 11
 	{
9
-		return $this->belongsTo('Quinquennium');
12
+		return $this->belongsTo('Program');
10 13
 	}
14
+	public function annualCycle()
15
+	{
16
+
17
+		return $this->belongsTo('AnnualCycle');
18
+	}
19
+
20
+	//courses_with_transformative
21
+
22
+	//
23
+
24
+	public function getCoursesAttribute()
25
+	{
26
+
27
+		$sql = Course::join('typ_semester_courses', 'typ_semester_courses.course_id', '=', 'courses.id')
28
+			->join('typ_semester_objectives', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
29
+			->join("typ_semester_outcome", 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
30
+			->join("annual_cycle", function ($join) {
31
+				$join->on('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_start')
32
+					->orOn('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_end');
33
+			})
34
+			->join('annual_plans', 'annual_plans.annual_cycle_id', '=', 'annual_cycle.id')
35
+			->where('annual_plans.program_id', $this->program_id)
36
+			->where('annual_plans.id', $this->id)
37
+			->select('courses.*', 'typ_semester_courses.id as typ_semester_course_id', 'annual_plans.program_id', 'typ_semester_outcome.semester_id as semester_id')
38
+			->toSql();
39
+		Log::info($sql);
40
+		Log::info("Aqui sql");
41
+		return Course::join('typ_semester_courses', 'typ_semester_courses.course_id', '=', 'courses.id')
42
+			->join('typ_semester_objectives', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
43
+			->join("typ_semester_outcome", 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
44
+			->join("annual_cycle", function ($join) {
45
+				$join->on('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_start')
46
+					->orOn('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_end');
47
+			})
48
+			->join('annual_plans', 'annual_plans.annual_cycle_id', '=', 'annual_cycle.id')
49
+			->where('annual_plans.program_id', $this->program_id)
50
+			->where('annual_plans.id', $this->id)
51
+			->select('courses.*', 'typ_semester_courses.id as typ_semester_course_id', 'annual_plans.program_id', 'typ_semester_outcome.semester_id as semester_id')
52
+			->get();
53
+	}
54
+
55
+	//Aprendi luego que se puede hacer esto smh
11 56
 
12
-	// return all the outcomes in the annual plan
13
-	public function annualPlanOutcomes()
57
+	public function getCoursesWithTransformativeActionsAttribute()
14 58
 	{
15
-		return $this->hasMany('AnnualPlanOutcome');
59
+		/*$courses = DB::table("annual_plans")
60
+
61
+			->join('annual_plan_transformative', 'annual_plans.id', '=', 'annual_plan_transformative.annual_plan_id')
62
+			->join('typ_semester_courses', 'annual_plan_transformative.typ_semester_course_id', '=', 'typ_semester_courses.id')
63
+			->where('annual_plan_id', $this->id)
64
+			->select('typ_semester_courses.id as typ_semester_course_id', 'typ_semester_courses.course_id as course_id')
65
+			->get();
66
+		$course_list = [];
67
+		foreach ($courses as $c) {
68
+			$cour = Course::find($c->course_id);
69
+			$cour->setAttribute('typ_semester_course_id', $c->typ_semester_course_id);
70
+			$course_list[] = $cour;
71
+		}
72
+		return $course_list*/
73
+
74
+		return Course::join('typ_semester_courses', 'typ_semester_courses.course_id', '=', 'courses.id')
75
+			->join('annual_plan_transformative', 'typ_semester_courses.id', '=', 'annual_plan_transformative.typ_semester_course_id')
76
+			->where('annual_plan_id', $this->id)
77
+			->select('courses.*', 'typ_semester_courses.id as typ_semester_course_id')
78
+			->groupBy("courses.id")
79
+			//->with("proposed_transformative_actions")
80
+			->get();
81
+	}
82
+
83
+
84
+
85
+
86
+
87
+	public function	getOutcomesAttribute()
88
+	{
89
+
90
+
91
+		return Outcome::join('typ_semester_outcome', 'typ_semester_outcome.outcome_id', '=', 'outcomes.id')
92
+			->join('annual_cycle', function ($j) {
93
+				$j->on('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_start')
94
+					->orOn('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_end');
95
+			})
96
+			->join('annual_plans', 'annual_cycle.id', '=', 'annual_plans.annual_cycle_id')
97
+			->join('typ_program', function ($j) {
98
+				$j->on('typ_semester_outcome.typ_program_id', '=', 'typ_program.id')
99
+					->on('typ_program.program_id', '=', 'annual_plans.program_id');
100
+			})
101
+			->join('typ_semester_objectives', 'typ_semester_objectives.typ_semester_outcome_id', '=', 'typ_semester_outcome.id')
102
+			->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
103
+			->where('annual_plans.id', $this->id)
104
+			->groupBy('outcomes.id')
105
+			->orderBy('typ_semester_outcome.semester_id')
106
+			->select(
107
+				'outcomes.*',
108
+				'outcomes.id as outcome_id',
109
+				'typ_semester_outcome.id as typ_semester_outcome_id',
110
+				'typ_semester_outcome.semester_id as semester_id',
111
+				DB::raw("{$this->program_id} as program_id")
112
+			)->get();
113
+
114
+
115
+
116
+		/*$outcomes_query = DB::table('annual_plans')
117
+			->join('annual_cycle', 'annual_cycle.id', '=', 'annual_plans.annual_cycle_id')
118
+			->join('typ_semester_outcome', function ($q) {
119
+				$q->on('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_start')
120
+					->orOn('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_end');
121
+			})
122
+			->join('typ_program', function ($j) {
123
+				$j->on('typ_semester_outcome.typ_program_id', '=', 'typ_program.id')
124
+					->on('typ_program.program_id', '=', 'annual_plans.program_id');
125
+			})
126
+			->join('typ_semester_objectives', 'typ_semester_objectives.typ_semester_outcome_id', '=', 'typ_semester_outcome.id')
127
+			->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
128
+			->join('outcomes', 'typ_semester_outcome.outcome_id', '=', 'outcomes.id')
129
+			->where('annual_plans.id', $this->id)
130
+			->groupBy('outcomes.id')
131
+			->orderBy('typ_semester_outcome.semester_id')
132
+			->select('outcomes.id as outcome_id', 'typ_semester_outcome.id as typ_semester_outcome_id', 'typ_semester_outcome.semester_id as semester_id');
133
+		//Log::info($outcomes_query->toSql());
134
+
135
+
136
+		//$outcomes = $outcomes_query->lists('outcome_id');
137
+		//$outcomes_typ_semester_id = $outcomes_query->lists('typ_semester_outcome_id');
138
+		//$outcomes_semester = $outcomes_query->lists('semester_id');
139
+
140
+		//->lists(array('outcome_id', 'typ_semester_outcome_id', "typ_semester_outcome.semester_id"));
141
+		$outcomes = $outcomes_query->get();
142
+		//Log::info("an_id");
143
+		//Log::info($an_id);
144
+		$an_id = $this->id;
145
+		//Log::info($an_id);
146
+		//Log::info($outcomes);
147
+
148
+
149
+
150
+		/*$outcomes_full = Outcome::whereIn("id", $outcomes)->get();
151
+
152
+		Log::info($outcomes_full);
153
+
154
+		foreach ($outcomes_full as $index => $outc) {
155
+			$outc->setAttribute('typ_semester_outcome_id', $outcomes_typ_semester_id[$index]);
156
+			$outc->setAttribute('semester_id', $outcomes_semester[$index]);
157
+			$outc->setAttribute('program_id', $this->program_id);
158
+			Log::info("Imagine");
159
+		}
160
+		//Log::info();*/
161
+		/*
162
+		$outcomes_full = [];
163
+		//Log::info("Estamos aqui");
164
+		//Log::info($outcomes);
165
+		foreach ($outcomes as $index => $outc) {
166
+
167
+			//Log::info("outcome_id");
168
+			//Log::info($outc->outcome_id);
169
+			$outcomes_full[$index] = Outcome::where('id', $outc->outcome_id)->first();
170
+			//Log::info(array($outcome));
171
+			$outcomes_full[$index]->setAttribute('typ_semester_outcome_id', $outc->typ_semester_outcome_id);
172
+			$outcomes_full[$index]->setAttribute('semester_id', $outc->semester_id);
173
+			$outcomes_full[$index]->setAttribute('program_id', $this->program_id);
174
+			//$outcomes_full[] = $outcome;
175
+		}
176
+
177
+
178
+		return $outcomes_full;*/
179
+
180
+		/*with([
181
+			'typ_semester_outcome_id' => function ($query) use (&$an_id) {
182
+				Log::info($this->id);
183
+				$query->join('typ_semester_outcome', 'typ_semester_outcome.outcome_id', '=', $this->id)
184
+					->join('annual_cycle', function ($q) {
185
+						$q->on('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_start')
186
+							->orOn('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_end');
187
+					})->join('typ_semester_objectives', 'typ_semester_objectives.typ_semester_outcome_id', '=', 'typ_semester_outcome.id')
188
+					->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
189
+
190
+					->join('annual_cycle', 'annual_cycle.id', '=', 'annual_plans.annual_cycle_id')
191
+					->join('typ_semester_outcome', function ($q) {
192
+						$q->on('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_start')
193
+							->orOn('typ_semester_outcome.semester_id', '=', 'annual_cycle.semester_end');
194
+					})
195
+					->join('typ_program', function ($j) {
196
+						$j->on('typ_semester_outcome.typ_program_id', '=', 'typ_program.id')
197
+							->on('typ_program.program_id', '=', 'annual_plans.program_id');
198
+					})
199
+					->where('annual_plans.id', $an_id)
200
+					->select('typ_outcome_semester_id')
201
+					->first();
202
+				//->first()->typ_outcome_semester_id;
203
+				//->where('outcome_id',$this->id)
204
+
205
+			}
206
+		]);*/
207
+
208
+
209
+		/*
210
+			select * from annual_plans
211
+			
212
+			select outcome_id, typ_semester_outcome_id, outcomes.* from annual_plans 
213
+		
214
+			join annual_cycle on annual_cycle.id = annual_plans.annual_cycle_id 
215
+			join typ_semester_outcome on typ_semester_outcome.semester_id = annual_cycle.semester_start or typ_semester_outcome.semester_id = annual_cycle.semester_end 
216
+			join typ_program on typ_semester_outcome.typ_program_id = typ_program.id and typ_program.program_id = annual_plans.program_id
217
+			join typ_semester_objectives on typ_semester_outcome.id = typ_semester_objectives.typ_semester_outcome_id 
218
+			join typ_semester_courses on typ_semester_objectives.id = typ_semester_courses.typ_semester_objective_id
219
+			join outcomes on typ_semester_outcome.outcome_id = outcomes.id
220
+			
221
+			where annual_plans.id = 3
222
+			GROUP by outcome_id
223
+		*/
16 224
 	}
17 225
 }

+ 201
- 5
app/models/Course.php View File

@@ -4,7 +4,7 @@ class Course extends Eloquent
4 4
 {
5 5
 
6 6
   protected $fillable = array('name', 'code', 'number', 'section', 'program_id', 'user_id', 'semester_id');
7
-
7
+  protected $appends = array('proposed_transformative_actions');
8 8
   public function program()
9 9
   {
10 10
     return $this->belongsTo('Program');
@@ -33,6 +33,189 @@ class Course extends Eloquent
33 33
     return $this->belongsTo('Activity');
34 34
   }
35 35
 
36
+  //paired_objective, como el typ_semester_course_id esta atado a un solo typ_semester_objective_id pues te devuelve el primero
37
+  public function getPairedObjectiveAttribute()
38
+  {
39
+
40
+    return Objective::join('typ_semester_objectives', 'typ_semester_objectives.objective_id', '=', 'objectives.id')
41
+      ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
42
+      ->where('typ_semester_courses.id', $this->typ_semester_course_id)
43
+      ->select('typ_semester_objectives.id as typ_semester_objective_id', 'objectives.*')
44
+      ->first();
45
+  }
46
+  //future_transformative_actions
47
+  public function getFutureTransformativeActionsAttribute()
48
+  {
49
+    if (isset($this->typ_semester_course_id)) {
50
+
51
+      Log::info("entramos al isset");
52
+      //Big object where  data is going to turn out like 
53
+      /*
54
+      $this->future_transformative_actions = all future transformative actions proposed in annual plan
55
+      and each future_transformative_action has an attribute future_semesters where it will be an 
56
+      array of all future semesters proposed
57
+
58
+      */
59
+      $results = $this->getFutureTypSemesterCourses($this->typ_semester_course_id, $this->program_id);
60
+      if (isset($results->future_transformative_actions))
61
+        $results = $results->future_transformative_actions;
62
+      $future_transformative_actions_ids = [];
63
+      foreach ($results as $row) {
64
+        //Log::info($this->typ_semester_course_id);
65
+        //Log::info('row');
66
+        //Log::info($row);
67
+
68
+        if (isset($row->trans_id)) {
69
+          if (!isset($future_transformative_actions_ids[$row->trans_id])) {
70
+
71
+            $future_transformative_actions_ids[$row->trans_id] = [
72
+              'future_semesters' => []
73
+            ];
74
+          }
75
+          Log::info('arreglo');
76
+          Log::info($future_transformative_actions_ids);
77
+          $future_transformative_actions_ids[$row->trans_id]['future_semesters'][] = $row->semester_id;
78
+        } else continue;
79
+      }
80
+
81
+      $trans_actions = [];
82
+      Log::info($future_transformative_actions_ids);
83
+      foreach ($future_transformative_actions_ids as $trans_id => $future_semesters) {
84
+        $ta = TransformativeAction::where('id', $trans_id)->first();
85
+        //$ta->setAttribute('future_semesters', []);
86
+
87
+        $temp_future_semesters = [];
88
+        foreach ($future_semesters['future_semesters'] as $index => $semester_id) {
89
+          //$ta->
90
+          $temp_future_semesters[$index] = Semester::where('id', $semester_id)->first();
91
+        }
92
+        $ta->setAttribute('future_semesters', $temp_future_semesters);
93
+        $trans_actions[] = $ta;
94
+      }
95
+      return $trans_actions;
96
+    }
97
+  }
98
+  //proposed_transformative_actions
99
+  public function getProposedTransformativeActionsAttribute()
100
+  {
101
+    if (isset($this->typ_semester_course_id)) {
102
+      //return 
103
+
104
+      return TransformativeAction::join('annual_plan_transformative', 'transformative_actions.id', '=', 'annual_plan_transformative.trans_id')
105
+        ->where('typ_semester_course_id', $this->typ_semester_course_id)
106
+        ->select('transformative_actions.*', DB::raw("{$this->semester_id} as semester_id"))
107
+        ->get();
108
+
109
+
110
+      $transformative_actions = DB::table('annual_plan_transformative')
111
+        ->join('transformative_actions', 'transformative_actions.id', '=', 'annual_plan_transformative.trans_id')
112
+        ->where('typ_semester_course_id', $this->typ_semester_course_id)
113
+        ->select('transformative_actions.*')
114
+        ->get();
115
+      $trans_list = [];
116
+      foreach ($transformative_actions as $trans) {
117
+        $ta =  TransformativeAction::where('id', $trans->id)->first();
118
+        $ta->setAttribute("semester_id", $this->semester_id);
119
+        $trans_list[] = $ta;
120
+      }
121
+      return $trans_list;
122
+    }
123
+    Log::info('te la viviste tm');
124
+    return null;
125
+  }
126
+
127
+
128
+
129
+  // assessed_paired_criteria
130
+  public function getAssessedPairedCriteriaAttribute()
131
+  {
132
+    $criteria_id = DB::table('annual_plan_objective')
133
+      ->where('typ_semester_course_id', $this->typ_semester_course_id)
134
+      ->lists('criteria_id');
135
+    Log::info($this->typ_semester_course_id);
136
+    Log::info("dame ese id");
137
+    $program = Program::where('id', $this->program_id)->first();
138
+    // Log::info($program->code);
139
+    //Si es un programa como core, enseña todos los estudiantes
140
+    if ($program->code == "") {
141
+      $program_ids = DB::table('programs')
142
+        ->where('school_id', $program->school->id)
143
+        ->lists('programs.id');
144
+      //Log::info("estamos");
145
+    } else $program_ids = array($program->id);
146
+
147
+    /*tabla es asi por curso codigo
148
+      *
149
+      *criterioDelPlan    EstudiantesDelProgramaQuePasaron   EstudiantesqueIntentaron
150
+      *    
151
+      *    criterio1                 3                             5
152
+      *    criterio2                 2                             2
153
+      *
154
+      *
155
+      */
156
+    return Criterion::join('activity_criterion', 'criteria.id', '=', 'activity_criterion.criterion_id')
157
+      ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
158
+      ->join('courses', 'courses.id', '=', 'activities.course_id')
159
+      ->join('course_student', 'course_student.course_id', '=', 'courses.id')
160
+      ->join('program_student_semester', 'program_student_semester.student_id', '=', 'course_student.student_id')
161
+      ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
162
+      ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
163
+
164
+      ->join('assessments', function ($join) {
165
+        $join->on("assessments.student_id", '=', 'program_student_semester.student_id')
166
+          ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
167
+      })
168
+      ->where('courses.semester_id', $this->semester_id)
169
+      ->whereIn('courses.program_id', $program_ids)
170
+      ->where('courses.code', $this->code)
171
+      ->where('courses.number', $this->number)
172
+      ->whereIn('program_student_semester.program_id', $program_ids)
173
+      ->whereIn('activity_criterion.criterion_id', $criteria_id)
174
+      ->whereIn('criteria.id', $criteria_id)
175
+      ->where('program_student_semester.semester_id', $this->semester_id)
176
+      ->select('criteria.*')
177
+      ->addSelect(DB::raw("{$this->typ_semester_course_id} as typ_semester_course_id"))
178
+      ->addSelect(DB::raw('count(case when assessments.score>= rubrics.expected_points then 1 else null end) as criteria_achieved'))
179
+      ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
180
+      ->groupBy('criteria.id')
181
+
182
+      ->get();
183
+  }
184
+
185
+  //paired_criteria solo funciona para plan ahora_mismo, y esta puerquito
186
+  public function getPairedCriteriaAttribute()
187
+  {
188
+    if (isset($this->typ_semester_course_id)) {
189
+
190
+      return Criterion::join("annual_plan_objective", 'annual_plan_objective.criteria_id', '=', 'criteria.id')
191
+        ->where('typ_semester_course_id', $this->typ_semester_course_id)
192
+        ->select(
193
+          'criteria.*',
194
+          'typ_semester_course_id'
195
+        )
196
+        ->get();
197
+
198
+
199
+
200
+      /*.
201
+      $criteria_info = $this->getCriteriaPlanReport($this);
202
+      $criteria_list = [];
203
+      foreach ($criteria_info as $index => $criterion) {
204
+        $criteria_list[$index] = Criterion::where("id", $criterion->id)->first();
205
+
206
+        $criteria_list[$index]->setAttribute("criteria_attempted", $criterion->criteria_attempted);
207
+        $criteria_list[$index]->setAttribute("criteria_achieved", $criterion->criteria_achieved);
208
+      }
209
+      return $criteria_list;
210
+    }*/
211
+    }
212
+    return null;
213
+  }
214
+
215
+
216
+
217
+
218
+
36 219
   public function assessedActivities()
37 220
   {
38 221
     // return $this->hasMany('Activity')->whereNotNull('activities.outcomes_attempted')->orderBy('date', 'asc');
@@ -97,7 +280,7 @@ class Course extends Eloquent
97 280
         'transformative_actions.at_text',
98 281
         'transformative_actions.description'
99 282
 
100
-      )->get();
283
+      ); //->get();
101 284
     //Log::info('El sql');
102 285
     $typ_info->future_transformative_actions  = DB::table('typ_semester_outcome')
103 286
       ->join('typ_semester_objectives', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
@@ -136,7 +319,12 @@ class Course extends Eloquent
136 319
         'transformative_actions.at_text',
137 320
         'transformative_actions.description'
138 321
 
139
-      )->get();
322
+      );
323
+    //Log::info("typ_info");
324
+    //Log::info($typ_info->future_semesters->toSql());
325
+    $typ_info->future_semesters = $typ_info->future_semesters->get();
326
+    //Log::info($typ_info->future_transformative_actions->toSql());
327
+    $typ_info->future_transformative_actions = $typ_info->future_transformative_actions->get();
140 328
     //Log::info($typ_info->toSql());
141 329
     Log::info($typ_semester_course_id);
142 330
     Log::info($program_id);
@@ -232,6 +420,7 @@ class Course extends Eloquent
232 420
       Log::info("dame ese id");
233 421
       $program = Program::where('id', $course_code->program_id)->first();
234 422
       // Log::info($program->code);
423
+      //Si es un programa como core, enseña todos los estudiantes
235 424
       if ($program->code == "") {
236 425
         $program_ids = DB::table('programs')
237 426
           ->where('school_id', $program->school->id)
@@ -284,6 +473,12 @@ class Course extends Eloquent
284 473
       return $table_per_criterion->get();
285 474
     }
286 475
   }
476
+
477
+  //dirty code repeated code
478
+  public function getStudentReportForOutcomeAttribute()
479
+  {
480
+    return $this->getStudentReportForOutcome($this);
481
+  }
287 482
   public static function getStudentReportForOutcome($course_code = null)
288 483
   {
289 484
     if ($course_code) {
@@ -312,6 +507,7 @@ class Course extends Eloquent
312 507
       */
313 508
       $table_per_student = DB::table('program_student_semester')
314 509
         ->join('course_student', 'program_student_semester.student_id', '=', 'course_student.student_id')
510
+        ->join("students", 'course_student.student_id', '=', 'students.id')
315 511
         ->join('courses', 'courses.id', '=', 'course_student.course_id')
316 512
         ->join('activities', 'activities.course_id', '=', 'courses.id')
317 513
         ->join('activity_criterion', 'activities.id', '=', 'activity_criterion.activity_id')
@@ -330,10 +526,10 @@ class Course extends Eloquent
330 526
         ->whereIn('program_student_semester.program_id', $program_ids)
331 527
         ->whereIn('activity_criterion.criterion_id', $criteria_id)
332 528
         ->where('program_student_semester.semester_id', $course_code->semester_id)
333
-        ->select('course_student.student_id')
529
+        ->select('students.number as student_id')
334 530
         ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
335 531
         ->addSelect(DB::raw('count(case when assessments.score>=rubrics.expected_points then 1 else NULL end) as criteria_achieved'))
336
-        ->groupBy('course_student.student_id');
532
+        ->groupBy('students.id');
337 533
 
338 534
 
339 535
 

+ 3
- 1
app/models/Criterion.php View File

@@ -25,6 +25,8 @@ class Criterion extends Eloquent
25 25
 		//$this->hasManyThrough('Outcome', 'Objective');
26 26
 	}
27 27
 
28
+
29
+
28 30
 	public function objectives()
29 31
 	{
30 32
 		return $this->belongsToMany('Objective');
@@ -43,7 +45,7 @@ class Criterion extends Eloquent
43 45
 	 */
44 46
 	public function programs()
45 47
 	{
46
-		return $this->belongsToMany('Program','program_criterion');
48
+		return $this->belongsToMany('Program', 'program_criterion');
47 49
 	}
48 50
 
49 51
 

+ 65
- 0
app/models/Objective.php View File

@@ -7,6 +7,7 @@ class Objective extends Eloquent
7 7
     use SoftDeletingTrait;
8 8
     protected $fillable = array('text', 'outcome_id',  'active');
9 9
     protected $table = 'objectives';
10
+    protected $appends = array("grouped_annual_course");
10 11
 
11 12
     /**
12 13
      * Return the program that the objective belongs to
@@ -18,6 +19,68 @@ class Objective extends Eloquent
18 19
         return $this->belongsTo('Program');
19 20
     }
20 21
 
22
+    //paired_outcome
23
+
24
+    public function getPairedOutcomeAttribute()
25
+    {
26
+        return Outcome::join('typ_semester_outcome', 'typ_semester_outcome.outcome_id', '=', 'outcomes.id')
27
+            ->join('typ_semester_objectives', 'typ_semester_objectives.typ_semester_outcome_id', '=', 'typ_semester_outcome.id')
28
+            ->where('typ_semester_objectives.id', $this->typ_semester_objective_id)
29
+            ->select('typ_semester_outcome.id as typ_semester_outcome_id', 'outcomes.*')
30
+            ->first();
31
+    }
32
+
33
+
34
+
35
+    public function getGroupedAnnualCourseAttribute()
36
+    {
37
+        if (isset($this->typ_semester_objective_id)) {
38
+            /*$course_codes = DB::table('typ_semester_courses')
39
+                ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
40
+                ->where('typ_semester_objective_id', $this->typ_semester_objective_id)
41
+                ->where('courses.program_id', $this->program_id)
42
+                ->select('courses.code', 'courses.number', 'courses.id as course_id', 'typ_semester_courses.id as typ_semester_course_id', DB::raw("'{$this->semester_id}' as semester_id"), "courses.program_id")
43
+                ->get();*/
44
+
45
+            return Course::join('typ_semester_courses',  'courses.id', '=', 'typ_semester_courses.course_id')
46
+                ->where('typ_semester_objective_id', $this->typ_semester_objective_id)
47
+                ->where('courses.program_id', $this->program_id)
48
+                ->select('courses.*', 'typ_semester_courses.id as typ_semester_course_id', DB::raw("'{$this->semester_id}' as semester_id"), "courses.program_id")
49
+                ->get();
50
+            // $course_code_id = $course_codes->lists('course_id');
51
+            //$course_code_typ = $course_codes->lists('typ_semester_course_id');
52
+
53
+
54
+            /*
55
+
56
+            $courses = []; //Course::whereIn("id", $course_code_id)->get();
57
+
58
+            foreach ($course_codes as $i => $code) {
59
+                $c = Course::where('id', $code->course_id)->first();
60
+                $c->setAttribute('typ_semester_course_id', $code->typ_semester_course_id); //$course_code_typ[$i]);
61
+                /*$c->setAttribute(
62
+                    'transforming_actions',
63
+                    DB::table('annual_plan_transformative')
64
+                        ->join('transformative_actions', 'transformative_actions.id', '=', 'annual_plan_transformative.trans_id')
65
+                        ->where('typ_semester_course_id', $c->typ_semester_course_id)
66
+                        ->select('transformative_actions.*')
67
+                        ->get()
68
+                );
69
+                //$c->setAttribute("future_typ_course_id", $this->()); //Course::getFutureTypSemesterCourses($c->typ_semester_course_id, $c->program_id));
70
+
71
+                $c->setAttribute("students", Course::getStudentReportForOutcome($c));
72
+                //$c->setAttribute("criteria", Course::getCriteriaPlanReport($c));
73
+                $courses[] = $c;
74
+            }
75
+
76
+
77
+
78
+
79
+            return $courses;
80
+            */
81
+        }
82
+        return null;
83
+    }
21 84
     /**
22 85
      * Return the outcomes that the objective belongs to
23 86
      *
@@ -65,6 +128,8 @@ class Objective extends Eloquent
65 128
         return $this->belongsTo('Outcome');
66 129
     }
67 130
 
131
+
132
+
68 133
     /**
69 134
      * Return the program that the objective belongs to
70 135
      *

+ 224
- 5
app/models/Outcome.php View File

@@ -9,13 +9,163 @@ class Outcome extends Eloquent
9 9
 
10 10
 	protected $fillable = array('name', 'definition');
11 11
 
12
+	protected $appends = array("annual_objectives");
13
+
14
+	//dirty code, this belongs to annual plan, but outcome has the important data
15
+	public function getExpectedTargetAttribute()
16
+	{
17
+		if (isset($this->semester_id) && isset($this->program_id)) {
18
+			$expected_target = DB::table("target_outcomes_program")
19
+				->where('program_id', $this->program_id)
20
+				->where('semester_id', $this->semester_id)
21
+				->first();
22
+			Log::info("PApi que hayy chabau");
23
+			Log::info(array($expected_target));
24
+			if ($expected_target != null) {
25
+				Log::info("PApi no chabau");
26
+				return $expected_target->expected_target;
27
+			} else return "Go to Annual Plan and define a target for learning outcome";
28
+		}
29
+		Log::info("PApi rip chabau");
30
+		return null;
31
+	}
32
+
33
+	//Dirty code sort of, la accion transformadora es para el programa, ppero esta bajo el dominio
34
+	//tecnicamente esto es hasta del annual plan, pero na, outcomes bajo el annual plan van a tener
35
+	// este atributo
36
+
37
+	//program_transformative_actions
38
+	public function getProgramTransformativeActionsAttribute()
39
+	{
40
+		/*$transformative_actions = DB::table('transformative_typ_outcome')
41
+			->where('typ_semester_outcome_id', $this->typ_semester_outcome_id)
42
+			->get();
43
+		$trans_actions = [];
44
+		foreach ($transformative_actions as $trans) {
45
+			$ta = TransformativeAction::where('id', $trans->trans_id)->first();
46
+			$ta->setAttribute('semester_id', $this->semester_id);
47
+			$trans_actions[] = $ta;
48
+		}
49
+		return $trans_actions;*/
50
+
51
+		return TransformativeAction::join('transformative_typ_outcome', 'transformative_typ_outcome.trans_id', '=', 'transformative_actions.id')
52
+			->where('typ_semester_outcome_id', $this->typ_semester_outcome_id)
53
+			->select('transformative_actions.*', DB::raw("{$this->semester_id} as semester_id"))
54
+			->get();
55
+	}
56
+
57
+	public function getCommentsAttribute()
58
+	{
59
+		return DB::table('typ_outcome_report_comments')
60
+			->where('typ_semester_outcome_id', $this->typ_semester_outcome_id)
61
+			->get();
62
+	}
63
+	// Son los resultados de los estudiantes por dominio, devuelve el percent.
64
+	public function getStudentPerformanceAttribute()
65
+	{
66
+
67
+		//create Counter for students
68
+
69
+		$whole_dict = [];
70
+		foreach ($this->annual_objectives as $objective) {
71
+			foreach ($objective->grouped_annual_course as $course_code) {
72
+				Log::info("Existen los cursos");
73
+				Log::info(json_encode($course_code));
74
+				foreach ($course_code->student_report_for_outcome as $student) {
75
+
76
+					//If is not defined, define
77
+					if (!isset($whole_dict[$student->student_id])) {
78
+						$whole_dict[$student->student_id] = array(
79
+							'student' => $student->student_id,
80
+							'criteria_attempted' => 0,
81
+							'criteria_achieved' => 0
82
+						);
83
+					}
84
+					$whole_dict[$student->student_id]["criteria_attempted"] += $student->criteria_attempted;
85
+					$whole_dict[$student->student_id]["criteria_achieved"] += $student->criteria_achieved;
86
+				}
87
+			}
88
+		}
89
+
90
+		$students_achieved = 0;
91
+		$students_attempted = 0;
92
+
93
+		Log::info('Outcome_content');
94
+		Log::info($whole_dict);
95
+
96
+		foreach ($whole_dict as $student) {
97
+			if ($student['criteria_attempted']) {
98
+
99
+				$students_attempted += 1;
100
+				$percentage = (($student['criteria_achieved'] / $student['criteria_attempted']) * 100);
101
+				if ($percentage >= $this->expected_outcome) {
102
+
103
+					$students_achieved += 1;
104
+				}
105
+			}
106
+		}
107
+
108
+		if ($students_attempted != 0)
109
+			return round(($students_achieved / $students_attempted) * 100, 2);
110
+		else
111
+			return "N/A";
112
+		/*
113
+                                   if (course_code.criteria.length) {
114
+
115
+                                        $.each(course_code.students, function(index, student) {
116
+                                            if (wholeDict[student.student_id] === undefined) {
117
+                                                wholeDict[student.student_id] = {
118
+                                                    'student': student.student_id,
119
+                                                    'criteria_attempted': 0,
120
+                                                    'criteria_achieved': 0
121
+                                                }
122
+
123
+                                            }
124
+                                            wholeDict[student.student_id][
125
+                                                    "criteria_attempted"
126
+                                                ] += student
127
+                                                .criteria_attempted;
128
+                                            wholeDict[student.student_id][
129
+                                                    "criteria_achieved"
130
+                                                ] += student
131
+                                                .criteria_achieved;
132
+
133
+                                        });
134
+
135
+										 $.each(wholeDict, function(key, dict) {
136
+
137
+
138
+                            if (dict.criteria_attempted) {
139
+                                students_attempted += 1;
140
+                                percentage = ((dict.criteria_achieved / dict.criteria_attempted) * 100).toFixed(
141
+                                    2);
142
+                                if (parseFloat(percentage) >= parseFloat(outcome.expected_outcome)) {
143
+                                    achieved = "Yes"
144
+                                    students_achieved += 1;
145
+                                } else achieved = "No"
146
+                            } else {
147
+                                percentage = "N/A"
148
+                                achieved = "N/A"
149
+                            }
150
+                            tableStudent.row.add([
151
+                                dict.student,
152
+                                dict.criteria_attempted,
153
+                                dict.criteria_achieved,
154
+                                percentage,
155
+                                achieved
156
+
157
+                            ]);
158
+                        })
159
+		*/
160
+	}
161
+
12 162
 	public function criteria()
13 163
 	{
14 164
 		return $this->hasManyThrough('Criterion', 'Objective')->orderBy('name');
15 165
 	}
16 166
 
17 167
 
18
-	public function fetchObjectivesReport($semester_id, $program_id)
168
+	public function fetchObjectivesReport($semester_id, $program_id, $with_model = false)
19 169
 	{
20 170
 		/*$objectives = DB::table('typ_semester_outcome')
21 171
 			->join('typ_semester_objectives', 'typ_semester_objectives.typ_semester_outcome_id', '=', 'typ_semester_outcome.id')
@@ -34,14 +184,83 @@ class Outcome extends Eloquent
34 184
 			->where('semester_id', $semester_id)
35 185
 			->where('program_id', $program_id)
36 186
 			->where('outcome_id', $this->id)
37
-			->select('objectives.*', 'typ_semester_objectives.id as typ_semester_objective_id', 'program_id', 'semester_id')
187
+			->select('objectives.id as objective_id', 'objectives.text', 'typ_semester_objectives.id as typ_semester_objective_id', 'program_id', 'semester_id')
38 188
 			->distinct();
39
-		Log::info($objectives->toSql());
40
-		Log::info('semester_program_outcome' . $semester_id . ',' . $program_id . ',' . $this->id);
189
+
190
+		Log::info('agooooo me');
191
+		////Log::info($objectives->toSql());
192
+		//Log::info('semester_program_outcome' . $semester_id . ',' . $program_id . ',' . $this->id);
193
+
194
+		if ($with_model) {
195
+			Log::info("Acho aqui estamos en with_model");
196
+			$objective_id  = $objectives->lists('objective_id');
197
+			$typ_semester_objective_ids = $objectives->lists('typ_semester_objective_id');
198
+			//$program_id = $objectives->lists('program_id');
199
+			//$semester_id = $objectives ->lists('semester_id');
200
+
201
+			$objectives = Objective::whereIn("objectives.id", $objective_id);
202
+			Log::info($objective_id);
203
+			//Log::info(array($objectives));
204
+
205
+			foreach ($objectives as $i => $o) {
206
+				Log::info("entramos aqui tambien?");
207
+				$o->setAttribute("typ_semester_objective_id", $typ_semester_objective_ids[$i]);
208
+				$o->setAttribute("program_id", $program_id);
209
+				$o->setAttribute("semester_id", $semester_id);
210
+			}
211
+			return $objectives;
212
+		}
41 213
 
42 214
 
43 215
 		return $objectives->get();
44 216
 	}
217
+
218
+	//Intento de get objectives pareados en un plan
219
+
220
+	public function getAnnualObjectivesAttribute()
221
+	{
222
+		if (isset($this->typ_semester_outcome_id)) {
223
+			/*Log::info('estamos aqui');
224
+			$objectives = DB::table("typ_semester_objectives")
225
+				->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
226
+				->where('typ_semester_outcome_id', $this->typ_semester_outcome_id)
227
+				->select('typ_semester_objectives.id as typ_semester_objective_id', 'objectives.id as objective_id')
228
+				->get();
229
+			//$objectives_id = $objectives->lists('objective_id');
230
+			//$typ_semester_objective_ids = $objectives->lists('typ_semester_objective_id');
231
+			//$program_id = $objectives->lists('program_id');
232
+			//$semester_id = $objectives ->lists('semester_id');
233
+			//Log::info($this->typ_semester_outcome_id);
234
+			//Log::info($objectives_id);
235
+
236
+			$objectives_list = []; // Objective::whereIn("id", $objectives_id)->get();
237
+
238
+			foreach ($objectives as $i => $ob) {
239
+				$o = Objective::find($ob->objective_id);
240
+				//Log::info("entramos aqui tambien?");
241
+				$o->setAttribute("typ_semester_objective_id", $ob->typ_semester_objective_id); //$typ_semester_objective_ids[$i]);
242
+				$o->setAttribute("semester_id", $this->semester_id);
243
+				$o->setAttribute('program_id', $this->program_id);
244
+				$objectives_list[] = $o;
245
+			}
246
+
247
+			return $objectives_list;*/
248
+
249
+			return Objective::join("typ_semester_objectives", 'objectives.id', '=', 'typ_semester_objectives.objective_id')
250
+				->where('typ_semester_outcome_id', $this->typ_semester_outcome_id)
251
+				->select(
252
+					'typ_semester_objectives.id as typ_semester_objective_id',
253
+					'objectives.id as objective_id',
254
+					'objectives.*',
255
+					DB::raw("{$this->semester_id} as semester_id"),
256
+					DB::raw("{$this->program_id} as program_id")
257
+				)
258
+				->get();
259
+			//return $objectives;
260
+		}
261
+		Log::info("Lol");
262
+		return null;
263
+	}
45 264
 	/**
46 265
 	 * Return the objectives that the outcome belongs to
47 266
 	 *
@@ -651,4 +870,4 @@ class Outcome extends Eloquent
651 870
 		$selected_semester = Semester::find(Session::get('semesters_ids')[0]);
652 871
 		return Outcome::withTrashed()->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null)->orderBy('name', 'ASC')->get();
653 872
 	}
654
-}
873
+}

+ 5
- 1
app/models/Program.php View File

@@ -93,6 +93,10 @@ class Program extends Eloquent
93 93
 		return $objectives;
94 94
 	}
95 95
 
96
+	public function annualPlan()
97
+	{
98
+		return $this->hasMany("AnnualPlan");
99
+	}
96 100
 	public function hasObjectivesInOutcome($outcome_id)
97 101
 	{
98 102
 		return Objective::where('program_id', $this->id)
@@ -399,4 +403,4 @@ class Program extends Eloquent
399 403
 
400 404
 		return $assessment_overview;
401 405
 	}
402
-}
406
+}

+ 10
- 7
app/models/Semester.php View File

@@ -2,16 +2,19 @@
2 2
 
3 3
 class Semester extends Eloquent
4 4
 {
5
-	/**
5
+    /**
6 6
      * Indicates if the model should be timestamped.
7 7
      *
8 8
      * @var bool
9 9
      */
10 10
     public $timestamps = false;
11 11
 
12
-	public function courses()
13
-	{
14
-	    return $this->hasMany('Course');
15
-	}
16
-
17
-}
12
+    public function courses()
13
+    {
14
+        return $this->hasMany('Course');
15
+    }
16
+    public function annual_cycle()
17
+    {
18
+        return $this->hasMany("AnnualCycle");
19
+    }
20
+}

+ 12
- 5
app/models/TransformativeAction.php View File

@@ -3,15 +3,21 @@
3 3
 class TransformativeAction extends Eloquent
4 4
 {
5 5
     protected $table = 'transformative_actions';
6
+    protected $appends = ['status'];
6 7
 
7
-    public function scopeStatus($query, $semester_id)
8
+    public function getStatusAttribute()
8 9
     {
9
-        return $query->join('transformative_action_status')
10
-            ->where('trans_id', $this->id)
11
-            ->where('semester_id', $semester_id)
12
-            ->first();
10
+        if (isset($this->semester_id)) {
11
+            Log::info("llegaremos?");
12
+            return DB::table('transformative_action_status')
13
+                ->where('trans_id', $this->id)
14
+                ->where('semester_id', $this->semester_id)
15
+                ->first();
16
+        }
17
+        return null;
13 18
     }
14 19
 
20
+
15 21
     public static function getTypCoursesWithSemesters($trans_id)
16 22
     {
17 23
         return DB::table('transformative_actions')
@@ -31,6 +37,7 @@ class TransformativeAction extends Eloquent
31 37
             ->get();
32 38
     }
33 39
 
40
+
34 41
     public static function getCategoriesHtml($program_id)
35 42
     {
36 43
         $categories = "<option value='0'>Nothing Selected</option>";

+ 12
- 1
app/routes.php View File

@@ -180,6 +180,17 @@ Route::group(array('before' => 'auth|has_access'), function () {
180 180
             'uses' => 'TransformativeActionsController@createTAForOutcome'
181 181
         )
182 182
     );
183
+
184
+    Route::post('postAnnualReport/{annual_id?}', 'AnnualPlansController@postAnnualReport');
185
+    Route::get('printAnnualPlan/{annual_plan?}', 'AnnualPlansController@printAnnualPlan');
186
+    Route::post('checkIfPlanReady', 'AnnualPlansController@checkIfPlanReady');
187
+
188
+    Route::post('submitAnnualPlan/{annual_id?}', 'AnnualPlansController@submitAnnualPlan');
189
+
190
+
191
+    Route::post("checkIfReady", 'AnnualPlansController@checkIfReady');
192
+
193
+    Route::get("printAnnualReport/{annual_plan?}", 'AnnualPlansController@printAnnualReport');
183 194
     Route::post('fetchObjectiveInfo', array(
184 195
         'as' => 'fetchObjectiveInfo',
185 196
         'uses' => 'AnnualPlansController@fetchObjectiveInfo'
@@ -203,7 +214,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
203 214
         'uses' => 'AnnualPlansController@fetchAnnualReport'
204 215
     ));
205 216
 
206
-    Route::post('submitAnnualPlan', array('uses' => 'AnnualPlansController@submitAnnualPlan'));
217
+    //Route::post('submitAnnualPlan', array('uses' => 'AnnualPlansController@submitAnnualPlan'));
207 218
 
208 219
     Route::post('fetchTransformativeStatus', array('uses' => 'TransformativeActionsController@fetchStatus'));
209 220
 

+ 15
- 16
app/start/global.php View File

@@ -13,11 +13,11 @@
13 13
 
14 14
 ClassLoader::addDirectories(array(
15 15
 
16
-	app_path().'/commands',
17
-	app_path().'/controllers',
18
-	app_path().'/models',
19
-	app_path().'/database/seeds',
20
-	app_path().'/helperClasses',
16
+	app_path() . '/commands',
17
+	app_path() . '/controllers',
18
+	app_path() . '/models',
19
+	app_path() . '/database/seeds',
20
+	app_path() . '/helperClasses',
21 21
 
22 22
 ));
23 23
 
@@ -32,7 +32,7 @@ ClassLoader::addDirectories(array(
32 32
 |
33 33
 */
34 34
 
35
-Log::useFiles(storage_path().'/logs/laravel.log');
35
+Log::useFiles(storage_path() . '/logs/laravel.log');
36 36
 
37 37
 /*
38 38
 |--------------------------------------------------------------------------
@@ -47,8 +47,7 @@ Log::useFiles(storage_path().'/logs/laravel.log');
47 47
 |
48 48
 */
49 49
 
50
-App::error(function(Exception $exception, $code)
51
-{
50
+App::error(function (Exception $exception, $code) {
52 51
 	Log::error($exception);
53 52
 });
54 53
 
@@ -63,9 +62,8 @@ App::error(function(Exception $exception, $code)
63 62
 |
64 63
 */
65 64
 
66
-App::down(function()
67
-{
68
-    $title = "OLAS is undergoing maintenance";
65
+App::down(function () {
66
+	$title = "OLAS is undergoing maintenance";
69 67
 	return View::make('global.maintenance', compact('title'));
70 68
 });
71 69
 
@@ -80,9 +78,10 @@ App::down(function()
80 78
 |
81 79
 */
82 80
 
83
-require app_path().'/filters.php';
81
+require app_path() . '/filters.php';
84 82
 
85
-App::missing(function($exception)
86
-{
87
-    return Response::view('global.404', array(), 404);
88
-});
83
+require_once base_path() . '/vendor/dompdf/dompdf/dompdf_config.inc.php';
84
+
85
+App::missing(function ($exception) {
86
+	return Response::view('global.404', array(), 404);
87
+});

+ 5
- 1
app/views/layouts/master-2.blade.php View File

@@ -105,7 +105,11 @@
105 105
                 </div>
106 106
             </div>
107 107
             <div class="row">
108
-                <div class="col-md-12"><h2> {{ $title }} </h2></div>
108
+                <div class="col-md-12" ><h2> {{ $title }} </h2>
109
+                <div id = "alert-for-save">
110
+
111
+                </div>
112
+                </div>
109 113
             </div>
110 114
 
111 115
             @if(Session::get('status'))

+ 202
- 163
app/views/local/managers/admins/assessment_report.blade.php View File

@@ -1,14 +1,15 @@
1 1
 @extends('layouts.master')
2 2
 
3 3
 @section('navigation')
4
-        @include('local.managers.admins._navigation')
4
+    @include('local.managers.admins._navigation')
5 5
 @stop
6 6
 
7 7
 @section('main')
8 8
     <div class="row">
9 9
         <div class="col-md-12">
10 10
 
11
-            <p>This report contains performance information for all Schools and Programs with assessed courses during the following semester(s):</p>
11
+            <p>This report contains performance information for all Schools and Programs with assessed courses during the
12
+                following semester(s):</p>
12 13
             <ul>
13 14
                 @foreach (Session::get('semesters_info') as $semester_info)
14 15
                     <li>{{ $semester_info }}</li>
@@ -21,7 +22,7 @@
21 22
             <!-- <h3>Table of Contents</h3> -->
22 23
             <!-- <ol id="table-of-contents" class="upper-roman">
23 24
 
24
-            </ol> -->
25
+                </ol> -->
25 26
 
26 27
 
27 28
             <h3 id="{{ $outcome->id }}" class="outcome">{{ $outcome->name }}</h3>
@@ -36,165 +37,201 @@
36 37
                 </thead>
37 38
                 <tfoot>
38 39
                     <tr class="column-search">
39
-                        <th><select class="column-search-select form-control"><option value=""></option></select></th>
40
-                        <th><select class="column-search-select form-control"><option value=""></option></select></th>
41
-                        <th><select class="column-search-select form-control"><option value=""></option></select></th>
42
-                        <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
40
+                        <th><select class="column-search-select form-control">
41
+                                <option value=""></option>
42
+                            </select></th>
43
+                        <th><select class="column-search-select form-control">
44
+                                <option value=""></option>
45
+                            </select></th>
46
+                        <th><select class="column-search-select form-control">
47
+                                <option value=""></option>
48
+                            </select></th>
49
+                        <th><input class="column-search-bar form-control" type="text" placeholder="Buscar" /></th>
43 50
                     </tr>
44 51
                 </tfoot>
45 52
                 <tbody>
46 53
                     @foreach ($schools as $school)
47 54
                         @foreach ($school->programs as $program)
48
-                            @if($program->assessesOutcome($outcome->id))
55
+                            @if ($program->assessesOutcome($outcome->id))
49 56
                                 <tr>
50 57
                                     <td>{{ $school->name }}</td>
51 58
                                     <td>{{ $program->name }}</td>
52 59
                                     <td>Yes</td>
53 60
                                     <td>
54 61
 
55
-                                    <!-- For each grouped course -->
56
-                                    @foreach($program->courses as $course_index => $course)
57
-                                        <!-- If grouped course has activities that evaluate the outcome -->
58
-
59
-                                        <?php
60
-
61
-                                           /* $sections_evaluating_outcome = Course::has('activities')
62
-//                                             ->whereNotNull('outcomes_attempted')
63
-//                                             ->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
64
-                                            ->with(array('activities'=>function($query) use(&$outcome){
65
-//                                                 $query->whereNotNull('outcomes_attempted');
66
-//                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');} ))
67
-//                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');
68
-                                                } ))
69
-                                            ->where('code', $course->code)->where('number',$course->number)
70
-                                            ->whereIn('semester_id', Session::get('semesters_ids'))
71
-                                            ->get();*/
62
+                                        <!-- For each grouped course -->
63
+                                        @foreach ($program->courses as $course_index => $course)
64
+                                            <!-- If grouped course has activities that evaluate the outcome -->
72 65
 
66
+                                            <?php
67
+                                            
68
+                                            /* $sections_evaluating_outcome = Course::has('activities')
69
+                                            //                                             ->whereNotNull('outcomes_attempted')
70
+                                            //                                             ->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
71
+                                                                                        ->with(array('activities'=>function($query) use(&$outcome){
72
+                                            //                                                 $query->whereNotNull('outcomes_attempted');
73
+                                            //                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');} ))
74
+                                            //                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');
75
+                                                                                            } ))
76
+                                                                                        ->where('code', $course->code)->where('number',$course->number)
77
+                                                                                        ->whereIn('semester_id', Session::get('semesters_ids'))
78
+                                                                                        ->get();*/
79
+                                            
73 80
                                             $sections_evaluating_outcome = Course::has('activities')
74
-                            
75
-                          ->with(array('activities'=>function($query) use(&$outcome, &$course){
76
-                                $activities = DB::table('activities')
77
-                                ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
78
-                                ->join('assessments', 'assessments.activity_criterion_id', '=','activity_criterion.id')
79
-                                ->join('criterion_objective_outcome', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
80
-                                ->join('courses','courses.id','=','activities.course_id')
81
-                                ->where('courses.code', $course->code)
82
-                                ->where('courses.number',$course->number)
83
-                                ->where('criterion_objective_outcome.outcome_id', $outcome->id)
84
-                                ->select('activity_id')
85
-                                ->lists('activity_id');
86
-
87
-                               $query->whereIn('id', $activities);
88
-                        } ))
89
-                                
90
-
91
-                            ->where('code', $course->code)->where('number',$course->number)
92
-                            ->whereIn('semester_id', Session::get('semesters_ids'))
93
-                            ->get();
94
-
95 81
                                             
96
-                                        ?>
97
-
98
-                                        @if(count($sections_evaluating_outcome))
99
-                                            <h4>{{ $course->code}}-{{ $course->number }}</h4>
100
-
101
-                                            <!-- For each section -->
102
-                                            @foreach($sections_evaluating_outcome as $section_index => $section)
103
-                                                <h5><u>Instance {{ $section_index + 1}}</u></h5>
82
+                                                ->with([
83
+                                                    'activities' => function ($query) use (&$outcome, &$course) {
84
+                                                        $activities = DB::table('activities')
85
+                                                            ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
86
+                                                            ->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
87
+                                                            ->join('criterion_objective_outcome', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
88
+                                                            ->join('courses', 'courses.id', '=', 'activities.course_id')
89
+                                                            ->where('courses.code', $course->code)
90
+                                                            ->where('courses.number', $course->number)
91
+                                                            ->where('criterion_objective_outcome.outcome_id', $outcome->id)
92
+                                                            ->select('activity_id')
93
+                                                            ->lists('activity_id');
94
+                                            
95
+                                                        $query->whereIn('id', $activities);
96
+                                                    },
97
+                                                ])
98
+                                            
99
+                                                ->where('code', $course->code)
100
+                                                ->where('number', $course->number)
101
+                                                ->whereIn('semester_id', Session::get('semesters_ids'))
102
+                                                ->get();
103
+                                            
104
+                                            ?>
104 105
 
105
-                                                <!-- For each activity in the section -->
106
-                                                @foreach($section->activities as $activity_index => $activity)
107
-                                                        <?php
106
+                                            @if (count($sections_evaluating_outcome))
107
+                                                <h4>{{ $course->code }}-{{ $course->number }}</h4>
108 108
 
109
-Log::info($activity->o_att_array);
110
-Log::info(array_key_exists($outcome->id, $activity->o_att_array));
111
-Log::info($activity->o_att_array[$outcome->id] >=1);
112
-Log::info(isset($section)); 
113
-Log::info($activity->rubric[0]);
109
+                                                <!-- For each section -->
110
+                                                @foreach ($sections_evaluating_outcome as $section_index => $section)
111
+                                                    <h5><u>Instance {{ $section_index + 1 }}</u></h5>
114 112
 
115
-?>
116
-                                                    <!-- If activity has a rubric and the rubric has the outcome being evaluated -->
117
-                                                    @if($activity->draft == 0 &&$activity->diagnostic==0 && array_key_exists($outcome->id, $activity->o_att_array) && $activity->o_att_array[$outcome->id] >=1 && isset($section)&& isset($activity->rubric[0]))
118
-                                                        <h5>Measure {{ $activity_index + 1 }}</h5>
113
+                                                    <!-- For each activity in the section -->
114
+                                                    @foreach ($section->activities as $activity_index => $activity)
119 115
                                                         <?php
120
-                                                        /*
121
-                                                        var_dump($section->code);
122
-                                                        var_dump($section->number);
123
-                                                        var_dump($section->name);
124
-                                                        var_dump($outcome->name);
125
-                                                        var_dump(date('M Y', strtotime($activity->date)));
126
-                                                        var_dump($activity->name);
127
-                                                        var_dump(count($section->students));
128
-                                                        print"<br>";
129
-                                                        print "A rubric was used in the $section->code-$section->number ($section->name) course (". date('M Y', strtotime($activity->date)).") to assess students’ <u>". strtolower($outcome->name) ."</u> in the activity: '<strong>$activity->name </strong>'. N= ". count($section->students);
130
-                                                        exit();
131
-                                                        */
132
-                                                        ?>
133
-
134
-
135
-                                                        <p>A rubric was used in the {{ $section->code }}-{{ $section->number }} ({{ $section->name }}) course ({{ date('M Y', strtotime($activity->date))}}) to assess students’ <u>{{ strtolower($outcome->name) }}</u> in the activity: "<strong>{{ $activity->name }}</strong>". N= {{ count($section->students) }}. </p>
136
-                                                        
137
-                                                        <p>The expected performance level was that <strong>{{ $activity->rubric[0]->expected_percentage }}%</strong> of students participating in the activity would score <strong>{{ $activity->rubric[0]->expected_points }} points</strong> or more in the 1-{{$activity->rubric[0]->max_score}} point scale used.</p>
138 116
                                                         
139
-                                                        <p>The results for each criterion were as follows:</p>
140
-
141
-                                                        <?php
142
-
143
-                                                            //$rubric_contents = json_decode($activity->rubric->contents);
144 117
                                                         ?>
118
+                                                        <!-- If activity has a rubric and the rubric has the outcome being evaluated -->
119
+                                                        @if ($activity->draft == 0 && $activity->diagnostic == 0 && array_key_exists($outcome->id, $activity->o_att_array) && $activity->o_att_array[$outcome->id] >= 1 && isset($section) && isset($activity->rubric[0]))
120
+                                                            <h5>Measure {{ $activity_index + 1 }}</h5>
121
+                                                            <?php
122
+                                                            /*
123
+                                                                                                                    var_dump($section->code);
124
+                                                                                                                    var_dump($section->number);
125
+                                                                                                                    var_dump($section->name);
126
+                                                                                                                    var_dump($outcome->name);
127
+                                                                                                                    var_dump(date('M Y', strtotime($activity->date)));
128
+                                                                                                                    var_dump($activity->name);
129
+                                                                                                                    var_dump(count($section->students));
130
+                                                                                                                    print"<br>";
131
+                                                                                                                    print "A rubric was used in the $section->code-$section->number ($section->name) course (". date('M Y', strtotime($activity->date)).") to assess students’ <u>". strtolower($outcome->name) ."</u> in the activity: '<strong>$activity->name </strong>'. N= ". count($section->students);
132
+                                                                                                                    exit();
133
+                                                                                                                    */
134
+                                                            ?>
135
+
136
+
137
+                                                            <p>A rubric was used in the
138
+                                                                {{ $section->code }}-{{ $section->number }}
139
+                                                                ({{ $section->name }}) course
140
+                                                                ({{ date('M Y', strtotime($activity->date)) }}) to assess
141
+                                                                students’ <u>{{ strtolower($outcome->name) }}</u> in the
142
+                                                                activity: "<strong>{{ $activity->name }}</strong>". N=
143
+                                                                {{ count($section->students) }}. </p>
144
+
145
+                                                            <p>The expected performance level was that
146
+                                                                <strong>{{ $activity->rubric[0]->expected_percentage }}%</strong>
147
+                                                                of students participating in the activity would score
148
+                                                                <strong>{{ $activity->rubric[0]->expected_points }}
149
+                                                                    points</strong> or more in the
150
+                                                                1-{{ $activity->rubric[0]->max_score }} point scale used.
151
+                                                            </p>
152
+
153
+                                                            <p>The results for each criterion were as follows:</p>
145 154
 
146
-                                                        <table class="table table-condensed table-bordered">
147
-                                                            <tbody>
148
-                                                                @foreach((array)$activity->cap_array as $criterion_id => $criterion)
149
-                                                                @if(in_array($outcome->id, json_decode($criterion->outcome_id))  /*== $outcome->id*/ && $criterion->score_percentage >= $activity->rubric[0]->expected_percentage )
150
-                                                                    <tr>
151
-                                                                        <td>{{ $criterion->name }}</td>
152
-                                                                        <td class="col-md-1 success">{{ $criterion->score_percentage }}%</td>
153
-                                                                    </tr>
154
-                                                                @elseif(in_array($outcome->id, json_decode($criterion->outcome_id)) && $criterion->score_percentage < $activity->rubric[0]->expected_percentage )
155
-                                                                    <tr>
156
-                                                                        <td>{{ $criterion->name }}</td>
157
-                                                                        <td class="col-md-1 danger">{{ $criterion->score_percentage }}%</td>
158
-                                                                    </tr>
159
-                                                                @endif  
160
-                                                            @endforeach
161
-                                                            </tbody>
162
-                                                        </table>
163
-
164
-                                                        <p>
165 155
                                                             <?php
166
-                                                                  $o_att_array = $activity->o_att_array;
167
-                                                            $o_ach_array = $activity->o_ach_array;
168
-                                                            $percentage = ($o_ach_array[$outcome->id]/$o_att_array[$outcome->id])*100;
169
-                                                        ?>
170
-                                                            @if($percentage >= 100)
171
-                                                                The expected goal was reached in <strong>all</strong> (100%) of the criteria assessed. Therefore, the goal for this outcome ({{ $outcome->expected_outcome }}%) was <strong>met</strong>.
172
-                                                            @elseif ($percentage < 1)
173
-                                                                The expected goal was reached in <strong>none</strong> (0%) of the criteria assessed. Therefore, the goal for this outcome ({{ $outcome->expected_outcome }}%) was <strong>not met</strong>.
174
-                                                            @elseif ($percentage >= $outcome->expected_outcome)
175
-                                                                The expected goal was reached in <strong>{{ $o_ach_array[$outcome->id] }}</strong> out of the <strong>{{ $o_att_array[$outcome->id] }}</strong> ({{ round($percentage, 2) }}%) criteria assessed. Therefore, the goal for this outcome ({{ $outcome->expected_outcome }}%) was <strong>met</strong>.
176
-                                                            @elseif ($percentage < $outcome->expected_outcome)
177
-                                                                The expected goal was reached in <strong>{{ $o_ach_array[$outcome->id] }}</strong> out of the <strong>{{ $o_att_array[$outcome->id] }}</strong> ({{ round($percentage, 2) }}%) criteria assessed. Therefore, the goal for this outcome ({{ $outcome->expected_outcome }}%) was <strong> not met</strong>.
156
+                                                            
157
+                                                            //$rubric_contents = json_decode($activity->rubric->contents);
158
+                                                            ?>
159
+
160
+                                                            <table class="table table-condensed table-bordered">
161
+                                                                <tbody>
162
+                                                                    @foreach ((array) $activity->cap_array as $criterion_id => $criterion)
163
+                                                                        @if (in_array($outcome->id, json_decode($criterion->outcome_id)) /*== $outcome->id*/ && $criterion->score_percentage >= $activity->rubric[0]->expected_percentage)
164
+                                                                            <tr>
165
+                                                                                <td>{{ $criterion->name }}</td>
166
+                                                                                <td class="col-md-1 success">
167
+                                                                                    {{ $criterion->score_percentage }}%
168
+                                                                                </td>
169
+                                                                            </tr>
170
+                                                                        @elseif(in_array($outcome->id, json_decode($criterion->outcome_id)) && $criterion->score_percentage < $activity->rubric[0]->expected_percentage)
171
+                                                                            <tr>
172
+                                                                                <td>{{ $criterion->name }}</td>
173
+                                                                                <td class="col-md-1 danger">
174
+                                                                                    {{ $criterion->score_percentage }}%
175
+                                                                                </td>
176
+                                                                            </tr>
177
+                                                                        @endif
178
+                                                                    @endforeach
179
+                                                                </tbody>
180
+                                                            </table>
181
+
182
+                                                            <p>
183
+                                                                <?php
184
+                                                                $o_att_array = $activity->o_att_array;
185
+                                                                $o_ach_array = $activity->o_ach_array;
186
+                                                                $percentage = ($o_ach_array[$outcome->id] / $o_att_array[$outcome->id]) * 100;
187
+                                                                ?>
188
+                                                                @if ($percentage >= 100)
189
+                                                                    The expected goal was reached in <strong>all</strong>
190
+                                                                    (100%) of the criteria assessed. Therefore, the goal for
191
+                                                                    this outcome ({{ $outcome->expected_outcome }}%) was
192
+                                                                    <strong>met</strong>.
193
+                                                                @elseif ($percentage < 1)
194
+                                                                    The expected goal was reached in <strong>none</strong>
195
+                                                                    (0%) of the criteria assessed. Therefore, the goal for
196
+                                                                    this outcome ({{ $outcome->expected_outcome }}%) was
197
+                                                                    <strong>not met</strong>.
198
+                                                                @elseif ($percentage >= $outcome->expected_outcome)
199
+                                                                    The expected goal was reached in
200
+                                                                    <strong>{{ $o_ach_array[$outcome->id] }}</strong> out
201
+                                                                    of the
202
+                                                                    <strong>{{ $o_att_array[$outcome->id] }}</strong>
203
+                                                                    ({{ round($percentage, 2) }}%) criteria assessed.
204
+                                                                    Therefore, the goal for this outcome
205
+                                                                    ({{ $outcome->expected_outcome }}%) was
206
+                                                                    <strong>met</strong>.
207
+                                                                @elseif ($percentage < $outcome->expected_outcome)
208
+                                                                    The expected goal was reached in
209
+                                                                    <strong>{{ $o_ach_array[$outcome->id] }}</strong> out
210
+                                                                    of the
211
+                                                                    <strong>{{ $o_att_array[$outcome->id] }}</strong>
212
+                                                                    ({{ round($percentage, 2) }}%) criteria assessed.
213
+                                                                    Therefore, the goal for this outcome
214
+                                                                    ({{ $outcome->expected_outcome }}%) was <strong> not
215
+                                                                        met</strong>.
216
+                                                                @endif
217
+                                                            </p>
218
+
219
+                                                            <h5><strong>Transformative Actions</strong></h5>
220
+                                                            @if ($activity->transforming_actions)
221
+                                                                {{ $activity->transforming_actions }}
222
+                                                            @else
223
+                                                                None
178 224
                                                             @endif
179
-                                                        </p>
180
-
181
-                                                        <h5><strong>Transformative Actions</strong></h5>
182
-                                                        @if($activity->transforming_actions)
183
-                                                            {{ $activity->transforming_actions }}
225
+                                                            <br><br>
184 226
                                                         @else
185
-                                                            None
227
+                                                            <h5>Measure {{ $activity_index + 1 }}</h5>
228
+                                                            <em>Outcome not measured.</em>
186 229
                                                         @endif
187
-                                                        <br><br>
188
-
189
-                                                    @else
190
-                                                        <h5>Measure {{ $activity_index + 1 }}</h5>
191
-                                                        <em>Outcome not measured.</em>
192
-                                                    @endif
230
+                                                    @endforeach
193 231
                                                 @endforeach
194
-                                            @endforeach
195
-                                        <hr>
196
-                                        @endif
197
-                                    @endforeach
232
+                                                <hr>
233
+                                            @endif
234
+                                        @endforeach
198 235
                                     </td>
199 236
                                 </tr>
200 237
                             @else
@@ -213,9 +250,7 @@ Log::info($activity->rubric[0]);
213 250
             </table>
214 251
         </div>
215 252
     </div>
216
-    <span class="js-vars"
217
-        data-pdf-url="{{ URL::action('OutcomesController@assessmentReport') }}"
218
-    ></span>
253
+    <span class="js-vars" data-pdf-url="{{ URL::action('OutcomesController@assessmentReport') }}"></span>
219 254
 @stop
220 255
 
221 256
 @section('included-js')
@@ -225,43 +260,47 @@ Log::info($activity->rubric[0]);
225 260
 
226 261
 @section('javascript')
227 262
 
228
-// Build table of contents
229
-var outcome = $('.outcome');
230
-var str ='';
231
-str+='<li><a href="#'+outcome.attr('id')+'">'+outcome.text()+'</a><ol class="schools upper-alpha">';
263
+    // Build table of contents
264
+    var outcome = $('.outcome');
265
+    var str ='';
266
+    str+='<li><a href="#'+outcome.attr('id')+'">'+outcome.text()+'</a>
267
+        <ol class="schools upper-alpha">';
232 268
 
233
-/*$('[id^='+outcome.attr('id')+'-].school:visible').each(function(e){
234
-    var school = $(this);
235
-    str+='<li><a href="#'+school.attr('id')+'">'+school.text()+'</a><ol class="programs">';
269
+            /*$('[id^='+outcome.attr('id')+'-].school:visible').each(function(e){
270
+            var school = $(this);
271
+            str+='<li><a href="#'+school.attr('id')+'">'+school.text()+'</a>
272
+                <ol class="programs">';
236 273
 
237
-    $('[id^='+school.attr('id')+'-].program:visible').each(function(e){
274
+                    $('[id^='+school.attr('id')+'-].program:visible').each(function(e){
238 275
 
239
-        var program = $(this);
240
-        if(!program.hasClass('no-courses'))
241
-            str+='<li><a href="#'+program.attr('id')+'">'+program.text()+'</a></li>';
242
-        else
243
-            str+='<li>'+program.text()+'</li>';
276
+                    var program = $(this);
277
+                    if(!program.hasClass('no-courses'))
278
+                    str+='<li><a href="#'+program.attr('id')+'">'+program.text()+'</a></li>';
279
+                    else
280
+                    str+='<li>'+program.text()+'</li>';
244 281
 
245
-    });
282
+                    });
246 283
 
247
-    str+='</ol></li>';
248
-});*/
284
+                    str+='</ol>
285
+            </li>';
286
+            });*/
249 287
 
250
-str+='</ol></li>';
288
+            str+='</ol>
289
+    </li>';
251 290
 
252
-//$('#table-of-contents').append(str);
291
+    //$('#table-of-contents').append(str);
253 292
 
254 293
 
255
-// ----------------------------------------------------------------------------
256
-// Events
257
-//
294
+    // ----------------------------------------------------------------------------
295
+    // Events
296
+    //
258 297
 
259
-$('.to-top').on('click', function(e) {
298
+    $('.to-top').on('click', function(e) {
260 299
     e.preventDefault();
261 300
 
262
-     $(this).scrollTop(0);
301
+    $(this).scrollTop(0);
263 302
     $('html').animate({scrollTop:0}, 1);
264 303
     $('body').animate({scrollTop:0}, 1);
265
-})
304
+    })
266 305
 
267 306
 @stop

+ 78
- 75
app/views/local/managers/pCoords/_new_navigation.blade.php View File

@@ -1,22 +1,23 @@
1 1
 <div class="navbar navbar-inverse navbar-static-top">
2 2
     <div class="container-fluid">
3 3
         <!--<div class="navbar-header">
4
-      {{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Online Learning Assessment System · Program Coordinator', [], ['class' => 'navbar-brand']) }}
4
+      {{ HTML::linkAction('ProgramCoordinatorsController@overview','Online Learning Assessment System · Program Coordinator',[],['class' => 'navbar-brand']) }}
5 5
     </div>-->
6 6
         <ul class="nav navbar-nav navbar-right">
7 7
             <li>{{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Overview') }}</li>
8
-            
8
+
9 9
             <li class="dropdown">
10 10
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
11 11
                     aria-expanded="false">Objectives<span class="caret"></span></a>
12
-                    <ul class="dropdown-menu" role="menu">
13
-                        <li>{{ HTML::linkAction('Objective2Controller@edit', 'Create/Edit Objectives') }}</li>
14
-                        <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'View Objectives and Criteria') }}</li>
15
-                    </ul>
12
+                <ul class="dropdown-menu" role="menu">
13
+                    <li>{{ HTML::linkAction('Objective2Controller@edit', 'Create/Edit Objectives') }}</li>
14
+                    <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'View Objectives and Criteria') }}
15
+                    </li>
16
+                </ul>
16 17
             </li>
17 18
 
18 19
             <!--Three Year Plan-->
19
-         
20
+
20 21
             <li class='dropdown'>
21 22
                 <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false"> Three
22 23
                     year Plans<span class="caret"></span></a>
@@ -35,17 +36,17 @@
35 36
                 <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false">
36 37
                     Criteria<span class="caret"></span></a>
37 38
                 <ul class='dropdown-menu' role='menu'>
38
-                    
39
+
39 40
                     <li>{{ HTML::linkAction('CriteriaController@edit', 'Create/Edit Criteria') }}</li>
40
-                    <li>{{ HTML::linkAction('CriteriaController@index', 'view Criteria') }}</li>
41
+                    <li>{{ HTML::linkAction('CriteriaController@index', 'View Criteria') }}</li>
41 42
 
42 43
                 </ul>
43 44
             </li>
44 45
             <!--Transformative Actions -->
45
-            <li class ='dropdown'>
46
-                <a href = "#" class = 'dropdown-toggle' data-toggle='dropdown' role = 'button' aria-expanded="false">
47
-                    Transformative Actions <span class = "caret"></span></a>
48
-                <ul class = 'dropdown-menu' role = 'menu'>
46
+            <li class='dropdown'>
47
+                <a href="#" class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false">
48
+                    Transformative Actions <span class="caret"></span></a>
49
+                <ul class='dropdown-menu' role='menu'>
49 50
                     <li>{{ HTML::linkAction('TransformativeActionsController@editTA', 'Create/Edit Tranformative Actions') }}
50 51
 
51 52
 
@@ -56,19 +57,20 @@
56 57
 
57 58
             <!-- Annual Plans-->
58 59
             <li class='dropdown'>
59
-                <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false"> Annual Plans<span class="caret"></span></a>
60
+                <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false"> Annual
61
+                    Plans<span class="caret"></span></a>
60 62
                 <ul class='dropdown-menu' role='menu'>
61 63
                     <h6 class="dropdown-header">Create/Edit Annual Plan For: </h6>
62 64
                     @foreach (Auth::user()->programs as $program)
63
-                    <li><a
64
-                        href="{{ URL::action('AnnualPlansController@showPlan', [$program->id]) }}">{{ $program->name }}</a>
65
-                </li>
65
+                        <li><a
66
+                                href="{{ URL::action('AnnualPlansController@showPlan', [$program->id]) }}">{{ $program->name }}</a>
67
+                        </li>
66 68
                     @endforeach
67
-                    <h6 class = "dropdown-header">View Annual Plan from:</h6>
69
+                    <h6 class="dropdown-header">View Annual Plan from:</h6>
68 70
                     @foreach (Auth::user()->programs as $program)
69
-                    <li><a
70
-                        href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">{{ $program->name }}</a>
71
-                </li>
71
+                        <li><a
72
+                                href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">{{ $program->name }}</a>
73
+                        </li>
72 74
                     @endforeach
73 75
                 </ul>
74 76
             </li>
@@ -76,7 +78,7 @@
76 78
             <!-- Rubrics -->
77 79
 
78 80
 
79
-            
81
+
80 82
 
81 83
             <li class="dropdown">
82 84
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
@@ -89,85 +91,86 @@
89 91
 
90 92
 
91 93
 
92
-            <li class = "dropdown">
93
-                <a  href="#" class = "dropdown-toggle" data-toggle = "dropdown" role = "button" aria-expanded="false"
94
-                >Program Results<span class = "caret"></span></a>
94
+            <li class="dropdown">
95
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Program
96
+                    Results<span class="caret"></span></a>
95 97
                 <ul class="dropdown-menu" role="menu">
96
-          
97
-                    <h6 class = 'dropdown-header'>Program Results For:</h6>
98
-                    @foreach(Auth::user()->programs as $program)
99
-                    <li><a
100
-                            href="{{ URL::action('OutcomesController@programAssessmentReport', $program->id) }}">{{$program->name}}
98
+
99
+                    <h6 class='dropdown-header'>Program Results For:</h6>
100
+                    @foreach (Auth::user()->programs as $program)
101
+                        <li><a href="{{ URL::action('OutcomesController@programAssessmentReport', $program->id) }}">{{ $program->name }}
101 102
                             </a></li>
102 103
                     @endforeach
103 104
                 </ul>
104 105
             </li>
105 106
 
106
-           
107 107
 
108 108
 
109
-            
109
+
110
+
110 111
             @if (count(Auth::user()->courses))
111
-     
112
+
112 113
                 <li class="dropdown">
113 114
 
114
-                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
115
-                        aria-expanded="false">My Courses<span class="caret"></span></a>
115
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">My
116
+                        Courses<span class="caret"></span></a>
116 117
                     <ul class="dropdown-menu" role="menu">
117 118
                         <li> {{ HTML::linkAction('ProfessorsController@overview', 'View My Courses', null) }}</li>
118 119
                         <li>{{ HTML::linkAction('OutcomesController@professorAssessmentReport', 'View My Courses\' Results') }}
119 120
 
120 121
                         </li>
121
-                        <h6 class ="dropdown-header">Sections: </h6>
122
+                        <h6 class="dropdown-header">Sections: </h6>
122 123
                         @foreach (Auth::user()->courses as $course)
123
-                        <li> {{ HTML::linkAction('CoursesController@show', $course->code . $course->number . '-' . $course->section . ' (' . $course->semester->code . ')', ['id' => $course->id]) }}
124
-                        </li>
125
-                    @endforeach
124
+                            <li> {{ HTML::linkAction('CoursesController@show',$course->code . $course->number . '-' . $course->section . ' (' . $course->semester->code . ')',['id' => $course->id]) }}
125
+                            </li>
126
+                        @endforeach
126 127
                     </ul>
127 128
                 </li>
128 129
             @endif
129 130
 
130
-            
131
-        
132 131
 
133
-            <li class = "dropdown">
134
-                <a  href="#" class = "dropdown-toggle" data-toggle = "dropdown" role = "button" aria-expanded="false"
135
-                >Annual Report<span class = "caret"></span></a>
132
+
133
+
134
+            <li class="dropdown">
135
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Annual
136
+                    Report<span class="caret"></span></a>
136 137
                 <ul class="dropdown-menu" role="menu">
137
-           
138
-                    <h6 class = 'dropdown-header'>Create/Edit Annual Report For:</h6>
139
-                    @foreach(Auth::user()->programs as $program)
140
-                    <li><a href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{$program->name}}</a></li>
138
+
139
+                    <h6 class='dropdown-header'>Create/Edit Annual Report For:</h6>
140
+                    @foreach (Auth::user()->programs as $program)
141
+                        <li><a
142
+                                href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{ $program->name }}</a>
143
+                        </li>
141 144
                     @endforeach
142 145
                 </ul>
143 146
             </li>
144 147
 
145
-            
146
-        
147
-    
148
-
149
-        <li class="dropdown">
150
-            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span
151
-                    class="caret"></span></a>
152
-            <ul class="dropdown-menu" role="menu">
153
-                <li>{{ HTML::linkAction('FeedbackController@create', 'Feedback') }}</li>
154
-                <!-- <li><a href="{{ asset('files/OLAS-intro.pdf') }}">Introduction to OLAS</a></li> -->
155
-                <li><a href="{{ asset('files/intro-avaluo.pdf') }}">Introduction to Assessment</a></li>
156
-                <!-- <li><a href="{{ asset('files/OLAS-coords.pdf') }}">OLAS for Coordinators</a></li> -->
157
-                <li><a
158
-                        href="http://oeae.uprrp.edu/wp-content/uploads/2019/01/Brochure-de-OLAS-rev.-agosto-2018.pdf">Brochure</a>
159
-                </li>
160
-            </ul>
161
-        </li>
162
-        <li class="dropdown">
163
-            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span
164
-                    class="caret"></span></a>
165
-            <ul class="dropdown-menu" role="menu">
166
-                <li>{{ HTML::linkAction('UsersController@edit', 'Profile') }}</li>
167
-                <li>{{ HTML::linkAction('AuthController@logout', 'Log out (' . Auth::user()->email . ')') }}</li>
168
-            </ul>
169
-        </li>
170
-        <li>
171
-            </ul>
148
+
149
+
150
+
151
+
152
+            <li class="dropdown">
153
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span
154
+                        class="caret"></span></a>
155
+                <ul class="dropdown-menu" role="menu">
156
+                    <li>{{ HTML::linkAction('FeedbackController@create', 'Feedback') }}</li>
157
+                    <!-- <li><a href="{{ asset('files/OLAS-intro.pdf') }}">Introduction to OLAS</a></li> -->
158
+                    <li><a href="{{ asset('files/intro-avaluo.pdf') }}">Introduction to Assessment</a></li>
159
+                    <!-- <li><a href="{{ asset('files/OLAS-coords.pdf') }}">OLAS for Coordinators</a></li> -->
160
+                    <li><a
161
+                            href="http://oeae.uprrp.edu/wp-content/uploads/2019/01/Brochure-de-OLAS-rev.-agosto-2018.pdf">Brochure</a>
162
+                    </li>
163
+                </ul>
164
+            </li>
165
+            <li class="dropdown">
166
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
167
+                    aria-expanded="false">Account<span class="caret"></span></a>
168
+                <ul class="dropdown-menu" role="menu">
169
+                    <li>{{ HTML::linkAction('UsersController@edit', 'Profile') }}</li>
170
+                    <li>{{ HTML::linkAction('AuthController@logout', 'Log out (' . Auth::user()->email . ')') }}</li>
171
+                </ul>
172
+            </li>
173
+            <li>
174
+        </ul>
172 175
     </div>
173 176
 </div>

+ 72
- 68
app/views/local/managers/sCoords/_new_navigation.blade.php View File

@@ -1,22 +1,23 @@
1 1
 <div class="navbar navbar-inverse navbar-static-top">
2 2
     <div class="container-fluid">
3 3
         <!--<div class="navbar-header">
4
-      {{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Online Learning Assessment System · Program Coordinator', [], ['class' => 'navbar-brand']) }}
4
+      {{ HTML::linkAction('ProgramCoordinatorsController@overview','Online Learning Assessment System · Program Coordinator',[],['class' => 'navbar-brand']) }}
5 5
     </div>-->
6 6
         <ul class="nav navbar-nav navbar-right">
7 7
             <li>{{ HTML::linkAction('SchoolCoordinatorsController@overview', 'Overview') }}</li>
8
-            
8
+
9 9
             <li class="dropdown">
10 10
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
11 11
                     aria-expanded="false">Objectives<span class="caret"></span></a>
12
-                    <ul class="dropdown-menu" role="menu">
13
-                        <li>{{ HTML::linkAction('Objective2Controller@edit', 'Create/Edit Objectives') }}</li>
14
-                        <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'View Objectives and Criteria') }}</li>
15
-                    </ul>
12
+                <ul class="dropdown-menu" role="menu">
13
+                    <li>{{ HTML::linkAction('Objective2Controller@edit', 'Create/Edit Objectives') }}</li>
14
+                    <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'View Objectives and Criteria') }}
15
+                    </li>
16
+                </ul>
16 17
             </li>
17 18
 
18 19
             <!--Three Year Plan-->
19
-         
20
+
20 21
             <li class='dropdown'>
21 22
                 <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false"> Three
22 23
                     year Plans<span class="caret"></span></a>
@@ -35,17 +36,17 @@
35 36
                 <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false">
36 37
                     Criteria<span class="caret"></span></a>
37 38
                 <ul class='dropdown-menu' role='menu'>
38
-                    
39
+
39 40
                     <li>{{ HTML::linkAction('CriteriaController@edit', 'Create/Edit Criteria') }}</li>
40
-                    <li>{{ HTML::linkAction('CriteriaController@index', 'view Criteria') }}</li>
41
+                    <li>{{ HTML::linkAction('CriteriaController@index', 'View Criteria') }}</li>
41 42
 
42 43
                 </ul>
43 44
             </li>
44 45
             <!--Transformative Actions -->
45
-            <li class ='dropdown'>
46
-                <a href = "#" class = 'dropdown-toggle' data-toggle='dropdown' role = 'button' aria-expanded="false">
47
-                    Transformative Actions <span class = "caret"></span></a>
48
-                <ul class = 'dropdown-menu' role = 'menu'>
46
+            <li class='dropdown'>
47
+                <a href="#" class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false">
48
+                    Transformative Actions <span class="caret"></span></a>
49
+                <ul class='dropdown-menu' role='menu'>
49 50
                     <li>{{ HTML::linkAction('TransformativeActionsController@editTA', 'Create/Edit Tranformative Actions') }}
50 51
 
51 52
 
@@ -56,19 +57,20 @@
56 57
 
57 58
             <!-- Annual Plans-->
58 59
             <li class='dropdown'>
59
-                <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false"> Annual Plans<span class="caret"></span></a>
60
+                <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded="false"> Annual
61
+                    Plans<span class="caret"></span></a>
60 62
                 <ul class='dropdown-menu' role='menu'>
61 63
                     <h6 class="dropdown-header">Create/Edit Annual Plan For: </h6>
62 64
                     @foreach (Auth::user()->school->programs as $program)
63
-                    <li><a
64
-                        href="{{ URL::action('AnnualPlansController@showPlan', [$program->id]) }}">{{ $program->name }}</a>
65
-                </li>
65
+                        <li><a
66
+                                href="{{ URL::action('AnnualPlansController@showPlan', [$program->id]) }}">{{ $program->name }}</a>
67
+                        </li>
66 68
                     @endforeach
67
-                    <h6 class = "dropdown-header">View Annual Plan from:</h6>
69
+                    <h6 class="dropdown-header">View Annual Plan from:</h6>
68 70
                     @foreach (Auth::user()->school->programs as $program)
69
-                    <li><a
70
-                        href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">{{ $program->name }}</a>
71
-                </li>
71
+                        <li><a
72
+                                href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">{{ $program->name }}</a>
73
+                        </li>
72 74
                     @endforeach
73 75
                 </ul>
74 76
             </li>
@@ -76,7 +78,7 @@
76 78
             <!-- Rubrics -->
77 79
 
78 80
 
79
-            
81
+
80 82
 
81 83
             <li class="dropdown">
82 84
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
@@ -89,72 +91,74 @@
89 91
 
90 92
 
91 93
             <li>{{ HTML::linkAction('OutcomesController@schoolAssessmentReport', 'School Results') }}</li>
92
-            
93
-           
94 94
 
95 95
 
96
-            
96
+
97
+
98
+
97 99
             @if (count(Auth::user()->courses))
98
-     
100
+
99 101
                 <li class="dropdown">
100 102
 
101
-                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
102
-                        aria-expanded="false">My Courses<span class="caret"></span></a>
103
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">My
104
+                        Courses<span class="caret"></span></a>
103 105
                     <ul class="dropdown-menu" role="menu">
104 106
                         <li> {{ HTML::linkAction('ProfessorsController@overview', 'View My Courses', null) }}</li>
105 107
                         <li>{{ HTML::linkAction('OutcomesController@professorAssessmentReport', 'View My Courses\' Results') }}
106 108
 
107 109
                         </li>
108
-                        <h6 class ="dropdown-header">Sections: </h6>
110
+                        <h6 class="dropdown-header">Sections: </h6>
109 111
                         @foreach (Auth::user()->courses as $course)
110
-                        <li> {{ HTML::linkAction('CoursesController@show', $course->code . $course->number . '-' . $course->section . ' (' . $course->semester->code . ')', ['id' => $course->id]) }}
111
-                        </li>
112
-                    @endforeach
112
+                            <li> {{ HTML::linkAction('CoursesController@show',$course->code . $course->number . '-' . $course->section . ' (' . $course->semester->code . ')',['id' => $course->id]) }}
113
+                            </li>
114
+                        @endforeach
113 115
                     </ul>
114 116
                 </li>
115 117
             @endif
116 118
 
117
-            
118
-        
119 119
 
120
-            <li class = "dropdown">
121
-                <a  href="#" class = "dropdown-toggle" data-toggle = "dropdown" role = "button" aria-expanded="false"
122
-                >Annual Report<span class = "caret"></span></a>
120
+
121
+
122
+            <li class="dropdown">
123
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Annual
124
+                    Report<span class="caret"></span></a>
123 125
                 <ul class="dropdown-menu" role="menu">
124
-           
125
-                    <h6 class = 'dropdown-header'>Create/Edit Annual Report For:</h6>
126
-                    @foreach(Auth::user()->school->programs as $program)
127
-                    <li><a href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{$program->name}}</a></li>
126
+
127
+                    <h6 class='dropdown-header'>Create/Edit Annual Report For:</h6>
128
+                    @foreach (Auth::user()->school->programs as $program)
129
+                        <li><a
130
+                                href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{ $program->name }}</a>
131
+                        </li>
128 132
                     @endforeach
129 133
                 </ul>
130 134
             </li>
131 135
 
132
-            
133
-        
134
-    
135
-
136
-        <li class="dropdown">
137
-            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span
138
-                    class="caret"></span></a>
139
-            <ul class="dropdown-menu" role="menu">
140
-                <li>{{ HTML::linkAction('FeedbackController@create', 'Feedback') }}</li>
141
-                <!-- <li><a href="{{ asset('files/OLAS-intro.pdf') }}">Introduction to OLAS</a></li> -->
142
-                <li><a href="{{ asset('files/intro-avaluo.pdf') }}">Introduction to Assessment</a></li>
143
-                <!-- <li><a href="{{ asset('files/OLAS-coords.pdf') }}">OLAS for Coordinators</a></li> -->
144
-                <li><a
145
-                        href="http://oeae.uprrp.edu/wp-content/uploads/2019/01/Brochure-de-OLAS-rev.-agosto-2018.pdf">Brochure</a>
146
-                </li>
147
-            </ul>
148
-        </li>
149
-        <li class="dropdown">
150
-            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span
151
-                    class="caret"></span></a>
152
-            <ul class="dropdown-menu" role="menu">
153
-                <li>{{ HTML::linkAction('UsersController@edit', 'Profile') }}</li>
154
-                <li>{{ HTML::linkAction('AuthController@logout', 'Log out (' . Auth::user()->email . ')') }}</li>
155
-            </ul>
156
-        </li>
157
-        <li>
158
-            </ul>
136
+
137
+
138
+
139
+
140
+            <li class="dropdown">
141
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span
142
+                        class="caret"></span></a>
143
+                <ul class="dropdown-menu" role="menu">
144
+                    <li>{{ HTML::linkAction('FeedbackController@create', 'Feedback') }}</li>
145
+                    <!-- <li><a href="{{ asset('files/OLAS-intro.pdf') }}">Introduction to OLAS</a></li> -->
146
+                    <li><a href="{{ asset('files/intro-avaluo.pdf') }}">Introduction to Assessment</a></li>
147
+                    <!-- <li><a href="{{ asset('files/OLAS-coords.pdf') }}">OLAS for Coordinators</a></li> -->
148
+                    <li><a
149
+                            href="http://oeae.uprrp.edu/wp-content/uploads/2019/01/Brochure-de-OLAS-rev.-agosto-2018.pdf">Brochure</a>
150
+                    </li>
151
+                </ul>
152
+            </li>
153
+            <li class="dropdown">
154
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
155
+                    aria-expanded="false">Account<span class="caret"></span></a>
156
+                <ul class="dropdown-menu" role="menu">
157
+                    <li>{{ HTML::linkAction('UsersController@edit', 'Profile') }}</li>
158
+                    <li>{{ HTML::linkAction('AuthController@logout', 'Log out (' . Auth::user()->email . ')') }}</li>
159
+                </ul>
160
+            </li>
161
+            <li>
162
+        </ul>
159 163
     </div>
160 164
 </div>

+ 232
- 10
app/views/local/managers/shared/annual-plans.blade.php View File

@@ -21,8 +21,8 @@
21 21
 
22 22
     <div class="row">
23 23
         <div class="col-md-3">
24
-            <a role="button" class="btn btn-secondary"
25
-                href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">View Plans</a>
24
+            {{-- <a role="button" class="btn btn-secondary"
25
+                href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">View Plans</a> --}}
26 26
 
27 27
             <select class="form-control selectpicker" id="annual_plan" onchange="fetchInfo('annual_plan')">
28 28
                 <option value='0'> Nothing Selected</option>
@@ -37,6 +37,10 @@
37 37
             <div id='allOutcomes'>
38 38
 
39 39
             </div>
40
+            <hr>
41
+            <div id="printButton">
42
+
43
+            </div>
40 44
         </div>
41 45
 
42 46
 
@@ -100,7 +104,8 @@
100 104
 
101 105
                     <input type='hidden' id='typ_semester_outcome_id' value='0'>
102 106
                     <div id='new_transformative_actions_to_outcome'>
103
-           
107
+
108
+
104 109
                     </div>
105 110
 
106 111
                     <button class='btn btn-md btn-secondary button-add-transformative' id='add_trans_action'
@@ -111,9 +116,8 @@
111 116
                         Add another Transformative Action
112 117
                     </button>
113 118
                     <hr>
114
-                    <button type="button" class="btn btn-primary" id="submit_modal" data-toggle="modal"
115
-                        data-target="#modal-submit" style="float: right">Submit Annual Plan</button>
116
-
119
+                    {{-- <button type="button" class="btn btn-primary" id="submit_modal" data-toggle="modal"
120
+                        data-target="#modal-submit" style="float: right">Submit Annual Plan</button> --}}
117 121
 
118 122
                 </div>
119 123
             </div>
@@ -124,6 +128,8 @@
124 128
             <div class="no-outcome alert alert-info">
125 129
                 <p>Select a Learning Outcome to view its information</p>
126 130
             </div>
131
+
132
+
127 133
         </div>
128 134
     </div>
129 135
 
@@ -141,6 +147,26 @@
141 147
             </div><!-- /.modal-content -->
142 148
         </div><!-- /.modal-dialog -->
143 149
     </div><!-- /.modal -->
150
+    <div class="modal fade" id="submit-modal">
151
+        <div class="modal-dialog modal-lg">
152
+            <div class="modal-content">
153
+                <div class="modal-header">
154
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
155
+                            aria-hidden="true">&times;</span></button>
156
+                    <h3 class="modal-title" id="submit-modal-title"></h3>
157
+                </div>
158
+                <div class="modal-body" id="submit-modal-body">
159
+
160
+
161
+
162
+
163
+                </div>
164
+                <div class='modal-footer' id='submit-modal-footer'>
165
+
166
+                </div>
167
+            </div><!-- /.modal-content -->
168
+        </div><!-- /.modal-dialog -->
169
+    </div><!-- /.modal -->
144 170
 
145 171
     <div class="modal fade" id="modal-submit">
146 172
         <div class="modal-dialog modal-lg">
@@ -206,7 +232,7 @@
206 232
 
207 233
         //Submit Plan
208 234
 
209
-        function submit_annual_plan() {
235
+        /*function submit_annual_plan() {
210 236
             annual_plan_id = $('#annual_plan').val();
211 237
             $.post("{{ URL::action('AnnualPlansController@submitAnnualPlan') }}", {
212 238
                     annual_plan_id: annual_plan_id
@@ -214,7 +240,7 @@
214 240
                 function() {
215 241
                     location.reload();
216 242
                 })
217
-        }
243
+        }*/
218 244
 
219 245
         //fetch after submit
220 246
         function fetchEverythingSubmitted(li) {
@@ -300,7 +326,7 @@
300 326
                         });
301 327
 
302 328
 
303
-                        courseshtml = ' &#8226; [' + course.code +  course.number + '] ' +
329
+                        courseshtml = ' &#8226; [' + course.code + course.number + '] ' +
304 330
                             course.name + '<br>'
305 331
                         courseTAhtml = ' &#8226; [' + course.code + course.number + '] ' +
306 332
                             course.name + '<br>';
@@ -1247,13 +1273,16 @@
1247 1273
                 },
1248 1274
                 function(json) {
1249 1275
 
1276
+
1250 1277
                     div = $('<div/>', {
1251 1278
                         'class': 'list-group',
1252 1279
                         'id': 'list'
1253 1280
                     });
1254 1281
                     var onclick = "";
1255 1282
                     //TODO CHange this
1256
-                    if (json.annual_plans.is_submitted!=2 )
1283
+
1284
+
1285
+                    if (json.annual_plans.is_submitted != 2)
1257 1286
                         onclick = "fetchEverything(this)";
1258 1287
                     else onclick = "fetchEverything(this)";
1259 1288
                     if (json.outcomes.first) {
@@ -1315,6 +1344,34 @@
1315 1344
                     $("#allOutcomes").html(div[0].innerHTML);
1316 1345
                     $("#allOutcomes").show();
1317 1346
 
1347
+
1348
+
1349
+                    // Create button to print report
1350
+
1351
+                    div_btn_group = $('<div>', {
1352
+                        'class': 'btn-group',
1353
+                        'role': 'group'
1354
+                    });
1355
+                    button_save = $('<button>', {
1356
+                        'class': 'btn btn-lg btn-primary',
1357
+                        'type': 'button',
1358
+                        'onclick': 'check_if_ready(' + annual_id + ')'
1359
+                    }).html('Submit Annual Plan');
1360
+                    button_print = $("<button>", {
1361
+                        "class": 'btn btn-lg btn-primary',
1362
+                        "type": "button",
1363
+                        "onclick": "window.location.href = " +
1364
+                            "'{{ URL::action('AnnualPlansController@printAnnualPlan') }}" +
1365
+                            "/" +
1366
+                            annual_id + "'",
1367
+                    }).html("Print Plan");
1368
+                    div_btn_group.append(button_print);
1369
+                    div_btn_group.append(button_save);
1370
+
1371
+
1372
+                    $('#printButton').html(div_btn_group);
1373
+
1374
+
1318 1375
                 },
1319 1376
                 "json",
1320 1377
             );
@@ -1329,11 +1386,176 @@
1329 1386
             $('#' + div).data("amount-select", $('#' + div).data("amount-select") - 1);
1330 1387
 
1331 1388
         }
1389
+
1390
+        function check_if_ready(annual_id) {
1391
+            $.post(
1392
+                "{{ URL::action('AnnualPlansController@checkIfPlanReady') }}", {
1393
+                    annual_id: annual_id
1394
+                },
1395
+                function(courses_with_missing_data) {
1396
+
1397
+                    if (courses_with_missing_data.length > 0) {
1398
+                        //id="submit-modal">
1399
+
1400
+                        //This means there is still data to be filled before submit.
1401
+
1402
+                        $('#submit-modal-title').html("There is still some data to be filled. ")
1403
+
1404
+                        //close button  <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
1405
+
1406
+                        button = $('<button>', {
1407
+                            'class': 'btn btn-secondary',
1408
+                            'type': 'button',
1409
+                            'data-dismiss': 'modal'
1410
+                        }).html('Close');
1411
+                        $('#submit-modal-footer').html(button);
1412
+
1413
+
1414
+
1415
+                        div_for_courses = $("<div>", {
1416
+                            'id': 'courses_criteria',
1417
+
1418
+                        }).html("<h4>These are the Courses that need at least one Criteria paired</h4>")
1419
+                        ol_course_ta = $("<ol>", {
1420
+                            'id': 'course_criteria',
1421
+                            'type': 'I'
1422
+                        });
1423
+                        div_for_courses.append(ol_course_ta);
1424
+                        //"<ol id='course_ta' type='I'>");
1425
+
1426
+                        //div_for_outcomes
1427
+                        $('#submit-modal-body').html(div_for_courses)
1428
+
1429
+                        $.each(courses_with_missing_data, function(index, info) {
1430
+
1431
+
1432
+                            selector = $('#course_typ_outcome_' + info.typ_semester_outcome_id);
1433
+                            if (selector.length === 0) {
1434
+                                li_outcome = $('<li>').html(info.outcome_name);
1435
+                                ol = $("<ol>", {
1436
+                                    'id': 'course_typ_outcome_' + info
1437
+                                        .typ_semester_outcome_id,
1438
+                                    'type': 'A'
1439
+                                });
1440
+                                li_outcome.append(ol);
1441
+                                $("#course_criteria").append(li_outcome);
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+                                //selector = $('<div>').html(info.outcome.typ_semester_outcome_id);
1448
+                                //selector.append('<ol type = "A">');
1449
+                                //objective_li = $("<li>");
1450
+                                //objective_id = $("<div>",{
1451
+                                //    'class':'typ-objective-'+info.objective.typ_semester_objective_id,
1452
+
1453
+                                //}).html();
1454
+                                //li.append(selector);
1455
+                            }
1456
+
1457
+                            selector = $("#course_typ_objective_" + info.typ_semester_objective_id)
1458
+                            if (selector.length === 0) {
1459
+                                li_objective = $("<li>").html(info.objective_text);
1460
+                                ol_objective = $("<ol>", {
1461
+                                    'id': 'course_typ_objective_' + info.typ_semester_objective_id,
1462
+                                    'type': '1'
1463
+                                });
1464
+                                li_objective.append(ol_objective);
1465
+                                $('#course_typ_outcome_' + info.typ_semester_outcome_id).append(
1466
+                                    li_objective);
1467
+
1468
+                            }
1469
+                            selector = $("#course_ul_" + info.typ_semester_course_id)
1470
+                            if (selector.length === 0) {
1471
+                                li_course = $("<li>").html(info.course_code);
1472
+                                ol_course = $("<ul>", {
1473
+                                    'id': "course_ul_" + info.typ_semester_course_id,
1474
+                                });
1475
+                                li_course.append(ol_course);
1476
+                                $('#course_typ_objective_' + info.typ_semester_objective_id)
1477
+                                    .append(li_course);
1478
+                            }
1479
+
1480
+
1481
+                        });
1482
+                        //$('#submit-modal-body').append("</ol>")
1483
+
1484
+
1485
+
1486
+                        //$('#submit-modal-footer').html(button);
1487
+
1488
+
1489
+
1490
+                    } else {
1491
+                        button = $('<button>', {
1492
+                            'class': 'btn btn-secondary',
1493
+                            'type': 'button',
1494
+                            'data-dismiss': 'modal'
1495
+                        }).html('Close');
1496
+                        button_for_save = $("<button>", {
1497
+
1498
+                            'class': 'btn btn-primary',
1499
+                            'type': 'button',
1500
+                            'onclick': "postAnnualPlan(" + annual_id + ")"
1501
+
1502
+
1503
+                        }).html("Submit Annual Report");
1504
+
1505
+                        $("#submit-modal-title").html("Are you sure you want to submit this report?");
1506
+                        $("#submit-modal-body")
1507
+                            .html(
1508
+                                "You can submit again later, but may need to give explination to administration on why was it resubmitted"
1509
+                            );
1510
+
1511
+                        $('#submit-modal-footer').html(button);
1512
+
1513
+
1514
+                        $("#submit-modal-footer").append(button_for_save);
1515
+
1516
+                    }
1517
+                    $("#submit-modal").modal('toggle');
1518
+
1519
+                }
1520
+
1521
+
1522
+            )
1523
+        }
1524
+
1525
+        function postAnnualPlan(annual_id) {
1526
+            $.post(
1527
+                "{{ URL::action('AnnualPlansController@submitAnnualPlan') }}/" + annual_id, {},
1528
+                function(message) {
1529
+                    if (message = '200') {
1530
+                        $("#submit-modal").modal('toggle');
1531
+                        alert = $('<div/>', {
1532
+                            'class': 'alert alert-success alert-dismissible',
1533
+                            'role': 'alert'
1534
+                        })
1535
+                        button = $('<button/>', {
1536
+                            'type': 'button',
1537
+                            'class': 'close',
1538
+                            'data-dismiss': 'alert',
1539
+                            'alert-label': 'close'
1540
+                        }).html('<span aria-hidden="true">×</span>');
1541
+                        alert.append(button);
1542
+                        alert.append(
1543
+                            '<strong>The plan was submitted. You can check it out in View Annual Plans or Print Plan </strong>'
1544
+                        )
1545
+                        alert.appendTo($("#alert-for-save"));
1546
+                    }
1547
+
1548
+
1549
+
1550
+                });
1551
+        }
1332 1552
     </script>
1333 1553
 
1334 1554
 
1335 1555
 
1336 1556
 
1557
+
1558
+
1337 1559
 @stop
1338 1560
 
1339 1561
 @section('included-js')

+ 291
- 15
app/views/local/managers/shared/annual_report.blade.php View File

@@ -34,6 +34,8 @@
34 34
             <div id='allOutcomes'>
35 35
 
36 36
             </div>
37
+            <hr>
38
+            <div id="printButton"></div>
37 39
         </div>
38 40
 
39 41
 
@@ -66,14 +68,14 @@
66 68
 
67 69
 
68 70
                     <!-- <div class="table-responsive">
69
-                                    <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
70
-                                      <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
71
-                                      <tbody>
72
-                                      </tbody>
71
+                                                                                                                                                                                                                                                                                    <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
72
+                                                                                                                                                                                                                                                                                      <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
73
+                                                                                                                                                                                                                                                                                      <tbody>
74
+                                                                                                                                                                                                                                                                                      </tbody>
73 75
 
74
-                                    </table>
75
-                                    
76
-                                </div>-->
76
+                                                                                                                                                                                                                                                                                    </table>
77
+                                                                                                                                                                                                                                                                                    
78
+                                                                                                                                                                                                                                                                                </div>-->
77 79
 
78 80
                 </div>
79 81
             </div>
@@ -172,6 +174,29 @@
172 174
             </div><!-- /.modal-content -->
173 175
         </div><!-- /.modal-dialog -->
174 176
     </div><!-- /.modal -->
177
+
178
+    <div class="modal fade" id="submit-modal">
179
+        <div class="modal-dialog modal-lg">
180
+            <div class="modal-content">
181
+                <div class="modal-header">
182
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
183
+                            aria-hidden="true">&times;</span></button>
184
+                    <h3 class="modal-title" id="submit-modal-title"></h3>
185
+                </div>
186
+                <div class="modal-body" id="submit-modal-body">
187
+
188
+
189
+
190
+
191
+                </div>
192
+                <div class='modal-footer' id='submit-modal-footer'>
193
+
194
+                </div>
195
+            </div><!-- /.modal-content -->
196
+        </div><!-- /.modal-dialog -->
197
+    </div><!-- /.modal -->
198
+
199
+
175 200
     <script>
176 201
         function nextChar(c) {
177 202
             return String.fromCharCode(c.charCodeAt(0) + 1);
@@ -409,7 +434,8 @@
409 434
                     button = $('<button>', {
410 435
                         "type": "button",
411 436
                         "class": "btn btn-primary",
412
-                        "onclick": 'saveTransReport(' + trans_action.trans_id + ', ' + semester_id + ')',
437
+                        "onclick": 'saveTransReport(' + trans_action.trans_id + ', ' + semester_id +
438
+                            ', this)',
413 439
                         'style': 'float: right'
414 440
 
415 441
                     }).html('Save');
@@ -977,12 +1003,12 @@
977 1003
 
978 1004
                             li = $('<li/>', {
979 1005
                                 'role': 'presentation',
980
-                                'id': 'li_for_' + objective.id
1006
+                                'id': 'li_for_' + objective.objective_id
981 1007
                             });
982 1008
                             a = $('<a/>', {
983 1009
                                 'data-toggle': 'tab',
984
-                                'id': 'a_for_' + objective.id,
985
-                                'href': '#' + objective.id,
1010
+                                'id': 'a_for_' + objective.objective_id,
1011
+                                'href': '#' + objective.objective_id,
986 1012
                                 'role': 'tab'
987 1013
                             }).html('Objective ' + (index + 1));
988 1014
                             li.append(a);
@@ -991,7 +1017,7 @@
991 1017
                             div = $('<div/>', {
992 1018
                                 'role': 'tabpanel',
993 1019
                                 'class': 'tab-pane',
994
-                                'id': objective.id
1020
+                                'id': objective.objective_id
995 1021
                             }).html(objective_title);
996 1022
 
997 1023
 
@@ -1179,10 +1205,12 @@
1179 1205
                         if (students_attempted) {
1180 1206
                             studentPercentage = ((students_achieved / students_attempted) * 100).toFixed(2);
1181 1207
                             if (parseFloat(studentPercentage) >= parseFloat(outcome.outcome_program_goal)) {
1182
-                                FinalReport = "<p style = 'margin: 30px; '><strong>Results for " + outcome.name+": </strong><em style = 'color: green'>" +
1208
+                                FinalReport = "<p style = 'margin: 30px; '><strong>Results for " + outcome.name +
1209
+                                    ": </strong><em style = 'color: green'>" +
1183 1210
                                     studentPercentage + "% </em></p>";
1184 1211
                             } else {
1185
-                                FinalReport = "<p style = 'margin: 30px'><strong>Results for " +outcome.name+": </strong><em style = 'color: red'>"+
1212
+                                FinalReport = "<p style = 'margin: 30px'><strong>Results for " + outcome.name +
1213
+                                    ": </strong><em style = 'color: red'>" +
1186 1214
                                     studentPercentage + "% </em></p>";
1187 1215
 
1188 1216
                             }
@@ -1447,7 +1475,24 @@
1447 1475
                     was_it_useful: was_it_useful,
1448 1476
                 },
1449 1477
                 function(message) {
1450
-                    alert(message);
1478
+                    if (type_of_input == 'modal') {
1479
+                        $('#modal-status-trans').modal("toggle");
1480
+                    } else {
1481
+                        alert = $('<div/>', {
1482
+                            'class': 'alert alert-success alert-dismissible',
1483
+                            'role': 'alert'
1484
+                        })
1485
+                        button = $('<button/>', {
1486
+                            'type': 'button',
1487
+                            'class': 'close',
1488
+                            'data-dismiss': 'alert',
1489
+                            'alert-label': 'close'
1490
+                        }).html('<span aria-hidden="true">×</span>');
1491
+                        alert.append(button);
1492
+                        alert.append('<strong>Saved! </strong>')
1493
+                        $(type_of_input).parent().prepend(alert);
1494
+                    }
1495
+
1451 1496
                 }
1452 1497
             )
1453 1498
         }
@@ -1529,11 +1574,242 @@
1529 1574
                     $("#allOutcomes").html(div[0].innerHTML);
1530 1575
                     $("#allOutcomes").show();
1531 1576
 
1577
+                    //create button for print
1578
+                    div_btn_group = $('<div>', {
1579
+                        'class': 'btn-group',
1580
+                        'role': 'group'
1581
+                    });
1582
+                    button_save = $('<button>', {
1583
+                        'class': 'btn btn-lg btn-primary',
1584
+                        'type': 'button',
1585
+                        'onclick': 'check_if_ready(' + annual_id + ')'
1586
+                    }).html('Submit Annual Report');
1587
+                    button_print = $("<button>", {
1588
+                        "class": 'btn btn-lg btn-primary',
1589
+                        "type": "button",
1590
+                        "onclick": "window.location.href = " +
1591
+                            "'{{ URL::action('AnnualPlansController@printAnnualReport') }}" +
1592
+                            "/" +
1593
+                            annual_id + "'",
1594
+                    }).html("Print Report");
1595
+                    div_btn_group.append(button_print);
1596
+                    div_btn_group.append(button_save);
1597
+
1598
+
1599
+                    $('#printButton').html(div_btn_group);
1600
+
1601
+
1532 1602
                 },
1533 1603
                 "json",
1534 1604
             );
1535 1605
 
1536 1606
         }
1607
+
1608
+        function check_if_ready(annual_id) {
1609
+            $.post(
1610
+                "{{ URL::action('AnnualPlansController@checkIfReady') }}", {
1611
+                    annual_id: annual_id
1612
+                },
1613
+                function(courses_with_missing_data) {
1614
+
1615
+                    if (courses_with_missing_data.outcomes.length > 0 || courses_with_missing_data.courses.length > 0) {
1616
+                        //id="submit-modal">
1617
+
1618
+                        //This means there is still data to be filled before submit.
1619
+
1620
+                        $('#submit-modal-title').html("There is still some data to be filled. ")
1621
+
1622
+                        //close button  <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
1623
+
1624
+                        button = $('<button>', {
1625
+                            'class': 'btn btn-secondary',
1626
+                            'type': 'button',
1627
+                            'data-dismiss': 'modal'
1628
+                        }).html('Close');
1629
+                        $('#submit-modal-footer').html(button);
1630
+
1631
+                        $('#submit-modal-body').html("These are the following transformative actions");
1632
+                        if (courses_with_missing_data.courses.length > 0) {
1633
+                            div_for_courses = $("<div>", {
1634
+                                'id': 'courses_ta',
1635
+
1636
+                            }).html("<h4>These are the Courses Transformative Actions need to be filled</h4>")
1637
+                            ol_course_ta = $("<ol>", {
1638
+                                'id': 'course_ta',
1639
+                                'type': 'I'
1640
+                            });
1641
+                            div_for_courses.append(ol_course_ta);
1642
+                            //"<ol id='course_ta' type='I'>");
1643
+
1644
+                            //div_for_outcomes
1645
+                            $('#submit-modal-body').append(div_for_courses)
1646
+
1647
+                            $.each(courses_with_missing_data.courses, function(index, info) {
1648
+                                /*
1649
+                                    $array_to_be_appended = [
1650
+                                        'course_name' => $course->code . '-' . $course->number,
1651
+                                        'objective' => $objective_info,
1652
+                                        'outcome' => $outcome_info,
1653
+                                        'transformative_action_title' => $ta->at_text,
1654
+                                        'transformative_action_description' => $ta->description
1655
+                                    ];
1656
+                                */
1657
+
1658
+                                selector = $('#course_typ_outcome_' + info.outcome.typ_semester_outcome_id);
1659
+                                if (selector.length === 0) {
1660
+                                    li_outcome = $('<li>').html(info.outcome.name);
1661
+                                    ol = $("<ol>", {
1662
+                                        'id': 'course_typ_outcome_' + info.outcome
1663
+                                            .typ_semester_outcome_id,
1664
+                                        'type': 'A'
1665
+                                    });
1666
+                                    li_outcome.append(ol);
1667
+                                    $("#course_ta").append(li_outcome);
1668
+
1669
+
1670
+
1671
+
1672
+
1673
+                                    //selector = $('<div>').html(info.outcome.typ_semester_outcome_id);
1674
+                                    //selector.append('<ol type = "A">');
1675
+                                    //objective_li = $("<li>");
1676
+                                    //objective_id = $("<div>",{
1677
+                                    //    'class':'typ-objective-'+info.objective.typ_semester_objective_id,
1678
+
1679
+                                    //}).html();
1680
+                                    //li.append(selector);
1681
+                                }
1682
+
1683
+                                selector = $("#course_typ_objective_" + info.objective
1684
+                                    .typ_semester_objective_id)
1685
+                                if (selector.length === 0) {
1686
+                                    li_objective = $("<li>").html(info.objective.text);
1687
+                                    ol_objective = $("<ol>", {
1688
+                                        'id': 'course_typ_objective_' + info.objective
1689
+                                            .typ_semester_objective_id,
1690
+                                        'type': '1'
1691
+                                    });
1692
+                                    li_objective.append(ol_objective);
1693
+                                    $('#course_typ_outcome_' + info.outcome.typ_semester_outcome_id).append(
1694
+                                        li_objective);
1695
+
1696
+                                }
1697
+                                selector = $("#course_ul_" + info.typ_semester_course_id)
1698
+                                if (selector.length === 0) {
1699
+                                    li_course = $("<li>").html(info.course_name);
1700
+                                    ol_course = $("<ul>", {
1701
+                                        'id': "course_ul_" + info.typ_semester_course_id,
1702
+                                    });
1703
+                                    li_course.append(ol_course);
1704
+                                    $('#course_typ_objective_' + info.objective.typ_semester_objective_id)
1705
+                                        .append(li_course);
1706
+                                }
1707
+                                li_ta = $('<li>').html('<p><strong>' + info.transformative_action_title +
1708
+                                    ': </strong>' + info.transformative_action_description + '</p>');
1709
+                                $("#course_ul_" + info.typ_semester_course_id).append(li_ta);
1710
+
1711
+                            });
1712
+                            //$('#submit-modal-body').append("</ol>")
1713
+
1714
+
1715
+
1716
+                            //$('#submit-modal-footer').html(button);
1717
+                        }
1718
+
1719
+                        if (courses_with_missing_data.outcomes.length > 0) {
1720
+                            div_for_outcomes = $("<div>", {
1721
+                                'id': 'outcomes_ta',
1722
+
1723
+                            }).html("<h4>These are the Program Transformative Actions need to be filled</h4>");
1724
+
1725
+
1726
+                            ol = $('<ol>', {
1727
+                                'id': 'list_for_outcomes',
1728
+                                'type': 'I'
1729
+                            });
1730
+                            ol.appendTo(div_for_outcomes);
1731
+                            $('#submit-modal-body').append(div_for_outcomes);
1732
+                            $.each(courses_with_missing_data.outcomes, function(index, info) {
1733
+
1734
+                                if ($("#outcome_ta_for_" + info.typ_semester_outcome_id).length === 0) {
1735
+                                    li_outcome = $("<li>").html(info.outcome_name);
1736
+                                    li_outcome.appendTo($("#list_for_outcomes"));
1737
+                                    ol = $('<ol>', {
1738
+                                        'id': "outcome_ta_for_" + info.typ_semester_outcome_id
1739
+                                    })
1740
+                                    ol.appendTo(li_outcome);
1741
+                                }
1742
+
1743
+                                li = $('<li>').html('<p><strong>' + info.transformative_action_title +
1744
+                                    ': </strong>' + info.transformative_action_description + '</p>');
1745
+                                $('#outcome_ta_for_' + info.typ_semester_outcome_id).append(li);
1746
+
1747
+                            })
1748
+                            // div_for_outcomes.append(ol);
1749
+
1750
+                        }
1751
+                    } else {
1752
+                        button = $('<button>', {
1753
+                            'class': 'btn btn-secondary',
1754
+                            'type': 'button',
1755
+                            'data-dismiss': 'modal'
1756
+                        }).html('Close');
1757
+                        button_for_save = $("<button>", {
1758
+
1759
+                            'class': 'btn btn-primary',
1760
+                            'type': 'button',
1761
+                            'onclick': "postAnnualReport(" + annual_id + ")"
1762
+
1763
+
1764
+                        }).html("Submit Annual Report");
1765
+
1766
+                        $("#submit-modal-title").html("Are you sure you want to submit this report?");
1767
+                        $("#submit-modal-body")
1768
+                            .html(
1769
+                                "You can submit again later, but may need to give explination to administration on why was it resubmitted"
1770
+                            );
1771
+
1772
+                        $('#submit-modal-footer').html(button);
1773
+
1774
+
1775
+                        $("#submit-modal-footer").append(button_for_save);
1776
+
1777
+                    }
1778
+                    $("#submit-modal").modal('toggle');
1779
+
1780
+                }
1781
+
1782
+
1783
+            )
1784
+        }
1785
+
1786
+        function postAnnualReport(annual_id) {
1787
+            $.post(
1788
+                "{{ URL::action('AnnualPlansController@postAnnualReport') }}/" + annual_id, {},
1789
+                function(message) {
1790
+                    if (message = '200') {
1791
+                        $("#submit-modal").modal('toggle');
1792
+                        alert = $('<div/>', {
1793
+                            'class': 'alert alert-success alert-dismissible',
1794
+                            'role': 'alert'
1795
+                        })
1796
+                        button = $('<button/>', {
1797
+                            'type': 'button',
1798
+                            'class': 'close',
1799
+                            'data-dismiss': 'alert',
1800
+                            'alert-label': 'close'
1801
+                        }).html('<span aria-hidden="true">×</span>');
1802
+                        alert.append(button);
1803
+                        alert.append(
1804
+                            '<strong>Report is complete, You can check it out in View Annual Reports or Print Report </strong>'
1805
+                            )
1806
+                        alert.appendTo($("#alert-for-save"));
1807
+                    }
1808
+
1809
+
1810
+
1811
+                });
1812
+        }
1537 1813
     </script>
1538 1814
 
1539 1815
 

+ 294
- 0
app/views/local/managers/shared/print_annual_plan.blade.php View File

@@ -0,0 +1,294 @@
1
+<?php
2
+
3
+echo '<html>';
4
+echo '<body>';
5
+
6
+//Inline styles (only for printing)
7
+echo '<style type="text/css">
8
+    body
9
+    {
10
+        font-family: "Arial", sans-serif;
11
+        width:90%;
12
+        margin: 0 auto;
13
+    }
14
+    .header-text
15
+    {
16
+        text-align:center;
17
+        font-weight: bold;
18
+        margin:0;
19
+    }
20
+    .outcome-text
21
+    {
22
+        text-align:left;
23
+        font-weight: bold;
24
+        margin:0;
25
+    }
26
+    h1.header-text
27
+    {
28
+      margin: 15px auto;
29
+      width:75%;
30
+      font-size: 25px;
31
+    }
32
+
33
+    table
34
+    {
35
+        border-collapse: collapse;
36
+        border: 1px solid black;
37
+        width: 100%;
38
+        margin: 30px auto;
39
+        font-size:1.5vw;
40
+    }
41
+    td, th
42
+    {
43
+        border: 1px solid black;
44
+        padding: 5px;
45
+    }
46
+
47
+    .activity-name-row
48
+    {
49
+      background:black;
50
+      color:white;
51
+    }
52
+
53
+    .activity-headers-row
54
+    {
55
+      background:lightgrey;
56
+      font-weight:bold;
57
+    }
58
+
59
+    .report-info
60
+    {
61
+      margin:5px 0;
62
+      font-size: 16px;
63
+    }
64
+
65
+    .criterion-field
66
+    {
67
+      text-align:left;
68
+    }
69
+
70
+    .score-field, .total, .percentage
71
+    {
72
+      text-align:center;
73
+    }
74
+
75
+    .header
76
+    {
77
+      margin: 30px 0;
78
+    }
79
+
80
+    .content
81
+    {
82
+      font-size: 12px;
83
+    }
84
+
85
+    .logo
86
+    {
87
+      position:absolute;
88
+      right:0;
89
+      top: 30px;
90
+      width: 100px;
91
+    }
92
+
93
+    ul{
94
+      list-style-type:none;
95
+    }
96
+
97
+    @media print{@page {size: landscape}}
98
+
99
+    .outcome-header{
100
+        text-align:left
101
+    }
102
+    hr{
103
+        border-block-color: black
104
+    }
105
+
106
+    .course-title {
107
+      text-align:center;
108
+      font-weight:bold;
109
+    }
110
+</style>';
111
+
112
+echo '<style type="text/css" media="print">
113
+  @page { size: landscape; }
114
+</style>';
115
+
116
+?>
117
+<img class="logo" src="{{ asset('images/logo_uprrp_bw.png') }}" alt="UPRRP Logo">
118
+
119
+<div class="header">
120
+    <p class="header-text">University of Puerto Rico, Río Piedras Campus</p>
121
+    <p class="header-text">Online Learning Assessment System</p>
122
+    <p class="header-text">{{ $annualPlan->program->name }} Program Report</p>
123
+
124
+    <h1 class="header-text">Academic Year {{ $annualPlan->annual_cycle->academic_year }} </h1>
125
+</div>
126
+
127
+@foreach ($annualPlan->outcomes as $outcome)
128
+    <h1 class="outcome-header">{{ $outcome->name }} <sub>(Semester
129
+            {{ Semester::find($outcome->semester_id)->code }})</sub></h1>
130
+    <hr>
131
+    <p class="outcome-text">Target to achieve the learning outcome: {{ $outcome->expected_outcome }} or more of
132
+        the
133
+        attempts</p>
134
+    <p class="outcome-text">Expected percent of students achieving the target by learning outcome:
135
+        {{ $outcome->expected_target }}%
136
+
137
+        <hr>
138
+    <table class="table table-striped table-condensed">
139
+        <thead>
140
+            <tr>
141
+                <th>
142
+                    Objectives for Courses
143
+                </th>
144
+
145
+                <th>
146
+                    Courses and Criteria
147
+                </th>
148
+                <th>
149
+                    Transformative Actions to be Implemented
150
+                </th>
151
+            </tr>
152
+        </thead>
153
+        <tbody>
154
+            @foreach ($outcome->annual_objectives as $index => $objective)
155
+                <tr>
156
+                    <td>
157
+                        {{ $alphabet[$index] }}. {{ $objective->text }}
158
+                    </td>
159
+
160
+                    <td>
161
+                        <ol type="1">
162
+
163
+
164
+                            @foreach ($objective->grouped_annual_course as $index2 => $course_code)
165
+                                <li>
166
+                                    <p>{{ $course_code->code }}-{{ $course_code->number }}</p>
167
+
168
+                                    <ol type="a">
169
+                                        @foreach ($course_code->paired_criteria as $index3 => $criterion)
170
+                                            <li>
171
+                                                {{ $criterion->name }}
172
+                                            </li>
173
+                                        @endforeach
174
+                                    </ol>
175
+
176
+                                    @if (count($objective->grouped_annual_course) > $index2 + 1)
177
+                                        <hr style="margin-left:-40px">
178
+                                    @endif
179
+
180
+
181
+                                </li>
182
+                            @endforeach
183
+                        </ol>
184
+                    </td>
185
+                    <td>
186
+                        <ol type="1">
187
+                            @foreach ($objective->grouped_annual_course as $index2 => $course_code)
188
+                                @if (count($course_code->proposed_transformative_actions) > 0)
189
+                                    <li>
190
+                                        <p>{{ $course_code->code }}-{{ $course_code->number }}</p>
191
+
192
+                                        <ol type="a">
193
+                                            @foreach ($course_code->proposed_transformative_actions as $index3 => $trans)
194
+                                                <li>
195
+                                                    <p><strong>{{ $trans->at_text }}:
196
+                                                        </strong>{{ $trans->description }}</p>
197
+
198
+                                                </li>
199
+                                            @endforeach
200
+                                        </ol>
201
+                                        <hr style="margin-left:-40px">
202
+
203
+                                        @if (count($objective->grouped_annual_course) != $index2 + 1)
204
+                                            <hr style="margin-left:-40px">
205
+                                        @endif
206
+                                @endif
207
+                            @endforeach
208
+                        </ol>
209
+
210
+
211
+                    </td>
212
+
213
+
214
+                </tr>
215
+            @endforeach
216
+
217
+        </tbody>
218
+
219
+    </table>
220
+
221
+    @if (count($outcome->program_transformative_actions) > 0)
222
+        <li>
223
+            <h2>Program Transformative Actions</h2>
224
+            <hr>
225
+
226
+            <table class="table table-striped table-condensed">
227
+                <thead>
228
+                    <tr>
229
+                        <th></th>
230
+                        <th>Transformative Action</th>
231
+                        <th>Category</th>
232
+
233
+
234
+                    </tr>
235
+                </thead>
236
+                <tbody>
237
+                    @foreach ($outcome->program_transformative_actions as $index => $ta)
238
+                        <tr>
239
+                            <td>{{ $index + 1 }}.</td>
240
+                            <td>
241
+                                <strong>{{ $ta->at_text }}: </strong>{{ $ta->description }}
242
+
243
+
244
+                            </td>
245
+                            <td>
246
+                                {{ $ta->type_of_TA }}
247
+                            </td>
248
+
249
+
250
+
251
+
252
+                        </tr>
253
+                    @endforeach
254
+
255
+                </tbody>
256
+            </table>
257
+            <hr>
258
+        </li>
259
+    @endif
260
+@endforeach
261
+
262
+{{-- @foreach ($outcome->program_transformative_actions as $trans)
263
+                                <li>
264
+                                    <h2><strong>{{ $trans->at_text }}: {{ $trans->description }}</strong></h2>
265
+
266
+                                    @if (isset($trans->status))
267
+                                        <p><strong>Results: </strong>{{ $trans->status->results }}</p>
268
+                                        <p><strong>Was this helpful to achieve the learning expectation? </strong>
269
+                                            @if ($trans->status->it_was_useful == 1)
270
+                                                Yes
271
+                                            @else
272
+                                                No
273
+                                            @endif
274
+                                        </p>
275
+                                        <p><strong>Explain briefly details about the implementation: </strong>
276
+                                            {{ $trans->status->comments }}
277
+                                        </p>
278
+                                    @else
279
+                                        <p><strong>Please submit the results </strong>
280
+                                    @endif
281
+
282
+                                </li>
283
+                            @endforeach
284
+                        </ol> --}}
285
+
286
+<?php
287
+
288
+echo '</body>';
289
+echo '</html>';
290
+?>
291
+
292
+<script type="text/javascript">
293
+    window.print();
294
+</script>

+ 487
- 0
app/views/local/managers/shared/print_annual_report.blade.php View File

@@ -0,0 +1,487 @@
1
+<?php
2
+
3
+echo '<html>';
4
+echo '<head>';
5
+echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js"></script>';
6
+echo '</head>';
7
+echo '<body>';
8
+
9
+//Inline styles (only for printing)
10
+echo '<style type="text/css">
11
+    body
12
+    {
13
+        font-family: "Arial", sans-serif;
14
+        width:90%;
15
+        margin: 0 auto;
16
+    }
17
+    .header-text
18
+    {
19
+        text-align:center;
20
+        font-weight: bold;
21
+        margin:0;
22
+    }
23
+    .outcome-text
24
+    {
25
+        text-align:left;
26
+        font-weight: bold;
27
+        margin:0;
28
+    }
29
+    h1.header-text
30
+    {
31
+      margin: 15px auto;
32
+      width:75%;
33
+      font-size: 25px;
34
+    }
35
+
36
+    table
37
+    {
38
+        border-collapse: collapse;
39
+        border: 1px solid black;
40
+        width: 100%;
41
+        margin: 30px auto;
42
+        font-size:1.5vw;
43
+    }
44
+    td, th
45
+    {
46
+        border: 1px solid black;
47
+        padding: 5px;
48
+    }
49
+
50
+    .activity-name-row
51
+    {
52
+      background:black;
53
+      color:white;
54
+    }
55
+
56
+    .activity-headers-row
57
+    {
58
+      background:lightgrey;
59
+      font-weight:bold;
60
+    }
61
+
62
+    .report-info
63
+    {
64
+      margin:5px 0;
65
+      font-size: 16px;
66
+    }
67
+
68
+    .criterion-field
69
+    {
70
+      text-align:left;
71
+    }
72
+
73
+    .score-field, .total, .percentage
74
+    {
75
+      text-align:center;
76
+    }
77
+
78
+    .header
79
+    {
80
+      margin: 30px 0;
81
+    }
82
+
83
+    .content
84
+    {
85
+      font-size: 12px;
86
+    }
87
+
88
+    .logo
89
+    {
90
+      position:absolute;
91
+      right:0;
92
+      top: 30px;
93
+      width: 100px;
94
+    }
95
+
96
+    ul{
97
+      list-style-type:none;
98
+    }
99
+
100
+    @media print{@page {size: landscape}}
101
+
102
+    .outcome-header{
103
+        text-align:left
104
+    }
105
+    hr{
106
+        border-block-color: black
107
+    }
108
+
109
+    .course-title {
110
+      text-align:center;
111
+      font-weight:bold;
112
+    }
113
+</style>';
114
+
115
+echo '<style type="text/css" media="print">
116
+  @page { size: landscape; }
117
+</style>';
118
+
119
+?>
120
+<div id="theEntireDoc">
121
+    <img class="logo" src="{{ asset('images/logo_uprrp_bw.png') }}" alt="UPRRP Logo">
122
+
123
+    <div class="header">
124
+        <p class="header-text">University of Puerto Rico, Río Piedras Campus</p>
125
+        <p class="header-text">Online Learning Assessment System</p>
126
+        <p class="header-text">{{ $annualPlan->program->name }} Program Report</p>
127
+
128
+        <h1 class="header-text">Academic Year {{ $annualPlan->annual_cycle->academic_year }} </h1>
129
+    </div>
130
+
131
+    @foreach ($annualPlan->outcomes as $outcome)
132
+        @if ($outcome->student_performance != 'N/A')
133
+            <h1 class="outcome-header">{{ $outcome->name }} <sub>(Semester
134
+                    {{ Semester::find($outcome->semester_id)->code }})</sub></h1>
135
+            <hr>
136
+            <p class="outcome-text">Target to achieve the learning outcome: {{ $outcome->expected_outcome }} or more
137
+                of
138
+                the
139
+                attempts</p>
140
+            <p class="outcome-text">Expected percent of students achieving the target by learning outcome:
141
+                {{ $outcome->expected_target }}%
142
+            <p class="outcome-text">Results for {{ $outcome->name }}
143
+
144
+                @if ($outcome->student_performance >= $outcome->expected_target)
145
+                    <em style="color: green">{{ $outcome->student_performance }}% </em>
146
+                @else
147
+                    <em style="color: red">{{ $outcome->student_performance }}% </em>
148
+                @endif
149
+
150
+            </p>
151
+            <hr>
152
+            <ol type="I">
153
+                <li>
154
+                    <h2>Courses Assessment</h2>
155
+                    <hr style="border-block-color: black">
156
+
157
+                    <ol type="A">
158
+                        @foreach ($outcome->annual_objectives as $objective)
159
+                            <li>
160
+
161
+                                <h2>{{ $objective->text }}: </h2>
162
+
163
+                                @foreach ($objective->grouped_annual_course as $course_code)
164
+                                    <h2 class="course-title">
165
+                                        {{ $course_code->code }}-{{ $course_code->number }}
166
+                                    </h2>
167
+                                    <h2 class="outcome-text">Performance of Students by Learning Outcome Criteria</h2>
168
+                                    <table class="table table-striped table-condensed">
169
+                                        <thead>
170
+                                            <tr>
171
+                                                <th></th>
172
+                                                <th>Criteria</th>
173
+
174
+                                                <th>Number of Students Assessed</th>
175
+
176
+
177
+                                                <th>Number of Students that Achieved the Target</th>
178
+                                                <th>Percentage</th>
179
+
180
+                                            </tr>
181
+                                        </thead>
182
+                                        <tbody>
183
+                                            @foreach ($course_code->assessed_paired_criteria as $index => $criterion)
184
+                                                <tr>
185
+                                                    <td>{{ $index + 1 }}.</td>
186
+                                                    <td>
187
+                                                        {{ $criterion->name }}
188
+
189
+                                                        @if ($criterion->subcriteria)
190
+                                                            <ul class="list-unstyled">
191
+                                                                @foreach (json_decode($criterion->subcriteria) as $subcriterion)
192
+                                                                    <li>{{ $subcriterion }}</li>
193
+                                                                @endforeach
194
+                                                            </ul>
195
+                                                        @endif
196
+                                                    </td>
197
+                                                    <td>
198
+                                                        {{ $criterion->criteria_attempted }}
199
+                                                    </td>
200
+                                                    <td>
201
+                                                        {{ $criterion->criteria_achieved }}
202
+                                                    </td>
203
+
204
+                                                    <td>
205
+                                                        {{ round(($criterion->criteria_achieved / $criterion->criteria_attempted) * 100, 2) }}%
206
+                                                    </td>
207
+
208
+
209
+                                                </tr>
210
+                                            @endforeach
211
+
212
+                                        </tbody>
213
+                                    </table>
214
+                                    @if (count($course_code->proposed_transformative_actions) > 0)
215
+                                        <h2 class="outcome-text">Follow up on Course's Proposed Transformative Actions
216
+                                        </h2>
217
+                                        <table class="table table-striped table-condensed">
218
+                                            <thead>
219
+                                                <tr>
220
+                                                    <th></th>
221
+                                                    <th>Transformative Actions</th>
222
+
223
+                                                    <th>Was it Implemented on Semester
224
+                                                        {{ Semester::find($outcome->semester_id)->code }} ?</th>
225
+
226
+
227
+                                                    <th>Was this transformative action helpful to achieve the learning
228
+                                                        expectation?</th>
229
+                                                    <th>Explain briefly about the implementation of this transformative
230
+                                                        action
231
+                                                        or why was it not implemented</th>
232
+
233
+                                                </tr>
234
+                                            </thead>
235
+                                            <tbody>
236
+                                                <?php Log::info(json_encode($course_code->proposed_transformative_actions)); ?>
237
+                                                @foreach ($course_code->proposed_transformative_actions as $index => $ta)
238
+                                                    <tr>
239
+                                                        <td>{{ $index + 1 }}.</td>
240
+                                                        <td>
241
+                                                            <strong>{{ $ta->at_text }}: </strong>
242
+                                                            {{ $ta->description }}
243
+
244
+
245
+                                                        </td>
246
+                                                        @if (!isset($ta->status))
247
+                                                            <td>
248
+                                                                Has not been followed up yet (Please follow up)
249
+                                                            </td>
250
+                                                            <td>
251
+                                                                Has not been followed up yet (Please follow up)
252
+                                                            </td>
253
+                                                            <td>
254
+                                                                Has not been followed up yet (Please follow up)
255
+                                                            </td>
256
+                                                        @else
257
+                                                            <td>
258
+                                                                @if ($ta->status->accomplished == 1)
259
+                                                                    Yes
260
+                                                                @else
261
+                                                                    No
262
+                                                                @endif
263
+                                                            </td>
264
+                                                            <td>
265
+                                                                @if ($ta->status->accomplished == 1)
266
+                                                                    @if ($ta->status->it_was_useful == 1)
267
+                                                                        Yes
268
+                                                                    @else
269
+                                                                        No
270
+                                                                    @endif
271
+                                                                @else
272
+                                                                    N/A
273
+                                                                @endif
274
+
275
+                                                            </td>
276
+
277
+                                                            <td>
278
+
279
+                                                                {{ $ta->status->comments }}
280
+                                                            </td>
281
+                                                        @endif
282
+
283
+
284
+                                                    </tr>
285
+                                                @endforeach
286
+
287
+                                            </tbody>
288
+                                        </table>
289
+                                    @endif
290
+                                    @if (count($course_code->future_transformative_actions) > 0)
291
+                                        <h2 class="outcome-text">Future Transformative Actions for Course
292
+                                        </h2>
293
+                                        <table class="table table-striped table-condensed">
294
+                                            <thead>
295
+                                                <tr>
296
+                                                    <th></th>
297
+                                                    <th>Transformative Actions to be Implemented</th>
298
+
299
+                                                    <th>Semesters where the Transformative Action will be Implemented
300
+                                                    </th>
301
+
302
+
303
+
304
+
305
+                                                </tr>
306
+                                            </thead>
307
+                                            <tbody>
308
+
309
+                                                @foreach ($course_code->future_transformative_actions as $index => $ta)
310
+                                                    <tr>
311
+                                                        <td>{{ $index + 1 }}.</td>
312
+                                                        <td>
313
+                                                            <strong>{{ $ta->at_text }}: </strong>
314
+                                                            {{ $ta->description }}
315
+
316
+
317
+                                                        </td>
318
+                                                        <td>
319
+                                                            @foreach ($ta->future_semesters as $semester)
320
+                                                                <p style="display:inline">{{ $semester->code }}, </p>
321
+                                                            @endforeach
322
+                                                        </td>
323
+
324
+
325
+                                                    </tr>
326
+                                                @endforeach
327
+
328
+                                            </tbody>
329
+                                        </table>
330
+                                    @endif
331
+                                    <hr>
332
+                                @endforeach
333
+
334
+
335
+
336
+
337
+                            </li>
338
+                        @endforeach
339
+
340
+
341
+                    </ol>
342
+
343
+
344
+                </li>
345
+
346
+
347
+
348
+                @if (count($outcome->program_transformative_actions) > 0)
349
+                    <li>
350
+                        <h2>Program Transformative Actions</h2>
351
+                        <hr>
352
+
353
+                        <table class="table table-striped table-condensed">
354
+                            <thead>
355
+                                <tr>
356
+                                    <th></th>
357
+                                    <th>Transformative Action</th>
358
+                                    <th>Category</th>
359
+                                    <th>Results</th>
360
+
361
+                                    <th>Was this helpful to achieve the learning expectation?</th>
362
+                                    <th>Explain briefly details about the implementation</th>
363
+
364
+                                </tr>
365
+                            </thead>
366
+                            <tbody>
367
+                                @foreach ($outcome->program_transformative_actions as $index => $ta)
368
+                                    <tr>
369
+                                        <td>{{ $index + 1 }}.</td>
370
+                                        <td>
371
+                                            <strong>{{ $ta->at_text }}: </strong>{{ $ta->description }}
372
+
373
+
374
+                                        </td>
375
+                                        <td>
376
+                                            {{ $ta->type_of_TA }}
377
+                                        </td>
378
+
379
+                                        @if (!isset($ta->status))
380
+                                            <td>Has Not yet submitted</td>
381
+                                            <td>Has Not Yet Submitted</td>
382
+                                            <td>Has Not Yet Submitted</td>
383
+                                        @else
384
+                                            <td>
385
+                                                {{ $ta->status->results }}
386
+                                            </td>
387
+
388
+                                            <td>
389
+                                                @if ($ta->status->it_was_useful == 1)
390
+                                                    Yes
391
+                                                @else
392
+                                                    No
393
+                                                @endif
394
+                                            </td>
395
+                                            <td>
396
+                                                {{ $ta->status->comments }}
397
+                                            </td>
398
+                                        @endif
399
+
400
+
401
+                                    </tr>
402
+                                @endforeach
403
+
404
+                            </tbody>
405
+                        </table>
406
+                        <hr>
407
+                    </li>
408
+                @endif
409
+
410
+                @if (count($outcome->comments) > 0)
411
+                    <li>
412
+                        <h2>Comments</h2>
413
+                        <hr>
414
+                        <table class='table table-striped table-condensed'>
415
+                            <tbody>
416
+                                @foreach ($outcome->comments as $index => $comment)
417
+                                    <tr>
418
+                                        <td>
419
+                                            {{ $index + 1 }}.
420
+                                        </td>
421
+                                        <td>
422
+                                            {{ $comment->comments }}
423
+                                        </td>
424
+                                    </tr>
425
+                                @endforeach
426
+                            </tbody>
427
+                        </table>
428
+
429
+                    </li>
430
+                @endif
431
+            </ol>
432
+        @else
433
+            <h1 class="outcome-header">{{ $outcome->name }} <sub>(Semester
434
+                    {{ Semester::find($outcome->semester_id)->code }})</sub></h1>
435
+            <hr>
436
+            <p class="outcome-text">Target to achieve the learning outcome: {{ $outcome->expected_outcome }} or
437
+                more of
438
+                the
439
+                attempts</p>
440
+            <p class="outcome-text">Expected percent of students achieving the target by learning outcome:
441
+                {{ $outcome->expected_target }}%
442
+            <p class="outcome-text">Results for {{ $outcome->name }}
443
+
444
+
445
+                <em style="color: red">{{ $outcome->student_performance }} </em>
446
+
447
+
448
+            </p>
449
+            <p class="outcome-text" style="color: red">No student has been assessed in this outcome</p>
450
+            <hr>
451
+        @endif
452
+    @endforeach
453
+</div>
454
+
455
+{{-- @foreach ($outcome->program_transformative_actions as $trans)
456
+                                <li>
457
+                                    <h2><strong>{{ $trans->at_text }}: {{ $trans->description }}</strong></h2>
458
+
459
+                                    @if (isset($trans->status))
460
+                                        <p><strong>Results: </strong>{{ $trans->status->results }}</p>
461
+                                        <p><strong>Was this helpful to achieve the learning expectation? </strong>
462
+                                            @if ($trans->status->it_was_useful == 1)
463
+                                                Yes
464
+                                            @else
465
+                                                No
466
+                                            @endif
467
+                                        </p>
468
+                                        <p><strong>Explain briefly details about the implementation: </strong>
469
+                                            {{ $trans->status->comments }}
470
+                                        </p>
471
+                                    @else
472
+                                        <p><strong>Please submit the results </strong>
473
+                                    @endif
474
+
475
+                                </li>
476
+                            @endforeach
477
+                        </ol> --}}
478
+
479
+<?php
480
+
481
+echo '</body>';
482
+echo '</html>';
483
+?>
484
+
485
+<script type="text/javascript">
486
+    window.print();
487
+</script>

+ 27
- 26
app/views/local/professors/compare_activities.blade.php View File

@@ -567,6 +567,8 @@
567 567
         </div>
568 568
     </div>
569 569
 
570
+  
571
+
570 572
 @stop
571 573
 @section('included-js')
572 574
     @include('global._datatables_js')
@@ -613,8 +615,7 @@
613 615
     step: 1,
614 616
     useHTML: true,
615 617
     formatter: function() {
616
-    return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">' +
617
-        this.value + '</div>';
618
+    return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">' +this.value + '</div>';
618 619
     },
619 620
     }
620 621
     },
@@ -643,12 +644,12 @@
643 644
     },
644 645
 
645 646
     tooltip: {
646
-    headerFormat: '<span style="font-size:10px">{point.key}</span>
647
-    <table> ',
648
-        pointFormat: '<tr>
649
-            <td style="color:{series.color};padding:0"> {series.name}: </td>' +
650
-            '<td style="padding:0"><b>{point.y:.2f}%</b></td>
651
-        </tr>',
647
+    headerFormat: '<span style="font-size:10px">{point.key}</span>'+
648
+    '<table> ',
649
+        pointFormat: '<tr>'+
650
+            '<td style="color:{series.color};padding:0"> {series.name}: </td>' +
651
+            '<td style="padding:0"><b>{point.y:.2f}%</b></td>'+
652
+        '</tr>',
652 653
         footerFormat: '</table>',
653 654
     shared: true,
654 655
     useHTML: true
@@ -753,12 +754,12 @@
753 754
     },
754 755
 
755 756
     tooltip: {
756
-    headerFormat: '<span style="font-size:10px">{point.key}</span>
757
-    <table> ',
758
-        pointFormat: '<tr>
759
-            <td style="color:{series.color};padding:0"> {series.name}: </td>' +
760
-            '<td style="padding:0"><b>{point.y:.2f}%</b></td>
761
-        </tr>',
757
+    headerFormat: '<span style="font-size:10px">{point.key}</span>'+
758
+    '<table> ',
759
+        pointFormat: '<tr>'+
760
+            '<td style="color:{series.color};padding:0"> {series.name}: </td>' +
761
+            '<td style="padding:0"><b>{point.y:.2f}%</b></td>'+
762
+        '</tr>',
762 763
         footerFormat: '</table>',
763 764
     shared: true,
764 765
     useHTML: true
@@ -839,12 +840,12 @@
839 840
     }
840 841
     },
841 842
     tooltip: {
842
-    headerFormat: '<span style="font-size:10px">{point.key}</span>
843
-    <table> ',
844
-        pointFormat: '<tr>
845
-            <td style="color:{series.color};padding:0"> {series.name}: </td>' +
846
-            '<td style="padding:0"><b>{point.y:.2f}</b></td>
847
-        </tr>',
843
+    headerFormat: '<span style="font-size:10px">{point.key}</span>'+
844
+    '<table> ',
845
+        pointFormat: '<tr>'+
846
+            '<td style="color:{series.color};padding:0"> {series.name}: </td>' +
847
+            '<td style="padding:0"><b>{point.y:.2f}</b></td>'+
848
+        '</tr>',
848 849
         footerFormat: '</table>',
849 850
     shared: true,
850 851
     useHTML: true
@@ -944,12 +945,12 @@
944 945
     }
945 946
     },
946 947
     tooltip: {
947
-    headerFormat: '<span style="font-size:10px">{point.key}</span>
948
-    <table> ',
949
-        pointFormat: '<tr>
950
-            <td style="color:{series.color};padding:0"> {series.name}: </td>' +
951
-            '<td style="padding:0"><b>{point.y:.2f}</b></td>
952
-        </tr>',
948
+    headerFormat: '<span style="font-size:10px">{point.key}</span>'+
949
+    '<table> ',
950
+        pointFormat: '<tr>'+
951
+            '<td style="color:{series.color};padding:0"> {series.name}: </td>' +
952
+            '<td style="padding:0"><b>{point.y:.2f}</b></td>'+
953
+        '</tr>',
953 954
         footerFormat: '</table>',
954 955
     shared: true,
955 956
     useHTML: true