123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <?php
-
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Support\Facades\Log;
-
- class ProgramCoordinatorsController extends \BaseController
- {
-
- public function overview()
- {
-
- switch (Auth::user()->role) {
- case 1:
- return Redirect::to('administrator');
- break;
- case 2:
- return Redirect::to('school/' . Auth::user()->school->id);
- break;
- }
-
- $title = 'Program Coordinator Overview';
-
- $programs = Auth::user()->programs;
-
-
-
-
- $semesters = Session::get('semesters_ids');
- $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
-
- $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))
- ->whereNull('deleted_at')
- ->whereRaw("(deactivation_date IS NULL or deactivation_date >= '{$semesters->start}')")
- ->orderBy('name', 'ASC')->get();
- $outcomeCount = count($outcomes);
-
- $programs_array = array();
- $programs_contact = array();
-
-
-
-
-
-
- foreach ($programs as $program) {
-
- $program_array = array();
- $program_object = new \stdClass();
- $program_object->name = $program->name;
- $program_object->school = $program->school->name;
- $program_object->id = $program->id;
- $program_array['program'] = $program_object;
-
-
- $program_array['outcomes_achieved'] = [];
- $program_array['outcomes_attempted'] = [];
-
- $program_array['program_outcomes_achieved'] = [];
- $program_array['program_outcomes_attempted'] = [];
-
-
- foreach ($outcomes as $outcome) {
- $program_array['outcomes_achieved'][$outcome->id] = 0;
- $program_array['outcomes_attempted'][$outcome->id] = 0;
- $program_array['program_outcomes_achieved'][$outcome->id] = 0;
- $program_array['program_outcomes_attempted'][$outcome->id] = 0;
- }
-
- $program_array['program_outcomes_achieved'] = $program->program_students_per_outcome['program_info']['outcomes_achieved_combined'];
- $program_array['program_outcomes_attempted'] = $program->program_students_per_outcome['program_info']['outcomes_attempted_combined'];
-
-
-
- $program_array['program_courses'] = $program->courses;
-
-
- $program_array['assessed_courses_count'] = 0;
- foreach ($program->courses as $course) {
-
- $student_report = $course->student_report_for_outcome;
-
- if ($student_report) {
-
- foreach ($student_report as $outcome_id => $score) {
- if (array_key_exists($outcome_id, $program_array['outcomes_attempted'])) $program_array['outcomes_attempted'][$outcome_id] += $student_report[$outcome_id]['calculations']['student_attempted'];
- else $program_array['outcomes_attempted'][$outcome_id] = $student_report[$outcome_id]['calculations']['student_attempted'];
-
- if (array_key_exists($outcome_id, $program_array['outcomes_achieved'])) $program_array['outcomes_achieved'][$outcome_id] += $student_report[$outcome_id]['calculations']['student_achieved'];
- else $program_array['outcomes_achieved'][$outcome_id] = $student_report[$outcome_id]['calculations']['student_achieved'];
- }
-
-
-
-
-
- $program_array['assessed_courses_count'] += 1;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $program_array['grouped_courses'] = Course::select(DB::raw('name, code, number, semester_id, program_id'))
- ->with('semester')
- ->with('program')
- ->where('program_id', $program->id)
- ->whereIn('semester_id', Session::get('semesters_ids'))
- ->groupBy(array('code', 'number', 'semester_id'))
- ->orderBy('code')
- ->orderBy('number')
- ->orderBy('semester_id')
- ->get();
-
-
- $program_array['linea_de_graph'] = $program->expected_outcome_target;
- $programs_array[] = $program_array;
-
-
-
-
-
- $users = User::select('users.*')
- ->leftJoin('program_user', 'users.id', '=', 'program_user.user_id')
- ->where(function ($query) use ($program) {
- $query
- ->where('school_id', $program->school_id)
- ->where('role', 2);
- })
- ->orWhere(function ($query) use ($program) {
- $query
- ->where('role', 3)
- ->where('program_id', $program->id);
- })
- ->orWhere(function ($query) use ($program) {
- $query
- ->where('role', 4)
- ->where('program_id', $program->id);
- })
- ->get();
-
-
- $programs_contact[] = $users;
- }
-
-
- return View::make('local.managers.pCoords.overview', compact('title', 'programs', 'outcomes', 'programs_array', 'programs_contact'));
- }
- }
|