|
@@ -14,7 +14,7 @@ class OutcomesController extends \BaseController
|
14
|
14
|
{
|
15
|
15
|
$title = "Learning Outcomes";
|
16
|
16
|
$outcomes = Outcome::withTrashed()->orderBy('id', 'ASC')->get();
|
17
|
|
-// $outcomes = Outcome::withTrashed()->orderBy('name', 'ASC')->get();
|
|
17
|
+ // $outcomes = Outcome::withTrashed()->orderBy('name', 'ASC')->get();
|
18
|
18
|
$schools = School::orderBy('name', 'ASC')->get();
|
19
|
19
|
// $semesters_ids = Session::get('semesters_ids');
|
20
|
20
|
// $semesters = Semester::whereIn('id',$semesters_ids)->get();
|
|
@@ -343,28 +343,26 @@ class OutcomesController extends \BaseController
|
343
|
343
|
public function delete()
|
344
|
344
|
{
|
345
|
345
|
$outcomeArray = json_decode(Input::get('outcomeArray'), true);
|
346
|
|
-// Log::info("delete".json_encode($outcomeArray));
|
347
|
|
- $outcome = Outcome::withTrashed()
|
348
|
|
- ->where('id', '=', $outcomeArray['id'])
|
349
|
|
- ->firstOrFail();
|
350
|
|
-// Log::info("delete2".json_encode($outcome));
|
351
|
|
- $outcome->forceDelete();
|
352
|
|
-// Log::info("sal".json_encode($sal));
|
353
|
|
-// if($sal)
|
354
|
|
- {
|
355
|
|
- Session::flash('status', 'success');
|
356
|
|
- Session::flash('message', 'Learning Outcome deleted.');
|
357
|
|
-
|
358
|
|
- }
|
359
|
|
-
|
360
|
|
- }
|
361
|
|
-
|
|
346
|
+ // Log::info("delete".json_encode($outcomeArray));
|
|
347
|
+ $outcome = Outcome::withTrashed()
|
|
348
|
+ ->where('id', '=', $outcomeArray['id'])
|
|
349
|
+ ->firstOrFail();
|
|
350
|
+ // Log::info("delete2".json_encode($outcome));
|
|
351
|
+ $outcome->forceDelete();
|
|
352
|
+ // Log::info("sal".json_encode($sal));
|
|
353
|
+ // if($sal)
|
|
354
|
+ {
|
|
355
|
+ Session::flash('status', 'success');
|
|
356
|
+ Session::flash('message', 'Learning Outcome deleted.');
|
|
357
|
+ }
|
|
358
|
+ }
|
|
359
|
+
|
362
|
360
|
public function updateMore()
|
363
|
361
|
{
|
364
|
362
|
$outcomeArray = json_decode(Input::get('outcomeArray'), true);
|
365
|
363
|
Session::flash('status', 'success');
|
366
|
364
|
Session::flash('message', 'Learning Outcomes updated.');
|
367
|
|
- Log::info("Ahora1".json_encode($outcomeArray));
|
|
365
|
+ Log::info("Ahora1" . json_encode($outcomeArray));
|
368
|
366
|
|
369
|
367
|
foreach ($outcomeArray as $outcomeObject) {
|
370
|
368
|
|
|
@@ -375,9 +373,9 @@ class OutcomesController extends \BaseController
|
375
|
373
|
'definition' => $outcomeObject['definition'],
|
376
|
374
|
'expected_outcome' => $outcomeObject['expected_outcome'],
|
377
|
375
|
'activation_date' => $outcomeObject['activation_date'],
|
378
|
|
-// 'deactivation_date' => (isset($outcomeObject['deactivation_date'])?$outcomeObject['deactivation_date']:NULL),
|
|
376
|
+ // 'deactivation_date' => (isset($outcomeObject['deactivation_date'])?$outcomeObject['deactivation_date']:NULL),
|
379
|
377
|
'level' => $outcomeObject['level'],
|
380
|
|
-// 'new_outcome_id'=>$outcomeObject['new_outcome_id']
|
|
378
|
+ // 'new_outcome_id'=>$outcomeObject['new_outcome_id']
|
381
|
379
|
// TODO- validar los otros 3 valores
|
382
|
380
|
),
|
383
|
381
|
array(
|
|
@@ -385,9 +383,9 @@ class OutcomesController extends \BaseController
|
385
|
383
|
'definition' => 'required',
|
386
|
384
|
'expected_outcome' => 'required|numeric',
|
387
|
385
|
'activation_date' => 'required|date',
|
388
|
|
-// 'deactivation_date' => 'sometimes|required|date',
|
|
386
|
+ // 'deactivation_date' => 'sometimes|required|date',
|
389
|
387
|
'level' => 'required|numeric'
|
390
|
|
-// 'new_outcome_id' => 'required|numeric'
|
|
388
|
+ // 'new_outcome_id' => 'required|numeric'
|
391
|
389
|
// TODO- los requisitos de los otros 3 valores
|
392
|
390
|
)
|
393
|
391
|
);
|
|
@@ -401,18 +399,15 @@ class OutcomesController extends \BaseController
|
401
|
399
|
$outcome->definition = $outcomeObject['definition'];
|
402
|
400
|
$outcome->expected_outcome = $outcomeObject['expected_outcome'];
|
403
|
401
|
$outcome->activation_date = $outcomeObject['activation_date'];
|
404
|
|
- if($outcomeObject['deactivation_date']!="")
|
405
|
|
- {
|
406
|
|
- $outcome->deactivation_date = $outcomeObject['deactivation_date'];
|
407
|
|
- if(isset($outcomeObject['new_outcome_id']))$outcome->new_outcome_id = $outcomeObject['new_outcome_id'];
|
408
|
|
- }
|
409
|
|
- else
|
410
|
|
- {
|
411
|
|
- $outcome->deactivation_date = NULL;
|
412
|
|
- $outcome->new_outcome_id=NULL;
|
|
402
|
+ if ($outcomeObject['deactivation_date'] != "") {
|
|
403
|
+ $outcome->deactivation_date = $outcomeObject['deactivation_date'];
|
|
404
|
+ if (isset($outcomeObject['new_outcome_id'])) $outcome->new_outcome_id = $outcomeObject['new_outcome_id'];
|
|
405
|
+ } else {
|
|
406
|
+ $outcome->deactivation_date = NULL;
|
|
407
|
+ $outcome->new_outcome_id = NULL;
|
413
|
408
|
}
|
414
|
409
|
$outcome->level = $outcomeObject['level'];
|
415
|
|
- Log::info("Ahora2".json_encode($outcome));
|
|
410
|
+ Log::info("Ahora2" . json_encode($outcome));
|
416
|
411
|
|
417
|
412
|
$outcome->save();
|
418
|
413
|
|
|
@@ -448,22 +443,24 @@ class OutcomesController extends \BaseController
|
448
|
443
|
|
449
|
444
|
public function fetchCriteria()
|
450
|
445
|
{
|
451
|
|
- // var_dump((Input::get('filter')));
|
452
|
|
- // exit();
|
|
446
|
+ $criteria_not_available = DB::table('criterion_objective_outcome')
|
|
447
|
+ ->where('objective_id', '=', 0)
|
|
448
|
+ ->lists('criterion_id');
|
|
449
|
+ $criteria = DB::table('criteria')
|
|
450
|
+ ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id');
|
453
|
451
|
if (Input::get('filter')) {
|
454
|
452
|
switch (Input::get('filter')) {
|
455
|
453
|
case 'all':
|
456
|
|
- $criteria = DB::table('criteria')
|
|
454
|
+ /*$criteria = DB::table('criteria')
|
457
|
455
|
->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
458
|
456
|
->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
|
459
|
457
|
->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
|
460
|
458
|
->where('criteria.num_scales', '=', Input::get('num_scales'))
|
461
|
|
- ->where('criteria.max_score', '=', Input::get('maximum'))
|
462
|
|
- ->select('criterion_id as id', 'name')
|
463
|
|
- ->orderBy('name', 'ASC')
|
464
|
|
- ->get();
|
|
459
|
+ ->where('criteria.max_score', '=', Input::get('maximum'))*/
|
|
460
|
+
|
465
|
461
|
|
466
|
|
- foreach ($criteria as $criterion) {
|
|
462
|
+
|
|
463
|
+ /*foreach ($criteria as $criterion) {
|
467
|
464
|
$criterion->program_ids = json_encode(DB::table('program_criterion')
|
468
|
465
|
->where('criterion_id', $criterion->id)
|
469
|
466
|
->lists('program_id'));
|
|
@@ -475,6 +472,7 @@ class OutcomesController extends \BaseController
|
475
|
472
|
->lists('text');
|
476
|
473
|
}
|
477
|
474
|
return $criteria;
|
|
475
|
+ break;*/
|
478
|
476
|
break;
|
479
|
477
|
|
480
|
478
|
case 'school':
|
|
@@ -483,17 +481,15 @@ class OutcomesController extends \BaseController
|
483
|
481
|
|
484
|
482
|
// Fetch all the programs whose school is the user's
|
485
|
483
|
$program_ids = DB::table('programs')->where('school_id', Auth::user()->school_id)->lists('id');
|
486
|
|
- $criteria = DB::table('criteria')
|
487
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
488
|
|
- ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
|
489
|
|
- ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
|
490
|
|
- ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
|
491
|
|
- ->where('criteria.num_scales', '=', Input::get('num_scales'))
|
492
|
|
- ->where('criteria.max_score', '=', Input::get('maximum'))
|
493
|
|
- ->whereIn('program_criterion.program_id', $program_ids)
|
494
|
|
- ->select('criterion_id as id', 'name')
|
495
|
|
- ->orderBy('name', 'ASC')
|
496
|
|
- ->get();
|
|
484
|
+ } else {
|
|
485
|
+ $program_ids = DB::table('programs')->where('school_id', Auth::user()->programs[0]->school->id)->lists('id');
|
|
486
|
+ }
|
|
487
|
+ $criteria = $criteria
|
|
488
|
+ ->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
|
|
489
|
+
|
|
490
|
+ ->whereIn('poco.program_id', $program_ids);
|
|
491
|
+
|
|
492
|
+ /*
|
497
|
493
|
foreach ($criteria as $criterion) {
|
498
|
494
|
$criterion->program_ids = json_encode(DB::table('program_criterion')
|
499
|
495
|
->where('criterion_id', $criterion->id)
|
|
@@ -506,57 +502,21 @@ class OutcomesController extends \BaseController
|
506
|
502
|
->lists('text'));
|
507
|
503
|
}
|
508
|
504
|
// Return all criteria belonging to any of those programs
|
509
|
|
- return $criteria;
|
510
|
|
- }
|
|
505
|
+ return $criteria;*/
|
511
|
506
|
|
512
|
|
- // If pcoord
|
513
|
|
- else {
|
514
|
507
|
|
515
|
|
- // Fetch all the programs from the user's school;
|
516
|
|
- // Fetch all the programs from the user's school;
|
517
|
|
- $program_ids = DB::table('programs')->where('school_id', Auth::user()->programs[0]->school->id)->lists('id');
|
518
|
508
|
|
519
|
|
- $criteria = DB::table('criteria')
|
520
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
521
|
|
- ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
|
522
|
|
- ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
|
523
|
|
- ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
|
524
|
|
- ->where('criteria.num_scales', '=', Input::get('num_scales'))
|
525
|
|
- ->where('criteria.max_score', '=', Input::get('maximum'))
|
526
|
|
- ->whereIn('program_criterion.program_id', $program_ids)
|
527
|
|
- ->select('criterion_id as id', 'name')
|
528
|
|
- ->orderBy('name', 'ASC')
|
529
|
|
- ->get();
|
530
|
509
|
|
531
|
|
- foreach ($criteria as $criterion) {
|
532
|
|
- $criterion->program_ids = json_encode(DB::table('program_criterion')
|
533
|
|
- ->where('criterion_id', $criterion->id)
|
534
|
|
- ->lists('program_id'));
|
535
|
|
- $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
|
536
|
|
- ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
|
537
|
|
- ->where('criterion_id', $criterion->id)
|
538
|
|
- ->select('objectives.*')
|
539
|
|
- ->distinct()
|
540
|
|
- ->lists('text'));
|
541
|
|
- }
|
542
|
|
- return $criteria;
|
543
|
|
- }
|
544
|
510
|
|
545
|
511
|
break;
|
546
|
512
|
|
547
|
513
|
case 'program':
|
548
|
|
- $criteria = DB::table('criteria')
|
549
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
550
|
|
- ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
|
551
|
|
- ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
|
552
|
|
- ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
|
553
|
|
- ->where('criteria.num_scales', '=', Input::get('num_scales'))
|
554
|
|
- ->where('criteria.max_score', '=', Input::get('maximum'))
|
555
|
|
- ->whereIn('program_criterion.program_id', Auth::user()->programs->lists('id'))
|
556
|
|
- ->select('criterion_id as id', 'name')
|
557
|
|
- ->orderBy('name', 'ASC')
|
558
|
|
- ->get();
|
559
|
|
- foreach ($criteria as $criterion) {
|
|
514
|
+
|
|
515
|
+ $criteria = $criteria
|
|
516
|
+ ->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
|
|
517
|
+
|
|
518
|
+ ->whereIn('poco.program_id', Auth::user()->programs->lists('id'));
|
|
519
|
+ /*foreach ($criteria as $criterion) {
|
560
|
520
|
$criterion->program_ids = json_encode(DB::table('program_criterion')
|
561
|
521
|
->where('criterion_id', $criterion->id)
|
562
|
522
|
->lists('program_id'));
|
|
@@ -567,21 +527,13 @@ class OutcomesController extends \BaseController
|
567
|
527
|
->distinct()
|
568
|
528
|
->lists('text'));
|
569
|
529
|
}
|
570
|
|
- return $criteria;
|
|
530
|
+ return $criteria;*/
|
571
|
531
|
break;
|
572
|
532
|
|
573
|
533
|
default:
|
574
|
|
- $criteria = DB::table('criteria')
|
575
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
576
|
|
- ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
|
577
|
|
- ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
|
578
|
|
- ->where('criteria.num_scales', '=', Input::get('num_scales'))
|
579
|
|
- ->where('criteria.max_score', '=', Input::get('maximum'))
|
580
|
|
- ->select('criterion_id as id', 'name')
|
581
|
|
- ->orderBy('name', 'ASC')
|
582
|
|
- ->get();
|
583
|
534
|
|
584
|
|
- foreach ($criteria as $criterion) {
|
|
535
|
+
|
|
536
|
+ /*foreach ($criteria as $criterion) {
|
585
|
537
|
$criterion->program_ids = json_encode(DB::table('program_criterion')
|
586
|
538
|
->where('criterion_id', $criterion->id)
|
587
|
539
|
->lists('program_id'));
|
|
@@ -592,33 +544,21 @@ class OutcomesController extends \BaseController
|
592
|
544
|
->distinct()
|
593
|
545
|
->lists('text'));
|
594
|
546
|
}
|
595
|
|
- return $criteria;
|
|
547
|
+ return $criteria;*/
|
596
|
548
|
break;
|
597
|
549
|
}
|
598
|
|
- } else {
|
599
|
|
- $criteria = DB::table('criteria')
|
600
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
601
|
|
- ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
|
602
|
|
- ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
|
603
|
|
- ->where('criteria.num_scales', '=', Input::get('num_scales'))
|
604
|
|
- ->where('criteria.max_score', '=', Input::get('maximum'))
|
605
|
|
- ->select('criterion_id as id', 'name')
|
606
|
|
- ->orderBy('name', 'ASC')
|
607
|
|
- ->get();
|
608
|
|
-
|
609
|
|
- foreach ($criteria as $criterion) {
|
610
|
|
- $criterion->program_ids = json_encode(DB::table('program_criterion')
|
611
|
|
- ->where('criterion_id', $criterion->id)
|
612
|
|
- ->lists('program_id'));
|
613
|
|
- $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
|
614
|
|
- ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
|
615
|
|
- ->where('criterion_id', $criterion->id)
|
616
|
|
- ->select('objectives.*')
|
617
|
|
- ->distinct()
|
618
|
|
- ->lists('text'));
|
619
|
|
- }
|
620
|
|
- return $criteria;
|
621
|
550
|
}
|
|
551
|
+
|
|
552
|
+ $criteria = $criteria
|
|
553
|
+ ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
|
|
554
|
+ ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
|
|
555
|
+ ->where('criteria.num_scales', '=', Input::get('num_scales'))
|
|
556
|
+ ->where('criteria.max_score', '=', Input::get('maximum'))
|
|
557
|
+ ->whereNotIn('criteria.id', $criteria_not_available)
|
|
558
|
+ ->select('criterion_id as id', 'name')
|
|
559
|
+ ->orderBy('name', 'ASC')
|
|
560
|
+ ->get();
|
|
561
|
+ return $criteria;
|
622
|
562
|
}
|
623
|
563
|
|
624
|
564
|
/**
|
|
@@ -715,7 +655,7 @@ class OutcomesController extends \BaseController
|
715
|
655
|
$diferent_levels = DB::table('criterion_objective_outcome')
|
716
|
656
|
->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
|
717
|
657
|
// GASP, añadí programa, para que solo muestre niveles de criterios del programa
|
718
|
|
- ->join('program_criterion', 'criteria.id', '=', 'program_criterion.criterion_id')
|
|
658
|
+ ->join('program_criterion_objective_outcome', 'criterion_objective_outcome.id', '=', 'program_criterion_objective_outcome.cri_obj_out_id')
|
719
|
659
|
->whereIn('program_id', $program_ids)
|
720
|
660
|
->where('criterion_objective_outcome.outcome_id', $id)
|
721
|
661
|
->distinct('criteria.num_scales')
|
|
@@ -739,8 +679,8 @@ class OutcomesController extends \BaseController
|
739
|
679
|
// ->get();
|
740
|
680
|
$outcome_criterias = DB::table('criterion_objective_outcome')
|
741
|
681
|
->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
|
742
|
|
- ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
|
743
|
|
- ->whereIn('program_criterion.program_id', $program_ids)
|
|
682
|
+ ->join('program_criterion_objective_outcome', 'criterion_objective_outcome.id', '=', 'program_criterion_objective_outcome.cri_obj_out_id')
|
|
683
|
+ ->whereIn('program_criterion_objective_outcome.program_id', $program_ids)
|
744
|
684
|
->where('criterion_objective_outcome.outcome_id', $id)
|
745
|
685
|
->where('criteria.num_scales', $level)
|
746
|
686
|
->select('criteria.id', 'criteria.name', 'criteria.deleted_at')
|
|
@@ -753,10 +693,14 @@ class OutcomesController extends \BaseController
|
753
|
693
|
$scales = DB::select("select * FROM scales INNER join `criterion_scale` on `criterion_scale`.`scale_id` = `scales`.`id` where criterion_scale.criterion_id ={$criteria_id->id} ORDER BY position");
|
754
|
694
|
|
755
|
695
|
$programs = DB::table('programs')
|
756
|
|
- ->join('program_criterion', 'program_criterion.program_id', '=', 'programs.id')
|
|
696
|
+ ->join('program_criterion_objective_outcome', 'programs.id', '=', 'program_criterion_objective_outcome.program_id')
|
|
697
|
+ ->join('criterion_objective_outcome as cobo', 'cobo.id', '=', 'program_criterion_objective_outcome.cri_obj_out_id')
|
|
698
|
+ //->join('program_criterion', 'program_criterion.program_id', '=', 'programs.id')
|
757
|
699
|
->where('criterion_id', $criteria_id->id)
|
|
700
|
+ ->select('programs.*')
|
|
701
|
+ ->distinct()
|
758
|
702
|
->lists('programs.name');
|
759
|
|
- Log::info($scales);
|
|
703
|
+ // Log::info($scales);
|
760
|
704
|
|
761
|
705
|
/* $scales =
|
762
|
706
|
DB::select(
|