parent
commit
4bfe1d010a

+ 3
- 3
app/controllers/CriteriaController.php View File

@@ -18,7 +18,7 @@ class CriteriaController extends \BaseController
18 18
         $userProgram = DB::select("select program_user.program_id from program_user where user_id = {$userProgram}");
19 19
         Log::info($userProgram);
20 20
         $title = "Criteria";
21
-        $outcomes = Outcome::where("deactivation_date", '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
21
+        $outcomes = Outcome::whereNull("deactivation_date")->orderBy('name', 'ASC')->lists('name', 'id');
22 22
 
23 23
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
24 24
         $programs = Program::where("id", "=", $userProgram[0]->program_id)->get();
@@ -30,7 +30,7 @@ class CriteriaController extends \BaseController
30 30
         $userSchool = Auth::user()['school_id'];
31 31
         Log::info($userSchool);
32 32
         $title = "Criteria";
33
-        $outcomes = Outcome::where("deactivation_date", '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
33
+        $outcomes = Outcome::whereNull("deactivation_date")->orderBy('name', 'ASC')->lists('name', 'id');
34 34
 
35 35
         $schools = School::find($userSchool)->get();
36 36
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
@@ -454,7 +454,7 @@ class CriteriaController extends \BaseController
454 454
     public function edit()
455 455
     {
456 456
         $title = "Criteria";
457
-        $outcomes = Outcome::where("deactivation_date", '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
457
+        $outcomes = Outcome::whereNull("deactivation_date")->orderBy('name', 'ASC')->lists('name', 'id');
458 458
 
459 459
         $schools = School::orderBy('name', 'ASC')->get();
460 460
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();

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

@@ -11,16 +11,6 @@ class Objective2Controller extends \BaseController
11 11
 	 * @return Response
12 12
 	 */
13 13
 
14
-	public function index()
15
-	{
16
-
17
-		$title = "Learning Outcomes and Criteria";
18
-		$outcomes = Outcome::orderBy('name', 'ASC')->get();
19
-		$schools = School::orderBy('name', 'ASC')->get();
20
-		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
21
-
22
-		return View::make('global.view-learning-outcomes-criteria', compact('title', 'outcomes', 'schools', 'objectives'));
23
-	}
24 14
 
25 15
 
26 16
 
@@ -304,7 +294,7 @@ class Objective2Controller extends \BaseController
304 294
 	public function edit()
305 295
 	{
306 296
 		$title = "Objective";
307
-		$outcomes = Outcome::where('deactivation_date', '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
297
+		$outcomes = Outcome::whereNull("deactivation_date")->orderBy('name', 'ASC')->lists('name', 'id');
308 298
 
309 299
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
310 300
 		$programs = Program::orderBy('name', 'ASC')->get();
@@ -320,7 +310,7 @@ class Objective2Controller extends \BaseController
320 310
 		$userProgram = DB::select("select program_user.program_id from program_user where user_id = {$userProgram}");
321 311
 
322 312
 		$title = "Objective";
323
-		$outcomes = Outcome::where('deactivation_date', '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
313
+		$outcomes = Outcome::whereNull("deactivation_date")->orderBy('name', 'ASC')->lists('name', 'id');
324 314
 
325 315
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
326 316
 
@@ -337,7 +327,7 @@ class Objective2Controller extends \BaseController
337 327
 		$userSchool = Auth::user()['school_id'];
338 328
 		Log::info($userSchool);
339 329
 		$title = "Objective";
340
-		$outcomes = Outcome::where('deactivation_date', '=', null)->orderBy('name', 'ASC')->lists('name', 'id');
330
+		$outcomes = Outcome::whereNull("deactivation_date")->orderBy('name', 'ASC')->lists('name', 'id');
341 331
 
342 332
 		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
343 333
 		$programs = Program::where("school_id", "=", $userSchool)->orderBy('name', 'ASC')->get();

+ 64
- 50
app/controllers/ProfessorsController.php View File

@@ -3,79 +3,96 @@
3 3
 class ProfessorsController extends \BaseController
4 4
 {
5 5
 
6
-	private $grouped_courses;
6
+    private $grouped_courses;
7 7
 
8
-	public function __construct()
8
+    public function __construct()
9 9
     {
10 10
         $this->courses = Auth::user()->courses;
11 11
     }
12 12
 
13
-	public function overview()
14
-	{
15
-        $title='My Courses';
13
+    public function overview()
14
+    {
15
+        $title = 'My Courses';
16 16
         $grouped_courses = Course::where('user_id', Auth::user()->id)->whereIn('semester_id', Session::get('semesters_ids'))->groupBy(array('code', 'number', 'semester_id'))->get();
17
-        $outcomes = Outcome::orderBy('name', 'asc')->get();
18
-        $outcomeCount = Outcome::all()->count();
17
+        $semesters = Session::get('semesters_ids');
18
+        $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
19
+        Log::info($semesters->start);
20
+        $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))
21
+            ->whereNull('deleted_at')
22
+            ->whereRaw("(deactivation_date IS NULL or deactivation_date >= '{$semesters->start}')")
23
+            ->orderBy('name', 'ASC')->get();
24
+        $outcomeCount = count($outcomes);
19 25
 
20 26
 
21 27
         $grouped_outcomes_achieved_results = array();
22 28
         $grouped_outcomes_attempted_results = array();
23 29
         $grouped_sections = array();
24 30
 
25
-        foreach ($grouped_courses as $index => $grouped_course)
26
-        {
31
+        foreach ($grouped_courses as $index => $grouped_course) {
27 32
             // Blank outcomes for one course
28
-            $outcomes_achieved = array_fill(1, $outcomeCount, 0);
29
-            $outcomes_attempted = array_fill(1, $outcomeCount, 0);
33
+
34
+            //$outcomes_achieved = array_fill(1, $outcomeCount, 0);
35
+            //$outcomes_attempted = array_fill(1, $outcomeCount, 0);
36
+
37
+            $outcomes_achieved = [];
38
+            $outcomes_attempted = [];
30 39
 
31 40
             // Find sections belonging to user with identifier of one course
32
-            $sections = Course::where('user_id', Auth::user()->id)->where('code', $grouped_course->code)->whereIn('semester_id', Session::get('semesters_ids'))->where('number', $grouped_course->number)->where('semester_id', $grouped_course->semester_id)->get();
41
+            $sections = Course::where('user_id', Auth::user()->id)
42
+                ->where('code', $grouped_course->code)
43
+                ->whereIn('semester_id', Session::get('semesters_ids'))
44
+                ->where('number', $grouped_course->number)
45
+                ->where('semester_id', $grouped_course->semester_id)
46
+                ->get();
33 47
 
34 48
             // For each of the professor's course sections, add the attempted and achieved criteria per outcome
35
-            foreach ($sections as $section)
36
-            {
37
-                if($section->outcomes_achieved!=NULL)
38
-                {
39
-                    $section_outcomes_achieved =json_decode($section->outcomes_achieved, true);
40
-                    $section_outcomes_attempted =json_decode($section->outcomes_attempted, true);
41
-                    for($i=1; $i<=count($outcomes_attempted); $i++)
42
-                    {
43
-                        $outcomes_achieved[$i]+=$section_outcomes_achieved[$i];
44
-                        $outcomes_attempted[$i]+=$section_outcomes_attempted[$i];
49
+            foreach ($sections as $section) {
50
+
51
+                $section_outcomes_achieved = $section->outcomes_ach();
52
+                $section_outcomes_attempted = $section->outcomes_att();
53
+
54
+                //if ($section->outcomes_achieved != NULL) {
55
+                if (!empty($section_outcomes_achieved)) {
56
+                    //$section_outcomes_achieved = json_decode($section->outcomes_achieved, true);
57
+                    //$section_outcomes_attempted = json_decode($section->outcomes_attempted, true);
58
+                    foreach ($section_outcomes_attempted as $outcome_id => $score) {
59
+
60
+                        if (array_key_exists($outcome_id, $outcomes_achieved)) $outcomes_achieved[$outcome_id] += $section_outcomes_achieved[$outcome_id];
61
+                        else $outcomes_achieved[$outcome_id] = $section_outcomes_achieved[$outcome_id];
62
+                        if (array_key_exists($outcome_id, $outcomes_attempted)) $outcomes_attempted[$outcome_id] +=  $section_outcomes_attempted[$outcome_id];
63
+                        else $outcomes_attempted[$outcome_id] =  $section_outcomes_attempted[$outcome_id];
64
+                        //$outcomes_achieved[$outcome_id] += $section_outcomes_achieved[$outcome_id];
65
+                        //$outcomes_attempted[$outcome_id] += $section_outcomes_attempted[$outcome_id];
45 66
                     }
46 67
                 }
47 68
             }
48 69
 
49
-            $grouped_outcomes_achieved_results[]=$outcomes_achieved;
50
-            $grouped_outcomes_attempted_results[]=$outcomes_attempted;
70
+            $grouped_outcomes_achieved_results[] = $outcomes_achieved;
71
+            $grouped_outcomes_attempted_results[] = $outcomes_attempted;
51 72
             $grouped_sections[] = $sections;
52
-
53 73
         }
54 74
 
55
-		return View::make('local.professors.overview', compact('title', 'grouped_courses', 'outcomes', 'grouped_outcomes_attempted_results', 'grouped_outcomes_achieved_results', 'grouped_sections'));
56
-	}
75
+        return View::make('local.professors.overview', compact('title', 'grouped_courses', 'outcomes', 'grouped_outcomes_attempted_results', 'grouped_outcomes_achieved_results', 'grouped_sections'));
76
+    }
57 77
 
58 78
     public function program()
59 79
     {
60 80
         $program =  Auth::user()->programs[0];
61
-        $title='Your Program: '.$program->name;
62
-        $program_courses = Course::where('program_id','=', $program->id)->whereIn('semester_id', Session::get('semesters_ids'))->get();
81
+        $title = 'Your Program: ' . $program->name;
82
+        $program_courses = Course::where('program_id', '=', $program->id)->whereIn('semester_id', Session::get('semesters_ids'))->get();
63 83
         $outcomes = Outcome::orderBy('name', 'asc')->get();
64 84
         $outcomeCount = Outcome::all()->count();
65 85
 
66 86
         $outcomes_achieved = array_fill(1, $outcomeCount, 0);
67 87
         $outcomes_attempted = array_fill(1, $outcomeCount, 0);
68 88
 
69
-        foreach ($program_courses as $course)
70
-        {
71
-            if($course->outcomes_achieved!=NULL)
72
-            {
73
-                $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
74
-                $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
75
-                for($i=1; $i<=count($outcomes_attempted); $i++)
76
-                {
77
-                    $outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
78
-                    $outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
89
+        foreach ($program_courses as $course) {
90
+            if ($course->outcomes_achieved != NULL) {
91
+                $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
92
+                $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
93
+                for ($i = 1; $i <= count($outcomes_attempted); $i++) {
94
+                    $outcomes_achieved[$i] += $course_outcomes_achieved[$i];
95
+                    $outcomes_attempted[$i] += $course_outcomes_attempted[$i];
79 96
                 }
80 97
             }
81 98
         }
@@ -84,8 +101,7 @@ class ProfessorsController extends \BaseController
84 101
         $scoords = User::where('school_id', $program->school_id)
85 102
             ->where('role', 2)
86 103
             ->get();
87
-        $pcoords = User::
88
-            select('users.*')
104
+        $pcoords = User::select('users.*')
89 105
             ->join('program_user', 'users.id', '=', 'program_user.user_id')
90 106
             ->where('role', 3)
91 107
             ->where('program_id', $program->id)
@@ -95,28 +111,26 @@ class ProfessorsController extends \BaseController
95 111
     }
96 112
 
97 113
 
98
-    public function generalStudiesOverview(){
114
+    public function generalStudiesOverview()
115
+    {
99 116
 
100
-        $title='General Component Assessment Overview';
117
+        $title = 'General Component Assessment Overview';
101 118
 
102
-        try{
119
+        try {
103 120
             $programs = Program::generalComponentPrograms();
104
-        }
105
-        catch(Exception $e){
121
+        } catch (Exception $e) {
106 122
             dd('Unable to find general component programs');
107 123
         }
108 124
 
109 125
         $outcomes = Outcome::orderBy('name', 'asc')->get();
110 126
         $schools = School::all();
111 127
         $program_packs = array();
112
-        if(!$programs->isEmpty()){
128
+        if (!$programs->isEmpty()) {
113 129
             foreach ($programs as $program) {
114
-                $program_packs[]= $program->assessmentOverview();
130
+                $program_packs[] = $program->assessmentOverview();
115 131
             }
116 132
         }
117 133
 
118 134
         return View::make('local.managers.shared.general_studies_overview', compact('title', 'outcomes', 'schools', 'program_packs'));
119
-
120
-
121 135
     }
122 136
 }

+ 10
- 2
app/controllers/ProgramCoordinatorsController.php View File

@@ -22,8 +22,16 @@ class ProgramCoordinatorsController extends \BaseController
22 22
 
23 23
     $programs = Auth::user()->programs;
24 24
 
25
-    $outcomes = Outcome::orderBy('name', 'asc')->get();
26
-    $outcomeCount = Outcome::all()->count();
25
+    //$outcomes = Outcome::orderBy('name', 'asc')->get();
26
+
27
+    $semesters = Session::get('semesters_ids');
28
+    $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
29
+    Log::info($semesters->start);
30
+    $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))
31
+      ->whereNull('deleted_at')
32
+      ->whereRaw("(deactivation_date IS NULL or deactivation_date >= '{$semesters->start}')")
33
+      ->orderBy('name', 'ASC')->get();
34
+    $outcomeCount = count($outcomes);
27 35
 
28 36
     $programs_array = array();
29 37
     $programs_contact = array();

+ 47
- 0
app/controllers/ThreeYearPlanController.php View File

@@ -602,4 +602,51 @@ class ThreeYearPlanController extends \BaseController
602 602
       $yearStartPlusOne++;
603 603
     }
604 604
   }
605
+
606
+  public function print($program_id, $typ)
607
+  {
608
+
609
+    $program = DB::table('programs')->where('id', $program_id)->first();
610
+    $three_year_plan = DB::table('three_year_plan')->where('id', $typ)->first();
611
+
612
+    $typ_program_id = DB::table('typ_program')->where('three_year_plan_id', $three_year_plan->id)
613
+      ->where('program_id', $program->id)
614
+      ->first()->id;
615
+
616
+    $typ_semesters = DB::table('semesters')
617
+      ->join('typ_semesters', 'semesters.id', '=', 'typ_semesters.semester_id')
618
+      ->where('typ_id', $three_year_plan->id)
619
+      ->orderBy('semester_id')
620
+      ->get();
621
+
622
+
623
+    foreach ($typ_semesters as $semester) {
624
+      $typ_semester_outcome[$semester->semester_id] = DB::table('typ_semester_outcome')
625
+        ->join('outcomes', 'outcomes.id', '=', 'typ_semester_outcome.outcome_id')
626
+        ->where('typ_program_id', $typ_program_id)
627
+        ->where('semester_id', $semester->semester_id)
628
+        ->select('typ_semester_outcome.id as typ_id')
629
+        ->addSelect('outcomes.id as outcome_id', 'outcomes.name')
630
+        ->get();
631
+
632
+      foreach ($typ_semester_outcome[$semester->semester_id] as $outcome) {
633
+        $outcome->objectives = DB::table('typ_semester_objectives')
634
+          ->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
635
+          ->where('typ_semester_outcome_id', $outcome->typ_id)
636
+          ->select('typ_semester_objectives.id as typ_obj_id')
637
+          ->addSelect('objectives.text', 'objectives.id as objective_id')
638
+          ->get();
639
+        foreach ($outcome->objectives as $objective) {
640
+          $objective->courses = DB::table('typ_semester_courses')
641
+            ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
642
+            ->where('typ_semester_objective_id', $objective->typ_obj_id)
643
+            ->get();
644
+        }
645
+      }
646
+    }
647
+    Log::info($typ_semester_outcome);
648
+
649
+
650
+    return View::make('global.print_three_year_plan', compact('typ_semesters', 'program', 'three_year_plan', 'typ_semesters', 'typ_semester_outcome'));
651
+  }
605 652
 }

+ 120
- 0
app/controllers/TransformativeActionsController.php View File

@@ -1,6 +1,7 @@
1 1
 <?php
2 2
 
3 3
 use Illuminate\Support\Facades\Input;
4
+use Illuminate\Support\Facades\Session;
4 5
 
5 6
 class TransformativeActionsController extends \BaseController
6 7
 {
@@ -1160,4 +1161,123 @@ class TransformativeActionsController extends \BaseController
1160 1161
       return Redirect::to("professor/activities/{$activity_id}");
1161 1162
     }
1162 1163
   }
1164
+
1165
+  public function viewFormativeActions()
1166
+  {
1167
+    $title = "Formative Actions";
1168
+    $semesters = Session::get('semesters_ids');
1169
+    $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
1170
+    Log::info($semesters->start);
1171
+    $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))
1172
+      ->whereNull('deleted_at')
1173
+      ->whereRaw("(deactivation_date IS NULL or deactivation_date >= '{$semesters->start}')")
1174
+      ->orderBy('name', 'ASC')->get();
1175
+    $semesters = DB::table('semesters')->where('is_visible', 1)->orderBy('end', 'DESC')->get();
1176
+    $role = Auth::user()->role;
1177
+    switch ($role) {
1178
+      case 1:
1179
+        $schools = DB::table('schools')->get();
1180
+        $programs = DB::table('programs')->get();
1181
+        break;
1182
+
1183
+      case 2:
1184
+        $schools = DB::table('schools')->where('id', Auth::user()->school_id)->first();
1185
+        $programs = DB::table('programs')->where('school_id', $schools->id)->get();
1186
+        break;
1187
+      case 3:
1188
+        $programs = DB::table('programs')
1189
+          ->join('program_user', 'programs.id', '=', 'program_user.program_id')
1190
+          ->where('user_id', Auth::user()->id)
1191
+          ->select('programs.*')
1192
+          ->get();
1193
+        $schools = DB::table('schools')->where('id', $programs[0]->school_id)->get();
1194
+        break;
1195
+    }
1196
+    return View::make('local.managers.shared.view_formative', compact('title', 'outcomes', 'schools', 'programs', 'semesters'));
1197
+  }
1198
+
1199
+  public function fetchCourses()
1200
+  {
1201
+
1202
+    $school = Input::get('schools');
1203
+
1204
+    $programs = Input::get('programs');
1205
+    $semesters = Input::get('semesters');
1206
+    $outcome_id = Input::get('id');
1207
+
1208
+    Log::info($programs);
1209
+    Log::info($semesters);
1210
+
1211
+
1212
+    if (in_array(0, $semesters)) {
1213
+      $semesters = DB::table('semesters')->where('is_visible', 1)->lists('id');
1214
+    }
1215
+
1216
+    if (in_array(0, $programs)) {
1217
+
1218
+      $role = Auth::user()->role;
1219
+
1220
+      switch ($role) {
1221
+        case 1:
1222
+          $programs = DB::table('programs')->lists('id');
1223
+          break;
1224
+        case 2:
1225
+          $programs = DB::table('programs')->where('school_id', Auth::user()->school_id)->lists('id');
1226
+          break;
1227
+        case 3:
1228
+          $programs = DB::table('program_user')->where('user_id', Auth::user()->id)->lists('program_id');
1229
+          break;
1230
+      }
1231
+    }
1232
+
1233
+    $grouped_courses = DB::table('courses')
1234
+      ->whereIn('program_id', $programs)
1235
+      ->whereIn('semester_id', $semesters)
1236
+      ->join('activities', 'activities.course_id', '=', 'courses.id')
1237
+      ->select('courses.*')
1238
+      ->groupBy(array('courses.code', 'courses.name', 'courses.semester_id'))
1239
+      ->get();
1240
+
1241
+
1242
+
1243
+    foreach ($grouped_courses as $course_name) {
1244
+      $course_name->sections = DB::table('courses')
1245
+        ->where('code', $course_name->code)
1246
+        ->where('name', $course_name->name)
1247
+        ->where('semester_id', $course_name->semester)
1248
+        ->where('program_id', $course_name->program_id)
1249
+        ->get();
1250
+      foreach ($course_name->sections as $section) {
1251
+
1252
+        $section->activities = DB::table('activities')
1253
+          ->join('activity_criterion', 'activities.id', '=', 'activity_criterion.activity_id')
1254
+          ->join('transformative_activity_criterion', 'transformative_activity_criterion.activity_criterion_id', '=', 'activity_criterion.id')
1255
+          ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
1256
+          ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
1257
+          ->where('activities.course_id', $section->id)
1258
+          ->where('criterion_objective_outcome.outcome_id', $outcome_id)
1259
+          ->select('activities.id as activity_id', 'activities.name')
1260
+          ->addSelect('transformative_actions.*', 'transformative_activity_criterion.trans_action_id as trans_action_id')
1261
+          ->groupBy('transformative_actions.id')
1262
+          ->get();
1263
+        foreach ($section->activities as $activity) {
1264
+          $activity->objectives = DB::table('transformative_objective')
1265
+            ->join('objectives', 'transformative_objective.objective_id', '=', 'objectives.id')
1266
+            ->where('ta_id', $activity->trans_action_id)
1267
+            ->get();
1268
+          foreach ($activity->objectives as $objective) {
1269
+            $objective->criterion = DB::table('criterion_objective_outcome')
1270
+              ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
1271
+              ->join('criteria', 'criteria.id', '=', 'activity_criterion.criteria_id')
1272
+              ->where('activity_criterion.activity_id', $activity->activity_id)
1273
+              ->where('objective_id', $objective->objective_id)
1274
+              ->select('criteria.*')
1275
+              ->distinct()
1276
+              ->get();
1277
+          }
1278
+        }
1279
+      }
1280
+    }
1281
+    Log::info($grouped_courses);
1282
+  }
1163 1283
 }

+ 80
- 2
app/models/Course.php View File

@@ -59,6 +59,84 @@ class Course extends Eloquent
59 59
     //   	SELECT distinct cr.outcome_id FROM  courses c, activities a, activity_criterion ac, criteria cr WHERE c.id=a.course_id and a.id=ac.activity_id and ac.criterion_id=cr.id and c.id=1
60 60
     // 	return $this->id;
61 61
   }
62
+  public function outcomes_att()
63
+  {
64
+    $criteria_attempted = DB::table('courses')
65
+      ->join('activities', 'activities.course_id', '=', 'courses.id')
66
+      ->join('activity_criterion', 'activities.id', '=', 'activity_criterion.activity_id')
67
+      ->select('criterion_id', 'activity_criterion.id as activity_criterion_id')
68
+      ->where('courses.id', $this->id)
69
+      ->where('draft', 0)
70
+      ->get();
71
+
72
+    // Old data was formed like { "outcome1": cuantity_of_criteria_associated, "outcome2":cuantity_of_criteria}
73
+    $outcomes_attempted = [];
74
+
75
+
76
+
77
+    foreach ($criteria_attempted as $criterion) {
78
+      $outcomes = DB::table('criterion_objective_outcome')
79
+        ->where('criterion_id', $criterion->criterion_id)
80
+        ->select('outcome_id')
81
+        ->distinct()
82
+        ->lists('outcome_id');
83
+
84
+      foreach ($outcomes as $outcome_id) {
85
+        if (array_key_exists($outcome_id, $outcomes_attempted)) $outcomes_attempted[$outcome_id] += 1;
86
+        else $outcomes_attempted[$outcome_id] = 1;
87
+      }
88
+    }
89
+
90
+    return $outcomes_attempted;
91
+  }
92
+
93
+  public function outcomes_ach()
94
+  {
95
+    $criteria = DB::table('criteria')
96
+      ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
97
+      ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
98
+      ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
99
+      ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
100
+      ->join('courses', 'activities.course_id', '=', 'courses.id')
101
+      ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
102
+      ->where('courses.id', '=', $this->id)
103
+      ->where('activities.draft', 0)
104
+      ->select(
105
+        'criteria.id',
106
+        'rubrics.expected_percentage as expected_percentage_students_achieving'/*'expected_percentage_students_achieving',*/,
107
+        'activity_criterion.activity_id'
108
+      )
109
+      ->distinct()
110
+      ->get();
111
+    // Old data was formed like { "outcome1": cuantity_of_criteria_associated_passed, "outcome2":cuantity_of_criteria}
112
+
113
+    $outcomes_achieved = [];
114
+
115
+    foreach ($criteria as $criterion) {
116
+      $students_attempted = Criterion::students_attempted($criterion->id, $criterion->activity_id);
117
+      $students_achieved = Criterion::students_achieved($criterion->id, $criterion->activity_id);
118
+
119
+      if ($students_attempted) {
120
+        $percentage_students_who_achieved = 100.0 * $students_achieved / $students_attempted;
121
+      } else {
122
+        $percentage_students_who_achieved = 0;
123
+      }
124
+      if ($percentage_students_who_achieved >= $criterion->expected_percentage_students_achieving) {
125
+        $outcomes = DB::table('criterion_objective_outcome')
126
+          ->where('criterion_id', $criterion->id)
127
+          ->select('outcome_id')
128
+          ->distinct()
129
+          ->lists('outcome_id');
130
+        foreach ($outcomes as $outcome_id) {
131
+          if (array_key_exists($outcome_id, $outcomes_achieved)) $outcomes_achieved[$outcome_id] += 1;
132
+          else $outcomes_achieved[$outcome_id] = 1;
133
+        }
134
+      }
135
+    }
136
+    return $outcomes_achieved;
137
+  }
138
+
139
+
62 140
 
63 141
   public function outcomes_achieved()
64 142
   {
@@ -66,13 +144,13 @@ class Course extends Eloquent
66 144
       ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
67 145
       ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
68 146
       ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
69
-      ->join('rubric', 'rubric.id', '=', 'rubric_activity.rubric_id')
147
+      ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
70 148
       ->join('courses', 'activities.course_id', '=', 'courses.id')
71 149
       ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
72 150
       ->where('courses.id', '=', $this->id)
73 151
       ->select(
74 152
         'criteria.id',
75
-        'rubric.expected_percentage as expected_percentage_students_achieving'/*'expected_percentage_students_achieving',*/,
153
+        'rubrics.expected_percentage as expected_percentage_students_achieving'/*'expected_percentage_students_achieving',*/,
76 154
         'activity_criterion.activity_id'
77 155
       )
78 156
       ->distinct()

+ 13
- 0
app/routes.php View File

@@ -178,6 +178,10 @@ Route::group(array('before' => 'auth|has_access'), function () {
178 178
         'as' => 'createThreeYearCycle',
179 179
         'uses' => 'ThreeYearPlanController@create'
180 180
     ));
181
+    Route::get('printThreeYear/{program_id}/{typ}', array(
182
+        'as' => 'printThreeYear/{program_id}/{typ}',
183
+        'uses' => 'ThreeYearPlanController@print'
184
+    ));
181 185
     // Fetch all criteria associated to an outcome
182 186
     Route::post('fetchInfo', array(
183 187
         'as' => 'fetchInfo',
@@ -191,6 +195,10 @@ Route::group(array('before' => 'auth|has_access'), function () {
191 195
         'as' => 'fetchCriterionWithTemplate',
192 196
         'uses' => 'CriteriaController@fetchCriterionWithTemplate'
193 197
     ));
198
+    Route::post('fetchFormative', array(
199
+        'as' => 'fetchFormative',
200
+        'uses' => 'TransformativeActionsController@fetchCourses'
201
+    ));
194 202
 
195 203
     // Fetch a criterion for a rubric
196 204
     Route::post('fetchCriterion', array(
@@ -207,6 +215,11 @@ Route::group(array('before' => 'auth|has_access'), function () {
207 215
         'uses' => 'CriteriaController@delete'
208 216
     ));
209 217
 
218
+    Route::get('viewFormative', array(
219
+        'as' => 'viewFormative',
220
+        'uses' => 'TransformativeActionsController@viewFormativeActions'
221
+    ));
222
+
210 223
 
211 224
     Route::post('delete', array(
212 225
         'as' => 'delete',

+ 167
- 0
app/views/global/print_three_year_plan.blade.php View File

@@ -0,0 +1,167 @@
1
+<?php
2
+
3
+echo '<html>';
4
+echo '<body>';
5
+
6
+//Inline styles (only for printing)
7
+echo
8
+'<style type="text/css">
9
+    body
10
+    {
11
+        font-family: "Arial", sans-serif;
12
+        width:90%;
13
+        margin: 0 auto;
14
+    }
15
+    .header-text
16
+    {
17
+        text-align:center;
18
+        font-weight: bold;
19
+        margin:0;
20
+    }
21
+
22
+    h1.header-text
23
+    {
24
+      margin: 15px auto;
25
+      width:75%;
26
+      font-size: 25px;
27
+    }
28
+
29
+    table
30
+    {
31
+        border-collapse: collapse;
32
+        border: 1px solid black;
33
+        width: 100%;
34
+        margin: 30px auto;
35
+        font-size:1.5vw;
36
+    }
37
+    td, th
38
+    {
39
+        border: 1px solid black;
40
+        padding: 5px;
41
+    }
42
+
43
+    .activity-name-row
44
+    {
45
+      background:black;
46
+      color:white;
47
+    }
48
+
49
+    .activity-headers-row
50
+    {
51
+      background:lightgrey;
52
+      font-weight:bold;
53
+    }
54
+
55
+    .report-info
56
+    {
57
+      margin:5px 0;
58
+      font-size: 16px;
59
+    }
60
+
61
+    .criterion-field
62
+    {
63
+      text-align:left;
64
+    }
65
+
66
+    .score-field, .total, .percentage
67
+    {
68
+      text-align:center;
69
+    }
70
+
71
+    .header
72
+    {
73
+      margin: 30px 0;
74
+    }
75
+
76
+    .content
77
+    {
78
+      font-size: 12px;
79
+    }
80
+
81
+    .logo
82
+    {
83
+      position:absolute;
84
+      right:0;
85
+      top: 30px;
86
+      width: 100px;
87
+    }
88
+
89
+    ul{
90
+      list-style-type:none;
91
+    }
92
+
93
+    @media print{@page {size: landscape}}
94
+</style>';
95
+
96
+echo '<style type="text/css" media="print">
97
+  @page { size: landscape; }
98
+</style>';
99
+
100
+?>
101
+<img class="logo" src="{{ asset('images/logo_uprrp_bw.png') }}" alt="UPRRP Logo">
102
+
103
+<div class="header"><p class="header-text">University of Puerto Rico, Río Piedras Campus</p>
104
+<p class="header-text">Online Learning Assessment System</p>
105
+
106
+<h1 class="header-text">Three Year Plan for {{$program->name}} from {{$three_year_plan->year_start}} to {{$three_year_plan->year_end}}</h1></div>
107
+
108
+
109
+
110
+@foreach($typ_semesters as $semester)
111
+    <br>
112
+    <br>
113
+    <h2 class ='header-text'>{{$semester->name}}</h2>
114
+    <br>
115
+    @foreach($typ_semester_outcome[$semester->semester_id] as $outcome)
116
+
117
+    <span><h3>{{$outcome->name}}</h3></span>
118
+    <table class="table table-striped table-condensed" style = "table-layout: fixed">
119
+    <thead>
120
+        <tr>
121
+        
122
+        <th>Objectives</th>
123
+        <th>Courses</th>
124
+        
125
+        </tr>
126
+    </thead>
127
+    <tbody>
128
+
129
+        @foreach($outcome->objectives as $index=> $objective)
130
+        <tr>
131
+       
132
+        <td>
133
+            {{ $index + 1 }}. {{$objective->text}}
134
+        </td>
135
+        <td>
136
+            <ol>
137
+            @foreach($objective->courses as $course)
138
+            
139
+    <li>[{{$course->code}}] {{$course->name}}</li>
140
+            
141
+            @endforeach
142
+        </ol>
143
+
144
+        </tr>     
145
+          @endforeach
146
+
147
+    </tbody>
148
+    </table>
149
+    <br>
150
+    <br>
151
+  
152
+
153
+@endforeach
154
+
155
+@endforeach
156
+
157
+<?php
158
+
159
+echo '</body>';
160
+echo '</html>';
161
+?>
162
+
163
+<script type="text/javascript">
164
+
165
+window.print();
166
+
167
+</script>

+ 9
- 0
app/views/global/view-three-year-plan.blade.php View File

@@ -92,6 +92,7 @@
92 92
   </script>
93 93
 
94 94
   <div class="row">
95
+ 
95 96
     <div class="col-md-3">
96 97
       <input class="form-control" type="text" id="userInput" onkeyup="filterCycles()" placeholder="Search for Cycles..">
97 98
       <div class="list-group" id='list'>
@@ -138,6 +139,9 @@
138 139
     </div>
139 140
 
140 141
     <div class="col-md-9">
142
+      <div class="btn-group pull-right">
143
+        <a href="" id= "print_button" class="btn btn-default" target="_blank" rel="noopener noreferrer">Print</a>
144
+   </div>
141 145
       <div id="cycle-display" class="panel panel-default">
142 146
         <div class="panel-heading">
143 147
           <h4 class=" panel-title" style="cursor:auto!important;">
@@ -383,8 +387,13 @@ $('.go-to-temp').on('click', function(){
383 387
     //section 1
384 388
     $('.list-group-item').on('click', function()
385 389
     {
390
+      
391
+      $('#three_year_button').hide();
386 392
       var id = $(this).data('cycle-id');
387 393
       $('#table-cycles').data('typ-id',id);
394
+      $('#print_button').show();
395
+      $('#print_button').attr("href", "{{URL::action('ThreeYearPlanController@print', [$program_id])}}"+
396
+      '/'+ $(this).data('cycle-id'));
388 397
       $('#section1').show();
389 398
       $('#section2').hide();
390 399
       $('#section3').hide();

+ 14
- 5
app/views/local/managers/pCoords/_navigation.blade.php View File

@@ -5,18 +5,27 @@
5 5
     </div>-->
6 6
     <ul class="nav navbar-nav navbar-right">
7 7
       <li>{{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Overview') }}</li>
8
-      <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubrics') }}</li>
9
-      <li>{{ HTML::linkAction('ThreeYearPlanController@threeYearsReport', 'Three Years Plan') }}</li>
8
+      <li class="dropdown">
9
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Management<span class="caret"></span></a>
10
+        <ul class="dropdown-menu" role="menu">
11
+          <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubrics') }}</li>
12
+        <li>{{ HTML::linkAction('Objective2Controller@editProgram', 'Objectives')}}</li>
13
+      <li>{{ HTML::linkAction('CriteriaController@editProgram', 'Criteria') }}</li>
10 14
       <li>{{ HTML::linkAction('TransformativeActionsController@editTA', 'Transformative Actions') }}</li>
11 15
 
12
-      <li>{{ HTML::linkAction('Objective2Controller@editProgram', 'Objectives')}}</li>
13
-      <li>{{ HTML::linkAction('CriteriaController@editProgram', 'Criteria') }}</li>
14
-      <li><a href="{{ URL::action('AnnualPlansController@showPlan', Auth::user()->programs[0]->id)}}">Annual Plan</a><li>
16
+    
17
+          <li><a href="{{ URL::action('AnnualPlansController@showPlan', Auth::user()->programs[0]->id)}}">Annual Plan</a><li>
18
+        <li>{{ HTML::linkAction('ThreeYearPlanController@threeYearsReport', 'Three Years Plan') }}</li>
19
+      </ul>
20
+      </li>
21
+     
22
+      
15 23
       <li class="dropdown">
16 24
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Learning and Criterias<span class="caret"></span></a>
17 25
         <ul class="dropdown-menu" role="menu">
18 26
           <li>{{ HTML::linkAction('CriteriaController@index', 'Outcomes and Criteria') }}</li>
19 27
           <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'Objectives and Criteria') }}</li>
28
+          <li>{{ HTML::linkAction('TransformativeActionsController@viewFormativeActions', 'Tranformative and Formative Actions')}}
20 29
         </ul>
21 30
       </li>
22 31
       @if(count(Auth::user()->courses))

+ 617
- 0
app/views/local/managers/shared/view_formative.blade.php
File diff suppressed because it is too large
View File


+ 7
- 0
app/views/local/professors/overview.blade.php View File

@@ -173,6 +173,13 @@ function loadGraphs() {
173 173
                 },
174 174
                 data:[
175 175
                     @foreach($outcomes as $outcome)
176
+                    <?php
177
+Log::info($grouped_outcomes_attempted_results[$index]);
178
+Log::info(array_key_exists($outcome->id, $grouped_outcomes_attempted_results[$index]));
179
+
180
+Log::info($grouped_outcomes_attempted_results[$index][$outcome->id]);
181
+                         
182
+                    ?>
176 183
                         @if(
177 184
                             is_array($grouped_outcomes_attempted_results[$index])
178 185
                             && array_key_exists($outcome->id, $grouped_outcomes_attempted_results[$index])

+ 1
- 1
app/views/local/professors/printrubric.blade.php View File

@@ -172,7 +172,7 @@ echo '<style type="text/css" media="print">
172 172
 </table>
173 173
 
174 174
 
175
-<?
175
+<?php
176 176
 
177 177
 echo '</body>';
178 178
 echo '</html>';