소스 검색

adicion de 'objectives and criteria'

-se creo una pagina para ver objectives and criteria, similar a ver learning outcomes and criteria.
onielm 4 년 전
부모
커밋
2587571461

+ 43
- 5
app/controllers/CriteriaController.php 파일 보기

@@ -300,11 +300,8 @@ class CriteriaController extends \BaseController {
300 300
 
301 301
     public function index()
302 302
     {
303
-        // para conseguir el ID de los semestres que el usuario tiene seleccionado.
304
-        $semesters_ids = array();
305
-        foreach(Session::get('semesters_ids') as $id){
306
-          array_push($semesters_ids, $id);
307
-        }
303
+        // el ID de los semestres que el usuario tiene seleccionado.
304
+        $semesters_ids = Session::get('semesters_ids');
308 305
         // buscar informacion de los semestres seleccionados
309 306
         $semesters = Semester::whereIn('id',$semesters_ids)->get();
310 307
 
@@ -318,6 +315,47 @@ class CriteriaController extends \BaseController {
318 315
 
319 316
     }
320 317
 
318
+    // copie index() y lo edite
319
+    public function objectivesIndex()
320
+    {
321
+        if(Auth::user()->role==1)
322
+        {
323
+          //uscar todos los objetivos
324
+          $objectives = DB::table('program_user')
325
+                                ->join('objectives','objectives.program_id','=','program_user.program_id')
326
+                                ->join('programs','programs.id','=','program_user.program_id')
327
+                                ->select('objectives.id','objectives.text','programs.name')
328
+                                ->orderBy('objectives.text', 'asc')
329
+                                ->get();
330
+        }
331
+        elseif(Auth::user()->role==2)
332
+        {
333
+          //buscar los objetivos de la departamento (school)
334
+          $objectives = DB::table('program_user')
335
+                                ->join('objectives','objectives.program_id','=','program_user.program_id')
336
+                                ->join('programs','programs.id','=','program_user.program_id')
337
+                                ->where('programs.school_id',Auth::user()->school_id)
338
+                                ->select('objectives.id','objectives.text','programs.name')
339
+                                ->orderBy('objectives.text', 'asc')
340
+                                ->get();
341
+        }
342
+        elseif((Auth::user()->role==3) || (Auth::user()->role==4))
343
+        {
344
+          //buscar los objetivos de los programas cuales el profesor esta
345
+          $objectives = DB::table('program_user')
346
+                                ->join('objectives','objectives.program_id','=','program_user.program_id')
347
+                                ->join('programs','programs.id','=','program_user.program_id')
348
+                                ->where('program_user.user_id',Auth::user()->id)
349
+                                ->select('objectives.id','objectives.text','programs.name')
350
+                                ->orderBy('objectives.text', 'asc')
351
+                                ->get();
352
+        }
353
+
354
+        $title = "Learning Objectives and Criteria";
355
+
356
+        return View::make('global.view-objectives-criteria', compact('title', 'objectives'));
357
+    }
358
+
321 359
     public function destroy()
322 360
     {
323 361
         $criterion = Criterion::withTrashed()->find(Input::get('id'));

+ 15
- 0
app/controllers/ObjectivesController.php 파일 보기

@@ -234,4 +234,19 @@ class ObjectivesController extends \BaseController {
234 234
 
235 235
     return json_encode($res);
236 236
   }
237
+
238
+  public function fetchObjectiveForCriteria()
239
+  {
240
+      $id = Input::get('id');
241
+
242
+      $objective = Objective::find($id);
243
+
244
+      $objective->program;
245
+      $objective->criteria;
246
+
247
+      return array
248
+      (
249
+          'objective' => $objective
250
+      );
251
+  }
237 252
 }

+ 4
- 0
app/routes.php 파일 보기

@@ -226,6 +226,9 @@ Route::group(array('before' => 'auth|has_access'), function()
226 226
     // Show users all learning outcomes and criteria
227 227
     Route::get('learning-outcomes-criteria', 'CriteriaController@index');
228 228
     Route::post('fetchOutcome', array('before' => 'csrf', 'uses'=>'OutcomesController@fetchOutcome'));
229
+    // Show users all objectives and criteria
230
+    Route::get('learning-objectives-criteria', 'CriteriaController@objectivesIndex');
231
+    Route::post('fetchObjectiveForCriteria', array('before' => 'csrf', 'uses'=>'ObjectivesController@fetchObjectiveForCriteria'));
229 232
 
230 233
     // Show professor overview to users with courses
231 234
     Route::get('professor', 'ProfessorsController@overview');
@@ -392,6 +395,7 @@ Route::group(array('before' => 'auth|has_access'), function()
392 395
         Route::post('updateRubric', array('before' => 'csrf', 'uses'=>'RubricsController@update'));
393 396
         Route::post('deleteRubric', array('before' => 'csrf', 'uses'=>'RubricsController@destroy'));
394 397
         Route::get('learning-outcomes-criteria', 'CriteriaController@index');
398
+        Route::get('learning-objectives-criteria', 'CriteriaController@objectivesIndex');
395 399
         Route::get('export_grades/{id}', 'CoursesController@exportGrades');
396 400
 
397 401
         // Assessment reports

+ 0
- 2
app/views/global/view-learning-outcomes-criteria.blade.php 파일 보기

@@ -19,11 +19,9 @@
19 19
       <div class="list-group">
20 20
         @foreach ($outcomes as $outcome)
21 21
           @foreach ($semesters as $semester)
22
-            {{-- activation_date --}}
23 22
             @if(!$outcome->deleted_at && $outcome->activation_date >= $semester->start && $outcome->activation_date <= $semester->end)
24 23
               {{-- <li data-outcome-id="{{ $outcome->id }}"class="list-group-item">{{ $outcome->name }}</li> --}}
25 24
               <li data-outcome-id="{{ $outcome->id }}"class="list-group-item">{{ $outcome->name }} [{{$semester->code}}]</li>
26
-              {{-- <li data-outcome-id="{{ $outcome->id }}"class="list-group-item">[{{$semester->code}}] {{ $outcome->name }}</li> --}}
27 25
             @endif
28 26
           @endforeach
29 27
         @endforeach

+ 145
- 0
app/views/global/view-objectives-criteria.blade.php 파일 보기

@@ -0,0 +1,145 @@
1
+@extends('layouts.master')
2
+
3
+@section('navigation')
4
+    @if(Auth::user()->role==1)
5
+      @include('local.managers.admins._navigation')
6
+    @elseif(Auth::user()->role==2)
7
+      @include('local.managers.sCoords._navigation')
8
+    @elseif(Auth::user()->role==3)
9
+      @include('local.managers.pCoords._navigation')
10
+    @elseif(Auth::user()->role==4)
11
+      @include('local.professors._navigation')
12
+    @endif
13
+@stop
14
+
15
+@section('main')
16
+
17
+  <div class="row">
18
+    <div class="col-md-3">
19
+      <div class="list-group">
20
+        @foreach ($objectives as $objective)
21
+          <li data-objective-id="{{ $objective->id }}"class="list-group-item">{{ $objective->text }}</li>
22
+        @endforeach
23
+      </div>
24
+    </div>
25
+
26
+    <div class="col-md-9">
27
+      <div id="objective-display" class="panel panel-default">
28
+        <div class="panel-heading">
29
+          <h4 class=" panel-title" style="cursor:auto!important;">
30
+          </h4>
31
+        </div>
32
+        <div class="panel-body">
33
+          <p class="objective-definition "></p>
34
+            <div class="table-responsive">
35
+                <table class="table table-striped table-condensed datatable">
36
+                  <thead><tr><th>Criterion</th><th>Beginning (1-2)</th><th>In Progress (3-4)</th><th>Satisfactory (5-6)</th><th>Excellent (7-8)</th></tr></thead>
37
+                  <tfoot>
38
+                      <tr class="column-search">
39
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
40
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
41
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
42
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
43
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
44
+                      </tr>
45
+                  </tfoot>
46
+                  <tbody>
47
+                  </tbody>
48
+                </table>
49
+            </div>
50
+
51
+        </div>
52
+      </div>
53
+    </div>
54
+
55
+    <div class="col-md-9">
56
+      <div class="no-objective alert alert-info">
57
+        <p>Select a Learning Objective to view its information</p>
58
+      </div>
59
+    </div>
60
+
61
+  </div>
62
+@stop
63
+
64
+@section('included-js')
65
+    @include('global._datatables_js')
66
+@stop
67
+
68
+@section('javascript')
69
+
70
+$(document).ready(function()
71
+{
72
+  // --------------------------------------------------------------------------
73
+  // Page load
74
+  // --------------------------------------------------------------------------
75
+
76
+  // Hide accordion panel contents by default
77
+  $('.panel-group .panel-body').hide();
78
+
79
+  $('#objective-display').parent().hide();
80
+
81
+  // --------------------------------------------------------------------------
82
+  // Functions
83
+  // --------------------------------------------------------------------------
84
+
85
+  // --------------------------------------------------------------------------
86
+  // Events
87
+  // --------------------------------------------------------------------------
88
+
89
+  // When list item is clicked, load corresponding info
90
+  $('.list-group-item').on('click', function()
91
+  {
92
+    var id = $(this).data('objective-id');
93
+
94
+    $.post(
95
+    "{{ URL::action('ObjectivesController@fetchObjectiveForCriteria') }}",
96
+    { id: id },
97
+    function(json)
98
+    {
99
+        // Retrieve datatable instance
100
+        var table = $('.datatable').DataTable();
101
+
102
+        var name = json.objective.text;
103
+        var definition = json.objective.program.name;
104
+        var criteria =json.objective.criteria;
105
+
106
+        $('#objective-display').parent().show();
107
+        $('.no-objective').parent().hide();
108
+
109
+        //Display title and definition
110
+        $('#objective-display .panel-title').html(name);
111
+        $('#objective-display .objective-definition').html(definition);
112
+
113
+        //Empty table
114
+        table.clear();
115
+
116
+        // Add new criteria
117
+        if(criteria.length>0)
118
+        {
119
+          $('table').show();
120
+          $.each(criteria, function(index, value)
121
+          {
122
+              table.row.add([
123
+                value.name,
124
+                value.description12,
125
+                value.description34,
126
+                value.description56,
127
+                value.description78
128
+              ]);
129
+          });
130
+        }
131
+        else
132
+        {
133
+          $('table').hide();
134
+        }
135
+
136
+        // Update display
137
+        table.draw();
138
+    },
139
+    'json'
140
+    );
141
+
142
+  })
143
+});
144
+
145
+@stop

+ 9
- 1
app/views/local/managers/admins/_navigation.blade.php 파일 보기

@@ -16,7 +16,15 @@
16 16
           <li>{{ HTML::linkAction('UsersController@index', 'Users') }}</li>
17 17
         </ul>
18 18
       </li>
19
-      <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li>
19
+      {{-- la linea siguiente comentada es lo que habia originalmente. tanto la linea como este comentario se pueden borrar --}}
20
+      {{-- <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li> --}}
21
+      <li class="dropdown">
22
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Learning and Criterias<span class="caret"></span></a>
23
+        <ul class="dropdown-menu" role="menu">
24
+          <li>{{ HTML::linkAction('CriteriaController@index', 'Outcomes and Criteria') }}</li>
25
+          <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'Objectives and Criteria') }}</li>
26
+        </ul>
27
+      </li>
20 28
       <li class="dropdown">
21 29
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Colleges and Schools<span class="caret"></span></a>
22 30
         <ul class="dropdown-menu" role="menu">

+ 9
- 1
app/views/local/managers/pCoords/_navigation.blade.php 파일 보기

@@ -6,7 +6,15 @@
6 6
     <ul class="nav navbar-nav navbar-right">
7 7
       <li>{{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Overview') }}</li>
8 8
       <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubrics') }}</li>
9
-      <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li>
9
+      {{-- la linea siguiente comentada es lo que habia originalmente. tanto la linea como este comentario se pueden borrar --}}
10
+      {{-- <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li> --}}
11
+      <li class="dropdown">
12
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Learning and Criterias<span class="caret"></span></a>
13
+        <ul class="dropdown-menu" role="menu">
14
+          <li>{{ HTML::linkAction('CriteriaController@index', 'Outcomes and Criteria') }}</li>
15
+          <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'Objectives and Criteria') }}</li>
16
+        </ul>
17
+      </li>
10 18
       @if(count(Auth::user()->courses))
11 19
       <li> {{ HTML::linkAction('ProfessorsController@overview', 'My Courses', NULL) }}</li>
12 20
       <li class="dropdown">

+ 9
- 1
app/views/local/managers/sCoords/_navigation.blade.php 파일 보기

@@ -6,7 +6,15 @@
6 6
     <ul class="nav navbar-nav navbar-right">
7 7
       <li>{{ HTML::linkAction('SchoolCoordinatorsController@overview', 'Overview') }}</li>
8 8
       <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubrics') }}</li>
9
-      <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li>
9
+      {{-- la linea siguiente comentada es lo que habia originalmente. tanto la linea como este comentario se pueden borrar --}}
10
+      {{-- <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li> --}}
11
+      <li class="dropdown">
12
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Learning and Criterias<span class="caret"></span></a>
13
+        <ul class="dropdown-menu" role="menu">
14
+          <li>{{ HTML::linkAction('CriteriaController@index', 'Outcomes and Criteria') }}</li>
15
+          <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'Objectives and Criteria') }}</li>
16
+        </ul>
17
+      </li>
10 18
       @if(count(Auth::user()->courses))
11 19
       <li> {{ HTML::linkAction('ProfessorsController@overview', 'My Courses', NULL) }}</li>
12 20
       <li class="dropdown">

+ 9
- 1
app/views/local/professors/_navigation.blade.php 파일 보기

@@ -6,7 +6,15 @@
6 6
     </div>-->
7 7
     <ul class="nav navbar-nav navbar-right">
8 8
       <li>{{ HTML::linkAction('ProfessorsController@overview', 'My Courses') }}</li>
9
-      <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li>
9
+      {{-- la linea siguiente comentada es lo que habia originalmente. tanto la linea como este comentario se pueden borrar --}}
10
+      {{-- <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li> --}}
11
+      <li class="dropdown">
12
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Learning and Criterias<span class="caret"></span></a>
13
+        <ul class="dropdown-menu" role="menu">
14
+          <li>{{ HTML::linkAction('CriteriaController@index', 'Outcomes and Criteria') }}</li>
15
+          <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'Objectives and Criteria') }}</li>
16
+        </ul>
17
+      </li>
10 18
       @if(count(Auth::user()->courses))
11 19
         <li class="dropdown">
12 20
           <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Sections<span class="caret"></span></a>