Browse Source

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

Para entrar migrations nuevos
parent
commit
a153830965
48 changed files with 3173 additions and 2538 deletions
  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 View File

167
         $rubric = Rubric::find($activity->rubric[0]->id);
167
         $rubric = Rubric::find($activity->rubric[0]->id);
168
         Log::info($rubric);
168
         Log::info($rubric);
169
         Log::info($activity);
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
             ->join("activity_criterion", "criteria.id", '=', 'activity_criterion.criterion_id')
172
             ->join("activity_criterion", "criteria.id", '=', 'activity_criterion.criterion_id')
173
             ->where("activity_criterion.activity_id", '=', $activity->id)
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
             ->select('criteria.name', 'criteria.id as criterion_id', 'criteria.subcriteria')
175
             ->select('criteria.name', 'criteria.id as criterion_id', 'criteria.subcriteria')
176
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
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
             ->get();
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
             $singleCR->scales = json_encode(DB::table('scales')->join('rubric_criteria_scale', 'rubric_criteria_scale.scale_id', '=', 'scales.id')
182
             $singleCR->scales = json_encode(DB::table('scales')->join('rubric_criteria_scale', 'rubric_criteria_scale.scale_id', '=', 'scales.id')
183
                 ->where('rubric_criteria_scale.rubric_criterion_id', '=', $singleCR->rubric_criterion_id)
183
                 ->where('rubric_criteria_scale.rubric_criterion_id', '=', $singleCR->rubric_criterion_id)
184
                 ->orderBy('position')
184
                 ->orderBy('position')
185
                 ->lists('description'));
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
         Log::info($rubric);
188
         Log::info($rubric);
189
-        Log::info($criterion_rubric);
189
+        Log::info($rubric_criterion);
190
 
190
 
191
 
191
 
192
 
192
 
213
         Log::info($scores_array);
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
     public function saveAssessment()
219
     public function saveAssessment()

+ 1
- 1
app/controllers/AnnualPlansController.php View File

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
     $typ_info['annual_plan'] = $annual_plan;
231
     $typ_info['annual_plan'] = $annual_plan;
232
     Log::info($typ_info);
232
     Log::info($typ_info);

+ 222
- 114
app/controllers/CriteriaController.php View File

22
 
22
 
23
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
23
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
24
         $programs = Program::where("id", "=", $userProgram[0]->program_id)->get();
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
     public function editSchool()
28
     public function editSchool()
63
         } else {
63
         } else {
64
             foreach ($json_to_send['outcomes'] as $index => $outcome) {
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
             $outcomeStr = rtrim($outcomeStr, ',');
68
             $outcomeStr = rtrim($outcomeStr, ',');
69
         }
69
         }
100
     }
100
     }
101
     public function fetchObjectivesForSelect()
101
     public function fetchObjectivesForSelect()
102
     {
102
     {
103
-
104
         $json = array();
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
         return json_encode($json);
112
         return json_encode($json);
113
     }
113
     }
114
     public function fetchCriterionWithTrashed()
114
     public function fetchCriterionWithTrashed()
115
     {
115
     {
116
 
116
 
117
         $json = array();
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
         $json['criteria'] = DB::select(" select * from criteria where id = ?", array(Input::get('id')));
149
         $json['criteria'] = DB::select(" select * from criteria where id = ?", array(Input::get('id')));
119
         $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')));
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
         $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')));
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
             $outId = $id->id;
157
             $outId = $id->id;
127
             $json['outcomes_assoc'][$outId] = DB::select("select name from outcomes where id = {$outId}");
158
             $json['outcomes_assoc'][$outId] = DB::select("select name from outcomes where id = {$outId}");
128
             $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");
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
         return json_encode($json);
162
         return json_encode($json);
132
     }
163
     }
156
         else
187
         else
157
             $program_id = NULL;
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
             ->where('name', '=', $input['name'])
196
             ->where('name', '=', $input['name'])
161
-            ->where('outcome_id', '=', $input['outcome_id'])
162
-            ->where('program_id', '=', $program_id)
197
+            ->where('subcriteria', '=', $input['subcriteria'])
163
             ->first();
198
             ->first();
164
 
199
 
165
 
200
 
166
 
201
 
202
+
203
+
167
         if ($saved_criterion)
204
         if ($saved_criterion)
168
             return false;
205
             return false;
169
         else
206
         else
197
 
234
 
198
 
235
 
199
         $clean_input['objective_id'] = Input::get('objective');
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
                 'outcome_id' => $clean_input['outcome_id'],
267
                 'outcome_id' => $clean_input['outcome_id'],
228
                 'notes' => $clean_input['notes'],
268
                 'notes' => $clean_input['notes'],
229
                 'copyright' => $clean_input['copyright'],
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
             array(
274
             array(
233
                 'name' => 'required|string',
275
                 'name' => 'required|string',
234
                 'subcriteria' => 'string',
276
                 'subcriteria' => 'string',
235
                 'outcome_id' => 'required|array',
277
                 'outcome_id' => 'required|array',
236
-
278
+                'scales' => 'required|array',
237
                 'notes' => 'string',
279
                 'notes' => 'string',
238
                 'copyright' => 'string',
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
     public function create()
293
     public function create()
251
     {
294
     {
252
         $clean_input = $this->cleanInput();
295
         $clean_input = $this->cleanInput();
296
+        Log::info("POG???");
253
 
297
 
254
         /** Validation rules */
298
         /** Validation rules */
255
-        $validator = $this->makeValidator($clean_input);
299
+        //$validator = $this->makeValidator($clean_input);
256
 
300
 
257
         /** If validation fails */
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
             foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
306
             foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
263
                 $message .= $validationError;
307
                 $message .= $validationError;
266
             $message .= '</ul>';
310
             $message .= '</ul>';
267
 
311
 
268
             /** Send error message and old data */
312
             /** Send error message and old data */
269
-            Session::flash('status', 'danger');
313
+        /* Session::flash('status', 'danger');
270
             Session::flash('message', $message);
314
             Session::flash('message', $message);
271
             $role = Auth::user()['role'];
315
             $role = Auth::user()['role'];
272
             switch ($role) {
316
             switch ($role) {
281
             }
325
             }
282
         } else {
326
         } else {
283
             // Check criterion uniqueness
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
                 Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name and associated program are the same.');
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
                     $scale = new Scale;
387
                     $scale = new Scale;
323
 
388
 
324
                     $position = $i;
389
                     $position = $i;
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
     public function edit()
453
     public function edit()
388
     {
454
     {
389
         $title = "Criteria";
455
         $title = "Criteria";
423
 
489
 
424
 
490
 
425
         $clean_input['subcriteria'] = $trimmed;
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
 
502
 
437
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
503
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
438
         $clean_input['notes'] = trim(preg_replace('/\t+/', '', Input::get('notes')));
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
         return $clean_input;
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
     public function update()
531
     public function update()
449
     {
532
     {
450
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
533
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
471
             $role = Auth::user()['role'];
554
             $role = Auth::user()['role'];
472
             switch ($role) {
555
             switch ($role) {
473
                 case 1:
556
                 case 1:
474
-                    return Redirect::to('objective')->withInput();
557
+                    return Redirect::to('criteria')->withInput();
475
 
558
 
476
                 case 2:
559
                 case 2:
477
-                    return Redirect::to('school-objective')->withInput();
560
+                    return Redirect::to('school-criteria')->withInput();
478
 
561
 
479
                 case 3:
562
                 case 3:
480
-                    return Redirect::to('program-objective')->withInput();
563
+                    return Redirect::to('program-criteria')->withInput();
481
             }
564
             }
482
         } else {
565
         } else {
483
 
566
 
484
             // // Check criterion uniqueness
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
             /** Set info */
585
             /** Set info */
494
             $criterion->name = $clean_input['name'];
586
             $criterion->name = $clean_input['name'];
495
             $criterion->subcriteria = $clean_input['subcriteria'];
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
                 $criterion->notes = NULL;
617
                 $criterion->notes = NULL;
525
 
618
 
526
             /** If criterion is updated, send success message */
619
             /** If criterion is updated, send success message */
620
+            $parentesis = array('(', ')');
527
             if ($criterion->save()) {
621
             if ($criterion->save()) {
528
                 $criterionId = $criterion->id;
622
                 $criterionId = $criterion->id;
529
                 DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
623
                 DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
530
                 DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
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
                 /*DB::delete("delete from `scales` where id in (select scale_id id from criterion_scale where criterion_id = {$criterionId})");
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
                     } else {
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
                 foreach ($clean_input['program_id'] as $program_id) {
669
                 foreach ($clean_input['program_id'] as $program_id) {
564
                     DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
670
                     DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");
565
                 }
671
                 }
641
         } elseif (Auth::user()->role == 2) {
747
         } elseif (Auth::user()->role == 2) {
642
             //buscar los objetivos de la departamento (school)
748
             //buscar los objetivos de la departamento (school)
643
             $objectives = DB::table('program_user')
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
                 ->join('programs', 'programs.id', '=', 'program_user.program_id')
752
                 ->join('programs', 'programs.id', '=', 'program_user.program_id')
646
                 ->where('programs.school_id', Auth::user()->school_id)
753
                 ->where('programs.school_id', Auth::user()->school_id)
647
                 ->select('objectives.id', 'objectives.text', 'programs.name')
754
                 ->select('objectives.id', 'objectives.text', 'programs.name')
650
         } elseif ((Auth::user()->role == 3) || (Auth::user()->role == 4)) {
757
         } elseif ((Auth::user()->role == 3) || (Auth::user()->role == 4)) {
651
             //buscar los objetivos de los programas cuales el profesor esta
758
             //buscar los objetivos de los programas cuales el profesor esta
652
             $objectives = DB::table('program_user')
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
                 ->join('programs', 'programs.id', '=', 'program_user.program_id')
762
                 ->join('programs', 'programs.id', '=', 'program_user.program_id')
655
                 ->where('program_user.user_id', Auth::user()->id)
763
                 ->where('program_user.user_id', Auth::user()->id)
656
                 ->select('objectives.id', 'objectives.text', 'programs.name')
764
                 ->select('objectives.id', 'objectives.text', 'programs.name')

+ 104
- 130
app/controllers/ObjectivesController.php View File

1
 <?php
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
    * Edit the learning objectives per learning outcome for a program
47
    * Edit the learning objectives per learning outcome for a program
60
     $role = Auth::user()->role;
51
     $role = Auth::user()->role;
61
 
52
 
62
     // Redirect users if they try to access forbidden page
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
     $objectives = $program->objectives;
63
     $objectives = $program->objectives;
78
 
64
 
79
     // Eager load outcomes related to objectives
65
     // Eager load outcomes related to objectives
86
 
72
 
87
   public function create()
73
   public function create()
88
   {
74
   {
89
-    try
90
-    {
75
+    try {
91
       $outcome_id = Input::get('outcome_id');
76
       $outcome_id = Input::get('outcome_id');
92
       $program_id = Input::get('program_id');
77
       $program_id = Input::get('program_id');
93
       $learning_objective = trim(Input::get('learning_objective'));
78
       $learning_objective = trim(Input::get('learning_objective'));
94
 
79
 
95
 
80
 
96
       $validator = Validator::make(
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
         /** Prepare error message */
95
         /** Prepare error message */
112
         $message = '<p>Error(s) creating a new Learning Objective: </p><ul>';
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
         /** Send error message and old data */
104
         /** Send error message and old data */
122
         Session::flash('status', 'danger');
105
         Session::flash('status', 'danger');
131
       ));
114
       ));
132
 
115
 
133
       /** Send success message */
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
       /** Send error message and old data */
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
    */
130
    */
150
   public function update()
131
   public function update()
151
   {
132
   {
152
-    try
153
-    {
133
+    try {
154
       $outcome_id = Input::get('edit_outcome_id');
134
       $outcome_id = Input::get('edit_outcome_id');
155
       $objective_id = Input::get('edit_objective_id');
135
       $objective_id = Input::get('edit_objective_id');
156
       $active = Input::get('edit_active');
136
       $active = Input::get('edit_active');
157
       $learning_objective = trim(Input::get('edit_learning_objective'));
137
       $learning_objective = trim(Input::get('edit_learning_objective'));
158
 
138
 
159
       $validator = Validator::make(
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
         /** Prepare error message */
155
         /** Prepare error message */
177
         $message = '<p>Error(s) updating the Learning Objective: </p><ul>';
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
         /** Send error message and old data */
164
         /** Send error message and old data */
187
         Session::flash('status', 'danger');
165
         Session::flash('status', 'danger');
195
           'outcome_id' => $outcome_id,
173
           'outcome_id' => $outcome_id,
196
           'text' => $learning_objective,
174
           'text' => $learning_objective,
197
           'active' => $active,
175
           'active' => $active,
198
-      ));
176
+        ));
199
 
177
 
200
       /** Send success message */
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
       )
202
       )
227
     );
203
     );
228
 
204
 
229
-    if($validator->fails())
230
-    {
205
+    if ($validator->fails()) {
231
       return '';
206
       return '';
232
     }
207
     }
233
     $res = DB::table('objectives')->where('id', Input::get('objective_id'))->first();
208
     $res = DB::table('objectives')->where('id', Input::get('objective_id'))->first();
237
 
212
 
238
   public function fetchObjectiveForCriteria()
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 View File

553
 
553
 
554
         $diferent_levels = DB::table('criterion_objective_outcome')
554
         $diferent_levels = DB::table('criterion_objective_outcome')
555
             ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
555
             ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
556
-            ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
557
             ->where('criterion_objective_outcome.outcome_id', $id)
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
             ->get();
560
             ->get();
562
 
561
 
563
         $criteria_array = array();
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
         $outcome->criteria = array();
581
         $outcome->criteria = array();
566
         foreach ($diferent_levels as $level) {
582
         foreach ($diferent_levels as $level) {
567
             $level = $level->levels;
583
             $level = $level->levels;
578
             //                 ->get();
594
             //                 ->get();
579
             $outcome_criterias = DB::table('criterion_objective_outcome')
595
             $outcome_criterias = DB::table('criterion_objective_outcome')
580
                 ->join('criteria', 'criteria.id', '=', 'criterion_objective_outcome.criterion_id')
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
                 ->where('criterion_objective_outcome.outcome_id', $id)
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
                 ->orderBy('criteria.name', 'asc')
602
                 ->orderBy('criteria.name', 'asc')
587
                 ->get();
603
                 ->get();
588
-            $outcome_criterias = $outcome_criterias;
604
+            // $outcome_criterias = $outcome_criterias;
589
 
605
 
590
             foreach ($outcome_criterias as $criteria_id) {
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
                     DB::select(
616
                     DB::select(
594
                         DB::raw("
617
                         DB::raw("
595
                   SELECT *
618
                   SELECT *
611
                   WHERE rn = 1
634
                   WHERE rn = 1
612
                   ORDER BY `a`.`position` ASC
635
                   ORDER BY `a`.`position` ASC
613
                       ")
636
                       ")
614
-                    );
637
+                    );*/
638
+                $criteria_id->programs = $programs;
615
                 // insertar la informacion de los criterios con N niveles en el arreglo de arreglos
639
                 // insertar la informacion de los criterios con N niveles en el arreglo de arreglos
616
                 $criteria_id->scales = $scales;
640
                 $criteria_id->scales = $scales;
617
                 // $i++;
641
                 // $i++;

+ 15
- 15
app/controllers/RubricsController.php View File

108
 
108
 
109
             $rubricId = $rubric->id;
109
             $rubricId = $rubric->id;
110
             foreach ($criteria as $index => $criterion_id) {
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
                 DB::commit();
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
                     ->where('criterion_id', '=', $criterion_id)->first();
114
                     ->where('criterion_id', '=', $criterion_id)->first();
115
 
115
 
116
 
116
 
270
 
270
 
271
         $course->save();
271
         $course->save();
272
         Log::info('entré6???');
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
         DB::delete("delete from activity_criterion where activity_id = {$activity->id}");
274
         DB::delete("delete from activity_criterion where activity_id = {$activity->id}");
275
         foreach ($criteria as $index => $criterion_id) {
275
         foreach ($criteria as $index => $criterion_id) {
276
             if (
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
                 &&  DB::insert("insert into `activity_criterion` (`activity_id`,`criterion_id`, `weight`) values ({$activity->id}, {$criterion_id}, {$defaultWeight})")
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
                     ->where('rubric_id', '=', $rubric->id)
283
                     ->where('rubric_id', '=', $rubric->id)
284
                     ->where('criterion_id', '=', $criterion_id)
284
                     ->where('criterion_id', '=', $criterion_id)
285
                     ->first();
285
                     ->first();
360
         Log::info($activity->rubric[0]->id);
360
         Log::info($activity->rubric[0]->id);
361
 
361
 
362
         $rubric = Rubric::where('id', '=', $activity->rubric[0]->id)->firstOrFail();
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
             ->get();
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
             $single_cr->scales = json_encode(DB::table('scales')
370
             $single_cr->scales = json_encode(DB::table('scales')
371
                 ->join('rubric_criteria_scale', 'rubric_criteria_scale.scale_id', '=', 'scales.id')
371
                 ->join('rubric_criteria_scale', 'rubric_criteria_scale.scale_id', '=', 'scales.id')
372
                 ->where('rubric_criteria_scale.rubric_criterion_id', '=', $single_cr->id)
372
                 ->where('rubric_criteria_scale.rubric_criterion_id', '=', $single_cr->id)
378
         }
378
         }
379
 
379
 
380
 
380
 
381
-        Log::info($criterion_rubric);
381
+        Log::info($rubric_criterion);
382
 
382
 
383
         $title = $activity->name . ': ' . $rubric->name;
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
         Log::info($rubric);
439
         Log::info($rubric);
440
 
440
 
441
         $rubric["criteria"] = DB::table("criteria")
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
             ->first();
445
             ->first();
446
         return json_encode($rubric);
446
         return json_encode($rubric);
447
 
447
 

+ 848
- 838
app/controllers/TransformativeActionsController.php
File diff suppressed because it is too large
View File


+ 2
- 2
app/database/migrations/2021_06_01_000529_create_scales_table.php View File

12
 			$table->increments('id');
12
 			$table->increments('id');
13
 
13
 
14
 			$table->string('description');
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
 			$table->timestamps();
17
 			$table->timestamps();
18
 		});
18
 		});
19
 	}
19
 	}

+ 2
- 1
app/database/migrations/2021_06_01_235626_create_criteria_table.php View File

15
 			$table->integer('user_id')->unsigned()->nullable();
15
 			$table->integer('user_id')->unsigned()->nullable();
16
 			$table->text('copyright')->nullable();
16
 			$table->text('copyright')->nullable();
17
 			$table->text('notes')->nullable();
17
 			$table->text('notes')->nullable();
18
-
18
+			$table->integer('num_scales');
19
+			$table->integer('max_score');
19
 			$table->timestamps();
20
 			$table->timestamps();
20
 			$table->timestamp('deleted_at')->nullable();
21
 			$table->timestamp('deleted_at')->nullable();
21
 
22
 

+ 2
- 2
app/database/migrations/2021_06_02_000507_create_rubrics_table.php View File

16
 			$table->integer('expected_points');
16
 			$table->integer('expected_points');
17
 			$table->integer('user_id')->unsigned();
17
 			$table->integer('user_id')->unsigned();
18
 			$table->timestamps();
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
 		Schema::table('rubrics', function (Blueprint $table) {
23
 		Schema::table('rubrics', function (Blueprint $table) {

+ 1
- 0
app/database/migrations/2021_06_03_001143_create_transformative_actions_table.php View File

17
 
17
 
18
 			$table->increments('id');
18
 			$table->increments('id');
19
 			$table->timestamps();
19
 			$table->timestamps();
20
+			$table->string('type_of_TA');
20
 			$table->boolean('is_custom');
21
 			$table->boolean('is_custom');
21
 			$table->integer('user_id')->unsigned()->nullable();
22
 			$table->integer('user_id')->unsigned()->nullable();
22
 			$table->integer('program_id')->unsigned()->nullable();
23
 			$table->integer('program_id')->unsigned()->nullable();

+ 3
- 3
app/database/migrations/2021_06_03_235944_create_courses_table.php View File

16
 			$table->integer('program_id')->unsigned();
16
 			$table->integer('program_id')->unsigned();
17
 			$table->integer('user_id')->unsigned();
17
 			$table->integer('user_id')->unsigned();
18
 			$table->timestamps();
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
 			$table->char('number', 4)->default('0000');
22
 			$table->char('number', 4)->default('0000');
23
 		});
23
 		});
24
 
24
 

+ 8
- 8
app/database/migrations/2021_06_04_003757_create_activities_table.php View File

15
 			$table->integer('course_id')->unsigned()->nullable();
15
 			$table->integer('course_id')->unsigned()->nullable();
16
 
16
 
17
 			$table->timestamps();
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
 			$table->text('assessment_comments')->nullable();
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
 			$table->date('date');
27
 			$table->date('date');
28
 			$table->boolean('draft')->default(0);
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
 			DB::statement('SET FOREIGN_KEY_CHECKS=1;');
32
 			DB::statement('SET FOREIGN_KEY_CHECKS=1;');
33
 		});
33
 		});

+ 1
- 1
app/database/migrations/2021_06_04_003810_create_activity_criterion_table.php View File

33
 			$table->text('assessment_comments')->nullable();
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
 			$table->timestamps();
38
 			$table->timestamps();
39
 		});
39
 		});

+ 3
- 2
app/database/migrations/2021_06_05_235636_create_criterion_rubric.php View File

8
 
8
 
9
 	public function up()
9
 	public function up()
10
 	{
10
 	{
11
-		Schema::create('criterion_rubric', function (Blueprint $table) {
11
+		Schema::create('rubric_criterion', function (Blueprint $table) {
12
 			$table->increments('id');
12
 			$table->increments('id');
13
 			$table->integer('criterion_id')->unsigned();
13
 			$table->integer('criterion_id')->unsigned();
14
 			$table->integer('rubric_id')->unsigned();
14
 			$table->integer('rubric_id')->unsigned();
26
 				->on('rubrics')
26
 				->on('rubrics')
27
 				->onDelete('cascade')
27
 				->onDelete('cascade')
28
 				->onUpdate('cascade');
28
 				->onUpdate('cascade');
29
+			$table->integer('position');
29
 		});
30
 		});
30
 	}
31
 	}
31
 
32
 
37
 	 */
38
 	 */
38
 	public function down()
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 View File

27
 				->onDelete('cascade')
27
 				->onDelete('cascade')
28
 				->onUpdate('cascade');
28
 				->onUpdate('cascade');
29
 			$table->timestamps();
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 View File

11
 		Schema::create('criterion_objective_outcome', function (Blueprint $table) {
11
 		Schema::create('criterion_objective_outcome', function (Blueprint $table) {
12
 			$table->increments('id');
12
 			$table->increments('id');
13
 			$table->integer('criterion_id')->unsigned();
13
 			$table->integer('criterion_id')->unsigned();
14
-			$table->integer('objective_id')->unsigned()->nullable();
14
+			$table->integer('objective_id')->unsigned();
15
 			$table->integer('outcome_id')->unsigned();
15
 			$table->integer('outcome_id')->unsigned();
16
 			$table
16
 			$table
17
 				->foreign('criterion_id')
17
 				->foreign('criterion_id')
19
 				->on('criteria')
19
 				->on('criteria')
20
 				->onDelete('cascade')
20
 				->onDelete('cascade')
21
 				->onUpdate('cascade');
21
 				->onUpdate('cascade');
22
-			$table
22
+			/*$table
23
 				->foreign('objective_id')
23
 				->foreign('objective_id')
24
 				->references('id')
24
 				->references('id')
25
 				->on('objectives')
25
 				->on('objectives')
30
 				->references('id')
30
 				->references('id')
31
 				->on('outcomes')
31
 				->on('outcomes')
32
 				->onDelete('cascade')
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
 				->onUpdate('cascade');
38
 				->onUpdate('cascade');
34
 			$table->timestamps();
39
 			$table->timestamps();
35
 		});
40
 		});

+ 0
- 38
app/database/migrations/2021_06_06_000518_create_rubric_criteria_scales_table.php View File

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 View File

3
 use Illuminate\Database\Schema\Blueprint;
3
 use Illuminate\Database\Schema\Blueprint;
4
 use Illuminate\Database\Migrations\Migration;
4
 use Illuminate\Database\Migrations\Migration;
5
 
5
 
6
-class CreateTransformativeObjectiveProgramTable extends Migration
6
+class CreateTransformativeObjectiveCourseTable extends Migration
7
 {
7
 {
8
 
8
 
9
 	public function up()
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
 			$table->increments('id');
12
 			$table->increments('id');
13
 			$table->timestamps();
13
 			$table->timestamps();
14
 
14
 
26
 				->onDelete('cascade')
26
 				->onDelete('cascade')
27
 				->onUpdate('cascade');
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
 			$table->foreign('program_id')
33
 			$table->foreign('program_id')
31
 				->references('id')
34
 				->references('id')
32
 				->on('programs')
35
 				->on('programs')
33
 				->onDelete('cascade')
36
 				->onDelete('cascade')
34
-				->onUpdate('cascade');
37
+				->onUpdate('cascade');*/
35
 		});
38
 		});
36
 	}
39
 	}
37
 
40
 
42
 	 */
45
 	 */
43
 	public function down()
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 View File

22
 				->on('templates')
22
 				->on('templates')
23
 				->onDelete('cascade')
23
 				->onDelete('cascade')
24
 				->onUpdate('cascade');
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 View File

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 View File

27
 				->on('annual_plans')
27
 				->on('annual_plans')
28
 				->onDelete('cascade')
28
 				->onDelete('cascade')
29
 				->onUpdate('cascade');
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
 				->references('id')
32
 				->references('id')
33
-				->on('typ_semester_objectives')
33
+				->on('typ_semester_courses')
34
 				->onDelete('cascade')
34
 				->onDelete('cascade')
35
 				->onUpdate('cascade');
35
 				->onUpdate('cascade');
36
 			$table->integer('proposing_coordinator_id')->unsigned();
36
 			$table->integer('proposing_coordinator_id')->unsigned();

+ 0
- 34
app/database/migrations/2021_06_22_150017_delete_min_max_scales.php View File

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 View File

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 View File

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 View File

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 View File

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 View File

15
 	{
15
 	{
16
 		Schema::create('rubric_title', function (Blueprint $table) {
16
 		Schema::create('rubric_title', function (Blueprint $table) {
17
 			$table->increments('id');
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
 			$table->integer('position');
24
 			$table->integer('position');
20
 			$table->integer('rubric_id')->unsigned();
25
 			$table->integer('rubric_id')->unsigned();
21
 			$table->foreign('rubric_id')
26
 			$table->foreign('rubric_id')

+ 6
- 1
app/database/migrations/2021_07_06_085513_template_titles.php View File

15
 	{
15
 	{
16
 		Schema::create('template_title', function (Blueprint $table) {
16
 		Schema::create('template_title', function (Blueprint $table) {
17
 			$table->increments('id');
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
 			$table->integer('position');
24
 			$table->integer('position');
20
 			$table->integer('template_id')->unsigned();
25
 			$table->integer('template_id')->unsigned();
21
 			$table->foreign('template_id')
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 View File

3
 use Illuminate\Database\Schema\Blueprint;
3
 use Illuminate\Database\Schema\Blueprint;
4
 use Illuminate\Database\Migrations\Migration;
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
 	 */
13
 	 */
14
 	public function up()
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
 			$table->increments('id');
17
 			$table->increments('id');
18
 			$table->integer('trans_action_id')->unsigned();
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
 			$table->foreign('trans_action_id')
22
 			$table->foreign('trans_action_id')
27
 				->references('id')
23
 				->references('id')
28
 				->on('transformative_actions')
24
 				->on('transformative_actions')
29
 				->onDelete('cascade')
25
 				->onDelete('cascade')
30
 				->onUpdate('cascade');
26
 				->onUpdate('cascade');
31
-			$table->foreign('activity_id')
27
+			$table->foreign('activity_criterion_id')
32
 				->references('id')
28
 				->references('id')
33
-				->on('activities')
29
+				->on('activity_criterion')
34
 				->onDelete('cascade')
30
 				->onDelete('cascade')
35
 				->onUpdate('cascade');
31
 				->onUpdate('cascade');
36
 		});
32
 		});
43
 	 */
39
 	 */
44
 	public function down()
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 View File

13
 	 */
13
 	 */
14
 	public function up()
14
 	public function up()
15
 	{
15
 	{
16
-		Schema::create('criterion_rubric', function (Blueprint $table) {
16
+		Schema::create('rubric_criterion', function (Blueprint $table) {
17
 			$table->increments('id');
17
 			$table->increments('id');
18
 			$table->integer('criterion_id')->unsigned();
18
 			$table->integer('criterion_id')->unsigned();
19
 			$table->integer('rubric_id')->unsigned();
19
 			$table->integer('rubric_id')->unsigned();
42
 	 */
42
 	 */
43
 	public function down()
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 View File

13
 	 */
13
 	 */
14
 	public function up()
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
 			$table->increments('id');
17
 			$table->increments('id');
18
 			$table->timestamps();
18
 			$table->timestamps();
19
 
19
 
47
 	 */
47
 	 */
48
 	public function down()
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 View File

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

+ 5
- 5
app/database/seeds/FillNewAssessmentActivityCriterion.php View File

10
 		$activities = DB::table('activities')
10
 		$activities = DB::table('activities')
11
 			->join('rubric_activity', 'activities.id', '=', 'rubric_activity.activity_id')
11
 			->join('rubric_activity', 'activities.id', '=', 'rubric_activity.activity_id')
12
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
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
 			->orderBy('activities.id')
15
 			->orderBy('activities.id')
16
-			->orderBy('criterion_rubric.criterion_id')
16
+			->orderBy('rubric_criterion.criterion_id')
17
 			->get();
17
 			->get();
18
 		//   DB::enableQueryLog();
18
 		//   DB::enableQueryLog();
19
 		// 		dd(DB::getQueryLog());
19
 		// 		dd(DB::getQueryLog());
83
 					// 					var_dump($criterion_id);
83
 					// 					var_dump($criterion_id);
84
 					var_dump($assessment);
84
 					var_dump($assessment);
85
 					// 					$activities=DB::table('activities')->where('id', $activity_id)->first();
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
 					// 					var_dump($activities);
87
 					// 					var_dump($activities);
88
-					// 					var_dump($criterion_rubric);
88
+					// 					var_dump($rubric_criterion);
89
 					// 					exit();
89
 					// 					exit();
90
 					$activity_criterion_id = DB::table('activity_criterion')->insertGetId(
90
 					$activity_criterion_id = DB::table('activity_criterion')->insertGetId(
91
 						array(
91
 						array(

+ 2
- 2
app/database/seeds/FillNewCriterionRubric.php View File

59
 					if (empty($existe2)) {
59
 					if (empty($existe2)) {
60
 						DB::table('criteria')->insert($criterion);
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
 					if (empty($existe3)) {
63
 					if (empty($existe3)) {
64
-						DB::table('criterion_rubric')->insert(
64
+						DB::table('rubric_criterion')->insert(
65
 							array('criterion_id' => $dato["id"], 'rubric_id' => $rubric->id)
65
 							array('criterion_id' => $dato["id"], 'rubric_id' => $rubric->id)
66
 						);
66
 						);
67
 					}
67
 					}

+ 59
- 1
app/models/Activity.php View File

31
 
31
 
32
     return count($amount_of_students);
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
   // cap_array
63
   // cap_array
35
   public function getCapArrayAttribute()
64
   public function getCapArrayAttribute()
36
   {
65
   {
85
   // o_ach_array
114
   // o_ach_array
86
   public function getOAchArrayAttribute($value)
115
   public function getOAchArrayAttribute($value)
87
   {
116
   {
117
+    /*
88
     $outcomes_achieved = [];
118
     $outcomes_achieved = [];
89
     $all_criterion = DB::table('activity_criterion')
119
     $all_criterion = DB::table('activity_criterion')
90
       ->where('activity_criterion.activity_id', '=', $this->id)
120
       ->where('activity_criterion.activity_id', '=', $this->id)
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
     return $outcomes_achieved;
190
     return $outcomes_achieved;
133
   }
191
   }
134
 
192
 
135
   // o_att_array
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 View File

33
 
33
 
34
   public function assessedActivities()
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
   public function publishedActivities()
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
   public function outcomes_attempted()
46
   public function outcomes_attempted()

+ 44
- 46
app/models/Criterion.php View File

7
 	use SoftDeletingTrait;
7
 	use SoftDeletingTrait;
8
 	protected $dates = ['deleted_at'];
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
 	public function outcomes()
13
 	public function outcomes()
14
 	{
14
 	{
23
 		return $this->belongsToMany('Objective');
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
 	 * Return the program that the criterion belongs to
33
 	 * Return the program that the criterion belongs to
63
 			->select('activity_criterion.id')
63
 			->select('activity_criterion.id')
64
 			->distinct()
64
 			->distinct()
65
 			->get();
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
 				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
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
 				->count();
77
 				->count();
79
 		}
78
 		}
80
 		return $students_attempted;
79
 		return $students_attempted;
82
 
81
 
83
 	public static function students_achieved($criterion_id, $activity_id)
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
 			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
95
 			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
97
 			->join('courses', 'activities.course_id', '=', 'courses.id')
96
 			->join('courses', 'activities.course_id', '=', 'courses.id')
98
 			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
97
 			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
99
 			->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
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
 			->distinct()
102
 			->distinct()
104
 			->get();
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
 				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
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
 				->count();
118
 				->count();
121
 		}
119
 		}
122
 		return $students_achieved;
120
 		return $students_achieved;

+ 1
- 1
app/models/Objective.php View File

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

+ 5
- 0
app/routes.php View File

166
     /**
166
     /**
167
      * Shared Routes
167
      * Shared Routes
168
      */
168
      */
169
+
170
+    Route::post('changeStatusOfCriterion', array(
171
+        'as' => 'changeStatusOfCriterion',
172
+        'uses' => 'CriteriaController@changeStatus'
173
+    ));
169
     Route::post('createThreeYearCycle', array(
174
     Route::post('createThreeYearCycle', array(
170
         'as' => 'createThreeYearCycle',
175
         'as' => 'createThreeYearCycle',
171
         'uses' => 'ThreeYearPlanController@create'
176
         'uses' => 'ThreeYearPlanController@create'

+ 356
- 4
app/views/global/view-learning-outcomes-criteria.blade.php
File diff suppressed because it is too large
View File


+ 0
- 1044
app/views/local/managers/admins/new_criteria.blade.php
File diff suppressed because it is too large
View File


+ 37
- 12
app/views/local/managers/pCoords/criteria.blade.php View File

284
         $('#' + select).html(options);
284
         $('#' + select).html(options);
285
         $('#' + select).val(previousvalue);
285
         $('#' + select).val(previousvalue);
286
         $('#' + select).selectpicker('refresh');
286
         $('#' + select).selectpicker('refresh');
287
+        $('#'+select).trigger('change');
287
     }
288
     }
288
 
289
 
289
     function numberOfAssoc(string, Scales) {
290
     function numberOfAssoc(string, Scales) {
290
         var maximum = $('#assoc_maximum_score').val();
291
         var maximum = $('#assoc_maximum_score').val();
291
         var amountOfScale = parseInt($('#' + string).val());
292
         var amountOfScale = parseInt($('#' + string).val());
292
         var dataValue = parseInt($('#' + Scales).attr('data-value'));
293
         var dataValue = parseInt($('#' + Scales).attr('data-value'));
294
+        var division = maximum/amountOfScale;
293
         //add
295
         //add
294
-        if (dataValue < amountOfScale) {
296
+        
295
 
297
 
296
             fullDiv = '';
298
             fullDiv = '';
297
-
299
+        if(division ==1){
298
             for (var i = dataValue; i < amountOfScale; i++) {
300
             for (var i = dataValue; i < amountOfScale; i++) {
299
                 div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
301
                 div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
300
                     '<div class ="form-group">' +
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
                 fullDiv += div;
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
     function numberOfScales(string, Scales) {
344
     function numberOfScales(string, Scales) {
320
         var maximum = parseInt($('#maximum_score').val());
345
         var maximum = parseInt($('#maximum_score').val());

+ 1275
- 0
app/views/local/managers/pCoords/new_criteria.blade.php
File diff suppressed because it is too large
View File


+ 45
- 20
app/views/local/managers/shared/rubrics.blade.php View File

195
             <form>
195
             <form>
196
                 <div class="form-group">
196
                 <div class="form-group">
197
                     <label>Select a Learning Outcome</label>
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
                         @foreach ($outcomes as $outcome)
199
                         @foreach ($outcomes as $outcome)
200
                         <option data-outcome-id="{{ $outcome->id }}">{{ $outcome->name }}</option>
200
                         <option data-outcome-id="{{ $outcome->id }}">{{ $outcome->name }}</option>
201
                         @endforeach
201
                         @endforeach
202
                     </select>
202
                     </select>
203
                 </div>
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
                     <div class="form-group">
211
                     <div class="form-group">
205
                         <label>Select the Maximum Score</label>
212
                         <label>Select the Maximum Score</label>
206
                     <select id="max_score" class="form-control selectpicker">
213
                     <select id="max_score" class="form-control selectpicker">
310
 // Functions
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
 // Fetch criteria associated to a specific learning outcome
340
 // Fetch criteria associated to a specific learning outcome
314
-function fetchCriteria(outcome)
341
+function fetchCriteria(outcome, objective)
315
 {
342
 {
316
     $.post
343
     $.post
317
     (
344
     (
428
 
455
 
429
             if(notes)
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
             else
460
             else
434
             {
461
             {
446
                 str+='<td class="editable" data-type="textarea"></td>';
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
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
479
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
455
 
480
 
456
             $('table tbody').append(str);
481
             $('table tbody').append(str);
457
 
482
 
458
             // Build copyright list
483
             // Build copyright list
459
-            buildOutcomeList();
484
+            buildCopyrightList();
460
 
485
 
461
             // Enable X-Edtable on this new row
486
             // Enable X-Edtable on this new row
462
             $('.editable').editable({
487
             $('.editable').editable({
506
 }
531
 }
507
 
532
 
508
 // Build list from copyright info in rubric
533
 // Build list from copyright info in rubric
509
-function buildOutcomeList()
534
+function buildCopyrightList()
510
 {
535
 {
511
     // Empty the copyright list
536
     // Empty the copyright list
512
     $('#copyright-list').empty();
537
     $('#copyright-list').empty();
515
     {
540
     {
516
         var criterion = $(this);
541
         var criterion = $(this);
517
         // If there's copyright info
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
             if($('#copyright-list li').length>0)
545
             if($('#copyright-list li').length>0)
521
             {
546
             {
522
                 var found = false;
547
                 var found = false;
523
                 $('#copyright-list li').each(function()
548
                 $('#copyright-list li').each(function()
524
                 {
549
                 {
525
                     // If found, give the string its number
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
                         copyrightNumber = Number.parseInt($(this).find('sup').text());
554
                         copyrightNumber = Number.parseInt($(this).find('sup').text());
548
                     console.log(criterion.children('td:nth-child(2)').find('sup').length);
573
                     console.log(criterion.children('td:nth-child(2)').find('sup').length);
549
 
574
 
550
                     criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
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
             else
579
             else
555
             {
580
             {
556
                 criterion.children('td:nth-child(2)').find('sup').text('1');
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
                 $('table tbody').append(str);
850
                 $('table tbody').append(str);
826
 
851
 
827
                 // Build copyright list
852
                 // Build copyright list
828
-                buildOutcomeList();
853
+                buildCopyrightList();
829
 
854
 
830
                 // Enable X-Edtable on this new row
855
                 // Enable X-Edtable on this new row
831
                 $('.editable').editable({
856
                 $('.editable').editable({
850
             });
875
             });
851
 
876
 
852
             // Build Copyright List
877
             // Build Copyright List
853
-            buildOutcomeList();
878
+            buildCopyrightList();
854
 
879
 
855
             var selected = $('#select-template').find(':selected');
880
             var selected = $('#select-template').find(':selected');
856
         var programs = {{ json_encode(Auth::user()->programs->lists('id')) }};
881
         var programs = {{ json_encode(Auth::user()->programs->lists('id')) }};
1033
                 counter++;
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
             $("#criterion-header").html(newScaleHeaders);
1063
             $("#criterion-header").html(newScaleHeaders);
1039
             $('#allCriteria').html(' ');
1064
             $('#allCriteria').html(' ');
1079
     changeTable();
1104
     changeTable();
1080
 })
1105
 })
1081
 // When a learning outcome changes, update its criteria
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
     fetchCriteria($('#select-outcome'));
1109
     fetchCriteria($('#select-outcome'));
1085
 });
1110
 });
1086
-
1111
+*/
1087
 // When the add button is clicked
1112
 // When the add button is clicked
1088
 $('#button-add-criterion').on('click', function(e)
1113
 $('#button-add-criterion').on('click', function(e)
1089
 {
1114
 {
1267
         $('#rubric-container').hide();
1292
         $('#rubric-container').hide();
1268
     }
1293
     }
1269
 
1294
 
1270
-    buildOutcomeList();
1295
+    buildCopyrightList();
1271
 });
1296
 });
1272
 
1297
 
1273
 // When print button is clicked, redirect to print page
1298
 // When print button is clicked, redirect to print page

+ 5
- 5
app/views/local/professors/assessment.blade.php View File

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

+ 1
- 0
app/views/local/professors/assessment_report.blade.php View File

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

+ 1
- 1
app/views/local/professors/viewrubric.blade.php View File

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