Просмотр исходного кода

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

Para entrar migrations nuevos
Carlos J Corrada Bravo 3 лет назад
Родитель
Сommit
a153830965
48 измененных файлов: 3173 добавлений и 2538 удалений
  1. 10
    10
      app/controllers/ActivitiesController.php
  2. 1
    1
      app/controllers/AnnualPlansController.php
  3. 222
    114
      app/controllers/CriteriaController.php
  4. 104
    130
      app/controllers/ObjectivesController.php
  5. 35
    11
      app/controllers/OutcomesController.php
  6. 15
    15
      app/controllers/RubricsController.php
  7. 848
    838
      app/controllers/TransformativeActionsController.php
  8. 2
    2
      app/database/migrations/2021_06_01_000529_create_scales_table.php
  9. 2
    1
      app/database/migrations/2021_06_01_235626_create_criteria_table.php
  10. 2
    2
      app/database/migrations/2021_06_02_000507_create_rubrics_table.php
  11. 1
    0
      app/database/migrations/2021_06_03_001143_create_transformative_actions_table.php
  12. 3
    3
      app/database/migrations/2021_06_03_235944_create_courses_table.php
  13. 8
    8
      app/database/migrations/2021_06_04_003757_create_activities_table.php
  14. 1
    1
      app/database/migrations/2021_06_04_003810_create_activity_criterion_table.php
  15. 3
    2
      app/database/migrations/2021_06_05_235636_create_criterion_rubric.php
  16. 1
    0
      app/database/migrations/2021_06_05_235749_create_objective_outcome_table.php
  17. 7
    2
      app/database/migrations/2021_06_06_000025_create_criterion_objective_outcome_table.php
  18. 0
    38
      app/database/migrations/2021_06_06_000518_create_rubric_criteria_scales_table.php
  19. 8
    5
      app/database/migrations/2021_06_06_001211_create_transformative_objective_course_table.php
  20. 1
    0
      app/database/migrations/2021_06_07_001028_create_templates_criterion_table.php
  21. 0
    38
      app/database/migrations/2021_06_07_001036_create_templates_criterion_scale_table.php
  22. 3
    3
      app/database/migrations/2021_06_15_235856_create_annual_plan_transformative_table.php
  23. 0
    34
      app/database/migrations/2021_06_22_150017_delete_min_max_scales.php
  24. 0
    41
      app/database/migrations/2021_06_22_150108_add_copyright_notes_rubric_criterion.php
  25. 0
    34
      app/database/migrations/2021_06_22_150135_change_weight_float.php
  26. 31
    0
      app/database/migrations/2021_07_05_083455_create_titles.php
  27. 0
    43
      app/database/migrations/2021_07_06_075249_fix_activities.php
  28. 6
    1
      app/database/migrations/2021_07_06_082232_rubric_titles.php
  29. 6
    1
      app/database/migrations/2021_07_06_085513_template_titles.php
  30. 8
    12
      app/database/migrations/2021_07_22_092532_create_transformative_activity_criterion.php
  31. 2
    2
      app/database/old_migrations/2020_04_22_095649_create_new_criterion_rubric_table.php
  32. 2
    2
      app/database/old_migrations/2021_03_29_151507_create_transformative_objective_program.php
  33. 1
    1
      app/database/old_migrations/2021_05_20_184230_create_rubric_scales.php
  34. 5
    5
      app/database/seeds/FillNewAssessmentActivityCriterion.php
  35. 2
    2
      app/database/seeds/FillNewCriterionRubric.php
  36. 59
    1
      app/models/Activity.php
  37. 4
    2
      app/models/Course.php
  38. 44
    46
      app/models/Criterion.php
  39. 1
    1
      app/models/Objective.php
  40. 5
    0
      app/routes.php
  41. 356
    4
      app/views/global/view-learning-outcomes-criteria.blade.php
  42. 0
    1044
      app/views/local/managers/admins/new_criteria.blade.php
  43. 37
    12
      app/views/local/managers/pCoords/criteria.blade.php
  44. 1275
    0
      app/views/local/managers/pCoords/new_criteria.blade.php
  45. 45
    20
      app/views/local/managers/shared/rubrics.blade.php
  46. 5
    5
      app/views/local/professors/assessment.blade.php
  47. 1
    0
      app/views/local/professors/assessment_report.blade.php
  48. 1
    1
      app/views/local/professors/viewrubric.blade.php

+ 10
- 10
app/controllers/ActivitiesController.php Просмотреть файл

@@ -167,26 +167,26 @@ class ActivitiesController extends \BaseController
167 167
         $rubric = Rubric::find($activity->rubric[0]->id);
168 168
         Log::info($rubric);
169 169
         Log::info($activity);
170
-        $criterion_rubric = DB::table('criteria')
171
-            ->join("criterion_rubric", "criterion_rubric.criterion_id", "=", "criteria.id")
170
+        $rubric_criterion = DB::table('criteria')
171
+            ->join("rubric_criterion", "rubric_criterion.criterion_id", "=", "criteria.id")
172 172
             ->join("activity_criterion", "criteria.id", '=', 'activity_criterion.criterion_id')
173 173
             ->where("activity_criterion.activity_id", '=', $activity->id)
174
-            ->where('criterion_rubric.rubric_id', '=', $rubric->id)
174
+            ->where('rubric_criterion.rubric_id', '=', $rubric->id)
175 175
             ->select('criteria.name', 'criteria.id as criterion_id', 'criteria.subcriteria')
176 176
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
177
-            ->addSelect('criterion_rubric.rubric_id', 'criterion_rubric.id as rubric_criterion_id')
178
-            ->addSelect('criterion_rubric.copyright', 'criterion_rubric.notes')
177
+            ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
178
+            ->addSelect('rubric_criterion.copyright', 'rubric_criterion.notes')
179 179
             ->get();
180
-        Log::info($criterion_rubric);
181
-        foreach ($criterion_rubric as $index => $singleCR) {
180
+        Log::info($rubric_criterion);
181
+        foreach ($rubric_criterion as $index => $singleCR) {
182 182
             $singleCR->scales = json_encode(DB::table('scales')->join('rubric_criteria_scale', 'rubric_criteria_scale.scale_id', '=', 'scales.id')
183 183
                 ->where('rubric_criteria_scale.rubric_criterion_id', '=', $singleCR->rubric_criterion_id)
184 184
                 ->orderBy('position')
185 185
                 ->lists('description'));
186 186
         }
187
-        $criterion_rubric_ids = DB::table('criterion_rubric')->where('rubric_id', '=', $rubric->id)->lists('id');
187
+        $rubric_criterion_ids = DB::table('rubric_criterion')->where('rubric_id', '=', $rubric->id)->lists('id');
188 188
         Log::info($rubric);
189
-        Log::info($criterion_rubric);
189
+        Log::info($rubric_criterion);
190 190
 
191 191
 
192 192
 
@@ -213,7 +213,7 @@ class ActivitiesController extends \BaseController
213 213
         Log::info($scores_array);
214 214
 
215 215
 
216
-        return View::make('local.professors.assessment', compact('activity', 'title', 'students', 'course', 'criterion_rubric', 'assessments', 'scores_array', 'rubric'));
216
+        return View::make('local.professors.assessment', compact('activity', 'title', 'students', 'course', 'rubric_criterion', 'assessments', 'scores_array', 'rubric'));
217 217
     }
218 218
 
219 219
     public function saveAssessment()

+ 1
- 1
app/controllers/AnnualPlansController.php Просмотреть файл

@@ -226,7 +226,7 @@ class AnnualPlansController extends \BaseController
226 226
       }
227 227
 
228 228
 
229
-      $typ_info['custom_transformative'][$objective->id] = DB::select("select * from transformative_actions where is_custom =1 and by_professor=0 and id in (select ta_id from transformative_objective_program where objective_id = {$objective->id})");
229
+      $typ_info['custom_transformative'][$objective->id] = DB::select("select * from transformative_actions where is_custom =1 and by_professor=0 and id in (select ta_id from transformative_objective_course where objective_id = {$objective->id})");
230 230
     }
231 231
     $typ_info['annual_plan'] = $annual_plan;
232 232
     Log::info($typ_info);

+ 222
- 114
app/controllers/CriteriaController.php Просмотреть файл

@@ -22,7 +22,7 @@ class CriteriaController extends \BaseController
22 22
 
23 23
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
24 24
         $programs = Program::where("id", "=", $userProgram[0]->program_id)->get();
25
-        return View::make('local.managers.pCoords.criteria', compact('title', 'outcomes', 'schools', 'criteria', 'programs', 'objectives'));
25
+        return View::make('local.managers.pCoords.new_criteria', compact('title', 'outcomes', 'schools', 'criteria', 'programs', 'objectives'));
26 26
     }
27 27
 
28 28
     public function editSchool()
@@ -63,7 +63,7 @@ class CriteriaController extends \BaseController
63 63
         } else {
64 64
             foreach ($json_to_send['outcomes'] as $index => $outcome) {
65 65
 
66
-                $outcomeStr .= $outcome->name . ', ';
66
+                $outcomeStr .= ($index + 1) . '. ' . $outcome->name . '<br>';
67 67
             }
68 68
             $outcomeStr = rtrim($outcomeStr, ',');
69 69
         }
@@ -100,21 +100,52 @@ class CriteriaController extends \BaseController
100 100
     }
101 101
     public function fetchObjectivesForSelect()
102 102
     {
103
-
104 103
         $json = array();
105 104
 
106
-        Log::info(Input::get('allOutcomes'));
107
-        foreach (Input::get('allOutcomes') as $id) {
108
-            $json['outcomes'][$id] = DB::select("select name from outcomes where id = {$id}");
109
-            $json['objectives'][$id] = DB::select("select objectives.id, objectives.text, outcomes.name from objectives, objective_outcome, outcomes where  objective_outcome.outcome_id ={$id} and objective_outcome.objective_id = objectives.id and objectives.active=1 and outcomes.id = objective_outcome.outcome_id");
110
-        }
111
-        Log::info(print_r($json, true));
105
+        $outcome_id = Input::get('outcomeID');
106
+
107
+        $json = DB::table('objectives')
108
+            ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
109
+            ->where('outcome_id', '=', $outcome_id)
110
+            ->get();
111
+
112 112
         return json_encode($json);
113 113
     }
114 114
     public function fetchCriterionWithTrashed()
115 115
     {
116 116
 
117 117
         $json = array();
118
+        $json['criteria'] = DB::table('criteria')->where('id', Input::get('id'))->get();
119
+
120
+
121
+        $assoc_outcomes = DB::table('criterion_objective_outcome')->where('criterion_id', Input::get('id'))->lists('outcome_id');
122
+        $json['outcomes'] = DB::table('outcomes')->whereIn('id', $assoc_outcomes)->get();
123
+        $criteria_id = Input::get('id');
124
+        foreach ($json['outcomes'] as $outcome) {
125
+            $id = $outcome->id;
126
+            $json['objectives'][$id] = DB::table('objectives')
127
+                ->join('criterion_objective_outcome', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
128
+                ->where('criterion_id', '=', $criteria_id)
129
+                ->where('outcome_id', '=', $id)
130
+                ->get();
131
+            $json['objectives_assoc'][$id] = DB::table('objectives')
132
+                ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
133
+                ->where('outcome_id', $id)
134
+                ->get();
135
+        }
136
+        $json['program'] = DB::table('program_criterion')->where('criterion_id', $criteria_id)->get();
137
+        $json['activity_criterion'] = DB::table('assessments')
138
+            ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
139
+            ->where('activity_criterion.criterion_id', $criteria_id)
140
+            ->get();
141
+        $json['scales'] = DB::table('criterion_scale')
142
+            ->join('scales', 'criterion_scale.scale_id', '=', 'scales.id')
143
+            ->where('criterion_id', $criteria_id)
144
+            ->orderBy('position')
145
+            ->get();
146
+
147
+
148
+        /*
118 149
         $json['criteria'] = DB::select(" select * from criteria where id = ?", array(Input::get('id')));
119 150
         $json['outcomes'] = DB::select("select  DISTINCT outcomes.id, outcomes.name from outcomes , criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and outcomes.id = criterion_objective_outcome.outcome_id order by outcomes.id", array(Input::get('id')));
120 151
         $json['objectives'] = DB::select("SELECT DISTINCT objectives.id, objectives.text FROM objectives, criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and criterion_objective_outcome.objective_id= objectives.id ", array(Input::get('id')));
@@ -126,7 +157,7 @@ class CriteriaController extends \BaseController
126 157
             $outId = $id->id;
127 158
             $json['outcomes_assoc'][$outId] = DB::select("select name from outcomes where id = {$outId}");
128 159
             $json['objectives_assoc'][$outId] = DB::select("select objectives.id, objectives.text, outcomes.name from objectives, objective_outcome, outcomes where  objective_outcome.outcome_id ={$outId} and objective_outcome.objective_id = objectives.id and objectives.active=1 and outcomes.id = objective_outcome.outcome_id");
129
-        }
160
+        }*/
130 161
 
131 162
         return json_encode($json);
132 163
     }
@@ -156,14 +187,20 @@ class CriteriaController extends \BaseController
156 187
         else
157 188
             $program_id = NULL;
158 189
 
159
-        $saved_criterion = Criterion::withTrashed()
190
+        $saved_criterion = DB::table('criteria')
191
+            ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
192
+            ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
193
+            ->whereIn('program_id', $input['program_id'])
194
+            ->whereIn('objective_id', $input['objective_id'])
195
+            ->whereIn('outcome_id', $input['outcome_id'])
160 196
             ->where('name', '=', $input['name'])
161
-            ->where('outcome_id', '=', $input['outcome_id'])
162
-            ->where('program_id', '=', $program_id)
197
+            ->where('subcriteria', '=', $input['subcriteria'])
163 198
             ->first();
164 199
 
165 200
 
166 201
 
202
+
203
+
167 204
         if ($saved_criterion)
168 205
             return false;
169 206
         else
@@ -197,6 +234,9 @@ class CriteriaController extends \BaseController
197 234
 
198 235
 
199 236
         $clean_input['objective_id'] = Input::get('objective');
237
+        //Log::info('PA los periqueros');
238
+        //Log::info(Input::get('objective'));
239
+        //Log::info($clean_input['objective_id']);
200 240
 
201 241
 
202 242
 
@@ -227,16 +267,19 @@ class CriteriaController extends \BaseController
227 267
                 'outcome_id' => $clean_input['outcome_id'],
228 268
                 'notes' => $clean_input['notes'],
229 269
                 'copyright' => $clean_input['copyright'],
230
-                'maximum_score' => $clean_input['maximum_score']
270
+                'maximum_score' => $clean_input['maximum_score'],
271
+                'scales' => $clean_input['scale_description'],
272
+                'objective_id' => $clean_input['objective_id']
231 273
             ),
232 274
             array(
233 275
                 'name' => 'required|string',
234 276
                 'subcriteria' => 'string',
235 277
                 'outcome_id' => 'required|array',
236
-
278
+                'scales' => 'required|array',
237 279
                 'notes' => 'string',
238 280
                 'copyright' => 'string',
239
-                'maximum_score' => 'required|integer'
281
+                'maximum_score' => 'required|integer',
282
+                'objective_id' => 'required|array'
240 283
             )
241 284
 
242 285
         );
@@ -250,14 +293,15 @@ class CriteriaController extends \BaseController
250 293
     public function create()
251 294
     {
252 295
         $clean_input = $this->cleanInput();
296
+        Log::info("POG???");
253 297
 
254 298
         /** Validation rules */
255
-        $validator = $this->makeValidator($clean_input);
299
+        //$validator = $this->makeValidator($clean_input);
256 300
 
257 301
         /** If validation fails */
258
-        if ($validator->fails()) {
259
-            /** Prepare error message */
260
-            $message = '<p>Error(s) creating a new Criterion:</p><ul>';
302
+        //if ($validator->fails()) {
303
+        /** Prepare error message */
304
+        /*    $message = '<p>Error(s) creating a new Criterion:</p><ul>';
261 305
 
262 306
             foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
263 307
                 $message .= $validationError;
@@ -266,7 +310,7 @@ class CriteriaController extends \BaseController
266 310
             $message .= '</ul>';
267 311
 
268 312
             /** Send error message and old data */
269
-            Session::flash('status', 'danger');
313
+        /* Session::flash('status', 'danger');
270 314
             Session::flash('message', $message);
271 315
             $role = Auth::user()['role'];
272 316
             switch ($role) {
@@ -281,44 +325,65 @@ class CriteriaController extends \BaseController
281 325
             }
282 326
         } else {
283 327
             // Check criterion uniqueness
284
-            /*if (!$this->isCriterionUnique($clean_input)) {
285
-                /** Send error message and old data
286
-                Session::flash('status', 'danger');
328
+            if (!$this->isCriterionUnique($clean_input)) {
329
+                /** Send error message and old data*/
330
+        /*Session::flash('status', 'danger');
287 331
                 Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name and associated program are the same.');
288
-                return Redirect::to('criteria')->withInput();
289
-            }*/
290 332
 
291
-            /** Instantiate new criterion */
292
-            $criterion = new Criterion;
293
-            $criterion->name = $clean_input['name'];
294
-            $criterion->subcriteria = $clean_input['subcriteria'];
333
+                $role = Auth::user()['role'];
334
+                switch ($role) {
335
+                    case 1:
336
+                        return Redirect::to('criteria')->withInput();
295 337
 
338
+                    case 2:
339
+                        return Redirect::to('school-criteria')->withInput();
296 340
 
297
-            //gabriel añadió aqui
341
+                    case 3:
342
+                        return Redirect::to('program-criteria')->withInput();
343
+                }
344
+            }
345
+*/
346
+        /** Instantiate new criterion */
347
+        $criterion = new Criterion;
348
+        $criterion->name = $clean_input['name'];
349
+        $criterion->subcriteria = $clean_input['subcriteria'];
298 350
 
299
-            //$criterion->number_of_scales = $clean_input['number_of_scales'];
300
-            //$criterion->maximum_score = $clean_input['maximum_score'];
301 351
 
302
-            if (Input::get('copyright'))
303
-                $criterion->copyright = $clean_input['copyright'];
352
+        //gabriel añadió aqui
304 353
 
305
-            if (Input::get('notes'))
306
-                $criterion->notes = $clean_input['notes'];
354
+        $criterion->num_scales = sizeof($clean_input['scale_description']);
355
+        $criterion->max_score = $clean_input['maximum_score'];
307 356
 
357
+        if (Input::get('copyright'))
358
+            $criterion->copyright = $clean_input['copyright'];
308 359
 
360
+        if (Input::get('notes'))
361
+            $criterion->notes = $clean_input['notes'];
309 362
 
310
-            /** If criterion is saved, send success message */
311
-            if ($criterion->save()) {
312 363
 
313
-                $criterionId = $criterion->id;
314
-                foreach ($clean_input['outcome_id'] as $outcome_id) {
315
-                    foreach ($clean_input['objective_id'] as $objective_id) {
316 364
 
317
-                        DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$objective_id},{$outcome_id}, {$criterionId})");
318
-                    }
319
-                }
365
+        /** If criterion is saved, send success message */
366
+        if ($criterion->save()) {
320 367
 
321
-                for ($i = 0; $i < sizeof($clean_input['scale_description']); $i++) {
368
+            $criterionId = $criterion->id;
369
+            $parentesis = array('(', ')');
370
+
371
+            foreach ($clean_input['objective_id'] as $objective_id) {
372
+
373
+                $outcome_objective = str_replace($parentesis, '', $objective_id);
374
+
375
+                $outcome_objective = explode(',', $outcome_objective);
376
+                DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$outcome_objective[1]},{$outcome_objective[0]}, {$criterionId})");
377
+            }
378
+
379
+
380
+            for ($i = 0; $i < sizeof($clean_input['scale_description']); $i++) {
381
+
382
+                $existing_scale = DB::table('scales')->where('description', $clean_input['scale_description'][$i])
383
+                    ->first();
384
+                if ($existing_scale) {
385
+                    DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$existing_scale->id},{$i})");
386
+                } else {
322 387
                     $scale = new Scale;
323 388
 
324 389
                     $position = $i;
@@ -343,47 +408,48 @@ class CriteriaController extends \BaseController
343 408
                         }
344 409
                     }
345 410
                 }
411
+            }
346 412
 
347
-                foreach ($clean_input['program_id'] as $program_id) {
348
-                    DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
349
-                }
413
+            foreach ($clean_input['program_id'] as $program_id) {
414
+                DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
415
+            }
350 416
 
351
-                Session::flash('status', 'success');
352
-                Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
353
-                $role = Auth::user()['role'];
354
-                switch ($role) {
355
-                    case 1:
356
-                        return Redirect::to('criteria')->withInput();
417
+            Session::flash('status', 'success');
418
+            Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
419
+            $role = Auth::user()['role'];
420
+            switch ($role) {
421
+                case 1:
422
+                    return Redirect::to('criteria')->withInput();
357 423
 
358
-                    case 2:
359
-                        return Redirect::to('school-criteria')->withInput();
424
+                case 2:
425
+                    return Redirect::to('school-criteria')->withInput();
360 426
 
361
-                    case 3:
362
-                        return Redirect::to('program-criteria')->withInput();
363
-                }
427
+                case 3:
428
+                    return Redirect::to('program-criteria')->withInput();
364 429
             }
430
+        }
365 431
 
366
-            /** If saving fails, send error message and old data */
367
-            else {
368
-                Session::flash('status', 'danger');
369
-                Session::flash('message', '<p>Error creating Criterion. Please try again later.</p>');
370
-                $role = Auth::user()['role'];
371
-                switch ($role) {
372
-                    case 1:
373
-                        return Redirect::to('criteria')->withInput();
432
+        /** If saving fails, send error message and old data */
433
+        else {
434
+            Session::flash('status', 'danger');
435
+            Session::flash('message', '<p>Error creating Criterion. Please try again later.</p>');
436
+            $role = Auth::user()['role'];
437
+            switch ($role) {
438
+                case 1:
439
+                    return Redirect::to('criteria')->withInput();
374 440
 
375
-                    case 2:
376
-                        return Redirect::to('school-criteria')->withInput();
441
+                case 2:
442
+                    return Redirect::to('school-criteria')->withInput();
377 443
 
378
-                    case 3:
379
-                        return Redirect::to('program-criteria')->withInput();
380
-                }
444
+                case 3:
445
+                    return Redirect::to('program-criteria')->withInput();
381 446
             }
382 447
         }
383 448
     }
384 449
 
385 450
 
386 451
 
452
+
387 453
     public function edit()
388 454
     {
389 455
         $title = "Criteria";
@@ -423,11 +489,11 @@ class CriteriaController extends \BaseController
423 489
 
424 490
 
425 491
         $clean_input['subcriteria'] = $trimmed;
426
-        $clean_input['outcome_id'] = Input::get('assoc_outcome');
492
+        $clean_input['outcome_id'] = Input::get('outcome');
427 493
 
428 494
 
429 495
 
430
-        $clean_input['objective_id'] = Input::get('assoc_objective');
496
+        $clean_input['objective_id'] = Input::get('objective');
431 497
 
432 498
 
433 499
 
@@ -436,15 +502,32 @@ class CriteriaController extends \BaseController
436 502
 
437 503
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
438 504
         $clean_input['notes'] = trim(preg_replace('/\t+/', '', Input::get('notes')));
439
-        /* $clean_input['maximum_score'] = (int) Input::get('assoc_maximum_score');
440
-        $clean_input['scale_title'] = Input::get('assoc_title');
441
-        $clean_input['scale_description'] = Input::get('assoc_scales');
442
-        $clean_input['number_of_scales'] = sizeof($clean_input['scale_title']);*/
505
+        $clean_input['maximum_score'] = (int) Input::get('maximum_score');
506
+        //$clean_input['scale_title'] = Input::get('assoc_title');
507
+        $clean_input['scale_description'] = Input::get('Scales');
508
+        $clean_input['number_of_scales'] = sizeof($clean_input['scale_description']);
443 509
 
444 510
 
445 511
         return $clean_input;
446 512
     }
447 513
 
514
+    public function changeStatus()
515
+    {
516
+        $criterion_id = Input::get('criterion_id');
517
+        $criterion = Criterion::find($criterion_id);
518
+
519
+        if (!$criterion->deleted_at) {
520
+            $criterion->deleted_at = date('Y-m-d H:i:s');
521
+            if ($criterion->save())
522
+                return "deleted";
523
+            else return 'error';
524
+        } else {
525
+            $criterion->deleted_at = NULL;
526
+            if ($criterion->save())
527
+                return "activated";
528
+            else return 'error';
529
+        }
530
+    }
448 531
     public function update()
449 532
     {
450 533
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
@@ -471,30 +554,40 @@ class CriteriaController extends \BaseController
471 554
             $role = Auth::user()['role'];
472 555
             switch ($role) {
473 556
                 case 1:
474
-                    return Redirect::to('objective')->withInput();
557
+                    return Redirect::to('criteria')->withInput();
475 558
 
476 559
                 case 2:
477
-                    return Redirect::to('school-objective')->withInput();
560
+                    return Redirect::to('school-criteria')->withInput();
478 561
 
479 562
                 case 3:
480
-                    return Redirect::to('program-objective')->withInput();
563
+                    return Redirect::to('program-criteria')->withInput();
481 564
             }
482 565
         } else {
483 566
 
484 567
             // // Check criterion uniqueness
485
-            // if(!$this->isCriterionUnique($clean_input, $criterion))
486
-            // {
487
-            //     /** Send error message and old data */
488
-            //     Session::flash('status', 'danger');
489
-            //     Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name, assoaciated school or program, and progress indicators are the same.');
490
-            //     return Redirect::to('criteria')->withInput();
491
-            // }
568
+            /*if (!$this->isCriterionUnique($clean_input, $criterion)) {
569
+                /** Send error message and old data */
570
+            /*Session::flash('status', 'danger');
571
+                Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name, assoaciated school or program, and progress indicators are the same.');
572
+                $role = Auth::user()['role'];
573
+                switch ($role) {
574
+                    case 1:
575
+                        return Redirect::to('criteria')->withInput();
576
+
577
+                    case 2:
578
+                        return Redirect::to('school-criteria')->withInput();
579
+
580
+                    case 3:
581
+                        return Redirect::to('program-criteria')->withInput();
582
+                }
583
+            }*/
492 584
 
493 585
             /** Set info */
494 586
             $criterion->name = $clean_input['name'];
495 587
             $criterion->subcriteria = $clean_input['subcriteria'];
496 588
 
497
-
589
+            $criterion->num_scales = $clean_input['number_of_scales'];
590
+            $criterion->max_score = $clean_input['maximum_score'];
498 591
 
499 592
 
500 593
 
@@ -524,42 +617,55 @@ class CriteriaController extends \BaseController
524 617
                 $criterion->notes = NULL;
525 618
 
526 619
             /** If criterion is updated, send success message */
620
+            $parentesis = array('(', ')');
527 621
             if ($criterion->save()) {
528 622
                 $criterionId = $criterion->id;
529 623
                 DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
530 624
                 DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
531 625
 
532
-                foreach ($clean_input['outcome_id'] as $outcome_id) {
533
-                    foreach ($clean_input['objective_id'] as $objective_id) {
626
+                foreach ($clean_input['objective_id'] as $objective_id) {
534 627
 
535
-                        DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$objective_id},{$outcome_id}, {$criterionId})");
536
-                    }
628
+                    $outcome_objective = str_replace($parentesis, '', $objective_id);
629
+
630
+                    $outcome_objective = explode(',', $outcome_objective);
631
+                    DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$outcome_objective[1]},{$outcome_objective[0]}, {$criterionId})");
537 632
                 }
633
+
538 634
                 /*DB::delete("delete from `scales` where id in (select scale_id id from criterion_scale where criterion_id = {$criterionId})");
635
+*/
636
+                DB::delete("delete from criterion_scale where criterion_id = {$criterionId}");
637
+                for ($i = 0; $i < sizeof($clean_input['scale_description']); $i++) {
539 638
 
540
-                for ($i = 0; $i < sizeof($clean_input['scale_title']); $i++) {
541
-                    $scale = new Scale;
542
-                    $scale->title = $clean_input['scale_title'][$i];
543
-                    $scale->position = $i + 1;
544
-                    $scale->description = $clean_input['scale_description'][$i];
545
-                    if ($scale->save()) {
546
-                        DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`) values({$criterionId},{$scale->id})");
639
+                    $existing_scale = DB::table('scales')->where('description', $clean_input['scale_description'][$i])
640
+                        ->first();
641
+                    if ($existing_scale) {
642
+                        DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$existing_scale->id},{$i})");
547 643
                     } else {
548
-                        Session::flash('status', 'danger');
549
-                        Session::flash('message', '<p>Error creating the Scales</p>');
550
-                        $role = Auth::user()['role'];
551
-                        switch ($role) {
552
-                            case 1:
553
-                                return Redirect::to('objective')->withInput();
644
+                        $scale = new Scale;
554 645
 
555
-                            case 2:
556
-                                return Redirect::to('school-objective')->withInput();
646
+                        $position = $i;
647
+                        $scale->description = $clean_input['scale_description'][$i];
557 648
 
558
-                            case 3:
559
-                                return Redirect::to('program-objective')->withInput();
649
+
650
+                        if ($scale->save()) {
651
+                            DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$scale->id}, {$position})");
652
+                        } else {
653
+                            Session::flash('status', 'danger');
654
+                            Session::flash('message', '<p>Error creating the Scales</p>');
655
+                            $role = Auth::user()['role'];
656
+                            switch ($role) {
657
+                                case 1:
658
+                                    return Redirect::to('criteria')->withInput();
659
+
660
+                                case 2:
661
+                                    return Redirect::to('school-criteria')->withInput();
662
+
663
+                                case 3:
664
+                                    return Redirect::to('program-criteria')->withInput();
665
+                            }
560 666
                         }
561 667
                     }
562
-                }*/
668
+                }
563 669
                 foreach ($clean_input['program_id'] as $program_id) {
564 670
                     DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
565 671
                 }
@@ -641,7 +747,8 @@ class CriteriaController extends \BaseController
641 747
         } elseif (Auth::user()->role == 2) {
642 748
             //buscar los objetivos de la departamento (school)
643 749
             $objectives = DB::table('program_user')
644
-                ->join('objectives', 'objectives.program_id', '=', 'program_user.program_id')
750
+                ->join('objective_program', 'objective_program.program_id', '=', 'program_user.program_id')
751
+                ->join('objectives', 'objectives.id', '=', 'objective_program.objective_id')
645 752
                 ->join('programs', 'programs.id', '=', 'program_user.program_id')
646 753
                 ->where('programs.school_id', Auth::user()->school_id)
647 754
                 ->select('objectives.id', 'objectives.text', 'programs.name')
@@ -650,7 +757,8 @@ class CriteriaController extends \BaseController
650 757
         } elseif ((Auth::user()->role == 3) || (Auth::user()->role == 4)) {
651 758
             //buscar los objetivos de los programas cuales el profesor esta
652 759
             $objectives = DB::table('program_user')
653
-                ->join('objectives', 'objectives.program_id', '=', 'program_user.program_id')
760
+                ->join('objective_program', 'objective_program.program_id', '=', 'program_user.program_id')
761
+                ->join('objectives', 'objectives.id', '=', 'objective_program.objective_id')
654 762
                 ->join('programs', 'programs.id', '=', 'program_user.program_id')
655 763
                 ->where('program_user.user_id', Auth::user()->id)
656 764
                 ->select('objectives.id', 'objectives.text', 'programs.name')

+ 104
- 130
app/controllers/ObjectivesController.php Просмотреть файл

@@ -1,56 +1,47 @@
1 1
 <?php
2 2
 
3
-class ObjectivesController extends \BaseController {
4
-
5
-    /**
6
-     * Display a listing of the resource.
7
-     *
8
-     * @return Response
9
-     */
10
-    public function fetch()
11
-    {
12
-        try
13
-        {
14
-            $outcome_id = Input::get('outcome_id');
15
-            $program_id = Input::get('program_id');
16
-            $format = Input::get('format');
17
-
18
-
19
-            $objectives = Objective::select('id', 'outcome_id', 'program_id', 'text');
20
-
21
-            if($outcome_id)
22
-            {
23
-                $objectives->where('outcome_id', $outcome_id);
24
-            }
25
-
26
-            if($program_id)
27
-            {
28
-                $objectives->where('program_id', $program_id);
29
-            }
30
-
31
-            if($format == 'select')
32
-            {
33
-                $string = '';
34
-                foreach ($objectives->get() as $objective)
35
-                {
36
-                    $string.='<option value="'.$objective->id.'">'.$objective->text.'</option>';
37
-                }
38
-
39
-                echo $string;
40
-                return;
41
-            }
42
-            else
43
-            {
44
-                return $objectives->get();
45
-            }
46
-        }
47
-        catch (Exception $e)
48
-        {
49
-            echo $e->getMessage();
50
-            return;
3
+class ObjectivesController extends \BaseController
4
+{
5
+
6
+  /**
7
+   * Display a listing of the resource.
8
+   *
9
+   * @return Response
10
+   */
11
+  public function fetch()
12
+  {
13
+    try {
14
+      $outcome_id = Input::get('outcome_id');
15
+      $program_id = Input::get('program_id');
16
+      $format = Input::get('format');
17
+
18
+
19
+      $objectives = Objective::select('id', 'outcome_id', 'program_id', 'text');
20
+
21
+      if ($outcome_id) {
22
+        $objectives->where('outcome_id', $outcome_id);
23
+      }
24
+
25
+      if ($program_id) {
26
+        $objectives->where('program_id', $program_id);
27
+      }
28
+
29
+      if ($format == 'select') {
30
+        $string = '';
31
+        foreach ($objectives->get() as $objective) {
32
+          $string .= '<option value="' . $objective->id . '">' . $objective->text . '</option>';
51 33
         }
52 34
 
35
+        echo $string;
36
+        return;
37
+      } else {
38
+        return $objectives->get();
39
+      }
40
+    } catch (Exception $e) {
41
+      echo $e->getMessage();
42
+      return;
53 43
     }
44
+  }
54 45
 
55 46
   /**
56 47
    * Edit the learning objectives per learning outcome for a program
@@ -60,20 +51,15 @@ class ObjectivesController extends \BaseController {
60 51
     $role = Auth::user()->role;
61 52
 
62 53
     // Redirect users if they try to access forbidden page
63
-  	if($role == 2 && $program->school_id != Auth::user()->school_id)
64
-  	{
65
-		return Redirect::to('/');
66
-  	}
67
-  	else if($role == 3 && !in_array($program->id, Auth::user()->programs->lists('id')))
68
-  	{
69
-		return Redirect::to('/');
70
-  	}
71
-  	else if($role == 4)
72
-  	{
73
-		return Redirect::to('/');
74
-  	}
75
-
76
-    $title = 'Learning Objectives ('.$program->name.')';
54
+    if ($role == 2 && $program->school_id != Auth::user()->school_id) {
55
+      return Redirect::to('/');
56
+    } else if ($role == 3 && !in_array($program->id, Auth::user()->programs->lists('id'))) {
57
+      return Redirect::to('/');
58
+    } else if ($role == 4) {
59
+      return Redirect::to('/');
60
+    }
61
+
62
+    $title = 'Learning Objectives (' . $program->name . ')';
77 63
     $objectives = $program->objectives;
78 64
 
79 65
     // Eager load outcomes related to objectives
@@ -86,37 +72,34 @@ class ObjectivesController extends \BaseController {
86 72
 
87 73
   public function create()
88 74
   {
89
-    try
90
-    {
75
+    try {
91 76
       $outcome_id = Input::get('outcome_id');
92 77
       $program_id = Input::get('program_id');
93 78
       $learning_objective = trim(Input::get('learning_objective'));
94 79
 
95 80
 
96 81
       $validator = Validator::make(
97
-          array(
98
-              'outcome_id' => $outcome_id,
99
-              'program_id' => $program_id,
100
-              'learning_objective' => $learning_objective
101
-          ),
102
-          array(
103
-              'outcome_id' => 'required|integer',
104
-              'program_id' => 'required|integer',
105
-              'learning_objective' => 'required|min:1',
106
-          )
82
+        array(
83
+          'outcome_id' => $outcome_id,
84
+          'program_id' => $program_id,
85
+          'learning_objective' => $learning_objective
86
+        ),
87
+        array(
88
+          'outcome_id' => 'required|integer',
89
+          'program_id' => 'required|integer',
90
+          'learning_objective' => 'required|min:1',
91
+        )
107 92
       );
108 93
 
109
-      if($validator->fails())
110
-      {
94
+      if ($validator->fails()) {
111 95
         /** Prepare error message */
112 96
         $message = '<p>Error(s) creating a new Learning Objective: </p><ul>';
113 97
 
114
-        foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
115
-        {
116
-            $message.=$validationError;
98
+        foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
99
+          $message .= $validationError;
117 100
         }
118 101
 
119
-        $message.='</ul>';
102
+        $message .= '</ul>';
120 103
 
121 104
         /** Send error message and old data */
122 105
         Session::flash('status', 'danger');
@@ -131,16 +114,14 @@ class ObjectivesController extends \BaseController {
131 114
       ));
132 115
 
133 116
       /** Send success message */
134
-        Session::flash('status', 'success');
135
-        Session::flash('message', 'New Learning Objective successfully created.');
136
-        return Redirect::back();
137
-    }
138
-    catch(Exception $e)
139
-    {
117
+      Session::flash('status', 'success');
118
+      Session::flash('message', 'New Learning Objective successfully created.');
119
+      return Redirect::back();
120
+    } catch (Exception $e) {
140 121
       /** Send error message and old data */
141
-        Session::flash('status', 'danger');
142
-        Session::flash('message', 'An error ocurred trying to create a new Learning Objective. Please try again later.'.$e->getMessage());
143
-        return Redirect::back()->withInput();
122
+      Session::flash('status', 'danger');
123
+      Session::flash('message', 'An error ocurred trying to create a new Learning Objective. Please try again later.' . $e->getMessage());
124
+      return Redirect::back()->withInput();
144 125
     }
145 126
   }
146 127
 
@@ -149,39 +130,36 @@ class ObjectivesController extends \BaseController {
149 130
    */
150 131
   public function update()
151 132
   {
152
-    try
153
-    {
133
+    try {
154 134
       $outcome_id = Input::get('edit_outcome_id');
155 135
       $objective_id = Input::get('edit_objective_id');
156 136
       $active = Input::get('edit_active');
157 137
       $learning_objective = trim(Input::get('edit_learning_objective'));
158 138
 
159 139
       $validator = Validator::make(
160
-          array(
161
-            'outcome_id' => $outcome_id,
162
-            'objective_id' => $objective_id,
163
-            'active' => $active,
164
-            'learning_objective' => $learning_objective
165
-          ),
166
-          array(
167
-            'outcome_id' => 'required|integer',
168
-            'objective_id' => 'required|integer',
169
-            'active' => 'required|integer|boolean',
170
-            'learning_objective' => 'required|min:1',
171
-          )
140
+        array(
141
+          'outcome_id' => $outcome_id,
142
+          'objective_id' => $objective_id,
143
+          'active' => $active,
144
+          'learning_objective' => $learning_objective
145
+        ),
146
+        array(
147
+          'outcome_id' => 'required|integer',
148
+          'objective_id' => 'required|integer',
149
+          'active' => 'required|integer|boolean',
150
+          'learning_objective' => 'required|min:1',
151
+        )
172 152
       );
173 153
 
174
-      if($validator->fails())
175
-      {
154
+      if ($validator->fails()) {
176 155
         /** Prepare error message */
177 156
         $message = '<p>Error(s) updating the Learning Objective: </p><ul>';
178 157
 
179
-        foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
180
-        {
181
-            $message.=$validationError;
158
+        foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
159
+          $message .= $validationError;
182 160
         }
183 161
 
184
-        $message.='</ul>';
162
+        $message .= '</ul>';
185 163
 
186 164
         /** Send error message and old data */
187 165
         Session::flash('status', 'danger');
@@ -195,19 +173,17 @@ class ObjectivesController extends \BaseController {
195 173
           'outcome_id' => $outcome_id,
196 174
           'text' => $learning_objective,
197 175
           'active' => $active,
198
-      ));
176
+        ));
199 177
 
200 178
       /** Send success message */
201
-        Session::flash('status', 'success');
202
-        Session::flash('message', 'Learning Objective successfully updated.');
203
-        return Redirect::back();
204
-    }
205
-    catch(Exception $e)
206
-    {
207
-      	/** Send error message and old data */
208
-        Session::flash('status', 'danger');
209
-        Session::flash('message', 'An error ocurred trying to create a new Learning Objective. Please try again later.'.$e->getMessage());
210
-        return Redirect::back()->withInput();
179
+      Session::flash('status', 'success');
180
+      Session::flash('message', 'Learning Objective successfully updated.');
181
+      return Redirect::back();
182
+    } catch (Exception $e) {
183
+      /** Send error message and old data */
184
+      Session::flash('status', 'danger');
185
+      Session::flash('message', 'An error ocurred trying to create a new Learning Objective. Please try again later.' . $e->getMessage());
186
+      return Redirect::back()->withInput();
211 187
     }
212 188
   }
213 189
 
@@ -226,8 +202,7 @@ class ObjectivesController extends \BaseController {
226 202
       )
227 203
     );
228 204
 
229
-    if($validator->fails())
230
-    {
205
+    if ($validator->fails()) {
231 206
       return '';
232 207
     }
233 208
     $res = DB::table('objectives')->where('id', Input::get('objective_id'))->first();
@@ -237,16 +212,15 @@ class ObjectivesController extends \BaseController {
237 212
 
238 213
   public function fetchObjectiveForCriteria()
239 214
   {
240
-      $id = Input::get('id');
215
+    $id = Input::get('id');
241 216
 
242
-      $objective = Objective::find($id);
217
+    $objective = Objective::find($id);
243 218
 
244
-      $objective->program;
245
-      $objective->criteria;
219
+    //$objective->program;
220
+    //$objective->criteria;
246 221
 
247
-      return array
248
-      (
249
-          'objective' => $objective
250
-      );
222
+    return array(
223
+      'objective' => $objective
224
+    );
251 225
   }
252 226
 }

+ 35
- 11
app/controllers/OutcomesController.php Просмотреть файл

@@ -553,15 +553,31 @@ class OutcomesController extends \BaseController
553 553
 
554 554
         $diferent_levels = DB::table('criterion_objective_outcome')
555 555
             ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
556
-            ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
557 556
             ->where('criterion_objective_outcome.outcome_id', $id)
558
-            ->distinct('criteria.number_of_scales')
559
-            ->select('criteria.number_of_scales as levels')
560
-            ->orderBy('criteria.number_of_scales', 'asc')
557
+            ->distinct('criteria.num_scales')
558
+            ->select('criteria.num_scales as levels')
559
+            ->orderBy('criteria.num_scales', 'asc')
561 560
             ->get();
562 561
 
563 562
         $criteria_array = array();
564 563
 
564
+        // switch para el query, dependiendo del usuario
565
+
566
+        $role = Auth::user()['role'];
567
+
568
+        switch ($role) {
569
+            case 1:
570
+                $program_ids = DB::table('programs')->lists('id');
571
+                break;
572
+            case 2:
573
+                $school_id = Auth::user()['school_id'];
574
+                $program_ids = DB::table('programs')->where('school_id', $school_id)->lists('id');
575
+                break;
576
+            case 3:
577
+                $program_ids = DB::table('program_user')->where('user_id', Auth::user()['id'])->lists('program_id');
578
+                break;
579
+        }
580
+
565 581
         $outcome->criteria = array();
566 582
         foreach ($diferent_levels as $level) {
567 583
             $level = $level->levels;
@@ -578,18 +594,25 @@ class OutcomesController extends \BaseController
578 594
             //                 ->get();
579 595
             $outcome_criterias = DB::table('criterion_objective_outcome')
580 596
                 ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
581
-                ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
597
+                ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
598
+                ->whereIn('program_criterion.program_id', $program_ids)
582 599
                 ->where('criterion_objective_outcome.outcome_id', $id)
583
-                ->where('criteria.number_of_scales', $level)
584
-                ->whereNull('criteria.deleted_at')
585
-                ->select('criteria.id', 'criteria.name')
600
+                ->where('criteria.num_scales', $level)
601
+                ->select('criteria.id', 'criteria.name', 'criteria.deleted_at')
586 602
                 ->orderBy('criteria.name', 'asc')
587 603
                 ->get();
588
-            $outcome_criterias = $outcome_criterias;
604
+            // $outcome_criterias = $outcome_criterias;
589 605
 
590 606
             foreach ($outcome_criterias as $criteria_id) {
607
+                $scales = DB::select("select * FROM scales INNER join `criterion_scale` on `criterion_scale`.`scale_id` = `scales`.`id` where criterion_scale.criterion_id ={$criteria_id->id} ORDER BY position");
608
+
609
+                $programs = DB::table('programs')
610
+                    ->join('program_criterion', 'program_criterion.program_id', '=', 'programs.id')
611
+                    ->where('criterion_id', $criteria_id->id)
612
+                    ->lists('programs.name');
613
+                Log::info($scales);
591 614
 
592
-                $scales =
615
+                /* $scales =
593 616
                     DB::select(
594 617
                         DB::raw("
595 618
                   SELECT *
@@ -611,7 +634,8 @@ class OutcomesController extends \BaseController
611 634
                   WHERE rn = 1
612 635
                   ORDER BY `a`.`position` ASC
613 636
                       ")
614
-                    );
637
+                    );*/
638
+                $criteria_id->programs = $programs;
615 639
                 // insertar la informacion de los criterios con N niveles en el arreglo de arreglos
616 640
                 $criteria_id->scales = $scales;
617 641
                 // $i++;

+ 15
- 15
app/controllers/RubricsController.php Просмотреть файл

@@ -108,9 +108,9 @@ class RubricsController extends \BaseController
108 108
 
109 109
             $rubricId = $rubric->id;
110 110
             foreach ($criteria as $index => $criterion_id) {
111
-                DB::insert("insert into criterion_rubric (`rubric_id`,`criterion_id`) values ({$rubricId},{$criterion_id})");
111
+                DB::insert("insert into rubric_criterion (`rubric_id`,`criterion_id`) values ({$rubricId},{$criterion_id})");
112 112
                 DB::commit();
113
-                $rubric_criterion_id = DB::table('criterion_rubric')->where('rubric_id', '=', $rubricId)
113
+                $rubric_criterion_id = DB::table('rubric_criterion')->where('rubric_id', '=', $rubricId)
114 114
                     ->where('criterion_id', '=', $criterion_id)->first();
115 115
 
116 116
 
@@ -270,16 +270,16 @@ class RubricsController extends \BaseController
270 270
 
271 271
         $course->save();
272 272
         Log::info('entré6???');
273
-        DB::delete("delete from criterion_rubric where rubric_id ={$rubric->id}");
273
+        DB::delete("delete from rubric_criterion where rubric_id ={$rubric->id}");
274 274
         DB::delete("delete from activity_criterion where activity_id = {$activity->id}");
275 275
         foreach ($criteria as $index => $criterion_id) {
276 276
             if (
277 277
 
278
-                DB::insert("insert into criterion_rubric (`rubric_id`, `criterion_id`) values ({$rubric->id}, {$criterion_id}) ")
278
+                DB::insert("insert into rubric_criterion (`rubric_id`, `criterion_id`) values ({$rubric->id}, {$criterion_id}) ")
279 279
                 &&  DB::insert("insert into `activity_criterion` (`activity_id`,`criterion_id`, `weight`) values ({$activity->id}, {$criterion_id}, {$defaultWeight})")
280 280
             ) {
281 281
 
282
-                $rubric_criterion_id =  DB::table('criterion_rubric')
282
+                $rubric_criterion_id =  DB::table('rubric_criterion')
283 283
                     ->where('rubric_id', '=', $rubric->id)
284 284
                     ->where('criterion_id', '=', $criterion_id)
285 285
                     ->first();
@@ -360,13 +360,13 @@ class RubricsController extends \BaseController
360 360
         Log::info($activity->rubric[0]->id);
361 361
 
362 362
         $rubric = Rubric::where('id', '=', $activity->rubric[0]->id)->firstOrFail();
363
-        $criterion_rubric = DB::table('criteria')
364
-            ->join('criterion_rubric', 'criterion_rubric.criterion_id', '=', 'criteria.id')
365
-            ->where('criterion_rubric.rubric_id', '=', $activity->rubric[0]->id)
363
+        $rubric_criterion = DB::table('criteria')
364
+            ->join('rubric_criterion', 'rubric_criterion.criterion_id', '=', 'criteria.id')
365
+            ->where('rubric_criterion.rubric_id', '=', $activity->rubric[0]->id)
366 366
             ->get();
367
-        Log::info($criterion_rubric);
367
+        Log::info($rubric_criterion);
368 368
 
369
-        foreach ($criterion_rubric as $single_cr) {
369
+        foreach ($rubric_criterion as $single_cr) {
370 370
             $single_cr->scales = json_encode(DB::table('scales')
371 371
                 ->join('rubric_criteria_scale', 'rubric_criteria_scale.scale_id', '=', 'scales.id')
372 372
                 ->where('rubric_criteria_scale.rubric_criterion_id', '=', $single_cr->id)
@@ -378,10 +378,10 @@ class RubricsController extends \BaseController
378 378
         }
379 379
 
380 380
 
381
-        Log::info($criterion_rubric);
381
+        Log::info($rubric_criterion);
382 382
 
383 383
         $title = $activity->name . ': ' . $rubric->name;
384
-        return View::make('local.professors.viewrubric', compact('rubric', 'activity', 'criterion_rubric', 'title', 'course'));
384
+        return View::make('local.professors.viewrubric', compact('rubric', 'activity', 'rubric_criterion', 'title', 'course'));
385 385
     }
386 386
 
387 387
     /**
@@ -439,9 +439,9 @@ class RubricsController extends \BaseController
439 439
         Log::info($rubric);
440 440
 
441 441
         $rubric["criteria"] = DB::table("criteria")
442
-            ->join("criterion_rubric", 'criterion_rubric.criterion_id', '=', 'criteria.id')
443
-            ->where("criterion_rubric.id", '=', Input::get('rubric_criterion_id'))
444
-            ->select('name', 'criterion_rubric.notes')
442
+            ->join("rubric_criterion", 'rubric_criterion.criterion_id', '=', 'criteria.id')
443
+            ->where("rubric_criterion.id", '=', Input::get('rubric_criterion_id'))
444
+            ->select('name', 'rubric_criterion.notes')
445 445
             ->first();
446 446
         return json_encode($rubric);
447 447
 

+ 848
- 838
app/controllers/TransformativeActionsController.php
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 2
- 2
app/database/migrations/2021_06_01_000529_create_scales_table.php Просмотреть файл

@@ -12,8 +12,8 @@ class CreateScalesTable extends Migration
12 12
 			$table->increments('id');
13 13
 
14 14
 			$table->string('description');
15
-			$table->integer('min_score')->unsigned();
16
-			$table->integer('max_score')->unsigned();
15
+			//$table->integer('min_score')->unsigned();
16
+			//$table->integer('max_score')->unsigned();
17 17
 			$table->timestamps();
18 18
 		});
19 19
 	}

+ 2
- 1
app/database/migrations/2021_06_01_235626_create_criteria_table.php Просмотреть файл

@@ -15,7 +15,8 @@ class CreateCriteriaTable extends Migration
15 15
 			$table->integer('user_id')->unsigned()->nullable();
16 16
 			$table->text('copyright')->nullable();
17 17
 			$table->text('notes')->nullable();
18
-
18
+			$table->integer('num_scales');
19
+			$table->integer('max_score');
19 20
 			$table->timestamps();
20 21
 			$table->timestamp('deleted_at')->nullable();
21 22
 

+ 2
- 2
app/database/migrations/2021_06_02_000507_create_rubrics_table.php Просмотреть файл

@@ -16,8 +16,8 @@ class CreateRubricsTable extends Migration
16 16
 			$table->integer('expected_points');
17 17
 			$table->integer('user_id')->unsigned();
18 18
 			$table->timestamps();
19
-			$table->integer('num_scales')->unsigned();
20
-			$table->integer('max_score')->unsigned();
19
+			//$table->integer('num_scales')->unsigned();
20
+			//$table->integer('max_score')->unsigned();
21 21
 		});
22 22
 
23 23
 		Schema::table('rubrics', function (Blueprint $table) {

+ 1
- 0
app/database/migrations/2021_06_03_001143_create_transformative_actions_table.php Просмотреть файл

@@ -17,6 +17,7 @@ class CreateTransformativeActionsTable extends Migration
17 17
 
18 18
 			$table->increments('id');
19 19
 			$table->timestamps();
20
+			$table->string('type_of_TA');
20 21
 			$table->boolean('is_custom');
21 22
 			$table->integer('user_id')->unsigned()->nullable();
22 23
 			$table->integer('program_id')->unsigned()->nullable();

+ 3
- 3
app/database/migrations/2021_06_03_235944_create_courses_table.php Просмотреть файл

@@ -16,9 +16,9 @@ class CreateCoursesTable extends Migration
16 16
 			$table->integer('program_id')->unsigned();
17 17
 			$table->integer('user_id')->unsigned();
18 18
 			$table->timestamps();
19
-			$table->text('criteria_achieved')->nullable();
20
-			$table->text('outcomes_achieved')->nullable();
21
-			$table->text('outcomes_attempted')->nullable();
19
+			//$table->text('criteria_achieved')->nullable();
20
+			//$table->text('outcomes_achieved')->nullable();
21
+			//$table->text('outcomes_attempted')->nullable();
22 22
 			$table->char('number', 4)->default('0000');
23 23
 		});
24 24
 

+ 8
- 8
app/database/migrations/2021_06_04_003757_create_activities_table.php Просмотреть файл

@@ -15,19 +15,19 @@ class CreateActivitiesTable extends Migration
15 15
 			$table->integer('course_id')->unsigned()->nullable();
16 16
 
17 17
 			$table->timestamps();
18
-			$table->text('criteria_achieved')->nullable();
19
-			$table->text('criteria_weights')->nullable();
20
-			$table->text('outcomes_achieved')->nullable();
21
-			$table->text('outcomes_attempted')->nullable();
18
+			//$table->text('criteria_achieved')->nullable();
19
+			//$table->text('criteria_weights')->nullable();
20
+			//$table->text('outcomes_achieved')->nullable();
21
+			//$table->text('outcomes_attempted')->nullable();
22 22
 
23 23
 			$table->text('assessment_comments')->nullable();
24
-			$table->text('transforming_actions')->nullable();
25
-			$table->text('criteria_achieved_percentage')->nullable();
24
+			//$table->text('transforming_actions')->nullable();
25
+			//$table->text('criteria_achieved_percentage')->nullable();
26 26
 
27 27
 			$table->date('date');
28 28
 			$table->boolean('draft')->default(0);
29
-			$table->text('criteria_participant_count')->nullable();
30
-			$table->text('criteria_achiever_count')->nullable();
29
+			//$table->text('criteria_participant_count')->nullable();
30
+			//$table->text('criteria_achiever_count')->nullable();
31 31
 
32 32
 			DB::statement('SET FOREIGN_KEY_CHECKS=1;');
33 33
 		});

+ 1
- 1
app/database/migrations/2021_06_04_003810_create_activity_criterion_table.php Просмотреть файл

@@ -33,7 +33,7 @@ class CreateActivityCriterionTable extends Migration
33 33
 			$table->text('assessment_comments')->nullable();
34 34
 
35 35
 
36
-			$table->decimal('weight', 3, 2)->default(1.0);
36
+			$table->decimal('weight', 6, 2)->default(1.0);
37 37
 
38 38
 			$table->timestamps();
39 39
 		});

+ 3
- 2
app/database/migrations/2021_06_05_235636_create_criterion_rubric.php Просмотреть файл

@@ -8,7 +8,7 @@ class CreateCriterionRubric extends Migration
8 8
 
9 9
 	public function up()
10 10
 	{
11
-		Schema::create('criterion_rubric', function (Blueprint $table) {
11
+		Schema::create('rubric_criterion', function (Blueprint $table) {
12 12
 			$table->increments('id');
13 13
 			$table->integer('criterion_id')->unsigned();
14 14
 			$table->integer('rubric_id')->unsigned();
@@ -26,6 +26,7 @@ class CreateCriterionRubric extends Migration
26 26
 				->on('rubrics')
27 27
 				->onDelete('cascade')
28 28
 				->onUpdate('cascade');
29
+			$table->integer('position');
29 30
 		});
30 31
 	}
31 32
 
@@ -37,6 +38,6 @@ class CreateCriterionRubric extends Migration
37 38
 	 */
38 39
 	public function down()
39 40
 	{
40
-		Schema::drop('criterion_rubric');
41
+		Schema::drop('rubric_criterion');
41 42
 	}
42 43
 }

+ 1
- 0
app/database/migrations/2021_06_05_235749_create_objective_outcome_table.php Просмотреть файл

@@ -27,6 +27,7 @@ class CreateObjectiveOutcomeTable extends Migration
27 27
 				->onDelete('cascade')
28 28
 				->onUpdate('cascade');
29 29
 			$table->timestamps();
30
+			$table->unique(array('objective_id', 'outcome_id'));
30 31
 		});
31 32
 	}
32 33
 

+ 7
- 2
app/database/migrations/2021_06_06_000025_create_criterion_objective_outcome_table.php Просмотреть файл

@@ -11,7 +11,7 @@ class CreateCriterionObjectiveOutcomeTable extends Migration
11 11
 		Schema::create('criterion_objective_outcome', function (Blueprint $table) {
12 12
 			$table->increments('id');
13 13
 			$table->integer('criterion_id')->unsigned();
14
-			$table->integer('objective_id')->unsigned()->nullable();
14
+			$table->integer('objective_id')->unsigned();
15 15
 			$table->integer('outcome_id')->unsigned();
16 16
 			$table
17 17
 				->foreign('criterion_id')
@@ -19,7 +19,7 @@ class CreateCriterionObjectiveOutcomeTable extends Migration
19 19
 				->on('criteria')
20 20
 				->onDelete('cascade')
21 21
 				->onUpdate('cascade');
22
-			$table
22
+			/*$table
23 23
 				->foreign('objective_id')
24 24
 				->references('id')
25 25
 				->on('objectives')
@@ -30,6 +30,11 @@ class CreateCriterionObjectiveOutcomeTable extends Migration
30 30
 				->references('id')
31 31
 				->on('outcomes')
32 32
 				->onDelete('cascade')
33
+				->onUpdate('cascade');*/
34
+			$table->foreign(array('objective_id', 'outcome_id'))
35
+				->references(array('objective_id', 'outcome_id'))
36
+				->on('objective_outcome')
37
+				->onDelete('cascade')
33 38
 				->onUpdate('cascade');
34 39
 			$table->timestamps();
35 40
 		});

+ 0
- 38
app/database/migrations/2021_06_06_000518_create_rubric_criteria_scales_table.php Просмотреть файл

@@ -1,38 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Schema\Blueprint;
4
-use Illuminate\Database\Migrations\Migration;
5
-
6
-class CreateRubricCriteriaScalesTable extends Migration
7
-{
8
-
9
-	public function up()
10
-	{
11
-		Schema::create("rubric_criteria_scale", function (Blueprint $table) {
12
-			$table->increments('id');
13
-			$table->integer('rubric_criterion_id')->unsigned();
14
-			$table->integer('scale_id')->unsigned();
15
-			$table->foreign('scale_id')
16
-				->references('id')
17
-				->on('scales')
18
-				->onDelete('cascade')
19
-				->onUpdate('cascade');
20
-			$table->foreign('rubric_criterion_id')
21
-				->references('id')
22
-				->on('criterion_rubric')
23
-				->onDelete('cascade')
24
-				->onUpdate('cascade');
25
-			$table->integer('position');
26
-		});
27
-	}
28
-
29
-	/**
30
-	 * Reverse the migrations.
31
-	 *
32
-	 * @return void
33
-	 */
34
-	public function down()
35
-	{
36
-		Schema::drop('rubric_criteria_scale');
37
-	}
38
-}

app/database/migrations/2021_06_06_001211_create_transformative_objective_program_table.php → app/database/migrations/2021_06_06_001211_create_transformative_objective_course_table.php Просмотреть файл

@@ -3,12 +3,12 @@
3 3
 use Illuminate\Database\Schema\Blueprint;
4 4
 use Illuminate\Database\Migrations\Migration;
5 5
 
6
-class CreateTransformativeObjectiveProgramTable extends Migration
6
+class CreateTransformativeObjectiveCourseTable extends Migration
7 7
 {
8 8
 
9 9
 	public function up()
10 10
 	{
11
-		Schema::create('transformative_objective_program', function (Blueprint $table) {
11
+		Schema::create('transformative_objective_course', function (Blueprint $table) {
12 12
 			$table->increments('id');
13 13
 			$table->timestamps();
14 14
 
@@ -26,12 +26,15 @@ class CreateTransformativeObjectiveProgramTable extends Migration
26 26
 				->onDelete('cascade')
27 27
 				->onUpdate('cascade');
28 28
 
29
-			$table->integer('program_id')->unsigned();
29
+			$table->string('course_code');
30
+			$table->string('course_number');
31
+
32
+			/*$table->integer('program_id')->unsigned();
30 33
 			$table->foreign('program_id')
31 34
 				->references('id')
32 35
 				->on('programs')
33 36
 				->onDelete('cascade')
34
-				->onUpdate('cascade');
37
+				->onUpdate('cascade');*/
35 38
 		});
36 39
 	}
37 40
 
@@ -42,6 +45,6 @@ class CreateTransformativeObjectiveProgramTable extends Migration
42 45
 	 */
43 46
 	public function down()
44 47
 	{
45
-		Schema::drop('transformative_objective_program');
48
+		Schema::drop('transformative_objective_course');
46 49
 	}
47 50
 }

+ 1
- 0
app/database/migrations/2021_06_07_001028_create_templates_criterion_table.php Просмотреть файл

@@ -22,6 +22,7 @@ class CreateTemplatesCriterionTable extends Migration
22 22
 				->on('templates')
23 23
 				->onDelete('cascade')
24 24
 				->onUpdate('cascade');
25
+			$table->integer('position')->unsigned();
25 26
 		});
26 27
 	}
27 28
 

+ 0
- 38
app/database/migrations/2021_06_07_001036_create_templates_criterion_scale_table.php Просмотреть файл

@@ -1,38 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Schema\Blueprint;
4
-use Illuminate\Database\Migrations\Migration;
5
-
6
-class CreateTemplatesCriterionScaleTable extends Migration
7
-{
8
-
9
-	public function up()
10
-	{
11
-		Schema::create('template_criterion_scale', function (Blueprint $table) {
12
-			$table->increments('id');
13
-			$table->integer('template_criterion_id')->unsigned();
14
-			$table->integer('scale_id')->unsigned();
15
-			$table->foreign('template_criterion_id')
16
-				->references('id')
17
-				->on('template_criterion')
18
-				->onDelete('cascade')
19
-				->onUpdate('cascade');
20
-			$table->foreign('scale_id')
21
-				->references('id')
22
-				->on('scales')
23
-				->onDelete('cascade')
24
-				->onUpdate('cascade');
25
-			$table->integer('position');
26
-		});
27
-	}
28
-
29
-	/**
30
-	 * Reverse the migrations.
31
-	 *
32
-	 * @return void
33
-	 */
34
-	public function down()
35
-	{
36
-		Schema::drop('template_criterion_scale');
37
-	}
38
-}

+ 3
- 3
app/database/migrations/2021_06_15_235856_create_annual_plan_transformative_table.php Просмотреть файл

@@ -27,10 +27,10 @@ class CreateAnnualPlanTransformativeTable extends Migration
27 27
 				->on('annual_plans')
28 28
 				->onDelete('cascade')
29 29
 				->onUpdate('cascade');
30
-			$table->integer('typ_semester_objective_id')->unsigned();
31
-			$table->foreign('typ_semester_objective_id')
30
+			$table->integer('typ_semester_course_id')->unsigned();
31
+			$table->foreign('typ_semester_course_id')
32 32
 				->references('id')
33
-				->on('typ_semester_objectives')
33
+				->on('typ_semester_courses')
34 34
 				->onDelete('cascade')
35 35
 				->onUpdate('cascade');
36 36
 			$table->integer('proposing_coordinator_id')->unsigned();

+ 0
- 34
app/database/migrations/2021_06_22_150017_delete_min_max_scales.php Просмотреть файл

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

+ 0
- 41
app/database/migrations/2021_06_22_150108_add_copyright_notes_rubric_criterion.php Просмотреть файл

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

+ 0
- 34
app/database/migrations/2021_06_22_150135_change_weight_float.php Просмотреть файл

@@ -1,34 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Schema\Blueprint;
4
-use Illuminate\Database\Migrations\Migration;
5
-
6
-class ChangeWeightFloat extends Migration
7
-{
8
-
9
-	/**
10
-	 * Run the migrations.
11
-	 *
12
-	 * @return void
13
-	 */
14
-	public function up()
15
-	{
16
-		Schema::table('activity_criterion', function (Blueprint $table) {
17
-
18
-			DB::statement("ALTER TABLE `activity_criterion` MODIFY COLUMN `weight` decimal(6,2)");
19
-		});
20
-	}
21
-
22
-	/**
23
-	 * Reverse the migrations.
24
-	 *
25
-	 * @return void
26
-	 */
27
-	public function down()
28
-	{
29
-		Schema::table('activity_criterion', function (Blueprint $table) {
30
-
31
-			DB::statement("ALTER TABLE `activity_criterion` MODIFY COLUMN `weight` decimal(3,2)");
32
-		});
33
-	}
34
-}

+ 31
- 0
app/database/migrations/2021_07_05_083455_create_titles.php Просмотреть файл

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

+ 0
- 43
app/database/migrations/2021_07_06_075249_fix_activities.php Просмотреть файл

@@ -1,43 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Schema\Blueprint;
4
-use Illuminate\Database\Migrations\Migration;
5
-
6
-class FixActivities extends Migration
7
-{
8
-
9
-	/**
10
-	 * Run the migrations.
11
-	 *
12
-	 * @return void
13
-	 */
14
-	public function up()
15
-	{
16
-		Schema::table('activities', function (Blueprint $table) {
17
-			$table->dropColumn(array(
18
-				'criteria_achieved',
19
-				'outcomes_attempted', 'outcomes_achieved',
20
-				'criteria_weights', 'criteria_achieved_percentage',
21
-				'criteria_participant_count', 'criteria_achiever_count'
22
-			));
23
-		});
24
-	}
25
-
26
-	/**
27
-	 * Reverse the migrations.
28
-	 *
29
-	 * @return void
30
-	 */
31
-	public function down()
32
-	{
33
-		Schema::table('activities', function (Blueprint $table) {
34
-			$table->text('criteria_achieved')->nullable();
35
-			$table->text('criteria_weights')->nullable();
36
-			$table->text('outcomes_achieved')->nullable();
37
-			$table->text('outcomes_attempted')->nullable();
38
-			$table->text('criteria_achieved_percentage')->nullable();
39
-			$table->text('criteria_participant_count')->nullable();
40
-			$table->text('criteria_achiever_count')->nullable();
41
-		});
42
-	}
43
-}

+ 6
- 1
app/database/migrations/2021_07_06_082232_rubric_titles.php Просмотреть файл

@@ -15,7 +15,12 @@ class RubricTitles extends Migration
15 15
 	{
16 16
 		Schema::create('rubric_title', function (Blueprint $table) {
17 17
 			$table->increments('id');
18
-			$table->string('title');
18
+			$table->integer('title_id')->unsigned();
19
+			$table->foreign('title_id')
20
+				->references('id')
21
+				->on('titles')
22
+				->onDelete('cascade')
23
+				->onUpdate('cascade');
19 24
 			$table->integer('position');
20 25
 			$table->integer('rubric_id')->unsigned();
21 26
 			$table->foreign('rubric_id')

+ 6
- 1
app/database/migrations/2021_07_06_085513_template_titles.php Просмотреть файл

@@ -15,7 +15,12 @@ class TemplateTitles extends Migration
15 15
 	{
16 16
 		Schema::create('template_title', function (Blueprint $table) {
17 17
 			$table->increments('id');
18
-			$table->string('title');
18
+			$table->integer('title_id')->unsigned();
19
+			$table->foreign('title_id')
20
+				->references('id')
21
+				->on('titles')
22
+				->onDelete('cascade')
23
+				->onUpdate('cascade');
19 24
 			$table->integer('position');
20 25
 			$table->integer('template_id')->unsigned();
21 26
 			$table->foreign('template_id')

app/database/migrations/2021_07_06_130407_create_transformative_objective_activity.php → app/database/migrations/2021_07_22_092532_create_transformative_activity_criterion.php Просмотреть файл

@@ -3,7 +3,7 @@
3 3
 use Illuminate\Database\Schema\Blueprint;
4 4
 use Illuminate\Database\Migrations\Migration;
5 5
 
6
-class CreateTransformativeObjectiveActivity extends Migration
6
+class CreateTransformativeActivityCriterion extends Migration
7 7
 {
8 8
 
9 9
 	/**
@@ -13,24 +13,20 @@ class CreateTransformativeObjectiveActivity extends Migration
13 13
 	 */
14 14
 	public function up()
15 15
 	{
16
-		Schema::create('transformative_objective_activity', function (Blueprint $table) {
16
+		Schema::create('transformative_activity_criterion', function (Blueprint $table) {
17 17
 			$table->increments('id');
18 18
 			$table->integer('trans_action_id')->unsigned();
19
-			$table->integer('activity_id')->unsigned();
20
-			$table->integer('objective_id')->unsigned();
21
-			$table->foreign('objective_id')
22
-				->references('id')
23
-				->on('objectives')
24
-				->onDelete('cascade')
25
-				->onUpdate('cascade');
19
+			$table->integer('activity_criterion_id')->unsigned();
20
+
21
+
26 22
 			$table->foreign('trans_action_id')
27 23
 				->references('id')
28 24
 				->on('transformative_actions')
29 25
 				->onDelete('cascade')
30 26
 				->onUpdate('cascade');
31
-			$table->foreign('activity_id')
27
+			$table->foreign('activity_criterion_id')
32 28
 				->references('id')
33
-				->on('activities')
29
+				->on('activity_criterion')
34 30
 				->onDelete('cascade')
35 31
 				->onUpdate('cascade');
36 32
 		});
@@ -43,6 +39,6 @@ class CreateTransformativeObjectiveActivity extends Migration
43 39
 	 */
44 40
 	public function down()
45 41
 	{
46
-		Schema::drop('transformative_objective_activity');
42
+		Schema::drop('transformative_activity_criterion');
47 43
 	}
48 44
 }

+ 2
- 2
app/database/old_migrations/2020_04_22_095649_create_new_criterion_rubric_table.php Просмотреть файл

@@ -13,7 +13,7 @@ class CreateNewCriterionRubricTable extends Migration
13 13
 	 */
14 14
 	public function up()
15 15
 	{
16
-		Schema::create('criterion_rubric', function (Blueprint $table) {
16
+		Schema::create('rubric_criterion', function (Blueprint $table) {
17 17
 			$table->increments('id');
18 18
 			$table->integer('criterion_id')->unsigned();
19 19
 			$table->integer('rubric_id')->unsigned();
@@ -42,6 +42,6 @@ class CreateNewCriterionRubricTable extends Migration
42 42
 	 */
43 43
 	public function down()
44 44
 	{
45
-		Schema::drop('criterion_rubric');
45
+		Schema::drop('rubric_criterion');
46 46
 	}
47 47
 }

+ 2
- 2
app/database/old_migrations/2021_03_29_151507_create_transformative_objective_program.php Просмотреть файл

@@ -13,7 +13,7 @@ class CreateTransformativeObjectiveProgram extends Migration
13 13
 	 */
14 14
 	public function up()
15 15
 	{
16
-		Schema::create('transformative_objective_program', function (Blueprint $table) {
16
+		Schema::create('transformative_objective_course', function (Blueprint $table) {
17 17
 			$table->increments('id');
18 18
 			$table->timestamps();
19 19
 
@@ -47,6 +47,6 @@ class CreateTransformativeObjectiveProgram extends Migration
47 47
 	 */
48 48
 	public function down()
49 49
 	{
50
-		Schema::drop('transformative_objective_program');
50
+		Schema::drop('transformative_objective_course');
51 51
 	}
52 52
 }

+ 1
- 1
app/database/old_migrations/2021_05_20_184230_create_rubric_scales.php Просмотреть файл

@@ -25,7 +25,7 @@ class CreateRubricScales extends Migration
25 25
 				->onUpdate('cascade');
26 26
 			$table->foreign('rubric_criterion_id')
27 27
 				->references('id')
28
-				->on('criterion_rubric')
28
+				->on('rubric_criterion')
29 29
 				->onDelete('cascade')
30 30
 				->onUpdate('cascade');
31 31
 			$table->integer('position');

+ 5
- 5
app/database/seeds/FillNewAssessmentActivityCriterion.php Просмотреть файл

@@ -10,10 +10,10 @@ class FillNewAssessmentActivityCriterion extends Seeder
10 10
 		$activities = DB::table('activities')
11 11
 			->join('rubric_activity', 'activities.id', '=', 'rubric_activity.activity_id')
12 12
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
13
-			->join('criterion_rubric', 'rubrics.id', '=', 'criterion_rubric.rubric_id')
14
-			->select('activities.*', 'rubrics.expected_percentage', 'rubrics.expected_points', 'criterion_rubric.criterion_id')
13
+			->join('rubric_criterion', 'rubrics.id', '=', 'rubric_criterion.rubric_id')
14
+			->select('activities.*', 'rubrics.expected_percentage', 'rubrics.expected_points', 'rubric_criterion.criterion_id')
15 15
 			->orderBy('activities.id')
16
-			->orderBy('criterion_rubric.criterion_id')
16
+			->orderBy('rubric_criterion.criterion_id')
17 17
 			->get();
18 18
 		//   DB::enableQueryLog();
19 19
 		// 		dd(DB::getQueryLog());
@@ -83,9 +83,9 @@ class FillNewAssessmentActivityCriterion extends Seeder
83 83
 					// 					var_dump($criterion_id);
84 84
 					var_dump($assessment);
85 85
 					// 					$activities=DB::table('activities')->where('id', $activity_id)->first();
86
-					// 					$criterion_rubric=DB::table('criterion_rubric')->where('criterion_id', $criterion_id)->first();
86
+					// 					$rubric_criterion=DB::table('rubric_criterion')->where('criterion_id', $criterion_id)->first();
87 87
 					// 					var_dump($activities);
88
-					// 					var_dump($criterion_rubric);
88
+					// 					var_dump($rubric_criterion);
89 89
 					// 					exit();
90 90
 					$activity_criterion_id = DB::table('activity_criterion')->insertGetId(
91 91
 						array(

+ 2
- 2
app/database/seeds/FillNewCriterionRubric.php Просмотреть файл

@@ -59,9 +59,9 @@ class FillNewCriterionRubric extends Seeder
59 59
 					if (empty($existe2)) {
60 60
 						DB::table('criteria')->insert($criterion);
61 61
 					}
62
-					$existe3 = (array)DB::table('criterion_rubric')->where('criterion_id', $criterion["id"])->where('rubric_id', $rubric->id)->first();
62
+					$existe3 = (array)DB::table('rubric_criterion')->where('criterion_id', $criterion["id"])->where('rubric_id', $rubric->id)->first();
63 63
 					if (empty($existe3)) {
64
-						DB::table('criterion_rubric')->insert(
64
+						DB::table('rubric_criterion')->insert(
65 65
 							array('criterion_id' => $dato["id"], 'rubric_id' => $rubric->id)
66 66
 						);
67 67
 					}

+ 59
- 1
app/models/Activity.php Просмотреть файл

@@ -31,6 +31,35 @@ class Activity extends Eloquent
31 31
 
32 32
     return count($amount_of_students);
33 33
   }
34
+
35
+  public function criteria_achieved()
36
+  {
37
+
38
+    $activity_criterion = DB::table('activity_criterion')
39
+      ->where('activity_id', '=', $this->id)
40
+      ->get();
41
+    $criteria_achieved = [];
42
+    foreach ($activity_criterion as $index => $single_ac) {
43
+
44
+      $assessments_passed = count(DB::table('assessments')
45
+        ->where('score', '>=', $this->rubric[0]->expected_points)
46
+        ->where('activity_criterion_id', '=', $single_ac->id)
47
+        ->lists('student_id'));
48
+      $assessments_attempted = count(DB::table('assessments')
49
+        ->where('activity_criterion_id', '=', $single_ac->id)
50
+        ->lists('student_id'));
51
+
52
+      if ((($assessments_passed / $assessments_attempted) * 100) >= $this->rubric[0]->expected_percentage) {
53
+        $criteria_achieved[$single_ac->criterion_id] = 1;
54
+      } else {
55
+        $criteria_achieved[$single_ac->criterion_id] = 0;
56
+      }
57
+    }
58
+    return  $criteria_achieved;
59
+  }
60
+
61
+
62
+
34 63
   // cap_array
35 64
   public function getCapArrayAttribute()
36 65
   {
@@ -85,6 +114,7 @@ class Activity extends Eloquent
85 114
   // o_ach_array
86 115
   public function getOAchArrayAttribute($value)
87 116
   {
117
+    /*
88 118
     $outcomes_achieved = [];
89 119
     $all_criterion = DB::table('activity_criterion')
90 120
       ->where('activity_criterion.activity_id', '=', $this->id)
@@ -129,11 +159,39 @@ class Activity extends Eloquent
129 159
       }
130 160
     }
131 161
 
162
+    return $outcomes_achieved;*/
163
+
164
+    $outcomes_achieved = [];
165
+
166
+    $criteria_achieved = $this->criteria_achieved();
167
+
168
+
169
+    $all_outcomes = DB::table('outcomes')->lists('id');
170
+
171
+    foreach ($all_outcomes as $outcome_id) {
172
+      $outcomes_achieved[$outcome_id] = 0;
173
+    }
174
+
175
+    foreach ($criteria_achieved as $criterion_id => $passed) {
176
+
177
+      if ($passed == 1) {
178
+        $outcomes_related = DB::table('criterion_objective_outcome')
179
+          ->where("criterion_id", '=', $criterion_id)
180
+          ->select('outcome_id')
181
+          ->distinct()
182
+          ->lists('outcome_id');
183
+
184
+        foreach ($outcomes_related as $index => $outcome_id) {
185
+
186
+          $outcomes_achieved[$outcome_id] += 1;
187
+        }
188
+      }
189
+    }
132 190
     return $outcomes_achieved;
133 191
   }
134 192
 
135 193
   // o_att_array
136
-  public function getOAttArrayAttribute($value)
194
+  public function getOAttArrayAttribute()
137 195
   {
138 196
 
139 197
 

+ 4
- 2
app/models/Course.php Просмотреть файл

@@ -33,12 +33,14 @@ class Course extends Eloquent
33 33
 
34 34
   public function assessedActivities()
35 35
   {
36
-    return $this->hasMany('Activity')->whereNotNull('activities.outcomes_attempted')->orderBy('date', 'asc');
36
+    // return $this->hasMany('Activity')->whereNotNull('activities.outcomes_attempted')->orderBy('date', 'asc');
37
+    return $this->hasMany('Activity')->where('activities.draft', 0)->orderBy('date', 'asc');
37 38
   }
38 39
 
39 40
   public function publishedActivities()
40 41
   {
41
-    return $this->hasMany('Activity')->whereNotNull('activities.outcomes_attempted')->where('activities.draft', 0)->orderBy('date', 'asc');
42
+    //return $this->hasMany('Activity')->whereNotNull('activities.outcomes_attempted')->where('activities.draft', 0)->orderBy('date', 'asc');
43
+    return $this->hasMany('Activity')->where('activities.draft', 0)->orderBy('date', 'asc');
42 44
   }
43 45
 
44 46
   public function outcomes_attempted()

+ 44
- 46
app/models/Criterion.php Просмотреть файл

@@ -7,8 +7,8 @@ class Criterion extends Eloquent
7 7
 	use SoftDeletingTrait;
8 8
 	protected $dates = ['deleted_at'];
9 9
 
10
-//     protected $table = 'new_criteria';
11
-    protected $table = 'criteria';
10
+	//     protected $table = 'new_criteria';
11
+	protected $table = 'criteria';
12 12
 
13 13
 	public function outcomes()
14 14
 	{
@@ -23,11 +23,11 @@ class Criterion extends Eloquent
23 23
 		return $this->belongsToMany('Objective');
24 24
 	}
25 25
 
26
-    public function rubrics()
27
-    {
28
-//         return $this->belongsToMany('Rubric', 'new_criterion_rubric');
29
-        return $this->belongsToMany('Rubric', 'criterion_rubric');
30
-    }
26
+	public function rubrics()
27
+	{
28
+		//         return $this->belongsToMany('Rubric', 'new_rubric_criterion');
29
+		return $this->belongsToMany('Rubric', 'rubric_criterion');
30
+	}
31 31
 
32 32
 	/**
33 33
 	 * Return the program that the criterion belongs to
@@ -63,18 +63,17 @@ class Criterion extends Eloquent
63 63
 			->select('activity_criterion.id')
64 64
 			->distinct()
65 65
 			->get();
66
-			
67
-		foreach($activities_criterions as $activity_criterion)
68
-		{
69
-		
70
-// 			 $students_attempted+=DB::table('new_assessments')
71
-// 				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
72
-// 				->where('activity_criterion.id',$activity_criterion->id)
73
-// 				->count();
74
-		
75
-			 $students_attempted+=DB::table('assessments')
66
+
67
+		foreach ($activities_criterions as $activity_criterion) {
68
+
69
+			// 			 $students_attempted+=DB::table('new_assessments')
70
+			// 				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
71
+			// 				->where('activity_criterion.id',$activity_criterion->id)
72
+			// 				->count();
73
+
74
+			$students_attempted += DB::table('assessments')
76 75
 				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
77
-				->where('activity_criterion.id',$activity_criterion->id)
76
+				->where('activity_criterion.id', $activity_criterion->id)
78 77
 				->count();
79 78
 		}
80 79
 		return $students_attempted;
@@ -82,41 +81,40 @@ class Criterion extends Eloquent
82 81
 
83 82
 	public static function students_achieved($criterion_id, $activity_id)
84 83
 	{
85
-		$students_achieved=0;
86
-// 		$activities_criterions=DB::table('activity_criterion')
87
-// 			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
88
-// 			->join('courses', 'activities.course_id', '=', 'courses.id')
89
-// 			->where('activities.id','=',$activity_id)
90
-// 			->where('activity_criterion.criterion_id','=',$criterion_id)
91
-// 			->select('activity_criterion.id','expected_student_score')
92
-// 			->distinct()
93
-// 			->get();
94
-
95
-		$activities_criterions=DB::table('activity_criterion')
84
+		$students_achieved = 0;
85
+		// 		$activities_criterions=DB::table('activity_criterion')
86
+		// 			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
87
+		// 			->join('courses', 'activities.course_id', '=', 'courses.id')
88
+		// 			->where('activities.id','=',$activity_id)
89
+		// 			->where('activity_criterion.criterion_id','=',$criterion_id)
90
+		// 			->select('activity_criterion.id','expected_student_score')
91
+		// 			->distinct()
92
+		// 			->get();
93
+
94
+		$activities_criterions = DB::table('activity_criterion')
96 95
 			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
97 96
 			->join('courses', 'activities.course_id', '=', 'courses.id')
98 97
 			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
99 98
 			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
100
-			->where('activities.id','=',$activity_id)
101
-			->where('activity_criterion.criterion_id','=',$criterion_id)
102
-			->select('activity_criterion.id','expected_points')
99
+			->where('activities.id', '=', $activity_id)
100
+			->where('activity_criterion.criterion_id', '=', $criterion_id)
101
+			->select('activity_criterion.id', 'expected_points')
103 102
 			->distinct()
104 103
 			->get();
105
-			
106
-		foreach($activities_criterions as $activity_criterion)
107
-		{
108
-		
109
-// 			$expected_student_score=DB::table('new_criteria')->where('id',$criterion_id)->select('expected_student_score')->get();
110
-// 			 $students_achieved+=DB::table('new_assessments')
111
-// 				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
112
-// 				->where('activity_criterion.id',$activity_criterion->id)
113
-// 				->where('new_assessments.score','>=',$activity_criterion->expected_student_score)
114
-// 				->count();
115
-
116
-			 $students_achieved+=DB::table('assessments')
104
+
105
+		foreach ($activities_criterions as $activity_criterion) {
106
+
107
+			// 			$expected_student_score=DB::table('new_criteria')->where('id',$criterion_id)->select('expected_student_score')->get();
108
+			// 			 $students_achieved+=DB::table('new_assessments')
109
+			// 				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
110
+			// 				->where('activity_criterion.id',$activity_criterion->id)
111
+			// 				->where('new_assessments.score','>=',$activity_criterion->expected_student_score)
112
+			// 				->count();
113
+
114
+			$students_achieved += DB::table('assessments')
117 115
 				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
118
-				->where('activity_criterion.id',$activity_criterion->id)
119
-				->where('assessments.score','>=',$activity_criterion->expected_points)
116
+				->where('activity_criterion.id', $activity_criterion->id)
117
+				->where('assessments.score', '>=', $activity_criterion->expected_points)
120 118
 				->count();
121 119
 		}
122 120
 		return $students_achieved;

+ 1
- 1
app/models/Objective.php Просмотреть файл

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\SoftDeletingTrait;
5 5
 class Objective extends Eloquent
6 6
 {
7 7
     use SoftDeletingTrait;
8
-    protected $fillable = array('text', 'outcome_id', 'program_id', 'active');
8
+    protected $fillable = array('text', 'outcome_id',  'active');
9 9
     protected $table = 'objectives';
10 10
 
11 11
     /**

+ 5
- 0
app/routes.php Просмотреть файл

@@ -166,6 +166,11 @@ Route::group(array('before' => 'auth|has_access'), function () {
166 166
     /**
167 167
      * Shared Routes
168 168
      */
169
+
170
+    Route::post('changeStatusOfCriterion', array(
171
+        'as' => 'changeStatusOfCriterion',
172
+        'uses' => 'CriteriaController@changeStatus'
173
+    ));
169 174
     Route::post('createThreeYearCycle', array(
170 175
         'as' => 'createThreeYearCycle',
171 176
         'uses' => 'ThreeYearPlanController@create'

+ 356
- 4
app/views/global/view-learning-outcomes-criteria.blade.php
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 0
- 1044
app/views/local/managers/admins/new_criteria.blade.php
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 37
- 12
app/views/local/managers/pCoords/criteria.blade.php Просмотреть файл

@@ -284,37 +284,62 @@
284 284
         $('#' + select).html(options);
285 285
         $('#' + select).val(previousvalue);
286 286
         $('#' + select).selectpicker('refresh');
287
+        $('#'+select).trigger('change');
287 288
     }
288 289
 
289 290
     function numberOfAssoc(string, Scales) {
290 291
         var maximum = $('#assoc_maximum_score').val();
291 292
         var amountOfScale = parseInt($('#' + string).val());
292 293
         var dataValue = parseInt($('#' + Scales).attr('data-value'));
294
+        var division = maximum/amountOfScale;
293 295
         //add
294
-        if (dataValue < amountOfScale) {
296
+        
295 297
 
296 298
             fullDiv = '';
297
-
299
+        if(division ==1){
298 300
             for (var i = dataValue; i < amountOfScale; i++) {
299 301
                 div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
300 302
                     '<div class ="form-group">' +
301
-                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
302
-                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
303
+                    '<label for ="assoc_descripcion' + i.toString() + '">Scale Description ('+(i+1)+')</label>' +
304
+                    '<textarea class="form-control" rows="2" aria-labelledby="assoc_descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
303 305
                 fullDiv += div;
304 306
 
305 307
 
306 308
             }
309
+        }
310
+        else if(division == maximum){
311
+            div = '<div id="assoc_eval' +0 + Scales + '">' +
312
+                    '<div class ="form-group">' +
313
+                    '<label for ="assoc_descripcion' + 0 + '">Scale Description ('+1+' - '+maximum+') </label>' +
314
+                    '<textarea class="form-control" rows="2" aria-labelledby="assoc_descripcion' + 0 + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
315
+                fullDiv += div;
316
+        }
317
+        else{
318
+            for (var i = 0; i < amountOfScale; i++) {
307 319
 
308
-            $('#' + Scales).append(fullDiv);
309
-            $('#' + Scales).attr('data-value', amountOfScale);
310
-        } else {
311
-            for (var i = dataValue; i > amountOfScale; i--) {
312
-                $('#assoc_eval' + (i - 1).toString()).remove();
313
-            }
320
+            div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
321
+                    '<div class ="form-group">' +
322
+                    '<label for ="assoc_descripcion' + i.toString() + '">Scale Description ('+(1+(i*division))+' - '+((1+i)*division)+')</label>' +
323
+                    '<textarea class="form-control" rows="2" aria-labelledby="assoc_descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
324
+                fullDiv += div;
325
+        }
314 326
         }
315
-        $('#' + Scales).attr('data-value', amountOfScale);
316 327
 
317
-    }
328
+            $('#' + Scales).html(fullDiv);
329
+            $('#' + Scales).attr('data-value', amountOfScale);
330
+        } 
331
+    
332
+        
333
+
334
+        
335
+        
336
+        //add
337
+    
338
+
339
+
340
+
341
+
342
+
318 343
    
319 344
     function numberOfScales(string, Scales) {
320 345
         var maximum = parseInt($('#maximum_score').val());

+ 1275
- 0
app/views/local/managers/pCoords/new_criteria.blade.php
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 45
- 20
app/views/local/managers/shared/rubrics.blade.php Просмотреть файл

@@ -195,12 +195,19 @@
195 195
             <form>
196 196
                 <div class="form-group">
197 197
                     <label>Select a Learning Outcome</label>
198
-                    <select id="select-outcome" class="form-control selectpicker">
198
+                    <select id="select-outcome" class="form-control selectpicker" onchange="fetchObjective(this)">
199 199
                         @foreach ($outcomes as $outcome)
200 200
                         <option data-outcome-id="{{ $outcome->id }}">{{ $outcome->name }}</option>
201 201
                         @endforeach
202 202
                     </select>
203 203
                 </div>
204
+                <div class="form-group">
205
+                    <label>Select an Objective</label>
206
+                    <select id="select-objective" class="form-control selectpicker" onchange="fetchCriteria($('#select-outcome'), this)">
207
+                        
208
+                    </select>
209
+                </div>
210
+
204 211
                     <div class="form-group">
205 212
                         <label>Select the Maximum Score</label>
206 213
                     <select id="max_score" class="form-control selectpicker">
@@ -310,8 +317,28 @@
310 317
 // Functions
311 318
 // --------------------------------------------------------------------------
312 319
 
320
+function fetchObjective(outcome){
321
+    $.post(
322
+        "{{URL::route('fetchObjectivesForSelect')}}",
323
+        {
324
+            outcomeID:$(outcome).find(':selected').data('outcome-id'),
325
+        },
326
+        function(data){
327
+            options = '';
328
+            for(objective_index in data){
329
+                options += '<option value = "'+data[objective_index].objective_id+'">'+data[objective_index].text+'</option>';
330
+
331
+            }
332
+            $('#select-objective').html(options);
333
+            $('#select-objective').selectpicker('refresh');
334
+            fetchCriteria($('#select-outcome'), $('#select-objective'));
335
+
336
+        }, 'json',
337
+    );
338
+
339
+}
313 340
 // Fetch criteria associated to a specific learning outcome
314
-function fetchCriteria(outcome)
341
+function fetchCriteria(outcome, objective)
315 342
 {
316 343
     $.post
317 344
     (
@@ -428,7 +455,7 @@ function addCriterion()
428 455
 
429 456
             if(notes)
430 457
             {
431
-                str+='<span><em data-toggle="tooltip" data-placement="top" title="'+notes+'">'+name+'</em></span><sup></sup>'+subcriteria+'</td>';
458
+                str+='<span><em data-toggle="tooltip" data-placement="top" title="'+notes+'">'+data.criterion.name+'</em></span><sup></sup>'+subcriteria+'</td>';
432 459
             }
433 460
             else
434 461
             {
@@ -446,17 +473,15 @@ function addCriterion()
446 473
                 str+='<td class="editable" data-type="textarea"></td>';
447 474
             }
448 475
         }
449
-        if(copyright== null) copyright= '';
450
-        if(notes == null)notes ='';
451
-        str += '<td class = "editable nullable" data-type = "textarea">'+copyright+'</td>';
452
-        str+= '<td class = "editable nullable" data-type = "textarea">'+notes+'</td>';
476
+        str+= '<td>'+data.outcomes+'</td>'
477
+        
453 478
 
454 479
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
455 480
 
456 481
             $('table tbody').append(str);
457 482
 
458 483
             // Build copyright list
459
-            buildOutcomeList();
484
+            buildCopyrightList();
460 485
 
461 486
             // Enable X-Edtable on this new row
462 487
             $('.editable').editable({
@@ -506,7 +531,7 @@ function fetchCriterion(criterion)
506 531
 }
507 532
 
508 533
 // Build list from copyright info in rubric
509
-function buildOutcomeList()
534
+function buildCopyrightList()
510 535
 {
511 536
     // Empty the copyright list
512 537
     $('#copyright-list').empty();
@@ -515,15 +540,15 @@ function buildOutcomeList()
515 540
     {
516 541
         var criterion = $(this);
517 542
         // If there's copyright info
518
-        if(criterion.data('outcomes')!=null){
519
-            var outcomes = criterion.data('outcomes');
543
+        if(criterion.data('copyright')!=null){
544
+            var copyright = criterion.data('copyright');
520 545
             if($('#copyright-list li').length>0)
521 546
             {
522 547
                 var found = false;
523 548
                 $('#copyright-list li').each(function()
524 549
                 {
525 550
                     // If found, give the string its number
526
-                    if(outcomes==$(this).find('span').text())
551
+                    if(copyright==$(this).find('span').text())
527 552
                     {
528 553
 
529 554
                         copyrightNumber = Number.parseInt($(this).find('sup').text());
@@ -548,13 +573,13 @@ function buildOutcomeList()
548 573
                     console.log(criterion.children('td:nth-child(2)').find('sup').length);
549 574
 
550 575
                     criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
551
-                    $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+outcomes+'<span></li>');
576
+                    $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
552 577
                 }
553 578
             }
554 579
             else
555 580
             {
556 581
                 criterion.children('td:nth-child(2)').find('sup').text('1');
557
-                $('#copyright-list').append('<li><sup>1 </sup><span>'+outcomes+'<span></li>');
582
+                $('#copyright-list').append('<li><sup>1 </sup><span>'+copyright+'<span></li>');
558 583
             }
559 584
         }
560 585
     });
@@ -825,7 +850,7 @@ function loadTemplate()
825 850
                 $('table tbody').append(str);
826 851
 
827 852
                 // Build copyright list
828
-                buildOutcomeList();
853
+                buildCopyrightList();
829 854
 
830 855
                 // Enable X-Edtable on this new row
831 856
                 $('.editable').editable({
@@ -850,7 +875,7 @@ function loadTemplate()
850 875
             });
851 876
 
852 877
             // Build Copyright List
853
-            buildOutcomeList();
878
+            buildCopyrightList();
854 879
 
855 880
             var selected = $('#select-template').find(':selected');
856 881
         var programs = {{ json_encode(Auth::user()->programs->lists('id')) }};
@@ -1033,7 +1058,7 @@ function changeTable(){
1033 1058
                 counter++;
1034 1059
             }
1035 1060
             }
1036
-            newScaleHeaders += '<th>Copyright</th><th>Notes</th><th></th>';
1061
+            newScaleHeaders += '<th>Outcomes</th><th></th>';
1037 1062
             
1038 1063
             $("#criterion-header").html(newScaleHeaders);
1039 1064
             $('#allCriteria').html(' ');
@@ -1079,11 +1104,11 @@ $('#number_of_scales').on('change', function(){
1079 1104
     changeTable();
1080 1105
 })
1081 1106
 // When a learning outcome changes, update its criteria
1082
-$('#select-outcome, input[name=criteria-filter]').on('change', function()
1107
+/*$('#select-outcome, input[name=criteria-filter]').on('change', function()
1083 1108
 {
1084 1109
     fetchCriteria($('#select-outcome'));
1085 1110
 });
1086
-
1111
+*/
1087 1112
 // When the add button is clicked
1088 1113
 $('#button-add-criterion').on('click', function(e)
1089 1114
 {
@@ -1267,7 +1292,7 @@ $('table').on('click', 'span.glyphicon-remove', function(e)
1267 1292
         $('#rubric-container').hide();
1268 1293
     }
1269 1294
 
1270
-    buildOutcomeList();
1295
+    buildCopyrightList();
1271 1296
 });
1272 1297
 
1273 1298
 // When print button is clicked, redirect to print page

+ 5
- 5
app/views/local/professors/assessment.blade.php Просмотреть файл

@@ -103,7 +103,7 @@
103 103
                 <tr>
104 104
                     <th>
105 105
                     </th>
106
-                    @foreach ($criterion_rubric as $index => $criterion)
106
+                    @foreach ($rubric_criterion as $index => $criterion)
107 107
                     <th  data-criterion-id="{{{ $criterion->criterion_id }}}" ><div class="th-box">
108 108
                         
109 109
                         Weight<input class="form-control" id="weight-{{$index}}" name='weight[]' type="text"  value="{{$criterion->weight}}" data-activity-criterion-id="{{$criterion->activity_criterion_id}}">
@@ -116,7 +116,7 @@
116 116
                                 Student
117 117
                             </div>
118 118
                         </th>
119
-                        @foreach ($criterion_rubric as $criterion)
119
+                        @foreach ($rubric_criterion as $criterion)
120 120
                             <th class="criterion-field" data-activity-criterion-id = "{{$criterion->activity_criterion_id}}"data-rubric-criterion-id = "{{$criterion->rubric_criterion_id}}" data-criterion-id="{{{ $criterion->criterion_id }}}" ><div class="th-box">{{ $criterion->name}}</div></th>
121 121
                         @endforeach
122 122
                         <th>Student Percentage</th>
@@ -137,7 +137,7 @@
137 137
                         </td>
138 138
 
139 139
                         <!-- For each criterion in the rubric, there's a score field -->
140
-                        @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
140
+                        @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
141 141
                             <td class="score-field">
142 142
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $student->name }}}">
143 143
                                 <!-- Option from 0-8 -->
@@ -170,7 +170,7 @@
170 170
                 @foreach ($students as $student)
171 171
                     <tr class="student-row">
172 172
                         <td class="student-field" data-student-id={{ $student->id }}>{{{ $student->name }}}</td>
173
-                        @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
173
+                        @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
174 174
                             <td class="score-field" data-weight = '1'>
175 175
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $student->name }}}">
176 176
                                     @for($j=0; $j<=$rubric->max_score; $j++)
@@ -192,7 +192,7 @@
192 192
                     <td>
193 193
                         <strong>Passed Criteria Percentage </strong>
194 194
                     </td>
195
-                    @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
195
+                    @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
196 196
                         <td class="total"><strong><span class="total-value"></span><span class="percent-sign">%</span></strong>
197 197
                         </td>
198 198
                     @endfor

+ 1
- 0
app/views/local/professors/assessment_report.blade.php Просмотреть файл

@@ -119,6 +119,7 @@ Log::info('aqui papi');?>
119 119
                                                 $o_ach_array = $activity->o_ach_array;
120 120
                                                 Log::info($o_att_array);
121 121
                                                 Log::info($o_ach_array);
122
+                                                Log::info('los outcomes');
122 123
                                                 $percentage = ($o_ach_array[$outcome->id]/$o_att_array[$outcome->id])*100;
123 124
                                             ?>
124 125
                                             @if($percentage >= 100)

+ 1
- 1
app/views/local/professors/viewrubric.blade.php Просмотреть файл

@@ -39,7 +39,7 @@
39 39
           </tr>
40 40
         </thead>
41 41
         <tbody>
42
-        @foreach($criterion_rubric as $index => $criterion)
42
+        @foreach($rubric_criterion as $index => $criterion)
43 43
           <tr data-criterion-copyright="{{ $criterion->copyright }}" data-criterion-notes="{{ $criterion->notes }}">
44 44
             <td>{{ $index + 1 }}.</td>
45 45
             @if(isset($criterion->notes))