|
@@ -200,12 +200,15 @@ class TemplatesController extends \BaseController
|
200
|
200
|
$templates = Template::orderBy('name', 'ASC')->get();
|
201
|
201
|
$programs = Program::orderBy('name', 'ASC')->get();
|
202
|
202
|
$criteria = Criterion::orderBy('name', 'ASC')->get();
|
|
203
|
+ $school_id_user=NULL;
|
203
|
204
|
} else {
|
204
|
205
|
if ($role == 2) {
|
205
|
206
|
$programs = Auth::user()->school->programs;
|
|
207
|
+ $school_id_user=Auth::user()->school_id;
|
206
|
208
|
}
|
207
|
209
|
if ($role == 3) {
|
208
|
210
|
$programs = Auth::user()->programs()->get();
|
|
211
|
+ $school_id_user=Auth::user()->programs[0]->school->id;
|
209
|
212
|
}
|
210
|
213
|
$program_ids = array();
|
211
|
214
|
foreach ($programs as $program) {
|
|
@@ -217,7 +220,8 @@ class TemplatesController extends \BaseController
|
217
|
220
|
$q->whereIn('program_id', $program_ids);
|
218
|
221
|
}
|
219
|
222
|
)->orderBy('name', 'ASC')->get();
|
220
|
|
- $templates = Template::where('school_id', '=', Auth::user()->programs[0]->school->id)->orWhere('school_id', '=', NULL)
|
|
223
|
+ }
|
|
224
|
+ $templates = Template::where('school_id', '=', $school_id_user)->orWhere('school_id', '=', NULL)
|
221
|
225
|
->orderBy('name', 'ASC')->get();
|
222
|
226
|
$criteria_ids = array();
|
223
|
227
|
foreach ($criteria as $criterion) {
|
|
@@ -231,12 +235,15 @@ class TemplatesController extends \BaseController
|
231
|
235
|
foreach ($templates_fuera as $tf) {
|
232
|
236
|
$templates_fuera_ids[] = $tf->id;
|
233
|
237
|
}
|
|
238
|
+// Log::info(json_encode($templates_fuera_ids));
|
|
239
|
+// exit();
|
234
|
240
|
$templates_dentro = Template::whereNotIn('id', $templates_fuera_ids)
|
235
|
241
|
->orderBy('name', 'ASC')->get();
|
236
|
242
|
|
237
|
|
- // var_dump(json_encode($templates_dentro));
|
238
|
|
- }
|
|
243
|
+// if(!isset($templates_dentro))$templates_dentro=
|
239
|
244
|
|
|
245
|
+ // var_dump(json_encode($templates_dentro));
|
|
246
|
+// }
|
240
|
247
|
|
241
|
248
|
|
242
|
249
|
return View::make('local.managers.shared.rubrics_new', compact('title', 'templates_dentro', 'templates_fuera', 'outcomes', 'criteria', 'schools', 'programs', 'criteria_ids'));
|