Browse Source

Merge branch 'Merge_gabriel_mayo' of https://git.ccom.uprrp.edu/CDCC/OLAS into Merge_gabriel_mayo

resuelto
Conflicts:
	app/controllers/ThreeYearPlanController.php
parent
commit
b34d4fc19f

+ 46
- 18
app/controllers/Objective2Controller.php View File

45
 			return true;
45
 			return true;
46
 	}
46
 	}
47
 
47
 
48
-
49
-	private function makeValidator($clean_input)
48
+	//edit == true or edit == false
49
+	private function makeValidator($clean_input, $edit)
50
 	{
50
 	{
51
 		/** Validation rules */
51
 		/** Validation rules */
52
-		return Validator::make(
53
-			array(
54
-				'text' => $clean_input['text'],
55
 
52
 
56
-				'outcome_id' => $clean_input['outcome_id'],
57
-				'program_id' => $clean_input['program_id']
53
+		if (!$edit) {
54
+			return Validator::make(
55
+				array(
56
+					'text' => $clean_input['text'],
58
 
57
 
59
-			),
60
-			array(
61
-				'text' => 'required|string',
58
+					'outcome_id' => $clean_input['outcome_id'],
59
+					'program_id' => $clean_input['program_id']
62
 
60
 
63
-				'outcome_id' => 'required|array',
64
-				'program_id' => 'required|array'
61
+				),
62
+				array(
65
 
63
 
66
-			)
64
+					'outcome_id' => 'required|array',
65
+					'program_id' => 'required|array'
66
+
67
+				)
68
+
69
+			);
70
+		} else {
71
+			return Validator::make(
72
+				array(
73
+					'text' => $clean_input['text'],
74
+
75
+					'outcome_id' => $clean_input['outcome_id'],
76
+					'program_id' => $clean_input['program_id']
77
+
78
+				),
79
+				array(
80
+					'text' => 'required|string|unique',
67
 
81
 
68
-		);
82
+					'outcome_id' => 'required|array',
83
+					'program_id' => 'required|array'
84
+
85
+				)
86
+
87
+			);
88
+		}
69
 	}
89
 	}
70
 
90
 
71
 
91
 
92
+
72
 	private function cleanInput()
93
 	private function cleanInput()
73
 	{
94
 	{
74
 		$clean_input = array();
95
 		$clean_input = array();
78
 
99
 
79
 		$clean_input['outcome_id'] = Input::get('outcome');
100
 		$clean_input['outcome_id'] = Input::get('outcome');
80
 		$counter = Input::get('counter') + 0;
101
 		$counter = Input::get('counter') + 0;
81
-		Log::info($clean_input);
102
+		//		Log::info($clean_input);
82
 
103
 
83
 		foreach ($clean_input['outcome_id'] as $index => $outcome_id) {
104
 		foreach ($clean_input['outcome_id'] as $index => $outcome_id) {
84
 			$clean_input['outcome_id'][$index] = trim(preg_replace('/\t+/', '', $clean_input['outcome_id'][$index]));
105
 			$clean_input['outcome_id'][$index] = trim(preg_replace('/\t+/', '', $clean_input['outcome_id'][$index]));
85
 		}
106
 		}
86
 
107
 
87
 		$clean_input['program_id'] = Input::get('program_id');
108
 		$clean_input['program_id'] = Input::get('program_id');
88
-		Log::info(Input::get('program_id'));
109
+		//		Log::info(Input::get('program_id'));
89
 
110
 
90
 		return $clean_input;
111
 		return $clean_input;
91
 	}
112
 	}
145
 				'typ_semester_outcome.id as typ_semester_outcome_id'
166
 				'typ_semester_outcome.id as typ_semester_outcome_id'
146
 			)
167
 			)
147
 			->get();
168
 			->get();
169
+
170
+
148
 		$json['typ_semester_objectives'] = DB::table('typ_semester_objectives')
171
 		$json['typ_semester_objectives'] = DB::table('typ_semester_objectives')
149
 			->where('objective_id', Input::get('id'))
172
 			->where('objective_id', Input::get('id'))
150
 			->get();
173
 			->get();
194
 		$clean_input = $this->cleanInput();
217
 		$clean_input = $this->cleanInput();
195
 
218
 
196
 		/** Validation rules */
219
 		/** Validation rules */
197
-		$validator = $this->makeValidator($clean_input);
220
+		$validator = $this->makeValidator($clean_input, false);
198
 
221
 
199
 		/** If validation fails */
222
 		/** If validation fails */
200
 		if ($validator->fails()) {
223
 		if ($validator->fails()) {
256
 			if ($objective->save()) {
279
 			if ($objective->save()) {
257
 				$objectiveId = $objective->id;
280
 				$objectiveId = $objective->id;
258
 
281
 
282
+				Log::info($clean_input['outcome_id']);
283
+
259
 
284
 
260
 				foreach ($clean_input['program_id'] as $program_id) {
285
 				foreach ($clean_input['program_id'] as $program_id) {
261
 					DB::insert("insert into objective_program (objective_id, program_id) values({$objectiveId},{$program_id})");
286
 					DB::insert("insert into objective_program (objective_id, program_id) values({$objectiveId},{$program_id})");
441
 		//Log::info(print_r($clean_input, true));
466
 		//Log::info(print_r($clean_input, true));
442
 
467
 
443
 		/** Validation rules */
468
 		/** Validation rules */
444
-		$validator = $this->makeValidator($clean_input);
469
+		if ($clean_input['text'] == $Objective->text) {
470
+			$validator = $this->makeValidator($clean_input, true);
471
+		} else
472
+			$validator = $this->makeValidator($clean_input, false);
445
 
473
 
446
 		/** If validation fails */
474
 		/** If validation fails */
447
 		if ($validator->fails()) {
475
 		if ($validator->fails()) {

+ 12
- 11
app/controllers/ThreeYearPlanController.php View File

80
     {
80
     {
81
 	    $outcomes = DB::table('outcomes')->where('deactivation_date', '=', null)->where('level', '=', 3)->orderBy('name', 'ASC')->get();    
81
 	    $outcomes = DB::table('outcomes')->where('deactivation_date', '=', null)->where('level', '=', 3)->orderBy('name', 'ASC')->get();    
82
     }
82
     }
83
+
83
     // se annadio la nueva variable
84
     // se annadio la nueva variable
84
     return View::make('global.view-three-year-plan', compact('title', 'last_year', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
85
     return View::make('global.view-three-year-plan', compact('title', 'last_year', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
85
   }
86
   }
375
             ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
376
             ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
376
             ->where('objective_program.program_id', $program_id)
377
             ->where('objective_program.program_id', $program_id)
377
             ->where('objective_outcome.outcome_id', $outcome_id)
378
             ->where('objective_outcome.outcome_id', $outcome_id)
378
-            ->where('objective_outcome.objective_id', "<>",0)
379
+            ->where('objective_outcome.objective_id', "<>", 0)
379
             ->select('objectives.id', 'objectives.text', 'outcomes.name as outcome_name')
380
             ->select('objectives.id', 'objectives.text', 'outcomes.name as outcome_name')
380
             ->orderBy('objectives.text', 'asc')
381
             ->orderBy('objectives.text', 'asc')
381
             ->get();
382
             ->get();
455
 
456
 
456
           $semesters_->selected_objectives = array();
457
           $semesters_->selected_objectives = array();
457
           foreach ($result_objectives as $objectives_) {
458
           foreach ($result_objectives as $objectives_) {
458
-//             $result_courses = DB::table('courses')
459
-//               ->where('courses.program_id', $program_id)
460
-//               ->select('courses.id as course_id', 'courses.name', 'courses.code', 'courses.number', 'courses.program_id')
461
-//               ->orderBy('courses.number', 'asc')
462
-//               ->groupBy('courses.name', 'courses.code')
463
-//               ->get();
459
+            //             $result_courses = DB::table('courses')
460
+            //               ->where('courses.program_id', $program_id)
461
+            //               ->select('courses.id as course_id', 'courses.name', 'courses.code', 'courses.number', 'courses.program_id')
462
+            //               ->orderBy('courses.number', 'asc')
463
+            //               ->groupBy('courses.name', 'courses.code')
464
+            //               ->get();
464
 
465
 
465
             $result_courses = DB::table('courses')
466
             $result_courses = DB::table('courses')
466
               ->where('courses.program_id', $program_id)
467
               ->where('courses.program_id', $program_id)
467
-              ->orWhereIn('courses.program_id', function ($q) use ($program_id){
468
-              		$q->select('other_program_id')
469
-              		  ->from('other_programs_courses_typ')
470
-              		  ->where('program_id',$program_id);	
468
+              ->orWhereIn('courses.program_id', function ($q) use ($program_id) {
469
+                $q->select('other_program_id')
470
+                  ->from('other_programs_courses_typ')
471
+                  ->where('program_id', $program_id);
471
               })
472
               })
472
               ->select('courses.id as course_id', 'courses.name', 'courses.code', 'courses.number', 'courses.program_id')
473
               ->select('courses.id as course_id', 'courses.name', 'courses.code', 'courses.number', 'courses.program_id')
473
               ->orderBy('courses.code', 'asc')
474
               ->orderBy('courses.code', 'asc')

+ 6
- 4
app/views/global/view-three-year-plan.blade.php View File

103
             </div>
103
             </div>
104
             <br>
104
             <br>
105
             <!--<button type="button" class="btn btn-secondary" id = "three_year_button" data-toggle="modal" data-target="#three_year">Create Three Year Cycle</button>
105
             <!--<button type="button" class="btn btn-secondary" id = "three_year_button" data-toggle="modal" data-target="#three_year">Create Three Year Cycle</button>
106
-                          -->
106
+                              -->
107
         </div>
107
         </div>
108
 
108
 
109
         <!-- Modal -->
109
         <!-- Modal -->
404
                 $.post(
404
                 $.post(
405
                     "{{ URL::action('ThreeYearPlanController@createAnnualPlan', [$program_id]) }}", {
405
                     "{{ URL::action('ThreeYearPlanController@createAnnualPlan', [$program_id]) }}", {
406
                         typ_id: $('#table-cycles').data('typ-id')
406
                         typ_id: $('#table-cycles').data('typ-id')
407
-                    });
408
-                window.location.href =
409
-                    "{{ URL::action('AnnualPlansController@showPlan', [$program_id]) }}";
407
+                    },
408
+                    function() {
409
+                        window.location.href =
410
+                            "{{ URL::action('AnnualPlansController@showPlan', [$program_id]) }}";
410
 
411
 
412
+                    });
411
             });
413
             });
412
 
414
 
413
             // When list item is clicked, load corresponding info
415
             // When list item is clicked, load corresponding info

+ 400
- 377
app/views/layouts/master.blade.php
File diff suppressed because it is too large
View File


+ 7
- 1
app/views/local/managers/pCoords/_new_navigation.blade.php View File

3
         <!--<div class="navbar-header">
3
         <!--<div class="navbar-header">
4
       {{ HTML::linkAction('ProgramCoordinatorsController@overview','Online Learning Assessment System · Program Coordinator',[],['class' => 'navbar-brand']) }}
4
       {{ HTML::linkAction('ProgramCoordinatorsController@overview','Online Learning Assessment System · Program Coordinator',[],['class' => 'navbar-brand']) }}
5
     </div>-->
5
     </div>-->
6
-        <ul class="nav navbar-nav navbar-right">
6
+        <ul class="nav navbar-nav navbar-right ml-auto">
7
             <li>{{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Overview') }}</li>
7
             <li>{{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Overview') }}</li>
8
 
8
 
9
             <li class="dropdown">
9
             <li class="dropdown">
142
                                 href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{ $program->name }}</a>
142
                                 href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{ $program->name }}</a>
143
                         </li>
143
                         </li>
144
                     @endforeach
144
                     @endforeach
145
+                    <h6 class="dropdown-header">View Annual Report from:</h6>
146
+                    @foreach (Auth::user()->programs as $program)
147
+                        <li><a
148
+                                href="{{ URL::action('AnnualPlansController@annualPlansShow', ['report', $program->id]) }}">{{ $program->name }}</a>
149
+                        </li>
150
+                    @endforeach
145
                 </ul>
151
                 </ul>
146
             </li>
152
             </li>
147
 
153
 

+ 8
- 2
app/views/local/managers/sCoords/_new_navigation.blade.php View File

3
         <!--<div class="navbar-header">
3
         <!--<div class="navbar-header">
4
       {{ HTML::linkAction('ProgramCoordinatorsController@overview','Online Learning Assessment System · Program Coordinator',[],['class' => 'navbar-brand']) }}
4
       {{ HTML::linkAction('ProgramCoordinatorsController@overview','Online Learning Assessment System · Program Coordinator',[],['class' => 'navbar-brand']) }}
5
     </div>-->
5
     </div>-->
6
-        <ul class="nav navbar-nav navbar-right">
6
+        <ul class="nav navbar-nav navbar-right ml-auto">
7
             <li>{{ HTML::linkAction('SchoolCoordinatorsController@overview', 'Overview') }}</li>
7
             <li>{{ HTML::linkAction('SchoolCoordinatorsController@overview', 'Overview') }}</li>
8
 
8
 
9
             <li class="dropdown">
9
             <li class="dropdown">
69
                     <h6 class="dropdown-header">View Annual Plan from:</h6>
69
                     <h6 class="dropdown-header">View Annual Plan from:</h6>
70
                     @foreach (Auth::user()->school->programs as $program)
70
                     @foreach (Auth::user()->school->programs as $program)
71
                         <li><a
71
                         <li><a
72
-                                href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">{{ $program->name }}</a>
72
+                                href="{{ URL::action('AnnualPlansController@annualPlansShow', ['plan', $program->id]) }}">{{ $program->name }}</a>
73
                         </li>
73
                         </li>
74
                     @endforeach
74
                     @endforeach
75
                 </ul>
75
                 </ul>
130
                                 href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{ $program->name }}</a>
130
                                 href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{ $program->name }}</a>
131
                         </li>
131
                         </li>
132
                     @endforeach
132
                     @endforeach
133
+                    <h6 class="dropdown-header">View Annual Report from:</h6>
134
+                    @foreach (Auth::user()->programs as $program)
135
+                        <li><a
136
+                                href="{{ URL::action('AnnualPlansController@annualPlansShow', ['report', $program->id]) }}">{{ $program->name }}</a>
137
+                        </li>
138
+                    @endforeach
133
                 </ul>
139
                 </ul>
134
             </li>
140
             </li>
135
 
141
 

+ 2
- 2
app/views/local/managers/shared/annual-plans.blade.php View File

1353
                         'role': 'group'
1353
                         'role': 'group'
1354
                     });
1354
                     });
1355
                     button_save = $('<button>', {
1355
                     button_save = $('<button>', {
1356
-                        'class': 'btn btn-lg btn-primary',
1356
+                        'class': 'btn btn-lg btn-primary btn-block',
1357
                         'type': 'button',
1357
                         'type': 'button',
1358
                         'onclick': 'check_if_ready(' + annual_id + ')'
1358
                         'onclick': 'check_if_ready(' + annual_id + ')'
1359
                     }).html('Submit Annual Plan');
1359
                     }).html('Submit Annual Plan');
1360
                     button_print = $("<button>", {
1360
                     button_print = $("<button>", {
1361
-                        "class": 'btn btn-lg btn-primary',
1361
+                        "class": 'btn btn-lg btn-primary btn-block',
1362
                         "type": "button",
1362
                         "type": "button",
1363
                         "onclick": "window.location.href = " +
1363
                         "onclick": "window.location.href = " +
1364
                             "'{{ URL::action('AnnualPlansController@printAnnualPlan') }}" +
1364
                             "'{{ URL::action('AnnualPlansController@printAnnualPlan') }}" +

+ 9
- 9
app/views/local/managers/shared/annual_report.blade.php View File

68
 
68
 
69
 
69
 
70
                     <!-- <div class="table-responsive">
70
                     <!-- <div class="table-responsive">
71
-                                                                                                                                                                                                                                                                                                                <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
72
-                                                                                                                                                                                                                                                                                                                  <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
73
-                                                                                                                                                                                                                                                                                                                  <tbody>
74
-                                                                                                                                                                                                                                                                                                                  </tbody>
71
+                                                                                                                                                                                                                                                                                                                    <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
72
+                                                                                                                                                                                                                                                                                                                      <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
73
+                                                                                                                                                                                                                                                                                                                      <tbody>
74
+                                                                                                                                                                                                                                                                                                                      </tbody>
75
 
75
 
76
-                                                                                                                                                                                                                                                                                                                </table>
77
-                                                                                                                                                                                                                                                                                                                
78
-                                                                                                                                                                                                                                                                                                            </div>-->
76
+                                                                                                                                                                                                                                                                                                                    </table>
77
+                                                                                                                                                                                                                                                                                                                    
78
+                                                                                                                                                                                                                                                                                                                </div>-->
79
 
79
 
80
                 </div>
80
                 </div>
81
             </div>
81
             </div>
1580
                         'role': 'group'
1580
                         'role': 'group'
1581
                     });
1581
                     });
1582
                     button_save = $('<button>', {
1582
                     button_save = $('<button>', {
1583
-                        'class': ' btn btn-lg btn-primary ',
1583
+                        'class': ' btn btn-lg btn-primary btn-block',
1584
                         'type': 'button',
1584
                         'type': 'button',
1585
                         'onclick': 'check_if_ready(' + annual_id + ')'
1585
                         'onclick': 'check_if_ready(' + annual_id + ')'
1586
                     }).html('Submit Annual Report');
1586
                     }).html('Submit Annual Report');
1587
                     button_print = $("<button>", {
1587
                     button_print = $("<button>", {
1588
-                        "class": 'btn btn-lg btn-primary ',
1588
+                        "class": 'btn btn-lg btn-primary btn-block',
1589
                         "type": "button",
1589
                         "type": "button",
1590
                         "onclick": "window.location.href = " +
1590
                         "onclick": "window.location.href = " +
1591
                             "'{{ URL::action('AnnualPlansController@printAnnualReport') }}" +
1591
                             "'{{ URL::action('AnnualPlansController@printAnnualReport') }}" +

+ 9
- 7
app/views/local/managers/shared/objectives.blade.php View File

29
                         <div class="form-group col-md-11" id='outcomeForm'>
29
                         <div class="form-group col-md-11" id='outcomeForm'>
30
 
30
 
31
 
31
 
32
-                            <select id="outcome[0]" name="outcome[0]" class="form-control selectpicker">
32
+                            <select id="outcome[0]" name="outcome[0]" class="form-control selectpicker createOutcome">
33
 
33
 
34
                                 @foreach ($outcomes as $outcome)
34
                                 @foreach ($outcomes as $outcome)
35
                                     <option value="{{ $outcome->id }}">
35
                                     <option value="{{ $outcome->id }}">
83
 
83
 
84
 
84
 
85
 
85
 
86
-                    {{ Form::submit('Create', ['class' => 'btn btn-primary btn-block']) }}
86
+                    {{ Form::submit('Create', ['class' => 'btn btn-primary btn-block', 'id' => 'createObjectiveButton']) }}
87
                     {{ Form::close() }}
87
                     {{ Form::close() }}
88
                 </div>
88
                 </div>
89
             </div>
89
             </div>
141
                             @foreach ($objectives as $objective)
141
                             @foreach ($objectives as $objective)
142
                                 <option value="{{ $objective->id }}"
142
                                 <option value="{{ $objective->id }}"
143
                                     data-subtext="
143
                                     data-subtext="
144
-                                                                                                                                                                                                                             @if ($objective->program) &nbsp;&nbsp;&nbsp;[{{ $objective->program->name }}] @endif
145
-                                                                                                                                                                                                            ">
144
+                                                                                                                                                                                                                                         @if ($objective->program) &nbsp;&nbsp;&nbsp;[{{ $objective->program->name }}] @endif
145
+                                                                                                                                                                                                                        ">
146
                                     {{ $objective->text }}
146
                                     {{ $objective->text }}
147
 
147
 
148
 
148
 
311
             );
311
             );
312
         }
312
         }
313
 
313
 
314
+
315
+
314
         var counter = 1;
316
         var counter = 1;
315
         var counterAssoc = 0;
317
         var counterAssoc = 0;
316
         //Add Another Outcome
318
         //Add Another Outcome
339
 
341
 
340
         function addOutcomeTest() {
342
         function addOutcomeTest() {
341
             var $select = $('<select/>', {
343
             var $select = $('<select/>', {
342
-                'class': "selectpicker form-control",
344
+                'class': "selectpicker form-control createOutcome",
343
                 'name': "outcome[" + counter.toString() + "]",
345
                 'name': "outcome[" + counter.toString() + "]",
344
                 'data-live-search': 'true'
346
                 'data-live-search': 'true'
345
 
347
 
406
 
408
 
407
                     // Select associated outcome
409
                     // Select associated outcome
408
                     $(".removable-outcome").remove();
410
                     $(".removable-outcome").remove();
409
-                    $('.alert-dismissible').remove();
411
+                    $('.warning-objective').remove();
410
                     $('#assoc_outcome0').val(json.outcome[0].outcome_id);
412
                     $('#assoc_outcome0').val(json.outcome[0].outcome_id);
411
 
413
 
412
                     disabled = 0;
414
                     disabled = 0;
466
 
468
 
467
                     if (disabled == 1) {
469
                     if (disabled == 1) {
468
                         alert = $('<div/>', {
470
                         alert = $('<div/>', {
469
-                            'class': 'alert alert-danger alert-dismissible',
471
+                            'class': 'alert alert-danger alert-dismissible warning-objective',
470
                             'role': 'alert'
472
                             'role': 'alert'
471
                         })
473
                         })
472
                         button = $('<button/>', {
474
                         button = $('<button/>', {