Pārlūkot izejas kodu

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

resuelto
Conflicts:
	app/controllers/ThreeYearPlanController.php
Carlos J Corrada Bravo 2 gadus atpakaļ
vecāks
revīzija
b34d4fc19f

+ 46
- 18
app/controllers/Objective2Controller.php Parādīt failu

@@ -45,30 +45,51 @@ class Objective2Controller extends \BaseController
45 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 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 93
 	private function cleanInput()
73 94
 	{
74 95
 		$clean_input = array();
@@ -78,14 +99,14 @@ class Objective2Controller extends \BaseController
78 99
 
79 100
 		$clean_input['outcome_id'] = Input::get('outcome');
80 101
 		$counter = Input::get('counter') + 0;
81
-		Log::info($clean_input);
102
+		//		Log::info($clean_input);
82 103
 
83 104
 		foreach ($clean_input['outcome_id'] as $index => $outcome_id) {
84 105
 			$clean_input['outcome_id'][$index] = trim(preg_replace('/\t+/', '', $clean_input['outcome_id'][$index]));
85 106
 		}
86 107
 
87 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 111
 		return $clean_input;
91 112
 	}
@@ -145,6 +166,8 @@ class Objective2Controller extends \BaseController
145 166
 				'typ_semester_outcome.id as typ_semester_outcome_id'
146 167
 			)
147 168
 			->get();
169
+
170
+
148 171
 		$json['typ_semester_objectives'] = DB::table('typ_semester_objectives')
149 172
 			->where('objective_id', Input::get('id'))
150 173
 			->get();
@@ -194,7 +217,7 @@ class Objective2Controller extends \BaseController
194 217
 		$clean_input = $this->cleanInput();
195 218
 
196 219
 		/** Validation rules */
197
-		$validator = $this->makeValidator($clean_input);
220
+		$validator = $this->makeValidator($clean_input, false);
198 221
 
199 222
 		/** If validation fails */
200 223
 		if ($validator->fails()) {
@@ -256,6 +279,8 @@ class Objective2Controller extends \BaseController
256 279
 			if ($objective->save()) {
257 280
 				$objectiveId = $objective->id;
258 281
 
282
+				Log::info($clean_input['outcome_id']);
283
+
259 284
 
260 285
 				foreach ($clean_input['program_id'] as $program_id) {
261 286
 					DB::insert("insert into objective_program (objective_id, program_id) values({$objectiveId},{$program_id})");
@@ -441,7 +466,10 @@ class Objective2Controller extends \BaseController
441 466
 		//Log::info(print_r($clean_input, true));
442 467
 
443 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 474
 		/** If validation fails */
447 475
 		if ($validator->fails()) {

+ 12
- 11
app/controllers/ThreeYearPlanController.php Parādīt failu

@@ -80,6 +80,7 @@ class ThreeYearPlanController extends \BaseController
80 80
     {
81 81
 	    $outcomes = DB::table('outcomes')->where('deactivation_date', '=', null)->where('level', '=', 3)->orderBy('name', 'ASC')->get();    
82 82
     }
83
+
83 84
     // se annadio la nueva variable
84 85
     return View::make('global.view-three-year-plan', compact('title', 'last_year', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
85 86
   }
@@ -375,7 +376,7 @@ class ThreeYearPlanController extends \BaseController
375 376
             ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
376 377
             ->where('objective_program.program_id', $program_id)
377 378
             ->where('objective_outcome.outcome_id', $outcome_id)
378
-            ->where('objective_outcome.objective_id', "<>",0)
379
+            ->where('objective_outcome.objective_id', "<>", 0)
379 380
             ->select('objectives.id', 'objectives.text', 'outcomes.name as outcome_name')
380 381
             ->orderBy('objectives.text', 'asc')
381 382
             ->get();
@@ -455,19 +456,19 @@ class ThreeYearPlanController extends \BaseController
455 456
 
456 457
           $semesters_->selected_objectives = array();
457 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 466
             $result_courses = DB::table('courses')
466 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 473
               ->select('courses.id as course_id', 'courses.name', 'courses.code', 'courses.number', 'courses.program_id')
473 474
               ->orderBy('courses.code', 'asc')

+ 6
- 4
app/views/global/view-three-year-plan.blade.php Parādīt failu

@@ -103,7 +103,7 @@
103 103
             </div>
104 104
             <br>
105 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 107
         </div>
108 108
 
109 109
         <!-- Modal -->
@@ -404,10 +404,12 @@
404 404
                 $.post(
405 405
                     "{{ URL::action('ThreeYearPlanController@createAnnualPlan', [$program_id]) }}", {
406 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 415
             // When list item is clicked, load corresponding info

+ 400
- 377
app/views/layouts/master.blade.php
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 7
- 1
app/views/local/managers/pCoords/_new_navigation.blade.php Parādīt failu

@@ -3,7 +3,7 @@
3 3
         <!--<div class="navbar-header">
4 4
       {{ HTML::linkAction('ProgramCoordinatorsController@overview','Online Learning Assessment System · Program Coordinator',[],['class' => 'navbar-brand']) }}
5 5
     </div>-->
6
-        <ul class="nav navbar-nav navbar-right">
6
+        <ul class="nav navbar-nav navbar-right ml-auto">
7 7
             <li>{{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Overview') }}</li>
8 8
 
9 9
             <li class="dropdown">
@@ -142,6 +142,12 @@
142 142
                                 href="{{ URL::action('OutcomesController@annualReport', $program->id) }}">{{ $program->name }}</a>
143 143
                         </li>
144 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 151
                 </ul>
146 152
             </li>
147 153
 

+ 8
- 2
app/views/local/managers/sCoords/_new_navigation.blade.php Parādīt failu

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

+ 2
- 2
app/views/local/managers/shared/annual-plans.blade.php Parādīt failu

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

+ 9
- 9
app/views/local/managers/shared/annual_report.blade.php Parādīt failu

@@ -68,14 +68,14 @@
68 68
 
69 69
 
70 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 80
                 </div>
81 81
             </div>
@@ -1580,12 +1580,12 @@
1580 1580
                         'role': 'group'
1581 1581
                     });
1582 1582
                     button_save = $('<button>', {
1583
-                        'class': ' btn btn-lg btn-primary ',
1583
+                        'class': ' btn btn-lg btn-primary btn-block',
1584 1584
                         'type': 'button',
1585 1585
                         'onclick': 'check_if_ready(' + annual_id + ')'
1586 1586
                     }).html('Submit Annual Report');
1587 1587
                     button_print = $("<button>", {
1588
-                        "class": 'btn btn-lg btn-primary ',
1588
+                        "class": 'btn btn-lg btn-primary btn-block',
1589 1589
                         "type": "button",
1590 1590
                         "onclick": "window.location.href = " +
1591 1591
                             "'{{ URL::action('AnnualPlansController@printAnnualReport') }}" +

+ 9
- 7
app/views/local/managers/shared/objectives.blade.php Parādīt failu

@@ -29,7 +29,7 @@
29 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 34
                                 @foreach ($outcomes as $outcome)
35 35
                                     <option value="{{ $outcome->id }}">
@@ -83,7 +83,7 @@
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 87
                     {{ Form::close() }}
88 88
                 </div>
89 89
             </div>
@@ -141,8 +141,8 @@
141 141
                             @foreach ($objectives as $objective)
142 142
                                 <option value="{{ $objective->id }}"
143 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 146
                                     {{ $objective->text }}
147 147
 
148 148
 
@@ -311,6 +311,8 @@
311 311
             );
312 312
         }
313 313
 
314
+
315
+
314 316
         var counter = 1;
315 317
         var counterAssoc = 0;
316 318
         //Add Another Outcome
@@ -339,7 +341,7 @@
339 341
 
340 342
         function addOutcomeTest() {
341 343
             var $select = $('<select/>', {
342
-                'class': "selectpicker form-control",
344
+                'class': "selectpicker form-control createOutcome",
343 345
                 'name': "outcome[" + counter.toString() + "]",
344 346
                 'data-live-search': 'true'
345 347
 
@@ -406,7 +408,7 @@
406 408
 
407 409
                     // Select associated outcome
408 410
                     $(".removable-outcome").remove();
409
-                    $('.alert-dismissible').remove();
411
+                    $('.warning-objective').remove();
410 412
                     $('#assoc_outcome0').val(json.outcome[0].outcome_id);
411 413
 
412 414
                     disabled = 0;
@@ -466,7 +468,7 @@
466 468
 
467 469
                     if (disabled == 1) {
468 470
                         alert = $('<div/>', {
469
-                            'class': 'alert alert-danger alert-dismissible',
471
+                            'class': 'alert alert-danger alert-dismissible warning-objective',
470 472
                             'role': 'alert'
471 473
                         })
472 474
                         button = $('<button/>', {