|
@@ -27,7 +27,11 @@ class TransformativeActionsController extends \BaseController
|
27
|
27
|
->orWhereNull('deactivation_date')
|
28
|
28
|
->get();
|
29
|
29
|
$objectives = array();
|
30
|
|
-
|
|
30
|
+ $types = DB::table('transformative_actions')
|
|
31
|
+ ->select('type_of_TA')
|
|
32
|
+ ->where('type_of_TA', '<>', '')
|
|
33
|
+ ->distinct()
|
|
34
|
+ ->get();
|
31
|
35
|
// if user is program coordinator
|
32
|
36
|
if ($role == 3) {
|
33
|
37
|
//1 edit panel: load the TA that
|
|
@@ -64,20 +68,23 @@ class TransformativeActionsController extends \BaseController
|
64
|
68
|
// get the courses from asociated with a TA
|
65
|
69
|
$course_filter_approvePanel = DB::table('ta_course')
|
66
|
70
|
->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
|
67
|
|
- ->join('courses', 'courses.id', '=', 'ta_course.course_id')
|
|
71
|
+ ->join('courses', function ($join) {
|
|
72
|
+ $join->on('courses.number', '=', 'ta_course.course_number');
|
|
73
|
+ $join->on('courses.code', '=', 'ta_course.course_code');
|
|
74
|
+ })
|
68
|
75
|
->where('transformative_actions.is_custom', 1)
|
69
|
76
|
->where('transformative_actions.program_id', $program_id)
|
70
|
77
|
->where('transformative_actions.by_professor', 1)
|
71
|
78
|
->select('courses.*')
|
72
|
|
- ->groupBy('courses.name', 'courses.code')
|
|
79
|
+ ->groupBy('courses.number', 'courses.code')
|
73
|
80
|
->orderBy('courses.name', 'ASC')
|
74
|
81
|
->orderBy('courses.code', 'ASC')
|
75
|
82
|
->get();
|
76
|
83
|
// get the outcome asociated with a TA
|
77
|
84
|
$outcome_filter_approvePanel = DB::table('transformative_actions')
|
78
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
79
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
80
|
|
- ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
|
|
85
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
86
|
+ ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
|
87
|
+ ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
|
81
|
88
|
->where('transformative_actions.is_custom', 1)
|
82
|
89
|
->where('transformative_actions.program_id', $program_id)
|
83
|
90
|
->where('transformative_actions.by_professor', 1)
|
|
@@ -100,18 +107,21 @@ class TransformativeActionsController extends \BaseController
|
100
|
107
|
->get();
|
101
|
108
|
$course_filter_editPanel = DB::table('ta_course')
|
102
|
109
|
->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
|
103
|
|
- ->join('courses', 'courses.id', '=', 'ta_course.course_id')
|
|
110
|
+ ->join('courses', function ($join) {
|
|
111
|
+ $join->on('courses.number', '=', 'ta_course.course_number');
|
|
112
|
+ $join->on('courses.code', '=', 'ta_course.course_code');
|
|
113
|
+ })
|
104
|
114
|
->where('transformative_actions.is_custom', 1)
|
105
|
115
|
->where('transformative_actions.program_id', $program_id)
|
106
|
116
|
->where('transformative_actions.by_professor', 0)
|
107
|
117
|
->select('courses.*')
|
108
|
|
- ->groupBy('courses.name', 'courses.code')
|
|
118
|
+ ->groupBy('courses.number', 'courses.code')
|
109
|
119
|
->orderBy('courses.name', 'ASC')
|
110
|
120
|
->orderBy('courses.code', 'ASC')
|
111
|
121
|
->get();
|
112
|
122
|
$outcome_filter_editPanel = DB::table('transformative_actions')
|
113
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
114
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
|
123
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
124
|
+ ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
115
|
125
|
->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
|
116
|
126
|
->where('transformative_actions.is_custom', 1)
|
117
|
127
|
->where('transformative_actions.program_id', $program_id)
|
|
@@ -124,11 +134,11 @@ class TransformativeActionsController extends \BaseController
|
124
|
134
|
$courses_create = DB::table('courses')
|
125
|
135
|
->where('courses.program_id', $program_id)
|
126
|
136
|
->select('courses.*')
|
127
|
|
- ->groupBy('courses.name', 'courses.code')
|
|
137
|
+ ->groupBy('courses.number', 'courses.code')
|
128
|
138
|
->orderBy('courses.name', 'ASC')
|
129
|
139
|
->orderBy('courses.code', 'ASC')
|
130
|
140
|
->get();
|
131
|
|
- }
|
|
141
|
+ }/*
|
132
|
142
|
// if user is profesor
|
133
|
143
|
elseif ($role == 4) {
|
134
|
144
|
// 1 the user can only edit TA that need approval and has been submited by the same user
|
|
@@ -157,8 +167,8 @@ class TransformativeActionsController extends \BaseController
|
157
|
167
|
->orderBy('courses.code', 'ASC')
|
158
|
168
|
->get();
|
159
|
169
|
$outcome_filter_editPanel = DB::table('transformative_actions')
|
160
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
161
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
|
170
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
171
|
+ ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
162
|
172
|
->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
|
163
|
173
|
->where('transformative_actions.is_custom', 1)
|
164
|
174
|
->where('transformative_actions.user_id', Auth::user()->id)
|
|
@@ -183,10 +193,11 @@ class TransformativeActionsController extends \BaseController
|
183
|
193
|
->orderBy('courses.code', 'ASC')
|
184
|
194
|
->get();
|
185
|
195
|
}
|
186
|
|
-
|
|
196
|
+*/
|
187
|
197
|
return View::make('local.managers.admins.transformativeAction', compact(
|
188
|
198
|
'title',
|
189
|
199
|
'role',
|
|
200
|
+ 'types',
|
190
|
201
|
'outcomes',
|
191
|
202
|
'schools',
|
192
|
203
|
'criteria',
|
|
@@ -246,7 +257,9 @@ class TransformativeActionsController extends \BaseController
|
246
|
257
|
$clean_input['objectiveid'] = Input::get('objectiveid');
|
247
|
258
|
$clean_input['courseid'] = Input::get('courseid');
|
248
|
259
|
$clean_input['approval'] = Input::get('approval');
|
|
260
|
+ $clean_input['type'] = Input::get('type_of_ta');
|
249
|
261
|
$clean_input['ta_id'] = Input::get('ta_id');
|
|
262
|
+ $clean_input['new_type'] = Input::get('new_type');
|
250
|
263
|
|
251
|
264
|
return $clean_input;
|
252
|
265
|
}
|
|
@@ -263,14 +276,16 @@ class TransformativeActionsController extends \BaseController
|
263
|
276
|
'courseid' => $clean_input['courseid'],
|
264
|
277
|
'approval' => $clean_input['approval'],
|
265
|
278
|
'ta_id' => $clean_input['ta_id'],
|
|
279
|
+ 'type_of_ta' => $clean_input['type'],
|
266
|
280
|
),
|
267
|
281
|
array(
|
268
|
282
|
'text' => 'required|string',
|
269
|
283
|
'description' => 'required|string',
|
270
|
284
|
'objectiveid' => 'required|array',
|
271
|
|
- 'courseid' => 'required|array',
|
|
285
|
+ 'courseid' => 'required|string',
|
272
|
286
|
'approval' => 'integer',
|
273
|
287
|
'ta_id' => 'integer',
|
|
288
|
+ 'type_of_ta' => 'required|string'
|
274
|
289
|
)
|
275
|
290
|
);
|
276
|
291
|
}
|
|
@@ -302,7 +317,7 @@ class TransformativeActionsController extends \BaseController
|
302
|
317
|
return Redirect::to('transformativeAction')->withInput();
|
303
|
318
|
} else {
|
304
|
319
|
|
305
|
|
- $user_id = auth::user()->id;
|
|
320
|
+ $user_id = Auth::user()->id;
|
306
|
321
|
$program_id = DB::table('program_user')
|
307
|
322
|
->where('user_id', $user_id)
|
308
|
323
|
->select('program_id')
|
|
@@ -313,10 +328,17 @@ class TransformativeActionsController extends \BaseController
|
313
|
328
|
if ($role == 3) {
|
314
|
329
|
$by_professor = 0;
|
315
|
330
|
}
|
316
|
|
-
|
|
331
|
+ Log::info($clean_input['courseid']);
|
317
|
332
|
// $by_professor = $clean_input['approval'];
|
318
|
333
|
|
|
334
|
+ $parentesis = array('(', ')');
|
|
335
|
+ $course_code_number = str_replace($parentesis, '', $clean_input['courseid']);
|
|
336
|
+
|
|
337
|
+ $course_code_number = explode(',', $course_code_number);
|
|
338
|
+
|
319
|
339
|
$current_timestamp = date('Y/m/d H:i:s', time());
|
|
340
|
+ if ($clean_input['new_type']) $type = $clean_input['new_type'];
|
|
341
|
+ else $type = $clean_input['type'];
|
320
|
342
|
// insert the TA
|
321
|
343
|
$ta_id = DB::table('transformative_actions')->insertGetId(
|
322
|
344
|
array(
|
|
@@ -327,32 +349,34 @@ class TransformativeActionsController extends \BaseController
|
327
|
349
|
'program_id' => $program_id,
|
328
|
350
|
'created_at' => $current_timestamp,
|
329
|
351
|
'by_professor' => $by_professor,
|
|
352
|
+ 'type_of_TA' => $type
|
330
|
353
|
)
|
331
|
354
|
);
|
332
|
355
|
|
333
|
356
|
//
|
334
|
357
|
// // insert the multiple TA_objective_program
|
335
|
358
|
foreach ($clean_input['objectiveid'] as $objective_id) {
|
336
|
|
- DB::table('transformative_objective_course')->insert(
|
|
359
|
+ DB::table('transformative_objective')->insert(
|
337
|
360
|
array(
|
338
|
361
|
'ta_id' => $ta_id,
|
339
|
362
|
'objective_id' => $objective_id,
|
340
|
|
- 'program_id' => $program_id,
|
341
|
|
- 'created_at' => $current_timestamp,
|
|
363
|
+
|
|
364
|
+
|
342
|
365
|
)
|
343
|
366
|
);
|
344
|
367
|
}
|
345
|
368
|
|
346
|
369
|
//
|
347
|
370
|
// // insert the multiple TA_course
|
348
|
|
- foreach ($clean_input['courseid'] as $course_id) {
|
349
|
|
- DB::table('TA_course')->insert(
|
350
|
|
- array(
|
351
|
|
- 'ta_id' => $ta_id,
|
352
|
|
- 'course_id' => $course_id,
|
353
|
|
- )
|
354
|
|
- );
|
355
|
|
- }
|
|
371
|
+ DB::table('TA_course')->insert(
|
|
372
|
+ array(
|
|
373
|
+ 'ta_id' => $ta_id,
|
|
374
|
+ 'course_number' => $course_code_number[1],
|
|
375
|
+ 'course_code' => $course_code_number[0],
|
|
376
|
+
|
|
377
|
+ )
|
|
378
|
+ );
|
|
379
|
+
|
356
|
380
|
|
357
|
381
|
Session::flash('status', 'success');
|
358
|
382
|
Session::flash('message', 'Transformative Action created: "' . $clean_input['text'] . '".');
|
|
@@ -387,12 +411,19 @@ class TransformativeActionsController extends \BaseController
|
387
|
411
|
|
388
|
412
|
$current_timestamp = date('Y/m/d H:i:s', time());
|
389
|
413
|
|
|
414
|
+ if (Input::get('new_type')) {
|
|
415
|
+ $type = Input::get('new_type');
|
|
416
|
+ } else {
|
|
417
|
+ $type = Input::get('type_of_ta');
|
|
418
|
+ }
|
|
419
|
+
|
390
|
420
|
// edit the TA
|
391
|
421
|
DB::table('transformative_actions')
|
392
|
422
|
->where('id', $ta_id)
|
393
|
423
|
->update([
|
394
|
424
|
'by_professor' => 0,
|
395
|
425
|
'updated_at' => $current_timestamp,
|
|
426
|
+ 'type_of_TA' => $type
|
396
|
427
|
]);
|
397
|
428
|
|
398
|
429
|
Session::flash('status', 'success');
|
|
@@ -442,6 +473,9 @@ class TransformativeActionsController extends \BaseController
|
442
|
473
|
|
443
|
474
|
// $by_professor = $clean_input['approval'];
|
444
|
475
|
|
|
476
|
+ if ($clean_input['new_type']) $type = $clean_input['new_type'];
|
|
477
|
+ else $type = $clean_input['type'];
|
|
478
|
+
|
445
|
479
|
$current_timestamp = date('Y/m/d H:i:s', time());
|
446
|
480
|
// edit the TA
|
447
|
481
|
DB::table('transformative_actions')
|
|
@@ -451,12 +485,14 @@ class TransformativeActionsController extends \BaseController
|
451
|
485
|
'at_text' => $clean_input['text'],
|
452
|
486
|
'description' => $clean_input['description'],
|
453
|
487
|
'updated_at' => $current_timestamp,
|
|
488
|
+ 'type_of_TA' => $type
|
|
489
|
+
|
454
|
490
|
]);
|
455
|
491
|
|
456
|
492
|
|
457
|
493
|
$ta_id = $clean_input['ta_id'];
|
458
|
494
|
$new_objective_id = $clean_input['objectiveid'];
|
459
|
|
- $old_objective_id = DB::table('transformative_objective_course')
|
|
495
|
+ $old_objective_id = DB::table('transformative_objective')
|
460
|
496
|
->where('ta_id', $ta_id)
|
461
|
497
|
->select('objective_id')
|
462
|
498
|
->lists('objective_id');
|
|
@@ -467,7 +503,7 @@ class TransformativeActionsController extends \BaseController
|
467
|
503
|
//do nothing if a new id is already in atble
|
468
|
504
|
} else {
|
469
|
505
|
//if old id not in new id, delete
|
470
|
|
- DB::table('transformative_objective_course')
|
|
506
|
+ DB::table('transformative_objective')
|
471
|
507
|
->where('ta_id', $ta_id)
|
472
|
508
|
->where('objective_id', $old_id)
|
473
|
509
|
->delete();
|
|
@@ -476,18 +512,17 @@ class TransformativeActionsController extends \BaseController
|
476
|
512
|
|
477
|
513
|
//
|
478
|
514
|
foreach ($new_objective_id as $new_id) {
|
479
|
|
- $result = DB::table('transformative_objective_course')
|
|
515
|
+ $result = DB::table('transformative_objective')
|
480
|
516
|
->where('objective_id', $new_id)
|
481
|
517
|
->select('objective_id')
|
482
|
518
|
->lists('objective_id');
|
483
|
519
|
|
484
|
520
|
if (count($result) == 0) {
|
485
|
521
|
//if the new_id does not exists, do nothing
|
486
|
|
- DB::table('transformative_objective_course')->insert(
|
|
522
|
+ DB::table('transformative_objective')->insert(
|
487
|
523
|
array(
|
488
|
524
|
'ta_id' => $ta_id,
|
489
|
525
|
'objective_id' => $new_id,
|
490
|
|
- 'program_id' => $program_id,
|
491
|
526
|
'created_at' => $current_timestamp,
|
492
|
527
|
)
|
493
|
528
|
);
|
|
@@ -496,8 +531,17 @@ class TransformativeActionsController extends \BaseController
|
496
|
531
|
}
|
497
|
532
|
}
|
498
|
533
|
|
|
534
|
+ $parentesis = array('(', ')');
|
|
535
|
+ $course_code_number = str_replace($parentesis, '', $clean_input['courseid']);
|
|
536
|
+
|
|
537
|
+ $course_code_number = explode(',', $course_code_number);
|
|
538
|
+
|
|
539
|
+ DB::update(
|
|
540
|
+ "UPDATE `ta_course` set `course_number` = '{$course_code_number[1]}', `course_code` = '{$course_code_number[0]}' where ta_id = {$ta_id}"
|
|
541
|
+ );
|
|
542
|
+
|
|
543
|
+ /*$new_course_id = $clean_input['courseid'];
|
499
|
544
|
|
500
|
|
- $new_course_id = $clean_input['courseid'];
|
501
|
545
|
$old_course_id = DB::table('ta_course')
|
502
|
546
|
->where('ta_id', $ta_id)
|
503
|
547
|
->select('course_id')
|
|
@@ -534,7 +578,7 @@ class TransformativeActionsController extends \BaseController
|
534
|
578
|
} else {
|
535
|
579
|
//if the new_id already exists, do nothing
|
536
|
580
|
}
|
537
|
|
- }
|
|
581
|
+ } */
|
538
|
582
|
|
539
|
583
|
Session::flash('status', 'success');
|
540
|
584
|
Session::flash('message', 'Updated Transformative Action: "' . $clean_input['text'] . '".');
|
|
@@ -617,12 +661,13 @@ class TransformativeActionsController extends \BaseController
|
617
|
661
|
$program_id = $program_id[0]->program_id;
|
618
|
662
|
|
619
|
663
|
$objectives = DB::table('transformative_actions')
|
620
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
621
|
|
- ->join('objectives', 'objectives.id', '=', 'transformative_objective_course.objective_id')
|
|
664
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
665
|
+ ->join('objectives', 'objectives.id', '=', 'transformative_objective.objective_id')
|
622
|
666
|
->where('transformative_actions.id', $ta_id)
|
623
|
667
|
->select('objectives.text as text', 'objectives.id as id')
|
624
|
668
|
->orderBy('objectives.text', 'ASC')
|
625
|
669
|
->get();
|
|
670
|
+ Log::info($ta_id);
|
626
|
671
|
|
627
|
672
|
$an_objective = $objectives[0]->id;
|
628
|
673
|
$outcome_id = DB::table('criterion_objective_outcome')
|
|
@@ -641,7 +686,10 @@ class TransformativeActionsController extends \BaseController
|
641
|
686
|
->select('objectives.text as text', 'objectives.id as id')
|
642
|
687
|
->get();
|
643
|
688
|
$selected_courses = DB::table('ta_course')
|
644
|
|
- ->join('courses', 'courses.id', '=', 'ta_course.course_id')
|
|
689
|
+ ->join('courses', function ($join) {
|
|
690
|
+ $join->on('courses.number', '=', 'ta_course.course_number');
|
|
691
|
+ $join->on('courses.code', '=', 'ta_course.course_code');
|
|
692
|
+ })
|
645
|
693
|
->where('ta_id', $ta_id)
|
646
|
694
|
->orderBy('courses.name', 'ASC')
|
647
|
695
|
->orderBy('courses.code', 'ASC')
|
|
@@ -694,8 +742,8 @@ class TransformativeActionsController extends \BaseController
|
694
|
742
|
|
695
|
743
|
$objectives = DB::table('objectives')
|
696
|
744
|
->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
|
697
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'objectives.id')
|
698
|
|
- ->where('criterion_objective_outcome.outcome_id', $outcome_id)
|
|
745
|
+ ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
|
|
746
|
+ ->where('objective_outcome.outcome_id', $outcome_id)
|
699
|
747
|
->where('objective_program.program_id', $program_id)
|
700
|
748
|
->orderBy('objectives.text', 'ASC')
|
701
|
749
|
->select('objectives.text as text', 'objectives.id as id')
|
|
@@ -743,25 +791,38 @@ class TransformativeActionsController extends \BaseController
|
743
|
791
|
if ($course_id == 0) {
|
744
|
792
|
$courses = DB::table('ta_course')
|
745
|
793
|
->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
|
746
|
|
- ->join('courses', 'courses.id', '=', 'ta_course.course_id')
|
|
794
|
+ ->join('courses', function ($join) {
|
|
795
|
+ $join->on('courses.number', '=', 'ta_course.course_number');
|
|
796
|
+ $join->on('courses.code', '=', 'ta_course.course_code');
|
|
797
|
+ })
|
747
|
798
|
->where('transformative_actions.is_custom', 1)
|
748
|
799
|
->where('transformative_actions.program_id', $program_id)
|
749
|
800
|
->where('transformative_actions.by_professor', 1)
|
750
|
|
- ->select('courses.id')
|
|
801
|
+ ->select('ta_course.course_number', 'ta_course.course_code')
|
|
802
|
+ ->distinct()
|
751
|
803
|
->get();
|
752
|
804
|
|
753
|
805
|
$course_id = array();
|
754
|
806
|
foreach ($courses as $key => $course) {
|
755
|
|
- array_push($course_id, $course->id);
|
|
807
|
+ array_push($course_id["number"], $course->course_number);
|
|
808
|
+ array_push($course_id["code"], $course->code);
|
756
|
809
|
}
|
757
|
810
|
} else {
|
758
|
|
- $course_id = array($course_id);
|
|
811
|
+
|
|
812
|
+ $parentesis = array('(', ')');
|
|
813
|
+ $course_code_number = str_replace($parentesis, '', $course_id);
|
|
814
|
+
|
|
815
|
+ $course_code_number = explode(',', $course_code_number);
|
|
816
|
+
|
|
817
|
+ $course_id = array();
|
|
818
|
+ $course_id['number'] = $course_code_number[1];
|
|
819
|
+ $course_id['code'] = $course_code_number[0];
|
759
|
820
|
}
|
760
|
821
|
// if outcome isnt a desired filter, search all outcomes
|
761
|
822
|
if ($outcome_id == 0) {
|
762
|
823
|
$outcomes = DB::table('transformative_actions')
|
763
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
764
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
|
824
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
825
|
+ ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
765
|
826
|
->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
|
766
|
827
|
->where('transformative_actions.is_custom', 1)
|
767
|
828
|
->where('transformative_actions.program_id', $program_id)
|
|
@@ -778,16 +839,18 @@ class TransformativeActionsController extends \BaseController
|
778
|
839
|
}
|
779
|
840
|
|
780
|
841
|
// search TA with filters
|
|
842
|
+
|
781
|
843
|
$filtered_at = DB::table('transformative_actions')
|
782
|
844
|
->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
|
783
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
784
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
|
845
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
846
|
+ ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
785
|
847
|
->where('transformative_actions.is_custom', 1)
|
786
|
848
|
->where('transformative_actions.program_id', $program_id)
|
787
|
849
|
->where('transformative_actions.by_professor', 1)
|
788
|
850
|
->whereIn('transformative_actions.user_id', $professor_id)
|
789
|
|
- ->whereIn('criterion_objective_outcome.outcome_id', $outcome_id)
|
790
|
|
- ->whereIn('ta_course.course_id', $course_id)
|
|
851
|
+ ->whereIn('objective_outcome.outcome_id', $outcome_id)
|
|
852
|
+ ->whereIn('ta_course.course_code', $course_id['code'])
|
|
853
|
+ ->whereIn('ta_course.course_number', $course_id['number'])
|
791
|
854
|
->select('transformative_actions.*')
|
792
|
855
|
->groupBy('transformative_actions.id')
|
793
|
856
|
->orderBy('transformative_actions.at_text', 'ASC')
|
|
@@ -816,26 +879,39 @@ class TransformativeActionsController extends \BaseController
|
816
|
879
|
if ($course_id == 0) {
|
817
|
880
|
$courses = DB::table('ta_course')
|
818
|
881
|
->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
|
819
|
|
- ->join('courses', 'courses.id', '=', 'ta_course.course_id')
|
|
882
|
+ ->join('courses', function ($join) {
|
|
883
|
+ $join->on('courses.number', '=', 'ta_course.course_number');
|
|
884
|
+ $join->on('courses.code', '=', 'ta_course.course_code');
|
|
885
|
+ })
|
820
|
886
|
->where('transformative_actions.is_custom', 1)
|
821
|
887
|
->where('transformative_actions.program_id', $program_id)
|
822
|
888
|
->where('transformative_actions.by_professor', 0)
|
823
|
|
- ->select('courses.id')
|
|
889
|
+ ->select('ta_course.course_number', 'ta_course.course_code')
|
|
890
|
+ ->distinct()
|
824
|
891
|
->get();
|
825
|
892
|
|
826
|
893
|
$course_id = array();
|
827
|
894
|
foreach ($courses as $key => $course) {
|
828
|
|
- array_push($course_id, $course->id);
|
|
895
|
+ array_push($course_id["number"], $course->course_number);
|
|
896
|
+ array_push($course_id["code"], $course->code);
|
829
|
897
|
}
|
830
|
898
|
} else {
|
831
|
|
- $course_id = array($course_id);
|
|
899
|
+
|
|
900
|
+ $parentesis = array('(', ')');
|
|
901
|
+ $course_code_number = str_replace($parentesis, '', $course_id);
|
|
902
|
+
|
|
903
|
+ $course_code_number = explode(',', $course_code_number);
|
|
904
|
+
|
|
905
|
+ $course_id = array();
|
|
906
|
+ $course_id['number'] = $course_code_number[1];
|
|
907
|
+ $course_id['code'] = $course_code_number[0];
|
832
|
908
|
}
|
833
|
909
|
// if outcome isnt a desired filter, search all outcomes
|
834
|
910
|
if ($outcome_id == 0) {
|
835
|
911
|
$outcomes = DB::table('transformative_actions')
|
836
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
837
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
838
|
|
- ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
|
|
912
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
913
|
+ ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
|
914
|
+ ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
|
839
|
915
|
->where('transformative_actions.is_custom', 1)
|
840
|
916
|
->where('transformative_actions.program_id', $program_id)
|
841
|
917
|
->where('transformative_actions.by_professor', 0)
|
|
@@ -853,14 +929,15 @@ class TransformativeActionsController extends \BaseController
|
853
|
929
|
// search TA with filters
|
854
|
930
|
$filtered_at = DB::table('transformative_actions')
|
855
|
931
|
->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
|
856
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
857
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
|
932
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
933
|
+ ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
858
|
934
|
->where('transformative_actions.is_custom', 1)
|
859
|
935
|
->where('transformative_actions.program_id', $program_id)
|
860
|
936
|
->where('transformative_actions.by_professor', 0)
|
861
|
937
|
->whereIn('transformative_actions.user_id', $professor_id)
|
862
|
|
- ->whereIn('criterion_objective_outcome.outcome_id', $outcome_id)
|
863
|
|
- ->whereIn('ta_course.course_id', $course_id)
|
|
938
|
+ ->whereIn('objective_outcome.outcome_id', $outcome_id)
|
|
939
|
+ ->whereIn('ta_course.course_code', $course_id['code'])
|
|
940
|
+ ->whereIn('ta_course.course_number', $course_id['number'])
|
864
|
941
|
->select('transformative_actions.*')
|
865
|
942
|
->groupBy('transformative_actions.id')
|
866
|
943
|
->orderBy('transformative_actions.at_text', 'ASC')
|
|
@@ -879,22 +956,32 @@ class TransformativeActionsController extends \BaseController
|
879
|
956
|
->where('transformative_actions.is_custom', 1)
|
880
|
957
|
->where('transformative_actions.program_id', $program_id)
|
881
|
958
|
->where('transformative_actions.by_professor', 1)
|
882
|
|
- ->select('courses.id')
|
|
959
|
+ ->select('ta_course.course_number', 'ta_course.course_code')
|
|
960
|
+ ->distinct()
|
883
|
961
|
->get();
|
884
|
962
|
|
885
|
963
|
$course_id = array();
|
886
|
964
|
foreach ($courses as $key => $course) {
|
887
|
|
- array_push($course_id, $course->id);
|
|
965
|
+ array_push($course_id["number"], $course->course_number);
|
|
966
|
+ array_push($course_id["code"], $course->code);
|
888
|
967
|
}
|
889
|
968
|
} else {
|
890
|
|
- $course_id = array($course_id);
|
|
969
|
+
|
|
970
|
+ $parentesis = array('(', ')');
|
|
971
|
+ $course_code_number = str_replace($parentesis, '', $course_id);
|
|
972
|
+
|
|
973
|
+ $course_code_number = explode(',', $course_code_number);
|
|
974
|
+
|
|
975
|
+ $course_id = array();
|
|
976
|
+ $course_id['number'] = $course_code_number[1];
|
|
977
|
+ $course_id['code'] = $course_code_number[0];
|
891
|
978
|
}
|
892
|
979
|
// if outcome isnt a desired filter, search all outcomes
|
893
|
980
|
if ($outcome_id == 0) {
|
894
|
981
|
$outcomes = DB::table('transformative_actions')
|
895
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
896
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
897
|
|
- ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
|
|
982
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
983
|
+ ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
|
984
|
+ ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
|
898
|
985
|
->where('transformative_actions.user_id', Auth::user()->id)
|
899
|
986
|
->where('transformative_actions.is_custom', 1)
|
900
|
987
|
->where('transformative_actions.program_id', $program_id)
|
|
@@ -913,14 +1000,15 @@ class TransformativeActionsController extends \BaseController
|
913
|
1000
|
// search TA with filters
|
914
|
1001
|
$filtered_at = DB::table('transformative_actions')
|
915
|
1002
|
->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
|
916
|
|
- ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
|
917
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
|
|
1003
|
+ ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
|
|
1004
|
+ ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
|
918
|
1005
|
->where('transformative_actions.user_id', Auth::user()->id)
|
919
|
1006
|
->where('transformative_actions.is_custom', 1)
|
920
|
1007
|
->where('transformative_actions.program_id', $program_id)
|
921
|
1008
|
->where('transformative_actions.by_professor', 1)
|
922
|
1009
|
->whereIn('criterion_objective_outcome.outcome_id', $outcome_id)
|
923
|
|
- ->whereIn('ta_course.course_id', $course_id)
|
|
1010
|
+ ->whereIn('ta_course.course_code', $course_id['code'])
|
|
1011
|
+ ->whereIn('ta_course.course_number', $course_id['number'])
|
924
|
1012
|
->select('transformative_actions.*')
|
925
|
1013
|
->groupBy('transformative_actions.id')
|
926
|
1014
|
->orderBy('transformative_actions.at_text', 'ASC')
|
|
@@ -933,6 +1021,12 @@ class TransformativeActionsController extends \BaseController
|
933
|
1021
|
function postActivityCriterion($activity_id)
|
934
|
1022
|
{
|
935
|
1023
|
DB::beginTransaction();
|
|
1024
|
+
|
|
1025
|
+ $existing_transformative_action = DB::table('transformative_actions')
|
|
1026
|
+ ->join('transformative_activity_criterion', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
|
|
1027
|
+ ->join('activity_criterion', 'activity_criterion.id', '=', 'transformative_activity_criterion.activity_criterion_id')
|
|
1028
|
+ ->where('activity_id', $activity_id)
|
|
1029
|
+ ->delete();
|
936
|
1030
|
$activity_criterion = Input::get('trans_act');
|
937
|
1031
|
|
938
|
1032
|
$trans = new TransformativeAction;
|
|
@@ -949,8 +1043,19 @@ class TransformativeActionsController extends \BaseController
|
949
|
1043
|
$trans->at_text = Input::get('name_trans');
|
950
|
1044
|
$trans->description = Input::get('transforming_actions');
|
951
|
1045
|
|
|
1046
|
+ $activity = DB::table('activities')
|
|
1047
|
+ ->where('id', $activity_id)
|
|
1048
|
+ ->first();
|
|
1049
|
+ $course_credentials = DB::table('courses')
|
|
1050
|
+ ->where('id', $activity->course_id)
|
|
1051
|
+ ->first();
|
|
1052
|
+
|
|
1053
|
+
|
952
|
1054
|
if ($trans->save()) {
|
953
|
1055
|
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
954
|
1059
|
foreach ($activity_criterion as $single_ac) {
|
955
|
1060
|
$result = DB::insert("insert into `transformative_activity_criterion` (`trans_action_id`, `activity_criterion_id`) values ($trans->id, $single_ac)");
|
956
|
1061
|
if (!$result) {
|
|
@@ -961,6 +1066,35 @@ class TransformativeActionsController extends \BaseController
|
961
|
1066
|
return Redirect::to("professor/activities/{$activity_id}");
|
962
|
1067
|
}
|
963
|
1068
|
}
|
|
1069
|
+ $criteria = DB::table('activity_criterion')
|
|
1070
|
+ ->whereIn('id', $activity_criterion)
|
|
1071
|
+ ->lists('criterion_id');
|
|
1072
|
+
|
|
1073
|
+ $allObjectives = DB::table('criterion_objective_outcome')
|
|
1074
|
+ ->whereIn('criterion_id', $criteria)
|
|
1075
|
+ ->select('objective_id')
|
|
1076
|
+ ->distinct()
|
|
1077
|
+ ->lists('objective_id');
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+ foreach ($allObjectives as $objective) {
|
|
1081
|
+ $result2 = DB::insert("insert into `transformative_objective` (`ta_id`, `objective_id`) values ({$trans->id},{$objective})");
|
|
1082
|
+ if (!$result2) {
|
|
1083
|
+ DB::rollback();
|
|
1084
|
+ Session::flash('status', 'danger');
|
|
1085
|
+ Session::flash('message', 'Error saving Transforming Action. Try again later.');
|
|
1086
|
+
|
|
1087
|
+ return Redirect::to("professor/activities/{$activity_id}");
|
|
1088
|
+ }
|
|
1089
|
+ }
|
|
1090
|
+ $result3 = DB::insert("insert into `ta_course` (`ta_id`, `course_number`, `course_code`) values ({$trans->id}, '{$course_credentials->number}', '{$course_credentials->code}')");
|
|
1091
|
+
|
|
1092
|
+ if (!($result3)) {
|
|
1093
|
+ DB::rollback();
|
|
1094
|
+ Session::flash('status', 'danger');
|
|
1095
|
+ Session::flash('message', 'Error saving Transforming Action. Try again later.');
|
|
1096
|
+ return Redirect::to("professor/activities/{$activity_id}");
|
|
1097
|
+ }
|
964
|
1098
|
DB::commit();
|
965
|
1099
|
Session::flash('status', 'success');
|
966
|
1100
|
Session::flash('message', 'Transformative Actions Saved.');
|