소스 검색

Created new Overview page

For Administrators, show Percent of Students Achieving Learning Outcomes By Academic Session
onielm 3 년 전
부모
커밋
4df236bd00

+ 350
- 35
app/controllers/AdministratorsController.php 파일 보기

@@ -1,7 +1,7 @@
1 1
 <?php
2 2
 
3 3
 class AdministratorsController extends \BaseController
4
-{	
4
+{
5 5
 	private function outcomes_semesters($selected_semesters, $level)
6 6
 	{
7 7
 		$min_start="9000-01-01 00:00:00";
@@ -42,14 +42,14 @@ class AdministratorsController extends \BaseController
42 42
 												   ->orWhere("level",3);
43 43
 										})
44 44
 								->count();
45
-	
45
+
46 46
 		foreach($outcomes as $outcome)
47 47
 		{
48
-			
48
+
49 49
 // 		var_dump($outcome->id);
50 50
 // 		print "<br>";
51 51
 			$outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semesters, $level);
52
-			$outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semesters, $level);	
52
+			$outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semesters, $level);
53 53
 		}
54 54
 
55 55
         $uhs_school_id = School::where('name', 'LIKE', '%UHS%')->first()->id;
@@ -91,34 +91,34 @@ class AdministratorsController extends \BaseController
91 91
 				}
92 92
 			}
93 93
 		}
94
-	
94
+
95 95
 		return array('outcomes'=>$outcomes,'outcomes_attempted'=>$outcomes_attempted, 'outcomes_achieved'=>$outcomes_achieved, 'attemptedProgramsPerOutcome'=>$attemptedProgramsPerOutcome, 'achievedProgramsPerOutcome'=>$achievedProgramsPerOutcome,'participating_programs'=>$participating_programs);
96
-	
97
-	
98
-	
96
+
97
+
98
+
99 99
 	}
100 100
     public function overview()
101 101
     {
102
-    
102
+
103 103
         $selected_semesters = Semester::find(Session::get('semesters_ids'));
104
-        
104
+
105 105
 		$subgraduado=$this->outcomes_semesters($selected_semesters,0);
106 106
         $outcomes_subgrad=$subgraduado['outcomes'];
107
-        $undergrad_outcomes_achieved=$subgraduado['outcomes_achieved']; 
108
-        $undergrad_outcomes_attempted=$subgraduado['outcomes_attempted']; 
109
-        $attemptedUndergradProgramsPerOutcome=$subgraduado['attemptedProgramsPerOutcome']; 
110
-        $achievedUndergradProgramsPerOutcome=$subgraduado['achievedProgramsPerOutcome']; 
111
-        $participating_undergrad_programs=$subgraduado['participating_programs']; 
112
-		
113
-		
107
+        $undergrad_outcomes_achieved=$subgraduado['outcomes_achieved'];
108
+        $undergrad_outcomes_attempted=$subgraduado['outcomes_attempted'];
109
+        $attemptedUndergradProgramsPerOutcome=$subgraduado['attemptedProgramsPerOutcome'];
110
+        $achievedUndergradProgramsPerOutcome=$subgraduado['achievedProgramsPerOutcome'];
111
+        $participating_undergrad_programs=$subgraduado['participating_programs'];
112
+
113
+
114 114
 		$graduado=$this->outcomes_semesters($selected_semesters,1);
115 115
         $outcomes_grad=$graduado['outcomes'];
116
-        $grad_outcomes_achieved=$graduado['outcomes_achieved']; 
117
-        $grad_outcomes_attempted=$graduado['outcomes_attempted']; 
118
-        $attemptedGradProgramsPerOutcome=$graduado['attemptedProgramsPerOutcome']; 
119
-        $achievedGradProgramsPerOutcome=$graduado['achievedProgramsPerOutcome']; 
120
-        $participating_grad_programs=$graduado['participating_programs']; 
121
-		
116
+        $grad_outcomes_achieved=$graduado['outcomes_achieved'];
117
+        $grad_outcomes_attempted=$graduado['outcomes_attempted'];
118
+        $attemptedGradProgramsPerOutcome=$graduado['attemptedProgramsPerOutcome'];
119
+        $achievedGradProgramsPerOutcome=$graduado['achievedProgramsPerOutcome'];
120
+        $participating_grad_programs=$graduado['participating_programs'];
121
+
122 122
         //Total amount of learning outcomes
123 123
 //         $outcomeCount = Outcome::withTrashed()->count();
124 124
 //         $selected_semester = Semester::find(Session::get('semesters_ids')[0]);
@@ -147,7 +147,7 @@ class AdministratorsController extends \BaseController
147 147
 //         									    		   ->orWhere("level",3);
148 148
 //         									    })
149 149
 //         								->count();
150
-// 
150
+//
151 151
 //         $outcomes_grad = Outcome::where(function($query) use ($selected_semester){$query->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null);})->where(function($query2){$query2->where("level",2)->orWhere("level",3);})->orderBy('name', 'ASC')->get();
152 152
 //         $outcomeCount_grad = Outcome::where(function($query) use ($selected_semester){$query->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null);})->where(function($query2){$query2->where("level",2)->orWhere("level",3);})->count();
153 153
 
@@ -159,21 +159,21 @@ class AdministratorsController extends \BaseController
159 159
 
160 160
         $schools = School::where('id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get();
161 161
         $title = 'Campus Overview';
162
-        
163
-        
162
+
163
+
164 164
         /**
165 165
          * Calculate campus wide outcome performance by counting the number of students
166
-         $undergrad_outcomes_attempted will have the number of criteria that was assessed in undergradute courses during the selected semester 
167
-         $undergrad_outcomes_achieved will have the number of criteria that was assessed in undergradute courses  during the selected semester 
166
+         $undergrad_outcomes_attempted will have the number of criteria that was assessed in undergradute courses during the selected semester
167
+         $undergrad_outcomes_achieved will have the number of criteria that was assessed in undergradute courses  during the selected semester
168 168
             where the percentage of students that obtained a better or equal score than the expected_student_score established in the
169 169
             activity_criterion table is greater or equal than the expected_percentage_students_achieving also established in the
170
-            activity_criterion table         
170
+            activity_criterion table
171 171
          */
172 172
 
173 173
 // 		foreach($outcomes_subgrad as $outcome)
174 174
 // 		{
175 175
 // 			$undergrad_outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semester->id,0);
176
-// 			$undergrad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,0);	
176
+// 			$undergrad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,0);
177 177
 // 		}
178 178
 // 		var_dump($undergrad_outcomes_attempted);
179 179
 // 		print"<br>";
@@ -182,7 +182,7 @@ class AdministratorsController extends \BaseController
182 182
 // 		foreach($outcomes_grad as $outcome)
183 183
 // 		{
184 184
 // 			$grad_outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semester->id,1);
185
-// 			$grad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,1);			
185
+// 			$grad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,1);
186 186
 // 		}
187 187
 
188 188
         /**
@@ -221,7 +221,7 @@ class AdministratorsController extends \BaseController
221 221
 //             }))->where('is_graduate', 0)->where('school_id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get() as $program)
222 222
 //             {
223 223
 //             	$participating_undergrad_programs[$program->id]=(object)array('id'=>$program->id, 'name'=>$program->name, 'is_graduate'=> $program->is_graduate, 'school_id'=>$program->school_id,'semestre_id',$selected_semester);
224
-// 
224
+//
225 225
 // // 				SELECT ac.id activity_criterion_id, ac.activity_id, ac.expected_student_score, ac.expected_percentage_students_achieving, co.program_id FROM activity_criterion ac, new_criteria c, activities a, objectives o, courses co where co.id=a.course_id and co.semester_id=13 and a.id=ac.activity_id and c.id = ac.criterion_id and o.id=c.objective_id and o.outcome_id = 2 order by program_id
226 226
 // 				$program_attempted_outcome=$program->attempted_outcome($outcome->id, $selected_semester->id);
227 227
 // 				$attempted_outcomes_per_undergrad_program[$outcome->id]+=$program_attempted_outcome;
@@ -250,11 +250,11 @@ class AdministratorsController extends \BaseController
250 250
 // 		exit();
251 251
         /**
252 252
          * Calculate how many grad programs achieved and attempted each outcome
253
-         $grad_outcomes_attempted will have the number of criteria that was assessed in gradute courses during the selected semester 
254
-         $grad_outcomes_achieved will have the number of criteria that was assessed in gradute courses  during the selected semester 
253
+         $grad_outcomes_attempted will have the number of criteria that was assessed in gradute courses during the selected semester
254
+         $grad_outcomes_achieved will have the number of criteria that was assessed in gradute courses  during the selected semester
255 255
             where the percentage of students that obtained a better or equal score than the expected_student_score established in the
256 256
             activity_criterion table is greater or equal than the expected_percentage_students_achieving also established in the
257
-            activity_criterion table         
257
+            activity_criterion table
258 258
          */
259 259
 
260 260
 
@@ -303,4 +303,319 @@ class AdministratorsController extends \BaseController
303 303
 // 		exit();
304 304
         return View::make('local.managers.admins.overview', compact('title', 'schools', 'outcomes_subgrad', 'outcomes_grad', 'undergrad_outcomes_achieved', 'undergrad_outcomes_attempted', 'grad_outcomes_achieved', 'grad_outcomes_attempted', 'attemptedUndergradProgramsPerOutcome', 'participating_undergrad_programs', 'achievedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'participating_grad_programs', 'achievedGradProgramsPerOutcome'));
305 305
     }
306
+
307
+
308
+    public function overview2()
309
+    {
310
+			// '''
311
+			//stucture of outcomes array:
312
+			//
313
+			// $outcome->id
314
+			// $outcome->name
315
+			// $outcome->semesters
316
+			//
317
+			// $outcome->semesters[i]->id
318
+			// $outcome->semesters[i]->code
319
+			// $outcome->semesters[i]->name
320
+			// $outcome->semesters[i]->tested
321
+			// $outcome->semesters[i]->achievers
322
+			// '''
323
+      $selected_semesters = Semester::find(Session::get('semesters_ids'));
324
+			$title = 'Overview2';
325
+
326
+			$semesters = DB::table('overview')
327
+          ->join('semesters','semesters.id','=','overview.semester_id')
328
+          ->select('semesters.name', 'semesters.code')
329
+					->orderBy('semesters.code', 'asc')
330
+					->groupBy('semesters.id')
331
+          ->get();
332
+			$outcomes = DB::table('overview')
333
+          ->join('outcomes','outcomes.id','=','overview.outcome_id')
334
+          ->selectRaw('outcomes.name, overview.outcome_id as id, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
335
+					->orderBy('outcomes.name', 'asc')
336
+					->groupBy('overview.outcome_id')
337
+          ->get();
338
+			foreach ($outcomes as $outcome) {
339
+				$outcome->semesters = DB::table('overview')
340
+	          ->join('semesters','semesters.id','=','overview.semester_id')
341
+						->where('overview.outcome_id', $outcome->id)
342
+						->selectRaw('semesters.id, semesters.name, semesters.code, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
343
+						->orderBy('semesters.code', 'asc')
344
+						->groupBy('overview.outcome_id')
345
+						->groupBy('overview.semester_id')
346
+	          ->get();
347
+			}
348
+
349
+			$filters = array();
350
+			$filters['school'] = DB::table('overview')
351
+          ->join('programs','programs.id','=','overview.program_id')
352
+          ->join('schools','schools.id','=','programs.school_id')
353
+					->select('schools.id','schools.name')
354
+					->orderBy('schools.name', 'asc')
355
+					->groupBy('schools.id')
356
+          ->get();
357
+
358
+			$filters['program'] = DB::table('overview')
359
+          ->join('programs','programs.id','=','overview.program_id')
360
+					->select('programs.id','programs.name')
361
+					->orderBy('programs.name', 'asc')
362
+					->groupBy('overview.program_id')
363
+          ->get();
364
+
365
+			$filters['semester'] = DB::table('overview')
366
+          ->join('semesters','semesters.id','=','overview.semester_id')
367
+          ->select('semesters.id','semesters.name','semesters.code')
368
+					->orderBy('semesters.code', 'asc')
369
+					->groupBy('overview.semester_id')
370
+          ->get();
371
+
372
+			$filters['year'] = DB::table('overview')//
373
+          ->join('semesters','semesters.id','=','overview.semester_id')
374
+          ->select('semesters.id','semesters.start')
375
+					->orderBy('semesters.code', 'asc')
376
+					->groupBy('overview.semester_id')
377
+          ->get();
378
+
379
+			$filters['outcome'] = DB::table('overview')
380
+          ->join('outcomes','outcomes.id','=','overview.outcome_id')
381
+          ->select('outcomes.id','outcomes.name')
382
+					->orderBy('outcomes.name', 'asc')
383
+					->groupBy('overview.outcome_id')
384
+          ->get();
385
+
386
+			$target = 0.70;
387
+
388
+      return View::make('local.managers.admins.overview2', compact('title','selected_semesters','outcomes','semesters','filters','target'));
389
+    }
390
+
391
+		// this is called when filters are changed
392
+    public function overview2_filter_results()
393
+    {
394
+
395
+			// selected filter data
396
+			$schools = Input::get('schools');
397
+			$programs = Input::get('programs');
398
+			$semesters = Input::get('semesters');
399
+			$years = Input::get('years');
400
+			$outcomes = Input::get('outcomes');
401
+
402
+
403
+			// make an array id's of schools selected. if All, use All available id's
404
+			if ($schools == array("0")){
405
+				$result = DB::table('overview')
406
+						->join('programs','programs.id','=','overview.program_id')
407
+						->join('schools','schools.id','=','programs.school_id')
408
+						->select('schools.id')
409
+						->orderBy('schools.name', 'asc')
410
+						->groupBy('schools.id')
411
+						->get();
412
+				$schools_id = array();
413
+				foreach ($result as $school) {
414
+					array_push($schools_id,$school->id);
415
+				}
416
+			}else {
417
+				$schools_id = array();
418
+				foreach ($schools as $school_id) {
419
+					array_push($schools_id,intval($school_id));
420
+				}
421
+			}
422
+			// make an array id's of programs selected. if All, use All available id's
423
+			if ($programs == array("0")){
424
+				$result = DB::table('overview')
425
+	          ->join('programs','programs.id','=','overview.program_id')
426
+						->select('programs.id')
427
+						->orderBy('programs.name', 'asc')
428
+						->groupBy('overview.program_id')
429
+	          ->get();
430
+				$programs_id = array();
431
+				foreach ($result as $program) {
432
+					array_push($programs_id,$program->id);
433
+				}
434
+			}else {
435
+				$programs_id = array();
436
+				foreach ($programs as $program_id) {
437
+					array_push($programs_id,intval($program_id));
438
+				}
439
+			}
440
+			// make an array id's of semesters selected. if All, use All available id's
441
+			if ($semesters == array("0")){
442
+				$result = DB::table('overview')
443
+	          ->join('semesters','semesters.id','=','overview.semester_id')
444
+	          ->select('semesters.id')
445
+						->orderBy('semesters.code', 'asc')
446
+						->groupBy('overview.semester_id')
447
+	          ->get();
448
+				$semesters_id = array();
449
+				foreach ($result as $semester) {
450
+					array_push($semesters_id,$semester->id);
451
+				}
452
+			}else {
453
+				$semesters_id = array();
454
+				foreach ($semesters as $semester_id) {
455
+					array_push($semesters_id,intval($semester_id));
456
+				}
457
+			}
458
+			// make an array id's of years selected. if All, use All available id's
459
+			if ($years == array("0")){
460
+				$result = DB::table('overview')//
461
+	          ->join('semesters','semesters.id','=','overview.semester_id')
462
+	          ->select('semesters.id')
463
+						->orderBy('semesters.code', 'asc')
464
+						->groupBy('overview.semester_id')
465
+	          ->get();
466
+				$years_id = array();
467
+				foreach ($result as $year) {
468
+					array_push($years_id,$year->id);
469
+				}
470
+			}else {
471
+				$years_id = array();
472
+				foreach ($years as $year_id) {
473
+					array_push($years_id,intval($year_id));
474
+				}
475
+			}
476
+			// make an array id's of outcomes selected. if All, use All available id's
477
+			if ($outcomes == array("0")){
478
+				$result = DB::table('overview')
479
+	          ->join('outcomes','outcomes.id','=','overview.outcome_id')
480
+	          ->select('outcomes.id')
481
+						->orderBy('outcomes.name', 'asc')
482
+						->groupBy('overview.outcome_id')
483
+	          ->get();
484
+				$outcomes_id = array();
485
+				foreach ($result as $outcome) {
486
+					array_push($outcomes_id,$outcome->id);
487
+				}
488
+			}else {
489
+				$outcomes_id = array();
490
+				foreach ($outcomes as $outcome_id) {
491
+					array_push($outcomes_id,intval($outcome_id));
492
+				}
493
+			}
494
+
495
+
496
+			// get data for graph
497
+			$semesters = DB::table('overview')
498
+					->join('programs','programs.id','=','overview.program_id')
499
+					->join('schools','schools.id','=','programs.school_id')
500
+					->join('semesters','semesters.id','=','overview.semester_id')
501
+					->join('outcomes','outcomes.id','=','overview.outcome_id')
502
+					->whereIn('schools.id',$schools_id)
503
+					->whereIn('programs.id',$programs_id)
504
+					->whereIn('semesters.id',$semesters_id)
505
+					// ->whereIn('years.id',$years_id)
506
+					->whereIn('outcomes.id',$outcomes_id)
507
+          ->select('semesters.name', 'semesters.code')
508
+					->orderBy('semesters.code', 'asc')
509
+					->groupBy('semesters.id')
510
+					->get();
511
+			$outcomes = DB::table('overview')
512
+					->join('programs','programs.id','=','overview.program_id')
513
+					->join('schools','schools.id','=','programs.school_id')
514
+					->join('semesters','semesters.id','=','overview.semester_id')
515
+					->join('outcomes','outcomes.id','=','overview.outcome_id')
516
+					->whereIn('schools.id',$schools_id)
517
+					->whereIn('programs.id',$programs_id)
518
+					->whereIn('semesters.id',$semesters_id)
519
+					// ->whereIn('years.id',$years_id)
520
+					->whereIn('outcomes.id',$outcomes_id)
521
+          ->selectRaw('outcomes.name, overview.outcome_id as id, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
522
+					->orderBy('outcomes.name', 'asc')
523
+					->groupBy('overview.outcome_id')
524
+					->get();
525
+			foreach ($outcomes as $outcome) {
526
+				$outcome->semesters = DB::table('overview')
527
+						->join('programs','programs.id','=','overview.program_id')
528
+						->join('schools','schools.id','=','programs.school_id')
529
+						->join('semesters','semesters.id','=','overview.semester_id')
530
+						->join('outcomes','outcomes.id','=','overview.outcome_id')
531
+						->whereIn('schools.id',$schools_id)
532
+						->whereIn('programs.id',$programs_id)
533
+						->whereIn('semesters.id',$semesters_id)
534
+						// ->whereIn('years.id',$years_id)
535
+						->whereIn('outcomes.id',$outcomes_id)
536
+						->where('overview.outcome_id', $outcome->id)
537
+						->selectRaw('semesters.id, semesters.name, semesters.code, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
538
+						->orderBy('semesters.code', 'asc')
539
+						->groupBy('overview.outcome_id')
540
+						->groupBy('overview.semester_id')
541
+						->get();
542
+			}
543
+
544
+			// get data for filters
545
+			$filters = array();
546
+			$filters['school'] = DB::table('overview')
547
+					->join('programs','programs.id','=','overview.program_id')
548
+					->join('schools','schools.id','=','programs.school_id')
549
+					->join('semesters','semesters.id','=','overview.semester_id')
550
+					->join('outcomes','outcomes.id','=','overview.outcome_id')
551
+					->whereIn('schools.id',$schools_id)
552
+					->whereIn('programs.id',$programs_id)
553
+					->whereIn('semesters.id',$semesters_id)
554
+					// ->whereIn('years.id',$years_id)
555
+					->whereIn('outcomes.id',$outcomes_id)
556
+					->select('schools.id','schools.name')
557
+					->orderBy('schools.name', 'asc')
558
+					->groupBy('schools.id')
559
+					->get();
560
+			$filters['program'] = DB::table('overview')
561
+					->join('programs','programs.id','=','overview.program_id')
562
+					->join('schools','schools.id','=','programs.school_id')
563
+					->join('semesters','semesters.id','=','overview.semester_id')
564
+					->join('outcomes','outcomes.id','=','overview.outcome_id')
565
+					->whereIn('schools.id',$schools_id)
566
+					// ->whereIn('programs.id',$programs_id)
567
+					->whereIn('semesters.id',$semesters_id)
568
+					// ->whereIn('years.id',$years_id)
569
+					->whereIn('outcomes.id',$outcomes_id)
570
+					->select('programs.id','programs.name')
571
+					->orderBy('programs.name', 'asc')
572
+					->groupBy('overview.program_id')
573
+					->get();
574
+			$filters['semester'] = DB::table('overview')
575
+					->join('programs','programs.id','=','overview.program_id')
576
+					->join('schools','schools.id','=','programs.school_id')
577
+					->join('semesters','semesters.id','=','overview.semester_id')
578
+					->join('outcomes','outcomes.id','=','overview.outcome_id')
579
+					->whereIn('schools.id',$schools_id)
580
+					->whereIn('programs.id',$programs_id)
581
+					// ->whereIn('semesters.id',$semesters_id)
582
+					// ->whereIn('years.id',$years_id)
583
+					->whereIn('outcomes.id',$outcomes_id)
584
+					->select('semesters.id','semesters.name','semesters.code')
585
+					->orderBy('semesters.code', 'asc')
586
+					->groupBy('overview.semester_id')
587
+					->get();
588
+			$filters['year'] = DB::table('overview')////////////////////////////////////////////
589
+					->join('programs','programs.id','=','overview.program_id')
590
+					->join('schools','schools.id','=','programs.school_id')
591
+					->join('semesters','semesters.id','=','overview.semester_id')
592
+					->join('outcomes','outcomes.id','=','overview.outcome_id')
593
+					->whereIn('schools.id',$schools_id)
594
+					->whereIn('programs.id',$programs_id)
595
+					->whereIn('semesters.id',$semesters_id)
596
+					// ->whereIn('years.id',$years_id)
597
+					->whereIn('outcomes.id',$outcomes_id)
598
+
599
+					->get();
600
+			$filters['outcome'] = DB::table('overview')
601
+					->join('programs','programs.id','=','overview.program_id')
602
+					->join('schools','schools.id','=','programs.school_id')
603
+					->join('semesters','semesters.id','=','overview.semester_id')
604
+					->join('outcomes','outcomes.id','=','overview.outcome_id')
605
+					->whereIn('schools.id',$schools_id)
606
+					->whereIn('programs.id',$programs_id)
607
+					->whereIn('semesters.id',$semesters_id)
608
+					// ->whereIn('years.id',$years_id)
609
+					// ->whereIn('outcomes.id',$outcomes_id)
610
+					->select('outcomes.id','outcomes.name')
611
+					->orderBy('outcomes.name', 'asc')
612
+					->groupBy('overview.outcome_id')
613
+          ->get();
614
+
615
+			return array(
616
+				"semesters" => $semesters,
617
+				"outcomes_info" => $outcomes,
618
+				"filters" => $filters,
619
+			);
620
+    }
306 621
 }

+ 55
- 0
app/database/migrations/2021_05_18_102422_create_overview_table.php 파일 보기

@@ -0,0 +1,55 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateOverviewTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		//
16
+		Schema::create('overview', function (Blueprint $table) {
17
+			$table->increments('id');
18
+
19
+			$table->integer('program_id')->unsigned();
20
+			$table->foreign('program_id')
21
+				->references('id')
22
+				->on('programs')
23
+				->onDelete('cascade')
24
+				->onUpdate('cascade');
25
+			$table->integer('outcome_id')->unsigned();
26
+			$table->foreign('outcome_id')
27
+				->references('id')
28
+				->on('outcomes')
29
+				->onDelete('cascade')
30
+				->onUpdate('cascade');
31
+			$table->integer('semester_id')->unsigned();
32
+			$table->foreign('semester_id')
33
+				->references('id')
34
+				->on('semesters')
35
+				->onDelete('cascade')
36
+				->onUpdate('cascade');
37
+
38
+			$table->integer('total_evaluated')->unsigned();
39
+			$table->integer('total_achieved')->unsigned();
40
+		});
41
+	}
42
+
43
+	/**
44
+	 * Reverse the migrations.
45
+	 *
46
+	 * @return void
47
+	 */
48
+	public function down()
49
+	{
50
+		//
51
+		Schema::drop('overview');
52
+
53
+	}
54
+
55
+}

+ 2
- 0
app/routes.php 파일 보기

@@ -256,6 +256,8 @@ Route::group(array('before' => 'auth|has_access'), function () {
256 256
      */
257 257
     Route::group(array('before' => 'admin'), function () {
258 258
         Route::get('/administrator', 'AdministratorsController@overview');
259
+        Route::get('/administrator2', 'AdministratorsController@overview2');
260
+        Route::post('/administrator2/filter', 'AdministratorsController@overview2_filter_results');
259 261
         Route::post('administrator/rubrics', array(
260 262
             'as' => 'rubrics',
261 263
             'before' => 'csrf',

+ 5
- 6
app/views/local/managers/admins/_navigation.blade.php 파일 보기

@@ -3,8 +3,7 @@
3 3
 
4 4
     <ul class="nav navbar-nav navbar-right">
5 5
       <li>{{ HTML::linkAction('AdministratorsController@overview', 'Overview') }}</li>
6
-      <li>{{ HTML::linkAction('ThreeYearPlanController@threeYearsReport', 'Three Years Plan') }}</li>
7
-      <li>{{ HTML::linkAction('TransformativeActionsController@editTA', 'Transformative Actions') }}</li>
6
+      <li>{{ HTML::linkAction('AdministratorsController@overview2', 'Overview2') }}</li>
8 7
 
9 8
       <li class="dropdown">
10 9
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Management<span class="caret"></span></a>
@@ -35,7 +34,7 @@
35 34
         </ul>
36 35
       </li>
37 36
       <li>{{ HTML::linkAction('ProgramsController@index', 'Programs') }}</li>
38
-      
37
+
39 38
       @if(count(Auth::user()->courses))
40 39
       <li> {{ HTML::linkAction('ProfessorsController@overview', 'My Courses', NULL) }}</li>
41 40
       <li class="dropdown">
@@ -46,16 +45,16 @@
46 45
           @endforeach
47 46
         </ul>
48 47
       </li>
49
-      
48
+
50 49
       @endif
51
-  
50
+
52 51
       <li class="dropdown">
53 52
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Reports<span class="caret"></span></a>
54 53
         <ul class="dropdown-menu" role="menu">
55 54
           <li>{{ HTML::linkAction('OutcomesController@managerAssessmentReports', 'Campus Reports') }}</li>
56 55
           @if(count(Auth::user()->courses))
57 56
           <li>{{ HTML::linkAction('OutcomesController@professorAssessmentReports', 'My Courses\' Reports') }}</li>
58
-          
57
+
59 58
           @endif
60 59
         </ul>
61 60
       </li>

+ 515
- 0
app/views/local/managers/admins/overview2.blade.php 파일 보기

@@ -0,0 +1,515 @@
1
+@extends('layouts.master')
2
+
3
+@section('navigation')
4
+@include('local.managers.admins._navigation')
5
+@stop
6
+
7
+@section('main')
8
+
9
+<div>
10
+  <div class="">
11
+    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
12
+    <script type="text/javascript">
13
+
14
+    function make_chart(outcomes_info, semesters) {
15
+      //////// Get values ready for chart
16
+      var target_line = {{$target}};
17
+      var x_label = 'Learning Outcomes';
18
+      var y_label = 'Percent of students';
19
+      var outcomes_labels = Array();
20
+      var i = 0;
21
+      outcomes_info.forEach(eachOutcome);
22
+      function eachOutcome(outcome, index) {
23
+        outcomes_labels.push({v: (index+1), f: outcome.name});
24
+        i = i + 1;
25
+      }
26
+
27
+      //
28
+      var outcomes_data = Array();
29
+
30
+      var legend = Array();
31
+      legend.push('');
32
+      legend.push('Target');
33
+      $.each(semesters, function(index, semester){
34
+        var name = semester.name;
35
+        name = name.split(' ');
36
+        var semester_number = name[0];
37
+        var semester_year = name[2];
38
+
39
+        if (semester_number == 'First'){
40
+          semester_number = '1';
41
+        }
42
+        else if (semester_number == 'Second'){
43
+          semester_number = '2';
44
+        }
45
+
46
+        name = semester_year + " Sem " + semester_number;
47
+        legend.push(name);
48
+      });
49
+      outcomes_data.push(legend);
50
+
51
+      //
52
+      var hidden_values = Array();
53
+      hidden_values.push(0);
54
+      hidden_values.push(target_line);
55
+      var k = 0;
56
+      while (k < semesters.length){
57
+        hidden_values.push(null);
58
+        k = k + 1;
59
+      }
60
+
61
+      //
62
+      outcomes_data.push(hidden_values);
63
+
64
+      $.each(outcomes_info, function(index, outcome){
65
+        var temp_outcome_grouping_info = Array();
66
+        temp_outcome_grouping_info.push({v:(index+1),f:"Students acheiving Learning Outcomes"});
67
+        temp_outcome_grouping_info.push(target_line);
68
+
69
+        var i = 0;
70
+        $.each(outcome.semesters, function(index, semester){
71
+
72
+          // if semester is not the same, insert null.
73
+          //  else, insert info from expected semester.
74
+          if(semester.name != semesters[i].name){
75
+            while(semester.name != semesters[i].name && i < semesters.length){
76
+              temp_outcome_grouping_info.push(null);
77
+              i = i + 1;
78
+            }
79
+          }
80
+          i = i + 1;
81
+
82
+          var total = semester.total_evaluated;
83
+          var achievers = semester.total_achieved;
84
+
85
+          var percentage = achievers/total;
86
+          var display_percentage = percentage*100;
87
+          temp_outcome_grouping_info.push({v:percentage,f:'\nAchieved by ' + display_percentage.toFixed(2) + '%\n(' + achievers + ' achievers and ' + total + ' participants)'});
88
+        });
89
+
90
+        var i = temp_outcome_grouping_info.length;
91
+        while(i < semesters.length+2){
92
+          temp_outcome_grouping_info.push(null);
93
+          i = i + 1;
94
+        }
95
+
96
+        outcomes_data.push(temp_outcome_grouping_info);
97
+      });
98
+      var last_hidden_values = [...hidden_values];
99
+      last_hidden_values[0] = i+1;
100
+      outcomes_data.push(last_hidden_values);
101
+
102
+      ////////
103
+      google.charts.load('current', {
104
+        packages: ['corechart']
105
+      }).then(function () {
106
+        var data = google.visualization.arrayToDataTable(outcomes_data);
107
+        // var data = google.visualization.arrayToDataTable([
108
+        //   ['', 'Target', '2020-21 Sem 2', '2021-22 Sem 1', '2021-22 Sem 2'],
109
+        //   [0, 0.80, null, null, null],
110
+        //   [{v:1,f:"Students acheiving Learning Outcomes"}, 0.80, {v:0.8275,f:82.75}, {v:0.9075,f:'\nAchieved by '+(90.75).toString()+'%\n(60 achievers and 80 participants)'}, {v:0.8475,f:84.75}],
111
+        //   [{v:2,f:"Students acheiving Learning Outcomes"}, 0.80, {v:0.7475,f:74.75}, {v:0.8775,f:87.75}, {v:0.9975,f:60.75}],
112
+        //   [{v:3,f:"Students acheiving Learning Outcomes"}, 0.80, {v:0.6875,f:68.75}, {v:0.9175,f:91.75}, {v:0.8475,f:84.75}],
113
+        //   [4, 0.80, null, null, null]
114
+        // ]);
115
+
116
+        var chartDiv = document.getElementById('chart_div');
117
+        var chart = new google.visualization.ColumnChart(chartDiv);
118
+        chart.draw(data, {
119
+          // colors: ['lime', 'magenta'],
120
+          hAxis: {
121
+            title: x_label,
122
+            ticks: outcomes_labels,
123
+            viewWindow: {
124
+              min: 0.5,
125
+              max: outcomes_info.length + 0.5 // el total de outcomes + 0.5
126
+            },
127
+            textStyle : {
128
+              fontSize: 10,
129
+              bold: true,
130
+            }
131
+          },
132
+          legend: 'right',
133
+          series: {
134
+            0: {
135
+              type: 'line'
136
+            }
137
+          },
138
+          title: ' ',
139
+          chartArea: {
140
+            width: '70%',
141
+            // top: 10,
142
+            // height: '50%'
143
+          },
144
+          vAxis: {
145
+            title: y_label,
146
+            format: 'percent',
147
+            viewWindow: {
148
+              min: 0,
149
+              max: 1
150
+            }
151
+          }
152
+        });
153
+      });
154
+    }
155
+
156
+
157
+    // labels for each outcome grouping
158
+    var outcomes_info = <?= json_encode($outcomes, JSON_HEX_TAG); ?>;
159
+    var semesters = <?= json_encode($semesters, JSON_HEX_TAG); ?>;
160
+
161
+    make_chart(outcomes_info,semesters);
162
+
163
+    </script>
164
+    <script src="https://www.gstatic.com/charts/loader.js"></script>
165
+    <div class="">
166
+      <div class="filters">
167
+        <div class="row" style="display: flex;">
168
+          <div class="category" >
169
+            <label for="school">School</label>
170
+            <div class="select">
171
+              <select multiple class="selectpicker" name="school" id="school">
172
+                <option value="0" selected="selected">All</option>
173
+                @foreach ($filters['school'] as $school)
174
+                  <option value="{{$school->id}}">{{$school->name}}</option>
175
+                @endforeach
176
+              </select>
177
+            </div>
178
+          </div>
179
+          <div class="category" >
180
+            <label for="program" >Academic Program</label>
181
+            <div class="select">
182
+              <select multiple class="selectpicker" name="program" id="program">
183
+                <option value="0" selected="selected">All</option>
184
+                @foreach ($filters['program'] as $program)
185
+                  <option value="{{$program->id}}">{{$program->name}}</option>
186
+                @endforeach
187
+              </select>
188
+            </div>
189
+          </div>
190
+        </div>
191
+        <div class="row" style="display: flex;">
192
+          <div class="category" >
193
+            <label for="semester">Semester</label>
194
+            <div class="select">
195
+              <select multiple class="selectpicker" name="semester" id="semester">
196
+                <option value="0" selected="selected">All</option>
197
+                @foreach ($filters['semester'] as $semester)
198
+                  <option value="{{$semester->id}}">{{$semester->name}}</option>
199
+                @endforeach
200
+              </select>
201
+            </div>
202
+          </div>
203
+          <div class="category" >
204
+            <label for="year">Academic Year</label>
205
+            <div class="select">
206
+              <select multiple class="selectpicker" name="year" id="year">
207
+                <option value="0" selected="selected">All</option>
208
+                @foreach ($filters['year'] as $year)
209
+                  <option value="{{$year->id}}">{{$year->start}}</option>
210
+                @endforeach
211
+              </select>
212
+            </div>
213
+          </div>
214
+          <div class="category" >
215
+            <label for="outcome">Learning Outcomes</label>
216
+            <div class="select">
217
+              <select multiple class="selectpicker" name="outcome" id="outcome">
218
+                <option value="0" selected="selected">All</option>
219
+                @foreach ($filters['outcome'] as $outcome)
220
+                  <option value="{{$outcome->id}}">{{$outcome->name}}</option>
221
+                @endforeach
222
+              </select>
223
+            </div>
224
+          </div>
225
+        </div>
226
+      </div>
227
+      <h4 class="container">
228
+        <b>Percent of Students Achieving Learning Outcomes By Academic Session</b>
229
+      </h4>
230
+      <div class="container" style="height:500px; width:1300px;" id="chart_div"></div>
231
+      <div class="" style="padding-left: 25px;">
232
+        <h5>
233
+          <b>Annotation</b>
234
+        </h5>
235
+        The target line represents the expected percent of students achieving the learning outcome({{$target*100}}%).
236
+      </div>
237
+    </div>
238
+  </div>
239
+</div>
240
+
241
+@stop
242
+
243
+@section('included-js')
244
+
245
+<!-- HighCharts -->
246
+<script src="{{ asset('vendor/highcharts/highcharts.js') }}"></script>
247
+
248
+@stop
249
+
250
+@section('javascript')
251
+
252
+
253
+$(document).ready(function()
254
+{
255
+  $("#year").parent().parent().parent().hide();
256
+
257
+
258
+
259
+  // when a filter is focused
260
+  var previous;
261
+  $(".category").find("button").focus(function() {
262
+    previous = Array();
263
+    $(this).parent().find("select option:selected").each(function() {
264
+      previous.push(this.value);
265
+    });
266
+  });
267
+
268
+  // when a filter is changed
269
+  $(".category").find("select").change(function() {
270
+    var new_value = Array();
271
+    $(this).parent().find("select option:selected").each(function() {
272
+      new_value.push(this.value);
273
+    });
274
+
275
+    //if statements so that "All" only can be selected alone and dont allow selecting no options
276
+    if(jQuery.inArray("0",new_value) !== -1 && jQuery.inArray("0",previous) === -1){
277
+      $(this).parent().find("select option:selected").each(function() {
278
+        $(this).removeAttr('selected');
279
+        $(this).parent().val(0);
280
+        //$('.selectpicker').selectpicker('refresh');
281
+        new_value = ["0"];
282
+      });
283
+    }else if(jQuery.inArray("0",new_value) !== -1 && jQuery.inArray("0",previous) !== -1 && new_value.length > previous.length){
284
+      $(this).parent().find("select option:selected").each(function() {
285
+        if(this.value == "0"){
286
+          $(this).removeAttr('selected');
287
+          //$('.selectpicker').selectpicker('refresh');
288
+          new_value = Array(new_value[1]);
289
+        }
290
+      });
291
+    }else if(new_value.length == 0){
292
+      $(this).parent().find("select").val(0);
293
+      //$('.selectpicker').selectpicker('refresh');
294
+      new_value = ["0"];
295
+    }
296
+    previous = new_value;
297
+
298
+
299
+    // get values from all selects
300
+    var schools = $("#school").val();
301
+    var programs = $("#program").val();
302
+    var semesters = $("#semester").val();
303
+    var years = $("#year").val();
304
+    var outcomes = $("#outcome").val();
305
+
306
+    // query the values and get new data for chart
307
+    $.post(
308
+        "{{ URL::action('AdministratorsController@overview2_filter_results') }}",
309
+      {
310
+        schools: (schools),
311
+        programs: (programs),
312
+        semesters: (semesters),
313
+        years: (years),
314
+        outcomes: (outcomes),
315
+      },
316
+      function(data)
317
+      {
318
+        var filters = data.filters;
319
+        var outcomes_info = data.outcomes_info;
320
+        var semesters = data.semesters;
321
+
322
+        //////// update chart
323
+        make_chart(outcomes_info,semesters);
324
+
325
+
326
+        ////////update filters
327
+        var new_all = $('<option/>',{
328
+          'value': "0",
329
+          'html': "All",
330
+        });;
331
+
332
+        {{--
333
+        //update school filter
334
+        var school_filter = $("#school");
335
+        var new_school_options = filters.school;
336
+        school_filter.find("option").remove();
337
+        school_filter.append(new_all.clone(true));
338
+        $.each(new_school_options, function(index, school)
339
+        {
340
+          var value = school.id;
341
+          var html = school.name;
342
+          var new_option = $('<option/>',{
343
+            'value': value,
344
+            'html': html,
345
+          });;
346
+          school_filter.append(new_option);
347
+        });
348
+        --}}
349
+
350
+        //update school filter
351
+        var school_filter = $("#school");
352
+        var school_selected_options = Array();
353
+        school_filter.find("option:selected").each(function() {
354
+          school_selected_options.push(this.value);
355
+        });
356
+        var new_school_options = filters.school;
357
+        school_filter.find("option").remove();
358
+        if(Array("0")[0] == school_selected_options[0]){
359
+          school_filter.append(new_all.clone(true).attr("selected","selected"));
360
+        } else{
361
+          school_filter.append(new_all.clone(true));
362
+        }
363
+        $.each(new_school_options, function(index, school)
364
+        {
365
+          var value = school.id.toString();
366
+          var html = school.name;
367
+          var new_option;
368
+          if(jQuery.inArray(value,school_selected_options) === -1){
369
+            new_option = $('<option/>',{
370
+              'value': value,
371
+              'html': html,
372
+            });;
373
+          }else{
374
+            new_option = $('<option/>',{
375
+              'value': value,
376
+              'html': html,
377
+              'selected': 'selected',
378
+            });;
379
+          }
380
+          school_filter.append(new_option);
381
+        });
382
+
383
+        //update semester filter
384
+        var semester_filter = $("#semester");
385
+        var semester_selected_options = Array();
386
+        semester_filter.find("option:selected").each(function() {
387
+          semester_selected_options.push(this.value);
388
+        });
389
+        var new_semester_options = filters.semester;
390
+        semester_filter.find("option").remove();
391
+        if(Array("0")[0] == semester_selected_options[0]){
392
+          semester_filter.append(new_all.clone(true).attr("selected","selected"));
393
+        } else{
394
+          semester_filter.append(new_all.clone(true));
395
+        }
396
+        $.each(new_semester_options, function(index, semester)
397
+        {
398
+          var value = semester.id.toString();
399
+          var html = semester.name;
400
+          var new_option;
401
+          if(jQuery.inArray(value,semester_selected_options) === -1){
402
+            new_option = $('<option/>',{
403
+              'value': value,
404
+              'html': html,
405
+            });;
406
+          }else{
407
+            new_option = $('<option/>',{
408
+              'value': value,
409
+              'html': html,
410
+              'selected': 'selected',
411
+            });;
412
+          }
413
+          semester_filter.append(new_option);
414
+        });
415
+
416
+        //update program filter
417
+        var program_filter = $("#program");
418
+        var program_selected_options = Array();
419
+        program_filter.find("option:selected").each(function() {
420
+          program_selected_options.push(this.value);
421
+        });
422
+        var new_program_options = filters.program;
423
+        program_filter.find("option").remove();
424
+        if(Array("0")[0] == program_selected_options[0]){
425
+          program_filter.append(new_all.clone(true).attr("selected","selected"));
426
+        } else{
427
+          program_filter.append(new_all.clone(true));
428
+        }
429
+        $.each(new_program_options, function(index, program)
430
+        {
431
+          var value = program.id.toString();
432
+          var html = program.name;
433
+          var new_option;
434
+          if(jQuery.inArray(value,program_selected_options) === -1){
435
+            new_option = $('<option/>',{
436
+              'value': value,
437
+              'html': html,
438
+            });;
439
+          }else{
440
+            new_option = $('<option/>',{
441
+              'value': value,
442
+              'html': html,
443
+              'selected': 'selected',
444
+            });;
445
+          }
446
+          program_filter.append(new_option);
447
+        });
448
+
449
+
450
+        //update outcome filter
451
+        var outcome_filter = $("#outcome");
452
+        var outcome_selected_options = Array();
453
+        outcome_filter.find("option:selected").each(function() {
454
+          outcome_selected_options.push(this.value);
455
+        });
456
+        var new_outcome_options = filters.outcome;
457
+        outcome_filter.find("option").remove();
458
+        if(Array("0")[0] == outcome_selected_options[0]){
459
+          outcome_filter.append(new_all.clone(true).attr("selected","selected"));
460
+        } else{
461
+          outcome_filter.append(new_all.clone(true));
462
+        }
463
+        $.each(new_outcome_options, function(index, outcome)
464
+        {
465
+          var value = outcome.id.toString();
466
+          var html = outcome.name;
467
+          var new_option;
468
+          if(jQuery.inArray(value,outcome_selected_options) === -1){
469
+            new_option = $('<option/>',{
470
+              'value': value,
471
+              'html': html,
472
+            });;
473
+          }else{
474
+            new_option = $('<option/>',{
475
+              'value': value,
476
+              'html': html,
477
+              'selected': 'selected',
478
+            });;
479
+          }
480
+          outcome_filter.append(new_option);
481
+        });
482
+
483
+
484
+        {{--
485
+        //update semester filter
486
+        var semester_filter = $("#semester");
487
+        var new_semester_options = filters.semester;
488
+        semester_filter.find("option").remove();
489
+        semester_filter.append(new_all.clone(true));
490
+        $.each(new_semester_options, function(index, semester)
491
+        {
492
+          var value = semester.id;
493
+          var html = semester.name;
494
+          var new_option = $('<option/>',{
495
+            'value': value,
496
+            'html': html,
497
+          });;
498
+          semester_filter.append(new_option);
499
+        });
500
+        --}}
501
+
502
+
503
+        $('.selectpicker').selectpicker('refresh');
504
+      }
505
+    );
506
+
507
+  });
508
+
509
+});
510
+
511
+
512
+
513
+{{-- @include('global.dummy-outcomes') --}}
514
+
515
+@stop