Kaynağa Gözat

Merge branch 'oniel-progreso' into gabriel_branch

Gabriel Santiago Plaza 3 yıl önce
ebeveyn
işleme
685b1a7209

+ 45
- 3
app/controllers/CriteriaController.php Dosyayı Görüntüle

@@ -8,7 +8,7 @@ class CriteriaController extends \BaseController
8 8
     /**
9 9
      * Display a listing of the resource.
10 10
      *
11
-     * 
11
+     *
12 12
      * @return Response
13 13
      */
14 14
     public function editProgram()
@@ -236,7 +236,7 @@ class CriteriaController extends \BaseController
236 236
         } else {
237 237
             // Check criterion uniqueness
238 238
             /*if (!$this->isCriterionUnique($clean_input)) {
239
-                /** Send error message and old data 
239
+                /** Send error message and old data
240 240
                 Session::flash('status', 'danger');
241 241
                 Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name and associated program are the same.');
242 242
                 return Redirect::to('criteria')->withInput();
@@ -590,7 +590,7 @@ class CriteriaController extends \BaseController
590 590
         // el ID de los semestres que el usuario tiene seleccionado.
591 591
         $semesters_ids = Session::get('semesters_ids');
592 592
         // buscar informacion de los semestres seleccionados
593
-        $semesters = Semester::whereIn('id', $semesters_ids)->get();
593
+        $semesters = Semester::whereIn('id',$semesters_ids)->get();
594 594
 
595 595
         $title = "Learning Outcomes and Criteria";
596 596
         $outcomes = Outcome::orderBy('name', 'ASC')->get();
@@ -599,6 +599,48 @@ class CriteriaController extends \BaseController
599 599
 
600 600
         // se annadio la nueva variable
601 601
         return View::make('global.view-learning-outcomes-criteria', compact('title', 'outcomes', 'schools', 'criteria', 'semesters'));
602
+
603
+    }
604
+
605
+    // copie index() y lo edite
606
+    public function objectivesIndex()
607
+    {
608
+        if(Auth::user()->role==1)
609
+        {
610
+          //uscar todos los objetivos
611
+          $objectives = DB::table('program_user')
612
+                                ->join('objectives','objectives.program_id','=','program_user.program_id')
613
+                                ->join('programs','programs.id','=','program_user.program_id')
614
+                                ->select('objectives.id','objectives.text','programs.name')
615
+                                ->orderBy('objectives.text', 'asc')
616
+                                ->get();
617
+        }
618
+        elseif(Auth::user()->role==2)
619
+        {
620
+          //buscar los objetivos de la departamento (school)
621
+          $objectives = DB::table('program_user')
622
+                                ->join('objectives','objectives.program_id','=','program_user.program_id')
623
+                                ->join('programs','programs.id','=','program_user.program_id')
624
+                                ->where('programs.school_id',Auth::user()->school_id)
625
+                                ->select('objectives.id','objectives.text','programs.name')
626
+                                ->orderBy('objectives.text', 'asc')
627
+                                ->get();
628
+        }
629
+        elseif((Auth::user()->role==3) || (Auth::user()->role==4))
630
+        {
631
+          //buscar los objetivos de los programas cuales el profesor esta
632
+          $objectives = DB::table('program_user')
633
+                                ->join('objectives','objectives.program_id','=','program_user.program_id')
634
+                                ->join('programs','programs.id','=','program_user.program_id')
635
+                                ->where('program_user.user_id',Auth::user()->id)
636
+                                ->select('objectives.id','objectives.text','programs.name')
637
+                                ->orderBy('objectives.text', 'asc')
638
+                                ->get();
639
+        }
640
+
641
+        $title = "Learning Objectives and Criteria";
642
+
643
+        return View::make('global.view-objectives-criteria', compact('title', 'objectives'));
602 644
     }
603 645
 
604 646
     public function destroy()

+ 8
- 5
app/routes.php Dosyayı Görüntüle

@@ -226,9 +226,10 @@ Route::group(array('before' => 'auth|has_access'), function () {
226 226
 
227 227
     // Show users all learning outcomes and criteria
228 228
     Route::get('learning-outcomes-criteria', 'CriteriaController@index');
229
+    Route::post('fetchOutcome', array('before' => 'csrf', 'uses'=>'OutcomesController@fetchOutcome'));
230
+    // Show users all objectives and criteria
229 231
     Route::get('learning-objectives-criteria', 'CriteriaController@objectivesIndex');
230
-    Route::post('fetchOutcome', array('before' => 'csrf', 'uses' => 'OutcomesController@fetchOutcome'));
231
-    Route::post('fetchObjectiveForCriteria', array('before' => 'csrf', 'uses' => 'ObjectivesController@fetchObjectiveForCriteria'));
232
+    Route::post('fetchObjectiveForCriteria', array('before' => 'csrf', 'uses'=>'ObjectivesController@fetchObjectiveForCriteria'));
232 233
 
233 234
     // Show professor overview to users with courses
234 235
     Route::get('professor', 'ProfessorsController@overview');
@@ -257,8 +258,9 @@ Route::group(array('before' => 'auth|has_access'), function () {
257 258
 
258 259
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@updateMore'));
259 260
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@update'));
260
-        Route::post('crtiteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
261
-        Route::delete('crtiteria/delete', array('before' => 'csrf', 'uses' => 'CriteriaController@destroy'));
261
+        Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@updateMore'));
262
+        Route::post('crtiteria/update', array('before' => 'csrf', 'uses'=>'CriteriaController@update'));
263
+        Route::delete('crtiteria/delete', array('before' => 'csrf', 'uses'=>'CriteriaController@destroy'));
262 264
 
263 265
         Route::get('administrator/users/{query?}', 'UsersController@index');
264 266
 
@@ -353,7 +355,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
353 355
         Route::post('updateObjective', array('before' => 'csrf', 'uses' => 'Objective2Controller@update'));
354 356
         Route::post('fetchObjectiveWithTrashed', array('before' => 'csrf', 'uses' => 'Objective2Controller@fetchObjectiveWithTrashed'));
355 357
 
356
-        // Five year plans, 
358
+        // Five year plans,
357 359
         Route::get('five-year-plans', 'FiveYearPlansController@index');
358 360
         Route::get('program/{program}/five-year-plans/create', 'FiveYearPlansController@create');
359 361
         Route::get('program/{program}/five-year-plans/{five_year_plan}', 'FiveYearPlansController@show');
@@ -410,6 +412,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
410 412
         Route::post('updateRubric', array('before' => 'csrf', 'uses' => 'RubricsController@update'));
411 413
         Route::post('deleteRubric', array('before' => 'csrf', 'uses' => 'RubricsController@destroy'));
412 414
         Route::get('learning-outcomes-criteria', 'CriteriaController@index');
415
+        Route::get('learning-objectives-criteria', 'CriteriaController@objectivesIndex');
413 416
         Route::get('export_grades/{id}', 'CoursesController@exportGrades');
414 417
         Route::get('learning-objectives-criteria', 'CriteriaController@objectivesIndex');
415 418
         // Assessment reports

+ 2
- 0
app/views/layouts/master.blade.php Dosyayı Görüntüle

@@ -164,6 +164,7 @@
164 164
         /////
165 165
 
166 166
         var table = null;
167
+        // var tables = [];
167 168
         $('.datatable').each(function()
168 169
         {
169 170
             table = $(this).DataTable({
@@ -270,6 +271,7 @@
270 271
                     }
271 272
                 ],
272 273
             });
274
+            // tables.push(table);
273 275
 
274 276
             // Apply the search
275 277
             table.columns().every( function ()

+ 1
- 1
app/views/local/managers/admins/_navigation.blade.php Dosyayı Görüntüle

@@ -82,4 +82,4 @@
82 82
     </li>
83 83
     </ul>
84 84
   </div>
85
-</div>
85
+</div>

+ 91
- 11
app/views/local/managers/admins/learning-outcomes.blade.php Dosyayı Görüntüle

@@ -15,33 +15,110 @@
15 15
     <div class="row">
16 16
         <div class="col-md-12">
17 17
             <p>Click on the values you want to change. Invalid values will be rejected automatically. To save your changes, click the 'Save' button at the bottom of the page.</p>
18
-            <table class="table table-striped table-condensed editable-table">
18
+            <table class="table table-striped table-condensed editable-table" id='outcomes_table'>
19 19
                 <thead><tr class="center-text">
20 20
                     <th class="col-md-4">Learning Outcome</th>
21 21
                     <th class="col-md-7">Definition</th>
22 22
                     <th class="col-md-1">Expected Value</th>
23
+                    <th class="col-md-2">Activation date</th>
24
+                    <th class="col-md-2">Deactivation date</th>
25
+                    <th class="col-md-1">Level</th>
23 26
 
24 27
                 </thead>
25 28
                 <tbody>
26
-                @foreach ($outcomes as $outcome)
27
-                    <tr data-id="{{ $outcome->id }}">
28
-                        <td contenteditable="true" class="name col-md-4" >{{ $outcome->name }}</td>
29
-                        <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ $outcome->definition }}</td>
30
-                        <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
31
-                    </tr>
32
-                @endforeach
29
+                  @foreach ($outcomes as $outcome)
30
+                    {{-- @foreach ($semesters as $semester) --}}
31
+                      {{-- display an outcome only if it is part of a currently selected semester --}}
32
+                      @if ((($outcome->deactivation_date == '0000-00-00') or ($outcome->deactivation_date == ''))
33
+                            // and ($outcome->activation_date >= $semester->start && $outcome->activation_date <= $semester->end)
34
+                            )
35
+                            <tr data-id="{{ $outcome->id }}">
36
+                                <td contenteditable="true" class="name col-md-4" >{{ $outcome->name }}</td>
37
+                                <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ $outcome->definition }}</td>
38
+                                <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
39
+                                <td contenteditable="true" class="activation-date col-md-2" >{{ $outcome->activation_date }}</td>
40
+                                <td contenteditable="true" class="deactivation-date col-md-2" >{{ $outcome->deactivation_date }}</td>
41
+                                <td contenteditable="true" class="level col-md-1" >{{ $outcome->level }}</td>
42
+                            </tr>
43
+                      @endif
44
+                    {{-- @endforeach --}}
45
+                  @endforeach
46
+                  @foreach ($outcomes as $outcome)
47
+                    {{-- @foreach ($semesters as $semester) --}}
48
+                      {{-- display an outcome only if it is part of a currently selected semester --}}
49
+                      @if ((($outcome->deactivation_date != '0000-00-00') and ($outcome->deactivation_date != ''))
50
+                            // and ($outcome->deactivation_date != '0000-00-00') and ($outcome->deactivation_date != '')
51
+                            )
52
+                            <tr data-id="{{ $outcome->id }}">
53
+                                <td contenteditable="true" class="name col-md-4" >{{ $outcome->name }}</td>
54
+                                <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ $outcome->definition }}</td>
55
+                                <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
56
+                                <td contenteditable="true" class="activation-date col-md-2" >{{ $outcome->activation_date }}</td>
57
+                                <td contenteditable="true" class="deactivation-date col-md-2" >{{ $outcome->deactivation_date }}</td>
58
+                                <td contenteditable="true" class="level col-md-1" >{{ $outcome->level }}</td>
59
+                            </tr>
60
+                      @endif
61
+                    {{-- @endforeach --}}
62
+                  @endforeach
33 63
                 </tbody>
34 64
             </table>
35 65
         </div>
36 66
     </div>
37 67
     <div class="row">
38
-        <div class="col-md-12"><button class="btn btn-lg btn-primary center-block">Save</button></div>
68
+      <div class="col-md-6"><button class="btn btn-lg btn-secondary center-block" id='show'>New Outcome</button></div>
69
+      <div class="col-md-6"><button class="btn btn-lg btn-primary center-block" id='save'>Save</button></div>
39 70
     </div>
71
+
72
+  <div class="" id='new_outcome_form'>
73
+    <h2>Add a new Learning Outcomes</h2>
74
+    {{-- For for adding a new outcome --}}
75
+    {{ Form::open(array('action' => 'OutcomesController@create')) }}
76
+      <div class="form-group">
77
+          {{ Form::label('name', 'Name') }}
78
+          {{ Form::text('name', '', array('class' => 'form-control', 'id'=>'outcome_name')) }}
79
+      </div>
80
+      <div class="form-group">
81
+          {{ Form::label('definition', 'Definition') }}
82
+          {{ Form::textarea('definition', 'At least 10 characters long', array('class' => 'form-control', 'id'=>'outcome_definition')) }}
83
+      </div>
84
+      Due to technical limitationss, the following must be edited after adding the new Outcome:
85
+      {{-- the technical limitation is: the Outcome Model has to be edited --}}
86
+      <ul>
87
+       <li>Expected Outcome</li>
88
+       <li>Activation Date</li>
89
+       <li>Deactivation Date</li>
90
+       <li>Level</li>
91
+      </ul>
92
+
93
+      <div class="row">
94
+        <div class="col-md-6"><button type="reset" class="btn btn-lg btn-secondary center-block" id='hide'>Hide Form</button></div>
95
+        <div class="col-md-6"><button type="submit" class="btn btn-lg btn-primary center-block">Submit New Outcome</button></div>
96
+      </div>
97
+      {{ Form::close() }}
98
+
99
+    <hr>
100
+  </div>
40 101
 @stop
41 102
 
42 103
 @section('javascript')
43 104
 
44
-        $('button').on('click', function(e)
105
+        $('#new_outcome_form').hide();
106
+
107
+        //show form
108
+        $('#show').on('click', function(e)
109
+        {
110
+          $('#new_outcome_form').show();
111
+          $('#show').hide();
112
+        });
113
+
114
+        //hide form
115
+        $('#hide').on('click', function(e)
116
+        {
117
+          $('#new_outcome_form').hide();
118
+          $('#show').show();
119
+        });
120
+
121
+        $('#save').on('click', function(e)
45 122
         {
46 123
             e.preventDefault();
47 124
 
@@ -56,6 +133,9 @@
56 133
                 outcomeObject.name= $(this).children('.name').text();
57 134
                 outcomeObject.definition= $(this).children('.definition').text();
58 135
                 outcomeObject.expected_outcome= $(this).children('.expected-outcome').text();
136
+                outcomeObject.activation_date= $(this).children('.activation-date').text();
137
+                outcomeObject.deactivation_date= $(this).children('.deactivation-date').text();
138
+                outcomeObject.level= $(this).children('.level').text();
59 139
 
60 140
                 if($(this).find('.glyphicon-eye-close').length>0)
61 141
                 {
@@ -70,7 +150,7 @@
70 150
             });
71 151
 
72 152
             $.post(
73
-                "{{ URL::action('OutcomesController@update') }}",
153
+                "{{ URL::action('OutcomesController@updateMore') }}",
74 154
                 { outcomeArray: JSON.stringify(outcomeArray)},
75 155
                 function(data)
76 156
                 {

+ 1
- 1
app/views/local/managers/pCoords/_navigation.blade.php Dosyayı Görüntüle

@@ -57,4 +57,4 @@
57 57
       </li>
58 58
     </ul>
59 59
   </div>
60
-</div>
60
+</div>

+ 1
- 1
app/views/local/managers/sCoords/_navigation.blade.php Dosyayı Görüntüle

@@ -56,4 +56,4 @@
56 56
       </li>
57 57
     </ul>
58 58
   </div>
59
-</div>
59
+</div>