Browse Source

Bugs antes de Trabajar criteria

Overview de school_coord
Objetivo tiene alrts cuando hace update.
Assessment scroll
Rubric views
parent
commit
1a3732c5fd

+ 29
- 1
app/controllers/CriteriaController.php View File

160
             $json['objectives_assoc'][$outId] = DB::select("select objectives.id, objectives.text, outcomes.name from objectives, objective_outcome, outcomes where  objective_outcome.outcome_id ={$outId} and objective_outcome.objective_id = objectives.id and objectives.active=1 and outcomes.id = objective_outcome.outcome_id");
160
             $json['objectives_assoc'][$outId] = DB::select("select objectives.id, objectives.text, outcomes.name from objectives, objective_outcome, outcomes where  objective_outcome.outcome_id ={$outId} and objective_outcome.objective_id = objectives.id and objectives.active=1 and outcomes.id = objective_outcome.outcome_id");
161
         }*/
161
         }*/
162
 
162
 
163
-        return json_encode($json);
163
+        $criterion =  DB::table('criteria')->where('id', Input::get('id'))->first();
164
+        $criterion->outcomes = DB::table('criterion_objective_outcome')
165
+            ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
166
+            ->where('criterion_id', $criterion->id)
167
+            ->distinct()
168
+            ->get();
169
+
170
+        foreach ($criterion->outcomes as $outcome) {
171
+            $outcome->assoc_objectives = DB::table('objective_outcome')
172
+                ->join('objectives', 'objectives.id', '=', 'objective_outcome.objective_id')
173
+                ->where('outcome_id', $outcome->outcome_id)
174
+                ->get();
175
+            $outcome->objectives_criteria = DB::table('criterion_objective_outcome')
176
+                ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
177
+                ->where('criterion_id', $criterion->id)
178
+                ->where('outcome_id', $outcome->id)
179
+                ->get();
180
+        }
181
+        $criterion->scales = DB::table('criterion_scale')
182
+            ->join('scales', 'criterion_scale.scale_id', '=', 'scales.id')
183
+            ->where('criterion_id', $criteria_id)
184
+            ->orderBy('position')
185
+            ->get();
186
+        $criterion->program =  DB::table('program_criterion')->where('criterion_id', $criteria_id)->get();
187
+        $criterion->activity_criterion = DB::table('assessments')
188
+            ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
189
+            ->where('activity_criterion.criterion_id', $criteria_id)
190
+            ->get();
191
+        return array($criterion);
164
     }
192
     }
165
 
193
 
166
     public function delete()
194
     public function delete()

+ 21
- 8
app/controllers/Objective2Controller.php View File

370
 			$message .= '</ul>';
370
 			$message .= '</ul>';
371
 
371
 
372
 			/** Send error message and old data */
372
 			/** Send error message and old data */
373
-			Session::flash('status', 'danger');
374
-			Session::flash('message', $message);
373
+			//Session::flash('status', 'danger');
374
+			//Session::flash('message', $message);
375
+			$MessageArray = array('status' => 'danger', 'message' => $message);
375
 			$role = Auth::user()['role'];
376
 			$role = Auth::user()['role'];
376
 			switch ($role) {
377
 			switch ($role) {
377
 				case 1:
378
 				case 1:
379
+					return $MessageArray;
378
 					return Redirect::to('objective')->withInput();
380
 					return Redirect::to('objective')->withInput();
379
 
381
 
380
 				case 2:
382
 				case 2:
383
+					return $MessageArray;
381
 					return Redirect::to('school-objective')->withInput();
384
 					return Redirect::to('school-objective')->withInput();
382
 
385
 
383
 				case 3:
386
 				case 3:
387
+					return $MessageArray;
384
 					return Redirect::to('program-objective')->withInput();
388
 					return Redirect::to('program-objective')->withInput();
385
 			}
389
 			}
386
 		} else {
390
 		} else {
396
 
400
 
397
 			// Set status
401
 			// Set status
398
 
402
 
399
-			Log::info("dimelo papi");
403
+
400
 			/** If Objective is updated, send success message */
404
 			/** If Objective is updated, send success message */
401
 			if ($Objective->save()) {
405
 			if ($Objective->save()) {
402
-				Log::info("dimelo papi2");
406
+
403
 				$objectiveId = $Objective->id;
407
 				$objectiveId = $Objective->id;
404
 				DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
408
 				DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
405
 				DB::delete("delete from objective_program where objective_id = {$objectiveId}");
409
 				DB::delete("delete from objective_program where objective_id = {$objectiveId}");
411
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
415
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
412
 				}
416
 				}
413
 
417
 
414
-				Session::flash('status', 'success');
415
-				Session::flash('message', 'Updated Objective: "' . $Objective->text . '"');
418
+				//Session::flash('status', 'success');
419
+				//Session::flash('message', 'Updated Objective: "' . $Objective->text . '"');
420
+				$MessageArray = array('status' => 'success', 'message' => 'Updated Objective: "' . $Objective->text . '"');
416
 				$role = Auth::user()['role'];
421
 				$role = Auth::user()['role'];
422
+
417
 				switch ($role) {
423
 				switch ($role) {
418
 					case 1:
424
 					case 1:
425
+						return $MessageArray;
419
 						return Redirect::to('objective')->withInput();
426
 						return Redirect::to('objective')->withInput();
420
 
427
 
421
 					case 2:
428
 					case 2:
429
+						return $MessageArray;
422
 						return Redirect::to('school-objective')->withInput();
430
 						return Redirect::to('school-objective')->withInput();
423
 
431
 
424
 					case 3:
432
 					case 3:
433
+						return $MessageArray;
425
 						return Redirect::to('program-objective')->withInput();
434
 						return Redirect::to('program-objective')->withInput();
426
 				}
435
 				}
427
 			}
436
 			}
428
 
437
 
429
 			/** If saving fails, send error message and old data */
438
 			/** If saving fails, send error message and old data */
430
 			else {
439
 			else {
431
-				Session::flash('status', 'danger');
432
-				Session::flash('message', 'Error updating the Objective. Please try again later.');
440
+				//Session::flash('status', 'danger');
441
+				////Session::flash('message', 'Error updating the Objective. Please try again later.');
442
+				$MessageArray = array('status' => 'danger', 'message' => 'Error updating the Objective. Please try again later.');
433
 				$role = Auth::user()['role'];
443
 				$role = Auth::user()['role'];
434
 				switch ($role) {
444
 				switch ($role) {
435
 					case 1:
445
 					case 1:
446
+						return $MessageArray;
436
 						return Redirect::to('objective')->withInput();
447
 						return Redirect::to('objective')->withInput();
437
 
448
 
438
 					case 2:
449
 					case 2:
450
+						return $MessageArray;
439
 						return Redirect::to('school-objective')->withInput();
451
 						return Redirect::to('school-objective')->withInput();
440
 
452
 
441
 					case 3:
453
 					case 3:
454
+						return $MessageArray;
442
 						return Redirect::to('program-objective')->withInput();
455
 						return Redirect::to('program-objective')->withInput();
443
 				}
456
 				}
444
 			}
457
 			}

+ 70
- 69
app/controllers/OutcomesController.php View File

621
                 ->where('criterion_objective_outcome.outcome_id', $id)
621
                 ->where('criterion_objective_outcome.outcome_id', $id)
622
                 ->where('criteria.num_scales', $level)
622
                 ->where('criteria.num_scales', $level)
623
                 ->select('criteria.id', 'criteria.name', 'criteria.deleted_at')
623
                 ->select('criteria.id', 'criteria.name', 'criteria.deleted_at')
624
+                ->distinct()
624
                 ->orderBy('criteria.name', 'asc')
625
                 ->orderBy('criteria.name', 'asc')
625
                 ->get();
626
                 ->get();
626
             // $outcome_criterias = $outcome_criterias;
627
             // $outcome_criterias = $outcome_criterias;
726
 
727
 
727
     public function totalAssessmentReport()
728
     public function totalAssessmentReport()
728
     {
729
     {
729
-    	//SELECT sm.name, s.name, p.name, p.code, a.outcomes_attempted, stu.number, ass.scores, c.code, c.number, r.expected_points 
730
-//     	FROM students stu, schools s, programs p, courses c, activities a, assessments ass, rubrics r, semesters sm 
731
-//     	where stu.id=ass.student_id and sm.id=c.semester_id and s.id=p.school_id and p.id=c.program_id and a.course_id=c.id and ass.activity_id=a.id and a.rubric_id=r.id 
732
-//     	and c.semester_id in (12,13) and a.outcomes_attempted is not null
733
-    ini_set('memory_limit', -1);
734
-	ini_set('max_execution_time', 300);
735
-// 		$total_assessments_temp = DB::table('assessments')
736
-//          						->join('students', 'students.id', '=', 'assessments.student_id')
737
-//          						->join('activities', 'activities.id', '=', 'assessments.activity_id')
738
-//          						->join('rubrics', 'rubrics.id', '=', 'activities.rubric_id')
739
-//          						->join('courses', 'courses.id', '=', 'activities.course_id')
740
-//          						->join('programs', 'programs.id', '=', 'courses.program_id')
741
-//          						->join('schools', 'schools.id', '=', 'programs.school_id')
742
-//           						->join('semesters', 'semesters.id', '=', 'courses.semester_id')
743
-//                    			   	->whereIn('courses.semester_id', Session::get('semesters_ids'))
744
-//                     			->whereRaw('activities.outcomes_attempted is not null')
745
-//                     			->select('activities.id as activity_id','semesters.name as semester','schools.name as school','programs.name as program','programs.id as program_id','programs.code as program_code','students.number as student_number','students.conc_code as student_conc_code','assessments.scores as results','courses.name as course','courses.code as course_code','courses.number as course_number','rubrics.expected_points as expected_result')
746
-//                     			->orderBy('semesters.id','school','program','course','student_number')
747
-// 								->distinct()
748
-//                     			->get();
749
-//                     			    
750
-//         $total_assessments=array();
751
-// 		foreach($total_assessments_temp as $total_assessment)
752
-// 		{
753
-// 			$results=json_decode($total_assessment->results, TRUE);
754
-// 			$total_assessment->course=$total_assessment->course_code.$total_assessment->course_number." ".$total_assessment->course;
755
-// 			foreach($results as $criterion_id => $result)
756
-// 			{	
757
-// 				if($result and $result!="N/A")
758
-// 				{
759
-// 					$trans_temp=clone $total_assessment;
760
-// 					$criterion=Criterion::find($criterion_id);
761
-// 					if($criterion)
762
-// 					{
763
-// 	// 					var_dump($total_assessment->activity_id);
764
-// 	// 					var_dump($criterion_id);
765
-// 						if($criterion_id==1398)var_dump($criterion);
766
-// 	// 					exit();
767
-// 						$trans_temp->result=$result;
768
-// 						$trans_temp->criterion=$criterion->name;
769
-// 						$trans_temp->outcome=Outcome::find($criterion->outcome_id)->name;
770
-// 						$total_assessments[]=$trans_temp;
771
-// 					}
772
-// 				}
773
-// 			}
774
-// 		
775
-// 		}
776
-		$total_assessments = DB::table('assessments')
777
-         						->join('students', 'students.id', '=', 'assessments.student_id')
778
-         						->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
779
-         						->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
780
-         						->join('criteria', 'criteria.id', '=', 'activity_criterion.criterion_id')
781
-         						->join('criterion_objective_outcome', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
782
-         						->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
783
-         						->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
784
-         						->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
785
-         						->join('courses', 'courses.id', '=', 'activities.course_id')
786
-         						->join('programs', 'programs.id', '=', 'courses.program_id')
787
-         						->join('schools', 'schools.id', '=', 'programs.school_id')
788
-          						->join('semesters', 'semesters.id', '=', 'courses.semester_id')
789
-                   			   	->whereIn('courses.semester_id', Session::get('semesters_ids'))
790
-                    			->select('criteria.name as criterion','outcomes.name as outcome','activities.id as activity_id','semesters.name as semester','schools.name as school','programs.name as program','programs.id as program_id','programs.code as program_code','students.number as student_number','students.conc_code as student_conc_code','assessments.score as result','courses.name as course','courses.code as course_code','courses.number as course_number','rubrics.expected_points as expected_result')
791
-                    			->orderBy('semesters.id','school','program','course','student_number')
792
-								->distinct()
793
-                    			->get();
794
-
795
-
796
-       $title = "Total Assessment Report";
797
-		
730
+        //SELECT sm.name, s.name, p.name, p.code, a.outcomes_attempted, stu.number, ass.scores, c.code, c.number, r.expected_points 
731
+        //     	FROM students stu, schools s, programs p, courses c, activities a, assessments ass, rubrics r, semesters sm 
732
+        //     	where stu.id=ass.student_id and sm.id=c.semester_id and s.id=p.school_id and p.id=c.program_id and a.course_id=c.id and ass.activity_id=a.id and a.rubric_id=r.id 
733
+        //     	and c.semester_id in (12,13) and a.outcomes_attempted is not null
734
+        ini_set('memory_limit', -1);
735
+        ini_set('max_execution_time', 300);
736
+        // 		$total_assessments_temp = DB::table('assessments')
737
+        //          						->join('students', 'students.id', '=', 'assessments.student_id')
738
+        //          						->join('activities', 'activities.id', '=', 'assessments.activity_id')
739
+        //          						->join('rubrics', 'rubrics.id', '=', 'activities.rubric_id')
740
+        //          						->join('courses', 'courses.id', '=', 'activities.course_id')
741
+        //          						->join('programs', 'programs.id', '=', 'courses.program_id')
742
+        //          						->join('schools', 'schools.id', '=', 'programs.school_id')
743
+        //           						->join('semesters', 'semesters.id', '=', 'courses.semester_id')
744
+        //                    			   	->whereIn('courses.semester_id', Session::get('semesters_ids'))
745
+        //                     			->whereRaw('activities.outcomes_attempted is not null')
746
+        //                     			->select('activities.id as activity_id','semesters.name as semester','schools.name as school','programs.name as program','programs.id as program_id','programs.code as program_code','students.number as student_number','students.conc_code as student_conc_code','assessments.scores as results','courses.name as course','courses.code as course_code','courses.number as course_number','rubrics.expected_points as expected_result')
747
+        //                     			->orderBy('semesters.id','school','program','course','student_number')
748
+        // 								->distinct()
749
+        //                     			->get();
750
+        //                     			    
751
+        //         $total_assessments=array();
752
+        // 		foreach($total_assessments_temp as $total_assessment)
753
+        // 		{
754
+        // 			$results=json_decode($total_assessment->results, TRUE);
755
+        // 			$total_assessment->course=$total_assessment->course_code.$total_assessment->course_number." ".$total_assessment->course;
756
+        // 			foreach($results as $criterion_id => $result)
757
+        // 			{	
758
+        // 				if($result and $result!="N/A")
759
+        // 				{
760
+        // 					$trans_temp=clone $total_assessment;
761
+        // 					$criterion=Criterion::find($criterion_id);
762
+        // 					if($criterion)
763
+        // 					{
764
+        // 	// 					var_dump($total_assessment->activity_id);
765
+        // 	// 					var_dump($criterion_id);
766
+        // 						if($criterion_id==1398)var_dump($criterion);
767
+        // 	// 					exit();
768
+        // 						$trans_temp->result=$result;
769
+        // 						$trans_temp->criterion=$criterion->name;
770
+        // 						$trans_temp->outcome=Outcome::find($criterion->outcome_id)->name;
771
+        // 						$total_assessments[]=$trans_temp;
772
+        // 					}
773
+        // 				}
774
+        // 			}
775
+        // 		
776
+        // 		}
777
+        $total_assessments = DB::table('assessments')
778
+            ->join('students', 'students.id', '=', 'assessments.student_id')
779
+            ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
780
+            ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
781
+            ->join('criteria', 'criteria.id', '=', 'activity_criterion.criterion_id')
782
+            ->join('criterion_objective_outcome', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
783
+            ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
784
+            ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
785
+            ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
786
+            ->join('courses', 'courses.id', '=', 'activities.course_id')
787
+            ->join('programs', 'programs.id', '=', 'courses.program_id')
788
+            ->join('schools', 'schools.id', '=', 'programs.school_id')
789
+            ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
790
+            ->whereIn('courses.semester_id', Session::get('semesters_ids'))
791
+            ->select('criteria.name as criterion', 'outcomes.name as outcome', 'activities.id as activity_id', 'semesters.name as semester', 'schools.name as school', 'programs.name as program', 'programs.id as program_id', 'programs.code as program_code', 'students.number as student_number', 'students.conc_code as student_conc_code', 'assessments.score as result', 'courses.name as course', 'courses.code as course_code', 'courses.number as course_number', 'rubrics.expected_points as expected_result')
792
+            ->orderBy('semesters.id', 'school', 'program', 'course', 'student_number')
793
+            ->distinct()
794
+            ->get();
795
+
796
+
797
+        $title = "Total Assessment Report";
798
+
798
         return View::make('local.managers.admins.total_assessment', compact('title', 'total_assessments'));
799
         return View::make('local.managers.admins.total_assessment', compact('title', 'total_assessments'));
799
     }
800
     }
800
 
801
 

+ 16
- 7
app/controllers/SchoolCoordinatorsController.php View File

5
 
5
 
6
     private function participatingPrograms($school)
6
     private function participatingPrograms($school)
7
     {
7
     {
8
-        return DB::table('VIEW_participating_programs')
8
+        return DB::table('programs')
9
+            ->join('courses', 'courses.program_id', '=', 'programs.id')
10
+            ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
11
+            ->addSelect('courses.semester_id')
9
             ->where('school_id', $school->id)
12
             ->where('school_id', $school->id)
10
             ->whereIn('semester_id', Session::get('semesters_ids'))
13
             ->whereIn('semester_id', Session::get('semesters_ids'))
11
             ->lists('id');
14
             ->lists('id');
158
         foreach ($school->programs as $program) {
161
         foreach ($school->programs as $program) {
159
             foreach ($program->courses as $course) {
162
             foreach ($program->courses as $course) {
160
                 if (!$course->program->is_graduate) {
163
                 if (!$course->program->is_graduate) {
161
-                    if ($course->outcomes_achieved != NULL) {
162
-                        $course_outcomes_achieved = $course->outcomes_ach();
164
+                    if ($course_outcomes_achieved = $course->outcomes_ach()) {
165
+                        //$course_outcomes_achieved = $course->outcomes_ach();
163
                         $course_outcomes_attempted = $course->outcomes_att();
166
                         $course_outcomes_attempted = $course->outcomes_att();
164
                         foreach ($course_outcomes_attempted as $i => $score) {
167
                         foreach ($course_outcomes_attempted as $i => $score) {
165
 
168
 
172
                     }
175
                     }
173
                     $undergrad_school_sections_count += 1;
176
                     $undergrad_school_sections_count += 1;
174
                 } else {
177
                 } else {
175
-                    if ($course->outcomes_achieved != NULL) {
176
-                        $course_outcomes_achieved = $course->outcomes_ach();
178
+                    if ($course_outcomes_achieved = $course->outcomes_ach()) {
179
+                        //$course_outcomes_achieved = $course->outcomes_ach();
177
                         $course_outcomes_attempted = $course->outcomes_att();
180
                         $course_outcomes_attempted = $course->outcomes_att();
178
                         foreach ($course_outcomes_attempted as $i => $score) {
181
                         foreach ($course_outcomes_attempted as $i => $score) {
179
 
182
 
200
         $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
203
         $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
201
 
204
 
202
         // Fetch programs with participation for the school
205
         // Fetch programs with participation for the school
203
-        $participating_undergrad_programs = DB::table('VIEW_participating_programs')
206
+        $participating_undergrad_programs = DB::table('programs')
207
+            ->join('courses', 'courses.program_id', '=', 'programs.id')
208
+            ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
209
+            ->addSelect('courses.semester_id')
204
             ->whereIn('semester_id', Session::get('semesters_ids'))
210
             ->whereIn('semester_id', Session::get('semesters_ids'))
205
             ->where('is_graduate', 0)
211
             ->where('is_graduate', 0)
206
             ->where('school_id', $school->id)
212
             ->where('school_id', $school->id)
274
         $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
280
         $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
275
 
281
 
276
         // Fetch programs with participation for the school
282
         // Fetch programs with participation for the school
277
-        $participating_grad_programs = DB::table('VIEW_participating_programs')
283
+        $participating_grad_programs = DB::table('programs')
284
+            ->join('courses', 'courses.program_id', '=', 'programs.id')
285
+            ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
286
+            ->addSelect('courses.semester_id')
278
             ->whereIn('semester_id', Session::get('semesters_ids'))
287
             ->whereIn('semester_id', Session::get('semesters_ids'))
279
             ->where('is_graduate', 1)
288
             ->where('is_graduate', 1)
280
             ->where('school_id', $school->id)
289
             ->where('school_id', $school->id)

+ 125
- 142
app/controllers/SchoolsController.php View File

5
 
5
 
6
     private function participatingPrograms($school)
6
     private function participatingPrograms($school)
7
     {
7
     {
8
-        return DB::table('VIEW_participating_programs')
8
+        return DB::table('programs')
9
+            ->join('courses', 'courses.program_id', '=', 'programs.id')
10
+            ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
11
+            ->addSelect('courses.semester_id')
9
             ->where('school_id', $school->id)
12
             ->where('school_id', $school->id)
10
             ->whereIn('semester_id', Session::get('semesters_ids'))
13
             ->whereIn('semester_id', Session::get('semesters_ids'))
11
             ->lists('id');
14
             ->lists('id');
12
     }
15
     }
13
 
16
 
14
-	public function show($id)
15
-	{
17
+    public function show($id)
18
+    {
16
         ini_set('memory_limit', '256M');
19
         ini_set('memory_limit', '256M');
17
         DB::connection()->disableQueryLog();
20
         DB::connection()->disableQueryLog();
18
         $school = School::find($id);
21
         $school = School::find($id);
19
-        $title= $school->name;
22
+        $title = $school->name;
20
         $schools = School::all();
23
         $schools = School::all();
21
 
24
 
22
         $outcomes = Outcome::orderBy('name', 'asc')->get();
25
         $outcomes = Outcome::orderBy('name', 'asc')->get();
27
          * List of grouped courses (grouped sections)
30
          * List of grouped courses (grouped sections)
28
          */
31
          */
29
 
32
 
30
-        $program_ids= $school->programs->lists('id');
33
+        $program_ids = $school->programs->lists('id');
31
 
34
 
32
         $undergrad_programs = DB::table('programs')
35
         $undergrad_programs = DB::table('programs')
33
-        ->select('id', 'name', 'school_id', 'is_graduate')
34
-        ->where('is_graduate', '=', 0)
35
-        ->where('school_id', '=', $id)
36
-        ->orderBy('name', 'ASC')
37
-        ->get();
36
+            ->select('id', 'name', 'school_id', 'is_graduate')
37
+            ->where('is_graduate', '=', 0)
38
+            ->where('school_id', '=', $id)
39
+            ->orderBy('name', 'ASC')
40
+            ->get();
38
 
41
 
39
         $grad_programs = DB::table('programs')
42
         $grad_programs = DB::table('programs')
40
-        ->select('id', 'name', 'school_id', 'is_graduate')
41
-        ->where('is_graduate', '=', 1)
42
-        ->where('school_id', '=', $id)
43
-        ->orderBy('name', 'ASC')
44
-        ->get();
45
-   
43
+            ->select('id', 'name', 'school_id', 'is_graduate')
44
+            ->where('is_graduate', '=', 1)
45
+            ->where('school_id', '=', $id)
46
+            ->orderBy('name', 'ASC')
47
+            ->get();
48
+
46
 
49
 
47
         $grad_grouped_courses = Course::
50
         $grad_grouped_courses = Course::
48
-//             select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
51
+            //             select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
49
             select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
52
             select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
50
             ->with('semester')
53
             ->with('semester')
51
             ->with('program')
54
             ->with('program')
60
             ->get();
63
             ->get();
61
 
64
 
62
         $undergrad_grouped_courses = Course::
65
         $undergrad_grouped_courses = Course::
63
-//             select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
66
+            //             select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
64
             select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
67
             select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
65
             ->with('semester')
68
             ->with('semester')
66
             ->with('program')
69
             ->with('program')
92
         $grad_assessed_sections_count = 0;
95
         $grad_assessed_sections_count = 0;
93
         $grad_school_sections_count = 0;
96
         $grad_school_sections_count = 0;
94
 
97
 
95
-        foreach($school->programs as $program)
96
-        {
97
-        	foreach ($program->courses as $course)
98
-        	{
99
-                if(!$course->program->is_graduate)
100
-                {
101
-                    if($course->outcomes_achieved != NULL)
102
-                    {
103
-                        $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
104
-                        $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
105
-                        for($i=1; $i<=count($undergrad_outcomes_attempted); $i++)
106
-                        {
107
-                            $undergrad_outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
108
-                            $undergrad_outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
98
+        foreach ($school->programs as $program) {
99
+            foreach ($program->courses as $course) {
100
+                if (!$course->program->is_graduate) {
101
+                    if ($course->outcomes_achieved != NULL) {
102
+                        $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
103
+                        $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
104
+                        for ($i = 1; $i <= count($undergrad_outcomes_attempted); $i++) {
105
+                            $undergrad_outcomes_achieved[$i] += $course_outcomes_achieved[$i];
106
+                            $undergrad_outcomes_attempted[$i] += $course_outcomes_attempted[$i];
109
                         }
107
                         }
110
-                        $undergrad_assessed_sections_count+=1;
108
+                        $undergrad_assessed_sections_count += 1;
111
                     }
109
                     }
112
-                    $undergrad_school_sections_count+=1;
113
-                }
114
-                else
115
-                {
116
-                    if($course->outcomes_achieved != NULL)
117
-                    {
118
-                        $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
119
-                        $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
120
-                        for($i=1; $i<=count($grad_outcomes_attempted); $i++)
121
-                        {
122
-                            $grad_outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
123
-                            $grad_outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
110
+                    $undergrad_school_sections_count += 1;
111
+                } else {
112
+                    if ($course->outcomes_achieved != NULL) {
113
+                        $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
114
+                        $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
115
+                        for ($i = 1; $i <= count($grad_outcomes_attempted); $i++) {
116
+                            $grad_outcomes_achieved[$i] += $course_outcomes_achieved[$i];
117
+                            $grad_outcomes_attempted[$i] += $course_outcomes_attempted[$i];
124
                         }
118
                         }
125
-                        $grad_assessed_sections_count+=1;
119
+                        $grad_assessed_sections_count += 1;
126
                     }
120
                     }
127
-                    $grad_school_sections_count+=1;
121
+                    $grad_school_sections_count += 1;
128
                 }
122
                 }
129
-            }    
123
+            }
130
         }
124
         }
131
 
125
 
132
         /**
126
         /**
140
         $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
134
         $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
141
 
135
 
142
         // Fetch programs with participation for the school
136
         // Fetch programs with participation for the school
143
-        $participating_undergrad_programs = DB::table('VIEW_participating_programs')
137
+        $participating_undergrad_programs = DB::table('programs')
138
+            ->join('courses', 'courses.program_id', '=', 'programs.id')
139
+            ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
140
+            ->addSelect('courses.semester_id')
144
             ->whereIn('semester_id', Session::get('semesters_ids'))
141
             ->whereIn('semester_id', Session::get('semesters_ids'))
145
             ->where('is_graduate', 0)
142
             ->where('is_graduate', 0)
146
             ->where('school_id', $school->id)
143
             ->where('school_id', $school->id)
151
 
148
 
152
 
149
 
153
         // For each outcome 
150
         // For each outcome 
154
-        foreach ($outcomes as $outcome)
155
-        {
151
+        foreach ($outcomes as $outcome) {
156
             // For each program with courses that do assessment
152
             // For each program with courses that do assessment
157
-            $programs_with_courses = Program::with(array('courses' => function($query){
158
-//                 $query->whereNotNull('outcomes_attempted');
153
+            $programs_with_courses = Program::with(array('courses' => function ($query) {
154
+                //                 $query->whereNotNull('outcomes_attempted');
159
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
155
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
160
             }))->where('is_graduate', 0)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
156
             }))->where('is_graduate', 0)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
161
 
157
 
162
-            foreach ($programs_with_courses as $program)
163
-            {
158
+            foreach ($programs_with_courses as $program) {
164
                 // To acummulate all criteria for one program
159
                 // To acummulate all criteria for one program
165
                 $achieved_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
160
                 $achieved_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
166
                 $attempted_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
161
                 $attempted_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
167
 
162
 
168
                 //Flag for counting programs
163
                 //Flag for counting programs
169
-                $flag =false;
164
+                $flag = false;
170
 
165
 
171
                 // For each course in the program
166
                 // For each course in the program
172
-                foreach ($program->courses as $course)
173
-                {
167
+                foreach ($program->courses as $course) {
174
                     // If the outcome in question is being evaluated
168
                     // If the outcome in question is being evaluated
175
                     $course_outcomes_attempted2 = $course->outcomes_att();
169
                     $course_outcomes_attempted2 = $course->outcomes_att();
176
-//                     $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
177
-//                     $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
170
+                    //                     $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
171
+                    //                     $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
178
                     $course_outcomes_achieved2 = $course->outcomes_ach();
172
                     $course_outcomes_achieved2 = $course->outcomes_ach();
179
-                    if(array_key_exists($outcome->id, $course_outcomes_attempted2 ) && array_key_exists($outcome->id, $course_outcomes_achieved2 )
180
-                        && $course_outcomes_attempted2[$outcome->id]>0)
181
-                    {
182
-                        $achieved_outcomes_per_undergrad_program[$outcome->id]+=$course_outcomes_achieved2[$outcome->id];
183
-                        $attempted_outcomes_per_undergrad_program[$outcome->id]+=$course_outcomes_attempted2[$outcome->id];
173
+                    if (
174
+                        array_key_exists($outcome->id, $course_outcomes_attempted2) && array_key_exists($outcome->id, $course_outcomes_achieved2)
175
+                        && $course_outcomes_attempted2[$outcome->id] > 0
176
+                    ) {
177
+                        $achieved_outcomes_per_undergrad_program[$outcome->id] += $course_outcomes_achieved2[$outcome->id];
178
+                        $attempted_outcomes_per_undergrad_program[$outcome->id] += $course_outcomes_attempted2[$outcome->id];
184
 
179
 
185
                         // Add one to the programs assessing, if it wasn't added before
180
                         // Add one to the programs assessing, if it wasn't added before
186
-                        if(!$flag)
187
-                        {
188
-                            $attemptedUndergradProgramsPerOutcome[$outcome->id]+=1;
189
-                            $flag= true;
181
+                        if (!$flag) {
182
+                            $attemptedUndergradProgramsPerOutcome[$outcome->id] += 1;
183
+                            $flag = true;
190
                         }
184
                         }
191
                     }
185
                     }
192
 
186
 
195
 
189
 
196
                 }
190
                 }
197
                 //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
191
                 //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
198
-                if($attempted_outcomes_per_undergrad_program[$outcome->id]!=0 && (float)$achieved_outcomes_per_undergrad_program[$outcome->id]/$attempted_outcomes_per_undergrad_program[$outcome->id]*100 >= $outcome->expected_outcome)
199
-                {
200
-                    $achievedUndergradProgramsPerOutcome[$outcome->id]+=1;
192
+                if ($attempted_outcomes_per_undergrad_program[$outcome->id] != 0 && (float)$achieved_outcomes_per_undergrad_program[$outcome->id] / $attempted_outcomes_per_undergrad_program[$outcome->id] * 100 >= $outcome->expected_outcome) {
193
+                    $achievedUndergradProgramsPerOutcome[$outcome->id] += 1;
201
                     // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
194
                     // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
202
                 }
195
                 }
203
             }
196
             }
214
         $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
207
         $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
215
 
208
 
216
         // Fetch programs with participation for the school
209
         // Fetch programs with participation for the school
217
-        $participating_grad_programs = DB::table('VIEW_participating_programs')
210
+        $participating_grad_programs = DB::table('programs')
211
+            ->join('courses', 'courses.program_id', '=', 'programs.id')
212
+            ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
213
+            ->addSelect('courses.semester_id')
218
             ->whereIn('semester_id', Session::get('semesters_ids'))
214
             ->whereIn('semester_id', Session::get('semesters_ids'))
219
             ->where('is_graduate', 1)
215
             ->where('is_graduate', 1)
220
             ->where('school_id', $school->id)
216
             ->where('school_id', $school->id)
225
 
221
 
226
 
222
 
227
         // For each outcome 
223
         // For each outcome 
228
-        foreach ($outcomes as $outcome)
229
-        {
224
+        foreach ($outcomes as $outcome) {
230
             // For each program with courses that do assessment
225
             // For each program with courses that do assessment
231
-            $programs_with_courses = Program::with(array('courses' => function($query){
232
-//                 $query->whereNotNull('outcomes_attempted');
226
+            $programs_with_courses = Program::with(array('courses' => function ($query) {
227
+                //                 $query->whereNotNull('outcomes_attempted');
233
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
228
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
234
             }))->where('is_graduate', 1)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
229
             }))->where('is_graduate', 1)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
235
 
230
 
236
-            foreach ($programs_with_courses as $program)
237
-            {
231
+            foreach ($programs_with_courses as $program) {
238
                 // To acummulate all criteria for one program
232
                 // To acummulate all criteria for one program
239
                 $achieved_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
233
                 $achieved_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
240
                 $attempted_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
234
                 $attempted_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
241
 
235
 
242
                 //Flag for counting programs
236
                 //Flag for counting programs
243
-                $flag =false;
237
+                $flag = false;
244
 
238
 
245
                 // For each course in the program
239
                 // For each course in the program
246
-                foreach ($program->courses as $course)
247
-                {
240
+                foreach ($program->courses as $course) {
248
                     // If the outcome in question is being evaluated
241
                     // If the outcome in question is being evaluated
249
-//                     $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
242
+                    //                     $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
250
                     $course_outcomes_attempted2 = ($course->outcomes_att());
243
                     $course_outcomes_attempted2 = ($course->outcomes_att());
251
                     $course_outcomes_achieved2 = ($course->outcomes_ach());
244
                     $course_outcomes_achieved2 = ($course->outcomes_ach());
252
-//                     $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
253
-                    if(array_key_exists($outcome->id, $course_outcomes_attempted2 ) && array_key_exists($outcome->id, $course_outcomes_achieved2 )
254
-                        && $course_outcomes_attempted2[$outcome->id]>0)
255
-                    {
256
-                        $achieved_outcomes_per_grad_program[$outcome->id]+=$course_outcomes_achieved2[$outcome->id];
257
-                        $attempted_outcomes_per_grad_program[$outcome->id]+=$course_outcomes_attempted2[$outcome->id];
245
+                    //                     $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
246
+                    if (
247
+                        array_key_exists($outcome->id, $course_outcomes_attempted2) && array_key_exists($outcome->id, $course_outcomes_achieved2)
248
+                        && $course_outcomes_attempted2[$outcome->id] > 0
249
+                    ) {
250
+                        $achieved_outcomes_per_grad_program[$outcome->id] += $course_outcomes_achieved2[$outcome->id];
251
+                        $attempted_outcomes_per_grad_program[$outcome->id] += $course_outcomes_attempted2[$outcome->id];
258
 
252
 
259
                         // Add one to the programs assessing, if it wasn't added before
253
                         // Add one to the programs assessing, if it wasn't added before
260
-                        if(!$flag)
261
-                        {
262
-                            $attemptedGradProgramsPerOutcome[$outcome->id]+=1;
263
-                            $flag= true;
254
+                        if (!$flag) {
255
+                            $attemptedGradProgramsPerOutcome[$outcome->id] += 1;
256
+                            $flag = true;
264
                         }
257
                         }
265
                     }
258
                     }
266
 
259
 
269
 
262
 
270
                 }
263
                 }
271
                 //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
264
                 //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
272
-                if($attempted_outcomes_per_grad_program[$outcome->id]!=0 && (float)$achieved_outcomes_per_grad_program[$outcome->id]/$attempted_outcomes_per_grad_program[$outcome->id]*100 >= $outcome->expected_outcome)
273
-                {
274
-                    $achievedGradProgramsPerOutcome[$outcome->id]+=1;
265
+                if ($attempted_outcomes_per_grad_program[$outcome->id] != 0 && (float)$achieved_outcomes_per_grad_program[$outcome->id] / $attempted_outcomes_per_grad_program[$outcome->id] * 100 >= $outcome->expected_outcome) {
266
+                    $achievedGradProgramsPerOutcome[$outcome->id] += 1;
275
                     // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
267
                     // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
276
                 }
268
                 }
277
             }
269
             }
278
         }
270
         }
279
-        if($school->id == 13){
280
-            return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes','undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
281
-        }else{
282
-            return View::make('local.managers.shared.school', compact('title', 'outcomes','undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
271
+        if ($school->id == 13) {
272
+            return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
273
+        } else {
274
+            return View::make('local.managers.shared.school', compact('title', 'outcomes', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
283
         }
275
         }
284
     }
276
     }
285
 
277
 
289
         DB::connection()->disableQueryLog();
281
         DB::connection()->disableQueryLog();
290
 
282
 
291
         $school = School::find($id);
283
         $school = School::find($id);
292
-        $title= $school->name.' Assessment Report - '.date('m/d/Y');
284
+        $title = $school->name . ' Assessment Report - ' . date('m/d/Y');
293
 
285
 
294
         $outcomes = Outcome::orderBy('name', 'asc')->get();
286
         $outcomes = Outcome::orderBy('name', 'asc')->get();
295
         $outcomeCount = Outcome::all()->count();
287
         $outcomeCount = Outcome::all()->count();
301
          * List of courses (grouped sections)
293
          * List of courses (grouped sections)
302
          */
294
          */
303
 
295
 
304
-        $program_ids= $school->programs->lists('id');
296
+        $program_ids = $school->programs->lists('id');
305
 
297
 
306
         $grouped_courses = Course::
298
         $grouped_courses = Course::
307
-//             select(DB::raw('name, code, number, max(outcomes_attempted) as outcomes_attempted, semester_id, program_id'))
299
+            //             select(DB::raw('name, code, number, max(outcomes_attempted) as outcomes_attempted, semester_id, program_id'))
308
             select(DB::raw('name, code, number, semester_id, program_id'))
300
             select(DB::raw('name, code, number, semester_id, program_id'))
309
             ->with('semester')
301
             ->with('semester')
310
             ->with('program')
302
             ->with('program')
328
         $assessed_sections_count = 0;
320
         $assessed_sections_count = 0;
329
         $school_sections_count = 0;
321
         $school_sections_count = 0;
330
 
322
 
331
-        foreach($school->programs as $program)
332
-        {
333
-            foreach ($program->courses as $course)
334
-            {
335
-              if($course->outcomes_achieved!=NULL)
336
-              {
337
-                $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
338
-                $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
339
-                for($i=1; $i<=count($outcomes_attempted); $i++)
340
-                {
341
-                  $outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
342
-                  $outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
343
-                }
323
+        foreach ($school->programs as $program) {
324
+            foreach ($program->courses as $course) {
325
+                if ($course->outcomes_achieved != NULL) {
326
+                    $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
327
+                    $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
328
+                    for ($i = 1; $i <= count($outcomes_attempted); $i++) {
329
+                        $outcomes_achieved[$i] += $course_outcomes_achieved[$i];
330
+                        $outcomes_attempted[$i] += $course_outcomes_attempted[$i];
331
+                    }
344
 
332
 
345
-                $assessed_sections_count+=1;
346
-              }
347
-              $school_sections_count+=1;
333
+                    $assessed_sections_count += 1;
334
+                }
335
+                $school_sections_count += 1;
348
             }
336
             }
349
         }
337
         }
350
 
338
 
362
 
350
 
363
 
351
 
364
         // For each outcome
352
         // For each outcome
365
-        foreach ($outcomes as $outcome)
366
-        {
353
+        foreach ($outcomes as $outcome) {
367
             // For each program with courses that do assessment
354
             // For each program with courses that do assessment
368
-            foreach (Program::with(array('courses' => function($query){
369
-//                 $query->whereNotNull('outcomes_attempted');
355
+            foreach (Program::with(array('courses' => function ($query) {
356
+                //                 $query->whereNotNull('outcomes_attempted');
370
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
357
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
371
-            }))->where('school_id', $school->id)->orderBy('name', 'asc')->get() as $program)
372
-            {
358
+            }))->where('school_id', $school->id)->orderBy('name', 'asc')->get() as $program) {
373
                 // To acummulate all criteria for one program
359
                 // To acummulate all criteria for one program
374
                 $achieved_outcomes_per_program = array_fill(1, $outcomeCount, 0);
360
                 $achieved_outcomes_per_program = array_fill(1, $outcomeCount, 0);
375
                 $attempted_outcomes_per_program = array_fill(1, $outcomeCount, 0);
361
                 $attempted_outcomes_per_program = array_fill(1, $outcomeCount, 0);
376
 
362
 
377
                 //Flag for counting programs
363
                 //Flag for counting programs
378
-                $flag =false;
364
+                $flag = false;
379
 
365
 
380
                 // For each course in the program
366
                 // For each course in the program
381
-                foreach ($program->courses as $course)
382
-                {
367
+                foreach ($program->courses as $course) {
383
                     // If the outcome in question is being evaluated
368
                     // If the outcome in question is being evaluated
384
                     $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
369
                     $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
385
                     $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
370
                     $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
386
-                    if(array_key_exists($outcome->id, $course_outcomes_attempted2 )
387
-                        && $course_outcomes_attempted2[$outcome->id]>0)
388
-                    {
389
-                        $achieved_outcomes_per_program[$outcome->id]+=$course_outcomes_achieved2[$outcome->id];
390
-                        $attempted_outcomes_per_program[$outcome->id]+=$course_outcomes_attempted2[$outcome->id];
371
+                    if (
372
+                        array_key_exists($outcome->id, $course_outcomes_attempted2)
373
+                        && $course_outcomes_attempted2[$outcome->id] > 0
374
+                    ) {
375
+                        $achieved_outcomes_per_program[$outcome->id] += $course_outcomes_achieved2[$outcome->id];
376
+                        $attempted_outcomes_per_program[$outcome->id] += $course_outcomes_attempted2[$outcome->id];
391
 
377
 
392
                         // Add one to the programs assessing, if it wasn't added before
378
                         // Add one to the programs assessing, if it wasn't added before
393
-                        if(!$flag)
394
-                        {
395
-                            $attemptedProgramsPerOutcome[$outcome->id]+=1;
396
-                            $flag= true;
379
+                        if (!$flag) {
380
+                            $attemptedProgramsPerOutcome[$outcome->id] += 1;
381
+                            $flag = true;
397
                         }
382
                         }
398
                     }
383
                     }
399
 
384
 
402
 
387
 
403
                 }
388
                 }
404
                 //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
389
                 //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
405
-                if($attempted_outcomes_per_program[$outcome->id]!=0 && (float)$achieved_outcomes_per_program[$outcome->id]/$attempted_outcomes_per_program[$outcome->id]*100 >= $outcome->expected_outcome)
406
-                {
407
-                    $achievedProgramsPerOutcome[$outcome->id]+=1;
390
+                if ($attempted_outcomes_per_program[$outcome->id] != 0 && (float)$achieved_outcomes_per_program[$outcome->id] / $attempted_outcomes_per_program[$outcome->id] * 100 >= $outcome->expected_outcome) {
391
+                    $achievedProgramsPerOutcome[$outcome->id] += 1;
408
                     // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
392
                     // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
409
                 }
393
                 }
410
             }
394
             }
411
         }
395
         }
412
 
396
 
413
-       return View::make('local.managers.shared.print_school', compact('title', 'outcomes', 'outcomes_attempted', 'outcomes_achieved', 'school', 'assessed_sections_count', 'school_sections_count', 'achievedProgramsPerOutcome', 'attemptedProgramsPerOutcome', 'grouped_courses', 'participating_programs'));
397
+        return View::make('local.managers.shared.print_school', compact('title', 'outcomes', 'outcomes_attempted', 'outcomes_achieved', 'school', 'assessed_sections_count', 'school_sections_count', 'achievedProgramsPerOutcome', 'attemptedProgramsPerOutcome', 'grouped_courses', 'participating_programs'));
414
     }
398
     }
415
-
416
 }
399
 }

+ 2
- 1
app/models/Activity.php View File

198
     return $outcomes_achieved;
198
     return $outcomes_achieved;
199
   }
199
   }
200
 
200
 
201
-  // o_att_array
201
+
202
   public function is_assessed()
202
   public function is_assessed()
203
   {
203
   {
204
     $all_criterion = DB::table('activity_criterion')
204
     $all_criterion = DB::table('activity_criterion')
235
     else return '';
235
     else return '';
236
   }
236
   }
237
 
237
 
238
+  // o_att_array
238
 
239
 
239
   public function getOAttArrayAttribute()
240
   public function getOAttArrayAttribute()
240
   {
241
   {

+ 30
- 2
app/views/local/managers/admins/objectives.blade.php View File

4
 @include('local.managers.admins._navigation')
4
 @include('local.managers.admins._navigation')
5
 @stop
5
 @stop
6
 @section('main')
6
 @section('main')
7
+<div class="row">
8
+    <div class="col-md-12" id = 'message'>
7
 
9
 
10
+    </div>
11
+    </div>
8
 <div class="row">
12
 <div class="row">
9
     <div class="col-md-6">
13
     <div class="col-md-6">
10
         <!-- Form to add a new objective -->
14
         <!-- Form to add a new objective -->
524
                 text:text,
528
                 text:text,
525
                 id:id
529
                 id:id
526
             },
530
             },
527
-   function(){
528
-       location.reload(true);
531
+            function($array){
532
+       div = $('<div/>', {
533
+           'class':'alert alert-dismissible alert-'+$array.status,
534
+           'role':'alert'
535
+       })
536
+       button = $('<button/>', {
537
+           'class':'close',
538
+           'type':'button',
539
+           'data-dismiss':'alert',
540
+           'aria-label':'Close'
541
+
542
+       }).html('<span aria-hidden="true">&times;</span>');
543
+       div.append(button);
544
+       if($array.status == 'danger'){
545
+       span = $('<span/>',{
546
+           'class':'glyphicon glyphicon-remove-sign'
547
+       });
548
+       }
549
+       else{
550
+        span = $('<span/>',{
551
+           'class':'glyphicon glyphicon-ok-sign'
552
+       });
553
+       }
554
+       div.append(span);
555
+    div.append($array.message);
556
+    div.appendTo('#message');
529
    }
557
    }
530
         )
558
         )
531
     })
559
     })

+ 31
- 3
app/views/local/managers/pCoords/objectives.blade.php View File

4
 @include('local.managers.pCoords._navigation')
4
 @include('local.managers.pCoords._navigation')
5
 @stop
5
 @stop
6
 @section('main')
6
 @section('main')
7
+<div class="row">
8
+    <div class="col-md-12" id = 'message'>
7
 
9
 
10
+    </div>
11
+    </div>
8
 <div class="row">
12
 <div class="row">
9
     <div class="col-md-6">
13
     <div class="col-md-6">
10
         <!-- Form to add a new objective -->
14
         <!-- Form to add a new objective -->
16
                 {{ Form::open(array('action' => 'Objective2Controller@create' )) }}
20
                 {{ Form::open(array('action' => 'Objective2Controller@create' )) }}
17
                 <div id='outcomeGroup'>
21
                 <div id='outcomeGroup'>
18
                     <label> Associated Outcome</label>
22
                     <label> Associated Outcome</label>
19
-                    <div class="form-group col-md-11" id='outcomeForm='>
23
+                    <div class="form-group col-md-11" id='outcomeForm'>
20
 
24
 
21
 
25
 
22
                         <select id="outcome[0]" name="outcome[0]" class="form-control selectpicker">
26
                         <select id="outcome[0]" name="outcome[0]" class="form-control selectpicker">
549
                 text:text,
553
                 text:text,
550
                 id:id
554
                 id:id
551
             },
555
             },
552
-   function(){
553
-       location.reload(true);
556
+            function($array){
557
+       div = $('<div/>', {
558
+           'class':'alert alert-dismissible alert-'+$array.status,
559
+           'role':'alert'
560
+       })
561
+       button = $('<button/>', {
562
+           'class':'close',
563
+           'type':'button',
564
+           'data-dismiss':'alert',
565
+           'aria-label':'Close'
566
+
567
+       }).html('<span aria-hidden="true">&times;</span>');
568
+       div.append(button);
569
+       if($array.status == 'danger'){
570
+       span = $('<span/>',{
571
+           'class':'glyphicon glyphicon-remove-sign'
572
+       });
573
+       }
574
+       else{
575
+        span = $('<span/>',{
576
+           'class':'glyphicon glyphicon-ok-sign'
577
+       });
578
+       }
579
+       div.append(span);
580
+    div.append($array.message);
581
+    div.appendTo('#message');
554
    }
582
    }
555
         )
583
         )
556
     })
584
     })

+ 1
- 2
app/views/local/managers/sCoords/criteria.blade.php View File

1176
 
1176
 
1177
 
1177
 
1178
 
1178
 
1179
-            },
1180
-            'json'
1179
+            }
1181
         );
1180
         );
1182
     }
1181
     }
1183
 </script>@stop
1182
 </script>@stop

+ 30
- 2
app/views/local/managers/sCoords/objectives.blade.php View File

4
 @include('local.managers.sCoords._navigation')
4
 @include('local.managers.sCoords._navigation')
5
 @stop
5
 @stop
6
 @section('main')
6
 @section('main')
7
+<div class="row">
8
+    <div class="col-md-12" id = 'message'>
7
 
9
 
10
+    </div>
11
+    </div>
8
 <div class="row">
12
 <div class="row">
9
     <div class="col-md-6">
13
     <div class="col-md-6">
10
         <!-- Form to add a new objective -->
14
         <!-- Form to add a new objective -->
529
                 text:text,
533
                 text:text,
530
                 id:id
534
                 id:id
531
             },
535
             },
532
-   function(){
533
-       location.reload(true);
536
+   function($array){
537
+       div = $('<div/>', {
538
+           'class':'alert alert-dismissible alert-'+$array.status,
539
+           'role':'alert'
540
+       })
541
+       button = $('<button/>', {
542
+           'class':'close',
543
+           'type':'button',
544
+           'data-dismiss':'alert',
545
+           'aria-label':'Close'
546
+
547
+       }).html('<span aria-hidden="true">&times;</span>');
548
+       div.append(button);
549
+       if($array.status == 'danger'){
550
+       span = $('<span/>',{
551
+           'class':'glyphicon glyphicon-remove-sign'
552
+       });
553
+       }
554
+       else{
555
+        span = $('<span/>',{
556
+           'class':'glyphicon glyphicon-ok-sign'
557
+       });
558
+       }
559
+       div.append(span);
560
+    div.append($array.message);
561
+    div.appendTo('#message');
534
    }
562
    }
535
         )
563
         )
536
     })
564
     })

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

376
 
376
 
377
 
377
 
378
 // Enable fixed headers
378
 // Enable fixed headers
379
-$('#assessment-table').stickyTableHeaders();
379
+//$('#assessment-table').stickyTableHeaders();
380
 
380
 
381
 
381
 
382
 // Hide spanish instructions by default
382
 // Hide spanish instructions by default

+ 2
- 2
app/views/local/professors/course.blade.php View File

86
                         <td>{{ date('M d, Y', strtotime($activity->date)) }}</td>
86
                         <td>{{ date('M d, Y', strtotime($activity->date)) }}</td>
87
                         <td>{{ date('M d, Y', strtotime($activity->updated_at)) }}</td>
87
                         <td>{{ date('M d, Y', strtotime($activity->updated_at)) }}</td>
88
                         <td>
88
                         <td>
89
-                            @if($activity->outcomes_attempted!=NULL)
89
+                            @if($activity->o_att_array)
90
                                 <span class="glyphicon glyphicon-ok"></span>
90
                                 <span class="glyphicon glyphicon-ok"></span>
91
                             @endif
91
                             @endif
92
                         </td>
92
                         </td>
93
                         <td>
93
                         <td>
94
-                            @if($activity->outcomes_attempted!=NULL && !$activity->draft)
94
+                            @if($activity->o_att_array && !$activity->draft)
95
                                 <span class="glyphicon glyphicon-ok"></span>
95
                                 <span class="glyphicon glyphicon-ok"></span>
96
                             @endif
96
                             @endif
97
                         </td>
97
                         </td>

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

134
       <td>
134
       <td>
135
         {{{ $criterion->name }}}
135
         {{{ $criterion->name }}}
136
 
136
 
137
-        @if(property_exists($criterion, 'subcriteria'))
137
+        @if($criterion->subcriteria)
138
           <ul class="list-unstyled">
138
           <ul class="list-unstyled">
139
             @foreach(json_decode($criterion->subcriteria) as $subcriterion)
139
             @foreach(json_decode($criterion->subcriteria) as $subcriterion)
140
                 <li>{{ $subcriterion }}</li>
140
                 <li>{{ $subcriterion }}</li>

+ 3
- 2
app/views/local/professors/viewrubric.blade.php View File

46
             <td>
46
             <td>
47
               <span><em data-toggle="tooltip" data-placement="top" title="{{ $criterion->notes }}">{{{ $criterion->name }}}</em></span>
47
               <span><em data-toggle="tooltip" data-placement="top" title="{{ $criterion->notes }}">{{{ $criterion->name }}}</em></span>
48
               <sup></sup>
48
               <sup></sup>
49
-              @if(property_exists($criterion, 'subcriteria'))
49
+              @if($criterion->subcriteria)
50
                 <ul class="list-unstyled">
50
                 <ul class="list-unstyled">
51
+                 
51
                   @foreach(json_decode($criterion->subcriteria) as $subcriterion)
52
                   @foreach(json_decode($criterion->subcriteria) as $subcriterion)
52
                       <li>{{ $subcriterion }}</li>
53
                       <li>{{ $subcriterion }}</li>
53
                   @endforeach
54
                   @endforeach
57
             @else
58
             @else
58
             <td>
59
             <td>
59
               <span>{{{ $criterion->name }}}</span><sup></sup>
60
               <span>{{{ $criterion->name }}}</span><sup></sup>
60
-              @if(property_exists($criterion, 'subcriteria'))
61
+              @if($criterion->subcriteria)
61
                 <ul class="list-unstyled">
62
                 <ul class="list-unstyled">
62
                   @foreach(json_decode($criterion->subcriteria) as $subcriterion)
63
                   @foreach(json_decode($criterion->subcriteria) as $subcriterion)
63
                       <li>{{ $subcriterion }}</li>
64
                       <li>{{ $subcriterion }}</li>