Browse Source

Merge branch 'merge-oniel-gabriel' into merge-oniel-g-c

onielm 3 years ago
parent
commit
e87a9b957c

+ 51
- 17
app/controllers/CriteriaController.php View File

@@ -87,17 +87,17 @@ class CriteriaController extends \BaseController
87 87
 
88 88
     public function delete()
89 89
     {
90
-        DB::delete("delete from new_criteria where id = ?", array(Input::get('id')));
90
+        DB::delete("delete from new_criteria where id = ?", array(Input::get('criterion_delete')));
91 91
         $role = Auth::user()['role'];
92 92
         switch ($role) {
93 93
             case 1:
94
-                return Redirect::to('objective')->withInput();
94
+                return Redirect::to('criteria')->withInput();
95 95
 
96 96
             case 2:
97
-                return Redirect::to('school-objective')->withInput();
97
+                return Redirect::to('school-criteria')->withInput();
98 98
 
99 99
             case 3:
100
-                return Redirect::to('program-objective')->withInput();
100
+                return Redirect::to('program-criteria')->withInput();
101 101
         }
102 102
     }
103 103
     public function isCriterionUnique($input, $existing_criterion = NULL)
@@ -225,13 +225,13 @@ class CriteriaController extends \BaseController
225 225
             $role = Auth::user()['role'];
226 226
             switch ($role) {
227 227
                 case 1:
228
-                    return Redirect::to('objective')->withInput();
228
+                    return Redirect::to('criteria')->withInput();
229 229
 
230 230
                 case 2:
231
-                    return Redirect::to('school-objective')->withInput();
231
+                    return Redirect::to('school-criteria')->withInput();
232 232
 
233 233
                 case 3:
234
-                    return Redirect::to('program-objective')->withInput();
234
+                    return Redirect::to('program-criteria')->withInput();
235 235
             }
236 236
         } else {
237 237
             // Check criterion uniqueness
@@ -288,13 +288,13 @@ class CriteriaController extends \BaseController
288 288
                         $role = Auth::user()['role'];
289 289
                         switch ($role) {
290 290
                             case 1:
291
-                                return Redirect::to('objective')->withInput();
291
+                                return Redirect::to('criteria')->withInput();
292 292
 
293 293
                             case 2:
294
-                                return Redirect::to('school-objective')->withInput();
294
+                                return Redirect::to('school-criteria')->withInput();
295 295
 
296 296
                             case 3:
297
-                                return Redirect::to('program-objective')->withInput();
297
+                                return Redirect::to('program-criteria')->withInput();
298 298
                         }
299 299
                     }
300 300
                 }
@@ -308,13 +308,13 @@ class CriteriaController extends \BaseController
308 308
                 $role = Auth::user()['role'];
309 309
                 switch ($role) {
310 310
                     case 1:
311
-                        return Redirect::to('objective')->withInput();
311
+                        return Redirect::to('criteria')->withInput();
312 312
 
313 313
                     case 2:
314
-                        return Redirect::to('school-objective')->withInput();
314
+                        return Redirect::to('school-criteria')->withInput();
315 315
 
316 316
                     case 3:
317
-                        return Redirect::to('program-objective')->withInput();
317
+                        return Redirect::to('program-criteria')->withInput();
318 318
                 }
319 319
             }
320 320
 
@@ -325,13 +325,13 @@ class CriteriaController extends \BaseController
325 325
                 $role = Auth::user()['role'];
326 326
                 switch ($role) {
327 327
                     case 1:
328
-                        return Redirect::to('objective')->withInput();
328
+                        return Redirect::to('criteria')->withInput();
329 329
 
330 330
                     case 2:
331
-                        return Redirect::to('school-objective')->withInput();
331
+                        return Redirect::to('school-criteria')->withInput();
332 332
 
333 333
                     case 3:
334
-                        return Redirect::to('program-objective')->withInput();
334
+                        return Redirect::to('program-criteria')->withInput();
335 335
                 }
336 336
             }
337 337
         }
@@ -550,13 +550,47 @@ class CriteriaController extends \BaseController
550 550
             }
551 551
         }
552 552
     }
553
+    // copie index() y lo edite
554
+    public function objectivesIndex()
555
+    {
556
+        if (Auth::user()->role == 1) {
557
+            //uscar todos los objetivos
558
+            $objectives = DB::table('program_user')
559
+                ->join('objectives', 'objectives.program_id', '=', 'program_user.program_id')
560
+                ->join('programs', 'programs.id', '=', 'program_user.program_id')
561
+                ->select('objectives.id', 'objectives.text', 'programs.name')
562
+                ->orderBy('objectives.text', 'asc')
563
+                ->get();
564
+        } elseif (Auth::user()->role == 2) {
565
+            //buscar los objetivos de la departamento (school)
566
+            $objectives = DB::table('program_user')
567
+                ->join('objectives', 'objectives.program_id', '=', 'program_user.program_id')
568
+                ->join('programs', 'programs.id', '=', 'program_user.program_id')
569
+                ->where('programs.school_id', Auth::user()->school_id)
570
+                ->select('objectives.id', 'objectives.text', 'programs.name')
571
+                ->orderBy('objectives.text', 'asc')
572
+                ->get();
573
+        } elseif ((Auth::user()->role == 3) || (Auth::user()->role == 4)) {
574
+            //buscar los objetivos de los programas cuales el profesor esta
575
+            $objectives = DB::table('program_user')
576
+                ->join('objectives', 'objectives.program_id', '=', 'program_user.program_id')
577
+                ->join('programs', 'programs.id', '=', 'program_user.program_id')
578
+                ->where('program_user.user_id', Auth::user()->id)
579
+                ->select('objectives.id', 'objectives.text', 'programs.name')
580
+                ->orderBy('objectives.text', 'asc')
581
+                ->get();
582
+        }
583
+
584
+        $title = "Learning Objectives and Criteria";
553 585
 
586
+        return View::make('global.view-objectives-criteria', compact('title', 'objectives'));
587
+    }
554 588
     public function index()
555 589
     {
556 590
         // el ID de los semestres que el usuario tiene seleccionado.
557 591
         $semesters_ids = Session::get('semesters_ids');
558 592
         // buscar informacion de los semestres seleccionados
559
-        $semesters = Semester::whereIn('id',$semesters_ids)->get();
593
+        $semesters = Semester::whereIn('id', $semesters_ids)->get();
560 594
 
561 595
         $title = "Learning Outcomes and Criteria";
562 596
         $outcomes = Outcome::orderBy('name', 'ASC')->get();

+ 42
- 14
app/controllers/Objective2Controller.php View File

@@ -70,7 +70,7 @@ class Objective2Controller extends \BaseController
70 70
 				'text' => 'required|string',
71 71
 
72 72
 				'outcome_id' => 'required|array',
73
-				'program_id' => 'required|numeric|integer'
73
+				'program_id' => 'required|array'
74 74
 
75 75
 			)
76 76
 
@@ -92,7 +92,7 @@ class Objective2Controller extends \BaseController
92 92
 			$clean_input['outcome_id'][$i] = trim(preg_replace('/\t+/', '', $clean_input['outcome_id'][$i]));
93 93
 		}
94 94
 
95
-		$clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
95
+		$clean_input['program_id'] = Input::get('program_id');
96 96
 
97 97
 
98 98
 		return $clean_input;
@@ -109,7 +109,7 @@ class Objective2Controller extends \BaseController
109 109
 
110 110
 
111 111
 
112
-		$clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
112
+		$clean_input['program_id'] = Input::get('program_id');
113 113
 
114 114
 
115 115
 		return $clean_input;
@@ -121,7 +121,37 @@ class Objective2Controller extends \BaseController
121 121
 
122 122
 	public function fetchObjectiveWithTrashed()
123 123
 	{
124
-		return json_encode(DB::select('select o.id, o.program_id, o.text, outc.outcome_id outcome_id from objectives o, objective_outcome outc where o.id = ? and o.id = outc.objective_id', array(Input::get('id'))));
124
+		$json = array();
125
+
126
+		$json['program'] = DB::select("select program_id from objective_program where objective_id = ?", array(Input::get('id')));
127
+		$json['outcome'] = DB::select("select outcome_id from objective_outcome outc where outc.objective_id = ?", array(Input::get('id')));
128
+		$json['objective'] = DB::select("select text, id from objectives where id =?", array(Input::get('id')));
129
+		$json['assessment'] = DB::select("select * from assessments where activity_id  in (select activity_id from activity_criterion where criterion_id in (select criterion_id from criterion_objective_outcome where objective_id = ?))", array(Input::get('id')));
130
+		$json['assoc_criteria'] = DB::select("select name from criteria where id in(select criterion_id from criterion_objective_outcome where objective_id =?)", array(Input::get('id')));
131
+		return json_encode($json);
132
+	}
133
+	public function fetchAllobjectives()
134
+	{
135
+		$program_id = Input::get('program_fetch');
136
+		$outcome_id = Input::get('outcome_fetch');
137
+		$json = array();
138
+		$json['objective'] = DB::select("SELECT * FROM `objectives` where id in (select objective_id from criterion_objective_outcome where outcome_id ={$outcome_id}) and id in(select objective_id from objective_program where program_id = {$program_id})");
139
+		return json_encode($json);
140
+	}
141
+	public function delete()
142
+	{
143
+		DB::delete("delete from objectives where id = ?", array(Input::get('deleteObj')));
144
+		$role = Auth::user()['role'];
145
+		switch ($role) {
146
+			case 1:
147
+				return Redirect::to('objectives')->withInput();
148
+
149
+			case 2:
150
+				return Redirect::to('school-objectives')->withInput();
151
+
152
+			case 3:
153
+				return Redirect::to('program-objectives')->withInput();
154
+		}
125 155
 	}
126 156
 	/**
127 157
 	 * Create a new Objective.
@@ -187,16 +217,15 @@ class Objective2Controller extends \BaseController
187 217
 
188 218
 
189 219
 
190
-			// Set program
191
-			if (Input::get('program_id') != 0)
192
-				$objective->program_id = $clean_input['program_id'];
193
-			else
194
-				$objective->program_id = NULL;
220
+
195 221
 
196 222
 
197 223
 			/** If Objective is saved, send success message */
198 224
 			if ($objective->save()) {
199 225
 				$objectiveId = $objective->id;
226
+				foreach ($clean_input['program_id'] as $program_id) {
227
+					DB::insert("insert into objective_program (objective_id, program_id) values({$objectiveId},{$program_id})");
228
+				}
200 229
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
201 230
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
202 231
 
@@ -369,11 +398,6 @@ class Objective2Controller extends \BaseController
369 398
 
370 399
 
371 400
 
372
-			// Set program
373
-			if (Input::get('program_id') != 0)
374
-				$Objective->program_id = Input::get('program_id');
375
-			else
376
-				$Objective->program_id = NULL;
377 401
 
378 402
 			// Set status
379 403
 
@@ -383,7 +407,11 @@ class Objective2Controller extends \BaseController
383 407
 
384 408
 				$objectiveId = $Objective->id;
385 409
 				DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
410
+				DB::delete("delete from objective_program where objective_id = {$objectiveId}");
386 411
 
412
+				foreach ($clean_input['program_id'] as $program_id) {
413
+					DB::insert("insert into `objective_program`(objective_id, program_id) values ({$objectiveId},{$program_id})");
414
+				}
387 415
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
388 416
 					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
389 417
 				}

+ 44
- 0
app/database/migrations/2018_08_28_140328_remove_outcome_id_from_objectives_table.php View File

@@ -0,0 +1,44 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class RemoveOutcomeIdFromObjectivesTable extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		//Schema::table('objectives', function(Blueprint $table)
17
+		//{
18
+		//    $table->dropForeign('objectives_outcome_id_foreign');
19
+		//	$table->dropColumn('outcome_id');
20
+		//});
21
+	}
22
+
23
+
24
+	/**
25
+	 * Reverse the migrations.
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function down()
30
+	{
31
+		Schema::table('objectives', function (Blueprint $table) {
32
+			$table
33
+				->integer('outcome_id')
34
+				->after('id')
35
+				->unsigned();
36
+			$table
37
+				->foreign('outcome_id')
38
+				->references('id')
39
+				->on('outcomes')
40
+				->onDelete('cascade')
41
+				->onUpdate('cascade');
42
+		});
43
+	}
44
+}

+ 38
- 0
app/database/migrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php View File

@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+
6
+class AddOutcomeIdToObjectivesTable extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		//Schema::table('objectives', function(Blueprint $table)
17
+		//{
18
+		//	$table->integer('outcome_id')->unsigned();
19
+
20
+		//	$table->foreign('outcome_id')->references('id')->on('outcomes')->onDelete('cascade')->onUpdate('cascade');
21
+		//});
22
+	}
23
+
24
+
25
+	/**
26
+	 * Reverse the migrations.
27
+	 *
28
+	 * @return void
29
+	 */
30
+	public function down()
31
+	{
32
+		Schema::table('objectives', function (Blueprint $table) {
33
+			$table->dropForeign('objectives_outcome_id_foreign');
34
+
35
+			$table->dropColumn('outcome_id');
36
+		});
37
+	}
38
+}

+ 47
- 0
app/database/migrations/2021_01_28_160558_ObjectiveProgramMigrate.php View File

@@ -0,0 +1,47 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class ObjectiveProgramMigrate extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::create('objective_program', function (Blueprint $table) {
17
+			$table->increments('id');
18
+			$table->integer('program_id')->unsigned();
19
+			$table->integer('objective_id')->unsigned();
20
+
21
+
22
+			$table
23
+				->foreign('objective_id')
24
+				->references('id')
25
+				->on('objectives')
26
+				->onDelete('cascade')
27
+				->onUpdate('cascade');
28
+			$table
29
+				->foreign('program_id')
30
+				->references('id')
31
+				->on('programs')
32
+				->onDelete('cascade')
33
+				->onUpdate('cascade');
34
+			$table->timestamps();
35
+		});
36
+	}
37
+
38
+	/**
39
+	 * Reverse the migrations.
40
+	 *
41
+	 * @return void
42
+	 */
43
+	public function down()
44
+	{
45
+		Schema::drop('objective_program');
46
+	}
47
+}

+ 33
- 0
app/database/migrations/2021_01_28_174905_fixObjectivesTable.php View File

@@ -0,0 +1,33 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class FixObjectivesTable extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::table('objectives', function (Blueprint $table) {
17
+
18
+			//$table->dropForeign('objectives_program_id_foreign');
19
+			//$table->dropColumn('program_id');
20
+			//$table->dropColumn('outcome_id');
21
+		});
22
+	}
23
+
24
+	/**
25
+	 * Reverse the migrations.
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function down()
30
+	{
31
+		//
32
+	}
33
+}

+ 2
- 2
app/filters.php View File

@@ -198,9 +198,9 @@ Route::filter('prof', function () {
198 198
 |
199 199
 | The CSRF filter is responsible for protecting your application against
200 200
 | cross-site request forgery attacks. If this special token in a user
201
-| session does not match the one given in this request, we'll bail.
201
+| session does not match the one given in this request, we'll bail
202 202
 |
203
-*/
203
+ */
204 204
 
205 205
 Route::filter('csrf', function () {
206 206
 	$token = Request::ajax() ? Request::header('X-CSRF-Token') : Input::get('_token');

+ 9
- 4
app/routes.php View File

@@ -252,8 +252,11 @@ Route::group(array('before' => 'auth|has_access'), function () {
252 252
         Route::post('createCriterion', array('before' => 'csrf', 'uses' => 'CriteriaController@create'));
253 253
 
254 254
         Route::get('learning-outcomes', 'OutcomesController@index');
255
+        Route::post('fetchObjectives', 'Objective2Controller@fetchAllObjectives');
255 256
         // TODO: Change later
256 257
         Route::get('new-learning-outcomes', 'OutcomesController@newIndex');
258
+
259
+        Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@updateMore'));
257 260
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@update'));
258 261
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@updateMore'));
259 262
         Route::post('crtiteria/update', array('before' => 'csrf', 'uses'=> 'CriteriaController@update'));
@@ -264,9 +267,11 @@ Route::group(array('before' => 'auth|has_access'), function () {
264 267
         Route::post('administrator/updateAccess', array('before' => 'csrf', 'uses' => 'UsersController@updateAccess'));
265 268
         Route::post('administrator/users/store', array('before' => 'csrf', 'uses' => 'UsersController@store'));
266 269
 
267
-
270
+        Route::get('criteria', array('uses' => 'CriteriaController@edit'));
271
+        Route::get('objectives', array('uses' => 'Objective2Controller@edit'));
268 272
         Route::get('administrator/semesters', 'SemestersController@edit');
269 273
         Route::post('administrator/semesters/update', 'SemestersController@update');
274
+        Route::post('deleteObjective', 'Objective2Controller@delete');
270 275
 
271 276
         Route::get('assessment-report/{outcome_id}', 'OutcomesController@assessmentReport');
272 277
         // TODO: Change later
@@ -292,7 +297,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
292 297
         Route::post('programs/report', 'ProgramsController@showReport');
293 298
         Route::get('programs', 'ProgramsController@index');
294 299
         Route::get('template-list', 'TemplatesController@schoolCoordinatorIndex');
295
-
300
+        Route::post('deleteObjective', 'Objective2Controller@delete');
296 301
         // Print school report
297 302
         Route::get('print_school/{id}', 'SchoolsController@print_school');
298 303
 
@@ -310,7 +315,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
310 315
      */
311 316
     Route::group(array('before' => 'pcoord'), function () {
312 317
         Route::get('program-coordinator', 'ProgramCoordinatorsController@overview');
313
-
318
+        Route::post('deleteObjective', 'Objective2Controller@delete');
314 319
         Route::get('rubrics', 'TemplatesController@newTemplate');
315 320
         Route::post('saveTemplate', array('before' => 'csrf', 'uses' => 'TemplatesController@create'));
316 321
         Route::post('updateTemplate', array('before' => 'csrf', 'uses' => 'TemplatesController@update'));
@@ -410,7 +415,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
410 415
         Route::get('learning-outcomes-criteria', 'CriteriaController@index');
411 416
         Route::get('learning-objectives-criteria', 'CriteriaController@objectivesIndex');
412 417
         Route::get('export_grades/{id}', 'CoursesController@exportGrades');
413
-
418
+        Route::get('learning-objectives-criteria', 'CriteriaController@objectivesIndex');
414 419
         // Assessment reports
415 420
         Route::get('professor-assessment-report/{outcome_id}', 'OutcomesController@professorAssessmentReport');
416 421
         Route::get('professor-assessment-reports', 'OutcomesController@professorAssessmentReports');

+ 1
- 1
app/views/local/managers/admins/_navigation.blade.php View File

@@ -84,4 +84,4 @@
84 84
     </li>
85 85
     </ul>
86 86
   </div>
87
-</div>
87
+</div>

+ 7
- 5
app/views/local/managers/admins/criteria.blade.php View File

@@ -232,13 +232,14 @@
232 232
                     {{ Form::label('notes', 'Additional Notes') }}
233 233
                     {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
234 234
                 </div>
235
-                <div id='delete'>
236 235
 
237
-                </div>
236
+
238 237
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
239 238
                 {{ Form::close() }}
240 239
 
241
-
240
+                {{ Form::open(array('action' => 'CriteriaController@delete')) }}
241
+                <input type='hidden' name='criterion_delete' id='deleteCriteria'>
242
+                {{Form::submit("Delete", array('class'=> 'btn btn-primary btn-block', 'id'=>"DeleteButton"))}}
242 243
             </div>
243 244
         </div>
244 245
     </div>
@@ -718,9 +719,10 @@
718 719
 
719 720
                 if (!(json.activity_criterion.length)) {
720 721
 
721
-                    var button = "<button type='button' class ='btn btn-primary btn-block' onclick ='deleteCriterion()'>Delete Criterion</button><br><br>"
722
-                    $('#delete').html(button)
722
+                    $('#DeleteButton').prop('enabled', true);
723 723
 
724
+                } else {
725
+                    $('#DeleteButton').prop('disabled', true);
724 726
                 }
725 727
 
726 728
                 if (!(json.criteria.length)) {

+ 148
- 39
app/views/local/managers/admins/objectives.blade.php View File

@@ -35,14 +35,16 @@
35 35
                 <!-- Associated Program -->
36 36
 
37 37
 
38
+                <!-- Associated Program -->
38 39
                 <div class="form-group">
39
-                    {{ Form::label('program_id', 'Associated Program') }}
40
-                    <select id="program_id" name="program_id" class="form-control selectpicker">
41
-                        <option value="0">All</option>
42
-                        @foreach ($programs as $program)
43
-                        <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
44
-                        @endforeach
45
-                    </select>
40
+                    {{ Form::label('program_id', 'Associated Program') }}<br>
41
+                    <br>
42
+
43
+                    @foreach ($programs as $program)
44
+
45
+                    <input type="checkbox" id="{{ $program->name }}" name="program_id[]" value="{{$program->id}}">
46
+                    <label for="{{ $program->name }}"> {{ $program->name }} [{{ $program->school->name }}]</label><br>
47
+                    @endforeach
46 48
                 </div>
47 49
 
48 50
 
@@ -65,8 +67,21 @@
65 67
                 Edit
66 68
             </div>
67 69
             <div class="panel-body">
70
+
68 71
                 {{ Form::open(array('action' => 'Objective2Controller@update')) }}
72
+                <div class="form-group">
73
+                    {{ Form::label('program_id2', 'Associated Program')}}
74
+                    <select id='select-program' class="form-control selectpicker" onchange='fetchAllObjectives("select-program", "assoc_outcomes_fetch")'>
75
+                        @foreach ($programs as $program)
76
+                        <option value='{{$program->id}}' data-subtext="{{$program->code}}">{{$program->name}}</option>
77
+                        @endforeach
78
+                    </select>
79
+                </div>
80
+                <div class="form-group">
81
+                    <label>Associated Outcome</label>
82
+                    {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) }}
69 83
 
84
+                </div>
70 85
                 <div class="form-group">
71 86
                     {{ Form::label('objective_id', 'Objectives') }}
72 87
                     <select id="select-objective" name="id" class="form-control selectpicker">
@@ -104,16 +119,18 @@
104 119
 
105 120
 
106 121
                 <!-- Associated Program -->
122
+                <!-- Associated Program -->
107 123
                 <div class="form-group">
108
-                    {{ Form::label('program_id2', 'Associated Program') }}
109
-                    <select id="program_id2" name="program_id" class="form-control selectpicker">
110
-                        <option value="0">All</option>
111
-                        @foreach ($programs as $program)
112
-                        <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
113
-                        @endforeach
114
-                    </select>
124
+
125
+                    {{ Form::label('program_id2', 'Associated Program') }}<br><br>
126
+                    @foreach ($programs as $program)
127
+
128
+                    <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="program_id[]" value="{{$program->id}}">
129
+                    <label for="assoc_program_id_{{ $program->id }}"> {{ $program->name }} <sub>[{{ $program->school->name }}]</sub></label><br>
130
+                    @endforeach
115 131
                 </div>
116 132
 
133
+
117 134
                 <!-- Status -->
118 135
                 <div class="form-group">
119 136
                     {{ Form::label('status', 'Status') }}
@@ -125,12 +142,20 @@
125 142
                     </select>
126 143
                 </div>
127 144
 
145
+
128 146
                 <div class="form-group">
129 147
                     {{ Form::label('text', 'Text') }}
130 148
                     {{ Form::text('text', Input::old('text'), array('class' => 'form-control', 'id'=>'objective-text')) }}
131 149
                 </div>
150
+                <div id="text">
151
+
152
+                </div>
153
+
132 154
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
133 155
                 {{ Form::close() }}
156
+                <form action="/deleteObjective" method="POST" id='deleteObj'>
157
+
158
+                </form>
134 159
             </div>
135 160
 
136 161
 
@@ -142,7 +167,30 @@
142 167
 <script>
143 168
     var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
144 169
     var selectOptions = document.getElementById('outcome[0]').innerHTML;
145
-    var ran = false;
170
+    fetchAllObjectives("select-program", "assoc_outcomes_fetch")
171
+
172
+    function fetchAllObjectives(program, outcome) {
173
+        var program_id_fetch = $('#' + program).find(':selected').val();
174
+        var outcome_fetch = $('#' + outcome).find(':selected').val();
175
+        $.post(
176
+            "{{URL::action('Objective2Controller@fetchAllObjectives')}}", {
177
+                program_fetch: program_id_fetch,
178
+                outcome_fetch: outcome_fetch
179
+            },
180
+            function(json) {
181
+                json_length = (json.objective.length);
182
+                fullHTML = '';
183
+                for (var i = 0; i < json_length; i++) {
184
+                    fullHTML += '<option value="' + json.objective[i].id + '">' + json.objective[i].text + '</option>';
185
+                }
186
+                $('#select-objective').html(fullHTML);
187
+                $('#select-objective').selectpicker('refresh');
188
+                fetchObjectiveForEditing();
189
+
190
+            },
191
+            'json'
192
+        );
193
+    }
146 194
 
147 195
     var counter = 1;
148 196
     var counterAssoc = 1;
@@ -168,6 +216,8 @@
168 216
         document.getElementById("outcomeGroup").innerHTML += outcomeHTML;
169 217
     }
170 218
 
219
+
220
+
171 221
     function addOutcomeTest() {
172 222
         var $select = $('<select/>', {
173 223
             'class': "selectpicker form-control",
@@ -221,8 +271,7 @@
221 271
             },
222 272
             function(json) {
223 273
 
224
-                var text = json[0].text;
225
-
274
+                var text = json.objective[0].text;
226 275
 
227 276
 
228 277
                 // Display info
@@ -230,19 +279,15 @@
230 279
 
231 280
 
232 281
                 // Select associated outcome
233
-                var outcome_id = json[0].outcome_id;
234
-                $('#assoc_outcome0').val(outcome_id);
235
-                $('#assoc_outcome0').selectpicker('refresh');
236
-
237
-                var length = json.length;
238
-                if (ran == true) {
239
-                    for (var i = counterAssoc; i != 0; i--) {
240
-                        deleteLastAssoc(i);
282
+                for (var i = counterAssoc; i != 1; i--) {
283
+                    deleteLastAssoc(i);
241 284
 
242
-                    }
243
-                    counterAssoc = 1
244 285
                 }
245
-                for (var i = 1; i < length; i++) {
286
+                $('#assoc_outcome0').val(json.outcome[0].outcome_id);
287
+                $('#assoc_outcome0').selectpicker('refresh');
288
+                counterAssoc = 1;
289
+                for (var i = 1; i < json.outcome.length; i++) {
290
+                    counterAssoc = i + 1;
246 291
                     var $select = $('<select />', {
247 292
                         'class': "selectpicker form-control",
248 293
                         'name': "assoc_outcome[]",
@@ -273,30 +318,94 @@
273 318
                     $select.appendTo('#assocOutcomeForm' + i.toString()).selectpicker('refresh');
274 319
                     $divForButton.appendTo('#assocOutcomeGroup');
275 320
 
276
-                    $('#assoc_outcome' + i.toString()).val(json[i].outcome_id);
321
+                    $('#assoc_outcome' + i.toString()).val(json.outcome[i].outcome_id);
277 322
                     $('#assoc_outcome' + i.toString()).selectpicker('refresh');
278 323
 
279
-                    counterAssoc = i;
280
-                    ran = true;
281 324
 
282 325
                 }
283 326
 
327
+
284 328
                 // Select associated program
285
-                if (json[0].program_id) {
286
-                    $('#program_id2').val(json[0].program_id);
329
+                var program_length = json.program.length;
330
+                $('input[type=checkbox]').prop('checked', false);
287 331
 
288
-                } else {
289
-                    $('#program_id2').val(0);
332
+                for (var i = 0; i < program_length; i++) {
333
+                    prog = json.program[i].program_id.toString();
334
+                    $('#assoc_program_id_' + prog).prop("checked", true);
290 335
                 }
291 336
 
292
-                $('#program_id2').selectpicker('refresh');
293
-
294 337
 
295 338
                 // Select status
296
-                if (json[0].deleted_at)
339
+                if (json.objective[0].deleted_at)
297 340
                     $('#status').val(0);
298 341
                 else
299 342
                     $('#status').val(1);
343
+                if (json.assessment.length) {
344
+                    $('#deleteObj').html("<p>This objective is currently participating in an assessment, therefore it cannot be deleted</p>");
345
+                } else if (json.assoc_criteria.length) {
346
+                    modal = '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
347
+                        'Delete' +
348
+                        '</button>' +
349
+                        '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
350
+
351
+                        '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
352
+                        '<div class="modal-dialog" role="document">' +
353
+                        '<div class="modal-content">' +
354
+                        ' <div class="modal-header">' +
355
+                        '<h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>' +
356
+                        '<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
357
+                        '<span aria-hidden="true">&times;</span>' +
358
+                        '</button>' +
359
+                        ' </div>' +
360
+                        '<div class="modal-body">' +
361
+                        "<p>This objective is associated to: <p>" +
362
+                        '<ul>';
363
+                    for (var i = 0; i < json.assoc_criteria.length; i++) {
364
+                        modal += "<li>" + json.assoc_criteria[i].name + '</li>';
365
+                    }
366
+                    modal += ' </ul>' +
367
+                        '<p>Do you still want to delete it?</p>' +
368
+                        '</div>' +
369
+                        '<div class="modal-footer">' +
370
+                        '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>' +
371
+                        '<button type="submit" class="btn btn-primary">Delete</button>' +
372
+                        '</div>' +
373
+                        '</div>' +
374
+                        '</div>' +
375
+                        '</div>';
376
+                    $('#deleteObj').html(modal);
377
+
378
+
379
+                } else {
380
+                    modal = '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
381
+                        'Delete' +
382
+                        '</button>' +
383
+                        '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
384
+
385
+                        '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
386
+                        '<div class="modal-dialog" role="document">' +
387
+                        '<div class="modal-content">' +
388
+                        ' <div class="modal-header">' +
389
+                        '<h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>' +
390
+                        '<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
391
+                        '<span aria-hidden="true">&times;</span>' +
392
+                        '</button>' +
393
+                        ' </div>' +
394
+                        '<div class="modal-body">' +
395
+                        "<p> Once deleted, there is no chance of getting it back.</p>";
396
+
397
+                    modal +=
398
+                        '<p>Do you still want to delete it?</p>' +
399
+                        '</div>' +
400
+                        '<div class="modal-footer">' +
401
+                        '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>' +
402
+                        '<button type="submit" class="btn btn-primary">Delete</button>' +
403
+                        '</div>' +
404
+                        '</div>' +
405
+                        '</div>' +
406
+                        '</div>';
407
+                    $('#deleteObj').html(modal);
408
+                }
300 409
             },
301 410
             'json'
302 411
         );
@@ -346,7 +455,7 @@
346 455
         $divForButton.appendTo('#assocOutcomeGroup');
347 456
 
348 457
 
349
-        ran = true;
458
+
350 459
         counterAssoc += 1;
351 460
 
352 461
 

+ 97
- 34
app/views/local/managers/pCoords/objectives.blade.php View File

@@ -36,15 +36,17 @@
36 36
 
37 37
 
38 38
                 <div class="form-group">
39
-                    {{ Form::label('program_id', 'Associated Program') }}
40
-                    <select id="program_id" name="program_id" class="form-control selectpicker">
39
+                    {{ Form::label('program_id', 'Associated Program') }}<br>
40
+                    <br>
41 41
 
42
-                        <option value="{{ $programs[0]->id }}">{{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</option>
43 42
 
44
-                    </select>
45
-                </div>
43
+
44
+                    <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
45
+                    <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
46 46
 
47 47
 
48
+                </div>
49
+
48 50
                 <div class="form-group">
49 51
                     {{ Form::label('text', 'Text') }}
50 52
                     {{ Form::text('text', '', array('class' => 'form-control')) }}
@@ -104,13 +106,15 @@
104 106
 
105 107
                 <!-- Associated Program -->
106 108
                 <div class="form-group">
107
-                    {{ Form::label('program_id2', 'Associated Program') }}
108
-                    <select id="program_id2" name="program_id" class="form-control selectpicker">
109
+                    {{ Form::label('program_id', 'Associated Program') }}<br>
110
+                    <br>
109 111
 
110 112
 
111
-                        <option value="{{ $programs[0]->id }}">{{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</option>
112 113
 
113
-                    </select>
114
+                    <input type="checkbox" id="{{ $programs[0]->name }}" id="assoc_program_id_{{$programs[0]->id}}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
115
+                    <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
116
+
117
+
114 118
                 </div>
115 119
 
116 120
                 <!-- Status -->
@@ -131,6 +135,9 @@
131 135
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
132 136
                 {{ Form::close() }}
133 137
             </div>
138
+            <div id="text">
139
+                <p>lmao</p>
140
+            </div>
134 141
 
135 142
 
136 143
 
@@ -220,8 +227,7 @@
220 227
             },
221 228
             function(json) {
222 229
 
223
-                var text = json[0].text;
224
-
230
+                var text = json.objective[0].text;
225 231
 
226 232
 
227 233
                 // Display info
@@ -229,19 +235,15 @@
229 235
 
230 236
 
231 237
                 // Select associated outcome
232
-                var outcome_id = json[0].outcome_id;
233
-                $('#assoc_outcome0').val(outcome_id);
234
-                $('#assoc_outcome0').selectpicker('refresh');
235
-
236
-                var length = json.length;
237
-                if (ran == true) {
238
-                    for (var i = counterAssoc; i != 0; i--) {
239
-                        deleteLastAssoc(i);
238
+                for (var i = counterAssoc; i != 1; i--) {
239
+                    deleteLastAssoc(i);
240 240
 
241
-                    }
242
-                    counterAssoc = 1
243 241
                 }
244
-                for (var i = 1; i < length; i++) {
242
+                $('#assoc_outcome0').val(json.outcome[0].outcome_id);
243
+                $('#assoc_outcome0').selectpicker('refresh');
244
+                counterAssoc = 1;
245
+                for (var i = 1; i < json.outcome.length; i++) {
246
+                    counterAssoc = i + 1;
245 247
                     var $select = $('<select />', {
246 248
                         'class': "selectpicker form-control",
247 249
                         'name': "assoc_outcome[]",
@@ -272,34 +274,95 @@
272 274
                     $select.appendTo('#assocOutcomeForm' + i.toString()).selectpicker('refresh');
273 275
                     $divForButton.appendTo('#assocOutcomeGroup');
274 276
 
275
-                    $('#assoc_outcome' + i.toString()).val(json[i].outcome_id);
277
+                    $('#assoc_outcome' + i.toString()).val(json.outcome[i].outcome_id);
276 278
                     $('#assoc_outcome' + i.toString()).selectpicker('refresh');
277 279
 
278
-                    counterAssoc = i;
279
-                    ran = true;
280 280
 
281 281
                 }
282 282
 
283
-                // Select associated program
284
-                if (json[0].program_id) {
285
-                    $('#program_id2').val(json[0].program_id);
286
-
287
-                } else {
288
-                    $('#program_id2').val(0);
289
-                }
290 283
 
291
-                $('#program_id2').selectpicker('refresh');
292 284
 
293 285
 
294 286
                 // Select status
295
-                if (json[0].deleted_at)
287
+                if (json.objective[0].deleted_at)
296 288
                     $('#status').val(0);
297 289
                 else
298 290
                     $('#status').val(1);
291
+
292
+                if (json.assessment.length) {
293
+                    $('#deleteObj').html("<p>This objective is currently participating in an assessment, therefore it cannot be deleted</p>");
294
+                } else if (json.assoc_criteria.length) {
295
+                    modal = '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
296
+                        'Delete' +
297
+                        '</button>' +
298
+                        '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
299
+
300
+                        '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
301
+                        '<div class="modal-dialog" role="document">' +
302
+                        '<div class="modal-content">' +
303
+                        ' <div class="modal-header">' +
304
+                        '<h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>' +
305
+                        '<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
306
+                        '<span aria-hidden="true">&times;</span>' +
307
+                        '</button>' +
308
+                        ' </div>' +
309
+                        '<div class="modal-body">' +
310
+                        "<p>This objective is associated to: <p>" +
311
+                        '<ul>';
312
+                    for (var i = 0; i < json.assoc_criteria.length; i++) {
313
+                        modal += "<li>" + json.assoc_criteria[i].name + '</li>';
314
+                    }
315
+                    modal += ' </ul>' +
316
+                        '<p>Do you still want to delete it?</p>' +
317
+                        '</div>' +
318
+                        '<div class="modal-footer">' +
319
+                        '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>' +
320
+                        '<button type="submit" class="btn btn-primary">Delete</button>' +
321
+                        '</div>' +
322
+                        '</div>' +
323
+                        '</div>' +
324
+                        '</div>';
325
+                    $('#deleteObj').html(modal);
326
+
327
+
328
+                } else {
329
+                    modal = '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
330
+                        'Delete' +
331
+                        '</button>' +
332
+                        '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
333
+
334
+                        '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
335
+                        '<div class="modal-dialog" role="document">' +
336
+                        '<div class="modal-content">' +
337
+                        ' <div class="modal-header">' +
338
+                        '<h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>' +
339
+                        '<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
340
+                        '<span aria-hidden="true">&times;</span>' +
341
+                        '</button>' +
342
+                        ' </div>' +
343
+                        '<div class="modal-body">' +
344
+                        "<p> Once deleted, there is no chance of getting it back.</p>";
345
+
346
+                    modal +=
347
+                        '<p>Do you still want to delete it?</p>' +
348
+                        '</div>' +
349
+                        '<div class="modal-footer">' +
350
+                        '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>' +
351
+                        '<button type="submit" class="btn btn-primary">Delete</button>' +
352
+                        '</div>' +
353
+                        '</div>' +
354
+                        '</div>' +
355
+                        '</div>';
356
+                    $('#deleteObj').html(modal);
357
+                }
299 358
             },
300 359
             'json'
301 360
         );
302 361
     }
362
+    },
363
+    'json'
364
+    );
365
+    }
303 366
 
304 367
     function deleteLastAssoc() {
305 368
 

+ 103
- 38
app/views/local/managers/sCoords/objectives.blade.php View File

@@ -36,15 +36,16 @@
36 36
 
37 37
 
38 38
                 <div class="form-group">
39
-                    {{ Form::label('program_id', 'Associated Program') }}
40
-                    <select id="program_id" name="program_id" class="form-control selectpicker">
41
-                        <option value="0">All</option>
42
-                        @foreach ($programs as $program)
43
-                        <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
44
-                        @endforeach
45
-                    </select>
46
-                </div>
39
+                    {{ Form::label('program_id', 'Associated Program') }}<br>
40
+                    <br>
41
+
42
+                    @foreach ($programs as $program)
47 43
 
44
+                    <input type="checkbox" id="{{ $program->name }}" name="program_id[]" value="{{$program->id}}">
45
+                    <label for="{{ $program->name }}"> {{ $program->name }} [{{ $program->school->name }}]</label><br>
46
+                    @endforeach
47
+
48
+                </div>
48 49
 
49 50
                 <div class="form-group">
50 51
                     {{ Form::label('text', 'Text') }}
@@ -105,15 +106,16 @@
105 106
 
106 107
                 <!-- Associated Program -->
107 108
                 <div class="form-group">
108
-                    {{ Form::label('program_id2', 'Associated Program') }}
109
-                    <select id="program_id2" name="program_id" class="form-control selectpicker">
110
-                        <option value="0">All</option>
111
-                        @foreach ($programs as $program)
112
-                        <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
113
-                        @endforeach
114
-                    </select>
109
+
110
+                    {{ Form::label('program_id2', 'Associated Program') }}<br><br>
111
+                    @foreach ($programs as $program)
112
+
113
+                    <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="program_id[]" value="{{$program->id}}">
114
+                    <label for="assoc_program_id_{{ $program->id }}"> {{ $program->name }} <sub>[{{ $program->school->name }}]</sub></label><br>
115
+                    @endforeach
115 116
                 </div>
116 117
 
118
+
117 119
                 <!-- Status -->
118 120
                 <div class="form-group">
119 121
                     {{ Form::label('status', 'Status') }}
@@ -221,8 +223,7 @@
221 223
             },
222 224
             function(json) {
223 225
 
224
-                var text = json[0].text;
225
-
226
+                var text = json.objective[0].text;
226 227
 
227 228
 
228 229
                 // Display info
@@ -230,19 +231,15 @@
230 231
 
231 232
 
232 233
                 // Select associated outcome
233
-                var outcome_id = json[0].outcome_id;
234
-                $('#assoc_outcome0').val(outcome_id);
235
-                $('#assoc_outcome0').selectpicker('refresh');
234
+                for (var i = counterAssoc; i != 1; i--) {
235
+                    deleteLastAssoc(i);
236 236
 
237
-                var length = json.length;
238
-                if (ran == true) {
239
-                    for (var i = counterAssoc; i != 0; i--) {
240
-                        deleteLastAssoc(i);
241
-
242
-                    }
243
-                    counterAssoc = 1
244 237
                 }
245
-                for (var i = 1; i < length; i++) {
238
+                $('#assoc_outcome0').val(json.outcome[0].outcome_id);
239
+                $('#assoc_outcome0').selectpicker('refresh');
240
+                counterAssoc = 1;
241
+                for (var i = 1; i < json.outcome.length; i++) {
242
+                    counterAssoc = i + 1;
246 243
                     var $select = $('<select />', {
247 244
                         'class': "selectpicker form-control",
248 245
                         'name': "assoc_outcome[]",
@@ -273,34 +270,102 @@
273 270
                     $select.appendTo('#assocOutcomeForm' + i.toString()).selectpicker('refresh');
274 271
                     $divForButton.appendTo('#assocOutcomeGroup');
275 272
 
276
-                    $('#assoc_outcome' + i.toString()).val(json[i].outcome_id);
273
+                    $('#assoc_outcome' + i.toString()).val(json.outcome[i].outcome_id);
277 274
                     $('#assoc_outcome' + i.toString()).selectpicker('refresh');
278 275
 
279
-                    counterAssoc = i;
280
-                    ran = true;
281 276
 
282 277
                 }
283 278
 
279
+
284 280
                 // Select associated program
285
-                if (json[0].program_id) {
286
-                    $('#program_id2').val(json[0].program_id);
281
+                var program_length = json.program.length;
282
+                $('input[type=checkbox]').prop('checked', false);
287 283
 
288
-                } else {
289
-                    $('#program_id2').val(0);
284
+                for (var i = 0; i < program_length; i++) {
285
+                    prog = json.program[i].program_id.toString();
286
+                    $('#assoc_program_id_' + prog).prop("checked", true);
290 287
                 }
291 288
 
292
-                $('#program_id2').selectpicker('refresh');
293
-
294 289
 
295 290
                 // Select status
296
-                if (json[0].deleted_at)
291
+                if (json.objective[0].deleted_at)
297 292
                     $('#status').val(0);
298 293
                 else
299 294
                     $('#status').val(1);
295
+                if (json.assessment.length) {
296
+                    $('#deleteObj').html("<p>This objective is currently participating in an assessment, therefore it cannot be deleted</p>");
297
+                } else if (json.assoc_criteria.length) {
298
+                    modal = '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
299
+                        'Delete' +
300
+                        '</button>' +
301
+                        '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
302
+
303
+                        '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
304
+                        '<div class="modal-dialog" role="document">' +
305
+                        '<div class="modal-content">' +
306
+                        ' <div class="modal-header">' +
307
+                        '<h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>' +
308
+                        '<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
309
+                        '<span aria-hidden="true">&times;</span>' +
310
+                        '</button>' +
311
+                        ' </div>' +
312
+                        '<div class="modal-body">' +
313
+                        "<p>This objective is associated to: <p>" +
314
+                        '<ul>';
315
+                    for (var i = 0; i < json.assoc_criteria.length; i++) {
316
+                        modal += "<li>" + json.assoc_criteria[i].name + '</li>';
317
+                    }
318
+                    modal += ' </ul>' +
319
+                        '<p>Do you still want to delete it?</p>' +
320
+                        '</div>' +
321
+                        '<div class="modal-footer">' +
322
+                        '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>' +
323
+                        '<button type="submit" class="btn btn-primary">Delete</button>' +
324
+                        '</div>' +
325
+                        '</div>' +
326
+                        '</div>' +
327
+                        '</div>';
328
+                    $('#deleteObj').html(modal);
329
+
330
+
331
+                } else {
332
+                    modal = '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
333
+                        'Delete' +
334
+                        '</button>' +
335
+                        '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
336
+
337
+                        '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
338
+                        '<div class="modal-dialog" role="document">' +
339
+                        '<div class="modal-content">' +
340
+                        ' <div class="modal-header">' +
341
+                        '<h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>' +
342
+                        '<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
343
+                        '<span aria-hidden="true">&times;</span>' +
344
+                        '</button>' +
345
+                        ' </div>' +
346
+                        '<div class="modal-body">' +
347
+                        "<p> Once deleted, there is no chance of getting it back.</p>";
348
+
349
+                    modal +=
350
+                        '<p>Do you still want to delete it?</p>' +
351
+                        '</div>' +
352
+                        '<div class="modal-footer">' +
353
+                        '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>' +
354
+                        '<button type="submit" class="btn btn-primary">Delete</button>' +
355
+                        '</div>' +
356
+                        '</div>' +
357
+                        '</div>' +
358
+                        '</div>';
359
+                    $('#deleteObj').html(modal);
360
+                }
300 361
             },
301 362
             'json'
302 363
         );
303 364
     }
365
+    },
366
+    'json'
367
+    );
368
+    }
304 369
 
305 370
     function deleteLastAssoc() {
306 371
 

+ 239
- 228
app/views/local/managers/shared/program.blade.php View File

@@ -1,13 +1,13 @@
1 1
 @extends('layouts.master')
2 2
 
3 3
 @section('navigation')
4
-    @if($role==1)
5
-        @include('local.managers.admins._navigation')
6
-    @elseif($role==2)
7
-        @include('local.managers.sCoords._navigation')
8
-    @elseif($role==3)
9
-        @include('local.managers.pCoords._navigation')
10
-    @endif
4
+@if($role==1)
5
+@include('local.managers.admins._navigation')
6
+@elseif($role==2)
7
+@include('local.managers.sCoords._navigation')
8
+@elseif($role==3)
9
+@include('local.managers.pCoords._navigation')
10
+@endif
11 11
 @stop
12 12
 
13 13
 @section('main')
@@ -36,42 +36,44 @@
36 36
                 <div class="col-md-12">
37 37
                     <h3>Courses in this program</h3>
38 38
                     @if($program_courses->count()>0)
39
-                        <table class="table table-striped table-condensed datatable">
40
-                            <thead>
41
-                                <tr>
42
-                                    <th>Identifier</th>
43
-                                    <th>Name</th>
44
-                                    <th>Program</th>
45
-                                    <th>Assessed</th>
46
-                                </tr>
47
-                            </thead>
48
-                            <tfoot>
49
-                                <tr class="column-search">
50
-                                    <th><input class="column-search-bar form-control" type="text" placeholder="Search"/></th>
51
-                                    <th><input class="column-search-bar form-control" type="text" placeholder="Search"/></th>
52
-                                    <th><input class="column-search-bar form-control" type="text" placeholder="Search"/></th>
53
-                                    <th><select class="column-search-select form-control"><option value=""></option></select></th>
54
-                                </tr>
55
-                            </tfoot>
56
-                            <tbody>
57
-                                @foreach($grouped_courses as $grouped_course)
58
-                                    <tr>
59
-                                        <td class="col-md-1">{{ HTML::linkAction('CoursesController@showGrouped', $grouped_course->code.$grouped_course->number.' ('.$grouped_course->semester->code.')', array($grouped_course->code, $grouped_course->number, $grouped_course->semester->code)) }}</td>
60
-                                        <td class="col-md-4">{{{ $grouped_course->name}}}</td>
61
-                                        <td class="col-md-3">{{{ $grouped_course->program->name }}}</td>
62
-                                        <td class="col-md-1">
63
-                                            @if($grouped_course->outcomes_attempted!=NULL)
64
-                                                Yes
65
-                                            @else
66
-                                                No
67
-                                            @endif
68
-                                        </td>
69
-                                    </tr>
70
-                                @endforeach
71
-                            </tbody>
72
-                        </table>
39
+                    <table class="table table-striped table-condensed datatable">
40
+                        <thead>
41
+                            <tr>
42
+                                <th>Identifier</th>
43
+                                <th>Name</th>
44
+                                <th>Program</th>
45
+                                <th>Assessed</th>
46
+                            </tr>
47
+                        </thead>
48
+                        <tfoot>
49
+                            <tr class="column-search">
50
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Search" /></th>
51
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Search" /></th>
52
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Search" /></th>
53
+                                <th><select class="column-search-select form-control">
54
+                                        <option value=""></option>
55
+                                    </select></th>
56
+                            </tr>
57
+                        </tfoot>
58
+                        <tbody>
59
+                            @foreach($grouped_courses as $grouped_course)
60
+                            <tr>
61
+                                <td class="col-md-1">{{ HTML::linkAction('CoursesController@showGrouped', $grouped_course->code.$grouped_course->number.' ('.$grouped_course->semester->code.')', array($grouped_course->code, $grouped_course->number, $grouped_course->semester->code)) }}</td>
62
+                                <td class="col-md-4">{{{ $grouped_course->name}}}</td>
63
+                                <td class="col-md-3">{{{ $grouped_course->program->name }}}</td>
64
+                                <td class="col-md-1">
65
+                                    @if($grouped_course->outcomes_attempted!=NULL)
66
+                                    Yes
67
+                                    @else
68
+                                    No
69
+                                    @endif
70
+                                </td>
71
+                            </tr>
72
+                            @endforeach
73
+                        </tbody>
74
+                    </table>
73 75
                     @else
74
-                        <p class="lead"> No courses assigned.</p>
76
+                    <p class="lead"> No courses assigned.</p>
75 77
                     @endif
76 78
                 </div>
77 79
             </div>
@@ -82,43 +84,45 @@
82 84
                 <div class="col-md-12">
83 85
                     <h3>Sections in this program</h3>
84 86
                     @if($program_courses->count()>0)
85
-                        <p class="lead"> {{{ $assessed_courses_count }}} out of {{{ $program_courses->count() }}} section(s) doing Assessment ({{{ round($assessed_courses_count/$program_courses->count()*100, 2) }}}%)</p>
86
-                        <table class="table table-striped table-condensed datatable">
87
-                            <thead>
88
-                                <tr>
89
-                                    <th>Identifier</th>
90
-                                    <th>Name</th>
91
-                                    <th>Professor</th>
92
-                                    <th>Assessed</th>
93
-                                </tr>
94
-                            </thead>
95
-                            <tfoot>
96
-                                <tr class="column-search">
97
-                                    <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
98
-                                    <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
99
-                                    <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
100
-                                    <th><select class="column-search-select form-control"><option value=""></option></select></th>
101
-                                </tr>
102
-                            </tfoot>
103
-                            <tbody>
104
-                                @foreach($program_courses as $course)
105
-                                <tr>
106
-                                    <td>{{ HTML::linkAction('CoursesController@showLimited', $course->code.$course->number.'-'.$course->section.' ('.$course->semester->code.')', array('id'=>$course->id)) }}</td>
107
-                                    <td>{{{ $course->name}}}</td>
108
-                                    <td>{{{ $course->user->surnames }}}, {{{ $course->user->first_name }}}</td>
109
-                                    <td>
110
-                                        @if($course->outcomes_attempted!=NULL)
111
-                                            Yes
112
-                                        @else
113
-                                            No
114
-                                        @endif
115
-                                    </td>
116
-                                </tr>
117
-                                @endforeach
118
-                            </tbody>
119
-                        </table>
87
+                    <p class="lead"> {{{ $assessed_courses_count }}} out of {{{ $program_courses->count() }}} section(s) doing Assessment ({{{ round($assessed_courses_count/$program_courses->count()*100, 2) }}}%)</p>
88
+                    <table class="table table-striped table-condensed datatable">
89
+                        <thead>
90
+                            <tr>
91
+                                <th>Identifier</th>
92
+                                <th>Name</th>
93
+                                <th>Professor</th>
94
+                                <th>Assessed</th>
95
+                            </tr>
96
+                        </thead>
97
+                        <tfoot>
98
+                            <tr class="column-search">
99
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Buscar" /></th>
100
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Buscar" /></th>
101
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Buscar" /></th>
102
+                                <th><select class="column-search-select form-control">
103
+                                        <option value=""></option>
104
+                                    </select></th>
105
+                            </tr>
106
+                        </tfoot>
107
+                        <tbody>
108
+                            @foreach($program_courses as $course)
109
+                            <tr>
110
+                                <td>{{ HTML::linkAction('CoursesController@showLimited', $course->code.$course->number.'-'.$course->section.' ('.$course->semester->code.')', array('id'=>$course->id)) }}</td>
111
+                                <td>{{{ $course->name}}}</td>
112
+                                <td>{{{ $course->user->surnames }}}, {{{ $course->user->first_name }}}</td>
113
+                                <td>
114
+                                    @if($course->outcomes_attempted!=NULL)
115
+                                    Yes
116
+                                    @else
117
+                                    No
118
+                                    @endif
119
+                                </td>
120
+                            </tr>
121
+                            @endforeach
122
+                        </tbody>
123
+                    </table>
120 124
                     @else
121
-                        <p class="lead"> No sections assigned.</p>
125
+                    <p class="lead"> No sections assigned.</p>
122 126
                     @endif
123 127
                 </div>
124 128
             </div>
@@ -140,55 +144,59 @@
140 144
                         </thead>
141 145
                         <tfoot>
142 146
                             <tr class="column-search">
143
-                                <th><input class="column-search-bar form-control" type="text" placeholder="Search"/></th>
144
-                                <th><select class="column-search-select form-control"><option value=""></option></select></th>
145
-                                <th><select class="column-search-select form-control"><option value=""></option></select></th>
146
-                                <th><input class="column-search-bar form-control" type="text" placeholder="Search"/></th>
147
-                                <th><input class="column-search-bar form-control" type="text" placeholder="Search"/></th>
147
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Search" /></th>
148
+                                <th><select class="column-search-select form-control">
149
+                                        <option value=""></option>
150
+                                    </select></th>
151
+                                <th><select class="column-search-select form-control">
152
+                                        <option value=""></option>
153
+                                    </select></th>
154
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Search" /></th>
155
+                                <th><input class="column-search-bar form-control" type="text" placeholder="Search" /></th>
148 156
                             </tr>
149 157
                         </tfoot>
150 158
                         <tbody>
151 159
                             @foreach($users as $user)
152
-                                <tr>
153
-                                    <td>{{ $user->surnames }}, {{ $user->first_name }}</td>
160
+                            <tr>
161
+                                <td>{{ $user->surnames }}, {{ $user->first_name }}</td>
154 162
 
155
-                                    @if($user->role == 1)
156
-                                        <td>Administrator</td>
157
-                                        <td>All</td>
158
-                                    @elseif($user->role == 2)
159
-                                        <td>School Coordinator</td>
160
-                                        <td>All in {{ $program->school->name }}</td>
161
-                                    @elseif($user->role == 3)
162
-                                        <td>Program Coordinator</td>
163
-                                        <td>
164
-                                            @foreach ($user->programs as $program)
165
-                                                {{ $program->name }}&nbsp;
166
-                                            @endforeach
167
-                                        </td>
168
-                                    @else
169
-                                        <td>Professor</td>
170
-                                        <td>
171
-                                            @foreach ($user->programs as $program)
172
-                                                {{ $program->name }}&nbsp;
173
-                                            @endforeach
174
-                                        </td>
175
-                                    @endif
163
+                                @if($user->role == 1)
164
+                                <td>Administrator</td>
165
+                                <td>All</td>
166
+                                @elseif($user->role == 2)
167
+                                <td>School Coordinator</td>
168
+                                <td>All in {{ $program->school->name }}</td>
169
+                                @elseif($user->role == 3)
170
+                                <td>Program Coordinator</td>
171
+                                <td>
172
+                                    @foreach ($user->programs as $program)
173
+                                    {{ $program->name }}&nbsp;
174
+                                    @endforeach
175
+                                </td>
176
+                                @else
177
+                                <td>Professor</td>
178
+                                <td>
179
+                                    @foreach ($user->programs as $program)
180
+                                    {{ $program->name }}&nbsp;
181
+                                    @endforeach
182
+                                </td>
183
+                                @endif
176 184
 
177
-                                    <td>
178
-                                        <a href="mailto:{{ $user->email }}">{{ $user->email }}</a>
179
-                                    </td>
180
-                                    <td>
181
-                                        @if($user->office_phone)
182
-                                            {{{ $user->office_phone }}}
185
+                                <td>
186
+                                    <a href="mailto:{{ $user->email }}">{{ $user->email }}</a>
187
+                                </td>
188
+                                <td>
189
+                                    @if($user->office_phone)
190
+                                    {{{ $user->office_phone }}}
183 191
 
184
-                                            @if($user->office_extension)
185
-                                                <span>ext.</span> {{{ $user->office_extension }}}
186
-                                            @endif
187
-                                        @else
188
-                                            Not set
189
-                                        @endif
190
-                                    </td>
191
-                                </tr>
192
+                                    @if($user->office_extension)
193
+                                    <span>ext.</span> {{{ $user->office_extension }}}
194
+                                    @endif
195
+                                    @else
196
+                                    Not set
197
+                                    @endif
198
+                                </td>
199
+                            </tr>
192 200
                             @endforeach
193 201
                         </tbody>
194 202
                     </table>
@@ -215,121 +223,124 @@
215 223
 @section('javascript')
216 224
 
217 225
 $('#programTabs a').click(function (e) {
218
-    e.preventDefault()
219
-    $(this).tab('show');
226
+e.preventDefault()
227
+$(this).tab('show');
220 228
 });
221 229
 
222 230
 
223 231
 $('#graph').highcharts({
224
-    chart: {
225
-        type: 'bar'
226
-    },
227
-    title: {
228
-        text: 'Performance by Learning Outcome Criteria in {{ $program->name }} Program'
229
-    },
230
-    legend: {
231
-                reversed: true,
232
-            },
233
-    xAxis: {
234
-        categories: [
235
-            @foreach($outcomes as $outcome)
236
-                "{{{ $outcome->name }}}",
237
-            @endforeach
238
-        ],
239
-        labels: {
240
-            style: {
241
-                fontSize:'11px'
242
-            },
243
-            step:1,
244
-            useHTML:true,
245
-            formatter: function() {
246
-                return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
247
-            },
248
-        }
249
-    },
250
-    yAxis: {
251
-        min: 0,
252
-        max: 100,
253
-        title: {
254
-            text: 'Percentage'
255
-        }
256
-    },
257
-    tooltip: {
258
-        headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
259
-        pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
260
-            '<td style="padding:0"><b>{point.y:.2f}</b></td></tr>',
261
-        footerFormat: '</table>',
262
-        shared: true,
263
-        useHTML: true
264
-    },
265
-    plotOptions: {
266
-        bar: {
267
-            //grouping: false,
268
-            shadow: false,
269
-            borderWidth: 0,
270
-        },
271
-        series: {
272
-        pointPadding: 0,
273
-        groupPadding: 0.075
274
-        },
275
-    },
276
-    series: [{
277
-        name: 'Expected Value',
278
-        color: '#555555',
279
-        dataLabels: {
280
-            enabled: true,
281
-            fontSize: 8,
282
-            color: '#fff',
283
-            align: 'right',
284
-            format: '{y:.1f}%',
285
-            style: {
286
-                //fontWeight: 'bold'
287
-            },
288
-            y:-1
289
-        },
290
-        data: [
291
-            @foreach($outcomes as $index => $outcome)
292
-                @if(
293
-                    is_array($outcomes_attempted)
294
-                    && array_key_exists($outcome->id, $outcomes_attempted)
295
-                    && $outcomes_attempted[$outcome->id]!=0)
296
-                    {{{ $outcome->expected_outcome }}},
297
-                @else
298
-                    0,
299
-                @endif
300
-            @endforeach
301
-        ]
232
+chart: {
233
+type: 'bar'
234
+},
235
+title: {
236
+text: 'Performance by Learning Outcome Criteria in {{ $program->name }} Program'
237
+},
238
+legend: {
239
+reversed: true,
240
+},
241
+xAxis: {
242
+categories: [
243
+@foreach($outcomes as $outcome)
244
+"{{{ $outcome->name }}}",
245
+@endforeach
246
+],
247
+labels: {
248
+style: {
249
+fontSize:'11px'
250
+},
251
+step:1,
252
+useHTML:true,
253
+formatter: function() {
254
+return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
255
+},
256
+}
257
+},
258
+yAxis: {
259
+min: 0,
260
+max: 100,
261
+title: {
262
+text: 'Percentage'
263
+}
264
+},
265
+tooltip: {
266
+headerFormat: '<span style="font-size:10px">{point.key}</span>
267
+<table>',
268
+    pointFormat: '<tr>
269
+        <td style="color:{series.color};padding : 0">{series.name}: </td>' +
270
+        '<td style="padding:0"><b>{point.y:.2f}</b></td>
271
+    </tr>',
272
+    footerFormat: '</table>',
273
+shared: true,
274
+useHTML: true
275
+},
276
+plotOptions: {
277
+bar: {
278
+//grouping: false,
279
+shadow: false,
280
+borderWidth: 0,
281
+},
282
+series: {
283
+pointPadding: 0,
284
+groupPadding: 0.075
285
+},
286
+},
287
+series: [{
288
+name: 'Expected Value',
289
+color: '#555555',
290
+dataLabels: {
291
+enabled: true,
292
+fontSize: 8,
293
+color: '#fff',
294
+align: 'right',
295
+format: '{y:.1f}%',
296
+style: {
297
+//fontWeight: 'bold'
298
+},
299
+y:-1
300
+},
301
+data: [
302
+@foreach($outcomes as $index => $outcome)
303
+@if(
304
+is_array($outcomes_attempted)
305
+&& array_key_exists($outcome->id, $outcomes_attempted)
306
+&& $outcomes_attempted[$outcome->id]!=0)
307
+{{{ $outcome->expected_outcome }}},
308
+@else
309
+0,
310
+@endif
311
+@endforeach
312
+]
302 313
 
303
-    },{
304
-        name: 'Obtained Value',
305
-        color: '#e70033',
306
-        dataLabels: {
307
-            enabled: true,
308
-            fontSize: 8,
309
-            color: '#fff',
310
-            align: 'right',
311
-            format: '{y:.1f}%',
312
-            style: {
313
-                //fontWeight: 'bold'
314
-            },
315
-            y:-1
316
-        },
317
-        data:[
318
-            @foreach($outcomes as $index => $outcome)
319
-                @if(
320
-                    is_array($outcomes_attempted)
321
-                    && array_key_exists($outcome->id, $outcomes_attempted)
322
-                    && $outcomes_attempted[$outcome->id]!=0)
323
-                    {{{ ($outcomes_achieved[$outcome->id]/$outcomes_attempted[$outcome->id])*100 }}},
324
-                @else
325
-                    0,
326
-                @endif
327
-            @endforeach
328
-        ]
329
-    }]
314
+},{
315
+name: 'Obtained Value',
316
+color: '#e70033',
317
+dataLabels: {
318
+enabled: true,
319
+fontSize: 8,
320
+color: '#fff',
321
+align: 'right',
322
+format: '{y:.1f}%',
323
+style: {
324
+//fontWeight: 'bold'
325
+},
326
+y:-1
327
+},
328
+data:[
329
+@foreach($outcomes as $index => $outcome)
330
+@if(
331
+is_array($outcomes_attempted)
332
+&& array_key_exists($outcome->id, $outcomes_attempted)
333
+&& $outcomes_attempted[$outcome->id]!=0)
334
+{{{ ($outcomes_achieved[$outcome->id]/$outcomes_attempted[$outcome->id])*100 }}},
335
+@else
336
+0,
337
+@endif
338
+@endforeach
339
+]
340
+}]
330 341
 });
331 342
 
332 343
 // Include dummy graph for outcomes
333 344
 @include('global.dummy-outcomes')
334 345
 
335
-@stop
346
+@stop

+ 7
- 7
app/views/local/professors/_navigation.blade.php View File

@@ -16,14 +16,14 @@
16 16
         </ul>
17 17
       </li>
18 18
       @if(count(Auth::user()->courses))
19
-        <li class="dropdown">
20
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Sections<span class="caret"></span></a>
21
-          <ul class="dropdown-menu" role="menu">
19
+      <li class="dropdown">
20
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Sections<span class="caret"></span></a>
21
+        <ul class="dropdown-menu" role="menu">
22 22
           @foreach ($courses as $course)
23
-            <li> {{ HTML::linkAction('CoursesController@show', $course->code.$course->number.'-'.$course->section.' ('.$course->semester->code.')', array('id'=>$course->id)) }}</li>
23
+          <li> {{ HTML::linkAction('CoursesController@show', $course->code.$course->number.'-'.$course->section.' ('.$course->semester->code.')', array('id'=>$course->id)) }}</li>
24 24
           @endforeach
25
-          </ul>
26
-        </li>
25
+        </ul>
26
+      </li>
27 27
       @endif
28 28
       <li> {{ HTML::linkAction('ProfessorsController@program', 'Program') }}</li>
29 29
       <li>{{ HTML::linkAction('OutcomesController@professorAssessmentReports', 'Reports') }}</li>
@@ -45,4 +45,4 @@
45 45
       </li>
46 46
     </ul>
47 47
   </div>
48
-</div>
48
+</div>