Browse Source

seteando everview2 como landing page de administradores

parent
commit
7a785a05ad

+ 192
- 74
app/controllers/AdministratorsController.php View File

306
 		// $outcome->semesters[i]->tested
306
 		// $outcome->semesters[i]->tested
307
 		// $outcome->semesters[i]->achievers
307
 		// $outcome->semesters[i]->achievers
308
 		// '''
308
 		// '''
309
+		$is_graduate=0;
310
+		$levels=array(1,3);
309
 		$selected_semesters = Semester::find(Session::get('semesters_ids'));
311
 		$selected_semesters = Semester::find(Session::get('semesters_ids'));
310
-		$title = 'Overview2';
312
+		$title = 'Overview';
311
 
313
 
312
 		$semesters = DB::table('overview')
314
 		$semesters = DB::table('overview')
313
 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
315
 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
314
-			->select('semesters.name', 'semesters.code')
316
+			->select('semesters.id', 'semesters.name', 'semesters.code')
315
 			->orderBy('semesters.code', 'asc')
317
 			->orderBy('semesters.code', 'asc')
316
 			->groupBy('semesters.id')
318
 			->groupBy('semesters.id')
317
 			->get();
319
 			->get();
320
+
321
+
318
 		$outcomes = DB::table('overview')
322
 		$outcomes = DB::table('overview')
319
-			->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
320
-			->selectRaw('outcomes.name, overview.outcome_id as id, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
323
+			->rightJoin('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
324
+			->whereIn('outcomes.level',$levels)
325
+			->selectRaw('outcomes.name, coalesce(outcomes.new_outcome_id,outcomes.id) as id, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
321
 			->orderBy('outcomes.name', 'asc')
326
 			->orderBy('outcomes.name', 'asc')
322
-			->groupBy('overview.outcome_id')
327
+			->groupBy(DB::raw('coalesce(outcomes.new_outcome_id,outcomes.id)'))
323
 			->get();
328
 			->get();
329
+//outcomes activos 
330
+// 		$outcomes = DB::table('outcomes')
331
+// 			->whereNull('deactivation_date')
332
+// 			
333
+// 			->get();
334
+			
335
+// DB::enableQueryLog();
324
 		foreach ($outcomes as $outcome) {
336
 		foreach ($outcomes as $outcome) {
337
+// 		select semester_id, program_id, sum(`total_evaluated`) eval, sum(`total_achieved`) ach from overview where outcome_id in (select id from outcomes where coalesce(`new_outcome_id`,id) = 12) group by semester_id, program_id
325
 			$outcome->semesters = DB::table('overview')
338
 			$outcome->semesters = DB::table('overview')
326
 				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
339
 				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
327
-				->where('overview.outcome_id', $outcome->id)
340
+				->whereIn('overview.outcome_id',function ($query) use ($outcome)
341
+				{
342
+					$query->select('outcomes.id')
343
+						  ->from('outcomes')
344
+						  ->whereRaw('coalesce(outcomes.new_outcome_id,outcomes.id)=?',[$outcome->id]);
345
+				})
328
 				->selectRaw('semesters.id, semesters.name, semesters.code, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
346
 				->selectRaw('semesters.id, semesters.name, semesters.code, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
329
 				->orderBy('semesters.code', 'asc')
347
 				->orderBy('semesters.code', 'asc')
330
-				->groupBy('overview.outcome_id')
331
 				->groupBy('overview.semester_id')
348
 				->groupBy('overview.semester_id')
332
 				->get();
349
 				->get();
333
 		}
350
 		}
351
+// var_dump($outcomes);
352
+// 		exit();
353
+// dd(DB::getQueryLog());
334
 
354
 
335
 		$filters = array();
355
 		$filters = array();
336
 		$filters['school'] = DB::table('overview')
356
 		$filters['school'] = DB::table('overview')
337
 			->join('programs', 'programs.id', '=', 'overview.program_id')
357
 			->join('programs', 'programs.id', '=', 'overview.program_id')
338
 			->join('schools', 'schools.id', '=', 'programs.school_id')
358
 			->join('schools', 'schools.id', '=', 'programs.school_id')
359
+			->where('programs.is_graduate',$is_graduate)
339
 			->select('schools.id', 'schools.name')
360
 			->select('schools.id', 'schools.name')
340
 			->orderBy('schools.name', 'asc')
361
 			->orderBy('schools.name', 'asc')
341
 			->groupBy('schools.id')
362
 			->groupBy('schools.id')
342
 			->get();
363
 			->get();
343
 
364
 
365
+// DB::enableQueryLog();
344
 		$filters['program'] = DB::table('overview')
366
 		$filters['program'] = DB::table('overview')
345
 			->join('programs', 'programs.id', '=', 'overview.program_id')
367
 			->join('programs', 'programs.id', '=', 'overview.program_id')
368
+			->where('programs.is_graduate',$is_graduate)
346
 			->select('programs.id', 'programs.name')
369
 			->select('programs.id', 'programs.name')
347
 			->orderBy('programs.name', 'asc')
370
 			->orderBy('programs.name', 'asc')
348
 			->groupBy('overview.program_id')
371
 			->groupBy('overview.program_id')
349
 			->get();
372
 			->get();
373
+// dd(DB::getQueryLog());
350
 
374
 
351
 		$filters['semester'] = DB::table('overview')
375
 		$filters['semester'] = DB::table('overview')
352
 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
376
 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
361
 			->orderBy('semesters.code', 'asc')
385
 			->orderBy('semesters.code', 'asc')
362
 			->groupBy('overview.semester_id')
386
 			->groupBy('overview.semester_id')
363
 			->get();
387
 			->get();
388
+// DB::enableQueryLog();
389
+//select `outcomes`.`id`, `outcomes`.`name` from outcomes where deactivation_date is null and `outcomes`.`id` in (select outcome_id from overview)
364
 
390
 
365
-		$filters['outcome'] = DB::table('overview')
366
-			->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
391
+		$filters['outcome'] = DB::table('outcomes')
367
 			->select('outcomes.id', 'outcomes.name')
392
 			->select('outcomes.id', 'outcomes.name')
393
+			->whereNull('deactivation_date')
394
+			->whereIn('outcomes.id',function($query)
395
+			{
396
+				$query->select('outcome_id')
397
+				 ->from('overview');
398
+			}
399
+			
400
+			)
368
 			->orderBy('outcomes.name', 'asc')
401
 			->orderBy('outcomes.name', 'asc')
369
-			->groupBy('overview.outcome_id')
370
 			->get();
402
 			->get();
371
-
403
+// dd(DB::getQueryLog());
404
+// exit();
372
 		$target = 0.70;
405
 		$target = 0.70;
373
 
406
 
374
 		return View::make('local.managers.admins.overview2', compact('title', 'selected_semesters', 'outcomes', 'semesters', 'filters', 'target'));
407
 		return View::make('local.managers.admins.overview2', compact('title', 'selected_semesters', 'outcomes', 'semesters', 'filters', 'target'));
384
 		$semesters = Input::get('semesters');
417
 		$semesters = Input::get('semesters');
385
 		$years = Input::get('years');
418
 		$years = Input::get('years');
386
 		$outcomes = Input::get('outcomes');
419
 		$outcomes = Input::get('outcomes');
387
-
420
+		$is_graduate=Input::get('is_graduate');
421
+// 		$is_graduate=0;
422
+		if($is_graduate)$levels=array(2,3);
423
+		else $levels=array(1,3);
388
 
424
 
389
 		// make an array id's of schools selected. if All, use All available id's
425
 		// make an array id's of schools selected. if All, use All available id's
390
 		if ($schools == array("0")) {
426
 		if ($schools == array("0")) {
391
 			$result = DB::table('overview')
427
 			$result = DB::table('overview')
392
 				->join('programs', 'programs.id', '=', 'overview.program_id')
428
 				->join('programs', 'programs.id', '=', 'overview.program_id')
393
 				->join('schools', 'schools.id', '=', 'programs.school_id')
429
 				->join('schools', 'schools.id', '=', 'programs.school_id')
430
+				->where('programs.is_graduate',$is_graduate)
394
 				->select('schools.id')
431
 				->select('schools.id')
395
 				->orderBy('schools.name', 'asc')
432
 				->orderBy('schools.name', 'asc')
396
 				->groupBy('schools.id')
433
 				->groupBy('schools.id')
409
 		if ($programs == array("0")) {
446
 		if ($programs == array("0")) {
410
 			$result = DB::table('overview')
447
 			$result = DB::table('overview')
411
 				->join('programs', 'programs.id', '=', 'overview.program_id')
448
 				->join('programs', 'programs.id', '=', 'overview.program_id')
449
+				->where('programs.is_graduate',$is_graduate)
412
 				->select('programs.id')
450
 				->select('programs.id')
413
 				->orderBy('programs.name', 'asc')
451
 				->orderBy('programs.name', 'asc')
414
 				->groupBy('overview.program_id')
452
 				->groupBy('overview.program_id')
442
 			}
480
 			}
443
 		}
481
 		}
444
 		// make an array id's of years selected. if All, use All available id's
482
 		// make an array id's of years selected. if All, use All available id's
445
-		if ($years == array("0")) {
446
-			$result = DB::table('overview') //
447
-				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
448
-				->select('semesters.id')
449
-				->orderBy('semesters.code', 'asc')
450
-				->groupBy('overview.semester_id')
451
-				->get();
452
-			$years_id = array();
453
-			foreach ($result as $year) {
454
-				array_push($years_id, $year->id);
455
-			}
456
-		} else {
457
-			$years_id = array();
458
-			foreach ($years as $year_id) {
459
-				array_push($years_id, intval($year_id));
460
-			}
461
-		}
483
+// 		if ($years == array("0")) {
484
+// 			$result = DB::table('overview') //
485
+// 				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
486
+// 				->select('semesters.id')
487
+// 				->orderBy('semesters.code', 'asc')
488
+// 				->groupBy('overview.semester_id')
489
+// 				->get();
490
+// 			$years_id = array();
491
+// 			foreach ($result as $year) {
492
+// 				array_push($years_id, $year->id);
493
+// 			}
494
+// 		} else {
495
+// 			$years_id = array();
496
+// 			foreach ($years as $year_id) {
497
+// 				array_push($years_id, intval($year_id));
498
+// 			}
499
+// 		}
462
 		// make an array id's of outcomes selected. if All, use All available id's
500
 		// make an array id's of outcomes selected. if All, use All available id's
463
 		if ($outcomes == array("0")) {
501
 		if ($outcomes == array("0")) {
464
-			$result = DB::table('overview')
465
-				->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
466
-				->select('outcomes.id')
467
-				->orderBy('outcomes.name', 'asc')
468
-				->groupBy('overview.outcome_id')
469
-				->get();
502
+
503
+		$result = DB::table('overview')
504
+			->rightJoin('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
505
+			->whereIn('outcomes.level',$levels)
506
+			->selectRaw('coalesce(outcomes.new_outcome_id,outcomes.id) as id')
507
+			->orderBy('outcomes.name', 'asc')
508
+			->groupBy(DB::raw('coalesce(outcomes.new_outcome_id,outcomes.id)'))
509
+			->get();
510
+// 		$result = DB::table('outcomes')
511
+// 			->select('outcomes.id')
512
+// 			->whereIn('outcomes.level',$levels)
513
+// 			->whereNull('deactivation_date')
514
+// // 			->whereIn('outcomes.id',function($query)
515
+// // 				{
516
+// // 					$query->select('outcome_id')
517
+// // 					 ->from('overview');
518
+// // 				}
519
+// // 			)
520
+// 			->orderBy('outcomes.name', 'asc')
521
+// 			->get();
522
+// 
523
+// 			$result = DB::table('overview')
524
+// 				->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
525
+// 				->select('outcomes.id')
526
+// 				->orderBy('outcomes.name', 'asc')
527
+// 				->groupBy('overview.outcome_id')
528
+// 				->get();
470
 			$outcomes_id = array();
529
 			$outcomes_id = array();
471
 			foreach ($result as $outcome) {
530
 			foreach ($result as $outcome) {
472
 				array_push($outcomes_id, $outcome->id);
531
 				array_push($outcomes_id, $outcome->id);
485
 			->join('schools', 'schools.id', '=', 'programs.school_id')
544
 			->join('schools', 'schools.id', '=', 'programs.school_id')
486
 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
545
 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
487
 			->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
546
 			->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
547
+// 			->where('programs.is_graduate',$is_graduate)
488
 			->whereIn('schools.id', $schools_id)
548
 			->whereIn('schools.id', $schools_id)
489
 			->whereIn('programs.id', $programs_id)
549
 			->whereIn('programs.id', $programs_id)
490
 			->whereIn('semesters.id', $semesters_id)
550
 			->whereIn('semesters.id', $semesters_id)
494
 			->orderBy('semesters.code', 'asc')
554
 			->orderBy('semesters.code', 'asc')
495
 			->groupBy('semesters.id')
555
 			->groupBy('semesters.id')
496
 			->get();
556
 			->get();
497
-		$outcomes = 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)
557
+
558
+// 		$outcomes = DB::table('overview')
559
+// 			->rightJoin('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
560
+// 			->join('programs', 'programs.id', '=', 'overview.program_id')
561
+// 			->join('schools', 'schools.id', '=', 'programs.school_id')
562
+// 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
563
+// 			->whereIn('schools.id', $schools_id)
564
+// 			->whereIn('programs.id', $programs_id)
565
+// 			->whereIn('semesters.id', $semesters_id)
566
+// 			->whereIn('outcomes.id', $outcomes_id)
567
+// 			->selectRaw('outcomes.name, coalesce(outcomes.new_outcome_id,outcomes.id) as id, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
568
+// 			->orderBy('outcomes.name', 'asc')
569
+// 			->groupBy(DB::raw('coalesce(outcomes.new_outcome_id,outcomes.id)'))
570
+// 			->get();
571
+			
572
+// 			$sql=DB::table('overview')
573
+// 				->join('programs', 'programs.id', '=', 'overview.program_id')
574
+// 				->join('schools', 'schools.id', '=', 'programs.school_id')
575
+// 				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
576
+// 				->select('overview.id','program_id','outcome_id','semester_id','total_evaluated','total_achieved')
577
+// 				->whereIn('schools.id', $schools_id)
578
+// 				->whereIn('programs.id', $programs_id)
579
+// 				->whereIn('semesters.id', $semesters_id);
580
+
581
+			$schools_text=implode(",", $schools_id);
582
+			$programs_text=implode(",", $programs_id);
583
+			$semesters_text=implode(",", $semesters_id);
584
+
585
+			$sql="select overview.* from `overview` inner join `programs` on `programs`.`id` = `overview`.`program_id` inner join `schools` on `schools`.`id` = `programs`.`school_id` inner join `semesters` on `semesters`.`id` = `overview`.`semester_id` where `schools`.`id` in ($schools_text) and `programs`.`id` in ($programs_text) and `semesters`.`id` in ($semesters_text)";
586
+			
587
+			$outcomes = DB::table('outcomes')
588
+			->leftJoin(DB::raw("({$sql}) as overview2"),'outcomes.id', '=', 'overview2.outcome_id')
506
 			->whereIn('outcomes.id', $outcomes_id)
589
 			->whereIn('outcomes.id', $outcomes_id)
507
-			->selectRaw('outcomes.name, overview.outcome_id as id, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
590
+			->selectRaw('outcomes.name, coalesce(outcomes.new_outcome_id,outcomes.id) as id, sum(overview2.total_evaluated) as total_evaluated, sum(overview2.total_achieved) as total_achieved')
508
 			->orderBy('outcomes.name', 'asc')
591
 			->orderBy('outcomes.name', 'asc')
509
-			->groupBy('overview.outcome_id')
592
+			->groupBy(DB::raw('coalesce(outcomes.new_outcome_id,outcomes.id)'))
593
+// 			->mergeBindings($sql->getQuery())
510
 			->get();
594
 			->get();
595
+			
511
 		foreach ($outcomes as $outcome) {
596
 		foreach ($outcomes as $outcome) {
597
+// 			$outcome->semesters = DB::table('overview')
598
+// 				->join('programs', 'programs.id', '=', 'overview.program_id')
599
+// 				->join('schools', 'schools.id', '=', 'programs.school_id')
600
+// 				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
601
+// 				->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
602
+// 				->whereIn('schools.id', $schools_id)
603
+// 				->whereIn('programs.id', $programs_id)
604
+// 				->whereIn('semesters.id', $semesters_id)
605
+// 				// ->whereIn('years.id',$years_id)
606
+// 				->whereIn('outcomes.id', $outcomes_id)
607
+// 				->where('overview.outcome_id', $outcome->id)
608
+// 				->selectRaw('semesters.id, semesters.name, semesters.code, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
609
+// 				->orderBy('semesters.code', 'asc')
610
+// 				->groupBy('overview.outcome_id')
611
+// 				->groupBy('overview.semester_id')
612
+// 				->get();
613
+
512
 			$outcome->semesters = DB::table('overview')
614
 			$outcome->semesters = DB::table('overview')
513
 				->join('programs', 'programs.id', '=', 'overview.program_id')
615
 				->join('programs', 'programs.id', '=', 'overview.program_id')
514
 				->join('schools', 'schools.id', '=', 'programs.school_id')
616
 				->join('schools', 'schools.id', '=', 'programs.school_id')
515
 				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
617
 				->join('semesters', 'semesters.id', '=', 'overview.semester_id')
516
-				->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
517
 				->whereIn('schools.id', $schools_id)
618
 				->whereIn('schools.id', $schools_id)
518
 				->whereIn('programs.id', $programs_id)
619
 				->whereIn('programs.id', $programs_id)
519
 				->whereIn('semesters.id', $semesters_id)
620
 				->whereIn('semesters.id', $semesters_id)
520
-				// ->whereIn('years.id',$years_id)
521
-				->whereIn('outcomes.id', $outcomes_id)
522
-				->where('overview.outcome_id', $outcome->id)
621
+				->whereIn('overview.outcome_id',function ($query) use ($outcome)
622
+				{
623
+					$query->select('outcomes.id')
624
+						  ->from('outcomes')
625
+						  ->whereRaw('coalesce(outcomes.new_outcome_id,outcomes.id)=?',[$outcome->id]);
626
+				})
523
 				->selectRaw('semesters.id, semesters.name, semesters.code, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
627
 				->selectRaw('semesters.id, semesters.name, semesters.code, sum(overview.total_evaluated) as total_evaluated, sum(overview.total_achieved) as total_achieved')
524
 				->orderBy('semesters.code', 'asc')
628
 				->orderBy('semesters.code', 'asc')
525
-				->groupBy('overview.outcome_id')
526
 				->groupBy('overview.semester_id')
629
 				->groupBy('overview.semester_id')
527
 				->get();
630
 				->get();
528
 		}
631
 		}
539
 			->whereIn('semesters.id', $semesters_id)
642
 			->whereIn('semesters.id', $semesters_id)
540
 			// ->whereIn('years.id',$years_id)
643
 			// ->whereIn('years.id',$years_id)
541
 			->whereIn('outcomes.id', $outcomes_id)
644
 			->whereIn('outcomes.id', $outcomes_id)
645
+			->where('programs.is_graduate',$is_graduate)
542
 			->select('schools.id', 'schools.name')
646
 			->select('schools.id', 'schools.name')
543
 			->orderBy('schools.name', 'asc')
647
 			->orderBy('schools.name', 'asc')
544
 			->groupBy('schools.id')
648
 			->groupBy('schools.id')
545
 			->get();
649
 			->get();
650
+			
546
 		$filters['program'] = DB::table('overview')
651
 		$filters['program'] = DB::table('overview')
547
 			->join('programs', 'programs.id', '=', 'overview.program_id')
652
 			->join('programs', 'programs.id', '=', 'overview.program_id')
548
 			->join('schools', 'schools.id', '=', 'programs.school_id')
653
 			->join('schools', 'schools.id', '=', 'programs.school_id')
553
 			->whereIn('semesters.id', $semesters_id)
658
 			->whereIn('semesters.id', $semesters_id)
554
 			// ->whereIn('years.id',$years_id)
659
 			// ->whereIn('years.id',$years_id)
555
 			->whereIn('outcomes.id', $outcomes_id)
660
 			->whereIn('outcomes.id', $outcomes_id)
661
+			->where('programs.is_graduate',$is_graduate)
556
 			->select('programs.id', 'programs.name')
662
 			->select('programs.id', 'programs.name')
557
 			->orderBy('programs.name', 'asc')
663
 			->orderBy('programs.name', 'asc')
558
 			->groupBy('overview.program_id')
664
 			->groupBy('overview.program_id')
567
 			// ->whereIn('semesters.id',$semesters_id)
673
 			// ->whereIn('semesters.id',$semesters_id)
568
 			// ->whereIn('years.id',$years_id)
674
 			// ->whereIn('years.id',$years_id)
569
 			->whereIn('outcomes.id', $outcomes_id)
675
 			->whereIn('outcomes.id', $outcomes_id)
676
+			->where('programs.is_graduate',$is_graduate)
570
 			->select('semesters.id', 'semesters.name', 'semesters.code')
677
 			->select('semesters.id', 'semesters.name', 'semesters.code')
571
 			->orderBy('semesters.code', 'asc')
678
 			->orderBy('semesters.code', 'asc')
572
 			->groupBy('overview.semester_id')
679
 			->groupBy('overview.semester_id')
573
 			->get();
680
 			->get();
574
-		$filters['year'] = 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
-
585
-			->get();
586
-		$filters['outcome'] = DB::table('overview')
587
-			->join('programs', 'programs.id', '=', 'overview.program_id')
588
-			->join('schools', 'schools.id', '=', 'programs.school_id')
589
-			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
590
-			->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
591
-			->whereIn('schools.id', $schools_id)
592
-			->whereIn('programs.id', $programs_id)
593
-			->whereIn('semesters.id', $semesters_id)
594
-			// ->whereIn('years.id',$years_id)
595
-			// ->whereIn('outcomes.id',$outcomes_id)
681
+// 		$filters['year'] = DB::table('overview') ////////////////////////////////////////////
682
+// 			->join('programs', 'programs.id', '=', 'overview.program_id')
683
+// 			->join('schools', 'schools.id', '=', 'programs.school_id')
684
+// 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
685
+// 			->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
686
+// 			->whereIn('schools.id', $schools_id)
687
+// 			->whereIn('programs.id', $programs_id)
688
+// 			->whereIn('semesters.id', $semesters_id)
689
+// 			// ->whereIn('years.id',$years_id)
690
+// 			->whereIn('outcomes.id', $outcomes_id)
691
+// 
692
+// 			->get();
693
+			$sql="select overview.* from `overview` inner join `programs` on `programs`.`id` = `overview`.`program_id` inner join `schools` on `schools`.`id` = `programs`.`school_id` inner join `semesters` on `semesters`.`id` = `overview`.`semester_id` where `schools`.`id` in ($schools_text) and `programs`.`id` in ($programs_text) and `semesters`.`id` in ($semesters_text) and programs.is_graduate=$is_graduate";
694
+			
695
+			$filters['outcome']  = DB::table('outcomes')
696
+			->leftJoin(DB::raw("({$sql}) as overview2"),'outcomes.id', '=', 'overview2.outcome_id')
596
 			->select('outcomes.id', 'outcomes.name')
697
 			->select('outcomes.id', 'outcomes.name')
597
 			->orderBy('outcomes.name', 'asc')
698
 			->orderBy('outcomes.name', 'asc')
598
-			->groupBy('overview.outcome_id')
699
+			->groupBy(DB::raw('coalesce(outcomes.new_outcome_id,outcomes.id)'))
700
+// 			->mergeBindings($sql->getQuery())
599
 			->get();
701
 			->get();
600
 
702
 
703
+// 		$filters['outcome'] = DB::table('overview')
704
+// 			->join('programs', 'programs.id', '=', 'overview.program_id')
705
+// 			->join('schools', 'schools.id', '=', 'programs.school_id')
706
+// 			->join('semesters', 'semesters.id', '=', 'overview.semester_id')
707
+// 			->join('outcomes', 'outcomes.id', '=', 'overview.outcome_id')
708
+// 			->whereIn('schools.id', $schools_id)
709
+// 			->whereIn('programs.id', $programs_id)
710
+// 			->whereIn('semesters.id', $semesters_id)
711
+// 			// ->whereIn('years.id',$years_id)
712
+// 			// ->whereIn('outcomes.id',$outcomes_id)
713
+// 			->where('programs.is_graduate',$is_graduate)
714
+// 			->select('outcomes.id', 'outcomes.name')
715
+// 			->orderBy('outcomes.name', 'asc')
716
+// 			->groupBy('overview.outcome_id')
717
+// 			->get();
718
+
601
 		return array(
719
 		return array(
602
 			"semesters" => $semesters,
720
 			"semesters" => $semesters,
603
 			"outcomes_info" => $outcomes,
721
 			"outcomes_info" => $outcomes,

+ 2
- 2
app/routes.php View File

268
      * Administrator Routes
268
      * Administrator Routes
269
      */
269
      */
270
     Route::group(array('before' => 'admin'), function () {
270
     Route::group(array('before' => 'admin'), function () {
271
-        Route::get('/administrator', 'AdministratorsController@overview');
272
-        Route::get('/administrator2', 'AdministratorsController@overview2');
271
+        Route::get('/administrator', 'AdministratorsController@overview2');
272
+        Route::get('/administrator2', 'AdministratorsController@overview');
273
         Route::post('/administrator2/filter', 'AdministratorsController@overview2_filter_results');
273
         Route::post('/administrator2/filter', 'AdministratorsController@overview2_filter_results');
274
         Route::post('administrator/rubrics', array(
274
         Route::post('administrator/rubrics', array(
275
             'as' => 'rubrics',
275
             'as' => 'rubrics',

+ 18
- 1
app/views/local/managers/admins/overview2.blade.php View File

60
 
60
 
61
       //
61
       //
62
       outcomes_data.push(hidden_values);
62
       outcomes_data.push(hidden_values);
63
+// 		console.log(semesters)
63
 
64
 
64
       $.each(outcomes_info, function(index, outcome){
65
       $.each(outcomes_info, function(index, outcome){
65
         var temp_outcome_grouping_info = Array();
66
         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({v:(index+1),f:"Students acheiving Learning Outcomes"});
67
         temp_outcome_grouping_info.push(target_line);
68
         temp_outcome_grouping_info.push(target_line);
68
-
69
+		
70
+// 		console.log(outcome.semesters)
69
         var i = 0;
71
         var i = 0;
70
         $.each(outcome.semesters, function(index, semester){
72
         $.each(outcome.semesters, function(index, semester){
71
 
73
 
158
     var outcomes_info = <?= json_encode($outcomes, JSON_HEX_TAG); ?>;
160
     var outcomes_info = <?= json_encode($outcomes, JSON_HEX_TAG); ?>;
159
     var semesters = <?= json_encode($semesters, JSON_HEX_TAG); ?>;
161
     var semesters = <?= json_encode($semesters, JSON_HEX_TAG); ?>;
160
 
162
 
163
+// 	console.log(outcomes_info);
161
     make_chart(outcomes_info,semesters);
164
     make_chart(outcomes_info,semesters);
162
 
165
 
163
     </script>
166
     </script>
166
       <div class="filters">
169
       <div class="filters">
167
         <div class="row" style="display: flex;">
170
         <div class="row" style="display: flex;">
168
           <div class="category" >
171
           <div class="category" >
172
+            <label for="is_graduate">Level</label>
173
+            <div class="select">
174
+              <select class="selectpicker" name="is_graduate" id="is_graduate">
175
+                <option value="0" selected="selected">Undergradute</option>
176
+                <option value="1">Graduate</option>
177
+              </select>
178
+            </div>
179
+          </div>
180
+        </div>
181
+        <div class="row" style="display: flex;">
182
+          <div class="category" >
169
             <label for="school">School</label>
183
             <label for="school">School</label>
170
             <div class="select">
184
             <div class="select">
171
               <select multiple class="selectpicker" name="school" id="school">
185
               <select multiple class="selectpicker" name="school" id="school">
302
     var semesters = $("#semester").val();
316
     var semesters = $("#semester").val();
303
     var years = $("#year").val();
317
     var years = $("#year").val();
304
     var outcomes = $("#outcome").val();
318
     var outcomes = $("#outcome").val();
319
+    var outcomes = $("#outcome").val();
320
+    var is_graduate = $("#is_graduate").val();
305
 
321
 
306
     // query the values and get new data for chart
322
     // query the values and get new data for chart
307
     $.post(
323
     $.post(
312
         semesters: (semesters),
328
         semesters: (semesters),
313
         years: (years),
329
         years: (years),
314
         outcomes: (outcomes),
330
         outcomes: (outcomes),
331
+        is_graduate: (is_graduate),
315
       },
332
       },
316
       function(data)
333
       function(data)
317
       {
334
       {