瀏覽代碼

Ultimos cambios

父節點
當前提交
b60a54cb6c

+ 239
- 98
app/controllers/CriteriaController.php 查看文件

@@ -102,20 +102,52 @@ class CriteriaController extends \BaseController
102 102
     public function fetchObjectivesForSelect()
103 103
     {
104 104
         $json = array();
105
+        $role = Auth::user()->role;
106
+        switch ($role) {
107
+            case 1:
108
+
109
+                $program_ids = DB::table('programs')->lists('id');
110
+
111
+                break;
112
+            case 2:
113
+
114
+                $program_ids = DB::table('programs')
115
+                    ->where('school_id', Auth::user()->school_id)
116
+                    ->lists('id');
117
+
118
+                break;
119
+
120
+            case 3:
121
+
122
+                $program_ids = DB::table('program_user')
123
+                    ->where('user_id', Auth::user()->id)
124
+                    ->lists('id');
105 125
 
126
+                break;
127
+        }
106 128
         $outcome_id = Input::get('outcomeID');
107 129
 
108 130
         $json = DB::table('objectives')
109 131
             ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
132
+            ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
110 133
             ->where('outcome_id', '=', $outcome_id)
134
+            ->whereIn('program_id', $program_ids)
135
+            ->select('objectives.*', 'objective_outcome.*')
136
+            ->distinct()
111 137
             ->get();
138
+        foreach ($json as $objective) {
139
+            $objective->program_ids = json_encode(DB::table('objective_program')
140
+                ->where('objective_id', $objective->objective_id)
141
+                ->lists('program_id'));
142
+        }
143
+
112 144
 
113 145
         return json_encode($json);
114 146
     }
115 147
     public function fetchCriterionWithTrashed()
116 148
     {
117 149
 
118
-        $json = array();
150
+        /* $json = array();
119 151
         $json['criteria'] = DB::table('criteria')->where('id', Input::get('id'))->get();
120 152
 
121 153
 
@@ -133,6 +165,11 @@ class CriteriaController extends \BaseController
133 165
                 ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
134 166
                 ->where('outcome_id', $id)
135 167
                 ->get();
168
+            foreach ($json['objectives_assoc'][$id] as $objective) {
169
+                $objective->program_ids = json_encode(DB::table('objective_program')
170
+                    ->where('objective_id', $objective->objective_id)
171
+                    ->lists('program_id'));
172
+            }
136 173
         }
137 174
         $json['program'] = DB::table('program_criterion')->where('criterion_id', $criteria_id)->get();
138 175
         $json['activity_criterion'] = DB::table('assessments')
@@ -159,7 +196,7 @@ class CriteriaController extends \BaseController
159 196
             $json['outcomes_assoc'][$outId] = DB::select("select name from outcomes where id = {$outId}");
160 197
             $json['objectives_assoc'][$outId] = DB::select("select objectives.id, objectives.text, outcomes.name from objectives, objective_outcome, outcomes where  objective_outcome.outcome_id ={$outId} and objective_outcome.objective_id = objectives.id and objectives.active=1 and outcomes.id = objective_outcome.outcome_id");
161 198
         }*/
162
-
199
+        $criteria_id = Input::get('id');
163 200
         $criterion =  DB::table('criteria')->where('id', Input::get('id'))->first();
164 201
         if (!$criterion) return $criterion;
165 202
         $criterion->outcomes = DB::table('criterion_objective_outcome')
@@ -179,6 +216,11 @@ class CriteriaController extends \BaseController
179 216
                 ->where('criterion_id', $criterion->id)
180 217
                 ->where('outcome_id', $outcome->id)
181 218
                 ->get();
219
+            foreach ($outcome->assoc_objectives as $objective) {
220
+                $objective->program_ids = json_encode(DB::table('objective_program')
221
+                    ->where('objective_id', $objective->objective_id)
222
+                    ->lists('program_id'));
223
+            }
182 224
         }
183 225
         $criterion->scales = DB::table('criterion_scale')
184 226
             ->join('scales', 'criterion_scale.scale_id', '=', 'scales.id')
@@ -218,20 +260,43 @@ class CriteriaController extends \BaseController
218 260
         else
219 261
             $program_id = NULL;
220 262
 
263
+        $outcomes = [];
264
+        $objectives = [];
265
+        foreach ($input['objective_id'] as $objective) {
266
+            $parentesis = array('(', ')');
267
+            $outcome_objective = str_replace($parentesis, '', $objective);
268
+            $outcomes[] = $outcome_objective[0];
269
+            $objectives[] = $outcome_objective[1];
270
+        }
271
+        $scales = [];
272
+        foreach ($input['scale_description'] as $scale) {
273
+            $existing_scale = DB::table('scales')->where('description', $scale)
274
+                ->first();
275
+            if (!$existing_scale) return true;
276
+            $scales[] = $existing_scale->id;
277
+        }
278
+
279
+
221 280
         $saved_criterion = DB::table('criteria')
222 281
             ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
223 282
             ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
283
+            ->join('criterion_scale', 'criterion_scale.criterion_id', '=', 'criteria.id')
224 284
             ->whereIn('program_id', $input['program_id'])
225
-            ->whereIn('objective_id', $input['objective_id'])
226
-            ->whereIn('outcome_id', $input['outcome_id'])
285
+            ->whereIn('objective_id', $objectives)
286
+            ->whereIn('outcome_id', $outcomes)
227 287
             ->where('name', '=', $input['name'])
228 288
             ->where('subcriteria', '=', $input['subcriteria'])
289
+            ->whereIn('scale_id', $scales)
290
+            ->where('num_scales', $input['number_of_scales'])
291
+            ->where('max_score', $input['maximum_score'])
292
+
229 293
             ->first();
230 294
 
231 295
 
232 296
 
233 297
 
234 298
 
299
+
235 300
         if ($saved_criterion)
236 301
             return false;
237 302
         else
@@ -265,9 +330,7 @@ class CriteriaController extends \BaseController
265 330
 
266 331
 
267 332
         $clean_input['objective_id'] = Input::get('objective');
268
-        //Log::info('PA los periqueros');
269
-        //Log::info(Input::get('objective'));
270
-        //Log::info($clean_input['objective_id']);
333
+
271 334
 
272 335
 
273 336
 
@@ -277,10 +340,9 @@ class CriteriaController extends \BaseController
277 340
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
278 341
         $clean_input['notes'] = trim(preg_replace('/\t+/', '', Input::get('notes')));
279 342
         $clean_input['maximum_score'] =  (int) Input::get('maximum_score');
280
-        // $clean_input['scale_title'] = Input::get('title');
343
+
281 344
         $clean_input['scale_description'] = Input::get('Scales');
282
-        // $clean_input['min_score'] = Input::get('min');
283
-        //$clean_input['max_score'] = Input::get('max');
345
+
284 346
 
285 347
         $clean_input['number_of_scales'] = sizeof($clean_input['scale_description']);
286 348
 
@@ -290,27 +352,45 @@ class CriteriaController extends \BaseController
290 352
 
291 353
     private function makeValidator($clean_input)
292 354
     {
293
-        /** Validation rules */
355
+        if (isset($clean_input['scale_description'][0])) {
356
+            $scale = $clean_input['scale_description'][0];
357
+        } else {
358
+            $scale = 0;
359
+        }
360
+        if (isset($clean_input['program_id'][0])) {
361
+            $program_id = $clean_input['program_id'][0];
362
+        } else {
363
+            $program_id = NULL;
364
+        }
365
+
366
+        if (isset($clean_input['objective_id'][0]) && $clean_input['objective_id'][0] != '0') {
367
+            $objective_id = $clean_input['objective_id'][0];
368
+            Log::info('Estamos');
369
+        } else {
370
+            $objective_id = NULL;
371
+        }
294 372
         return Validator::make(
295 373
             array(
296 374
                 'name' => $clean_input['name'],
297 375
                 'subcriteria' => $clean_input['subcriteria'],
298
-                'outcome_id' => $clean_input['outcome_id'],
376
+                // 'outcome_id' => $clean_input['outcome_id'],
299 377
                 'notes' => $clean_input['notes'],
300 378
                 'copyright' => $clean_input['copyright'],
301 379
                 'maximum_score' => $clean_input['maximum_score'],
302
-                'scales' => $clean_input['scale_description'],
303
-                'objective_id' => $clean_input['objective_id']
380
+                'scales' => $scale,
381
+                'objective_id' => $objective_id,
382
+                'program_id' => $program_id,
304 383
             ),
305 384
             array(
306 385
                 'name' => 'required|string',
307 386
                 'subcriteria' => 'string',
308
-                'outcome_id' => 'required|array',
309
-                'scales' => 'required|array',
387
+                // 'outcome_id' => 'required|array',
388
+                'scales' => 'required|string',
310 389
                 'notes' => 'string',
311 390
                 'copyright' => 'string',
312 391
                 'maximum_score' => 'required|integer',
313
-                'objective_id' => 'required|array'
392
+                'objective_id' => 'required|string',
393
+                'program_id' => 'required|integer'
314 394
             )
315 395
 
316 396
         );
@@ -324,15 +404,15 @@ class CriteriaController extends \BaseController
324 404
     public function create()
325 405
     {
326 406
         $clean_input = $this->cleanInput();
327
-        Log::info("POG???");
407
+
328 408
 
329 409
         /** Validation rules */
330
-        //$validator = $this->makeValidator($clean_input);
410
+        $validator = $this->makeValidator($clean_input);
331 411
 
332 412
         /** If validation fails */
333
-        //if ($validator->fails()) {
334
-        /** Prepare error message */
335
-        /*    $message = '<p>Error(s) creating a new Criterion:</p><ul>';
413
+        if ($validator->fails()) {
414
+            /** Prepare error message */
415
+            $message = '<p>Error(s) creating a new Criterion:</p><ul>';
336 416
 
337 417
             foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
338 418
                 $message .= $validationError;
@@ -341,7 +421,7 @@ class CriteriaController extends \BaseController
341 421
             $message .= '</ul>';
342 422
 
343 423
             /** Send error message and old data */
344
-        /* Session::flash('status', 'danger');
424
+            Session::flash('status', 'danger');
345 425
             Session::flash('message', $message);
346 426
             $role = Auth::user()['role'];
347 427
             switch ($role) {
@@ -358,7 +438,7 @@ class CriteriaController extends \BaseController
358 438
             // Check criterion uniqueness
359 439
             if (!$this->isCriterionUnique($clean_input)) {
360 440
                 /** Send error message and old data*/
361
-        /*Session::flash('status', 'danger');
441
+                Session::flash('status', 'danger');
362 442
                 Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name and associated program are the same.');
363 443
 
364 444
                 $role = Auth::user()['role'];
@@ -373,114 +453,146 @@ class CriteriaController extends \BaseController
373 453
                         return Redirect::to('program-criteria')->withInput();
374 454
                 }
375 455
             }
376
-*/
377
-        /** Instantiate new criterion */
378
-        $criterion = new Criterion;
379
-        $criterion->name = $clean_input['name'];
380
-        $criterion->subcriteria = $clean_input['subcriteria'];
381 456
 
457
+            /** Instantiate new criterion */
458
+            $criterion = new Criterion;
459
+            $criterion->name = $clean_input['name'];
460
+            $criterion->subcriteria = $clean_input['subcriteria'];
382 461
 
383
-        //gabriel añadió aqui
384 462
 
385
-        $criterion->num_scales = sizeof($clean_input['scale_description']);
386
-        $criterion->max_score = $clean_input['maximum_score'];
463
+            //gabriel añadió aqui
387 464
 
388
-        if (Input::get('copyright'))
389
-            $criterion->copyright = $clean_input['copyright'];
465
+            $criterion->num_scales = sizeof($clean_input['scale_description']);
466
+            $criterion->max_score = $clean_input['maximum_score'];
390 467
 
391
-        if (Input::get('notes'))
392
-            $criterion->notes = $clean_input['notes'];
468
+            if (Input::get('copyright'))
469
+                $criterion->copyright = $clean_input['copyright'];
393 470
 
471
+            if (Input::get('notes'))
472
+                $criterion->notes = $clean_input['notes'];
394 473
 
395 474
 
396
-        /** If criterion is saved, send success message */
397
-        if ($criterion->save()) {
398 475
 
399
-            $criterionId = $criterion->id;
400
-            $parentesis = array('(', ')');
476
+            /** If criterion is saved, send success message */
477
+            if ($criterion->save()) {
401 478
 
402
-            foreach ($clean_input['objective_id'] as $objective_id) {
479
+                $criterionId = $criterion->id;
480
+                $parentesis = array('(', ')');
403 481
 
404
-                $outcome_objective = str_replace($parentesis, '', $objective_id);
482
+                foreach ($clean_input['objective_id'] as $objective_id) {
405 483
 
406
-                $outcome_objective = explode(',', $outcome_objective);
407
-                DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$outcome_objective[1]},{$outcome_objective[0]}, {$criterionId})");
408
-            }
484
+                    $outcome_objective = str_replace($parentesis, '', $objective_id);
409 485
 
486
+                    $outcome_objective = explode(',', $outcome_objective);
487
+                    DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$outcome_objective[1]},{$outcome_objective[0]}, {$criterionId})");
488
+                }
410 489
 
411
-            for ($i = 0; $i < sizeof($clean_input['scale_description']); $i++) {
412 490
 
413
-                $existing_scale = DB::table('scales')->where('description', $clean_input['scale_description'][$i])
414
-                    ->first();
415
-                if ($existing_scale) {
416
-                    DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$existing_scale->id},{$i})");
417
-                } else {
418
-                    $scale = new Scale;
491
+                for ($i = 0; $i < sizeof($clean_input['scale_description']); $i++) {
419 492
 
420
-                    $position = $i;
421
-                    $scale->description = $clean_input['scale_description'][$i];
493
+                    $existing_scale = DB::table('scales')->where('description', $clean_input['scale_description'][$i])
494
+                        ->first();
495
+                    if ($existing_scale) {
496
+                        DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$existing_scale->id},{$i})");
497
+                    } else {
498
+                        $scale = new Scale;
422 499
 
500
+                        $position = $i;
501
+                        $scale->description = $clean_input['scale_description'][$i];
423 502
 
424
-                    if ($scale->save()) {
425
-                        DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$scale->id}, {$position})");
426
-                    } else {
427
-                        Session::flash('status', 'danger');
428
-                        Session::flash('message', '<p>Error creating the Scales</p>');
429
-                        $role = Auth::user()['role'];
430
-                        switch ($role) {
431
-                            case 1:
432
-                                return Redirect::to('criteria')->withInput();
433
-
434
-                            case 2:
435
-                                return Redirect::to('school-criteria')->withInput();
436
-
437
-                            case 3:
438
-                                return Redirect::to('program-criteria')->withInput();
503
+
504
+                        if ($scale->save()) {
505
+                            DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$scale->id}, {$position})");
506
+                        } else {
507
+                            Session::flash('status', 'danger');
508
+                            Session::flash('message', '<p>Error creating the Scales</p>');
509
+                            $role = Auth::user()['role'];
510
+                            switch ($role) {
511
+                                case 1:
512
+                                    return Redirect::to('criteria')->withInput();
513
+
514
+                                case 2:
515
+                                    return Redirect::to('school-criteria')->withInput();
516
+
517
+                                case 3:
518
+                                    return Redirect::to('program-criteria')->withInput();
519
+                            }
439 520
                         }
440 521
                     }
441 522
                 }
442
-            }
443 523
 
444
-            foreach ($clean_input['program_id'] as $program_id) {
445
-                DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
446
-            }
524
+                /* $role = Auth::user()->role;
525
+                switch ($role) {
526
+                    case 1:
527
+                        $program_ids = DB::table('criterion_objective_outcome')
528
+                            ->join('objective_program', 'criterion_objective_outcome.objective_id', '=', 'objective_program.program_id')
529
+                            ->where('criterion_id', $criterionId)
530
+                            ->select('program_id')
531
+                            ->distinct()
532
+                            ->lists('program_id');
533
+                        break;
534
+                    case 2:
535
+                        $program_ids =  DB::table('criterion_objective_outcome')
536
+                            ->join('objective_program', 'criterion_objective_outcome.objective_id', '=', 'objective_program.program_id')
537
+                            ->join('programs', 'programs.id', '=', 'objective_program.program_id')
538
+                            ->where('criterion_id', $criterionId)
539
+                            ->where('programs.school_id', Auth::user()->school_id)
540
+                            ->select('program_id')
541
+                            ->distinct()
542
+                            ->lists('program_id');
447 543
 
448
-            Session::flash('status', 'success');
449
-            Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
450
-            $role = Auth::user()['role'];
451
-            switch ($role) {
452
-                case 1:
453
-                    return Redirect::to('criteria')->withInput();
544
+                        break;
454 545
 
455
-                case 2:
456
-                    return Redirect::to('school-criteria')->withInput();
546
+                    case 3:
457 547
 
458
-                case 3:
459
-                    return Redirect::to('program-criteria')->withInput();
548
+                        $program_ids = DB::table('program_user')
549
+                            ->where('user_id', Auth::user()->id)
550
+                            ->lists('program_id');
551
+
552
+                        break;
553
+                }*/
554
+
555
+
556
+                foreach ($clean_input['program_id'] as $program_id) {
557
+                    DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
558
+                }
559
+
560
+                Session::flash('status', 'success');
561
+                Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
562
+                $role = Auth::user()['role'];
563
+                switch ($role) {
564
+                    case 1:
565
+                        return Redirect::to('criteria')->withInput();
566
+
567
+                    case 2:
568
+                        return Redirect::to('school-criteria')->withInput();
569
+
570
+                    case 3:
571
+                        return Redirect::to('program-criteria')->withInput();
572
+                }
460 573
             }
461
-        }
462 574
 
463
-        /** If saving fails, send error message and old data */
464
-        else {
465
-            Session::flash('status', 'danger');
466
-            Session::flash('message', '<p>Error creating Criterion. Please try again later.</p>');
467
-            $role = Auth::user()['role'];
468
-            switch ($role) {
469
-                case 1:
470
-                    return Redirect::to('criteria')->withInput();
575
+            /** If saving fails, send error message and old data */
576
+            else {
577
+                Session::flash('status', 'danger');
578
+                Session::flash('message', '<p>Error creating Criterion. Please try again later.</p>');
579
+                $role = Auth::user()['role'];
580
+                switch ($role) {
581
+                    case 1:
582
+                        return Redirect::to('criteria')->withInput();
471 583
 
472
-                case 2:
473
-                    return Redirect::to('school-criteria')->withInput();
584
+                    case 2:
585
+                        return Redirect::to('school-criteria')->withInput();
474 586
 
475
-                case 3:
476
-                    return Redirect::to('program-criteria')->withInput();
587
+                    case 3:
588
+                        return Redirect::to('program-criteria')->withInput();
589
+                }
477 590
             }
478 591
         }
479 592
     }
480 593
 
481 594
 
482 595
 
483
-
484 596
     public function edit()
485 597
     {
486 598
         $title = "Criteria";
@@ -696,7 +808,36 @@ class CriteriaController extends \BaseController
696 808
                             }
697 809
                         }
698 810
                     }
699
-                }
811
+                }/*
812
+                switch ($role) {
813
+                    case 1:
814
+                        $program_ids = DB::table('criterion_objective_outcome')
815
+                            ->join('objective_program', 'criterion_objective_outcome.objective_id', '=', 'objective_program.program_id')
816
+                            ->where('criterion_id', $criterionId)
817
+                            ->select('program_id')
818
+                            ->distinct()
819
+                            ->lists('program_id');
820
+                        break;
821
+                    case 2:
822
+                        $program_ids =  DB::table('criterion_objective_outcome')
823
+                            ->join('objective_program', 'criterion_objective_outcome.objective_id', '=', 'objective_program.program_id')
824
+                            ->join('programs', 'programs.id', '=', 'objective_program.program_id')
825
+                            ->where('criterion_id', $criterionId)
826
+                            ->where('programs.school_id', Auth::user()->school_id)
827
+                            ->select('program_id')
828
+                            ->distinct()
829
+                            ->lists('program_id');
830
+
831
+                        break;
832
+
833
+                    case 3:
834
+
835
+                        $program_ids = DB::table('program_user')
836
+                            ->where('user_id', Auth::user()->id)
837
+                            ->lists('program_id');
838
+
839
+                        break;
840
+                }*/
700 841
                 foreach ($clean_input['program_id'] as $program_id) {
701 842
                     DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
702 843
                 }

+ 2
- 2
app/controllers/OutcomesController.php 查看文件

@@ -424,12 +424,12 @@ class OutcomesController extends \BaseController
424 424
                         $criterion->program_ids = json_encode(DB::table('program_criterion')
425 425
                             ->where('criterion_id', $criterion->id)
426 426
                             ->lists('program_id'));
427
-                        $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
427
+                        $criterion->objectives = DB::table('criterion_objective_outcome')
428 428
                             ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
429 429
                             ->where('criterion_id', $criterion->id)
430 430
                             ->select('objectives.*')
431 431
                             ->distinct()
432
-                            ->lists('text'));
432
+                            ->lists('text');
433 433
                     }
434 434
                     return $criteria;
435 435
                     break;

+ 3
- 3
app/views/global/view-three-year-plan.blade.php 查看文件

@@ -442,9 +442,9 @@ $('.go-to-temp').on('click', function(){
442 442
           //if(typ.length>0)
443 443
           //{
444 444
           $('table').show();
445
-          $('#cycle1').html((year_start)+"-"+(year_start+1));
446
-          $('#cycle2').html((year_start+1)+"-"+(year_end-1));
447
-          $('#cycle3').html((year_end-1)+"-"+(year_end));
445
+          $('#cycle1').html((parseInt(year_start))+"-"+(parseInt(year_start)+1));
446
+          $('#cycle2').html((parseInt(year_start)+1)+"-"+(parseInt(year_end)-1));
447
+          $('#cycle3').html((parseInt(year_end)-1)+"-"+(parseInt(year_end)));
448 448
 
449 449
           $('#cycle_id').val(typ.id);
450 450
 

+ 91
- 22
app/views/local/managers/sCoords/criteria.blade.php 查看文件

@@ -28,7 +28,7 @@
28 28
                 <div id='objectiveGroupFor0' data-value = '1'>
29 29
                     <div class="form-group col-md-11">
30 30
                         <label>Associated Objectives for Outcome 1</label>
31
-                        <select id="objective_0_counter_1" name="objective[]" class="form-control selectpicker">
31
+                        <select id="objective_0_counter_1" name="objective[]" class="form-control selectpicker" onchange ="visiblePrograms('allOutcomes')">
32 32
                         </select>
33 33
 
34 34
                     </div>
@@ -56,14 +56,14 @@
56 56
                 </button>
57 57
 
58 58
                 <!-- Associated Program -->
59
-                <div class="form-group">
59
+                <div class="form-group" id = 'program-checkboxes'>
60 60
                     {{ Form::label('program_id', 'Associated Program') }}<br>
61 61
                     <br>
62 62
 
63 63
                     @foreach ($programs as $program)
64 64
 
65
-                    <input type="checkbox" id="{{ $program->name }}" name="program_id[]" value="{{$program->id}}">
66
-                    <label for="{{ $program->name }}"> {{ $program->name }} [{{ $program->school->name }}]</label><br>
65
+                    <input type="checkbox" id="program-{{ $program->id }}" name="program_id[]" value="{{$program->id}}" >
66
+                    <label for="program-{{ $program->id }}"> {{ $program->name }} [{{ $program->school->name }}]</label><br>
67 67
                     @endforeach
68 68
 
69 69
                 </div>
@@ -163,7 +163,7 @@
163 163
     <div id='assoc_objectiveGroupFor0' data-value="1">
164 164
                         <div class="form-group col-md-11">
165 165
                             <label>Associated Objectives for Outcome 1</label>
166
-                            <select id="assoc_objective_0_counter_1" name="objective[]" class="form-control selectpicker">
166
+                            <select id="assoc_objective_0_counter_1" name="objective[]" class="form-control selectpicker" onchange ="visiblePrograms('allAssocOutcomes')">
167 167
                                 <option value="0">No associated objectives</option>
168 168
                             </select>
169 169
     
@@ -184,13 +184,13 @@
184 184
                         Add another Outcome
185 185
                     </button>
186 186
                 <!-- Associated Program -->
187
-                <div class="form-group">
187
+                <div class="form-group" id = 'assoc-program-checkboxes'>
188 188
 
189 189
                     {{ Form::label('program_id2', 'Associated Program') }}<br><br>
190 190
                     @foreach ($programs as $program)
191 191
 
192
-                    <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="program_id[]" value="{{$program->id}}">
193
-                    <label for="assoc_program_id_{{ $program->id }}"> {{ $program->name }} <sub>[{{ $program->school->name }}]</sub></label><br>
192
+                    <input type="checkbox" id="assoc_program-{{ $program->id }}" name="program_id[]" value="{{$program->id}}">
193
+                    <label for="assoc_program-{{ $program->id }}"> {{ $program->name }} <sub>[{{ $program->school->name }}]</sub></label><br>
194 194
                     @endforeach
195 195
                 </div>
196 196
 
@@ -285,7 +285,68 @@ if(e.originalEvent.submitter.id != "update_the_criterion")
285 285
 e.preventDefault();
286 286
 })
287 287
 
288
+visibleProgram = {};
289
+visibleProgram["allAssocOutcomes"]= {}
290
+visibleProgram["allOutcomes"]={}
291
+function visiblePrograms(allOutcomesDiv){
292
+    $('#'+allOutcomesDiv).parent().find('input:checkbox').each(function(index){
293
+
294
+        id = $(this).attr('id');
295
+        $(this).prop( "checked", false );
296
+        program_id = $(this).val();
297
+        if(!(program_id in visibleProgram[allOutcomesDiv])){
298
+            visibleProgram[allOutcomesDiv][program_id] ={};
299
+        }
300
+        visibleProgram[allOutcomesDiv][program_id]["checkbox"] =$(this).detach();
301
+        $("label[for='"+id+"']").next('br').remove();
302
+        visibleProgram[allOutcomesDiv][program_id]["label"] =$("label[for='"+id+"']").detach();
288 303
 
304
+    })
305
+    if(allOutcomesDiv =="allOutcomes"){
306
+    $('#'+allOutcomesDiv).parent().find("select[name='objective[]']").each(function(index){
307
+        var the_programs = $(this).find(':selected').data('program-ids');
308
+        if(!the_programs) return;
309
+        
310
+        
311
+        for(index in the_programs){
312
+            program_id = the_programs[index];
313
+            
314
+            if(program_id in visibleProgram[allOutcomesDiv] && 
315
+            !($('#program-checkboxes').find('#'+visibleProgram[allOutcomesDiv][program_id]['checkbox'].attr('id')).val())){
316
+                visibleProgram[allOutcomesDiv][program_id]['checkbox'].appendTo('#program-checkboxes');
317
+                visibleProgram[allOutcomesDiv][program_id]['label'].appendTo("#program-checkboxes");
318
+                $('#program-checkboxes').append('<br>');
319
+
320
+                
321
+
322
+            }
323
+        }
324
+        
325
+    })
326
+    }
327
+    else{
328
+        $('#'+allOutcomesDiv).find("select[name='objective[]']").each(function(index){
329
+        var the_programs = $(this).find(':selected').data('program-ids');
330
+        if(!the_programs) return;
331
+        
332
+        
333
+        for(index in the_programs){
334
+            program_id = the_programs[index];
335
+            if(program_id in visibleProgram[allOutcomesDiv] && 
336
+            !($('#assoc-program-checkboxes').find('#'+visibleProgram[allOutcomesDiv][program_id]['checkbox'].attr('id')).val())){
337
+                visibleProgram[allOutcomesDiv][program_id]['checkbox'].appendTo('#assoc-program-checkboxes');
338
+                visibleProgram[allOutcomesDiv][program_id]['label'].appendTo("#assoc-program-checkboxes");
339
+                $('#assoc-program-checkboxes').append('<br>');
340
+
341
+                
342
+
343
+            }
344
+        }
345
+        
346
+    })
347
+    }
348
+
349
+}
289 350
     function addOptions(select, max, scaleDiv) {
290 351
 
291 352
         
@@ -471,7 +532,8 @@ function addOutcomeTest() {
471 532
         'class': "selectpicker form-control",
472 533
         'name': "objective[]",
473 534
         'data-live-search': 'true',
474
-        'id': 'objective_'+counter +'_counter_1'  
535
+        'id': 'objective_'+counter +'_counter_1' ,
536
+        'onchange': "visiblePrograms('allOutcomes')"
475 537
     });
476 538
 
477 539
     var empty_div = $('<div/>',{
@@ -538,17 +600,20 @@ function addOutcomeTest() {
538 600
 
539 601
     }
540 602
     //Delete Objective
541
-    function deleteObjective(objectiveForm, closeObj, objectiveGroup) {
603
+    function deleteObjective(objectiveForm, closeObj, objectiveGroup, allOutcomes) {
542 604
         $div = document.getElementById(objectiveForm);
543 605
         $div.remove();
544 606
         $div = document.getElementById(closeObj);
545 607
         $div.remove();
546 608
         counter = parseInt($('#'+objectiveGroup).data("value"));
547 609
         $('#'+objectiveGroup).data("value", counter-1);
610
+        visiblePrograms(allOutcomes);
548 611
 
549 612
 
550 613
     }
551 614
 
615
+    
616
+
552 617
     //Add objective when editing
553 618
 
554 619
     function addAssocObjective(objForGroup, originalObjective) {
@@ -561,6 +626,7 @@ function addOutcomeTest() {
561 626
             'name': "objective[]",
562 627
             'data-live-search': 'true',
563 628
             'id': originalObjective+'_counter_' + (assocObjectiveCounter+1).toString(),
629
+            'onchange': "visiblePrograms('allAssocOutcomes')"
564 630
 
565 631
 
566 632
         });
@@ -576,7 +642,7 @@ function addOutcomeTest() {
576 642
         var $button = $('<button/>', {
577 643
             'type': 'button',
578 644
             'class': 'btn btn-primary',
579
-            'onclick': 'deleteObjective("assoc_objectiveForm_'+objForGroup+'_' + assocObjectiveCounter.toString() + '", "assoc_closeObj_' +objForGroup+'_' + assocObjectiveCounter.toString() + '", "'+objForGroup+'")'
645
+            'onclick': 'deleteObjective("assoc_objectiveForm_'+objForGroup+'_' + assocObjectiveCounter.toString() + '", "assoc_closeObj_' +objForGroup+'_' + assocObjectiveCounter.toString() + '", "'+objForGroup+'", "allAssocOutcomes")'
580 646
         });
581 647
 
582 648
         $button.append('X');
@@ -605,7 +671,8 @@ function addOutcomeTest() {
605 671
             'class': "selectpicker form-control",
606 672
             'name': "objective[]",
607 673
             'data-live-search': 'true',
608
-            'id': originalObjective +'_counter_' + (counter+1).toString()
674
+            'id': originalObjective +'_counter_' + (counter+1).toString(),
675
+            'onchange': "visiblePrograms('allOutcomes')"
609 676
         });
610 677
         var $div = $('<div/>', {
611 678
             'id': 'objectiveForm_'+objForGroup + '_' + counter.toString(),
@@ -619,7 +686,7 @@ function addOutcomeTest() {
619 686
         var $button = $('<button/>', {
620 687
             'type': 'button',
621 688
             'class': 'btn btn-primary',
622
-            'onclick': 'deleteObjective("objectiveForm_' +objForGroup +'_' + counter.toString() + '", "closeObj_'+objForGroup+'_' + counter.toString() + '", "'+objForGroup+'")'
689
+            'onclick': 'deleteObjective("objectiveForm_' +objForGroup +'_' + counter.toString() + '", "closeObj_'+objForGroup+'_' + counter.toString() + '", "'+objForGroup+'", "allOutcomes")'
623 690
         });
624 691
 
625 692
         $button.append('X');
@@ -664,7 +731,7 @@ function addOutcomeTest() {
664 731
             'type': 'button',
665 732
             'class': 'btn btn-primary',
666 733
             'id': 'assoc_close_button'+assocOutcomeCounter,
667
-            'onclick': '$(this).parent().parent().remove()'
734
+            'onclick': '$(this).parent().parent().remove(); visiblePrograms("allAssocOutcomes")'
668 735
          });
669 736
 
670 737
         var divForGroup = $('<div/>', {
@@ -683,7 +750,8 @@ function addOutcomeTest() {
683 750
             'class': "selectpicker form-control",
684 751
             'name': "objective[]",
685 752
             'data-live-search': 'true',
686
-            'id': 'assoc_objective_'+assocOutcomeCounter +'_counter_1'  
753
+            'id': 'assoc_objective_'+assocOutcomeCounter +'_counter_1',
754
+            'onchange': "visiblePrograms('allAssocOutcomes')" 
687 755
         });
688 756
 
689 757
         var empty_div = $('<div/>',{
@@ -734,7 +802,7 @@ function addOutcomeTest() {
734 802
 
735 803
     var assocObjectiveCounter = 1;
736 804
 
737
-    function fetchAssocObjective(outcomeDiv, objectiveGroup) {
805
+/*    function fetchAssocObjective(outcomeDiv, objectiveGroup) {
738 806
         var count = $('#'+outcomeDiv).data('value');
739 807
         var allOutcomes =[];
740 808
 
@@ -792,14 +860,14 @@ function addOutcomeTest() {
792 860
                     $("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
793 861
                     $("#assoc_objective_"+i.toString()).selectpicker("refresh");
794 862
                     }
795
-                }*/
863
+                }
796 864
 
797 865
 
798 866
 
799 867
             },
800 868
             'json'
801 869
         );
802
-    }
870
+    }*/
803 871
 
804 872
     //Fetch objective at creating criteria
805 873
     counterForPost = 0;
@@ -824,7 +892,7 @@ function addOutcomeTest() {
824 892
                 optionName = '<option value ="0">Nothing Selected</option>';
825 893
                 for(index in varArray){
826 894
                     objectiveObject = varArray[index];
827
-                    optionName += '<option value ="('+objectiveObject.outcome_id+','+objectiveObject.objective_id+')">'+
895
+                    optionName += '<option data-program-ids = "'+objectiveObject.program_ids+'" value ="('+objectiveObject.outcome_id+','+objectiveObject.objective_id+')">'+
828 896
                         objectiveObject.text+'</option>';
829 897
 
830 898
                 }
@@ -1029,7 +1097,7 @@ $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible"
1029 1097
                     options = "<option value ='0'>Nothing Selected</option>";
1030 1098
                         $(first_outcome.assoc_objectives).each(function(index, objective){
1031 1099
 
1032
-                        options += '<option value ="('+first_outcome.id+','+objective.objective_id+')">'+
1100
+                        options += '<option data-program-ids = "'+objective.program_ids+'" value ="('+first_outcome.id+','+objective.objective_id+')">'+
1033 1101
                             objective.text+'</option>';
1034 1102
 
1035 1103
                         })
@@ -1120,6 +1188,7 @@ options += '<option value ="('+outcome.id+','+objective.objective_id+')">'+
1120 1188
                     }
1121 1189
 
1122 1190
                 }
1191
+                visiblePrograms('allAssocOutcomes');
1123 1192
 
1124 1193
 
1125 1194
                 //counterObj =$('#assoc_objectiveGroup').data('value');
@@ -1190,7 +1259,7 @@ options += '<option value ="('+outcome.id+','+objective.objective_id+')">'+
1190 1259
                 $('input[type=checkbox]').prop('checked', false);
1191 1260
 
1192 1261
                 for (var i = 0; i < program_length; i++) {
1193
-                    $('#assoc_program_id_' + criterion.program[i].program_id).prop("checked", true);
1262
+                    $('#assoc_program-' + criterion.program[i].program_id).prop("checked", true);
1194 1263
                 }
1195 1264
 
1196 1265
 
@@ -1220,7 +1289,7 @@ fetchCriterionForEditing();
1220 1289
 fetchObjectiveForSelect('outcome0', 'objectiveGroupFor0');
1221 1290
 // setCriterionStatus();
1222 1291
 fetchAllCriterion("select-program", "assoc_outcomes_fetch");
1223
-
1292
+visiblePrograms('allOutcomes');
1224 1293
 // --------------------------------------------------------------------------
1225 1294
 // Functions
1226 1295
 // --------------------------------------------------------------------------

+ 1
- 1
app/views/local/managers/sCoords/objectives.blade.php 查看文件

@@ -53,7 +53,7 @@
53 53
 
54 54
                     @foreach ($programs as $program)
55 55
 
56
-                    <input type="checkbox" id="{{ $program->name }}" name="program_id[]" value="{{$program->id}}">
56
+                    <input type="checkbox" id="{{ $program->name }}" name="program_id[]" value="{{$program->id}}" >
57 57
                     <label for="{{ $program->name }}"> {{ $program->name }} [{{ $program->school->name }}]</label><br>
58 58
                     @endforeach
59 59
 

+ 146
- 44
app/views/local/managers/shared/rubrics.blade.php 查看文件

@@ -315,6 +315,31 @@
315 315
         </div>
316 316
     </div>
317 317
 </div>
318
+
319
+<div class="modal fade" id="rubric-modal">
320
+    <div class="modal-dialog modal-md">
321
+      <div class="modal-content">
322
+        <div class="modal-header">
323
+          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
324
+          <h4 class="modal-title text-center" id ="modal-title-rubric">You are adding criteria to your program</h4>
325
+        </div>
326
+          <div class="modal-body" id ="modal-body-rubric">
327
+              
328
+  
329
+  
330
+ 
331
+                 
332
+                  
333
+                  
334
+          </div>
335
+        <div class="modal-footer">
336
+              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
337
+              <button type="button" class="btn btn-primary" id ="saveButton" value="Save" type="button" onclick = "saveTemplate()" >Save</button>
338
+
339
+        </div>
340
+      </div><!-- /.modal-content -->
341
+    </div><!-- /.modal-dialog -->
342
+  </div>
318 343
 <script>
319 344
 
320 345
     </script>
@@ -382,8 +407,9 @@ function fetchCriteria(outcome, objective)
382 407
             // Append criteria
383 408
             data.forEach( function (arrayItem)
384 409
             {
410
+                objectives = JSON.stringify(arrayItem.objectives);
385 411
                 $('#select-criterion')
386
-                    .append('<option data-criterion-id="'+arrayItem.id+'" data-program-ids = "'+arrayItem.program_ids+'" data-assoc-objectives = "'arrayItem.objectives'">'+arrayItem.name+'</option>');
412
+                    .append('<option data-criterion-id="'+arrayItem.id+'" data-program-ids = "'+arrayItem.program_ids+'" data-assoc-objectives= '+"'"+objectives+"'"+'>'+arrayItem.name+'</option>');
387 413
             });
388 414
 
389 415
             // If there are no criteria assigned to the selected outcome, disable the
@@ -423,7 +449,8 @@ function addCriterion()
423 449
 
424 450
     // Get the selected criterion's id
425 451
     var id= parseInt($('#select-criterion').find(':selected').data('criterion-id'));
426
-
452
+    var program_ids = $('#select-criterion').find(':selected').data('program-ids');
453
+    var objectives = $('#select-criterion').find(':selected').data('assoc-objectives');
427 454
     // Check for duplicates
428 455
     var duplicates=false;
429 456
     numberOfScale = $('#number_of_scales').find(':selected').val();
@@ -469,7 +496,7 @@ function addCriterion()
469 496
             }
470 497
             
471 498
             
472
-            var str ='<tr data-criterion-id="'+data.criterion.id+'" data-criterion-copyright="'+copyright+'" data-criterion-notes="'+notes+'" data-outcomes = "'+data.outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
499
+            var str ='<tr data-criterion-name ="'+data.criterion.name+'" data-program-ids = "['+program_ids+']" data-assoc-objectives = '+"'"+objectives+"'"+' data-criterion-id="'+data.criterion.id+'" data-criterion-copyright="'+copyright+'" data-criterion-notes="'+notes+'" data-outcomes = "'+data.outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
473 500
 
474 501
             var subcriteria = '';
475 502
             if(data.criterion.subcriteria){
@@ -782,8 +809,9 @@ function loadTemplate()
782 809
             // Set the contents of the rubric
783 810
             var temp_criterion = data.criterion;
784 811
             for(temp_c in temp_criterion){
785
-                var str = '<tr data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
786 812
                 current_criterion = temp_criterion[temp_c]
813
+                var str = '<tr data-criterion-name = "'+current_criterion.name+'" data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
814
+                
787 815
                 var subcriteria ='';
788 816
                 if(current_criterion.subcriteria){
789 817
                     var subcriteria_array = JSON.parse(current_criterion.subcriteria);
@@ -841,7 +869,7 @@ function loadTemplate()
841 869
             contents.forEach(function (data)
842 870
             {
843 871
                 // Append the fetched data
844
-                var str ='<tr data-criterion-id="'+data.id+'" data-criterion-copyright="'+data.copyright+'" data-criterion-notes="'+data.notes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
872
+                var str ='<tr  data-criterion-id="'+data.id+'" data-criterion-copyright="'+data.copyright+'" data-criterion-notes="'+data.notes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
845 873
 
846 874
 
847 875
                 var subcriteria = '';
@@ -1170,48 +1198,12 @@ $('#button-add-criterion').on('click', function(e)
1170 1198
     //Add new criterion
1171 1199
     addCriterion();
1172 1200
 });
1173
-
1174
-// When the create or update buttons are clicked (.save)
1175
-$('.save').on('click', function(e)
1201
+function saveTemplate(button_id)
1176 1202
 {
1177 1203
     //Prevent page refresh
1178
-    e.preventDefault();
1179
-
1180
-    // Empty field validation
1181
-    var emptyFields=false;
1182
-
1183
-    $('#allCriteria').children('td').each(function()
1184
-    {
1185
-        if (($(this).text() == "" || $(this).text() == "Empty") && !($(this).hasClass('nullable')) )
1186
-        {
1187
-            emptyFields=true;
1188
-        }
1189
-    });
1190
-
1191
-
1192
-    // If any fields are empty, display error
1193
-    if(emptyFields || $.trim($('#rubric-name').val())=='')
1194
-    {
1195
-        $('#js-error-row').show();
1196
-        $('#js-error-row').find('#error-message').text('Error: Please fill all the fields. Make sure your rubric has a name and all scale scores are filled.');
1197
-        return;
1198
-    }
1199
-    else
1200
-    {
1201
-            $('#js-error-row').hide();
1202
-    }
1204
+    
1203 1205
 
1204
-    // Check whether a rubric with the written name already exists
1205
-    if($(this).attr('id')=='button-create-rubric' && nameExists())
1206
-    {
1207
-        $('#js-error-row').show();
1208
-        $('#js-error-row').find('#error-message').text('Error: A template with that name already exists.');
1209
-        return;
1210
-    }
1211
-    else
1212
-    {
1213
-            $('#js-error-row').hide();
1214
-    }
1206
+    
1215 1207
 
1216 1208
     var criterionObject = new Object();
1217 1209
     var criteriaArray = new Array();
@@ -1305,6 +1297,116 @@ $('.save').on('click', function(e)
1305 1297
         );
1306 1298
     }
1307 1299
 
1300
+}
1301
+// When the create or update buttons are clicked (.save)
1302
+$('.save').on('click', function(e)
1303
+{
1304
+    //Prevent page refresh
1305
+    e.preventDefault();
1306
+    var emptyFields=false;
1307
+
1308
+    $('#allCriteria').children('td').each(function()
1309
+    {
1310
+        if (($(this).text() == "" || $(this).text() == "Empty") && !($(this).hasClass('nullable')) )
1311
+        {
1312
+            emptyFields=true;
1313
+        }
1314
+    });
1315
+
1316
+
1317
+    // If any fields are empty, display error
1318
+    if(emptyFields || $.trim($('#rubric-name').val())=='')
1319
+    {
1320
+        $('#js-error-row').show();
1321
+        $('#js-error-row').find('#error-message').text('Error: Please fill all the fields. Make sure your rubric has a name and all scale scores are filled.');
1322
+        return;
1323
+    }
1324
+    else
1325
+    {
1326
+            $('#js-error-row').hide();
1327
+    }
1328
+
1329
+    // Check whether a rubric with the written name already exists
1330
+    if($(this).attr('id')=='button-create-rubric' && nameExists())
1331
+    {
1332
+        $('#js-error-row').show();
1333
+        $('#js-error-row').find('#error-message').text('Error: A template with that name already exists.');
1334
+        return;
1335
+    }
1336
+    else
1337
+    {
1338
+            $('#js-error-row').hide();
1339
+    }
1340
+    program_id = $('#select-program').find(':selected').data('program-id')
1341
+    if(program_id == 0){
1342
+        $('#modal-title-rubric').html("All criteria will be associated with this school's programs");
1343
+        htmlString = "<h5>The following criteria and objectives will be matched with all programs</h5>"
1344
+        htmlString += "<ol style='list-style-position: inside'>"
1345
+
1346
+        $('tbody tr').each(function( index )
1347
+        {
1348
+            objectives = $(this).data('assoc-objectives');
1349
+            objectives = objectives.split(',');
1350
+            htmlString += "<li>" +$(this).data('criterion-name');
1351
+            htmlString += "<br><h5>This criterion is associated with these objectives</h5>"
1352
+            htmlString +="<ul style='padding-left: 5%; list-style-position: inside'>"
1353
+            for(index in objectives){
1354
+                
1355
+                objective_string = objectives[index];
1356
+                htmlString +="<li>"+objective_string+"</li>";
1357
+
1358
+            }
1359
+            htmlString += "</ul>"
1360
+           
1361
+            htmlString +="</li>" 
1362
+            htmlString+= "<br>";
1363
+        });
1364
+        htmlString +='</ol>';
1365
+        $("#modal-body-rubric").html(htmlString);
1366
+
1367
+
1368
+    }
1369
+    else{
1370
+        $('#modal-title-rubric').html('Some criteria will be associated with this program');
1371
+        $('tbody tr').each(function( index )
1372
+        {
1373
+            htmlString = '';
1374
+            
1375
+            program_ids = $(this).data('program-ids')
1376
+            if(!program_ids.includes(program_id) ){
1377
+                title = "<h6>The following criteria and objectives will be matched with this program</h6>"
1378
+                htmlString += "<ol style='list-style-position: inside'>"
1379
+        
1380
+                objectives = $(this).data('assoc-objectives');
1381
+            objectives = objectives.split(',');
1382
+            htmlString += "<li>" +$(this).data('criterion-name');
1383
+            htmlString += "<br><h6>This criterion is associated with these objectives</h6>"
1384
+            htmlString +="<ul style='padding-left: 5%; list-style-position: inside'>"
1385
+            for(index in objectives){
1386
+                
1387
+                objective_string = objectives[index];
1388
+                htmlString +="<li>"+objective_string+"</li>";
1389
+
1390
+            }
1391
+            htmlString += "</ul>"
1392
+           
1393
+            htmlString +="</li>" 
1394
+            htmlString+= "<br>";
1395
+
1396
+            }
1397
+            if(htmlString != ''){
1398
+                $("#modal-body-rubric").html(title);
1399
+
1400
+                $("#modal-body-rubric").append(htmlString);
1401
+
1402
+            }
1403
+        });
1404
+    }
1405
+    
1406
+    $('#rubric-modal').modal('toggle');
1407
+    $('#saveButton').attr('onclick','saveTemplate("'+$(this).attr('id')+'")')
1408
+
1409
+
1308 1410
 });
1309 1411
 
1310 1412
 // When the confirm  delete button is clicked