Gabriel Santiago Plaza 3 роки тому
джерело
коміт
71ac151280

+ 15
- 5
app/controllers/ActivitiesController.php Переглянути файл

@@ -204,6 +204,7 @@ class ActivitiesController extends \BaseController
204 204
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
205 205
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
206 206
             ->get();
207
+        Log::info("EN mi cuarto o o o");
207 208
         Log::info($rubric_criterion);
208 209
         foreach ($rubric_criterion as $index => $singleCR) {
209 210
             $singleCR->scales = json_encode(DB::table('scales')
@@ -232,12 +233,12 @@ class ActivitiesController extends \BaseController
232 233
         $scores_array = array();
233 234
 
234 235
         foreach ($assessments as $index => $assessment) {
235
-            $scores_array[$assessment->student_id][] = $assessment->score;
236
+            $scores_array[$assessment->student_id][$assessment->activity_criterion_id] = $assessment->score;
236 237
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
237 238
                 ->where("activity_id", '=', $activity->id)
238 239
                 ->select('comments')->first()->comments;
239 240
         }
240
-
241
+        Log::info($assessments);
241 242
         Log::info($scores_array);
242 243
 
243 244
 
@@ -774,11 +775,12 @@ class ActivitiesController extends \BaseController
774 775
         // Get rubric contents
775 776
         $rubric = Rubric::find($activity->rubric[0]->id);
776 777
 
778
+
777 779
         $rubric->titles = DB::table('titles')
778 780
             ->join('rubric_title', 'rubric_title.title_id', '=', 'titles.id')
779 781
             ->where('rubric_id', $rubric->id)
780
-            ->get();
781
-
782
+            ->orderBy("position", 'ASC')
783
+            ->lists('text');
782 784
         //$rubric_contents = Rubric::select('contents')->where('id', '=', $activity->rubric_id)->get();
783 785
         //$rubric_contents = json_decode($rubric_contents['0']->contents);
784 786
 
@@ -792,6 +794,8 @@ class ActivitiesController extends \BaseController
792 794
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
793 795
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
794 796
             ->get();
797
+        Log::info("EN mi cuarto o o o");
798
+        Log::info($rubric_criterion);
795 799
 
796 800
         foreach ($rubric_criterion as $index => $crit) {
797 801
             $crit->scales = DB::table('scales')
@@ -815,7 +819,7 @@ class ActivitiesController extends \BaseController
815 819
         $scores_array = array();
816 820
 
817 821
         foreach ($assessments as $index => $assessment) {
818
-            $scores_array[$assessment->student_id][] = $assessment->score;
822
+            $scores_array[$assessment->student_id][$assessment->activity_criterion_id][] = $assessment->score;
819 823
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
820 824
                 ->where("activity_id", '=', $activity->id)
821 825
                 ->select('comments')->first()->comments;
@@ -853,6 +857,12 @@ class ActivitiesController extends \BaseController
853 857
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
854 858
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
855 859
             ->get();
860
+        $rubric->titles = DB::table('titles')
861
+            ->join('rubric_title', 'rubric_title.titles_id', '=', 'titles.id')
862
+            ->where('rubric_id', $rubric->id)
863
+            ->orderBy("position", 'ASC')
864
+            ->lists('text');
865
+
856 866
 
857 867
         foreach ($rubric_contents as $index => $crit) {
858 868
             $crit->scales = DB::table('scales')

+ 1
- 0
app/controllers/RubricsController.php Переглянути файл

@@ -443,6 +443,7 @@ class RubricsController extends \BaseController
443 443
 
444 444
     public function fetchRubricCriterion()
445 445
     {
446
+        Log::info(Input::all());
446 447
         $rubric = DB::table("criterion_scale")
447 448
             ->join('scales', 'scales.id', '=', 'criterion_scale.scale_id')
448 449
             ->where("criterion_id", '=', Input::get('criterion_id'))

+ 25
- 1
app/controllers/TemplatesController.php Переглянути файл

@@ -389,6 +389,30 @@ class TemplatesController extends \BaseController
389 389
 	{
390 390
 		try {
391 391
 			$template = Template::find($id);
392
+			$template->titles = DB::table('titles')
393
+				->join('template_title', 'template_title.title_id', '=', 'titles.id')
394
+				->where("template_id", $template->id)
395
+				->orderBy('position', 'ASC')
396
+				->lists('text');
397
+			$template_criterion = DB::table('template_criterion')
398
+				->join('criteria', 'criteria.id', '=', 'template_criterion.criterion_id')
399
+				->where('template_id', $template->id)
400
+				->orderBy('position', 'ASC')
401
+				->get();
402
+
403
+			foreach ($template_criterion as $single_crit) {
404
+				$single_crit->scales = DB::table('criterion_scale')
405
+					->join('scales', 'criterion_scale.scale_id', '=', 'scales.id')
406
+					->where('criterion_id', $single_crit->id)
407
+					->orderBy('position')
408
+					->lists('description');
409
+				$single_crit->outcomes = DB::table('outcomes')
410
+					->join('criterion_objective_outcome', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
411
+					->where('criterion_id', $single_crit->id)
412
+					->select('name')
413
+					->distinct()
414
+					->lists('name');
415
+			}
392 416
 
393 417
 			$title = $template->name;
394 418
 
@@ -402,7 +426,7 @@ class TemplatesController extends \BaseController
402 426
 			else
403 427
 				$program = 'All Programs';
404 428
 
405
-			return View::make('local.managers.shared.print_rubric', compact('title', 'template', 'school', 'program'));
429
+			return View::make('local.managers.shared.print_rubric', compact('title', 'template_criterion', 'template', 'school', 'program'));
406 430
 		} catch (Exception $e) {
407 431
 			Session::flash('status', 'danger');
408 432
 			Session::flash('message', $e->getMessage());

+ 39
- 0
app/database/migrations/2021_08_27_142254_add_level_modality_gender_student.php Переглянути файл

@@ -0,0 +1,39 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+use Illuminate\Support\Facades\Schema;
6
+
7
+class AddLevelModalityGenderStudent extends Migration
8
+{
9
+
10
+	/**
11
+	 * Run the migrations.
12
+	 *
13
+	 * @return void
14
+	 */
15
+	public function up()
16
+	{
17
+		Schema::table('students', function (Blueprint $table) {
18
+
19
+			$table->integer('level')->unsigned();
20
+			$table->char("modality", 1);
21
+			$table->char('gender', 4);
22
+		});
23
+	}
24
+
25
+	/**
26
+	 * Reverse the migrations.
27
+	 *
28
+	 * @return void
29
+	 */
30
+	public function down()
31
+	{
32
+		Schema::table('students', function (Blueprint $table) {
33
+
34
+			$table->dropColumn("level");
35
+			$table->dropColumn('modality');
36
+			$table->dropColumn('gender');
37
+		});
38
+	}
39
+}

+ 35
- 0
app/database/migrations/2021_08_27_142509_add_degree_to_programs.php Переглянути файл

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

+ 33
- 0
app/database/migrations/2021_08_27_142937_add_modality_to_course.php Переглянути файл

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

+ 18
- 12
app/views/local/managers/shared/print_rubric.blade.php Переглянути файл

@@ -121,17 +121,16 @@ echo
121 121
     <tr>
122 122
       <th></th>
123 123
       <th>Criterion</th>
124
-      <th>Beginning (1-2)</th>
125
-      <th>In Progress (3-4)</th>
126
-      <th>Good (5-6)</th>
127
-      <th>Excellent (7-8)</th>
124
+      @foreach($template->titles as $i=>$title)
125
+      <th>{{$title}} ({{1+($i*($template->max_score/$template->num_scales))}}-{{(1+$i)*($template->max_score/$template->num_scales)}})</th>
126
+      @endforeach
128 127
       <th>Learning Outcome</th>
129 128
       <th>Copyright</th>
130 129
       <th>Notes</th>
131 130
     </tr>
132 131
   </thead>
133 132
   <tbody>
134
-  @foreach(json_decode($template->contents) as $index => $criterion)
133
+  @foreach($template_criterion as $index => $criterion)
135 134
     <tr>
136 135
       <td>{{ $index + 1 }}.</td>
137 136
       <td>
@@ -139,17 +138,24 @@ echo
139 138
 
140 139
         @if(property_exists($criterion, 'subcriteria'))
141 140
           <ul class="list-unstyled">
142
-            @foreach($criterion->subcriteria as $subcriterion)
141
+            @foreach(json_decode($criterion->subcriteria) as $subcriterion)
143 142
                 <li>{{ $subcriterion }}</li>
144 143
             @endforeach
145 144
           </ol>
146 145
         @endif
147 146
       </td>
148
-      <td>{{{ $criterion->description12 }}}</td>
149
-      <td>{{{ $criterion->description34 }}}</td>
150
-      <td>{{{ $criterion->description56 }}}</td>
151
-      <td>{{{ $criterion->description78 }}}</td>
152
-      <td>{{{ Outcome::where('id', $criterion->outcome_id)->first()->name }}}</td>
147
+      @foreach($criterion->scales as $index=>$description)
148
+      <td>{{{ $description }}}</td>
149
+      @endforeach
150
+      
151
+      <td>
152
+        <ol>
153
+        @foreach($criterion->outcomes as $outcome)
154
+        <li>{{$outcome}}</li>
155
+
156
+        @endforeach
157
+        </ol>
158
+      </td>
153 159
       <td>
154 160
       @if($criterion->copyright)
155 161
         {{{ $criterion->copyright }}}
@@ -166,7 +172,7 @@ echo
166 172
 </table>
167 173
 
168 174
 
169
-<?
175
+<?php
170 176
 
171 177
 echo '</body>';
172 178
 echo '</html>';

+ 24
- 16
app/views/local/managers/shared/rubrics.blade.php Переглянути файл

@@ -316,7 +316,22 @@
316 316
     </div>
317 317
 </div>
318 318
 <script>
319
-    // --------------------------------------------------------------------------
319
+  
320
+    </script>
321
+@stop
322
+
323
+@section('included-js')
324
+
325
+<!-- jQuery Sortable Tables -->
326
+<script src="{{ asset('vendor/jQuerySortable/jquery-sortable-min.js') }}"></script>
327
+
328
+<!-- X-Editable js -->
329
+<script src="{{ asset('vendor/xeditable/bootstrap-editable.min.js') }}"></script>
330
+
331
+@stop
332
+
333
+@section('javascript')
334
+// --------------------------------------------------------------------------
320 335
 // Functions
321 336
 // --------------------------------------------------------------------------
322 337
 
@@ -742,6 +757,7 @@ function loadTemplate()
742 757
             $('#expected_percentage').val(data.template.expected_percentage);
743 758
             
744 759
             $('#expected_points').val(data.template.expected_points);
760
+            
745 761
             $('#number_of_scales').val(data.template.num_scales);
746 762
             refreshSelects();
747 763
             changeTable();
@@ -913,6 +929,9 @@ function loadTemplate()
913 929
         // Enable print button
914 930
         $('#button-print-rubric').prop('disabled', false);
915 931
 
932
+        fetchCriteria($('#select-outcome'), $('#select-objective'));
933
+
934
+
916 935
         }, 
917 936
         'json',
918 937
     );
@@ -1118,6 +1137,10 @@ $('#max_score').on('change', function(){
1118 1137
 })
1119 1138
 $('#number_of_scales').on('change', function(){
1120 1139
     changeTable();
1140
+    $('#rubric-container').hide();
1141
+    $('#rubric-name').val('');
1142
+    $('tbody').empty();
1143
+
1121 1144
 })
1122 1145
 // When a learning outcome changes, update its criteria
1123 1146
 /*$('#select-outcome, input[name=criteria-filter]').on('change', function()
@@ -1311,21 +1334,6 @@ $('#button-print-rubric').on('click', function(e)
1311 1334
 
1312 1335
 });
1313 1336
 
1314
-    </script>
1315
-@stop
1316
-
1317
-@section('included-js')
1318
-
1319
-<!-- jQuery Sortable Tables -->
1320
-<script src="{{ asset('vendor/jQuerySortable/jquery-sortable-min.js') }}"></script>
1321
-
1322
-<!-- X-Editable js -->
1323
-<script src="{{ asset('vendor/xeditable/bootstrap-editable.min.js') }}"></script>
1324
-
1325
-@stop
1326
-
1327
-@section('javascript')
1328
-
1329 1337
 // --------------------------------------------------------------------------
1330 1338
 // Page load
1331 1339
 // --------------------------------------------------------------------------

+ 3
- 5
app/views/local/professors/assessment.blade.php Переглянути файл

@@ -144,10 +144,8 @@
144 144
                                 
145 145
                                 @for ($j=0; $j<=$rubric->max_score; $j++)
146 146
                                     <!-- If the decoded scores with index as the assessment id and second index as criterion id equals the loop index, mark it as selected -->
147
-                                    <?php
148
-                                    Log::info($scores_array);
149
-                                    ?>
150
-                                    @if(array_key_exists($student->id, $scores_array) && $j ==  $scores_array[$student->id][$i])
147
+
148
+                                    @if(array_key_exists($student->id, $scores_array) && isset($scores_array[$student->id][$rubric_criterion[$i]->activity_criterion_id]) && $j ==  $scores_array[$student->id][$rubric_criterion[$i]->activity_criterion_id])
151 149
                                         <option value="{{$j}}" selected="selected">{{ $j }}</option>
152 150
                                     @else
153 151
                                         <option value="{{$j}}">{{ $j }}</option>
@@ -155,7 +153,7 @@
155 153
                                 @endfor
156 154
 
157 155
                                 <!-- N/A option -->
158
-                                @if( !array_key_exists($student->id, $scores_array)|| isset($scores_array[$student->id][$i]))
156
+                                @if( !array_key_exists($student->id, $scores_array)|| !isset($scores_array[$student->id][$rubric_criterion[$i]->activity_criterion_id]))
159 157
                                     <option value="N/A" selected="selected">N/A</option>
160 158
                                 @else
161 159
                                     <option value="N/A">N/A</option>

+ 5
- 5
app/views/local/professors/print_assessment.blade.php Переглянути файл

@@ -131,18 +131,18 @@ echo
131 131
             <!-- If the activity was assessed, load the assessment.-->
132 132
             @if(sizeof($assessments)!=0)
133 133
                 <!-- For each assessment -->
134
-                @foreach ($assessments as $assessment)
134
+                @foreach ($students as $student)
135 135
                     <tr class="student-row">
136 136
                         <!-- Fetch student name -->
137
-                        <td class="student-field" data-student-id="{{ $assessment->student_id }}">
138
-                            {{{ Student::find($assessment->student_id)->name }}}
137
+                        <td class="student-field" data-student-id="{{ $student->id }}">
138
+                            {{{ $student->name }}}
139 139
                         </td>
140 140
 
141 141
                         <!-- For each criterion in the rubric, there's a score field -->
142 142
                         @for ($i = 0; $i<sizeof($rubric_contents); $i++)
143 143
                             <td class="score-field">
144
-                                @if(array_key_exists($assessment->student_id, $scores_array)&& isset($scores_array[$assessment->student_id][$i]))
145
-                                {{ $scores_array[$assessment->student_id][$i] }}
144
+                                @if(array_key_exists($student->id, $scores_array)&& isset($scores_array[$student->id][$i]))
145
+                                {{ $scores_array[$student->id][$i] }}
146 146
                                 @else
147 147
                                 N/A
148 148
                                 @endif

+ 15
- 14
app/views/local/professors/view_assessment.blade.php Переглянути файл

@@ -24,10 +24,10 @@
24 24
             <div class="modal-body">
25 25
                 <table class="table table-bordered">
26 26
                     <thead>
27
-                        <th>Beginning (1-2)</th>
28
-                        <th>In Progress (3-4)</th>
29
-                        <th>Good (5-6)</th>
30
-                        <th>Excellent (7-8)</th>
27
+                        @foreach($rubric->titles as $i=>$title)
28
+                        <th>{{$title}} ({{1+($i*($rubric->max_score/$rubric->num_scales))}}-{{(1+$i)*($rubric->max_score/$rubric->num_scales)}})</th>
29
+                        @endforeach
30
+                        
31 31
                         <th>Notes</th>
32 32
                     </thead>
33 33
                     <tbody>
@@ -297,23 +297,24 @@ $('.criterion-field').on('click', function()
297 297
 {
298 298
     $.ajax({
299 299
         type: 'POST',
300
-        url: "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}",
301
-        data: { id: $(this).data('criterion-id') },
300
+        url: "{{ URL::action('RubricsController@fetchRubricCriterion') }}",
301
+        data: { criterion_id: $(this).data('criterion-id') },
302 302
         success: function(data)
303 303
         {
304
-            $('.modal-title').html(data.name);
305
-
304
+            data = JSON.parse(data);
305
+            $('.modal-title').html(data.criteria.name);
306
+            descriptions = '';
306 307
             $('.modal-body tbody tr').empty();
308
+            for(i =0; i<{{$rubric->num_scales}}; i++){
309
+                descriptions += '<td>'+data[i].description+'</td>'
310
+            }
307 311
             $('.modal-body tbody tr').append
308 312
             (
309
-                '<td>'+data.description12+'</td>'
310
-                +'<td>'+data.description34+'</td>'
311
-                +'<td>'+data.description56+'</td>'
312
-                +'<td>'+data.description78+'</td>'
313
+                descriptions
313 314
             );
314 315
 
315
-            if(data.notes!=null)
316
-                $('.modal-body tbody tr').append('<td>'+data.notes+'</td>');
316
+            if(data.criteria.notes!=null)
317
+                $('.modal-body tbody tr').append('<td>'+data.criteria.notes+'</td>');
317 318
             else
318 319
                 $('.modal-body tbody tr').append('<td></td>');
319 320