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