|
@@ -7,11 +7,22 @@ class SchoolsController extends \BaseController
|
7
|
7
|
{
|
8
|
8
|
return DB::table('programs')
|
9
|
9
|
->join('courses', 'courses.program_id', '=', 'programs.id')
|
|
10
|
+ ->join('activities', 'activities.course_id', '=', 'courses.id')
|
|
11
|
+ ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
|
|
12
|
+ ->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
|
10
|
13
|
->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
|
11
|
14
|
->addSelect('courses.semester_id')
|
12
|
15
|
->where('school_id', $school->id)
|
13
|
16
|
->whereIn('semester_id', Session::get('semesters_ids'))
|
14
|
17
|
->lists('id');
|
|
18
|
+
|
|
19
|
+// return DB::table('programs')
|
|
20
|
+// ->join('courses', 'courses.program_id', '=', 'programs.id')
|
|
21
|
+// ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
|
|
22
|
+// ->addSelect('courses.semester_id')
|
|
23
|
+// ->where('school_id', $school->id)
|
|
24
|
+// ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
25
|
+// ->lists('id');
|
15
|
26
|
}
|
16
|
27
|
|
17
|
28
|
public function show($id)
|
|
@@ -22,8 +33,216 @@ class SchoolsController extends \BaseController
|
22
|
33
|
$title = $school->name;
|
23
|
34
|
$schools = School::all();
|
24
|
35
|
|
25
|
|
- $outcomes = Outcome::orderBy('name', 'asc')->get();
|
26
|
|
- $outcomeCount = Outcome::all()->count();
|
|
36
|
+ $semesters = Semester::whereIn('id',Session::get('semesters_ids'))->get();
|
|
37
|
+
|
|
38
|
+ $outcomes_grad = Outcome::active_by_semesters($semesters, 1);
|
|
39
|
+ $outcomes_undergrad = Outcome::active_by_semesters($semesters, 0);
|
|
40
|
+
|
|
41
|
+ /**
|
|
42
|
+ * List of grouped courses (grouped sections)
|
|
43
|
+ */
|
|
44
|
+
|
|
45
|
+ $program_ids = $school->programs->lists('id');
|
|
46
|
+
|
|
47
|
+ $undergrad_programs = DB::table('programs')
|
|
48
|
+ ->select('id', 'name', 'school_id', 'is_graduate')
|
|
49
|
+ ->where('is_graduate', '=', 0)
|
|
50
|
+ ->where('school_id', '=', $id)
|
|
51
|
+ ->orderBy('name', 'ASC')
|
|
52
|
+ ->get();
|
|
53
|
+
|
|
54
|
+ $grad_programs = DB::table('programs')
|
|
55
|
+ ->select('id', 'name', 'school_id', 'is_graduate')
|
|
56
|
+ ->where('is_graduate', '=', 1)
|
|
57
|
+ ->where('school_id', '=', $id)
|
|
58
|
+ ->orderBy('name', 'ASC')
|
|
59
|
+ ->get();
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+ $grad_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'))
|
|
64
|
+ select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
|
|
65
|
+ ->with('semester')
|
|
66
|
+ ->with('program')
|
|
67
|
+ ->whereIn('courses.program_id', $program_ids)
|
|
68
|
+ ->whereIn('courses.semester_id', Session::get('semesters_ids'))
|
|
69
|
+ ->leftJoin('programs', 'courses.program_id', '=', 'programs.id')
|
|
70
|
+ ->where('programs.is_graduate', '=', 1)
|
|
71
|
+ ->groupBy(array('courses.code', 'courses.number', 'courses.semester_id'))
|
|
72
|
+ ->orderBy('courses.code')
|
|
73
|
+ ->orderBy('courses.number')
|
|
74
|
+ ->orderBy('courses.semester_id')
|
|
75
|
+ ->get();
|
|
76
|
+
|
|
77
|
+ $undergrad_grouped_courses = Course::
|
|
78
|
+ // select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
|
|
79
|
+ select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
|
|
80
|
+ ->with('semester')
|
|
81
|
+ ->with('program')
|
|
82
|
+ ->whereIn('courses.program_id', $program_ids)
|
|
83
|
+ ->whereIn('courses.semester_id', Session::get('semesters_ids'))
|
|
84
|
+ ->leftJoin('programs', 'courses.program_id', '=', 'programs.id')
|
|
85
|
+ ->where('programs.is_graduate', '=', 0)
|
|
86
|
+ ->groupBy(array('courses.code', 'courses.number', 'courses.semester_id'))
|
|
87
|
+ ->orderBy('courses.code')
|
|
88
|
+ ->orderBy('courses.number')
|
|
89
|
+ ->orderBy('courses.semester_id')
|
|
90
|
+ ->get();
|
|
91
|
+
|
|
92
|
+ foreach($undergrad_grouped_courses as $key=>$courses)
|
|
93
|
+ {
|
|
94
|
+ $undergrad_grouped_courses[$key]->outcomes_attempted=NULL;
|
|
95
|
+ $coursesT=Course::where('courses.code',$courses->code)->where('courses.number',$courses->number)->where('courses.semester_id',$courses->semester_id)->get();
|
|
96
|
+ foreach($coursesT as $course)
|
|
97
|
+ {
|
|
98
|
+ if($course->isAssessed())
|
|
99
|
+ {
|
|
100
|
+ $undergrad_grouped_courses[$key]->outcomes_attempted=true;
|
|
101
|
+ }
|
|
102
|
+ }
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ foreach($grad_grouped_courses as $key=>$courses)
|
|
106
|
+ {
|
|
107
|
+ $grad_grouped_courses[$key]->outcomes_attempted=NULL;
|
|
108
|
+ $coursesT=Course::where('courses.code',$courses->code)->where('courses.number',$courses->number)->where('courses.semester_id',$courses->semester_id)->get();
|
|
109
|
+ foreach($coursesT as $course)
|
|
110
|
+ {
|
|
111
|
+ if($course->isAssessed())
|
|
112
|
+ {
|
|
113
|
+ $grad_grouped_courses[$key]->outcomes_attempted=true;
|
|
114
|
+ }
|
|
115
|
+ }
|
|
116
|
+ }
|
|
117
|
+
|
|
118
|
+ // Fetch programs with participation
|
|
119
|
+ $participating_programs = $this->participatingPrograms($school);
|
|
120
|
+
|
|
121
|
+ /**
|
|
122
|
+ * Calculate how many sections are doing assessment
|
|
123
|
+ */
|
|
124
|
+
|
|
125
|
+ $undergrad_assessed_sections_count = 0;
|
|
126
|
+ $undergrad_school_sections_count = 0;
|
|
127
|
+
|
|
128
|
+ $grad_assessed_sections_count = 0;
|
|
129
|
+ $grad_school_sections_count = 0;
|
|
130
|
+
|
|
131
|
+ foreach ($school->programs as $program) {
|
|
132
|
+ foreach ($program->courses as $course) {
|
|
133
|
+
|
|
134
|
+ if (!$course->program->is_graduate){
|
|
135
|
+ $undergrad_school_sections_count += 1;
|
|
136
|
+ if($course->isAssessed())$undergrad_assessed_sections_count += 1;
|
|
137
|
+ }
|
|
138
|
+ else {
|
|
139
|
+ $grad_school_sections_count += 1;
|
|
140
|
+ if($course->isAssessed())$grad_assessed_sections_count += 1;
|
|
141
|
+ }
|
|
142
|
+ }
|
|
143
|
+ }
|
|
144
|
+
|
|
145
|
+ /**
|
|
146
|
+ * Calculate how many programs achieved and attempted each outcome in this school
|
|
147
|
+ */
|
|
148
|
+
|
|
149
|
+ // For each outcome
|
|
150
|
+ foreach ($outcomes_undergrad as $outcome) {
|
|
151
|
+// $attempted_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
152
|
+// $achieved_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
153
|
+ $attemptedUndergradProgramsPerOutcome[$outcome->id]=0;
|
|
154
|
+ $achievedUndergradProgramsPerOutcome[$outcome->id]=0;
|
|
155
|
+ $programs_attempted_in_school[$outcome->id]=$outcome->programs_attempted_in_school($semesters, $school->id);
|
|
156
|
+// var_dump($programs_attempted_in_school);exit();
|
|
157
|
+ foreach($programs_attempted_in_school[$outcome->id] as $program_id)
|
|
158
|
+ {
|
|
159
|
+// var_dump($program_id->id);exit();
|
|
160
|
+ $program = DB::table('programs')->where('id', '=', $program_id->id)->first();
|
|
161
|
+
|
|
162
|
+ if(!$program->is_graduate)
|
|
163
|
+ {
|
|
164
|
+ $attemptedUndergradProgramsPerOutcome[$outcome->id]++;
|
|
165
|
+ $programC=Program::where('id', '=', $program_id->id)->first();
|
|
166
|
+// var_dump($programC);exit();
|
|
167
|
+ if($programC->achieved_outcome($outcome->id,$semesters))
|
|
168
|
+ {
|
|
169
|
+ $achievedUndergradProgramsPerOutcome[$outcome->id]++;
|
|
170
|
+ }
|
|
171
|
+ }
|
|
172
|
+ }
|
|
173
|
+ $undergrad_outcomes_attempted[$outcome->id]=$outcome->attempted_by_school($semesters, $school->id,0);
|
|
174
|
+ $undergrad_outcomes_achieved[$outcome->id]=$outcome->achieved_by_school($semesters, $school->id,0);
|
|
175
|
+
|
|
176
|
+ // For each program with courses that do assessment
|
|
177
|
+ $programs_with_courses = Program::with(array('courses' => function ($query) {
|
|
178
|
+ // $query->whereNotNull('outcomes_attempted');
|
|
179
|
+ $query->whereIn('semester_id', Session::get('semesters_ids'));
|
|
180
|
+ }))->where('is_graduate', 0)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
|
|
181
|
+
|
|
182
|
+ }
|
|
183
|
+
|
|
184
|
+ /**
|
|
185
|
+ * Calculate how many Graduate programs achieved and attempted each outcome in this school
|
|
186
|
+ */
|
|
187
|
+
|
|
188
|
+ // For each outcome
|
|
189
|
+ foreach ($outcomes_grad as $outcome) {
|
|
190
|
+// $attempted_outcomes_per_grad_program[$outcome->id]=0;
|
|
191
|
+ $achieved_outcomes_per_grad_program[$outcome->id]=0;
|
|
192
|
+ $attemptedGradProgramsPerOutcome[$outcome->id]=0;
|
|
193
|
+ $achievedGradProgramsPerOutcome[$outcome->id]=0;
|
|
194
|
+ $grad_outcomes_attempted[$outcome->id]=$outcome->attempted_by_school($semesters, $school->id,1);
|
|
195
|
+ $grad_outcomes_achieved[$outcome->id]=$outcome->achieved_by_school($semesters, $school->id,1);
|
|
196
|
+ // For each program with courses that do assessment
|
|
197
|
+ foreach($programs_attempted_in_school[$outcome->id] as $program_id)
|
|
198
|
+ {
|
|
199
|
+// var_dump($program_id->id);exit();
|
|
200
|
+ $program = DB::table('programs')
|
|
201
|
+ ->where('id', '=', $program_id->id)
|
|
202
|
+ ->first();
|
|
203
|
+// $program=Program::where('id', $program_id->id);
|
|
204
|
+// var_dump($program);exit();
|
|
205
|
+ if($program->is_graduate)
|
|
206
|
+ {
|
|
207
|
+ $attemptedGradProgramsPerOutcome[$outcome->id]++;
|
|
208
|
+ $programC=Program::where('id', '=', $program_id->id)->first();
|
|
209
|
+// var_dump($programC);exit();
|
|
210
|
+ if($programC->achieved_outcome($outcome->id,$semesters))
|
|
211
|
+ {
|
|
212
|
+ $achievedGradProgramsPerOutcome[$outcome->id]++;
|
|
213
|
+ }
|
|
214
|
+ }
|
|
215
|
+ }
|
|
216
|
+ $programs_with_courses = Program::with(array('courses' => function ($query) {
|
|
217
|
+ // $query->whereNotNull('outcomes_attempted');
|
|
218
|
+ $query->whereIn('semester_id', Session::get('semesters_ids'));
|
|
219
|
+ }))->where('is_graduate', 1)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
|
|
220
|
+
|
|
221
|
+ }
|
|
222
|
+ if ($school->id == 13) {
|
|
223
|
+// 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'));
|
|
224
|
+ return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes_grad', 'outcomes_undergrad', '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'));
|
|
225
|
+ } else {
|
|
226
|
+// 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'));
|
|
227
|
+ return View::make('local.managers.shared.school', compact('title', 'outcomes_grad', 'outcomes_undergrad', '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'));
|
|
228
|
+ }
|
|
229
|
+ }
|
|
230
|
+
|
|
231
|
+ public function showQuasiOri($id)
|
|
232
|
+ {
|
|
233
|
+ ini_set('memory_limit', '256M');
|
|
234
|
+ DB::connection()->disableQueryLog();
|
|
235
|
+ $school = School::find($id);
|
|
236
|
+ $title = $school->name;
|
|
237
|
+ $schools = School::all();
|
|
238
|
+
|
|
239
|
+// $outcomes = Outcome::orderBy('name', 'asc')->get();
|
|
240
|
+// $outcomeCount = Outcome::all()->count();
|
|
241
|
+ $semesters = Semester::whereIn('id',Session::get('semesters_ids'))->get();
|
|
242
|
+// var_dump($semesters);
|
|
243
|
+// exit();
|
|
244
|
+ $outcomes_grad = Outcome::active_by_semesters($semesters, 1);
|
|
245
|
+ $outcomes_undergrad = Outcome::active_by_semesters($semesters, 0);
|
27
|
246
|
|
28
|
247
|
|
29
|
248
|
/**
|
|
@@ -85,41 +304,57 @@ class SchoolsController extends \BaseController
|
85
|
304
|
* Calculate how many sections are doing assessment
|
86
|
305
|
*/
|
87
|
306
|
|
88
|
|
- $undergrad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
|
89
|
|
- $undergrad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
|
|
307
|
+// $undergrad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
|
|
308
|
+// $undergrad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
|
90
|
309
|
$undergrad_assessed_sections_count = 0;
|
91
|
310
|
$undergrad_school_sections_count = 0;
|
92
|
311
|
|
93
|
|
- $grad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
|
94
|
|
- $grad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
|
|
312
|
+// $grad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
|
|
313
|
+// $grad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
|
95
|
314
|
$grad_assessed_sections_count = 0;
|
96
|
315
|
$grad_school_sections_count = 0;
|
97
|
316
|
|
98
|
317
|
foreach ($school->programs as $program) {
|
99
|
318
|
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];
|
107
|
|
- }
|
108
|
|
- $undergrad_assessed_sections_count += 1;
|
109
|
|
- }
|
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];
|
118
|
|
- }
|
119
|
|
- $grad_assessed_sections_count += 1;
|
120
|
|
- }
|
121
|
|
- $grad_school_sections_count += 1;
|
122
|
|
- }
|
|
319
|
+// Log::info("aqui".$course);
|
|
320
|
+
|
|
321
|
+ if (!$course->program->is_graduate){
|
|
322
|
+ $undergrad_school_sections_count += 1;
|
|
323
|
+ if($course->isAssessed())$undergrad_assessed_sections_count += 1;
|
|
324
|
+// Log::info("aqui".$course);
|
|
325
|
+
|
|
326
|
+ }
|
|
327
|
+ else {
|
|
328
|
+ $grad_school_sections_count += 1;
|
|
329
|
+ if($course->isAssessed())$grad_assessed_sections_count += 1;
|
|
330
|
+// Log::info("aqui".$course);
|
|
331
|
+
|
|
332
|
+ }
|
|
333
|
+
|
|
334
|
+// if (!$course->program->is_graduate) {
|
|
335
|
+// if ($course->outcomes_achieved != NULL) {
|
|
336
|
+// $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
|
337
|
+// $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
|
338
|
+// for ($i = 1; $i <= count($undergrad_outcomes_attempted); $i++) {
|
|
339
|
+// $undergrad_outcomes_achieved[$i] += $course_outcomes_achieved[$i];
|
|
340
|
+// $undergrad_outcomes_attempted[$i] += $course_outcomes_attempted[$i];
|
|
341
|
+// }
|
|
342
|
+// $undergrad_assessed_sections_count += 1;
|
|
343
|
+// }
|
|
344
|
+// $undergrad_school_sections_count += 1;
|
|
345
|
+// } else {
|
|
346
|
+// if ($course->outcomes_achieved != NULL) {
|
|
347
|
+// $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
|
348
|
+// $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
|
349
|
+// for ($i = 1; $i <= count($grad_outcomes_attempted); $i++) {
|
|
350
|
+// $grad_outcomes_achieved[$i] += $course_outcomes_achieved[$i];
|
|
351
|
+// $grad_outcomes_attempted[$i] += $course_outcomes_attempted[$i];
|
|
352
|
+// }
|
|
353
|
+// $grad_assessed_sections_count += 1;
|
|
354
|
+// }
|
|
355
|
+// $grad_school_sections_count += 1;
|
|
356
|
+// }
|
|
357
|
+
|
123
|
358
|
}
|
124
|
359
|
}
|
125
|
360
|
|
|
@@ -128,27 +363,50 @@ class SchoolsController extends \BaseController
|
128
|
363
|
*/
|
129
|
364
|
|
130
|
365
|
// Number of programs that achieved a particular learning outcome
|
131
|
|
- $achievedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
|
366
|
+// $achievedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
132
|
367
|
|
133
|
368
|
// Number of programs that attempted a particular learning outcome
|
134
|
|
- $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
|
369
|
+// $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
135
|
370
|
|
136
|
371
|
// Fetch programs with participation for the school
|
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')
|
141
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))
|
142
|
|
- ->where('is_graduate', 0)
|
143
|
|
- ->where('school_id', $school->id)
|
144
|
|
- ->groupBy('id')
|
145
|
|
- ->get();
|
|
372
|
+// $participating_undergrad_programs = DB::table('programs')
|
|
373
|
+// ->join('courses', 'courses.program_id', '=', 'programs.id')
|
|
374
|
+// ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
|
|
375
|
+// ->addSelect('courses.semester_id')
|
|
376
|
+// ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
377
|
+// ->where('is_graduate', 0)
|
|
378
|
+// ->where('school_id', $school->id)
|
|
379
|
+// ->groupBy('id')
|
|
380
|
+// ->get();
|
146
|
381
|
|
147
|
382
|
$output = array();
|
148
|
383
|
|
149
|
384
|
|
150
|
385
|
// For each outcome
|
151
|
|
- foreach ($outcomes as $outcome) {
|
|
386
|
+ foreach ($outcomes_undergrad as $outcome) {
|
|
387
|
+// $attempted_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
388
|
+ $achieved_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
389
|
+ $attemptedUndergradProgramsPerOutcome[$outcome->id]=0;
|
|
390
|
+ $achievedUndergradProgramsPerOutcome[$outcome->id]=0;
|
|
391
|
+ $programs_attempted_in_school[$outcome->id]=$outcome->programs_attempted_in_school($semesters, $school->id);
|
|
392
|
+// var_dump($programs_attempted_in_school);exit();
|
|
393
|
+ foreach($programs_attempted_in_school[$outcome->id] as $program_id)
|
|
394
|
+ {
|
|
395
|
+// var_dump($program_id->id);exit();
|
|
396
|
+ $program = DB::table('programs')
|
|
397
|
+ ->where('id', '=', $program_id->id)
|
|
398
|
+ ->first();
|
|
399
|
+// $program=Program::where('id', $program_id->id);
|
|
400
|
+// var_dump($program);exit();
|
|
401
|
+ if(!$program->is_graduate)
|
|
402
|
+ {
|
|
403
|
+ $attemptedUndergradProgramsPerOutcome[$outcome->id]++;
|
|
404
|
+
|
|
405
|
+ }
|
|
406
|
+ }
|
|
407
|
+ $undergrad_outcomes_attempted[$outcome->id]=$outcome->attempted_by_school($semesters, $school->id,0);
|
|
408
|
+ $undergrad_outcomes_achieved[$outcome->id]=$outcome->achieved_by_school($semesters, $school->id,0);
|
|
409
|
+
|
152
|
410
|
// For each program with courses that do assessment
|
153
|
411
|
$programs_with_courses = Program::with(array('courses' => function ($query) {
|
154
|
412
|
// $query->whereNotNull('outcomes_attempted');
|
|
@@ -156,43 +414,46 @@ class SchoolsController extends \BaseController
|
156
|
414
|
}))->where('is_graduate', 0)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
|
157
|
415
|
|
158
|
416
|
foreach ($programs_with_courses as $program) {
|
|
417
|
+ if(in_array($program->id,$participating_programs)){
|
159
|
418
|
// To acummulate all criteria for one program
|
160
|
|
- $achieved_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
|
161
|
|
- $attempted_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
|
|
419
|
+// $achieved_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
|
|
420
|
+// $attempted_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
|
162
|
421
|
|
163
|
422
|
//Flag for counting programs
|
164
|
423
|
$flag = false;
|
165
|
424
|
|
166
|
425
|
// For each course in the program
|
167
|
|
- foreach ($program->courses as $course) {
|
168
|
|
- // If the outcome in question is being evaluated
|
169
|
|
- $course_outcomes_attempted2 = $course->outcomes_att();
|
170
|
|
- // $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
|
171
|
|
- // $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
|
172
|
|
- $course_outcomes_achieved2 = $course->outcomes_ach();
|
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];
|
179
|
|
-
|
180
|
|
- // Add one to the programs assessing, if it wasn't added before
|
181
|
|
- if (!$flag) {
|
182
|
|
- $attemptedUndergradProgramsPerOutcome[$outcome->id] += 1;
|
183
|
|
- $flag = true;
|
184
|
|
- }
|
185
|
|
- }
|
186
|
|
-
|
187
|
|
- // $output[] = 'ACHIEVED: '.$program->name.'-'.json_encode($achieved_outcomes_per_undergrad_program);
|
188
|
|
- // $output[] = 'ATTEMPTED: '.$program->name.'-'.json_encode($attempted_outcomes_per_program);
|
189
|
|
-
|
190
|
|
- }
|
|
426
|
+ // foreach ($program->courses as $course) {
|
|
427
|
+// if($course->isAssessed()){
|
|
428
|
+// // If the outcome in question is being evaluated
|
|
429
|
+// $course_outcomes_attempted2 = $course->outcomes_att();
|
|
430
|
+// // $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
|
|
431
|
+// // $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
|
|
432
|
+// $course_outcomes_achieved2 = $course->outcomes_ach();
|
|
433
|
+// if (
|
|
434
|
+// array_key_exists($outcome->id, $course_outcomes_attempted2) && array_key_exists($outcome->id, $course_outcomes_achieved2)
|
|
435
|
+// && $course_outcomes_attempted2[$outcome->id] > 0
|
|
436
|
+// ) {
|
|
437
|
+// $achieved_outcomes_per_undergrad_program[$outcome->id] += $course_outcomes_achieved2[$outcome->id];
|
|
438
|
+// // $attempted_outcomes_per_undergrad_program[$outcome->id] += $course_outcomes_attempted2[$outcome->id];
|
|
439
|
+//
|
|
440
|
+// // Add one to the programs assessing, if it wasn't added before
|
|
441
|
+// if (!$flag) {
|
|
442
|
+// $attemptedUndergradProgramsPerOutcome[$outcome->id] += 1;
|
|
443
|
+// $flag = true;
|
|
444
|
+// }
|
|
445
|
+// }
|
|
446
|
+//
|
|
447
|
+// // $output[] = 'ACHIEVED: '.$program->name.'-'.json_encode($achieved_outcomes_per_undergrad_program);
|
|
448
|
+// // $output[] = 'ATTEMPTED: '.$program->name.'-'.json_encode($attempted_outcomes_per_program);
|
|
449
|
+// }
|
|
450
|
+// }
|
191
|
451
|
//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
|
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;
|
194
|
|
- // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
|
195
|
|
- }
|
|
452
|
+// 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) {
|
|
453
|
+// $achievedUndergradProgramsPerOutcome[$outcome->id] += 1;
|
|
454
|
+// // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
|
|
455
|
+// }
|
|
456
|
+ }
|
196
|
457
|
}
|
197
|
458
|
}
|
198
|
459
|
|
|
@@ -201,43 +462,65 @@ class SchoolsController extends \BaseController
|
201
|
462
|
*/
|
202
|
463
|
|
203
|
464
|
// Number of programs that achieved a particular learning outcome
|
204
|
|
- $achievedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
|
465
|
+// $achievedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
205
|
466
|
|
206
|
467
|
// Number of programs that attempted a particular learning outcome
|
207
|
|
- $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
208
|
|
-
|
|
468
|
+// $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
|
469
|
+//
|
209
|
470
|
// Fetch programs with participation for the school
|
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')
|
214
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))
|
215
|
|
- ->where('is_graduate', 1)
|
216
|
|
- ->where('school_id', $school->id)
|
217
|
|
- ->groupBy('id')
|
218
|
|
- ->get();
|
|
471
|
+// $participating_grad_programs = DB::table('programs')
|
|
472
|
+// ->join('courses', 'courses.program_id', '=', 'programs.id')
|
|
473
|
+// ->select('programs.id', 'programs.name', 'programs.is_graduate', 'programs.school_id')
|
|
474
|
+// ->addSelect('courses.semester_id')
|
|
475
|
+// ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
476
|
+// ->where('is_graduate', 1)
|
|
477
|
+// ->where('school_id', $school->id)
|
|
478
|
+// ->groupBy('id')
|
|
479
|
+// ->get();
|
219
|
480
|
|
220
|
481
|
$output = array();
|
221
|
482
|
|
222
|
483
|
|
223
|
484
|
// For each outcome
|
224
|
|
- foreach ($outcomes as $outcome) {
|
225
|
|
- // For each program with courses that do assessment
|
|
485
|
+ foreach ($outcomes_grad as $outcome) {
|
|
486
|
+// $attempted_outcomes_per_grad_program[$outcome->id]=0;
|
|
487
|
+ $achieved_outcomes_per_grad_program[$outcome->id]=0;
|
|
488
|
+ $attemptedGradProgramsPerOutcome[$outcome->id]=0;
|
|
489
|
+ $achievedGradProgramsPerOutcome[$outcome->id]=0;
|
|
490
|
+ $grad_outcomes_attempted[$outcome->id]=$outcome->attempted_by_school($semesters, $school->id,1);
|
|
491
|
+ $grad_outcomes_achieved[$outcome->id]=$outcome->achieved_by_school($semesters, $school->id,1);
|
|
492
|
+ // For each program with courses that do assessment
|
|
493
|
+ foreach($programs_attempted_in_school[$outcome->id] as $program_id)
|
|
494
|
+ {
|
|
495
|
+// var_dump($program_id->id);exit();
|
|
496
|
+ $program = DB::table('programs')
|
|
497
|
+ ->where('id', '=', $program_id->id)
|
|
498
|
+ ->first();
|
|
499
|
+// $program=Program::where('id', $program_id->id);
|
|
500
|
+// var_dump($program);exit();
|
|
501
|
+ if($program->is_graduate)
|
|
502
|
+ {
|
|
503
|
+ $attemptedGradProgramsPerOutcome[$outcome->id]++;
|
|
504
|
+
|
|
505
|
+ }
|
|
506
|
+ }
|
226
|
507
|
$programs_with_courses = Program::with(array('courses' => function ($query) {
|
227
|
508
|
// $query->whereNotNull('outcomes_attempted');
|
228
|
509
|
$query->whereIn('semester_id', Session::get('semesters_ids'));
|
229
|
510
|
}))->where('is_graduate', 1)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
|
230
|
511
|
|
231
|
512
|
foreach ($programs_with_courses as $program) {
|
232
|
|
- // To acummulate all criteria for one program
|
233
|
|
- $achieved_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
|
234
|
|
- $attempted_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
|
|
513
|
+ if(in_array($program->id,$participating_programs)){
|
|
514
|
+ // To acummulate all criteria for one program
|
|
515
|
+// $achieved_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
|
|
516
|
+// $attempted_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
|
235
|
517
|
|
236
|
518
|
//Flag for counting programs
|
237
|
519
|
$flag = false;
|
238
|
520
|
|
239
|
521
|
// For each course in the program
|
240
|
522
|
foreach ($program->courses as $course) {
|
|
523
|
+ if($course->isAssessed()){
|
241
|
524
|
// If the outcome in question is being evaluated
|
242
|
525
|
// $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
|
243
|
526
|
$course_outcomes_attempted2 = ($course->outcomes_att());
|
|
@@ -259,19 +542,22 @@ class SchoolsController extends \BaseController
|
259
|
542
|
|
260
|
543
|
// $output[] = 'ACHIEVED: '.$program->name.'-'.json_encode($achieved_outcomes_per_grad_program);
|
261
|
544
|
// $output[] = 'ATTEMPTED: '.$program->name.'-'.json_encode($attempted_outcomes_per_program);
|
262
|
|
-
|
|
545
|
+ }
|
263
|
546
|
}
|
264
|
547
|
//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
|
265
|
548
|
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
|
549
|
$achievedGradProgramsPerOutcome[$outcome->id] += 1;
|
267
|
550
|
// $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
|
268
|
551
|
}
|
|
552
|
+ }
|
269
|
553
|
}
|
270
|
554
|
}
|
271
|
555
|
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'));
|
|
556
|
+// 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'));
|
|
557
|
+ return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes_grad', 'outcomes_undergrad', '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'));
|
273
|
558
|
} 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'));
|
|
559
|
+// 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'));
|
|
560
|
+ return View::make('local.managers.shared.school', compact('title', 'outcomes_grad', 'outcomes_undergrad', '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'));
|
275
|
561
|
}
|
276
|
562
|
}
|
277
|
563
|
|