|
@@ -2,7 +2,8 @@
|
2
|
2
|
|
3
|
3
|
use Illuminate\Database\Eloquent\Collection;
|
4
|
4
|
|
5
|
|
-class OutcomesController extends \BaseController {
|
|
5
|
+class OutcomesController extends \BaseController
|
|
6
|
+{
|
6
|
7
|
|
7
|
8
|
|
8
|
9
|
/**
|
|
@@ -25,7 +26,7 @@ class OutcomesController extends \BaseController {
|
25
|
26
|
public function newIndex()
|
26
|
27
|
{
|
27
|
28
|
$title = "Learning Outcomes";
|
28
|
|
-// TODO: Check when semester doesnt exist or session is empty
|
|
29
|
+ // TODO: Check when semester doesnt exist or session is empty
|
29
|
30
|
$selected_semester = Semester::find(Session::get('semesters_ids')[0]);
|
30
|
31
|
$outcomes = Outcome::withTrashed()->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null)->orderBy('name', 'ASC')->get();
|
31
|
32
|
$schools = School::orderBy('name', 'ASC')->get();
|
|
@@ -35,187 +36,181 @@ class OutcomesController extends \BaseController {
|
35
|
36
|
|
36
|
37
|
public function show($id)
|
37
|
38
|
{
|
38
|
|
- $outcome = Outcome::find($id);
|
|
39
|
+ $outcome = Outcome::find($id);
|
39
|
40
|
$selected_semesters = Semester::find(Session::get('semesters_ids'));
|
40
|
|
- $programs=$outcome->programs_attempted($selected_semesters);
|
41
|
|
-
|
42
|
|
- $undergradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
43
|
|
- $gradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
44
|
|
- foreach($programs as $program_id)
|
45
|
|
- {
|
46
|
|
- // var_dump($program_id);
|
47
|
|
-// exit();
|
48
|
|
- $program = Program::where('id','=',$program_id->id)->first();
|
49
|
|
- $school = School::where('id','=',$program->school_id)->first();
|
50
|
|
- if($program->is_graduate)
|
51
|
|
- {
|
52
|
|
- $gradResults['names'][]=$program->name;
|
53
|
|
- $gradResults['schools'][]=$school->name;
|
54
|
|
- $attempted=$program->attempted_criteria_by_outcome($id, $selected_semesters);
|
55
|
|
- $gradResults['attempted'][]=$attempted;
|
56
|
|
- $achieved=$program->achieved_criteria_by_outcome($id, $selected_semesters);
|
57
|
|
- $gradResults['achieved'][]=$achieved;
|
58
|
|
- $gradResults['successRate'][]=sprintf("%.2f",100*$achieved/$attempted);
|
59
|
|
-
|
60
|
|
- }
|
61
|
|
- else
|
62
|
|
- {
|
63
|
|
- $undergradResults['names'][]=$program->name;
|
64
|
|
- $undergradResults['schools'][]=$school->name;
|
65
|
|
- $attempted=$program->attempted_criteria_by_outcome($id,$selected_semesters);
|
66
|
|
- $undergradResults['attempted'][]=$attempted;
|
67
|
|
- $achieved=$program->achieved_criteria_by_outcome($id,$selected_semesters);
|
68
|
|
- $undergradResults['achieved'][]=$achieved;
|
69
|
|
- $undergradResults['successRate'][]=sprintf("%.2f",100*$achieved/$attempted);
|
70
|
|
- }
|
71
|
|
-
|
|
41
|
+ $programs = $outcome->programs_attempted($selected_semesters);
|
|
42
|
+
|
|
43
|
+ $undergradResults = array("names" => array(), "schools" => array(), "achieved" => array(), "attempted" => array(), "successRate" => array());
|
|
44
|
+ $gradResults = array("names" => array(), "schools" => array(), "achieved" => array(), "attempted" => array(), "successRate" => array());
|
|
45
|
+ foreach ($programs as $program_id) {
|
|
46
|
+ // var_dump($program_id);
|
|
47
|
+ // exit();
|
|
48
|
+ $program = Program::where('id', '=', $program_id->id)->first();
|
|
49
|
+ $school = School::where('id', '=', $program->school_id)->first();
|
|
50
|
+ if ($program->is_graduate) {
|
|
51
|
+ $gradResults['names'][] = $program->name;
|
|
52
|
+ $gradResults['schools'][] = $school->name;
|
|
53
|
+ $attempted = $program->attempted_criteria_by_outcome($id, $selected_semesters);
|
|
54
|
+ $gradResults['attempted'][] = $attempted;
|
|
55
|
+ $achieved = $program->achieved_criteria_by_outcome($id, $selected_semesters);
|
|
56
|
+ $gradResults['achieved'][] = $achieved;
|
|
57
|
+ $gradResults['successRate'][] = sprintf("%.2f", 100 * $achieved / $attempted);
|
|
58
|
+ } else {
|
|
59
|
+ $undergradResults['names'][] = $program->name;
|
|
60
|
+ $undergradResults['schools'][] = $school->name;
|
|
61
|
+ $attempted = $program->attempted_criteria_by_outcome($id, $selected_semesters);
|
|
62
|
+ $undergradResults['attempted'][] = $attempted;
|
|
63
|
+ $achieved = $program->achieved_criteria_by_outcome($id, $selected_semesters);
|
|
64
|
+ $undergradResults['achieved'][] = $achieved;
|
|
65
|
+ $undergradResults['successRate'][] = sprintf("%.2f", 100 * $achieved / $attempted);
|
|
66
|
+ }
|
72
|
67
|
}
|
73
|
|
-
|
74
|
|
- $title = "Outcome Results: ".$outcome->name;
|
75
|
|
-
|
76
|
|
-
|
77
|
|
-// $undergradResults["successRate"]
|
78
|
|
-
|
|
68
|
+
|
|
69
|
+ $title = "Outcome Results: " . $outcome->name;
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+ // $undergradResults["successRate"]
|
|
73
|
+
|
79
|
74
|
return View::make('local.managers.admins.learning-outcome_new', compact('title', 'outcome', 'undergradResults', 'gradResults'));
|
80
|
75
|
}
|
81
|
76
|
|
82
|
|
-// public function show($id)
|
83
|
|
-// {
|
84
|
|
-// DB::disableQueryLog();
|
85
|
|
-// $outcome = Outcome::find($id);
|
86
|
|
-//
|
87
|
|
-// $undergradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
88
|
|
-// $gradResults = array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
89
|
|
-//
|
90
|
|
-// //Calculate performance for this outcome for each undergrad program
|
91
|
|
-// $undergradPrograms = Program::where('is_graduate','=', 0)
|
92
|
|
-// ->where(function($query)
|
93
|
|
-// {
|
94
|
|
-// if(Auth::user()->school_id)
|
95
|
|
-// {
|
96
|
|
-// $query->where('school_id', Auth::user()->school_id);
|
97
|
|
-// }
|
98
|
|
-// })
|
99
|
|
-// ->with('courses')
|
100
|
|
-// ->orderBy('name', 'asc')->get();
|
101
|
|
-//
|
102
|
|
-// foreach($undergradPrograms as $program)
|
103
|
|
-// {
|
104
|
|
-// $undergradResults["names"][$program->id]=$program->name;
|
105
|
|
-// $undergradResults["schools"][$program->id]=$program->school->name;
|
106
|
|
-// $programAssessed=false;
|
107
|
|
-//
|
108
|
|
-// $undergradResults["attempted"][$program->id]=0;
|
109
|
|
-// $undergradResults["achieved"][$program->id]=0;
|
110
|
|
-//
|
111
|
|
-// foreach($program->courses as $course)
|
112
|
|
-// {
|
113
|
|
-// $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
114
|
|
-// $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
115
|
|
-//
|
116
|
|
-// $attemptedCriteriaCount=0;
|
117
|
|
-// $achievedCriteriaCount=0;
|
118
|
|
-//
|
119
|
|
-// // If this outcome was evaluated
|
120
|
|
-// if(
|
121
|
|
-// $course_outcomes_attempted
|
122
|
|
-// && array_key_exists($outcome->id, $course_outcomes_attempted)
|
123
|
|
-// && $course_outcomes_attempted[$outcome->id]!=0)
|
124
|
|
-// {
|
125
|
|
-// // Count +1 for attempted and achieved in the program
|
126
|
|
-// $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
127
|
|
-// $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
128
|
|
-// $programAssessed=true;
|
129
|
|
-//
|
130
|
|
-// if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
131
|
|
-// {
|
132
|
|
-// $undergradResults["achieved"][$program->id]+=1;
|
133
|
|
-// }
|
134
|
|
-// $undergradResults["attempted"][$program->id]+=1;
|
135
|
|
-// }
|
136
|
|
-// }
|
137
|
|
-//
|
138
|
|
-// // Calculate success rate for this program
|
139
|
|
-// if($programAssessed && $undergradResults["attempted"][$program->id]>0)
|
140
|
|
-// $undergradResults["successRate"][$program->id]= round((float)$undergradResults["achieved"][$program->id]/$undergradResults["attempted"][$program->id]*100, 2).'%';
|
141
|
|
-// else
|
142
|
|
-// $undergradResults["successRate"][$program->id]= 'N/M';
|
143
|
|
-// }
|
144
|
|
-//
|
145
|
|
-//
|
146
|
|
-// //Calculate performance for this outcome for each grad program
|
147
|
|
-// $gradPrograms = Program::where('is_graduate','=', 1)
|
148
|
|
-// ->where(function($query)
|
149
|
|
-// {
|
150
|
|
-// if(Auth::user()->school_id)
|
151
|
|
-// {
|
152
|
|
-// $query->where('school_id', Auth::user()->school_id);
|
153
|
|
-// }
|
154
|
|
-// })
|
155
|
|
-// ->with(array('courses'=>function($query)
|
156
|
|
-// {
|
157
|
|
-// $query->whereNotNull('outcomes_attempted');
|
158
|
|
-// }))
|
159
|
|
-// ->orderBy('name', 'asc')->get();
|
160
|
|
-//
|
161
|
|
-// foreach($gradPrograms as $program)
|
162
|
|
-// {
|
163
|
|
-// $gradResults["names"][$program->id]=$program->name;
|
164
|
|
-// $gradResults["schools"][$program->id]=$program->school->name;
|
165
|
|
-//
|
166
|
|
-// $programAssessed=false;
|
167
|
|
-//
|
168
|
|
-// $gradResults["attempted"][$program->id]=0;
|
169
|
|
-// $gradResults["achieved"][$program->id]=0;
|
170
|
|
-//
|
171
|
|
-// foreach($program->courses as $course)
|
172
|
|
-// {
|
173
|
|
-// $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
174
|
|
-// $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
175
|
|
-//
|
176
|
|
-// $attemptedCriteriaCount=0;
|
177
|
|
-// $achievedCriteriaCount=0;
|
178
|
|
-//
|
179
|
|
-// // If this outcome was evaluated
|
180
|
|
-// if(
|
181
|
|
-// $course_outcomes_attempted
|
182
|
|
-// && array_key_exists($outcome->id, $course_outcomes_attempted)
|
183
|
|
-// && $course_outcomes_attempted[$outcome->id]!=0)
|
184
|
|
-// {
|
185
|
|
-// // Count +1 for attempted and achieved in the program
|
186
|
|
-// $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
187
|
|
-// $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
188
|
|
-// $programAssessed=true;
|
189
|
|
-//
|
190
|
|
-// if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
191
|
|
-// {
|
192
|
|
-// $gradResults["achieved"][$program->id]+=1;
|
193
|
|
-// }
|
194
|
|
-// $gradResults["attempted"][$program->id]+=1;
|
195
|
|
-// }
|
196
|
|
-// }
|
197
|
|
-//
|
198
|
|
-// // Calculate success rate for this program
|
199
|
|
-// if($programAssessed && $gradResults["attempted"][$program->id]>0)
|
200
|
|
-// $gradResults["successRate"][$program->id]= round((float)$gradResults["achieved"][$program->id]/$gradResults["attempted"][$program->id]*100, 2).'%';
|
201
|
|
-// else
|
202
|
|
-// $gradResults["successRate"][$program->id]= 'N/M';
|
203
|
|
-// }
|
204
|
|
-//
|
205
|
|
-// $title = "Outcome Results: ".$outcome->name;
|
206
|
|
-//
|
207
|
|
-// return View::make('local.managers.admins.learning-outcome', compact('title', 'outcome', 'undergradResults', 'gradResults'));
|
208
|
|
-// }
|
|
77
|
+ // public function show($id)
|
|
78
|
+ // {
|
|
79
|
+ // DB::disableQueryLog();
|
|
80
|
+ // $outcome = Outcome::find($id);
|
|
81
|
+ //
|
|
82
|
+ // $undergradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
|
83
|
+ // $gradResults = array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
|
|
84
|
+ //
|
|
85
|
+ // //Calculate performance for this outcome for each undergrad program
|
|
86
|
+ // $undergradPrograms = Program::where('is_graduate','=', 0)
|
|
87
|
+ // ->where(function($query)
|
|
88
|
+ // {
|
|
89
|
+ // if(Auth::user()->school_id)
|
|
90
|
+ // {
|
|
91
|
+ // $query->where('school_id', Auth::user()->school_id);
|
|
92
|
+ // }
|
|
93
|
+ // })
|
|
94
|
+ // ->with('courses')
|
|
95
|
+ // ->orderBy('name', 'asc')->get();
|
|
96
|
+ //
|
|
97
|
+ // foreach($undergradPrograms as $program)
|
|
98
|
+ // {
|
|
99
|
+ // $undergradResults["names"][$program->id]=$program->name;
|
|
100
|
+ // $undergradResults["schools"][$program->id]=$program->school->name;
|
|
101
|
+ // $programAssessed=false;
|
|
102
|
+ //
|
|
103
|
+ // $undergradResults["attempted"][$program->id]=0;
|
|
104
|
+ // $undergradResults["achieved"][$program->id]=0;
|
|
105
|
+ //
|
|
106
|
+ // foreach($program->courses as $course)
|
|
107
|
+ // {
|
|
108
|
+ // $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
|
109
|
+ // $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
|
110
|
+ //
|
|
111
|
+ // $attemptedCriteriaCount=0;
|
|
112
|
+ // $achievedCriteriaCount=0;
|
|
113
|
+ //
|
|
114
|
+ // // If this outcome was evaluated
|
|
115
|
+ // if(
|
|
116
|
+ // $course_outcomes_attempted
|
|
117
|
+ // && array_key_exists($outcome->id, $course_outcomes_attempted)
|
|
118
|
+ // && $course_outcomes_attempted[$outcome->id]!=0)
|
|
119
|
+ // {
|
|
120
|
+ // // Count +1 for attempted and achieved in the program
|
|
121
|
+ // $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
|
122
|
+ // $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
|
123
|
+ // $programAssessed=true;
|
|
124
|
+ //
|
|
125
|
+ // if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
|
126
|
+ // {
|
|
127
|
+ // $undergradResults["achieved"][$program->id]+=1;
|
|
128
|
+ // }
|
|
129
|
+ // $undergradResults["attempted"][$program->id]+=1;
|
|
130
|
+ // }
|
|
131
|
+ // }
|
|
132
|
+ //
|
|
133
|
+ // // Calculate success rate for this program
|
|
134
|
+ // if($programAssessed && $undergradResults["attempted"][$program->id]>0)
|
|
135
|
+ // $undergradResults["successRate"][$program->id]= round((float)$undergradResults["achieved"][$program->id]/$undergradResults["attempted"][$program->id]*100, 2).'%';
|
|
136
|
+ // else
|
|
137
|
+ // $undergradResults["successRate"][$program->id]= 'N/M';
|
|
138
|
+ // }
|
|
139
|
+ //
|
|
140
|
+ //
|
|
141
|
+ // //Calculate performance for this outcome for each grad program
|
|
142
|
+ // $gradPrograms = Program::where('is_graduate','=', 1)
|
|
143
|
+ // ->where(function($query)
|
|
144
|
+ // {
|
|
145
|
+ // if(Auth::user()->school_id)
|
|
146
|
+ // {
|
|
147
|
+ // $query->where('school_id', Auth::user()->school_id);
|
|
148
|
+ // }
|
|
149
|
+ // })
|
|
150
|
+ // ->with(array('courses'=>function($query)
|
|
151
|
+ // {
|
|
152
|
+ // $query->whereNotNull('outcomes_attempted');
|
|
153
|
+ // }))
|
|
154
|
+ // ->orderBy('name', 'asc')->get();
|
|
155
|
+ //
|
|
156
|
+ // foreach($gradPrograms as $program)
|
|
157
|
+ // {
|
|
158
|
+ // $gradResults["names"][$program->id]=$program->name;
|
|
159
|
+ // $gradResults["schools"][$program->id]=$program->school->name;
|
|
160
|
+ //
|
|
161
|
+ // $programAssessed=false;
|
|
162
|
+ //
|
|
163
|
+ // $gradResults["attempted"][$program->id]=0;
|
|
164
|
+ // $gradResults["achieved"][$program->id]=0;
|
|
165
|
+ //
|
|
166
|
+ // foreach($program->courses as $course)
|
|
167
|
+ // {
|
|
168
|
+ // $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
|
|
169
|
+ // $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
|
|
170
|
+ //
|
|
171
|
+ // $attemptedCriteriaCount=0;
|
|
172
|
+ // $achievedCriteriaCount=0;
|
|
173
|
+ //
|
|
174
|
+ // // If this outcome was evaluated
|
|
175
|
+ // if(
|
|
176
|
+ // $course_outcomes_attempted
|
|
177
|
+ // && array_key_exists($outcome->id, $course_outcomes_attempted)
|
|
178
|
+ // && $course_outcomes_attempted[$outcome->id]!=0)
|
|
179
|
+ // {
|
|
180
|
+ // // Count +1 for attempted and achieved in the program
|
|
181
|
+ // $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
|
|
182
|
+ // $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
|
|
183
|
+ // $programAssessed=true;
|
|
184
|
+ //
|
|
185
|
+ // if($attemptedCriteriaCount>0 &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
|
|
186
|
+ // {
|
|
187
|
+ // $gradResults["achieved"][$program->id]+=1;
|
|
188
|
+ // }
|
|
189
|
+ // $gradResults["attempted"][$program->id]+=1;
|
|
190
|
+ // }
|
|
191
|
+ // }
|
|
192
|
+ //
|
|
193
|
+ // // Calculate success rate for this program
|
|
194
|
+ // if($programAssessed && $gradResults["attempted"][$program->id]>0)
|
|
195
|
+ // $gradResults["successRate"][$program->id]= round((float)$gradResults["achieved"][$program->id]/$gradResults["attempted"][$program->id]*100, 2).'%';
|
|
196
|
+ // else
|
|
197
|
+ // $gradResults["successRate"][$program->id]= 'N/M';
|
|
198
|
+ // }
|
|
199
|
+ //
|
|
200
|
+ // $title = "Outcome Results: ".$outcome->name;
|
|
201
|
+ //
|
|
202
|
+ // return View::make('local.managers.admins.learning-outcome', compact('title', 'outcome', 'undergradResults', 'gradResults'));
|
|
203
|
+ // }
|
209
|
204
|
|
210
|
205
|
// TODO: Clean up and verify relationships are correct
|
211
|
206
|
public function newShow($id)
|
212
|
207
|
{
|
213
|
|
-// DB::disableQueryLog();
|
214
|
|
-// $outcome = null;
|
|
208
|
+ // DB::disableQueryLog();
|
|
209
|
+ // $outcome = null;
|
215
|
210
|
if ($id === 'all') {
|
216
|
211
|
$outcome = Outcome::with('objectives.criteria')->get();
|
217
|
212
|
$title = 'All Outcomes';
|
218
|
|
- $criteria = $outcome->reduce(function($carry, $outcome) {
|
|
213
|
+ $criteria = $outcome->reduce(function ($carry, $outcome) {
|
219
|
214
|
return $carry->merge($outcome->criteria);
|
220
|
215
|
}, Collection::make([]));
|
221
|
216
|
$report_link = URL::action('OutcomesController@newReportAll');
|
|
@@ -226,26 +221,26 @@ class OutcomesController extends \BaseController {
|
226
|
221
|
$report_link = URL::action('OutcomesController@newReport', ['id' => $outcome->id]);
|
227
|
222
|
}
|
228
|
223
|
|
229
|
|
-// $objectives = $outcome->objectives;
|
230
|
|
-// var_dump(get_class_methods($criteria));
|
231
|
|
-// var_dump($criteria);
|
232
|
|
- $rubrics = $criteria->reduce(function($carry, $crit) {
|
|
224
|
+ // $objectives = $outcome->objectives;
|
|
225
|
+ // var_dump(get_class_methods($criteria));
|
|
226
|
+ // var_dump($criteria);
|
|
227
|
+ $rubrics = $criteria->reduce(function ($carry, $crit) {
|
233
|
228
|
return $carry->merge($crit->rubrics);
|
234
|
229
|
}, Collection::make([]))->load('activities');
|
235
|
|
- $activities = $rubrics->reduce(function($carry, $rubric) {
|
|
230
|
+ $activities = $rubrics->reduce(function ($carry, $rubric) {
|
236
|
231
|
return $carry->merge($rubric->activities);
|
237
|
232
|
}, Collection::make([]));
|
238
|
|
- $courses = $activities->reduce(function($carry, $activity) {
|
|
233
|
+ $courses = $activities->reduce(function ($carry, $activity) {
|
239
|
234
|
if ($activity->course !== null) {
|
240
|
235
|
$carry->push($activity->course);
|
241
|
236
|
}
|
242
|
237
|
return $carry;
|
243
|
238
|
}, Collection::make([]));
|
244
|
|
- $activities = $activities->filter(function($activity) {
|
|
239
|
+ $activities = $activities->filter(function ($activity) {
|
245
|
240
|
return ($activity->course === null);
|
246
|
241
|
});
|
247
|
242
|
|
248
|
|
-// var_dump(DB::getQueryLog());
|
|
243
|
+ // var_dump(DB::getQueryLog());
|
249
|
244
|
return View::make('local.managers.admins.new-learning-outcome', compact('title', 'outcome', 'courses', 'activities', 'report_link'));
|
250
|
245
|
}
|
251
|
246
|
|
|
@@ -254,14 +249,19 @@ class OutcomesController extends \BaseController {
|
254
|
249
|
$outcome = Outcome::find($id);
|
255
|
250
|
$objectives = $outcome->objectives;
|
256
|
251
|
$criteria = $outcome->criteria;
|
257
|
|
- $programs = $objectives->map(function ($objective) { return $objective->program; })
|
258
|
|
- ->merge($criteria->map(function ($criteria) { return $criteria->program; }))
|
259
|
|
- ->filter(function ($program) { return $program->users->contains(Auth::user()); });
|
|
252
|
+ $programs = $objectives->map(function ($objective) {
|
|
253
|
+ return $objective->program;
|
|
254
|
+ })
|
|
255
|
+ ->merge($criteria->map(function ($criteria) {
|
|
256
|
+ return $criteria->program;
|
|
257
|
+ }))
|
|
258
|
+ ->filter(function ($program) {
|
|
259
|
+ return $program->users->contains(Auth::user());
|
|
260
|
+ });
|
260
|
261
|
$title = $outcome->name . ' Report';
|
261
|
262
|
|
262
|
263
|
|
263
|
264
|
return View::make('local.managers.admins.new-report', compact('title', 'outcome', 'objectives'));
|
264
|
|
-
|
265
|
265
|
}
|
266
|
266
|
|
267
|
267
|
public function newReportAll()
|
|
@@ -270,7 +270,6 @@ class OutcomesController extends \BaseController {
|
270
|
270
|
$title = 'All Outcomes Report';
|
271
|
271
|
|
272
|
272
|
return View::make('local.managers.admins.new-report-all', compact('title', 'outcomes'));
|
273
|
|
-
|
274
|
273
|
}
|
275
|
274
|
|
276
|
275
|
public function update()
|
|
@@ -279,8 +278,7 @@ class OutcomesController extends \BaseController {
|
279
|
278
|
Session::flash('status', 'success');
|
280
|
279
|
Session::flash('message', 'Learning Outcomes updated.');
|
281
|
280
|
|
282
|
|
- foreach ($outcomeArray as $outcomeObject)
|
283
|
|
- {
|
|
281
|
+ foreach ($outcomeArray as $outcomeObject) {
|
284
|
282
|
|
285
|
283
|
|
286
|
284
|
$validator = Validator::make(
|
|
@@ -296,12 +294,10 @@ class OutcomesController extends \BaseController {
|
296
|
294
|
)
|
297
|
295
|
);
|
298
|
296
|
|
299
|
|
- if(!$validator->fails())
|
300
|
|
- {
|
301
|
|
- try
|
302
|
|
- {
|
|
297
|
+ if (!$validator->fails()) {
|
|
298
|
+ try {
|
303
|
299
|
$outcome = Outcome::withTrashed()
|
304
|
|
- ->where('id','=', $outcomeObject['id'])
|
|
300
|
+ ->where('id', '=', $outcomeObject['id'])
|
305
|
301
|
->firstOrFail();
|
306
|
302
|
$outcome->name = $outcomeObject['name'];
|
307
|
303
|
$outcome->definition = $outcomeObject['definition'];
|
|
@@ -309,30 +305,24 @@ class OutcomesController extends \BaseController {
|
309
|
305
|
$outcome->save();
|
310
|
306
|
|
311
|
307
|
// If delete is 1, and outcome isn't already trashed, delete
|
312
|
|
- if($outcomeObject['delete']==1 && !$outcome->trashed())
|
|
308
|
+ if ($outcomeObject['delete'] == 1 && !$outcome->trashed())
|
313
|
309
|
$outcome->delete();
|
314
|
310
|
// If delete is 0, and outcome is already trashed, restore
|
315
|
|
- elseif($outcomeObject['delete']==0 && $outcome->trashed())
|
|
311
|
+ elseif ($outcomeObject['delete'] == 0 && $outcome->trashed())
|
316
|
312
|
$outcome->restore();
|
317
|
|
- }
|
318
|
|
-
|
319
|
|
- catch(Exception $e)
|
320
|
|
- {
|
|
313
|
+ } catch (Exception $e) {
|
321
|
314
|
|
322
|
315
|
Session::flash('message', $e->getMessage());
|
323
|
316
|
}
|
324
|
|
- }
|
325
|
|
- else
|
326
|
|
- {
|
|
317
|
+ } else {
|
327
|
318
|
/** Prepare error message */
|
328
|
319
|
$message = 'Error(s) updating the Learning Outcomes: <ul>';
|
329
|
320
|
|
330
|
|
- foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
|
331
|
|
- {
|
332
|
|
- $message.=$validationError;
|
|
321
|
+ foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
|
|
322
|
+ $message .= $validationError;
|
333
|
323
|
}
|
334
|
324
|
|
335
|
|
- $message.='</ul>';
|
|
325
|
+ $message .= '</ul>';
|
336
|
326
|
|
337
|
327
|
/** Send error message and old data */
|
338
|
328
|
Session::flash('status', 'danger');
|
|
@@ -345,16 +335,15 @@ class OutcomesController extends \BaseController {
|
345
|
335
|
}
|
346
|
336
|
|
347
|
337
|
/**
|
348
|
|
- *Copy of update(), but also updates activation_date, deactivation_date and level
|
349
|
|
- */
|
|
338
|
+ *Copy of update(), but also updates activation_date, deactivation_date and level
|
|
339
|
+ */
|
350
|
340
|
public function updateMore()
|
351
|
341
|
{
|
352
|
342
|
$outcomeArray = json_decode(Input::get('outcomeArray'), true);
|
353
|
343
|
Session::flash('status', 'success');
|
354
|
344
|
Session::flash('message', 'Learning Outcomes updated.');
|
355
|
345
|
|
356
|
|
- foreach ($outcomeArray as $outcomeObject)
|
357
|
|
- {
|
|
346
|
+ foreach ($outcomeArray as $outcomeObject) {
|
358
|
347
|
|
359
|
348
|
|
360
|
349
|
$validator = Validator::make(
|
|
@@ -372,12 +361,10 @@ class OutcomesController extends \BaseController {
|
372
|
361
|
)
|
373
|
362
|
);
|
374
|
363
|
|
375
|
|
- if(!$validator->fails())
|
376
|
|
- {
|
377
|
|
- try
|
378
|
|
- {
|
|
364
|
+ if (!$validator->fails()) {
|
|
365
|
+ try {
|
379
|
366
|
$outcome = Outcome::withTrashed()
|
380
|
|
- ->where('id','=', $outcomeObject['id'])
|
|
367
|
+ ->where('id', '=', $outcomeObject['id'])
|
381
|
368
|
->firstOrFail();
|
382
|
369
|
$outcome->name = $outcomeObject['name'];
|
383
|
370
|
$outcome->definition = $outcomeObject['definition'];
|
|
@@ -388,30 +375,24 @@ class OutcomesController extends \BaseController {
|
388
|
375
|
$outcome->save();
|
389
|
376
|
|
390
|
377
|
// If delete is 1, and outcome isn't already trashed, delete
|
391
|
|
- if($outcomeObject['delete']==1 && !$outcome->trashed())
|
|
378
|
+ if ($outcomeObject['delete'] == 1 && !$outcome->trashed())
|
392
|
379
|
$outcome->delete();
|
393
|
380
|
// If delete is 0, and outcome is already trashed, restore
|
394
|
|
- elseif($outcomeObject['delete']==0 && $outcome->trashed())
|
|
381
|
+ elseif ($outcomeObject['delete'] == 0 && $outcome->trashed())
|
395
|
382
|
$outcome->restore();
|
396
|
|
- }
|
397
|
|
-
|
398
|
|
- catch(Exception $e)
|
399
|
|
- {
|
|
383
|
+ } catch (Exception $e) {
|
400
|
384
|
|
401
|
385
|
Session::flash('message', $e->getMessage());
|
402
|
386
|
}
|
403
|
|
- }
|
404
|
|
- else
|
405
|
|
- {
|
|
387
|
+ } else {
|
406
|
388
|
/** Prepare error message */
|
407
|
389
|
$message = 'Error(s) updating the Learning Outcomes: <ul>';
|
408
|
390
|
|
409
|
|
- foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
|
410
|
|
- {
|
411
|
|
- $message.=$validationError;
|
|
391
|
+ foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
|
|
392
|
+ $message .= $validationError;
|
412
|
393
|
}
|
413
|
394
|
|
414
|
|
- $message.='</ul>';
|
|
395
|
+ $message .= '</ul>';
|
415
|
396
|
|
416
|
397
|
/** Send error message and old data */
|
417
|
398
|
Session::flash('status', 'danger');
|
|
@@ -426,40 +407,33 @@ class OutcomesController extends \BaseController {
|
426
|
407
|
public function fetchCriteria()
|
427
|
408
|
{
|
428
|
409
|
|
429
|
|
- if(Input::get('filter'))
|
430
|
|
- {
|
431
|
|
- switch (Input::get('filter'))
|
432
|
|
- {
|
|
410
|
+ if (Input::get('filter')) {
|
|
411
|
+ switch (Input::get('filter')) {
|
433
|
412
|
case 'all':
|
434
|
413
|
return Outcome::find(Input::get('id'))->criteria;
|
435
|
414
|
break;
|
436
|
415
|
|
437
|
416
|
case 'school':
|
438
|
417
|
// If scoord
|
439
|
|
- if(Auth::user()->role == '2')
|
440
|
|
- {
|
|
418
|
+ if (Auth::user()->role == '2') {
|
441
|
419
|
|
442
|
420
|
// Fetch all the programs whose school is the user's
|
443
|
421
|
$program_ids = DB::table('programs')->where('school_id', Auth::user()->school_id)->lists('id');
|
444
|
422
|
|
445
|
423
|
// Return all criteria belonging to any of those programs
|
446
|
|
- return Criterion::
|
447
|
|
- where('outcome_id', Input::get('id'))
|
|
424
|
+ return Criterion::where('outcome_id', Input::get('id'))
|
448
|
425
|
->whereIn('program_id', $program_ids)
|
449
|
426
|
->orderBy('name', 'ASC')
|
450
|
427
|
->get();
|
451
|
|
-
|
452
|
428
|
}
|
453
|
429
|
|
454
|
430
|
// If pcoord
|
455
|
|
- else
|
456
|
|
- {
|
|
431
|
+ else {
|
457
|
432
|
|
458
|
433
|
// Fetch all the programs from the user's school;
|
459
|
434
|
$program_ids = DB::table('programs')->where('school_id', Auth::user()->programs[0]->school->id)->lists('id');
|
460
|
435
|
|
461
|
|
- return Criterion::
|
462
|
|
- where('outcome_id', Input::get('id'))
|
|
436
|
+ return Criterion::where('outcome_id', Input::get('id'))
|
463
|
437
|
->whereIn('program_id', $program_ids)
|
464
|
438
|
->orderBy('name', 'ASC')
|
465
|
439
|
->get();
|
|
@@ -468,8 +442,7 @@ class OutcomesController extends \BaseController {
|
468
|
442
|
break;
|
469
|
443
|
|
470
|
444
|
case 'program':
|
471
|
|
- return Criterion::
|
472
|
|
- where('outcome_id', Input::get('id'))
|
|
445
|
+ return Criterion::where('outcome_id', Input::get('id'))
|
473
|
446
|
->whereIn('program_id', Auth::user()->programs->lists('id'))
|
474
|
447
|
->orderBy('name', 'ASC')
|
475
|
448
|
->get();
|
|
@@ -479,9 +452,7 @@ class OutcomesController extends \BaseController {
|
479
|
452
|
return Outcome::find(Input::get('id'))->criteria;
|
480
|
453
|
break;
|
481
|
454
|
}
|
482
|
|
- }
|
483
|
|
- else
|
484
|
|
- {
|
|
455
|
+ } else {
|
485
|
456
|
return Outcome::find(Input::get('id'))->criteria;
|
486
|
457
|
}
|
487
|
458
|
}
|
|
@@ -504,41 +475,35 @@ class OutcomesController extends \BaseController {
|
504
|
475
|
);
|
505
|
476
|
|
506
|
477
|
/** If validation fails */
|
507
|
|
- if ($validator->fails())
|
508
|
|
- {
|
|
478
|
+ if ($validator->fails()) {
|
509
|
479
|
/** Prepare error message */
|
510
|
480
|
$message = '<p>Error(s) creating a new Learning Outcome</p><ul>';
|
511
|
481
|
|
512
|
|
- foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
|
513
|
|
- {
|
514
|
|
- $message.=$validationError;
|
|
482
|
+ foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
|
|
483
|
+ $message .= $validationError;
|
515
|
484
|
}
|
516
|
485
|
|
517
|
|
- $message.='</ul>';
|
|
486
|
+ $message .= '</ul>';
|
518
|
487
|
|
519
|
488
|
/** Send error message and old data */
|
520
|
489
|
Session::flash('status', 'warning');
|
521
|
490
|
Session::flash('message', $message);
|
522
|
491
|
return Redirect::to('learning-outcomes')->withInput();
|
523
|
|
- }
|
524
|
|
- else
|
525
|
|
- {
|
|
492
|
+ } else {
|
526
|
493
|
/** Instantiate new outcome */
|
527
|
494
|
$outcome = new Outcome;
|
528
|
|
- $outcome->name= Input::get('name');
|
|
495
|
+ $outcome->name = Input::get('name');
|
529
|
496
|
$outcome->definition = Input::get('definition');
|
530
|
497
|
|
531
|
498
|
/** If outcome is saved, send success message */
|
532
|
|
- if($outcome->save())
|
533
|
|
- {
|
|
499
|
+ if ($outcome->save()) {
|
534
|
500
|
Session::flash('status', 'success');
|
535
|
501
|
Session::flash('message', '<p>Learning Outcome added.</p>');
|
536
|
502
|
return Redirect::to('learning-outcomes');
|
537
|
503
|
}
|
538
|
504
|
|
539
|
505
|
/** If saving fails, send error message and old data */
|
540
|
|
- else
|
541
|
|
- {
|
|
506
|
+ else {
|
542
|
507
|
Session::flash('status', 'warning');
|
543
|
508
|
Session::flash('message', '<p>Error adding Learning Outcome. Please try again later.</p>');
|
544
|
509
|
return Redirect::to('learning-outcomes')->withInput();
|
|
@@ -554,8 +519,7 @@ class OutcomesController extends \BaseController {
|
554
|
519
|
|
555
|
520
|
$outcome->criteria;
|
556
|
521
|
|
557
|
|
- return array
|
558
|
|
- (
|
|
522
|
+ return array(
|
559
|
523
|
'outcome' => $outcome
|
560
|
524
|
);
|
561
|
525
|
}
|
|
@@ -582,7 +546,6 @@ class OutcomesController extends \BaseController {
|
582
|
546
|
App::abort('404');
|
583
|
547
|
break;
|
584
|
548
|
}
|
585
|
|
-
|
586
|
549
|
}
|
587
|
550
|
|
588
|
551
|
/**
|
|
@@ -592,26 +555,25 @@ class OutcomesController extends \BaseController {
|
592
|
555
|
{
|
593
|
556
|
$outcome = Outcome::find($outcome_id);
|
594
|
557
|
|
595
|
|
- if(!$outcome)
|
|
558
|
+ if (!$outcome)
|
596
|
559
|
App::abort('404');
|
597
|
|
- $title = "Assessment Report: ".$outcome->name;
|
|
560
|
+ $title = "Assessment Report: " . $outcome->name;
|
598
|
561
|
|
599
|
562
|
|
600
|
|
- $schools = School::
|
601
|
|
- has('courses')
|
602
|
|
- ->with(array('programs'=>function($query) use($outcome_id){
|
|
563
|
+ $schools = School::has('courses')
|
|
564
|
+ ->with(array('programs' => function ($query) use ($outcome_id) {
|
603
|
565
|
$query
|
604
|
|
- ->has('courses')
|
605
|
|
- ->with(array('courses'=>function($query2) use($outcome_id){
|
606
|
|
- $query2
|
607
|
|
- ->has('activities')
|
608
|
|
- ->whereNotNull('outcomes_attempted')
|
609
|
|
- // ->where('outcomes_attempted', 'NOT LIKE', '%"'.$outcome_id.'":0%')
|
610
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))
|
611
|
|
- ->groupBy(array('code', 'number'));
|
612
|
|
- }));
|
|
566
|
+ ->has('courses')
|
|
567
|
+ ->with(array('courses' => function ($query2) use ($outcome_id) {
|
|
568
|
+ $query2
|
|
569
|
+ ->has('activities')
|
|
570
|
+ ->whereNotNull('outcomes_attempted')
|
|
571
|
+ // ->where('outcomes_attempted', 'NOT LIKE', '%"'.$outcome_id.'":0%')
|
|
572
|
+ ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
573
|
+ ->groupBy(array('code', 'number'));
|
|
574
|
+ }));
|
613
|
575
|
}))
|
614
|
|
- ->get();
|
|
576
|
+ ->get();
|
615
|
577
|
|
616
|
578
|
return View::make('local.managers.admins.assessment_report', compact('title', 'outcome', 'schools'));
|
617
|
579
|
}
|
|
@@ -621,16 +583,15 @@ class OutcomesController extends \BaseController {
|
621
|
583
|
{
|
622
|
584
|
$outcome = Outcome::find($outcome_id);
|
623
|
585
|
|
624
|
|
- if(!$outcome)
|
|
586
|
+ if (!$outcome)
|
625
|
587
|
App::abort('404');
|
626
|
|
- $title = "Assessment Report: ".$outcome->name;
|
|
588
|
+ $title = "Assessment Report: " . $outcome->name;
|
627
|
589
|
|
628
|
|
- $schools = School::
|
629
|
|
- has('courses')
|
630
|
|
- ->with(array('programs'=>function($query) use($outcome_id){
|
|
590
|
+ $schools = School::has('courses')
|
|
591
|
+ ->with(array('programs' => function ($query) use ($outcome_id) {
|
631
|
592
|
$query
|
632
|
593
|
->has('courses')
|
633
|
|
- ->with(array('courses'=>function($query2) use($outcome_id){
|
|
594
|
+ ->with(array('courses' => function ($query2) use ($outcome_id) {
|
634
|
595
|
$query2
|
635
|
596
|
->has('activities')
|
636
|
597
|
->whereNotNull('outcomes_attempted')
|
|
@@ -651,26 +612,25 @@ class OutcomesController extends \BaseController {
|
651
|
612
|
{
|
652
|
613
|
$outcome = Outcome::find($outcome_id);
|
653
|
614
|
|
654
|
|
- if(!$outcome)
|
|
615
|
+ if (!$outcome)
|
655
|
616
|
App::abort('404');
|
656
|
|
- $title = "Assessment Report: ".$outcome->name;
|
|
617
|
+ $title = "Assessment Report: " . $outcome->name;
|
657
|
618
|
|
658
|
619
|
|
659
|
|
- $school = School::
|
660
|
|
- where('id', Auth::user()->school_id)
|
661
|
|
- ->has('courses')
|
662
|
|
- ->with(array('programs'=>function($query){
|
663
|
|
- $query
|
|
620
|
+ $school = School::where('id', Auth::user()->school_id)
|
664
|
621
|
->has('courses')
|
665
|
|
- ->with(array('courses'=>function($query2){
|
666
|
|
- $query2
|
667
|
|
- ->has('activities')
|
668
|
|
- ->whereNotNull('outcomes_attempted')
|
669
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))
|
670
|
|
- ->groupBy(array('code', 'number'));
|
671
|
|
- }));
|
672
|
|
- }))
|
673
|
|
- ->first();
|
|
622
|
+ ->with(array('programs' => function ($query) {
|
|
623
|
+ $query
|
|
624
|
+ ->has('courses')
|
|
625
|
+ ->with(array('courses' => function ($query2) {
|
|
626
|
+ $query2
|
|
627
|
+ ->has('activities')
|
|
628
|
+ ->whereNotNull('outcomes_attempted')
|
|
629
|
+ ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
630
|
+ ->groupBy(array('code', 'number'));
|
|
631
|
+ }));
|
|
632
|
+ }))
|
|
633
|
+ ->first();
|
674
|
634
|
|
675
|
635
|
return View::make('local.managers.sCoords.assessment_report', compact('title', 'outcome', 'school'));
|
676
|
636
|
}
|
|
@@ -682,20 +642,19 @@ class OutcomesController extends \BaseController {
|
682
|
642
|
{
|
683
|
643
|
$outcome = Outcome::find($outcome_id);
|
684
|
644
|
|
685
|
|
- if(!$outcome)
|
|
645
|
+ if (!$outcome)
|
686
|
646
|
App::abort('404');
|
687
|
|
- $title = "Assessment Report: ".$outcome->name;
|
|
647
|
+ $title = "Assessment Report: " . $outcome->name;
|
688
|
648
|
|
689
|
649
|
|
690
|
|
- $program = Program::
|
691
|
|
- where('id', $program_id)
|
|
650
|
+ $program = Program::where('id', $program_id)
|
692
|
651
|
->has('courses')
|
693
|
|
- ->with(array('courses'=>function($query){
|
|
652
|
+ ->with(array('courses' => function ($query) {
|
694
|
653
|
$query
|
695
|
|
- ->has('activities')
|
696
|
|
- ->whereNotNull('outcomes_attempted')
|
697
|
|
- ->whereIn('semester_id', Session::get('semesters_ids'))
|
698
|
|
- ->groupBy(array('code', 'number'));
|
|
654
|
+ ->has('activities')
|
|
655
|
+ ->whereNotNull('outcomes_attempted')
|
|
656
|
+ ->whereIn('semester_id', Session::get('semesters_ids'))
|
|
657
|
+ ->groupBy(array('code', 'number'));
|
699
|
658
|
}))
|
700
|
659
|
->first();
|
701
|
660
|
|
|
@@ -709,7 +668,6 @@ class OutcomesController extends \BaseController {
|
709
|
668
|
$title = "My Courses' Assessment Reports";
|
710
|
669
|
|
711
|
670
|
return View::make('local.professors.assessment_reports', compact('title', 'outcomes'));
|
712
|
|
-
|
713
|
671
|
}
|
714
|
672
|
|
715
|
673
|
|
|
@@ -718,13 +676,12 @@ class OutcomesController extends \BaseController {
|
718
|
676
|
{
|
719
|
677
|
$outcome = Outcome::find($outcome_id);
|
720
|
678
|
|
721
|
|
- if(!$outcome)
|
|
679
|
+ if (!$outcome)
|
722
|
680
|
App::abort('404');
|
723
|
|
- $title = "My Courses' Assessment Report: ".$outcome->name;
|
|
681
|
+ $title = "My Courses' Assessment Report: " . $outcome->name;
|
724
|
682
|
|
725
|
683
|
|
726
|
|
- $courses = Course::
|
727
|
|
- where('user_id', Auth::user()->id)
|
|
684
|
+ $courses = Course::where('user_id', Auth::user()->id)
|
728
|
685
|
->has('activities')
|
729
|
686
|
->whereNotNull('outcomes_attempted')
|
730
|
687
|
->whereIn('semester_id', Session::get('semesters_ids'))
|