Browse Source

Feature de objectives

parent
commit
0a44bf0ba1

+ 16
- 11
app/controllers/CriteriaController.php View File

257
             ->where('criterion_id', $criteria_id)
257
             ->where('criterion_id', $criteria_id)
258
             ->orderBy('position')
258
             ->orderBy('position')
259
             ->get();
259
             ->get();
260
-        $criterion->program =  DB::table('program_criterion')->where('criterion_id', $criteria_id)->get();
260
+        $criterion->program =  DB::table('program_criterion_objective_outcome as poco')
261
+            ->join('criterion_objective_outcome as cobo', 'cobo.id', '=', 'poco.cri_obj_out_id')
262
+            ->where('criterion_id', $criteria_id)
263
+            ->select('poco.program_id')
264
+            ->distinct()->get();
261
         $criterion->activity_criterion = DB::table('assessments')
265
         $criterion->activity_criterion = DB::table('assessments')
262
             ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
266
             ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
263
             ->where('activity_criterion.criterion_id', $criteria_id)
267
             ->where('activity_criterion.criterion_id', $criteria_id)
336
 
340
 
337
 
341
 
338
         $saved_criterion = DB::table('criteria')
342
         $saved_criterion = DB::table('criteria')
339
-            ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
340
             ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
343
             ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
344
+            ->join('program_criterion_objective_outcome', 'program_criterion_objective_outcome.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
345
+
341
             ->join('criterion_scale', 'criterion_scale.criterion_id', '=', 'criteria.id')
346
             ->join('criterion_scale', 'criterion_scale.criterion_id', '=', 'criteria.id')
342
             ->whereIn('program_id', $input['program_id'])
347
             ->whereIn('program_id', $input['program_id'])
343
             ->whereIn('objective_id', $objectives)
348
             ->whereIn('objective_id', $objectives)
461
      */
466
      */
462
     public function create()
467
     public function create()
463
     {
468
     {
464
-        $clean_input = $this->cleanInput();	
469
+        $clean_input = $this->cleanInput();
465
 
470
 
466
         Log::info(json_encode($clean_input));
471
         Log::info(json_encode($clean_input));
467
 
472
 
489
                     return Redirect::to('criteria')->withInput();
494
                     return Redirect::to('criteria')->withInput();
490
 
495
 
491
                 case 2:
496
                 case 2:
492
-//                     Log::info(Input::all());
497
+                    //                     Log::info(Input::all());
493
                     return Redirect::to('school-criteria')->withInput();
498
                     return Redirect::to('school-criteria')->withInput();
494
 
499
 
495
                 case 3:
500
                 case 3:
630
                 }*/
635
                 }*/
631
 
636
 
632
 
637
 
633
-                foreach ($clean_input['program_id'] as $program_id) {
634
-                    DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
635
-                }
638
+                //foreach ($clean_input['program_id'] as $program_id) {
639
+                //    DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
640
+                //}
636
 
641
 
637
                 Session::flash('status', 'success');
642
                 Session::flash('status', 'success');
638
                 Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
643
                 Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
873
                 $criterionId = $criterion->id;
878
                 $criterionId = $criterion->id;
874
                 DB::table('criterion_objective_outcome as cobo')
879
                 DB::table('criterion_objective_outcome as cobo')
875
                     ->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'cobo.id')
880
                     ->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'cobo.id')
876
-                    ->where($criterionId)
881
+                    ->where('cobo.criterion_id', $criterionId)
877
                     ->delete();
882
                     ->delete();
878
                 // DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
883
                 // DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
879
                 DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
884
                 DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
964
 
969
 
965
                         break;
970
                         break;
966
                 }*/
971
                 }*/
967
-                foreach ($clean_input['program_id'] as $program_id) {
968
-                    DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
969
-                }
972
+                //foreach ($clean_input['program_id'] as $program_id) {
973
+                //    DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
974
+                //}
970
 
975
 
971
 
976
 
972
 
977
 

+ 2
- 2
app/controllers/Objective2Controller.php View File

660
 				if ($clean_input['agreement']) {
660
 				if ($clean_input['agreement']) {
661
 					DB::table('criterion_objective_outcome')
661
 					DB::table('criterion_objective_outcome')
662
 						//QUE PONEMOS CORRADA
662
 						//QUE PONEMOS CORRADA
663
-						//->join('program_criterion_objective_outcome', 'criterion_objective_outcome.id', "=", 'program_criterion_objective_outcome.cri_obj_out_id')
663
+						->join('program_criterion_objective_outcome', 'criterion_objective_outcome.id', "=", 'program_criterion_objective_outcome.cri_obj_out_id')
664
 
664
 
665
-						->join('program_criterion', 'criterion_objective_outcome.criterion_id', "=", 'program_criterion.criterion_id')
665
+						//->join('program_criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', "=", 'program_criterion_objective_outcome.criterion_id')
666
 						->whereIn('program_id', $clean_input['program_id'])
666
 						->whereIn('program_id', $clean_input['program_id'])
667
 						->whereIn('outcome_id', $clean_input['outcome_id'])
667
 						->whereIn('outcome_id', $clean_input['outcome_id'])
668
 						->where('objective_id', '=', 0)
668
 						->where('objective_id', '=', 0)

+ 10
- 5
app/controllers/ObjectivesController.php View File

242
     }
242
     }
243
 
243
 
244
     $criteria_scales = DB::table('criteria')
244
     $criteria_scales = DB::table('criteria')
245
-      ->join('criterion_objective_outcome as cobo', 'criterion_id', '=', 'criteria.id')
246
-      ->join('program_criterion', 'cobo.criterion_id', '=', 'program_criterion.criterion_id')
245
+      ->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'criteria.id')
246
+      ->join('program_criterion_objective_outcome as poco', 'cobo.id', '=', 'poco.cri_obj_out_id')
247
       ->whereIn('program_id', $program_ids)
247
       ->whereIn('program_id', $program_ids)
248
       ->where('objective_id', $objective->id)
248
       ->where('objective_id', $objective->id)
249
       ->select('num_scales')
249
       ->select('num_scales')
255
 
255
 
256
       $objective->criteria[$num_scales] = DB::table('criteria')
256
       $objective->criteria[$num_scales] = DB::table('criteria')
257
         ->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'criteria.id')
257
         ->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'criteria.id')
258
-        ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
258
+        ->join('program_criterion_objective_outcome as poco', 'cobo.id', '=', 'poco.cri_obj_out_id')
259
         ->whereIn('program_id', $program_ids)
259
         ->whereIn('program_id', $program_ids)
260
         ->where('objective_id', $objective->id)
260
         ->where('objective_id', $objective->id)
261
         ->where('num_scales', $num_scales)
261
         ->where('num_scales', $num_scales)
265
 
265
 
266
       foreach ($objective->criteria[$num_scales] as $criteria) {
266
       foreach ($objective->criteria[$num_scales] as $criteria) {
267
         $criteria->programs = DB::table('programs')
267
         $criteria->programs = DB::table('programs')
268
-          ->join('program_criterion', 'programs.id', '=', 'program_criterion.program_id')
268
+          ->join('program_criterion_objective_outcome as poco', 'poco.program_id', '=', 'programs.id')
269
+          ->join('criterion_objective_outcome as cobo', 'cobo.id', '=', 'poco.cri_obj_out_id')
270
+
271
+
269
           ->where('criterion_id', $criteria->criterion_id)
272
           ->where('criterion_id', $criteria->criterion_id)
273
+          ->select("programs.*")
274
+          ->distinct()
270
           ->get();
275
           ->get();
271
 
276
 
272
         $criteria->outcomes = DB::table('outcomes')
277
         $criteria->outcomes = DB::table('outcomes')
289
       'objective' => $objective
294
       'objective' => $objective
290
     );
295
     );
291
   }
296
   }
292
-}
297
+}

+ 78
- 134
app/controllers/OutcomesController.php View File

14
     {
14
     {
15
         $title = "Learning Outcomes";
15
         $title = "Learning Outcomes";
16
         $outcomes = Outcome::withTrashed()->orderBy('id', 'ASC')->get();
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
         $schools = School::orderBy('name', 'ASC')->get();
18
         $schools = School::orderBy('name', 'ASC')->get();
19
         // $semesters_ids = Session::get('semesters_ids');
19
         // $semesters_ids = Session::get('semesters_ids');
20
         // $semesters = Semester::whereIn('id',$semesters_ids)->get();
20
         // $semesters = Semester::whereIn('id',$semesters_ids)->get();
343
     public function delete()
343
     public function delete()
344
     {
344
     {
345
         $outcomeArray = json_decode(Input::get('outcomeArray'), true);
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
     public function updateMore()
360
     public function updateMore()
363
     {
361
     {
364
         $outcomeArray = json_decode(Input::get('outcomeArray'), true);
362
         $outcomeArray = json_decode(Input::get('outcomeArray'), true);
365
         Session::flash('status', 'success');
363
         Session::flash('status', 'success');
366
         Session::flash('message', 'Learning Outcomes updated.');
364
         Session::flash('message', 'Learning Outcomes updated.');
367
-		Log::info("Ahora1".json_encode($outcomeArray));
365
+        Log::info("Ahora1" . json_encode($outcomeArray));
368
 
366
 
369
         foreach ($outcomeArray as $outcomeObject) {
367
         foreach ($outcomeArray as $outcomeObject) {
370
 
368
 
375
                     'definition' => $outcomeObject['definition'],
373
                     'definition' => $outcomeObject['definition'],
376
                     'expected_outcome' => $outcomeObject['expected_outcome'],
374
                     'expected_outcome' => $outcomeObject['expected_outcome'],
377
                     'activation_date' => $outcomeObject['activation_date'],
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
                     'level' => $outcomeObject['level'],
377
                     'level' => $outcomeObject['level'],
380
-//                     'new_outcome_id'=>$outcomeObject['new_outcome_id']
378
+                    //                     'new_outcome_id'=>$outcomeObject['new_outcome_id']
381
                     // TODO- validar los otros 3 valores
379
                     // TODO- validar los otros 3 valores
382
                 ),
380
                 ),
383
                 array(
381
                 array(
385
                     'definition' => 'required',
383
                     'definition' => 'required',
386
                     'expected_outcome' => 'required|numeric',
384
                     'expected_outcome' => 'required|numeric',
387
                     'activation_date' => 'required|date',
385
                     'activation_date' => 'required|date',
388
-//                     'deactivation_date' => 'sometimes|required|date',
386
+                    //                     'deactivation_date' => 'sometimes|required|date',
389
                     'level' => 'required|numeric'
387
                     'level' => 'required|numeric'
390
-//                     'new_outcome_id' => 'required|numeric'
388
+                    //                     'new_outcome_id' => 'required|numeric'
391
                     // TODO- los requisitos de los otros 3 valores
389
                     // TODO- los requisitos de los otros 3 valores
392
                 )
390
                 )
393
             );
391
             );
401
                     $outcome->definition = $outcomeObject['definition'];
399
                     $outcome->definition = $outcomeObject['definition'];
402
                     $outcome->expected_outcome = $outcomeObject['expected_outcome'];
400
                     $outcome->expected_outcome = $outcomeObject['expected_outcome'];
403
                     $outcome->activation_date = $outcomeObject['activation_date'];
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
                     $outcome->level = $outcomeObject['level'];
409
                     $outcome->level = $outcomeObject['level'];
415
-		Log::info("Ahora2".json_encode($outcome));
410
+                    Log::info("Ahora2" . json_encode($outcome));
416
 
411
 
417
                     $outcome->save();
412
                     $outcome->save();
418
 
413
 
448
 
443
 
449
     public function fetchCriteria()
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
         if (Input::get('filter')) {
451
         if (Input::get('filter')) {
454
             switch (Input::get('filter')) {
452
             switch (Input::get('filter')) {
455
                 case 'all':
453
                 case 'all':
456
-                    $criteria = DB::table('criteria')
454
+                    /*$criteria = DB::table('criteria')
457
                         ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
455
                         ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
458
                         ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
456
                         ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
459
                         ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
457
                         ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
460
                         ->where('criteria.num_scales', '=', Input::get('num_scales'))
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
                         $criterion->program_ids = json_encode(DB::table('program_criterion')
464
                         $criterion->program_ids = json_encode(DB::table('program_criterion')
468
                             ->where('criterion_id', $criterion->id)
465
                             ->where('criterion_id', $criterion->id)
469
                             ->lists('program_id'));
466
                             ->lists('program_id'));
475
                             ->lists('text');
472
                             ->lists('text');
476
                     }
473
                     }
477
                     return $criteria;
474
                     return $criteria;
475
+                    break;*/
478
                     break;
476
                     break;
479
 
477
 
480
                 case 'school':
478
                 case 'school':
483
 
481
 
484
                         // Fetch all the programs whose school is the user's
482
                         // Fetch all the programs whose school is the user's
485
                         $program_ids = DB::table('programs')->where('school_id', Auth::user()->school_id)->lists('id');
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
                         foreach ($criteria as $criterion) {
493
                         foreach ($criteria as $criterion) {
498
                             $criterion->program_ids = json_encode(DB::table('program_criterion')
494
                             $criterion->program_ids = json_encode(DB::table('program_criterion')
499
                                 ->where('criterion_id', $criterion->id)
495
                                 ->where('criterion_id', $criterion->id)
506
                                 ->lists('text'));
502
                                 ->lists('text'));
507
                         }
503
                         }
508
                         // Return all criteria belonging to any of those programs
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
                     break;
511
                     break;
546
 
512
 
547
                 case 'program':
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
                         $criterion->program_ids = json_encode(DB::table('program_criterion')
520
                         $criterion->program_ids = json_encode(DB::table('program_criterion')
561
                             ->where('criterion_id', $criterion->id)
521
                             ->where('criterion_id', $criterion->id)
562
                             ->lists('program_id'));
522
                             ->lists('program_id'));
567
                             ->distinct()
527
                             ->distinct()
568
                             ->lists('text'));
528
                             ->lists('text'));
569
                     }
529
                     }
570
-                    return $criteria;
530
+                    return $criteria;*/
571
                     break;
531
                     break;
572
 
532
 
573
                 default:
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
                         $criterion->program_ids = json_encode(DB::table('program_criterion')
537
                         $criterion->program_ids = json_encode(DB::table('program_criterion')
586
                             ->where('criterion_id', $criterion->id)
538
                             ->where('criterion_id', $criterion->id)
587
                             ->lists('program_id'));
539
                             ->lists('program_id'));
592
                             ->distinct()
544
                             ->distinct()
593
                             ->lists('text'));
545
                             ->lists('text'));
594
                     }
546
                     }
595
-                    return $criteria;
547
+                    return $criteria;*/
596
                     break;
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
         $diferent_levels = DB::table('criterion_objective_outcome')
655
         $diferent_levels = DB::table('criterion_objective_outcome')
716
             ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
656
             ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
717
             // GASP, añadí programa, para que solo muestre niveles de criterios del programa
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
             ->whereIn('program_id', $program_ids)
659
             ->whereIn('program_id', $program_ids)
720
             ->where('criterion_objective_outcome.outcome_id', $id)
660
             ->where('criterion_objective_outcome.outcome_id', $id)
721
             ->distinct('criteria.num_scales')
661
             ->distinct('criteria.num_scales')
739
             //                 ->get();
679
             //                 ->get();
740
             $outcome_criterias = DB::table('criterion_objective_outcome')
680
             $outcome_criterias = DB::table('criterion_objective_outcome')
741
                 ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
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
                 ->where('criterion_objective_outcome.outcome_id', $id)
684
                 ->where('criterion_objective_outcome.outcome_id', $id)
745
                 ->where('criteria.num_scales', $level)
685
                 ->where('criteria.num_scales', $level)
746
                 ->select('criteria.id', 'criteria.name', 'criteria.deleted_at')
686
                 ->select('criteria.id', 'criteria.name', 'criteria.deleted_at')
753
                 $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");
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
                 $programs = DB::table('programs')
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
                     ->where('criterion_id', $criteria_id->id)
699
                     ->where('criterion_id', $criteria_id->id)
700
+                    ->select('programs.*')
701
+                    ->distinct()
758
                     ->lists('programs.name');
702
                     ->lists('programs.name');
759
-                Log::info($scales);
703
+                // Log::info($scales);
760
 
704
 
761
                 /* $scales =
705
                 /* $scales =
762
                     DB::select(
706
                     DB::select(

+ 9
- 9
app/controllers/ProgramsController.php View File

282
       $domains = DB::table('outcomes')
282
       $domains = DB::table('outcomes')
283
         ->join('criterion_objective_outcome as cobo', 'cobo.outcome_id', '=', 'outcomes.id')
283
         ->join('criterion_objective_outcome as cobo', 'cobo.outcome_id', '=', 'outcomes.id')
284
         ->join('criteria', 'criteria.id', '=', 'cobo.criterion_id')
284
         ->join('criteria', 'criteria.id', '=', 'cobo.criterion_id')
285
-        ->join('program_criterion', 'criteria.id', '=', 'program_criterion.criterion_id')
286
-        ->join('courses', 'courses.program_id', '=', 'program_criterion.program_id')
287
-        ->where('program_criterion.program_id', $program->id)
285
+        ->join('program_criterion_objective_outcome', 'cobo.id', '=', 'program_criterion_objective_outcome.cri_obj_out_id')
286
+        ->join('courses', 'courses.program_id', '=', 'program_criterion_objective_outcome.program_id')
287
+        ->where('program_criterion_objective_outcome.program_id', $program->id)
288
         ->select('outcomes.name', 'outcomes.activation_date')
288
         ->select('outcomes.name', 'outcomes.activation_date')
289
         ->distinct()
289
         ->distinct()
290
         ->orderBy('outcomes.name', 'asc')
290
         ->orderBy('outcomes.name', 'asc')
306
       $courses_used =  DB::table('outcomes')
306
       $courses_used =  DB::table('outcomes')
307
         ->join('criterion_objective_outcome as cobo', 'cobo.outcome_id', '=', 'outcomes.id')
307
         ->join('criterion_objective_outcome as cobo', 'cobo.outcome_id', '=', 'outcomes.id')
308
         ->join('criteria', 'criteria.id', '=', 'cobo.criterion_id')
308
         ->join('criteria', 'criteria.id', '=', 'cobo.criterion_id')
309
-        ->join('program_criterion', 'criteria.id', '=', 'program_criterion.criterion_id')
310
-        ->join('courses', 'courses.program_id', '=', 'program_criterion.program_id')
311
-        ->where('program_criterion.program_id', $program->id)
309
+        ->join('program_criterion_objective_outcome', 'cobo.id', '=', 'program_criterion_objective_outcome.cri_obj_out_id')
310
+        ->join('courses', 'courses.program_id', '=', 'program_criterion_objective_outcome.program_id')
311
+        ->where('program_criterion_objective_outcome.program_id', $program->id)
312
         ->select('courses.number', 'outcomes.name as domain_name', 'courses.code')
312
         ->select('courses.number', 'outcomes.name as domain_name', 'courses.code')
313
         ->distinct()
313
         ->distinct()
314
         ->orderBy('courses.name', 'asc')
314
         ->orderBy('courses.name', 'asc')
328
       $transformative_actions = DB::table('outcomes')
328
       $transformative_actions = DB::table('outcomes')
329
         ->join('criterion_objective_outcome as cobo', 'cobo.outcome_id', '=', 'outcomes.id')
329
         ->join('criterion_objective_outcome as cobo', 'cobo.outcome_id', '=', 'outcomes.id')
330
         ->join('criteria', 'criteria.id', '=', 'cobo.criterion_id')
330
         ->join('criteria', 'criteria.id', '=', 'cobo.criterion_id')
331
-        ->join('program_criterion', 'criteria.id', '=', 'program_criterion.criterion_id')
332
-        ->join('courses', 'courses.program_id', '=', 'program_criterion.program_id')
331
+        ->join('program_criterion_objective_outcome', 'cobo.id', '=', 'program_criterion_objective_outcome.cri_obj_out_id')
332
+        ->join('courses', 'courses.program_id', '=', 'program_criterion_objective_outcome.program_id')
333
 
333
 
334
         ->join('activities', 'activities.course_id', '=', 'courses.id')
334
         ->join('activities', 'activities.course_id', '=', 'courses.id')
335
         ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
335
         ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
336
         ->join('transformative_activity_criterion as taa', 'taa.activity_criterion_id', '=', 'activity_criterion.id')
336
         ->join('transformative_activity_criterion as taa', 'taa.activity_criterion_id', '=', 'activity_criterion.id')
337
         ->join('transformative_actions', 'transformative_actions.id', '=', 'taa.trans_action_id')
337
         ->join('transformative_actions', 'transformative_actions.id', '=', 'taa.trans_action_id')
338
-        ->where('program_criterion.program_id', $program->id)
338
+        ->where('program_criterion_objective_outcome.program_id', $program->id)
339
         ->select('transformative_actions.description', 'outcomes.name as domain_name')
339
         ->select('transformative_actions.description', 'outcomes.name as domain_name')
340
         ->distinct()
340
         ->distinct()
341
         ->orderBy('transformative_actions.description', 'asc')
341
         ->orderBy('transformative_actions.description', 'asc')

+ 25
- 4
app/controllers/TemplatesController.php View File

252
 		// 			Log::info("aqui".(count($criteria)));
252
 		// 			Log::info("aqui".(count($criteria)));
253
 		// 			Log::info(json_encode(count($criteria)));
253
 		// 			Log::info(json_encode(count($criteria)));
254
 
254
 
255
+
256
+
255
 		$templates = Template::where('school_id', '=', $school_id_user)->orWhere('school_id', '=', NULL)
257
 		$templates = Template::where('school_id', '=', $school_id_user)->orWhere('school_id', '=', NULL)
256
 			->orderBy('name', 'ASC')->get();
258
 			->orderBy('name', 'ASC')->get();
257
 		$criteria_ids = array();
259
 		$criteria_ids = array();
274
 		$templates_dentro = Template::whereNotIn('id', $templates_fuera_ids)
276
 		$templates_dentro = Template::whereNotIn('id', $templates_fuera_ids)
275
 			->orderBy('name', 'ASC')->get();
277
 			->orderBy('name', 'ASC')->get();
276
 
278
 
279
+		/*$templates_dentro = Template::join('template_criterion', 'template_criterion.template_id', '=', 'templates.id')
280
+			->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'template_criterion.criterion_id')
281
+			->where('objective_id', '<>', '0')
282
+
283
+			->where(function ($query) use ($school_id_user) {
284
+				$query->where('school_id', $school_id_user)
285
+					->orWhere('school_id', '=', NULL);
286
+			})
287
+
288
+			//			->orWhere('school_id', '=', NULL)
289
+
290
+			->orderBy('name', 'ASC')
291
+			->groupBy('templates.id')
292
+			->select("templates.*")
293
+			->get();*/
294
+
277
 		// 			if(!isset($templates_dentro))$templates_dentro=
295
 		// 			if(!isset($templates_dentro))$templates_dentro=
278
 
296
 
279
 		// 			var_dump(json_encode($templates_dentro));
297
 		// 			var_dump(json_encode($templates_dentro));
296
 				return "NO pa";
314
 				return "NO pa";
297
 			}
315
 			}
298
 
316
 
299
-			$crit->all_objectives = Objective::join("criterion_objective_outcome", 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
317
+			$crit->all_objectives = DB::table("objectives")->join("criterion_objective_outcome", 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
300
 				->where('criterion_id', $crit->id)
318
 				->where('criterion_id', $crit->id)
301
 				->select('objectives.*')
319
 				->select('objectives.*')
302
 				->groupBy('objectives.id')
320
 				->groupBy('objectives.id')
452
 				->orderBy('position', 'ASC')
470
 				->orderBy('position', 'ASC')
453
 				->get();
471
 				->get();
454
 
472
 
455
-			$temp_crit->program_ids = json_encode(DB::table('program_criterion')
456
-				->where('criterion_id', $temp_crit->id)
457
-				->lists('program_id'));
473
+			$temp_crit->program_ids = json_encode(DB::table('program_criterion_objective_outcome')
474
+				->join('criterion_objective_outcome', 'criterion_objective_outcome.id', '=', 'program_criterion_objective_outcome.cri_obj_out_id')
475
+				->where('criterion_objective_outcome.criterion_id', $temp_crit->id)
476
+				->select('program_criterion_objective_outcome.program_id')
477
+				->distinct()
478
+				->lists('program_criterion_objective_outcome.program_id'));
458
 
479
 
459
 			Log::info("ee" . json_encode($temp_crit->program_ids));
480
 			Log::info("ee" . json_encode($temp_crit->program_ids));
460
 
481
 

+ 31
- 2
app/controllers/ThreeYearPlanController.php View File

321
     $program_id = Input::get('program_id');
321
     $program_id = Input::get('program_id');
322
 
322
 
323
     // get program_id
323
     // get program_id
324
-    $user_id = auth::user()->id;
325
-    Log::info(Input::all());
324
+    //$user_id = auth::user()->id;
325
+    //Log::info(Input::all());
326
 
326
 
327
     // get typ_program_id
327
     // get typ_program_id
328
     $result = DB::table('typ_program')
328
     $result = DB::table('typ_program')
1070
       return $pdf->stream(basename($queryToPath->path_to_pdf));
1070
       return $pdf->stream(basename($queryToPath->path_to_pdf));
1071
   }
1071
   }
1072
   */
1072
   */
1073
+
1074
+  ///////////////////
1075
+  //
1076
+  //Pair everything
1077
+  //
1078
+  ////////////////////
1079
+
1080
+  public function pairEveryObjective()
1081
+  {
1082
+    Log::info(Input::all());
1083
+    $selected_objectives = Input::get('selected_objectives');
1084
+    $typ_id = Input::get('typ_id');
1085
+    $program_id = Input::get('program_id');
1086
+    for ($i = 0; $i < count($selected_objectives); $i += 3) {
1087
+      Input::replace([
1088
+        'program_id' => $program_id,
1089
+        'new_objective_id' => $selected_objectives[$i + 2],
1090
+        'outcome_id' => $selected_objectives[$i],
1091
+        'semester_id' => $selected_objectives[$i + 1],
1092
+        'typ_id' => $typ_id,
1093
+        'previous_objective_id' => 'nothing_selected'
1094
+
1095
+
1096
+      ]);
1097
+      if ($this->section2_on_change() != 'update was succes')
1098
+        return 0;
1099
+    }
1100
+    return 200;
1101
+  }
1073
 }
1102
 }

+ 2
- 2
app/models/Criterion.php View File

39
 	}
39
 	}
40
 
40
 
41
 
41
 
42
-	public function scopeFromProgram($query, $programs)
42
+	/*public function scopeFromProgram($query, $programs)
43
 	{
43
 	{
44
 
44
 
45
 		return $query->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
45
 		return $query->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
46
 			->whereIn("program_id", "programs")
46
 			->whereIn("program_id", "programs")
47
 			->select('criteria.*');
47
 			->select('criteria.*');
48
-	}
48
+	}*/
49
 
49
 
50
 	/**
50
 	/**
51
 	 * Return the program that the criterion belongs to
51
 	 * Return the program that the criterion belongs to

+ 8
- 0
app/routes.php View File

246
     Route::get("downloadThreeYearPlanPDF/{path_id}", "ThreeYearPlanController@showHTML");
246
     Route::get("downloadThreeYearPlanPDF/{path_id}", "ThreeYearPlanController@showHTML");
247
     Route::get("findHTMLlinksTYP/{path_id}", 'ThreeYearPlanController@findHTML');
247
     Route::get("findHTMLlinksTYP/{path_id}", 'ThreeYearPlanController@findHTML');
248
 
248
 
249
+    /////////////////////////////////////////
250
+    // 
251
+    //  pairing everything in three year
252
+    //
253
+    /////////////////////////////////////////
254
+
255
+
256
+    Route::post('pairEveryObjective', "ThreeYearPlanController@pairEveryObjective");
249
     //View annual plans and report
257
     //View annual plans and report
250
 
258
 
251
     Route::get('{annual_report_or_plan}/show/{program_id}', "AnnualPlansController@annualPlansShow");
259
     Route::get('{annual_report_or_plan}/show/{program_id}', "AnnualPlansController@annualPlansShow");

+ 103
- 1
app/views/global/view-three-year-plan.blade.php View File

252
                                 <div class="select-course-selection-0" style="margin-left:30px;">
252
                                 <div class="select-course-selection-0" style="margin-left:30px;">
253
                                     <div class="objective-selector-0">
253
                                     <div class="objective-selector-0">
254
                                         <label for="">OBJECTIVE TEMP</label>
254
                                         <label for="">OBJECTIVE TEMP</label>
255
-                                        <select class="select-0" name="" style="width:100%;max-width:55%;">
255
+                                        <select class="select-0"  name="" style="width:100%;max-width:55%;">
256
                                             <option class="default-option" value="nothing_selected">Select a course</option>
256
                                             <option class="default-option" value="nothing_selected">Select a course</option>
257
                                         </select>
257
                                         </select>
258
                                         <button class="btn btn-md btn-primary delete-selection-0"
258
                                         <button class="btn btn-md btn-primary delete-selection-0"
259
                                             style="margin:5px; "><span></span> X</button>
259
                                             style="margin:5px; "><span></span> X</button>
260
                                     </div>
260
                                     </div>
261
                                     <div class="clone-objective-course-select-0">
261
                                     <div class="clone-objective-course-select-0">
262
+                                        <div class = 'btn-group'>
262
                                         <button class="btn btn-md btn-secondary add-objective-course"
263
                                         <button class="btn btn-md btn-secondary add-objective-course"
263
                                             style="margin:5px;"><span class="glyphicon glyphicon-plus"></span> Choose more
264
                                             style="margin:5px;"><span class="glyphicon glyphicon-plus"></span> Choose more
264
                                             Courses</button>
265
                                             Courses</button>
266
+                                        <button class = 'btn btn-md btn-secondary copy-objective-button'  onclick="showParingObjectiveModal(this)" style="margin:5px;">Copy Courses to each Objective</button>
267
+                                        </div>
265
                                     </div>
268
                                     </div>
266
                                 </div>
269
                                 </div>
267
                             </div>
270
                             </div>
326
                 </div>
329
                 </div>
327
             </div>
330
             </div>
328
         </div>
331
         </div>
332
+        <div id="pairingModal" class="modal fade" tabindex="-1" data-criterion-id="0">
333
+            <div class="modal-dialog">
334
+                <div class="modal-content">
335
+                    <div class="modal-header" >
336
+                        <h5 class="modal-title" id = "pairingModalTitle">Would you like to pair this </h5>
337
+                        <button type="button" class="close" data-dismiss="modal">&times;</button>
338
+                    </div>
339
+                    <div class="modal-body"  id = 'pairingModalBody'>
340
+                    
341
+
342
+                    </div>
343
+                    <div class="modal-footer">
344
+                       
345
+                        <button type="button" class="btn btn-secondary" data-dismiss="modal" >cancel</button>
346
+                        <button type="button" id='pairingModalSubmitButton' class="btn btn-primary" data-dismiss="modal" onclick = 'pairEverything()' >Ok</button>
347
+                        
348
+                    </div>
349
+                </div>
350
+            </div>
351
+        </div>
329
 
352
 
330
     </div>
353
     </div>
354
+
331
     <script>
355
     <script>
356
+
357
+        function showParingObjectiveModal(button){
358
+            modal = "#pairingModal"
359
+
360
+            
361
+
362
+            select_course_selector = $(button).parent().parent().parent();
363
+            objective_selectors= select_course_selector.find("div:not([style*='display: none'])");
364
+            selects = objective_selectors.find('select');
365
+            
366
+
367
+            array_to_send = [];
368
+
369
+            var semester_id;
370
+            var outcome_id;
371
+            var objectives_ids = [];
372
+            $.each(selects, function(ind, select){
373
+                splited = $(select).val().split('-');
374
+                semester_id = splited[1];
375
+                outcome_id = splited[0];
376
+                objectives_ids.push(splited[2]);
377
+                array_to_send.push(splited);
378
+            })
379
+
380
+            whole_outcome_div = select_course_selector.parent().parent();
381
+            whole_outcome_div.children('div.semester-course-selection').each(function(ind, div){
382
+                if($(div).data('semester-id')== semester_id){
383
+                    return;
384
+                }
385
+                div_semester = $(div).data('semester-id');
386
+                $.each(objectives_ids, function(ind, obj){
387
+                    array_to_send.push([outcome_id, div_semester, obj]);
388
+                })
389
+            })
390
+
391
+            if($(button).html()=="Copy Courses to each Objective"){
392
+                $(modal+'Title').html("Would you like to pair these Courses to each Objective in this Outcome");
393
+                $(modal+'Body').html("This action will pair each Course in each Objective and each Semester of this Outcome.<br> This action is reversable")
394
+                $(modal+"SubmitButton").attr('onclick', 'pairEveryCourse(['+array_to_send.toString()+'])')
395
+            }
396
+            else{
397
+                $(modal+'Title').html("Would you like to pair these Objective to each Semester in this Outcome");
398
+                $(modal+'Body').html("This action will pair each Objective on each Semester of this Outcome.<br> This action is reversable")
399
+                $(modal+"SubmitButton").attr('onclick', 'pairEveryObjective(['+array_to_send.toString()+'])')
400
+            }
401
+
402
+            
403
+
404
+
405
+            $(modal).modal('show');
406
+
407
+        }
408
+        function pairEveryObjective(selected_objectives){
409
+
410
+            var typ_id = $('#table-cycles').data('typ-id');
411
+            $.post(
412
+                "{{URL::action('ThreeYearPlanController@pairEveryObjective')}}",
413
+                {
414
+                    selected_objectives:selected_objectives,
415
+                    typ_id: typ_id,
416
+                    program_id:{{$program_id}}
417
+                },
418
+                function(data){
419
+                    if(data ==200){
420
+                        $(".go-to-2").trigger('click');
421
+                    }
422
+                   
423
+
424
+                }
425
+            )
426
+        }
332
         $(document).ready(function() {
427
         $(document).ready(function() {
333
             // --------------------------------------------------------------------------
428
             // --------------------------------------------------------------------------
334
             // Page load
429
             // Page load
656
             window.scrollTo(0, 0);
751
             window.scrollTo(0, 0);
657
             $(".panel-body").hide();
752
             $(".panel-body").hide();
658
             $("#section2").show();
753
             $("#section2").show();
754
+            
659
         });
755
         });
660
 
756
 
661
 
757
 
716
 
812
 
717
                             var select_area = $('.semester-course-selection-0').clone(true);
813
                             var select_area = $('.semester-course-selection-0').clone(true);
718
                             select_area.attr('class', 'semester-course-selection');
814
                             select_area.attr('class', 'semester-course-selection');
815
+                            select_area.attr('data-semester-id', semester_id);
719
                             select_area.attr('style', ' ');
816
                             select_area.attr('style', ' ');
720
                             select_area.find('.semester-label-course-selection-0').html(
817
                             select_area.find('.semester-label-course-selection-0').html(
721
                                 semester_name + "'s Objectives");
818
                                 semester_name + "'s Objectives");
725
                             select_area.find('.add-objective-course').html(
822
                             select_area.find('.add-objective-course').html(
726
                                 '<span class="glyphicon glyphicon-plus"></span> Choose more Objectives'
823
                                 '<span class="glyphicon glyphicon-plus"></span> Choose more Objectives'
727
                             );
824
                             );
825
+                            select_area.find('.copy-objective-button').html('Copy Objectives to each Semester in Outcome');
826
+
728
 
827
 
729
                             if (semester.available_objectives.length != 0) {
828
                             if (semester.available_objectives.length != 0) {
730
                                 select_area.find('.objective-selector-0 label').hide();
829
                                 select_area.find('.objective-selector-0 label').hide();
811
             new_select.attr('class', 'objective-selector');
910
             new_select.attr('class', 'objective-selector');
812
             new_select.show();
911
             new_select.show();
813
             $(this).parent().before(new_select);
912
             $(this).parent().before(new_select);
913
+            //$('.selectpicker').selectpicker('refresh')
814
         });
914
         });
815
 
915
 
816
 
916
 
853
 
953
 
854
                             var select_area = $('.semester-course-selection-0').clone(true);
954
                             var select_area = $('.semester-course-selection-0').clone(true);
855
                             select_area.attr('class', 'semester-course-selection');
955
                             select_area.attr('class', 'semester-course-selection');
956
+                            select_area.attr('data-semester-id', semester_id);
856
                             select_area.attr('style', ' ');
957
                             select_area.attr('style', ' ');
857
                             select_area.find('.semester-label-course-selection-0').html(
958
                             select_area.find('.semester-label-course-selection-0').html(
858
                                 semester_name);
959
                                 semester_name);
945
                         $('.courses-section').append(area);
1046
                         $('.courses-section').append(area);
946
 
1047
 
947
                     });
1048
                     });
1049
+                    //$('.selectpicker').selectpicker('refresh');
948
                     //$('.objective-selector').children('.delete-selection-0').css("margin:5px; display:block;");
1050
                     //$('.objective-selector').children('.delete-selection-0').css("margin:5px; display:block;");
949
                 }
1051
                 }
950
             );
1052
             );