|
@@ -1,207 +1,306 @@
|
1
|
1
|
<?php
|
2
|
2
|
|
3
|
3
|
class AdministratorsController extends \BaseController
|
4
|
|
-{
|
|
4
|
+{
|
|
5
|
+ private function outcomes_semesters($selected_semesters, $level)
|
|
6
|
+ {
|
|
7
|
+ $min_start="9000-01-01 00:00:00";
|
|
8
|
+ $max_end="1000-01-01 00:00:00";
|
|
9
|
+ foreach($selected_semesters as $semester)
|
|
10
|
+ {
|
|
11
|
+ if($min_start>$semester->start)
|
|
12
|
+ {
|
|
13
|
+ $min_start=$semester->start;
|
|
14
|
+ }
|
|
15
|
+ if($max_end<$semester->end)
|
|
16
|
+ {
|
|
17
|
+ $max_end=$semester->end;
|
|
18
|
+ }
|
|
19
|
+ }
|
|
20
|
+ $outcomes = Outcome::where(function($query) use ($min_start)
|
|
21
|
+ {
|
|
22
|
+ $query->where('deactivation_date', '>=', $min_start)
|
|
23
|
+ ->orWhere('deactivation_date', null);
|
|
24
|
+ })
|
|
25
|
+ ->where('activation_date', '<=', $max_end)
|
|
26
|
+ ->where(function($query2) use ($level)
|
|
27
|
+ {
|
|
28
|
+ $query2->where("level", $level+1)
|
|
29
|
+ ->orWhere("level",3);
|
|
30
|
+ })
|
|
31
|
+ ->orderBy('name', 'ASC')
|
|
32
|
+ ->get();
|
|
33
|
+ $outcomeCount = Outcome::where(function($query) use ($min_start)
|
|
34
|
+ {
|
|
35
|
+ $query->where('deactivation_date', '>=', $min_start)
|
|
36
|
+ ->orWhere('deactivation_date', null);
|
|
37
|
+ })
|
|
38
|
+ ->where('activation_date', '<=', $max_end)
|
|
39
|
+ ->where(function($query2) use ($level)
|
|
40
|
+ {
|
|
41
|
+ $query2->where("level",$level+1)
|
|
42
|
+ ->orWhere("level",3);
|
|
43
|
+ })
|
|
44
|
+ ->count();
|
|
45
|
+
|
|
46
|
+ foreach($outcomes as $outcome)
|
|
47
|
+ {
|
|
48
|
+
|
|
49
|
+// var_dump($outcome->id);
|
|
50
|
+// print "<br>";
|
|
51
|
+ $outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semesters, $level);
|
|
52
|
+ $outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semesters, $level);
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ $uhs_school_id = School::where('name', 'LIKE', '%UHS%')->first()->id;
|
|
56
|
+ $uhs_program_id = Program::where('name', 'LIKE', '%UHS%')->first()->id;
|
|
57
|
+
|
|
58
|
+ foreach ($outcomes as $outcome)
|
|
59
|
+ {
|
|
60
|
+ $achievedProgramsPerOutcome[$outcome->id]=0; // For each program with courses that do assessment
|
|
61
|
+ $attemptedProgramsPerOutcome[$outcome->id]=0; // For each program with courses that do assessment
|
|
62
|
+ foreach (Program::with(array('courses' => function($query){
|
|
63
|
+// $query->whereNotNull('outcomes_attempted');
|
|
64
|
+ $query->where('code', '!=', 'TEST');
|
|
65
|
+ $query->whereIn('semester_id', Session::get('semesters_ids'));
|
|
66
|
+ }))->where('is_graduate', $level)->where('school_id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get() as $program)
|
|
67
|
+ {
|
|
68
|
+ $achieved_outcomes_per_program[$program->id]=0;
|
|
69
|
+ $attempted_outcomes_per_program[$program->id]=0;
|
|
70
|
+ $participating_programs[$program->id]=(object)array('id'=>$program->id, 'name'=>$program->name, 'is_graduate'=> $program->is_graduate, 'school_id'=>$program->school_id);
|
|
71
|
+
|
|
72
|
+// SELECT ac.id activity_criterion_id, ac.activity_id, ac.expected_student_score, ac.expected_percentage_students_achieving, co.program_id FROM activity_criterion ac, new_criteria c, activities a, objectives o, courses co where co.id=a.course_id and co.semester_id=13 and a.id=ac.activity_id and c.id = ac.criterion_id and o.id=c.objective_id and o.outcome_id = 2 order by program_id
|
|
73
|
+ $program_attempted_outcome=$program->attempted_outcome($outcome->id, $selected_semesters);
|
|
74
|
+ $attempted_outcomes_per_program[$program->id]+=$program_attempted_outcome;
|
|
75
|
+// var_dump($program_attempted_outcome);
|
|
76
|
+// exit();
|
|
77
|
+ if($program_attempted_outcome)
|
|
78
|
+ {
|
|
79
|
+ $program_achieved_outcome=$program->achieved_outcome($outcome->id, $selected_semesters);
|
|
80
|
+ $achieved_outcomes_per_program[$program->id]+=$program_achieved_outcome;
|
|
81
|
+
|
|
82
|
+ $attemptedProgramsPerOutcome[$outcome->id]+=$program_attempted_outcome;
|
|
83
|
+// $attemptedProgramsPerOutcome[$outcome->id]+=1;
|
|
84
|
+ $achievedProgramsPerOutcome[$outcome->id]+=$program_achieved_outcome;
|
|
85
|
+// $achieved_outcomes_per_program[$outcome->id]=$program->achieved_outcome($outcome->id, $selected_semesters);
|
|
86
|
+// if($attempted_outcomes_per_program[$outcome->id]!=0 && 100.0*$achieved_outcomes_per_program[$outcome->id]/$attempted_outcomes_per_program[$outcome->id] >= $outcome->expected_outcome)
|
|
87
|
+// {
|
|
88
|
+// $achievedProgramsPerOutcome[$outcome->id]+=1;
|
|
89
|
+// // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
|
|
90
|
+// }
|
|
91
|
+ }
|
|
92
|
+ }
|
|
93
|
+ }
|
|
94
|
+
|
|
95
|
+ return array('outcomes'=>$outcomes,'outcomes_attempted'=>$outcomes_attempted, 'outcomes_achieved'=>$outcomes_achieved, 'attemptedProgramsPerOutcome'=>$attemptedProgramsPerOutcome, 'achievedProgramsPerOutcome'=>$achievedProgramsPerOutcome,'participating_programs'=>$participating_programs);
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+ }
|
5
|
100
|
public function overview()
|
6
|
101
|
{
|
|
102
|
+
|
|
103
|
+ $selected_semesters = Semester::find(Session::get('semesters_ids'));
|
|
104
|
+
|
|
105
|
+ $subgraduado=$this->outcomes_semesters($selected_semesters,0);
|
|
106
|
+ $outcomes_subgrad=$subgraduado['outcomes'];
|
|
107
|
+ $undergrad_outcomes_achieved=$subgraduado['outcomes_achieved'];
|
|
108
|
+ $undergrad_outcomes_attempted=$subgraduado['outcomes_attempted'];
|
|
109
|
+ $attemptedUndergradProgramsPerOutcome=$subgraduado['attemptedProgramsPerOutcome'];
|
|
110
|
+ $achievedUndergradProgramsPerOutcome=$subgraduado['achievedProgramsPerOutcome'];
|
|
111
|
+ $participating_undergrad_programs=$subgraduado['participating_programs'];
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+ $graduado=$this->outcomes_semesters($selected_semesters,1);
|
|
115
|
+ $outcomes_grad=$graduado['outcomes'];
|
|
116
|
+ $grad_outcomes_achieved=$graduado['outcomes_achieved'];
|
|
117
|
+ $grad_outcomes_attempted=$graduado['outcomes_attempted'];
|
|
118
|
+ $attemptedGradProgramsPerOutcome=$graduado['attemptedProgramsPerOutcome'];
|
|
119
|
+ $achievedGradProgramsPerOutcome=$graduado['achievedProgramsPerOutcome'];
|
|
120
|
+ $participating_grad_programs=$graduado['participating_programs'];
|
|
121
|
+
|
7
|
122
|
//Total amount of learning outcomes
|
8
|
|
- $outcomeCount = Outcome::withTrashed()->count();
|
9
|
|
-
|
|
123
|
+// $outcomeCount = Outcome::withTrashed()->count();
|
|
124
|
+// $selected_semester = Semester::find(Session::get('semesters_ids')[0]);
|
|
125
|
+// $outcomes_subgrad = Outcome::where(function($query) use ($selected_semester)
|
|
126
|
+// {
|
|
127
|
+// $query->where('deactivation_date', '>=', $selected_semester->start)
|
|
128
|
+// ->orWhere('deactivation_date', null);
|
|
129
|
+// })
|
|
130
|
+// ->where('activation_date', '<=', $selected_semester->end)
|
|
131
|
+// ->where(function($query2)
|
|
132
|
+// {
|
|
133
|
+// $query2->where("level",1)
|
|
134
|
+// ->orWhere("level",3);
|
|
135
|
+// })
|
|
136
|
+// ->orderBy('name', 'ASC')
|
|
137
|
+// ->get();
|
|
138
|
+// $outcomeCount_subgrad = Outcome::where(function($query) use ($selected_semester)
|
|
139
|
+// {
|
|
140
|
+// $query->where('deactivation_date', '>=', $selected_semester->start)
|
|
141
|
+// ->orWhere('deactivation_date', null);
|
|
142
|
+// })
|
|
143
|
+// ->where('activation_date', '<=', $selected_semester->end)
|
|
144
|
+// ->where(function($query2)
|
|
145
|
+// {
|
|
146
|
+// $query2->where("level",1)
|
|
147
|
+// ->orWhere("level",3);
|
|
148
|
+// })
|
|
149
|
+// ->count();
|
|
150
|
+//
|
|
151
|
+// $outcomes_grad = Outcome::where(function($query) use ($selected_semester){$query->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null);})->where(function($query2){$query2->where("level",2)->orWhere("level",3);})->orderBy('name', 'ASC')->get();
|
|
152
|
+// $outcomeCount_grad = Outcome::where(function($query) use ($selected_semester){$query->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null);})->where(function($query2){$query2->where("level",2)->orWhere("level",3);})->count();
|
|
153
|
+
|
|
154
|
+// print($outcomeCount_subgrad);
|
|
155
|
+// print($outcomeCount_grad);
|
10
|
156
|
// Id for excluding UHS from records
|
11
|
157
|
$uhs_school_id = School::where('name', 'LIKE', '%UHS%')->first()->id;
|
12
|
|
- $uhs_program_id = Program::where('name', 'LIKE', '%UHS%')->first()->id;
|
|
158
|
+// $uhs_program_id = Program::where('name', 'LIKE', '%UHS%')->first()->id;
|
13
|
159
|
|
14
|
160
|
$schools = School::where('id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get();
|
15
|
161
|
$title = 'Campus Overview';
|
16
|
|
- $outcomes = Outcome::withTrashed()->select('id', 'name', 'expected_outcome')->orderBy('name', 'asc')->get();
|
17
|
|
-
|
18
|
|
- $undergrad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
|
19
|
|
- $undergrad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
|
20
|
|
- $grad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
|
21
|
|
- $grad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
|
22
|
|
-
|
|
162
|
+
|
|
163
|
+
|
23
|
164
|
/**
|
24
|
|
- * Calculate campus wide outcome performance
|
|
165
|
+ * Calculate campus wide outcome performance by counting the number of students
|
|
166
|
+ $undergrad_outcomes_attempted will have the number of criteria that was assessed in undergradute courses during the selected semester
|
|
167
|
+ $undergrad_outcomes_achieved will have the number of criteria that was assessed in undergradute courses during the selected semester
|
|
168
|
+ where the percentage of students that obtained a better or equal score than the expected_student_score established in the
|
|
169
|
+ activity_criterion table is greater or equal than the expected_percentage_students_achieving also established in the
|
|
170
|
+ activity_criterion table
|
25
|
171
|
*/
|
26
|
172
|
|
27
|
|
- // Calculate campus wide outcome performance for undergrad and grad
|
28
|
|
- foreach (Course::with('program')
|
29
|
|
- ->where('program_id', '!=', $uhs_program_id)
|
30
|
|
- ->where('code', '!=', 'TEST')
|
31
|
|
- ->whereNotNull('outcomes_achieved')
|
32
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))->get() as $course)
|
33
|
|
- {
|
34
|
|
- if(!$course->program->is_graduate)
|
35
|
|
- {
|
36
|
|
- $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
|
37
|
|
- $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
|
38
|
|
- for($i=1; $i<=count($undergrad_outcomes_attempted); $i++)
|
39
|
|
- {
|
40
|
|
-
|
41
|
|
- $undergrad_outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
|
42
|
|
- $undergrad_outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
|
43
|
|
- }
|
44
|
|
- }
|
45
|
|
- else
|
46
|
|
- {
|
47
|
|
- $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
|
48
|
|
- $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
|
49
|
|
- for($i=1; $i<=count($grad_outcomes_attempted); $i++)
|
50
|
|
- {
|
51
|
|
-
|
52
|
|
- $grad_outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
|
53
|
|
- $grad_outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
|
54
|
|
- }
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
- }
|
|
173
|
+// foreach($outcomes_subgrad as $outcome)
|
|
174
|
+// {
|
|
175
|
+// $undergrad_outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semester->id,0);
|
|
176
|
+// $undergrad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,0);
|
|
177
|
+// }
|
|
178
|
+// var_dump($undergrad_outcomes_attempted);
|
|
179
|
+// print"<br>";
|
|
180
|
+// var_dump($undergrad_outcomes_achieved);
|
|
181
|
+// print"<br>";
|
|
182
|
+// foreach($outcomes_grad as $outcome)
|
|
183
|
+// {
|
|
184
|
+// $grad_outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semester->id,1);
|
|
185
|
+// $grad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,1);
|
|
186
|
+// }
|
58
|
187
|
|
59
|
188
|
/**
|
60
|
189
|
* Calculate how many programs achieved and attempted each outcome
|
61
|
190
|
*/
|
62
|
191
|
|
63
|
192
|
// Number of programs that achieved a particular learning outcome
|
64
|
|
- $achievedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
|
193
|
+// $achievedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount_subgrad, 0);
|
65
|
194
|
|
66
|
195
|
// Number of programs that attempted a particular learning outcome
|
67
|
|
- $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
|
196
|
+// $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount_subgrad, 0);
|
68
|
197
|
|
69
|
198
|
// Names of programs doing assessment
|
70
|
199
|
// Fetch programs with participation
|
71
|
|
- $participating_undergrad_programs = DB::table('VIEW_participating_programs')
|
72
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))
|
73
|
|
- ->where('is_graduate', 0)
|
74
|
|
- ->groupBy('id')
|
75
|
|
- ->orderBy('name', 'asc')
|
76
|
|
- ->get();
|
77
|
|
-
|
78
|
|
- $output = array();
|
79
|
|
-
|
80
|
|
-
|
81
|
|
- // For each outcome
|
82
|
|
- foreach ($outcomes as $outcome)
|
83
|
|
- {
|
84
|
|
- // For each program with courses that do assessment
|
85
|
|
- foreach (Program::with(array('courses' => function($query){
|
86
|
|
- $query->whereNotNull('outcomes_attempted');
|
87
|
|
- $query->where('code', '!=', 'TEST');
|
88
|
|
- $query->whereIn('semester_id', Session::get('semesters_ids'));
|
89
|
|
- }))->where('is_graduate', 0)->orderBy('name', 'asc')->get() as $program)
|
90
|
|
- {
|
91
|
|
- // To acummulate all criteria for one program
|
92
|
|
- $achieved_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
|
93
|
|
- $attempted_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
|
94
|
|
-
|
95
|
|
- //Flag for counting programs
|
96
|
|
- $flag =false;
|
97
|
|
-
|
98
|
|
- // For each course in the program
|
99
|
|
- foreach ($program->courses as $course)
|
100
|
|
- {
|
101
|
|
- // If the outcome in question is being evaluated
|
102
|
|
- $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
|
103
|
|
- $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
|
104
|
|
- if(array_key_exists($outcome->id, $course_outcomes_attempted2 )
|
105
|
|
- && $course_outcomes_attempted2[$outcome->id]>0)
|
106
|
|
- {
|
107
|
|
- $achieved_outcomes_per_undergrad_program[$outcome->id]+=$course_outcomes_achieved2[$outcome->id];
|
108
|
|
- $attempted_outcomes_per_undergrad_program[$outcome->id]+=$course_outcomes_attempted2[$outcome->id];
|
109
|
|
-
|
110
|
|
-
|
111
|
|
- // Add one to the programs assessing, if it wasn't added before
|
112
|
|
- if(!$flag)
|
113
|
|
- {
|
114
|
|
- $attemptedUndergradProgramsPerOutcome[$outcome->id]+=1;
|
115
|
|
- $flag= true;
|
116
|
|
- }
|
117
|
|
- }
|
118
|
|
-
|
119
|
|
- // $output[] = 'ACHIEVED: '.$program->name.'-'.json_encode($achieved_outcomes_per_undergrad_program);
|
120
|
|
- // $output[] = 'ATTEMPTED: '.$program->name.'-'.json_encode($attempted_outcomes_per_undergrad_program);
|
121
|
|
-
|
122
|
|
- }
|
123
|
|
- //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
|
124
|
|
- 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)
|
125
|
|
- {
|
126
|
|
- $achievedUndergradProgramsPerOutcome[$outcome->id]+=1;
|
127
|
|
- // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedUndergradProgramsPerOutcome);
|
128
|
|
- }
|
129
|
|
- }
|
130
|
|
- }
|
131
|
|
-
|
|
200
|
+// $participating_undergrad_programs = DB::table('VIEW_participating_programs')
|
|
201
|
+// ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
202
|
+// ->where('is_graduate', 0)
|
|
203
|
+// ->groupBy('id')
|
|
204
|
+// ->orderBy('name', 'asc')
|
|
205
|
+// ->get();
|
|
206
|
+// $output = array();
|
132
|
207
|
|
133
|
208
|
/**
|
134
|
|
- * Calculate how many programs achieved and attempted each outcome
|
|
209
|
+ * Calculate how many undergrad programs achieved and attempted each outcome
|
|
210
|
+ */
|
|
211
|
+// foreach ($outcomes_subgrad as $outcome)
|
|
212
|
+// {
|
|
213
|
+// $achieved_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
214
|
+// $attempted_outcomes_per_undergrad_program[$outcome->id]=0;
|
|
215
|
+// $achievedUndergradProgramsPerOutcome[$outcome->id]=0; // For each program with courses that do assessment
|
|
216
|
+// $attemptedUndergradProgramsPerOutcome[$outcome->id]=0; // For each program with courses that do assessment
|
|
217
|
+// foreach (Program::with(array('courses' => function($query){
|
|
218
|
+// // $query->whereNotNull('outcomes_attempted');
|
|
219
|
+// $query->where('code', '!=', 'TEST');
|
|
220
|
+// $query->whereIn('semester_id', Session::get('semesters_ids'));
|
|
221
|
+// }))->where('is_graduate', 0)->where('school_id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get() as $program)
|
|
222
|
+// {
|
|
223
|
+// $participating_undergrad_programs[$program->id]=(object)array('id'=>$program->id, 'name'=>$program->name, 'is_graduate'=> $program->is_graduate, 'school_id'=>$program->school_id,'semestre_id',$selected_semester);
|
|
224
|
+//
|
|
225
|
+// // SELECT ac.id activity_criterion_id, ac.activity_id, ac.expected_student_score, ac.expected_percentage_students_achieving, co.program_id FROM activity_criterion ac, new_criteria c, activities a, objectives o, courses co where co.id=a.course_id and co.semester_id=13 and a.id=ac.activity_id and c.id = ac.criterion_id and o.id=c.objective_id and o.outcome_id = 2 order by program_id
|
|
226
|
+// $program_attempted_outcome=$program->attempted_outcome($outcome->id, $selected_semester->id);
|
|
227
|
+// $attempted_outcomes_per_undergrad_program[$outcome->id]+=$program_attempted_outcome;
|
|
228
|
+// // var_dump($program_attempted_outcome);
|
|
229
|
+// // exit();
|
|
230
|
+// if($program_attempted_outcome)
|
|
231
|
+// {
|
|
232
|
+// $attemptedUndergradProgramsPerOutcome[$outcome->id]+=1;
|
|
233
|
+// $achieved_outcomes_per_undergrad_program[$outcome->id]=$program->achieved_outcome($outcome->id, $selected_semester->id);
|
|
234
|
+// if($attempted_outcomes_per_undergrad_program[$outcome->id]!=0 && 100.0*$achieved_outcomes_per_undergrad_program[$outcome->id]/$attempted_outcomes_per_undergrad_program[$outcome->id] >= $outcome->expected_outcome)
|
|
235
|
+// {
|
|
236
|
+// $achievedUndergradProgramsPerOutcome[$outcome->id]+=1;
|
|
237
|
+// // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedUndergradProgramsPerOutcome);
|
|
238
|
+// }
|
|
239
|
+// }
|
|
240
|
+// }
|
|
241
|
+// }
|
|
242
|
+// var_dump($attempted_outcomes_per_undergrad_program);
|
|
243
|
+// print"<br>";
|
|
244
|
+// var_dump($achieved_outcomes_per_undergrad_program);
|
|
245
|
+// print"<br>";
|
|
246
|
+// var_dump($attemptedUndergradProgramsPerOutcome);
|
|
247
|
+// print"<br>";
|
|
248
|
+// var_dump($achievedUndergradProgramsPerOutcome);
|
|
249
|
+// print"<br>";
|
|
250
|
+// exit();
|
|
251
|
+ /**
|
|
252
|
+ * Calculate how many grad programs achieved and attempted each outcome
|
|
253
|
+ $grad_outcomes_attempted will have the number of criteria that was assessed in gradute courses during the selected semester
|
|
254
|
+ $grad_outcomes_achieved will have the number of criteria that was assessed in gradute courses during the selected semester
|
|
255
|
+ where the percentage of students that obtained a better or equal score than the expected_student_score established in the
|
|
256
|
+ activity_criterion table is greater or equal than the expected_percentage_students_achieving also established in the
|
|
257
|
+ activity_criterion table
|
135
|
258
|
*/
|
136
|
259
|
|
137
|
|
- // Number of programs that achieved a particular learning outcome
|
138
|
|
- $achievedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
139
|
|
-
|
140
|
|
- // Number of programs that attempted a particular learning outcome
|
141
|
|
- $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
|
142
|
260
|
|
143
|
261
|
// Names of programs doing assessment
|
144
|
|
- $participating_grad_programs = DB::table('VIEW_participating_programs')
|
145
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))
|
146
|
|
- ->where('is_graduate', 1)
|
147
|
|
- ->groupBy('id')
|
148
|
|
- ->orderBy('name', 'asc')
|
149
|
|
- ->get();
|
150
|
|
-
|
151
|
|
- $output = array();
|
152
|
|
-
|
153
|
|
-
|
154
|
|
- // For each outcome
|
155
|
|
- foreach ($outcomes as $outcome)
|
156
|
|
- {
|
157
|
|
- // For each program with courses that do assessment
|
158
|
|
- foreach (Program::with(array('courses' => function($query){
|
159
|
|
- $query->whereNotNull('outcomes_attempted');
|
160
|
|
- $query->where('code', '!=', 'TEST');
|
161
|
|
- $query->whereIn('semester_id', Session::get('semesters_ids'));
|
162
|
|
- }))->where('is_graduate', 1)->orderBy('name', 'asc')->get() as $program)
|
163
|
|
- {
|
164
|
|
- // To acummulate all criteria for one program
|
165
|
|
- $achieved_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
|
166
|
|
- $attempted_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
|
167
|
|
-
|
168
|
|
- //Flag for counting programs
|
169
|
|
- $flag =false;
|
170
|
|
-
|
171
|
|
- // For each course in the program
|
172
|
|
- foreach ($program->courses as $course)
|
173
|
|
- {
|
174
|
|
- // If the outcome in question is being evaluated
|
175
|
|
- $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
|
176
|
|
- $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
|
177
|
|
- if(array_key_exists($outcome->id, $course_outcomes_attempted2 )
|
178
|
|
- && $course_outcomes_attempted2[$outcome->id]>0)
|
179
|
|
- {
|
180
|
|
- $achieved_outcomes_per_grad_program[$outcome->id]+=$course_outcomes_achieved2[$outcome->id];
|
181
|
|
- $attempted_outcomes_per_grad_program[$outcome->id]+=$course_outcomes_attempted2[$outcome->id];
|
182
|
|
-
|
183
|
|
-
|
184
|
|
- // Add one to the programs assessing, if it wasn't added before
|
185
|
|
- if(!$flag)
|
186
|
|
- {
|
187
|
|
- $attemptedGradProgramsPerOutcome[$outcome->id]+=1;
|
188
|
|
- $flag= true;
|
189
|
|
- }
|
190
|
|
- }
|
191
|
|
-
|
192
|
|
- // $output[] = 'ACHIEVED: '.$program->name.'-'.json_encode($achieved_outcomes_per_grad_program);
|
193
|
|
- // $output[] = 'ATTEMPTED: '.$program->name.'-'.json_encode($attempted_outcomes_per_grad_program);
|
194
|
|
-
|
195
|
|
- }
|
196
|
|
- //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
|
197
|
|
- 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)
|
198
|
|
- {
|
199
|
|
- $achievedGradProgramsPerOutcome[$outcome->id]+=1;
|
200
|
|
- // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedGradProgramsPerOutcome);
|
201
|
|
- }
|
202
|
|
- }
|
203
|
|
- }
|
204
|
|
-
|
205
|
|
- return View::make('local.managers.admins.overview', compact('title', 'schools', 'outcomes', 'undergrad_outcomes_achieved', 'undergrad_outcomes_attempted', 'grad_outcomes_achieved', 'grad_outcomes_attempted', 'attemptedUndergradProgramsPerOutcome', 'participating_undergrad_programs', 'achievedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'participating_grad_programs', 'achievedGradProgramsPerOutcome'));
|
|
262
|
+// $participating_grad_programs = DB::table('VIEW_participating_programs')
|
|
263
|
+// ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
264
|
+// ->where('is_graduate', 1)
|
|
265
|
+// ->groupBy('id')
|
|
266
|
+// ->orderBy('name', 'asc')
|
|
267
|
+// ->get();
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+// foreach ($outcomes_grad as $outcome)
|
|
271
|
+// {
|
|
272
|
+// $achieved_outcomes_per_grad_program[$outcome->id]=0;
|
|
273
|
+// $attempted_outcomes_per_grad_program[$outcome->id]=0;
|
|
274
|
+// $achievedGradProgramsPerOutcome[$outcome->id]=0; // For each program with courses that do assessment
|
|
275
|
+// $attemptedGradProgramsPerOutcome[$outcome->id]=0; // For each program with courses that do assessment
|
|
276
|
+// foreach (Program::with(array('courses' => function($query){
|
|
277
|
+// $query->whereNotNull('outcomes_attempted');
|
|
278
|
+// $query->where('code', '!=', 'TEST');
|
|
279
|
+// $query->whereIn('semester_id', Session::get('semesters_ids'));
|
|
280
|
+// }))->where('is_graduate', 1)->where('school_id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get() as $program)
|
|
281
|
+// {
|
|
282
|
+// $participating_grad_programs[$program->id]=(object)array('id'=>$program->id, 'name'=>$program->name, 'is_graduate'=> $program->is_graduate, 'school_id'=>$program->school_id,'semestre_id',$selected_semester);
|
|
283
|
+// // SELECT ac.id activity_criterion_id, ac.activity_id, ac.expected_student_score, ac.expected_percentage_students_achieving, co.program_id FROM activity_criterion ac, new_criteria c, activities a, objectives o, courses co where co.id=a.course_id and co.semester_id=13 and a.id=ac.activity_id and c.id = ac.criterion_id and o.id=c.objective_id and o.outcome_id = 2 order by program_id
|
|
284
|
+// $program_attempted_outcome=$program->attempted_outcome($outcome->id, $selected_semester->id);
|
|
285
|
+// $attempted_outcomes_per_grad_program[$outcome->id]+=$program_attempted_outcome;
|
|
286
|
+// // var_dump($attempted_outcomes_per_undergrad_program);
|
|
287
|
+// // exit();
|
|
288
|
+// if($program_attempted_outcome)
|
|
289
|
+// {
|
|
290
|
+// $attemptedGradProgramsPerOutcome[$outcome->id]+=1;
|
|
291
|
+// $achieved_outcomes_per_grad_program[$outcome->id]=$program->achieved_outcome($outcome->id, $selected_semester->id);
|
|
292
|
+// 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)
|
|
293
|
+// {
|
|
294
|
+// $achievedGradProgramsPerOutcome[$outcome->id]+=1;
|
|
295
|
+// // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedUndergradProgramsPerOutcome);
|
|
296
|
+// }
|
|
297
|
+// }
|
|
298
|
+// }
|
|
299
|
+// }
|
|
300
|
+// var_dump($grad_outcomes_attempted);
|
|
301
|
+// print("<br>");
|
|
302
|
+// var_dump($grad_outcomes_achieved);
|
|
303
|
+// exit();
|
|
304
|
+ return View::make('local.managers.admins.overview', compact('title', 'schools', 'outcomes_subgrad', 'outcomes_grad', 'undergrad_outcomes_achieved', 'undergrad_outcomes_attempted', 'grad_outcomes_achieved', 'grad_outcomes_attempted', 'attemptedUndergradProgramsPerOutcome', 'participating_undergrad_programs', 'achievedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'participating_grad_programs', 'achievedGradProgramsPerOutcome'));
|
206
|
305
|
}
|
207
|
306
|
}
|