Ver código fonte

Gabriel, trabajo hasta 11/17

Añadí un readmePLease.txt que creo que abarca lo más importante.
Gabriel Santiago Plaza 4 anos atrás
pai
commit
fc142f4fe2
48 arquivos alterados com 3246 adições e 963 exclusões
  1. 14
    0
      READMEPLEASE.txt
  2. 6
    5
      app/config/app.php
  3. 6
    5
      app/config/database.php
  4. 171
    261
      app/controllers/ActivitiesController.php
  5. 180
    96
      app/controllers/CriteriaController.php
  6. 331
    0
      app/controllers/Objective2Controller.php
  7. 86
    0
      app/controllers/Objective_OutcomeController.php
  8. 49
    75
      app/controllers/RubricsController.php
  9. 47
    0
      app/database/migrations/2020_10_04_142756_create_new_assessments_table.php
  10. 52
    0
      app/database/migrations/2020_10_05_124915_create_activity_criterion_table.php
  11. 35
    0
      app/database/migrations/2020_10_05_130252_add_max_score_num_scales_new_criteria_table.php
  12. 35
    0
      app/database/migrations/2020_10_05_142424_create_scales_table.php
  13. 47
    0
      app/database/migrations/2020_10_05_142912_create_criterion_scale_table.php
  14. 34
    0
      app/database/migrations/2020_10_05_232429_add_assessment_comments_to_activity_criterion.php
  15. 36
    0
      app/database/migrations/2020_10_09_131800_add_level_activation_date_to_outcomes.php
  16. 53
    0
      app/database/migrations/2020_10_16_190923_create_criterion_objective_outcome_table.php
  17. 57
    0
      app/database/migrations/2020_10_18_145108_create_outcome_performance_table.php
  18. 30
    0
      app/database/migrations/2020_10_29_122332_MakeOutcomeNullable.php
  19. 30
    0
      app/database/migrations/2020_10_29_195413_MakeObjectiveNullable.php
  20. 30
    0
      app/database/migrations/2020_10_29_224846_Make_criterion_objective_outcome_changeForeignKey.php
  21. 35
    0
      app/database/migrations/2020_11_06_011242_changeCriteriaObjOutcome.php
  22. 31
    0
      app/database/migrations/2020_11_11_201214_dropForeignObjOut.php
  23. 30
    0
      app/database/migrations/emails/feedback-email-copy.blade.php
  24. 9
    11
      app/database/unusedMigrations/2018_08_28_140328_remove_outcome_id_from_objectives_table.php
  25. 0
    0
      app/database/unusedMigrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php
  26. 52
    0
      app/database/unusedMigrations/2020_10_05_124915_create_activity_criterion_table.php
  27. 35
    0
      app/database/unusedMigrations/2020_10_05_130252_add_max_score_num_scales_new_criteria_table.php
  28. 35
    0
      app/database/unusedMigrations/2020_10_05_142424_create_scales_table.php
  29. 47
    0
      app/database/unusedMigrations/2020_10_05_142912_create_criterion_scale_table.php
  30. 34
    0
      app/database/unusedMigrations/2020_10_05_232429_add_assessment_comments_to_activity_criterion.php
  31. 36
    0
      app/database/unusedMigrations/2020_10_08_203557_create_new_criteria_table2.php
  32. 33
    0
      app/database/unusedMigrations/2020_10_08_215013_drop_objective_id_new_criteria.php
  33. 34
    0
      app/database/unusedMigrations/2020_10_09_085334_add_activities_rubric_id.php
  34. 35
    0
      app/database/unusedMigrations/2020_10_09_092810_drop_assessment_criteria.php
  35. 35
    0
      app/database/unusedMigrations/2020_10_09_094503_add_criterion_to_assessment.php
  36. 29
    0
      app/database/unusedMigrations/2020_10_09_095246_drop_foreign_assesment_criterion.php
  37. 36
    0
      app/database/unusedMigrations/2020_10_09_131800_add_level_activation_date_to_outcomes.php
  38. 28
    53
      app/filters.php
  39. 29
    26
      app/models/Objective.php
  40. 38
    0
      app/models/Objective_Outcome.php
  41. 0
    7
      app/models/Outcome.php
  42. 13
    12
      app/models/User.php
  43. 106
    115
      app/routes.php
  44. 20
    18
      app/views/local/managers/admins/_navigation.blade.php
  45. 715
    278
      app/views/local/managers/admins/criteria.blade.php
  46. 420
    0
      app/views/local/managers/admins/objectives.blade.php
  47. 1
    1
      bootstrap/start.php
  48. 1
    0
      public/.htaccess

+ 14
- 0
READMEPLEASE.txt Ver arquivo

@@ -0,0 +1,14 @@
1
+NO CORRAN LOS MIGRATIONS QUE TIENEN. hay algunos migrations que los hice y creé otros migrations para cancelar esos por ignorancia. Ahora
2
+
3
+
4
+1. Añadí un objectiveController que se llama Objective2Controller. Las rutas
5
+	que tienen ese controller se tienen que añadir dentro del routes.php
6
+
7
+2. Añadí un objectives.blade.php para editar objective
8
+3. Edité criteria.blade.php
9
+4. Edité criteriaController.php
10
+5. No creé modelos que funcionan, preferí utilizar DB::select()
11
+
12
+6. edité criteria donde esta la tabla, apunta a new_criteria en vez de criteria
13
+7. Los outcomes, apuntan a outcomes, no a new_outcomes, descubrí eso el martes 11/17 y no me deja añadir a new_outcomes
14
+8. CUALQUIERO DUDA contactarme gabriel.santiago21@upr.edu  787-969-0474

+ 6
- 5
app/config/app.php Ver arquivo

@@ -13,8 +13,9 @@ return array(
13 13
 	|
14 14
 	*/
15 15
 
16
-	'debug' => $_ENV['APP_DEBUG'] ?: false,
16
+	//'debug' => $_ENV['APP_DEBUG'] ?: false,
17 17
 
18
+	'debug' => true,
18 19
 	/*
19 20
 	|--------------------------------------------------------------------------
20 21
 	| Application URL
@@ -24,9 +25,9 @@ return array(
24 25
 	| the Artisan command line tool. You should set this to the root of
25 26
 	| your application so that it is used when running Artisan tasks.
26 27
 	|
27
-	*/
28
+	*/ //$_ENV['APP_URL'] ?:
28 29
 
29
-	'url' => $_ENV['APP_URL'] ?: 'http://localhost',
30
+	'url' =>  'https://localhost',
30 31
 
31 32
 	/*
32 33
 	|--------------------------------------------------------------------------
@@ -139,7 +140,7 @@ return array(
139 140
 	|
140 141
 	*/
141 142
 
142
-	'manifest' => storage_path().'/meta',
143
+	'manifest' => storage_path() . '/meta',
143 144
 
144 145
 	/*
145 146
 	|--------------------------------------------------------------------------
@@ -193,7 +194,7 @@ return array(
193 194
 		'Validator'         => 'Illuminate\Support\Facades\Validator',
194 195
 		'View'              => 'Illuminate\Support\Facades\View',
195 196
 		'PDF'				=> 'Barryvdh\DomPDF\Facade',
196
-        'Entrust' => 'Zizaco\Entrust\EntrustFacade'
197
+		'Entrust' => 'Zizaco\Entrust\EntrustFacade'
197 198
 
198 199
 
199 200
 	),

+ 6
- 5
app/config/database.php Ver arquivo

@@ -47,15 +47,16 @@ return array(
47 47
 	'connections' => array(
48 48
 
49 49
 		'mysql' => array(
50
+
50 51
 			'driver'    => 'mysql',
51
-			'host'      => $_ENV['MYSQL_HOST'] ?: 'localhost',
52
-			'database'  => $_ENV['MYSQL_DATABASE'] ?: 'laravel',
53
-			'username'  => $_ENV['MYSQL_USERNAME'] ?: 'root',
54
-			'password'  => $_ENV['MYSQL_PASSWORD'] ?: '',
52
+			'host'      =>  '127.0.0.1',
53
+			'database'  =>  'trabajoolas5',
54
+			'username'  =>  'root',
55
+			'password'  =>  '',
55 56
 			'charset'   => 'utf8',
56 57
 			'collation' => 'utf8_unicode_ci',
57 58
 			'prefix'    => '',
58
-            'engine'    => 'InnoDB',
59
+			'engine'    => 'InnoDB',
59 60
 		),
60 61
 	),
61 62
 

+ 171
- 261
app/controllers/ActivitiesController.php Ver arquivo

@@ -2,7 +2,8 @@
2 2
 
3 3
 use Illuminate\Database\Eloquent\Collection;
4 4
 
5
-class ActivitiesController extends \BaseController {
5
+class ActivitiesController extends \BaseController
6
+{
6 7
 
7 8
     /**
8 9
      * Save a new activity
@@ -13,55 +14,51 @@ class ActivitiesController extends \BaseController {
13 14
     public function create($id)
14 15
     {
15 16
         /** Validation rules */
17
+
16 18
         $validator = Validator::make(
17 19
             array(
18 20
                 'name' => Input::get('name'),
19 21
                 'description' => Input::get('description')
20 22
             ),
21 23
             array(
22
-                'name' => 'required|unique:activities,course_id,'.$id,
24
+                'name' => 'required|unique:activities,course_id,' . $id,
23 25
                 'description' => 'required|min:10'
24 26
             )
25 27
         );
26 28
 
29
+
27 30
         /** If validation fails */
28
-        if ($validator->fails())
29
-        {
31
+        if ($validator->fails()) {
30 32
             /** Prepare error message */
31 33
             $message = 'Error(s) creating a new Activity<ul>';
32 34
 
33
-            foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
34
-            {
35
-                $message.=$validationError;
35
+            foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
36
+                $message .= $validationError;
36 37
             }
37 38
 
38
-            $message.='</ul>';
39
+            $message .= '</ul>';
39 40
 
40 41
             /** Send error message and old data */
41 42
             Session::flash('status', 'danger');
42 43
             Session::flash('message', $message);
43 44
             return Redirect::back()->withInput();
44
-        }
45
-        else
46
-        {
45
+        } else {
47 46
             /** Instantiate new activity */
48 47
             $activity = new Activity;
49
-            $activity->name= Input::get('name');
48
+            $activity->name = Input::get('name');
50 49
             $activity->description = Input::get('description');
51 50
             $activity->course_id = $id;
52 51
             $activity->date = date('Y-m-d');
53 52
 
54 53
             /** If activity is saved, send success message */
55
-            if($activity->save())
56
-            {
54
+            if ($activity->save()) {
57 55
                 Session::flash('status', 'success');
58 56
                 Session::flash('message', 'Activity created.');
59 57
                 return Redirect::action('ActivitiesController@show', array($activity->id));
60 58
             }
61 59
 
62 60
             /** If saving fails, send error message and old data */
63
-            else
64
-            {
61
+            else {
65 62
                 Session::flash('status', 'warning');
66 63
                 Session::flash('message', 'Error adding Activity. Please try again later.');
67 64
                 return Redirect::back()->withInput();
@@ -76,24 +73,25 @@ class ActivitiesController extends \BaseController {
76 73
         $instruments = Rubric::all();
77 74
         $courses = Course::where('user_id', Auth::user()->id)->get();
78 75
         $outcomes = Outcome::with('objectives')->get();
79
-//        var_dump($outcomes[0]->objectives);
76
+        //        var_dump($outcomes[0]->objectives);
80 77
         $objectives_by_outcome = Collection::make([]);
81
-        $outcomes->each(function($outcome) use (&$objectives_by_outcome) {
82
-//            var_dump($outcome->objectives);
78
+        $outcomes->each(function ($outcome) use (&$objectives_by_outcome) {
79
+            //            var_dump($outcome->objectives);
83 80
             $objectives_by_outcome->put($outcome->id, $outcome->objectives);
84
-//            var_dump($objectives);
81
+            //            var_dump($objectives);
85 82
         });
86 83
         $criteria_by_objective = Collection::make([]);
87
-        $objectives_by_outcome->each(function($objectives) use (&$criteria_by_objective) {
88
-            $objectives->each(function($objective) use (&$criteria_by_objective) {
84
+        $objectives_by_outcome->each(function ($objectives) use (&$criteria_by_objective) {
85
+            $objectives->each(function ($objective) use (&$criteria_by_objective) {
89 86
                 $criteria_by_objective->put($objective->id, $objective->criteria);
90 87
             });
91 88
         });
92 89
         $transforming_actions = [];
93 90
         $course = Course::find($course_id);
94
-//        var_dump($criteria_by_objective);
95
-//        return $objectives->toJson();
96
-        return View::make('local.managers.admins.new-activity-create',
91
+        //        var_dump($criteria_by_objective);
92
+        //        return $objectives->toJson();
93
+        return View::make(
94
+            'local.managers.admins.new-activity-create',
97 95
             compact(
98 96
                 'title',
99 97
                 'course',
@@ -116,7 +114,7 @@ class ActivitiesController extends \BaseController {
116 114
         $activity = Activity::find($id);
117 115
 
118 116
         // If activity does not exist, display 404
119
-        if(!$activity)
117
+        if (!$activity)
120 118
             App::abort('404');
121 119
 
122 120
         // Get activity's course
@@ -127,16 +125,14 @@ class ActivitiesController extends \BaseController {
127 125
             App::abort('403', 'Access Forbidden');
128 126
 
129 127
         // Get active semesters
130
-        $active_semesters= array();
128
+        $active_semesters = array();
131 129
         $active_semesters_collection = Semester::select('id')->where('is_visible', 1)->where('start', '<=', date('Y-m-d H:i:s'))->where('end', '>=', date('Y-m-d H:i:s'))->get();
132
-        foreach ($active_semesters_collection as $active_semester)
133
-        {
134
-            $active_semesters[]=$active_semester->id;
130
+        foreach ($active_semesters_collection as $active_semester) {
131
+            $active_semesters[] = $active_semester->id;
135 132
         }
136
-            // Added the function htmlspecialchars to activity name string because it was corrupting Jquery code while using quotes on page rendering. - Carlos R Caraballo 1/18/2019
137
-        $title = $course->code.$course->number.'-'.$course->section.': '.htmlspecialchars($activity->name, ENT_QUOTES).' <span class="small attention">('.$course->semester->code.')</span>';
138
-        //$outcomes = Outcome::orderBy('name', 'asc')->get();
139
-        $outcomes = Outcome::active();
133
+        // Added the function htmlspecialchars to activity name string because it was corrupting Jquery code while using quotes on page rendering. - Carlos R Caraballo 1/18/2019
134
+        $title = $course->code . $course->number . '-' . $course->section . ': ' . htmlspecialchars($activity->name, ENT_QUOTES) . ' <span class="small attention">(' . $course->semester->code . ')</span>';
135
+        $outcomes = Outcome::orderBy('name', 'asc')->get();
140 136
         $outcomes_achieved = json_decode($activity->outcomes_achieved, true);
141 137
         $outcomes_attempted = json_decode($activity->outcomes_attempted, true);
142 138
 
@@ -149,7 +145,7 @@ class ActivitiesController extends \BaseController {
149 145
         $activity = Activity::find($id);
150 146
 
151 147
         // If activity does not exist, display 404
152
-        if(!$activity)
148
+        if (!$activity)
153 149
             App::abort('404');
154 150
 
155 151
         // Get activity's course
@@ -167,12 +163,11 @@ class ActivitiesController extends \BaseController {
167 163
         $rubric_contents = json_decode($rubric->contents);
168 164
 
169 165
         // Get results
170
-        $assessments = DB::table('assessments')->join('students', 'assessments.student_id','=','students.id')->where('activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
166
+        $assessments = DB::table('assessments')->join('students', 'assessments.student_id', '=', 'students.id')->where('activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
171 167
 
172 168
         // Decode the scores (blade workaround)
173 169
         $scores_array = array();
174
-        foreach ($assessments as $index=>$assessment)
175
-        {
170
+        foreach ($assessments as $index => $assessment) {
176 171
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
177 172
         }
178 173
 
@@ -181,12 +176,9 @@ class ActivitiesController extends \BaseController {
181 176
 
182 177
     public function saveAssessment()
183 178
     {
184
-        try
185
-        {
186
-            $exception = DB::transaction(function()
187
-            {
188
-                DB::transaction(function()
189
-                {
179
+        try {
180
+            $exception = DB::transaction(function () {
181
+                DB::transaction(function () {
190 182
                     // Student assessment data
191 183
                     $student_data = json_decode(Input::get('student_scores'));
192 184
 
@@ -198,51 +190,42 @@ class ActivitiesController extends \BaseController {
198 190
                     $activity = Activity::find(Input::get('activity_id'));
199 191
 
200 192
                     // Create or update student scores
201
-                    if($activity->outcomes_attempted==NULL)
202
-                    {
193
+                    if ($activity->outcomes_attempted == NULL) {
203 194
                         // For each student, save her/his assessment in the db
204
-                        foreach ($student_data as $single_student_data)
205
-                        {
195
+                        foreach ($student_data as $single_student_data) {
206 196
                             // Find student by id
207 197
                             $student = Student::find($single_student_data->student_id);
208 198
 
209 199
                             $comments = trim($single_student_data->comments);
210
-                            if($comments=='')
211
-                            {
200
+                            if ($comments == '') {
212 201
                                 $comments = NULL;
213 202
                             }
214 203
 
215 204
                             // Add the assessment to the pivot table
216 205
                             $student->assessed_activities()->attach($activity->id, array(
217 206
                                 'scores' => json_encode($single_student_data->scores),
218
-                                'percentage'=>$single_student_data->percentage,
207
+                                'percentage' => $single_student_data->percentage,
219 208
                                 'comments' => $single_student_data->comments
220 209
                             ));
221 210
                         }
222
-                    }
223
-                    else
224
-                    {
211
+                    } else {
225 212
                         // For each student, save her/his assessment in the db
226
-                        foreach ($student_data as $single_student_data)
227
-                        {
213
+                        foreach ($student_data as $single_student_data) {
228 214
                             // Find student by id
229 215
                             $student = Student::find($single_student_data->student_id);
230 216
 
231 217
                             $comments = trim($single_student_data->comments);
232
-                            if($comments=='')
233
-                            {
218
+                            if ($comments == '') {
234 219
                                 $comments = NULL;
235 220
                             }
236 221
 
237 222
                             // Update the assessment in the pivot table
238 223
                             $student->assessed_activities()->updateExistingPivot($activity->id, array(
239 224
                                 'scores' => json_encode($single_student_data->scores),
240
-                                'percentage'=>$single_student_data->percentage,
225
+                                'percentage' => $single_student_data->percentage,
241 226
                                 'comments' => $single_student_data->comments
242 227
                             ));
243
-
244 228
                         }
245
-
246 229
                     }
247 230
 
248 231
 
@@ -256,43 +239,37 @@ class ActivitiesController extends \BaseController {
256 239
                     $course_outcomes_attempted = NULL;
257 240
                     $course_outcomes_achieved = NULL;
258 241
 
259
-                    if($course->outcomes_attempted==NULL)
260
-                    {
242
+                    if ($course->outcomes_attempted == NULL) {
261 243
                         $course_outcomes_attempted = array_fill(1, $outcomeCount, 0);
262 244
                         $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
263
-                    }
264
-                    else
265
-                    {
245
+                    } else {
266 246
                         // the second argument is necessary to convert it into an array
267 247
                         $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
268 248
                         $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
269 249
                     }
270 250
 
271 251
 
272
-                    foreach($criteria_achievement as $criterion_id=>$criterion_achieved)
273
-                    {
252
+                    foreach ($criteria_achievement as $criterion_id => $criterion_achieved) {
274 253
                         // Find corresponding learning outcome
275 254
                         $criterion = Criterion::withTrashed()->find($criterion_id);
276 255
                         $outcome = Outcome::find($criterion->outcome_id);
277 256
 
278 257
                         // If criterion is achieved (1), add 1 to all arrays
279
-                        if($criterion_achieved===1)
280
-                        {
281
-                            $outcomes_attempted[$outcome->id]+=1;
282
-                            $outcomes_achieved[$outcome->id]+=1;
283
-                            $course_outcomes_attempted[$outcome->id]+=1;
284
-                            $course_outcomes_achieved[$outcome->id]+=1;
258
+                        if ($criterion_achieved === 1) {
259
+                            $outcomes_attempted[$outcome->id] += 1;
260
+                            $outcomes_achieved[$outcome->id] += 1;
261
+                            $course_outcomes_attempted[$outcome->id] += 1;
262
+                            $course_outcomes_achieved[$outcome->id] += 1;
285 263
                         }
286 264
                         // Else if it's 0, only add to the attempted outcomes arrays
287
-                        elseif($criterion_achieved===0)
288
-                        {
289
-                            $outcomes_attempted[$outcome->id]+=1;
290
-                            $course_outcomes_attempted[$outcome->id]+=1;
265
+                        elseif ($criterion_achieved === 0) {
266
+                            $outcomes_attempted[$outcome->id] += 1;
267
+                            $course_outcomes_attempted[$outcome->id] += 1;
291 268
                         }
292 269
                     }
293 270
 
294 271
                     // If all values are 0, throw exception
295
-                    if(count(array_unique($outcomes_attempted))==1 && $outcomes_attempted[1]==0)
272
+                    if (count(array_unique($outcomes_attempted)) == 1 && $outcomes_attempted[1] == 0)
296 273
                         throw new Exception("Error Processing Request", 1);
297 274
 
298 275
 
@@ -305,18 +282,14 @@ class ActivitiesController extends \BaseController {
305 282
 
306 283
 
307 284
                     // Publish results if not a draft. That is, update the activity's course.
308
-                    if(Input::get('draft')==false)
309
-                    {
285
+                    if (Input::get('draft') == false) {
310 286
                         // Update course
311 287
                         $course->outcomes_achieved = json_encode($course_outcomes_achieved);
312 288
                         $course->outcomes_attempted = json_encode($course_outcomes_attempted);
313 289
                         $course->save();
314 290
 
315 291
                         $activity->draft = false;
316
-
317
-                    }
318
-                    else
319
-                    {
292
+                    } else {
320 293
                         // Set draft to true
321 294
                         $activity->draft = true;
322 295
                     }
@@ -334,18 +307,15 @@ class ActivitiesController extends \BaseController {
334 307
 
335 308
                     // Check if any assessed activities remain
336 309
                     $remainingAssessed = false;
337
-                    foreach ($activities as $activity1)
338
-                    {
339
-                        if($activity1->outcomes_attempted!=NULL)
340
-                        {
341
-                            $remainingAssessed =true;
310
+                    foreach ($activities as $activity1) {
311
+                        if ($activity1->outcomes_attempted != NULL) {
312
+                            $remainingAssessed = true;
342 313
                             break;
343 314
                         }
344 315
                     }
345 316
 
346 317
                     //If there are still evaluated activities in the course, recalculate course outcomes
347
-                    if(count($activities) && $remainingAssessed)
348
-                    {
318
+                    if (count($activities) && $remainingAssessed) {
349 319
                         $outcomeCount = Outcome::all()->count();
350 320
 
351 321
                         // Variables to hold recalculated outcomes for the course
@@ -353,29 +323,24 @@ class ActivitiesController extends \BaseController {
353 323
                         $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
354 324
 
355 325
                         // For each activity
356
-                        foreach ($activities as $activity2)
357
-                        {
326
+                        foreach ($activities as $activity2) {
358 327
                             // If activity has been assessed
359
-                            if($activity2->outcomes_attempted!=NULL)
360
-                            {
328
+                            if ($activity2->outcomes_attempted != NULL) {
361 329
                                 // Get the achieved criteria
362 330
                                 $criteria_achievement = json_decode($activity2->criteria_achieved, true);
363
-                                foreach($criteria_achievement as $criterion_id=>$criterion_achieved)
364
-                                {
331
+                                foreach ($criteria_achievement as $criterion_id => $criterion_achieved) {
365 332
                                     // Find corresponding learning outcome;
366 333
                                     $criterion = Criterion::withTrashed()->find($criterion_id);
367 334
                                     $outcome = Outcome::find($criterion->outcome_id);
368 335
 
369 336
                                     // If criterion is achieved (1), add 1 to both arrays
370
-                                    if($criterion_achieved === 1)
371
-                                    {
372
-                                        $course_outcomes_attempted[$outcome->id]+=1;
373
-                                        $course_outcomes_achieved[$outcome->id]+=1;
337
+                                    if ($criterion_achieved === 1) {
338
+                                        $course_outcomes_attempted[$outcome->id] += 1;
339
+                                        $course_outcomes_achieved[$outcome->id] += 1;
374 340
                                     }
375 341
                                     // Else, only add to the attempted outcomes arrays
376
-                                    elseif($criterion_achieved === 0)
377
-                                    {
378
-                                        $course_outcomes_attempted[$outcome->id]+=1;
342
+                                    elseif ($criterion_achieved === 0) {
343
+                                        $course_outcomes_attempted[$outcome->id] += 1;
379 344
                                     }
380 345
                                 }
381 346
                             }
@@ -383,54 +348,46 @@ class ActivitiesController extends \BaseController {
383 348
 
384 349
                         // Update course
385 350
                         DB::table('courses')
386
-                        ->where('id', $course->id)
387
-                        ->update(array(
388
-                            'outcomes_attempted'=> json_encode($course_outcomes_attempted),
389
-                            'outcomes_achieved'=> json_encode($course_outcomes_achieved),
390
-                            'updated_at' => date('Y-m-d H:i:s'))
391
-                        );
351
+                            ->where('id', $course->id)
352
+                            ->update(array(
353
+                                'outcomes_attempted' => json_encode($course_outcomes_attempted),
354
+                                'outcomes_achieved' => json_encode($course_outcomes_achieved),
355
+                                'updated_at' => date('Y-m-d H:i:s')
356
+                            ));
392 357
                     }
393 358
                     // Otherwise, set them all to NULL
394
-                    else
395
-                    {
359
+                    else {
396 360
                         DB::table('courses')
397
-                        ->where('id', $course->id)
398
-                        ->update(array(
399
-                            'outcomes_attempted'=> NULL,
400
-                            'outcomes_achieved'=> NULL,
401
-                            'updated_at' => date('Y-m-d H:i:s'))
402
-                        );
361
+                            ->where('id', $course->id)
362
+                            ->update(array(
363
+                                'outcomes_attempted' => NULL,
364
+                                'outcomes_achieved' => NULL,
365
+                                'updated_at' => date('Y-m-d H:i:s')
366
+                            ));
403 367
                     }
404
-
405 368
                 });
406 369
             });
407 370
 
408
-            if(is_null($exception))
409
-            {
371
+            if (is_null($exception)) {
410 372
                 Session::flash('status', 'success');
411 373
                 Session::flash('message', 'Assessment Saved. To add transforming actions click "Transforming Actions".');
412 374
                 return action('ActivitiesController@show', array(Input::get('activity_id')));
413 375
             }
414
-
415
-        }
416
-        catch(Exception $e)
417
-        {
418
-            Log::info('e:'.$e);
376
+        } catch (Exception $e) {
377
+            Log::info('e:' . $e);
378
+            echo $e->getMessage();
419 379
             Session::flash('status', 'danger');
420 380
             Session::flash('message', 'Error saving assessment. Try again later.');
421 381
 
422 382
             return action('ActivitiesController@show', array(Input::get('activity_id')));
423
-
424 383
         }
425 384
     }
426 385
 
427 386
     public function deleteAssessment()
428 387
     {
429 388
 
430
-        try
431
-        {
432
-            $exception = DB::transaction(function()
433
-            {
389
+        try {
390
+            $exception = DB::transaction(function () {
434 391
                 $activity = DB::table('activities')->where('id', Input::get('id'))->first();
435 392
 
436 393
                 $course = DB::table('courses')->where('id', $activity->course_id)->first();
@@ -441,14 +398,14 @@ class ActivitiesController extends \BaseController {
441 398
                     ->where('id', Input::get('id'))
442 399
                     ->update(array(
443 400
                         'draft' => 0,
444
-                        'outcomes_attempted'=> NULL,
445
-                        'outcomes_achieved'=> NULL,
446
-                        'criteria_achieved'=> NULL,
447
-                        'transforming_actions'=> NULL,
448
-                        'assessment_comments'=> NULL,
449
-                        'criteria_achieved_percentage'=> NULL,
450
-                        'updated_at' => date('Y-m-d H:i:s'))
451
-                    );
401
+                        'outcomes_attempted' => NULL,
402
+                        'outcomes_achieved' => NULL,
403
+                        'criteria_achieved' => NULL,
404
+                        'transforming_actions' => NULL,
405
+                        'assessment_comments' => NULL,
406
+                        'criteria_achieved_percentage' => NULL,
407
+                        'updated_at' => date('Y-m-d H:i:s')
408
+                    ));
452 409
 
453 410
                 // Delete students score
454 411
                 DB::table('assessments')->where('activity_id', $activity->id)->delete();
@@ -462,18 +419,15 @@ class ActivitiesController extends \BaseController {
462 419
 
463 420
                 // Check if any assessed activties remain
464 421
                 $remainingAssessed = false;
465
-                foreach ($activities as $activity)
466
-                {
467
-                    if($activity->outcomes_attempted!=NULL)
468
-                    {
469
-                        $remainingAssessed =true;
422
+                foreach ($activities as $activity) {
423
+                    if ($activity->outcomes_attempted != NULL) {
424
+                        $remainingAssessed = true;
470 425
                         break;
471 426
                     }
472 427
                 }
473 428
 
474 429
                 //If there are still evaluated activities in the course, recalculate course outcomes
475
-                if(count($activities) && $remainingAssessed)
476
-                {
430
+                if (count($activities) && $remainingAssessed) {
477 431
                     $outcomeCount = Outcome::all()->count();
478 432
 
479 433
                     // Variables to hold recalculated outcomes for the course
@@ -481,29 +435,24 @@ class ActivitiesController extends \BaseController {
481 435
                     $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
482 436
 
483 437
                     // For each activity
484
-                    foreach ($activities as $activity)
485
-                    {
438
+                    foreach ($activities as $activity) {
486 439
                         // If activity has been assessed
487
-                        if($activity->outcomes_attempted!=NULL)
488
-                        {
440
+                        if ($activity->outcomes_attempted != NULL) {
489 441
                             // Get the achieved criteria
490 442
                             $criteria_achievement = json_decode($activity->criteria_achieved, true);
491
-                            foreach($criteria_achievement as $criterion_id=>$criterion_achieved)
492
-                            {
443
+                            foreach ($criteria_achievement as $criterion_id => $criterion_achieved) {
493 444
                                 // Find corresponding learning outcome;
494 445
                                 $criterion = Criterion::withTrashed()->find($criterion_id);
495 446
                                 $outcome = Outcome::find($criterion->outcome_id);
496 447
 
497 448
                                 // If criterion is achieved (1), add 1 to both arrays
498
-                                if($criterion_achieved === 1)
499
-                                {
500
-                                    $course_outcomes_attempted[$outcome->id]+=1;
501
-                                    $course_outcomes_achieved[$outcome->id]+=1;
449
+                                if ($criterion_achieved === 1) {
450
+                                    $course_outcomes_attempted[$outcome->id] += 1;
451
+                                    $course_outcomes_achieved[$outcome->id] += 1;
502 452
                                 }
503 453
                                 // Else, only add to the attempted outcomes arrays
504
-                                elseif($criterion_achieved === 0)
505
-                                {
506
-                                    $course_outcomes_attempted[$outcome->id]+=1;
454
+                                elseif ($criterion_achieved === 0) {
455
+                                    $course_outcomes_attempted[$outcome->id] += 1;
507 456
                                 }
508 457
                             }
509 458
                         }
@@ -511,36 +460,31 @@ class ActivitiesController extends \BaseController {
511 460
 
512 461
                     // Update course
513 462
                     DB::table('courses')
514
-                    ->where('id', $course->id)
515
-                    ->update(array(
516
-                        'outcomes_attempted'=> json_encode($course_outcomes_attempted),
517
-                        'outcomes_achieved'=> json_encode($course_outcomes_achieved),
518
-                        'updated_at' => date('Y-m-d H:i:s'))
519
-                    );
463
+                        ->where('id', $course->id)
464
+                        ->update(array(
465
+                            'outcomes_attempted' => json_encode($course_outcomes_attempted),
466
+                            'outcomes_achieved' => json_encode($course_outcomes_achieved),
467
+                            'updated_at' => date('Y-m-d H:i:s')
468
+                        ));
520 469
                 }
521 470
                 // Otherwise, set them all to NULL
522
-                else
523
-                {
471
+                else {
524 472
                     DB::table('courses')
525
-                    ->where('id', $course->id)
526
-                    ->update(array(
527
-                        'outcomes_attempted'=> NULL,
528
-                        'outcomes_achieved'=> NULL,
529
-                        'updated_at' => date('Y-m-d H:i:s'))
530
-                    );
473
+                        ->where('id', $course->id)
474
+                        ->update(array(
475
+                            'outcomes_attempted' => NULL,
476
+                            'outcomes_achieved' => NULL,
477
+                            'updated_at' => date('Y-m-d H:i:s')
478
+                        ));
531 479
                 }
532 480
             });
533 481
 
534
-            if(is_null($exception))
535
-            {
482
+            if (is_null($exception)) {
536 483
                 Session::flash('status', 'success');
537 484
                 Session::flash('message', 'Assessment deleted.');
538 485
                 return Redirect::back();
539 486
             }
540
-
541
-        }
542
-        catch (Exception $e)
543
-        {
487
+        } catch (Exception $e) {
544 488
             Session::flash('status', 'danger');
545 489
             Session::flash('message', 'Error saving  assessment. Try again later.');
546 490
 
@@ -552,25 +496,21 @@ class ActivitiesController extends \BaseController {
552 496
     {
553 497
         $course = Activity::find($id)->course;
554 498
 
555
-        if(Activity::destroy($id))
556
-        {
499
+        if (Activity::destroy($id)) {
557 500
             // Recalculate course outcomes
558 501
             $activities = $course->activities;
559 502
 
560 503
             // Check if any assessed activties remain
561 504
             $remainingAssessed = false;
562
-            foreach ($course->activities as $activity)
563
-            {
564
-                if($activity->outcomes_attempted!=NULL)
565
-                {
566
-                    $remainingAssessed =true;
505
+            foreach ($course->activities as $activity) {
506
+                if ($activity->outcomes_attempted != NULL) {
507
+                    $remainingAssessed = true;
567 508
                     break;
568 509
                 }
569 510
             }
570 511
 
571 512
             //If there are still evaluated activities in the course, recalculate course outcomes
572
-            if(!$course->activities->isEmpty() && $remainingAssessed )
573
-            {
513
+            if (!$course->activities->isEmpty() && $remainingAssessed) {
574 514
                 $outcomeCount = Outcome::all()->count();
575 515
 
576 516
                 // Variables to hold recalculated outcomes for the course
@@ -578,60 +518,48 @@ class ActivitiesController extends \BaseController {
578 518
                 $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
579 519
 
580 520
                 // For each activity
581
-                foreach ($activities as $activity)
582
-                {
583
-                  // If activity has been assessed
584
-                  if($activity->outcomes_attempted!=NULL)
585
-                  {
586
-                    // Get the achieved criteria
587
-                    $criteria_achievement = json_decode($activity->criteria_achieved, true);
588
-                    foreach($criteria_achievement as $criterion_id=>$criterion_achieved)
589
-                    {
590
-                      // Find corresponding learning outcome;
591
-                      $criterion = Criterion::withTrashed()->find($criterion_id);
592
-                      $outcome = Outcome::find($criterion->outcome_id);
593
-
594
-                      // If criterion is achieved (1), add 1 to both arrays
595
-                      if($criterion_achieved === 1)
596
-                      {
597
-                        $course_outcomes_attempted[$outcome->id]+=1;
598
-                        $course_outcomes_achieved[$outcome->id]+=1;
599
-                      }
600
-                      // Else, only add to the attempted outcomes arrays
601
-                      elseif($criterion_achieved === 0)
602
-                      {
603
-                        $course_outcomes_attempted[$outcome->id]+=1;
604
-                      }
521
+                foreach ($activities as $activity) {
522
+                    // If activity has been assessed
523
+                    if ($activity->outcomes_attempted != NULL) {
524
+                        // Get the achieved criteria
525
+                        $criteria_achievement = json_decode($activity->criteria_achieved, true);
526
+                        foreach ($criteria_achievement as $criterion_id => $criterion_achieved) {
527
+                            // Find corresponding learning outcome;
528
+                            $criterion = Criterion::withTrashed()->find($criterion_id);
529
+                            $outcome = Outcome::find($criterion->outcome_id);
530
+
531
+                            // If criterion is achieved (1), add 1 to both arrays
532
+                            if ($criterion_achieved === 1) {
533
+                                $course_outcomes_attempted[$outcome->id] += 1;
534
+                                $course_outcomes_achieved[$outcome->id] += 1;
535
+                            }
536
+                            // Else, only add to the attempted outcomes arrays
537
+                            elseif ($criterion_achieved === 0) {
538
+                                $course_outcomes_attempted[$outcome->id] += 1;
539
+                            }
540
+                        }
605 541
                     }
606
-                  }
607 542
                 }
608 543
 
609 544
                 // Update course
610 545
                 $course->outcomes_achieved = json_encode($course_outcomes_achieved);
611 546
                 $course->outcomes_attempted = json_encode($course_outcomes_attempted);
612
-            }
613
-            else
614
-            {
547
+            } else {
615 548
                 $course->outcomes_achieved = NULL;
616 549
                 $course->outcomes_attempted = NULL;
617 550
             }
618 551
 
619
-            if($course->save())
620
-            {
552
+            if ($course->save()) {
621 553
                 Session::flash('status', 'success');
622 554
                 Session::flash('message', 'Activity deleted.');
623
-            }
624
-            else
625
-            {
555
+            } else {
626 556
                 Session::flash('status', 'danger');
627 557
                 Session::flash('message', 'Error deleting activity. Try again later.');
628 558
                 return Redirect::back();
629 559
             }
630 560
 
631 561
             return Redirect::action('CoursesController@show', array($course->id));
632
-        }
633
-        else
634
-        {
562
+        } else {
635 563
             Session::flash('status', 'danger');
636 564
             Session::flash('message', 'Error deleting activity. Try again later.');
637 565
             return Redirect::back();
@@ -640,12 +568,10 @@ class ActivitiesController extends \BaseController {
640 568
 
641 569
     public function update($id)
642 570
     {
643
-        try
644
-        {
571
+        try {
645 572
             $activity = Activity::find($id);
646 573
 
647
-            if(Input::has('update_activity_information'))
648
-            {
574
+            if (Input::has('update_activity_information')) {
649 575
                 /** Validation rules */
650 576
                 $validator = Validator::make(
651 577
                     array(
@@ -654,27 +580,25 @@ class ActivitiesController extends \BaseController {
654 580
                         'date' => Input::get('date'),
655 581
                     ),
656 582
                     array(
657
-                        'name' => 'required|unique:activities,course_id,'.$id,
583
+                        'name' => 'required|unique:activities,course_id,' . $id,
658 584
                         'description' => 'required|min:10',
659 585
                         'date' => 'required|dateFormat:Y-m-d'
660 586
                     ),
661 587
                     array(
662
-                        'date.dateFormat'=>'The date does not match the correct format: yyyy-mm-dd.'
588
+                        'date.dateFormat' => 'The date does not match the correct format: yyyy-mm-dd.'
663 589
                     )
664 590
                 );
665 591
 
666 592
                 /** If validation fails */
667
-                if ($validator->fails())
668
-                {
593
+                if ($validator->fails()) {
669 594
                     /** Prepare error message */
670 595
                     $message = 'Error(s) updating the Activity<ul>';
671 596
 
672
-                    foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
673
-                    {
674
-                        $message.=$validationError;
597
+                    foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
598
+                        $message .= $validationError;
675 599
                     }
676 600
 
677
-                    $message.='</ul>';
601
+                    $message .= '</ul>';
678 602
 
679 603
                     /** Send error message and old data */
680 604
                     Session::flash('status', 'warning');
@@ -686,23 +610,17 @@ class ActivitiesController extends \BaseController {
686 610
                 $activity->name = Input::get('name');
687 611
                 $activity->description = Input::get('description');
688 612
                 $activity->date = Input::get('date');
689
-            }
690
-            elseif(Input::has('update_transforming_actions'))
691
-            {
692
-                if(trim(Input::get('transforming_actions')) !="")
613
+            } elseif (Input::has('update_transforming_actions')) {
614
+                if (trim(Input::get('transforming_actions')) != "")
693 615
                     $activity->transforming_actions = Input::get('transforming_actions');
694 616
                 else
695 617
                     $activity->transforming_actions = NULL;
696
-            }
697
-            elseif(Input::has('update_assessment_comments'))
698
-            {
699
-                if(trim(Input::get('assessment_comments')) !="")
618
+            } elseif (Input::has('update_assessment_comments')) {
619
+                if (trim(Input::get('assessment_comments')) != "")
700 620
                     $activity->assessment_comments = Input::get('assessment_comments');
701 621
                 else
702 622
                     $activity->assessment_comments = NULL;
703
-            }
704
-            else
705
-            {
623
+            } else {
706 624
                 Session::flash('status', 'danger');
707 625
                 Session::flash('message', 'Error updating Activity. Please try again later.');
708 626
                 return Redirect::action('ActivitiesController@show', array($activity->id));
@@ -714,15 +632,11 @@ class ActivitiesController extends \BaseController {
714 632
             Session::flash('status', 'success');
715 633
             Session::flash('message', 'Activity succesfully updated.');
716 634
             return Redirect::action('ActivitiesController@show', array($activity->id));
717
-
718
-        }
719
-        catch(Exception $e)
720
-        {
635
+        } catch (Exception $e) {
721 636
             Session::flash('status', 'warning');
722 637
             Session::flash('message', 'Error updating Activity. Please try again later.');
723 638
             return Redirect::action('ActivitiesController@show', array($activity->id));
724 639
         }
725
-
726 640
     }
727 641
 
728 642
     //TODO the code in the next 2 functions is the same as the assess function except for the view returned. try to refactor this to avoid copying code.
@@ -732,7 +646,7 @@ class ActivitiesController extends \BaseController {
732 646
         $activity = Activity::find($id);
733 647
 
734 648
         // If activity does not exist, display 404
735
-        if(!$activity)
649
+        if (!$activity)
736 650
             App::abort('404');
737 651
 
738 652
         // Get activity's course
@@ -756,8 +670,7 @@ class ActivitiesController extends \BaseController {
756 670
 
757 671
         // Decode the scores (blade workaround)
758 672
         $scores_array = array();
759
-        foreach ($assessments as $index=>$assessment)
760
-        {
673
+        foreach ($assessments as $index => $assessment) {
761 674
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
762 675
         }
763 676
 
@@ -769,7 +682,7 @@ class ActivitiesController extends \BaseController {
769 682
         $activity = Activity::find($id);
770 683
 
771 684
         // If activity does not exist, display 404
772
-        if(!$activity)
685
+        if (!$activity)
773 686
             App::abort('404');
774 687
 
775 688
         // Get activity's course
@@ -793,13 +706,10 @@ class ActivitiesController extends \BaseController {
793 706
 
794 707
         // Decode the scores (blade workaround)
795 708
         $scores_array = array();
796
-        foreach ($assessments as $index=>$assessment)
797
-        {
709
+        foreach ($assessments as $index => $assessment) {
798 710
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
799 711
         }
800 712
 
801 713
         return View::make('local.professors.print_assessment', compact('activity', 'title', 'students', 'course', 'rubric_contents', 'assessments', 'scores_array', 'rubric'));
802 714
     }
803
-
804
-
805 715
 }

+ 180
- 96
app/controllers/CriteriaController.php Ver arquivo

@@ -1,20 +1,47 @@
1 1
 <?php
2 2
 
3
-class CriteriaController extends \BaseController {
3
+use Illuminate\Support\Facades\Input;
4
+
5
+class CriteriaController extends \BaseController
6
+{
4 7
 
5 8
     /**
6 9
      * Display a listing of the resource.
7 10
      *
11
+     * 
8 12
      * @return Response
9 13
      */
10 14
     public function fetchCriterion()
11 15
     {
12 16
         return Criterion::find(Input::get('id'));
13 17
     }
14
-
18
+    public function fetchObjectivesForSelect()
19
+    {
20
+        //$alloutcome = Input::get('outcome');
21
+        //$array = array();
22
+        //foreach ($alloutcome as $outcome) {
23
+        $outcome = DB::select("select objectives.id, objectives.text from objectives, objective_outcome where objective_outcome.outcome_id =? and objective_outcome.objective_id = objectives.id and objectives.active=1", array(Input::get('id')));
24
+        //
25
+        return json_encode($outcome);
26
+    }
15 27
     public function fetchCriterionWithTrashed()
16 28
     {
17
-        return Criterion::withTrashed()->find(Input::get('id'));
29
+
30
+        $json = array();
31
+        $json['criteria'] = DB::select(" select * from new_criteria where id = ?", array(Input::get('id')));
32
+        $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", array(Input::get('id')));
33
+        $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')));
34
+        $json['objectives_outcome'] = DB::select("select objectives.id, objectives.text, objective_outcome.outcome_id from objective_outcome, objectives where objective_outcome.outcome_id in(select  DISTINCT outcomes.id from outcomes , criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? 
35
+        and outcomes.id = criterion_objective_outcome.outcome_id) and objectives.id = objective_outcome.objective_id ORDER BY outcome_id", array(Input::get('id')));
36
+
37
+
38
+        //foreach ($objectivesAll as $objective) {
39
+
40
+        //   $objectivesArray = (array) $objective;
41
+        ///    Log::info("Logging an array: " . print_r($objectivesArray, true));
42
+        ///    $json['objectives_outcome'][strval($objectivesArray['outcome_id'])] = array('id' => $objectivesArray['id'], 'text' => $objectivesArray['text'], 'outcome_id');
43
+        //}
44
+        return json_encode($json);
18 45
     }
19 46
 
20 47
 
@@ -23,13 +50,12 @@ class CriteriaController extends \BaseController {
23 50
         // dd($input);
24 51
         Log::info('isCriterionUnique');
25 52
 
26
-        if(Input::get('program_id')!=0)
53
+        if (Input::get('program_id') != 0)
27 54
             $program_id = $input['program_id'];
28 55
         else
29 56
             $program_id = NULL;
30 57
 
31
-        $saved_criterion = Criterion::
32
-            withTrashed()
58
+        $saved_criterion = Criterion::withTrashed()
33 59
             ->where('name', '=', $input['name'])
34 60
             ->where('outcome_id', '=', $input['outcome_id'])
35 61
             ->where('program_id', '=', $program_id)
@@ -39,9 +65,9 @@ class CriteriaController extends \BaseController {
39 65
             // ->where('description78', '=', $input['description78'])
40 66
             ->first();
41 67
 
42
-    
43 68
 
44
-        if($saved_criterion)
69
+
70
+        if ($saved_criterion)
45 71
             return false;
46 72
         else
47 73
             return true;
@@ -56,21 +82,28 @@ class CriteriaController extends \BaseController {
56 82
 
57 83
         $trimmed = trim(preg_replace('/\t+/', '', Input::get('subcriteria')));
58 84
 
59
-        Log::info('trimmed 1 -->'.$trimmed.'<--');
85
+        Log::info('trimmed 1 -->' . $trimmed . '<--');
60 86
 
61 87
 
62
-        if($trimmed ==''){
88
+        if ($trimmed == '') {
63 89
             $trimmed = NULL;
64
-        }
65
-        else{
90
+        } else {
66 91
             $trimmed = json_encode(preg_split('/\r\n/', $trimmed));
67 92
         }
68 93
 
69
-        Log::info('trimmed 2 -->'.$trimmed.'<--');
94
+        Log::info('trimmed 2 -->' . $trimmed . '<--');
70 95
 
71 96
 
72 97
         $clean_input['subcriteria'] = $trimmed;
73
-        $clean_input['outcome_id'] = trim(preg_replace('/\t+/', '', Input::get('outcome_id')));
98
+        $clean_input['outcome_id'] = Input::get('outcome');
99
+
100
+
101
+
102
+        $clean_input['objective_id'] = Input::get('objective');
103
+
104
+
105
+
106
+
74 107
         $clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
75 108
         $clean_input['description12'] = trim(preg_replace('/\t+/', '', Input::get('description12')));
76 109
         $clean_input['description34'] = trim(preg_replace('/\t+/', '', Input::get('description34')));
@@ -78,6 +111,9 @@ class CriteriaController extends \BaseController {
78 111
         $clean_input['description78'] = trim(preg_replace('/\t+/', '', Input::get('description78')));
79 112
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
80 113
         $clean_input['notes'] = trim(preg_replace('/\t+/', '', Input::get('notes')));
114
+        $clean_input['maximum_score'] = 8;
115
+        $clean_input['number_of_scales'] = 4;
116
+
81 117
 
82 118
         return $clean_input;
83 119
     }
@@ -100,7 +136,7 @@ class CriteriaController extends \BaseController {
100 136
             array(
101 137
                 'name' => 'required|string',
102 138
                 'subcriteria' => 'string',
103
-                'outcome_id' => 'required|numeric|integer',
139
+                'outcome_id' => 'required|array',
104 140
                 'description12' => 'required|string',
105 141
                 'description34' => 'required|string',
106 142
                 'description56' => 'required|string',
@@ -130,68 +166,77 @@ class CriteriaController extends \BaseController {
130 166
         $validator = $this->makeValidator($clean_input);
131 167
 
132 168
         /** If validation fails */
133
-        if ($validator->fails())
134
-        {
169
+        if ($validator->fails()) {
135 170
             /** Prepare error message */
136 171
             $message = '<p>Error(s) creating a new Criterion:</p><ul>';
137 172
 
138
-            foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
139
-            {
140
-                $message.=$validationError;
173
+            foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
174
+                $message .= $validationError;
141 175
             }
142 176
 
143
-            $message.='</ul>';
177
+            $message .= '</ul>';
144 178
 
145 179
             /** Send error message and old data */
146 180
             Session::flash('status', 'danger');
147 181
             Session::flash('message', $message);
148 182
             return Redirect::to('criteria')->withInput();
149
-        }
150
-        else
151
-        {
183
+        } else {
152 184
             // Check criterion uniqueness
153
-            if(!$this->isCriterionUnique($clean_input))
154
-            {
155
-                /** Send error message and old data */
185
+            /*if (!$this->isCriterionUnique($clean_input)) {
186
+                /** Send error message and old data 
156 187
                 Session::flash('status', 'danger');
157 188
                 Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name and associated program are the same.');
158 189
                 return Redirect::to('criteria')->withInput();
159
-            }
190
+            }*/
160 191
 
161 192
             /** Instantiate new criterion */
162 193
             $criterion = new Criterion;
163
-            $criterion->name= $clean_input['name'];
194
+            $criterion->name = $clean_input['name'];
164 195
             $criterion->subcriteria = $clean_input['subcriteria'];
165
-            $criterion->outcome_id= $clean_input['outcome_id'];
196
+
166 197
             $criterion->description12 = $clean_input['description12'];
167 198
             $criterion->description34 = $clean_input['description34'];
168 199
             $criterion->description56 = $clean_input['description56'];
169 200
             $criterion->description78 = $clean_input['description78'];
201
+            //gabriel añadió aqui
202
+            $criterion->objective_id = 1; //$clean_input['objective_id'];
170 203
 
171
-            if(Input::get('copyright'))
204
+            if (Input::get('copyright'))
172 205
                 $criterion->copyright = $clean_input['copyright'];
173 206
 
174
-            if(Input::get('notes'))
207
+            if (Input::get('notes'))
175 208
                 $criterion->notes = $clean_input['notes'];
176 209
 
177 210
             // Set program
178
-            if(Input::get('program_id')!=0)
211
+            if (Input::get('program_id') != 0)
179 212
                 $criterion->program_id = $clean_input['program_id'];
180 213
             else
181 214
                 $criterion->program_id = NULL;
182 215
 
183 216
 
184 217
             /** If criterion is saved, send success message */
185
-            if($criterion->save())
186
-            {
218
+            if ($criterion->save()) {
219
+
220
+                $criterionId = $criterion->id;
221
+                foreach ($clean_input['outcome_id'] as $outcome_id) {
222
+                    foreach ($clean_input['objective_id'] as $objective_id) {
223
+                        //try{
224
+                        DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`, `objective_outcome_id`) values ({$objective_id},{$outcome_id}, {$criterionId}, 0)");
225
+                        // }
226
+                        //catch{
227
+                        //Session::flash('status', 'danger');
228
+                        //Session::flash('message', '<p>Error creating objective. Please try again later.</p>');
229
+                        //return Redirect::to('objective')->withInput();
230
+                        //}
231
+                    }
232
+                }
187 233
                 Session::flash('status', 'success');
188
-                Session::flash('message', 'Criterion created: "'.$criterion->name.'".');
234
+                Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
189 235
                 return Redirect::to('criteria')->withInput(Input::only('outcome_id'));
190 236
             }
191 237
 
192 238
             /** If saving fails, send error message and old data */
193
-            else
194
-            {
239
+            else {
195 240
                 Session::flash('status', 'danger');
196 241
                 Session::flash('message', '<p>Error creating Criterion. Please try again later.</p>');
197 242
                 return Redirect::to('learning-outcomes-criteria')->withInput();
@@ -202,43 +247,89 @@ class CriteriaController extends \BaseController {
202 247
     public function edit()
203 248
     {
204 249
         $title = "Criteria";
205
-        $outcomes = Outcome::orderBy('name', 'ASC')->get();
250
+        $outcomes = Outcome::orderBy('name', 'ASC')->lists('name', 'id');
251
+
206 252
         $schools = School::orderBy('name', 'ASC')->get();
207 253
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
208 254
         $programs = Program::orderBy('name', 'ASC')->get();
255
+        $objectives = DB::table('objectives')->orderBy('text', 'ASC')->lists('text', 'id');
209 256
 
210
-        return View::make('local.managers.admins.criteria', compact('title', 'outcomes', 'schools', 'criteria', 'programs'));
257
+
258
+
259
+
260
+        return View::make('local.managers.admins.criteria', compact('title', 'outcomes', 'schools', 'criteria', 'programs', 'objectives'));
261
+    }
262
+
263
+    private function cleanInputEdit()
264
+    {
265
+        $clean_input = array();
266
+
267
+        $clean_input['name'] = trim(preg_replace('/\t+/', '', Input::get('name')));
268
+
269
+
270
+        $trimmed = trim(preg_replace('/\t+/', '', Input::get('subcriteria')));
271
+
272
+        Log::info('trimmed 1 -->' . $trimmed . '<--');
273
+
274
+
275
+        if ($trimmed == '') {
276
+            $trimmed = NULL;
277
+        } else {
278
+            $trimmed = json_encode(preg_split('/\r\n/', $trimmed));
279
+        }
280
+
281
+        Log::info('trimmed 2 -->' . $trimmed . '<--');
282
+
283
+
284
+        $clean_input['subcriteria'] = $trimmed;
285
+        $clean_input['outcome_id'] = Input::get('assoc_outcome');
286
+
287
+
288
+
289
+        $clean_input['objective_id'] = Input::get('assoc_objective');
290
+
291
+
292
+
293
+
294
+        $clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
295
+        $clean_input['description12'] = trim(preg_replace('/\t+/', '', Input::get('description12')));
296
+        $clean_input['description34'] = trim(preg_replace('/\t+/', '', Input::get('description34')));
297
+        $clean_input['description56'] = trim(preg_replace('/\t+/', '', Input::get('description56')));
298
+        $clean_input['description78'] = trim(preg_replace('/\t+/', '', Input::get('description78')));
299
+        $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
300
+        $clean_input['notes'] = trim(preg_replace('/\t+/', '', Input::get('notes')));
301
+        $clean_input['maximum_score'] = 8;
302
+        $clean_input['number_of_scales'] = 4;
303
+
304
+
305
+        return $clean_input;
211 306
     }
212 307
 
213 308
     public function update()
214 309
     {
215 310
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
216 311
 
217
-        $clean_input = $this->cleanInput();
312
+        $clean_input = $this->cleanInputEdit();
218 313
 
219 314
         /** Validation rules */
220 315
         $validator = $this->makeValidator($clean_input);
221 316
 
222 317
         /** If validation fails */
223
-        if ($validator->fails())
224
-        {
318
+        if ($validator->fails()) {
225 319
             /** Prepare error message */
226 320
             $message = 'Error(s) updating the Criterion: <ul>';
227 321
 
228
-            foreach ($validator->messages()->all('<li>:message</li>') as $validationError)
229
-            {
230
-                $message.=$validationError;
322
+            foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
323
+                $message .= $validationError;
231 324
             }
232 325
 
233
-            $message.='</ul>';
326
+            $message .= '</ul>';
234 327
 
235 328
             /** Send error message and old data */
236 329
             Session::flash('status', 'danger');
237 330
             Session::flash('message', $message);
238 331
             return Redirect::back()->withInput();
239
-        }
240
-        else
241
-        {
332
+        } else {
242 333
 
243 334
             // // Check criterion uniqueness
244 335
             // if(!$this->isCriterionUnique($clean_input, $criterion))
@@ -250,47 +341,57 @@ class CriteriaController extends \BaseController {
250 341
             // }
251 342
 
252 343
             /** Set info */
253
-            $criterion->name= $clean_input['name'];
344
+            $criterion->name = $clean_input['name'];
254 345
             $criterion->subcriteria = $clean_input['subcriteria'];
255
-            $criterion->outcome_id= $clean_input['outcome_id'];
346
+            //$criterion->outcome_id = $clean_input['outcome_id'];
256 347
             $criterion->description12 = $clean_input['description12'];
257 348
             $criterion->description34 = $clean_input['description34'];
258 349
             $criterion->description56 = $clean_input['description56'];
259 350
             $criterion->description78 = $clean_input['description78'];
260 351
 
352
+
353
+
261 354
             // Set program
262
-            if(Input::get('program_id')!=0)
355
+            if (Input::get('program_id') != 0)
263 356
                 $criterion->program_id = Input::get('program_id');
264 357
             else
265 358
                 $criterion->program_id = NULL;
266 359
 
267 360
             // Set status
268
-            if(Input::get('status')==0)
361
+            if (Input::get('status') == 0)
269 362
                 $criterion->deleted_at = date('Y-m-d H:i:s');
270 363
             else
271 364
                 $criterion->deleted_at = NULL;
272 365
 
273
-            if(Input::get('copyright'))
366
+            if (Input::get('copyright'))
274 367
                 $criterion->copyright = $clean_input['copyright'];
275 368
             else
276
-                $criterion->copyright=NULL;
369
+                $criterion->copyright = NULL;
277 370
 
278
-            if(Input::get('notes'))
371
+            if (Input::get('notes'))
279 372
                 $criterion->notes = $clean_input['notes'];
280 373
             else
281
-                $criterion->notes=NULL;
374
+                $criterion->notes = NULL;
282 375
 
283 376
             /** If criterion is updated, send success message */
284
-            if($criterion->save())
285
-            {
377
+            if ($criterion->save()) {
378
+                $criterionId = $criterion->id;
379
+                DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
380
+
381
+                foreach ($clean_input['outcome_id'] as $outcome_id) {
382
+                    foreach ($clean_input['objective_id'] as $objective_id) {
383
+
384
+                        DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`,`objective_outcome_id`) values ({$objective_id},{$outcome_id}, {$criterionId}, 0)");
385
+                    }
386
+                }
387
+
286 388
                 Session::flash('status', 'success');
287
-                Session::flash('message', 'Updated criterion: "'.$criterion->name.'"');
389
+                Session::flash('message', 'Updated criterion: "' . $criterion->name . '"');
288 390
                 return Redirect::back();
289 391
             }
290 392
 
291 393
             /** If saving fails, send error message and old data */
292
-            else
293
-            {
394
+            else {
294 395
                 Session::flash('status', 'danger');
295 396
                 Session::flash('message', 'Error updating the Criterion. Please try again later.');
296 397
                 return Redirect::back()->withInput();
@@ -306,76 +407,60 @@ class CriteriaController extends \BaseController {
306 407
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
307 408
 
308 409
         return View::make('global.view-learning-outcomes-criteria', compact('title', 'outcomes', 'schools', 'criteria'));
309
-
310 410
     }
311 411
 
312 412
     public function destroy()
313 413
     {
314 414
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
315
-        if(!$criterion->trashed())
316
-        {
317
-            try
318
-            {
415
+        if (!$criterion->trashed()) {
416
+            try {
319 417
                 $criterion->delete();
320 418
                 Session::flash('status', 'success');
321
-                Session::flash('message', 'Deactivated criterion: "'.$criterion->name.'"');
322
-            }
323
-            catch (Exception $e)
324
-            {
419
+                Session::flash('message', 'Deactivated criterion: "' . $criterion->name . '"');
420
+            } catch (Exception $e) {
325 421
                 Session::flash('status', 'danger');
326
-                Session::flash('message', 'Error deactivating criterion."'.$criterion->name.'"');
422
+                Session::flash('message', 'Error deactivating criterion."' . $criterion->name . '"');
327 423
             }
328 424
             return Redirect::back();
329
-        }
330
-        else
331
-        {
332
-            try
333
-            {
425
+        } else {
426
+            try {
334 427
                 $criterion->restore();
335 428
                 Session::flash('status', 'success');
336
-                Session::flash('message', 'Reactivated criterion: "'.$criterion->name.'"');
337
-            }
338
-            catch (Exception $e)
339
-            {
429
+                Session::flash('message', 'Reactivated criterion: "' . $criterion->name . '"');
430
+            } catch (Exception $e) {
340 431
                 Session::flash('status', 'danger');
341
-                Session::flash('message', 'Error reactivating criterion: "'.$criterion->name.'".');
432
+                Session::flash('message', 'Error reactivating criterion: "' . $criterion->name . '".');
342 433
             }
343 434
             return Redirect::back();
344
-
345 435
         }
346 436
     }
347 437
 
348 438
     public function filterCriteria()
349 439
     {
350
-        switch (Input::get('filter'))
351
-        {
440
+        switch (Input::get('filter')) {
352 441
             case 'all':
353 442
                 return Criteria::all();
354 443
                 break;
355 444
 
356 445
             case 'school':
357 446
                 // If scoord
358
-                if(Auth::user()->role == '2')
359
-                {
447
+                if (Auth::user()->role == '2') {
360 448
 
361 449
                     // Fetch all the programs whose school is the user's
362 450
                     $program_ids = DB::table('programs')->where('school_id', Auth::user()->school_id)->lists('id');
363 451
 
364 452
                     // Return all criteria belonging to any of those programs
365
-                    return Criterion::
366
-                        whereIn('program_id', $program_ids)
453
+                    return Criterion::whereIn('program_id', $program_ids)
367 454
                         ->orderBy('name', 'ASC')
368 455
                         ->get();
369 456
                 }
370 457
 
371 458
                 // If pcoord
372
-                else
373
-                {
459
+                else {
374 460
                     // Fetch all the programs from the user's school;
375 461
                     $program_ids = DB::table('programs')->where('school_id', Auth::user()->programs[0]->school->id)->lists('id');
376 462
 
377
-                    return Criterion::
378
-                        whereIn('program_id', $program_ids)
463
+                    return Criterion::whereIn('program_id', $program_ids)
379 464
                         ->orderBy('name', 'ASC')
380 465
                         ->get();
381 466
                 }
@@ -383,8 +468,7 @@ class CriteriaController extends \BaseController {
383 468
                 break;
384 469
 
385 470
             case 'program':
386
-                return Criterion::
387
-                    whereIn('program_id', Auth::user()->programs->lists('id'))
471
+                return Criterion::whereIn('program_id', Auth::user()->programs->lists('id'))
388 472
                     ->orderBy('name', 'ASC')
389 473
                     ->get();
390 474
                 break;

+ 331
- 0
app/controllers/Objective2Controller.php Ver arquivo

@@ -0,0 +1,331 @@
1
+<?php
2
+
3
+class Objective2Controller extends \BaseController
4
+{
5
+
6
+	/**
7
+	 * Display a listing of the resource.
8
+	 *
9
+	 * @return Response
10
+	 */
11
+
12
+	public function index()
13
+	{
14
+
15
+		$title = "Learning Outcomes and Criteria";
16
+		$outcomes = Outcome::orderBy('name', 'ASC')->get();
17
+		$schools = School::orderBy('name', 'ASC')->get();
18
+		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
19
+
20
+		return View::make('global.view-learning-outcomes-criteria', compact('title', 'outcomes', 'schools', 'objectives'));
21
+	}
22
+
23
+
24
+
25
+	/**
26
+	 * Show the form for creating a new resource.
27
+	 *
28
+	 * @return Response
29
+	 */
30
+	public function isObjectiveUnique($input, $existing_Objective = NULL)
31
+	{
32
+
33
+		Log::info('isObjectiveUnique');
34
+
35
+		if (Input::get('program_id') != 0)
36
+			$program_id = $input['program_id'];
37
+		else
38
+			$program_id = NULL;
39
+
40
+		$saved_Objective = Objective::withTrashed()
41
+			->where('text', '=', $input['text'])
42
+			->where('outcome_id', '=', $input['outcome_id'])
43
+			->where('program_id', '=', $program_id)
44
+
45
+			->first();
46
+
47
+
48
+
49
+		if ($saved_Objective)
50
+			return false;
51
+		else
52
+			return true;
53
+	}
54
+
55
+
56
+	private function makeValidator($clean_input)
57
+	{
58
+		/** Validation rules */
59
+		return Validator::make(
60
+			array(
61
+				'text' => $clean_input['text'],
62
+
63
+				'outcome_id' => $clean_input['outcome_id'],
64
+				'program_id' => $clean_input['program_id']
65
+
66
+			),
67
+			array(
68
+				'text' => 'required|string',
69
+
70
+				'outcome_id' => 'required|array',
71
+				'program_id' => 'required|numeric|integer'
72
+
73
+			)
74
+
75
+		);
76
+	}
77
+
78
+
79
+	private function cleanInput()
80
+	{
81
+		$clean_input = array();
82
+
83
+		$clean_input['text'] = trim(preg_replace('/\t+/', '', Input::get('text')));
84
+
85
+
86
+		$clean_input['outcome_id'] = Input::get('outcome');
87
+		$counter = Input::get('counter') + 0;
88
+
89
+		for ($i = 0; $i < $counter; $i++) {
90
+			$clean_input['outcome_id'][$i] = trim(preg_replace('/\t+/', '', $clean_input['outcome_id'][$i]));
91
+		}
92
+
93
+		$clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
94
+
95
+
96
+		return $clean_input;
97
+	}
98
+
99
+	private function cleanAssocInput()
100
+	{
101
+		$clean_input = array();
102
+
103
+		$clean_input['text'] = trim(preg_replace('/\t+/', '', Input::get('text')));
104
+
105
+
106
+		$clean_input['outcome_id'] = Input::get('assoc_outcome');
107
+		$counter = Input::get('counter') + 0;
108
+
109
+		for ($i = 0; $i < $counter; $i++) {
110
+			$clean_input['outcome_id'][$i] = trim(preg_replace('/\t+/', '', $clean_input['outcome_id'][$i]));
111
+		}
112
+
113
+		$clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
114
+
115
+
116
+		return $clean_input;
117
+	}
118
+	public function fetchObjective()
119
+	{
120
+		return Objective::find(Input::get('id'));
121
+	}
122
+
123
+	public function fetchObjectiveWithTrashed()
124
+	{
125
+		return json_encode(DB::select('select o.id, o.program_id, o.text, outc.outcome_id outcome_id from objectives o, objective_outcome outc where o.id = ? and o.id = outc.objective_id', array(Input::get('id'))));
126
+	}
127
+	/**
128
+	 * Create a new Objective.
129
+	 *
130
+	 * @return Redirect Redirect back to form page
131
+	 */
132
+	public function create()
133
+	{
134
+
135
+		$clean_input = $this->cleanInput();
136
+
137
+		/** Validation rules */
138
+		$validator = $this->makeValidator($clean_input);
139
+
140
+		/** If validation fails */
141
+		if ($validator->fails()) {
142
+			/** Prepare error message */
143
+			$message = '<p>Error(s) creating a new Objective:</p><ul>';
144
+
145
+			foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
146
+				$message .= $validationError;
147
+			}
148
+
149
+			$message .= '</ul>';
150
+
151
+			/** Send error message and old data */
152
+			Session::flash('status', 'danger');
153
+			Session::flash('message', $message);
154
+			return Redirect::to('objective')->withInput();
155
+		} else {
156
+			// Check Objective uniqueness
157
+			if (!$this->isObjectiveUnique($clean_input)) {
158
+				/** Send error message and old data */
159
+				Session::flash('status', 'danger');
160
+				Session::flash('message', "This objective is a duplicate of an already saved Objective because it's and associated program are the same.");
161
+				return Redirect::to('objective')->withInput();
162
+			}
163
+
164
+			/** Instantiate new Objective */
165
+			$objective = new Objective;
166
+			$objective->text = $clean_input['text'];
167
+
168
+
169
+
170
+
171
+			// Set program
172
+			if (Input::get('program_id') != 0)
173
+				$objective->program_id = $clean_input['program_id'];
174
+			else
175
+				$objective->program_id = NULL;
176
+
177
+
178
+			/** If Objective is saved, send success message */
179
+			if ($objective->save()) {
180
+				$objectiveId = $objective->id;
181
+				foreach ($clean_input['outcome_id'] as $outcome_id) {
182
+					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
183
+
184
+					/*if (!($objectiveOutcome->save())) {
185
+						Session::flash('status', 'danger');
186
+						Session::flash('message', '<p>Error creating objective. Please try again later.</p>');
187
+						return Redirect::to('objective')->withInput();
188
+					}*/
189
+				}
190
+
191
+				Session::flash('status', 'success');
192
+				Session::flash('message', 'Objective created: "' . $objective->text . '".');
193
+				return Redirect::to('objective')->withInput(Input::only('outcome_id'));
194
+			}
195
+
196
+			/** If saving fails, send error message and old data */
197
+			else {
198
+				Session::flash('status', 'danger');
199
+				Session::flash('message', '<p>Error creating objective. Please try again later.</p>');
200
+				return Redirect::to('objective')->withInput();
201
+			}
202
+		}
203
+	}
204
+	/**
205
+	 * Store a newly created resource in storage.
206
+	 *
207
+	 * @return Response
208
+	 */
209
+	public function store()
210
+	{
211
+		//
212
+	}
213
+
214
+
215
+	/**
216
+	 * Display the specified resource.
217
+	 *
218
+	 * @param  int  $id
219
+	 * @return Response
220
+	 */
221
+	public function show($id)
222
+	{
223
+		//
224
+	}
225
+
226
+
227
+	/**
228
+	 * Show the form for editing the specified resource.
229
+	 *
230
+	 * @param  int  $id
231
+	 * @return Response
232
+	 */
233
+	public function edit()
234
+	{
235
+		$title = "Objective";
236
+		$outcomes = Outcome::orderBy('name', 'ASC')->lists('name', 'id');
237
+
238
+		$objectives = Objective::withTrashed()->orderBy('text', 'ASC')->get();
239
+		$programs = Program::orderBy('name', 'ASC')->get();
240
+
241
+		return View::make('local.managers.admins.objectives', compact('title', 'outcomes', 'objectives', 'programs'));
242
+	}
243
+
244
+
245
+
246
+
247
+	/**
248
+	 * Update the specified resource in storage.
249
+	 *
250
+	 * @param  int  $id
251
+	 * @return Response
252
+	 */
253
+
254
+	public function update()
255
+	{
256
+		$Objective = Objective::withTrashed()->find(Input::get('id'));
257
+
258
+		$clean_input = $this->cleanAssocInput();
259
+
260
+		/** Validation rules */
261
+		$validator = $this->makeValidator($clean_input);
262
+
263
+		/** If validation fails */
264
+		if ($validator->fails()) {
265
+			/** Prepare error message */
266
+			$message = 'Error(s) updating the Objective: <ul>';
267
+
268
+			foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
269
+				$message .= $validationError;
270
+			}
271
+
272
+			$message .= '</ul>';
273
+
274
+			/** Send error message and old data */
275
+			Session::flash('status', 'danger');
276
+			Session::flash('message', $message);
277
+			return Redirect::back()->withInput();
278
+		} else {
279
+
280
+
281
+
282
+			/** Set info */
283
+			$Objective->text = $clean_input['text'];
284
+
285
+
286
+
287
+			// Set program
288
+			if (Input::get('program_id') != 0)
289
+				$Objective->program_id = Input::get('program_id');
290
+			else
291
+				$Objective->program_id = NULL;
292
+
293
+			// Set status
294
+
295
+
296
+			/** If Objective is updated, send success message */
297
+			if ($Objective->save()) {
298
+
299
+				$objectiveId = $Objective->id;
300
+				DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
301
+
302
+				foreach ($clean_input['outcome_id'] as $outcome_id) {
303
+					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
304
+					Session::flash('status', 'success');
305
+					Session::flash('message', 'Updated Objective: "' . $Objective->text . '"');
306
+					return Redirect::back();
307
+				}
308
+			}
309
+
310
+			/** If saving fails, send error message and old data */
311
+			else {
312
+				Session::flash('status', 'danger');
313
+				Session::flash('message', 'Error updating the Objective. Please try again later.');
314
+				return Redirect::back()->withInput();
315
+			}
316
+		}
317
+	}
318
+
319
+
320
+
321
+	/**
322
+	 * Remove the specified resource from storage.
323
+	 *
324
+	 * @param  int  $id
325
+	 * @return Response
326
+	 */
327
+	public function destroy($id)
328
+	{
329
+		//
330
+	}
331
+}

+ 86
- 0
app/controllers/Objective_OutcomeController.php Ver arquivo

@@ -0,0 +1,86 @@
1
+<?php
2
+
3
+class Objective_OutcomeController extends \BaseController {
4
+
5
+	/**
6
+	 * Display a listing of the resource.
7
+	 *
8
+	 * @return Response
9
+	 */
10
+	public function index()
11
+	{
12
+		//
13
+	}
14
+
15
+
16
+	/**
17
+	 * Show the form for creating a new resource.
18
+	 *
19
+	 * @return Response
20
+	 */
21
+	public function create()
22
+	{
23
+		//
24
+	}
25
+
26
+
27
+	/**
28
+	 * Store a newly created resource in storage.
29
+	 *
30
+	 * @return Response
31
+	 */
32
+	public function store()
33
+	{
34
+		//
35
+	}
36
+
37
+
38
+	/**
39
+	 * Display the specified resource.
40
+	 *
41
+	 * @param  int  $id
42
+	 * @return Response
43
+	 */
44
+	public function show($id)
45
+	{
46
+		//
47
+	}
48
+
49
+
50
+	/**
51
+	 * Show the form for editing the specified resource.
52
+	 *
53
+	 * @param  int  $id
54
+	 * @return Response
55
+	 */
56
+	public function edit($id)
57
+	{
58
+		//
59
+	}
60
+
61
+
62
+	/**
63
+	 * Update the specified resource in storage.
64
+	 *
65
+	 * @param  int  $id
66
+	 * @return Response
67
+	 */
68
+	public function update($id)
69
+	{
70
+		//
71
+	}
72
+
73
+
74
+	/**
75
+	 * Remove the specified resource from storage.
76
+	 *
77
+	 * @param  int  $id
78
+	 * @return Response
79
+	 */
80
+	public function destroy($id)
81
+	{
82
+		//
83
+	}
84
+
85
+
86
+}

+ 49
- 75
app/controllers/RubricsController.php Ver arquivo

@@ -1,6 +1,7 @@
1 1
 <?php
2 2
 
3
-class RubricsController extends \BaseController {
3
+class RubricsController extends \BaseController
4
+{
4 5
 
5 6
     /**
6 7
      * Show the form for creating a new rubric
@@ -15,20 +16,18 @@ class RubricsController extends \BaseController {
15 16
         if (!$activity)
16 17
             App::abort('404');
17 18
 
18
-        $title = 'Rubric for <em>'.$activity->name.'</em>';
19
+        $title = 'Rubric for <em>' . $activity->name . '</em>';
19 20
 
20 21
         // Select templates that belong to everyone or belong to the activity's course's school
21
-        $templates = Template::
22
-        where('is_visible', '=', 1)
23
-        ->where(function($query) use ($activity)
24
-        {
25
-            if(Auth::user()->role != 1){
26
-                $query
27
-                ->where('school_id', $activity->course->program->school->id)
28
-                ->orWhere('school_id', '=', NULL);
29
-            }
30
-        })
31
-        ->orderBy('name', 'ASC')->get();
22
+        $templates = Template::where('is_visible', '=', 1)
23
+            ->where(function ($query) use ($activity) {
24
+                if (Auth::user()->role != 1) {
25
+                    $query
26
+                        ->where('school_id', $activity->course->program->school->id)
27
+                        ->orWhere('school_id', '=', NULL);
28
+                }
29
+            })
30
+            ->orderBy('name', 'ASC')->get();
32 31
 
33 32
         $rubrics = Auth::user()->rubrics;
34 33
         $outcomes = Outcome::orderBy('name', 'ASC')->get();
@@ -48,10 +47,9 @@ class RubricsController extends \BaseController {
48 47
 
49 48
         DB::beginTransaction();
50 49
 
51
-        try
52
-        {
50
+        try {
53 51
             // Get rubric contents
54
-            $rubric_contents= json_decode(Input::get('contents'));
52
+            $rubric_contents = json_decode(Input::get('contents'));
55 53
 
56 54
             // Process rubric
57 55
             $rubric = new Rubric;
@@ -73,14 +71,12 @@ class RubricsController extends \BaseController {
73 71
             Session::flash('message', 'Rubric assigned.');
74 72
 
75 73
             return action('ActivitiesController@show', array($activity->id));
74
+        } catch (Exception $e) {
76 75
 
77
-
78
-        }
79
-        catch(Exception $e)
80
-        {
81 76
             DB::rollBack();
82
-            Session::flash('status', 'danger');
83
-            Session::flash('message', 'Error creating Rubric. Try again later.');
77
+            echo $e->getMessage();
78
+            //Session::flash('status', 'danger');
79
+            //Session::flash('message', 'Error creating Rubric. Try again later.');
84 80
         }
85 81
     }
86 82
 
@@ -111,17 +107,15 @@ class RubricsController extends \BaseController {
111 107
 
112 108
         try {
113 109
             // Get associated activity
114
-            $activity= Activity::where('rubric_id', '=', $rubric->id)->first();
110
+            $activity = Activity::where('rubric_id', '=', $rubric->id)->first();
115 111
 
116 112
             // If the associated activity has been assessed, delete the records
117
-            if($activity->outcomes_attempted!=NULL)
118
-            {
113
+            if ($activity->outcomes_attempted != NULL) {
119 114
                 DB::table('assessments')->where('activity_id', '=', $activity->id)->delete();
120
-                $activity->criteria_achieved_percentage= NULL;
121
-                $activity->criteria_achieved= NULL;
122
-                $activity->outcomes_achieved=NULL;
123
-                $activity->outcomes_attempted=NULL;
124
-
115
+                $activity->criteria_achieved_percentage = NULL;
116
+                $activity->criteria_achieved = NULL;
117
+                $activity->outcomes_achieved = NULL;
118
+                $activity->outcomes_attempted = NULL;
125 119
             }
126 120
 
127 121
             $rubric->save();
@@ -133,46 +127,38 @@ class RubricsController extends \BaseController {
133 127
 
134 128
             // Check if any assessed activities remain
135 129
             $remainingAssessed = false;
136
-            foreach ($course->activities as $activity)
137
-            {
138
-                if($activity->outcomes_attempted!=NULL)
139
-                {
140
-                    $remainingAssessed =true;
130
+            foreach ($course->activities as $activity) {
131
+                if ($activity->outcomes_attempted != NULL) {
132
+                    $remainingAssessed = true;
141 133
                     break;
142 134
                 }
143 135
             }
144 136
 
145 137
             //If there are still evaluated activities in the course, recalculate course outcomes
146
-            if(!$activities->isEmpty() && $remainingAssessed)
147
-            {
138
+            if (!$activities->isEmpty() && $remainingAssessed) {
148 139
                 // Variables to hold recalculated outcomes for the course
149 140
                 $course_outcomes_attempted = array_fill(1, Outcome::all()->count(), 0);
150 141
                 $course_outcomes_achieved = array_fill(1, Outcome::all()->count(), 0);
151 142
 
152 143
                 // For each activity
153
-                foreach ($activities as $activity)
154
-                {
144
+                foreach ($activities as $activity) {
155 145
                     // If activity has been assessed
156
-                    if($activity->outcomes_attempted!=NULL)
157
-                    {
146
+                    if ($activity->outcomes_attempted != NULL) {
158 147
                         // Get the achieved criteria
159 148
                         $criteria_achievement = json_decode($activity->criteria_achieved, true);
160
-                        foreach($criteria_achievement as $criterion_id=>$criterion_achieved)
161
-                        {
149
+                        foreach ($criteria_achievement as $criterion_id => $criterion_achieved) {
162 150
                             // Find corresponding learning outcome;
163 151
                             $criterion = Criterion::find($criterion_id);
164 152
                             $outcome = Outcome::find($criterion->outcome_id);
165 153
 
166 154
                             // If criterion is achieved (1), add 1 to both arrays
167
-                            if($criterion_achieved === 1)
168
-                            {
169
-                                $course_outcomes_attempted[$outcome->id]+=1;
170
-                                $course_outcomes_achieved[$outcome->id]+=1;
155
+                            if ($criterion_achieved === 1) {
156
+                                $course_outcomes_attempted[$outcome->id] += 1;
157
+                                $course_outcomes_achieved[$outcome->id] += 1;
171 158
                             }
172 159
                             // Else, only add to the attempted outcomes arrays
173
-                            elseif($criterion_achieved === 0)
174
-                            {
175
-                                $course_outcomes_attempted[$outcome->id]+=1;
160
+                            elseif ($criterion_achieved === 0) {
161
+                                $course_outcomes_attempted[$outcome->id] += 1;
176 162
                             }
177 163
                         }
178 164
                     }
@@ -181,14 +167,10 @@ class RubricsController extends \BaseController {
181 167
                 // Update course
182 168
                 $course->outcomes_achieved = json_encode($course_outcomes_achieved);
183 169
                 $course->outcomes_attempted = json_encode($course_outcomes_attempted);
184
-
185
-            }
186
-            else
187
-            {
170
+            } else {
188 171
                 // Update course
189 172
                 $course->outcomes_achieved = NULL;
190 173
                 $course->outcomes_attempted = NULL;
191
-
192 174
             }
193 175
 
194 176
             $course->save();
@@ -198,9 +180,7 @@ class RubricsController extends \BaseController {
198 180
             Session::flash('message', 'Rubric updated.');
199 181
 
200 182
             return action('ActivitiesController@show', array($activity->id));
201
-        }
202
-        catch (Exception $e)
203
-        {
183
+        } catch (Exception $e) {
204 184
             DB::rollBack();
205 185
             Session::flash('status', 'danger');
206 186
             Session::flash('message', 'Error: The rubric could not be updated. Try again later.');
@@ -216,13 +196,10 @@ class RubricsController extends \BaseController {
216 196
     {
217 197
         $rubric = Rubric::find(Input::get('id'));
218 198
 
219
-        if($rubric->delete())
220
-        {
199
+        if ($rubric->delete()) {
221 200
             Session::flash('status', 'success');
222 201
             Session::flash('message', 'Rubric deleted.');
223
-        }
224
-        else
225
-        {
202
+        } else {
226 203
             Session::flash('status', 'danger');
227 204
             Session::flash('message', 'Error: The rubric could not be deleted. Try again later.');
228 205
         }
@@ -243,10 +220,10 @@ class RubricsController extends \BaseController {
243 220
 
244 221
         // If activity does not belong to the requesting user, display 403
245 222
         if ($course->user_id != Auth::id())
246
-                App::abort('403', 'Access Forbidden');
223
+            App::abort('403', 'Access Forbidden');
247 224
 
248 225
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
249
-        $title = $activity->name.': '.$rubric->name;
226
+        $title = $activity->name . ': ' . $rubric->name;
250 227
         return View::make('local.professors.viewrubric', compact('rubric', 'activity', 'title', 'course'));
251 228
     }
252 229
 
@@ -259,7 +236,7 @@ class RubricsController extends \BaseController {
259 236
     {
260 237
         // If user is a professor, display 403.
261 238
         if (Auth::user()->role == 4)
262
-                App::abort('403', 'Access Forbidden');
239
+            App::abort('403', 'Access Forbidden');
263 240
 
264 241
         $rubric = Rubric::where('id', '=', $rubric_id)->firstOrFail();
265 242
         $title = $rubric->name;
@@ -275,10 +252,10 @@ class RubricsController extends \BaseController {
275 252
 
276 253
         // If activity does not belong to the requesting user, display 403
277 254
         if ($course->user_id != Auth::id())
278
-                App::abort('403', 'Access Forbidden');
255
+            App::abort('403', 'Access Forbidden');
279 256
 
280 257
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
281
-        $title = $activity->name.': '.$rubric->name;
258
+        $title = $activity->name . ': ' . $rubric->name;
282 259
         return View::make('local.professors.downloadrubric', compact('rubric', 'activity', 'title', 'course'));
283 260
     }
284 261
 
@@ -290,10 +267,10 @@ class RubricsController extends \BaseController {
290 267
 
291 268
         // If activity does not belong to the requesting user, display 403
292 269
         if ($course->user_id != Auth::id())
293
-                App::abort('403', 'Access Forbidden');
270
+            App::abort('403', 'Access Forbidden');
294 271
 
295 272
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
296
-        $title = $activity->name.': '.$rubric->name;
273
+        $title = $activity->name . ': ' . $rubric->name;
297 274
         return View::make('local.professors.printrubric', compact('rubric', 'activity', 'title', 'course'));
298 275
     }
299 276
 
@@ -304,13 +281,10 @@ class RubricsController extends \BaseController {
304 281
 
305 282
         $rubric_contents = json_decode($rubric->contents);
306 283
 
307
-        foreach ($rubric_contents as $key => $criterion)
308
-        {
309
-            if($criterion->id == $criterion_id)
310
-            {
284
+        foreach ($rubric_contents as $key => $criterion) {
285
+            if ($criterion->id == $criterion_id) {
311 286
                 return json_encode($criterion);
312 287
             }
313 288
         }
314 289
     }
315
-
316 290
 }

+ 47
- 0
app/database/migrations/2020_10_04_142756_create_new_assessments_table.php Ver arquivo

@@ -0,0 +1,47 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateNewAssessmentsTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('new_assessments', function(Blueprint $table)
16
+		{
17
+			$table->increments('id');
18
+			$table->integer('student_id')->unsigned();
19
+			$table->integer('activity_criterion_id')->unsigned();
20
+			$table->integer('score');
21
+			$table
22
+				->foreign('student_id')
23
+				->references('id')
24
+				->on('students')
25
+				->onDelete('cascade')
26
+				->onUpdate('cascade');
27
+			$table
28
+				->foreign('activity_criterion_id')
29
+				->references('id')
30
+				->on('activity_criterion')
31
+				->onDelete('cascade')
32
+				->onUpdate('cascade');
33
+			$table->timestamps();
34
+		});
35
+	}
36
+
37
+	/**
38
+	 * Reverse the migrations.
39
+	 *
40
+	 * @return void
41
+	 */
42
+	public function down()
43
+	{
44
+		Schema::drop('new_assessments');
45
+	}
46
+
47
+}

+ 52
- 0
app/database/migrations/2020_10_05_124915_create_activity_criterion_table.php Ver arquivo

@@ -0,0 +1,52 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateActivityCriterionTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('activity_criterion', function(Blueprint $table)
16
+		{
17
+			$table->increments('id');
18
+			$table->integer('activity_id')->unsigned();
19
+			$table->integer('criterion_id')->unsigned();
20
+			$table
21
+				->foreign('activity_id')
22
+				->references('id')
23
+				->on('activities')
24
+				->onDelete('cascade')
25
+				->onUpdate('cascade');
26
+			$table
27
+				->foreign('criterion_id')
28
+				->references('id')
29
+				->on('criteria')
30
+				->onDelete('cascade')
31
+				->onUpdate('cascade');
32
+			$table->text('transformative_actions')->nullable();
33
+			$table->integer('expected_student_score')->nullable();
34
+			$table->decimal('expected_percentage_students_achieving', 5, 2)->nullable();
35
+			$table->decimal('percentage_students_who_achieved', 5, 2)->nullable();
36
+			$table->decimal('weight', 3, 2)->default(1.0);
37
+			$table->timestamps();
38
+		});
39
+	
40
+	}
41
+
42
+	/**
43
+	 * Reverse the migrations.
44
+	 *
45
+	 * @return void
46
+	 */
47
+	public function down()
48
+	{
49
+		Schema::drop('activity_criterion');
50
+	}
51
+
52
+}

+ 35
- 0
app/database/migrations/2020_10_05_130252_add_max_score_num_scales_new_criteria_table.php Ver arquivo

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

+ 35
- 0
app/database/migrations/2020_10_05_142424_create_scales_table.php Ver arquivo

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

+ 47
- 0
app/database/migrations/2020_10_05_142912_create_criterion_scale_table.php Ver arquivo

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

+ 34
- 0
app/database/migrations/2020_10_05_232429_add_assessment_comments_to_activity_criterion.php Ver arquivo

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

+ 36
- 0
app/database/migrations/2020_10_09_131800_add_level_activation_date_to_outcomes.php Ver arquivo

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

+ 53
- 0
app/database/migrations/2020_10_16_190923_create_criterion_objective_outcome_table.php Ver arquivo

@@ -0,0 +1,53 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateCriterionObjectiveOutcomeTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('criterion_objective_outcome', function(Blueprint $table)
16
+		{
17
+			$table->increments('id');
18
+			$table->integer('criterion_id')->unsigned();
19
+			$table->integer('objective_id')->unsigned();
20
+			$table->integer('outcome_id')->unsigned();
21
+			$table
22
+				->foreign('criterion_id')
23
+				->references('id')
24
+				->on('criteria')
25
+				->onDelete('cascade')
26
+				->onUpdate('cascade');
27
+			$table
28
+				->foreign('objective_id')
29
+				->references('id')
30
+				->on('objectives')
31
+				->onDelete('cascade')
32
+				->onUpdate('cascade');
33
+			$table
34
+				->foreign('outcome_id')
35
+				->references('id')
36
+				->on('outcomes')
37
+				->onDelete('cascade')
38
+				->onUpdate('cascade');
39
+			$table->timestamps();
40
+		});
41
+	}
42
+
43
+	/**
44
+	 * Reverse the migrations.
45
+	 *
46
+	 * @return void
47
+	 */
48
+	public function down()
49
+	{
50
+		Schema::drop('criterion_objective_outcome');
51
+	}
52
+
53
+}

+ 57
- 0
app/database/migrations/2020_10_18_145108_create_outcome_performance_table.php Ver arquivo

@@ -0,0 +1,57 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateOutcomePerformanceTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('outcome_performance', function(Blueprint $table)
16
+		{
17
+			$table->increments('id');
18
+			$table->integer('criterion_id')->unsigned();
19
+			$table->integer('outcome_id')->unsigned();
20
+			$table->integer('semester_id')->unsigned();
21
+			$table->integer('students_attempted');
22
+			$table->integer('students_achieved');
23
+			$table->smallInteger('level');
24
+			$table
25
+				->foreign('criterion_id')
26
+				->references('id')
27
+				->on('criteria')
28
+				->onDelete('cascade')
29
+				->onUpdate('cascade');
30
+			$table
31
+				->foreign('outcome_id')
32
+				->references('id')
33
+				->on('outcomes')
34
+				->onDelete('cascade')
35
+				->onUpdate('cascade');
36
+			$table
37
+				->foreign('semester_id')
38
+				->references('id')
39
+				->on('semesters')
40
+				->onDelete('cascade')
41
+				->onUpdate('cascade');
42
+
43
+			$table->timestamps();
44
+		});
45
+	}
46
+
47
+	/**
48
+	 * Reverse the migrations.
49
+	 *
50
+	 * @return void
51
+	 */
52
+	public function down()
53
+	{
54
+		Schema::drop('outcome_performance');
55
+	}
56
+
57
+}

+ 30
- 0
app/database/migrations/2020_10_29_122332_MakeOutcomeNullable.php Ver arquivo

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

+ 30
- 0
app/database/migrations/2020_10_29_195413_MakeObjectiveNullable.php Ver arquivo

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

+ 30
- 0
app/database/migrations/2020_10_29_224846_Make_criterion_objective_outcome_changeForeignKey.php Ver arquivo

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class MakeCriterionObjectiveOutcomeChangeForeignKey extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::table('criterion_objective_outcome', function (Blueprint $table) {
17
+			$table->dropForeign('criterion_objective_outcome_criterion_id_foreign');
18
+			$table->foreign('criterion_id')->references('id')->on('new_criteria')->onDelete('cascade')->onUpdate('cascade');
19
+		});
20
+	}
21
+
22
+	/**
23
+	 * Reverse the migrations.
24
+	 *
25
+	 * @return void
26
+	 */
27
+	public function down()
28
+	{
29
+	}
30
+}

+ 35
- 0
app/database/migrations/2020_11_06_011242_changeCriteriaObjOutcome.php Ver arquivo

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+use Illuminate\Support\Facades\Schema;
6
+
7
+class ChangeCriteriaObjOutcome extends Migration
8
+{
9
+
10
+	/**
11
+	 * Run the migrations.
12
+	 *
13
+	 * @return void
14
+	 */
15
+	public function up()
16
+	{
17
+		Schema::table('criterion_objective_outcome', function (Blueprint $table) {
18
+			//$table->dropForeign('criterion_objective_outcome_objective_id_foreign');
19
+			//$table->dropForeign('criterion_objective_outcome_outcome_id_foreign');
20
+			//$table->integer('objective_outcome_id');
21
+			DB::statement("ALTER TABLE `criterion_objective_outcome` CHANGE COLUMN `objective_outcome_id` `objective_outcome_id` INT(10) UNSIGNED NOT NULL");
22
+			$table->foreign('objective_outcome_id')->references('id')->on('objective_outcome')->onDelete('cascade')->onUpdate('cascade');
23
+		});
24
+	}
25
+
26
+	/**
27
+	 * Reverse the migrations.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function down()
32
+	{
33
+		//
34
+	}
35
+}

+ 31
- 0
app/database/migrations/2020_11_11_201214_dropForeignObjOut.php Ver arquivo

@@ -0,0 +1,31 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class DropForeignObjOut extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::table('criterion_objective_outcome', function (Blueprint $table) {
17
+			$table->dropForeign('criterion_objective_outcome_objective_outcome_id_foreign');
18
+			$table->foreign('outcome_id')->references('id')->on('outcomes')->onDelete('cascade')->onUpdate('cascade');
19
+		});
20
+	}
21
+
22
+	/**
23
+	 * Reverse the migrations.
24
+	 *
25
+	 * @return void
26
+	 */
27
+	public function down()
28
+	{
29
+		//
30
+	}
31
+}

+ 30
- 0
app/database/migrations/emails/feedback-email-copy.blade.php Ver arquivo

@@ -0,0 +1,30 @@
1
+<!DOCTYPE html>
2
+<html lang="en-US">
3
+	<head>
4
+		<meta charset="utf-8">
5
+	</head>
6
+	<body style="width: 960px;">
7
+		<div>{{HTML::image('/images/olas-email-header.png', 'OLAS Header Image', array('class'=>'logo img-responsive'))}}</div>		
8
+		<div>
9
+			<h2 style="color: #E70033;">Copy of your feedback for OLAS (no-reply)</h2>
10
+			
11
+			<hr style="border: 0; height: 0; border-top: 1px solid rgba(0, 0, 0, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.3);">
12
+			<h3>Type: </h3>
13
+			<p>{{ $type }}</p>
14
+
15
+			<h3>Email: </h3>
16
+			<p>{{ $email }}</p>
17
+
18
+			<h3>Comment: </h3>
19
+			<p>{{ $comment }}</p>
20
+			<hr style="border: 0; height: 0; border-top: 1px solid rgba(0, 0, 0, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.3);">
21
+
22
+			<p>This is an automatic email message. Please do not reply, as the inbox is not monitored.</p>
23
+
24
+			<p>Regards,</p>
25
+			<p style="color: #E70033;"><strong>OLAS UPRRP Administration<strong></p><br/>
26
+			
27
+
28
+		</div>
29
+	</body>
30
+</html>

app/database/migrations/2018_08_28_140328_remove_outcome_id_from_objectives_table.php → app/database/unusedMigrations/2018_08_28_140328_remove_outcome_id_from_objectives_table.php Ver arquivo

@@ -3,7 +3,8 @@
3 3
 use Illuminate\Database\Migrations\Migration;
4 4
 use Illuminate\Database\Schema\Blueprint;
5 5
 
6
-class RemoveOutcomeIdFromObjectivesTable extends Migration {
6
+class RemoveOutcomeIdFromObjectivesTable extends Migration
7
+{
7 8
 
8 9
 	/**
9 10
 	 * Run the migrations.
@@ -12,9 +13,8 @@ class RemoveOutcomeIdFromObjectivesTable extends Migration {
12 13
 	 */
13 14
 	public function up()
14 15
 	{
15
-		Schema::table('objectives', function(Blueprint $table)
16
-		{
17
-            $table->dropForeign('objectives_outcome_id_foreign');
16
+		Schema::table('objectives', function (Blueprint $table) {
17
+			$table->dropForeign('objectives_outcome_id_foreign');
18 18
 			$table->dropColumn('outcome_id');
19 19
 		});
20 20
 	}
@@ -27,12 +27,11 @@ class RemoveOutcomeIdFromObjectivesTable extends Migration {
27 27
 	 */
28 28
 	public function down()
29 29
 	{
30
-		Schema::table('objectives', function(Blueprint $table)
31
-		{
32
-            $table
33
-                ->integer('outcome_id')
34
-                ->after('id')
35
-                ->unsigned();
30
+		Schema::table('objectives', function (Blueprint $table) {
31
+			$table
32
+				->integer('outcome_id')
33
+				->after('id')
34
+				->unsigned();
36 35
 			$table
37 36
 				->foreign('outcome_id')
38 37
 				->references('id')
@@ -41,5 +40,4 @@ class RemoveOutcomeIdFromObjectivesTable extends Migration {
41 40
 				->onUpdate('cascade');
42 41
 		});
43 42
 	}
44
-
45 43
 }

app/database/migrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php → app/database/unusedMigrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php Ver arquivo


+ 52
- 0
app/database/unusedMigrations/2020_10_05_124915_create_activity_criterion_table.php Ver arquivo

@@ -0,0 +1,52 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateActivityCriterionTable extends Migration {
7
+
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('activity_criterion', function(Blueprint $table)
16
+		{
17
+			$table->increments('id');
18
+			$table->integer('activity_id')->unsigned();
19
+			$table->integer('criterion_id')->unsigned();
20
+			$table
21
+				->foreign('activity_id')
22
+				->references('id')
23
+				->on('activities')
24
+				->onDelete('cascade')
25
+				->onUpdate('cascade');
26
+			$table
27
+				->foreign('criterion_id')
28
+				->references('id')
29
+				->on('criteria')
30
+				->onDelete('cascade')
31
+				->onUpdate('cascade');
32
+			$table->text('transformative_actions')->nullable();
33
+			$table->integer('expected_student_score')->nullable();
34
+			$table->decimal('expected_percentage_students_achieving', 5, 2)->nullable();
35
+			$table->decimal('percentage_students_who_achieved', 5, 2)->nullable();
36
+			$table->decimal('weight', 3, 2)->default(1.0);
37
+			$table->timestamps();
38
+		});
39
+	
40
+	}
41
+
42
+	/**
43
+	 * Reverse the migrations.
44
+	 *
45
+	 * @return void
46
+	 */
47
+	public function down()
48
+	{
49
+		Schema::drop('activity_criterion');
50
+	}
51
+
52
+}

+ 35
- 0
app/database/unusedMigrations/2020_10_05_130252_add_max_score_num_scales_new_criteria_table.php Ver arquivo

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

+ 35
- 0
app/database/unusedMigrations/2020_10_05_142424_create_scales_table.php Ver arquivo

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

+ 47
- 0
app/database/unusedMigrations/2020_10_05_142912_create_criterion_scale_table.php Ver arquivo

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

+ 34
- 0
app/database/unusedMigrations/2020_10_05_232429_add_assessment_comments_to_activity_criterion.php Ver arquivo

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

+ 36
- 0
app/database/unusedMigrations/2020_10_08_203557_create_new_criteria_table2.php Ver arquivo

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

+ 33
- 0
app/database/unusedMigrations/2020_10_08_215013_drop_objective_id_new_criteria.php Ver arquivo

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

+ 34
- 0
app/database/unusedMigrations/2020_10_09_085334_add_activities_rubric_id.php Ver arquivo

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

+ 35
- 0
app/database/unusedMigrations/2020_10_09_092810_drop_assessment_criteria.php Ver arquivo

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

+ 35
- 0
app/database/unusedMigrations/2020_10_09_094503_add_criterion_to_assessment.php Ver arquivo

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class AddCriterionToAssessment extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{ {
16
+			Schema::table('assessments', function ($table) {
17
+
18
+
19
+
20
+				$table->foreign('criterion_id')->references('id')->on('new_criteria')->onDelete('cascade')->onUpdate('cascade');
21
+			});
22
+		}
23
+	}
24
+	/**
25
+	 * Reverse the migrations.
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function down()
30
+	{
31
+		Schema::table('assessments', function ($table) {
32
+			$table->dropForeign('criterion_id');
33
+		});
34
+	}
35
+}

+ 29
- 0
app/database/unusedMigrations/2020_10_09_095246_drop_foreign_assesment_criterion.php Ver arquivo

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

+ 36
- 0
app/database/unusedMigrations/2020_10_09_131800_add_level_activation_date_to_outcomes.php Ver arquivo

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

+ 28
- 53
app/filters.php Ver arquivo

@@ -11,19 +11,16 @@
11 11
 |
12 12
 */
13 13
 
14
-App::before(function($request)
15
-{
16
-	Log::debug('START '.Request::getClientIp().': '.Request::method().' '.Request::path());
17
-
18
-	if( ! Request::secure())
19
-    {
20
-        return Redirect::secure(Request::path());
21
-    }
14
+App::before(function ($request) {
15
+	Log::debug('START ' . Request::getClientIp() . ': ' . Request::method() . ' ' . Request::path());
16
+
17
+	//if (!Request::secure()) {
18
+	//	return Redirect::secure(Request::path());
19
+	//}
22 20
 });
23 21
 
24 22
 
25
-App::after(function($request, $response)
26
-{
23
+App::after(function ($request, $response) {
27 24
 	//
28 25
 });
29 26
 
@@ -38,37 +35,28 @@ App::after(function($request, $response)
38 35
 |
39 36
 */
40 37
 
41
-Route::filter('auth', function()
42
-{
43
-	if (Auth::guest())
44
-	{
45
-		if (Request::ajax())
46
-		{
38
+Route::filter('auth', function () {
39
+	if (Auth::guest()) {
40
+		if (Request::ajax()) {
47 41
 			return Response::make('Unauthorized', 401);
48
-		}
49
-		else
50
-		{
42
+		} else {
51 43
 			return Redirect::guest('/');
52 44
 		}
53 45
 	}
54 46
 });
55 47
 
56 48
 
57
-Route::filter('auth.basic', function()
58
-{
49
+Route::filter('auth.basic', function () {
59 50
 	return Auth::basic();
60 51
 });
61 52
 
62
-Route::filter('has_access', function()
63
-{
64
-	if(!Auth::user()->has_access)
65
-	{
53
+Route::filter('has_access', function () {
54
+	if (!Auth::user()->has_access) {
66 55
 		Session::flash('status', 'info');
67 56
 		Session::flash('message', 'At this time, access to OLAS is limited to some users. Check back later or contact an administrator.');
68 57
 		Auth::logout();
69 58
 		return Redirect::action('AuthController@showLogin');
70 59
 	}
71
-
72 60
 });
73 61
 /*
74 62
 |--------------------------------------------------------------------------
@@ -81,10 +69,8 @@ Route::filter('has_access', function()
81 69
 |
82 70
 */
83 71
 
84
-Route::filter('guest', function()
85
-{
86
-	if (Auth::check())
87
-	{
72
+Route::filter('guest', function () {
73
+	if (Auth::check()) {
88 74
 		switch (Auth::user()->role) {
89 75
 			case 1:
90 76
 				return Redirect::to('administrator');
@@ -115,10 +101,8 @@ Route::filter('guest', function()
115 101
 |
116 102
 */
117 103
 
118
-Route::filter('admin', function()
119
-{
120
-	if (Auth::user()->role !=1)
121
-	{
104
+Route::filter('admin', function () {
105
+	if (Auth::user()->role != 1) {
122 106
 		switch (Auth::user()->role) {
123 107
 			case 2:
124 108
 				return Redirect::to('school-coordinator');
@@ -145,13 +129,10 @@ Route::filter('admin', function()
145 129
 |
146 130
 */
147 131
 
148
-Route::filter('scoord', function()
149
-{
132
+Route::filter('scoord', function () {
150 133
 
151
-	if (!(Auth::user()->role ==2 || Auth::user()->role ==1))
152
-	{
153
-		switch (Auth::user()->role)
154
-		{
134
+	if (!(Auth::user()->role == 2 || Auth::user()->role == 1)) {
135
+		switch (Auth::user()->role) {
155 136
 
156 137
 			case 3:
157 138
 				return Redirect::to('program-coordinator');
@@ -174,10 +155,8 @@ Route::filter('scoord', function()
174 155
 |
175 156
 */
176 157
 
177
-Route::filter('pcoord', function()
178
-{
179
-	if (!(Auth::user()->role ==3 || Auth::user()->role ==2 || Auth::user()->role ==1))
180
-	{
158
+Route::filter('pcoord', function () {
159
+	if (!(Auth::user()->role == 3 || Auth::user()->role == 2 || Auth::user()->role == 1)) {
181 160
 		return Redirect::to('professor');
182 161
 	}
183 162
 });
@@ -192,12 +171,10 @@ Route::filter('pcoord', function()
192 171
 |
193 172
 */
194 173
 
195
-Route::filter('prof', function()
196
-{
174
+Route::filter('prof', function () {
197 175
 	// If user has no courses then s/he is not a professor
198 176
 	// and must be redirected to her/his overview page
199
-	if (!count(Auth::user()->courses))
200
-	{
177
+	if (!count(Auth::user()->courses)) {
201 178
 		switch (Auth::user()->role) {
202 179
 			case 1:
203 180
 				return Redirect::to('administrator');
@@ -225,11 +202,9 @@ Route::filter('prof', function()
225 202
 |
226 203
 */
227 204
 
228
-Route::filter('csrf', function()
229
-{
205
+Route::filter('csrf', function () {
230 206
 	$token = Request::ajax() ? Request::header('X-CSRF-Token') : Input::get('_token');
231
-	if (Session::token() !== $token)
232
-	{
233
-	  throw new Illuminate\Session\TokenMismatchException;
207
+	if (Session::token() !== $token) {
208
+		throw new Illuminate\Session\TokenMismatchException;
234 209
 	}
235 210
 });

+ 29
- 26
app/models/Objective.php Ver arquivo

@@ -1,43 +1,46 @@
1 1
 <?php
2 2
 
3
+use Illuminate\Database\Eloquent\SoftDeletingTrait;
4
+
3 5
 class Objective extends Eloquent
4 6
 {
7
+    use SoftDeletingTrait;
8
+    protected $fillable = array('text', 'outcome_id', 'program_id', 'active');
9
+    protected $table = 'objectives';
5 10
 
6
-  protected $fillable = array('text', 'outcome_id', 'program_id', 'active');
11
+    /**
12
+     * Return the program that the objective belongs to
13
+     *
14
+     * @return Illuminate\Database\Eloquent\Model
15
+     */
16
+    public function program()
17
+    {
18
+        return $this->belongsTo('Program');
19
+    }
7 20
 
8
-  /**
9
-   * Return the program that the objective belongs to
10
-   *
11
-   * @return Illuminate\Database\Eloquent\Model
12
-   */
13
-  public function program()
14
-  {
15
-  	return $this->belongsTo('Program');
16
-  }
21
+    /**
22
+     * Return the outcomes that the objective belongs to
23
+     *
24
+     * @return Illuminate\Database\Eloquent\Model
25
+     */
17 26
 
18
-  /**
19
-   * Return the outcomes that the objective belongs to
20
-   *
21
-   * @return Illuminate\Database\Eloquent\Model
22
-   */
23
-  public function outcomes()
24
-  {
25
-  	return $this->belongsToMany('Outcome', 'objective_outcome', 'objective_id', 'outcome_id');
26
-  }
27
+    public function outcomes()
28
+    {
29
+        return $this->belongsToMany('Outcome', 'objective_outcome', 'objective_id', 'outcome_id');
30
+    }
27 31
 
28
-  public function outcome()
29
-  {
30
-      return $this->belongsTo('Outcome');
31
-  }
32
+    public function outcome()
33
+    {
34
+        return $this->belongsTo('Outcome');
35
+    }
32 36
 
33 37
     /**
34 38
      * Return the program that the objective belongs to
35 39
      *
36 40
      * @return Illuminate\Database\Eloquent\Model
37 41
      */
38
-    public function criteria()
42
+    public function outcome_id()
39 43
     {
40
-        return $this->hasMany('Criterion');
44
+        return $this->hasMany('Objective_Outcome', 'objective_id');
41 45
     }
42
-
43 46
 }

+ 38
- 0
app/models/Objective_Outcome.php Ver arquivo

@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+use Illuminate\Database\Eloquent\SoftDeletingTrait;
4
+
5
+class Objective_Outcome extends Eloquent
6
+{
7
+    use SoftDeletingTrait;
8
+    protected $fillable = array('outcome_id', 'objective_id');
9
+    protected $table = 'objective_outcome';
10
+
11
+    /**
12
+     * Return the program that the objective belongs to
13
+     *
14
+     * @return Illuminate\Database\Eloquent\Model
15
+     */
16
+    public function outcome()
17
+    {
18
+        return $this->belongsTo('Outcome');
19
+    }
20
+
21
+    /**
22
+     * Return the outcomes that the objective belongs to
23
+     *
24
+     * @return Illuminate\Database\Eloquent\Model
25
+     */
26
+
27
+
28
+
29
+    /**
30
+     * Return the program that the objective belongs to
31
+     *
32
+     * @return Illuminate\Database\Eloquent\Model
33
+     */
34
+    public function objective()
35
+    {
36
+        return $this->belongsTo('Objective');
37
+    }
38
+}

+ 0
- 7
app/models/Outcome.php Ver arquivo

@@ -24,11 +24,4 @@ class Outcome extends Eloquent
24 24
 	    return $this->hasMany('Objective');
25 25
 //		return $this->belongsToMany('Objective', 'objective_outcome');
26 26
 	}
27
-
28
-	public static function active()
29
-    {
30
-        //TODO: Check when semester doesnt exist or session is empty
31
-        $selected_semester = Semester::find(Session::get('semesters_ids')[0]);
32
-        return Outcome::withTrashed()->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null)->orderBy('name', 'ASC')->get();
33
-    }
34 27
 }

+ 13
- 12
app/models/User.php Ver arquivo

@@ -7,7 +7,8 @@ use Illuminate\Auth\Reminders\RemindableInterface;
7 7
 
8 8
 use Zizaco\Entrust\HasRole;
9 9
 
10
-class User extends Eloquent implements UserInterface, RemindableInterface {
10
+class User extends Eloquent implements UserInterface, RemindableInterface
11
+{
11 12
 
12 13
 	use UserTrait, RemindableTrait, HasRole;
13 14
 
@@ -31,17 +32,17 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
31 32
 	protected $fillable = array('ssn', 'first_name', 'surnames', 'email', 'role', 'school_id', 'has_access', 'cell_phone', 'office_phone', 'office_extension');
32 33
 
33 34
 	/**
34
-     * Searchable rules.
35
-     *
36
-     * @var array
37
-     */
38
-    protected $searchable = [
39
-        'columns' => [
40
-            'first_name' => 10,
41
-            'surnames' => 10,
42
-            'email' => 2,
43
-        ],
44
-    ];
35
+	 * Searchable rules.
36
+	 *
37
+	 * @var array
38
+	 */
39
+	protected $searchable = [
40
+		'columns' => [
41
+			'first_name' => 10,
42
+			'surnames' => 10,
43
+			'email' => 2,
44
+		],
45
+	];
45 46
 
46 47
 
47 48
 	public function program()

+ 106
- 115
app/routes.php Ver arquivo

@@ -33,8 +33,7 @@ View::composer(array(
33 33
     'local.managers.admins._navigation',
34 34
     'local.managers.sCoords._navigation',
35 35
     'local.managers.pCoords._navigation',
36
-    ), function($view)
37
-{
36
+), function ($view) {
38 37
     // Get user's courses' numbers
39 38
     $courses = Auth::user()->courses;
40 39
 
@@ -54,10 +53,10 @@ View::composer(array(
54 53
     'local.managers.shared.program',
55 54
     'local.managers.shared.rubrics',
56 55
     'global.view-learning-outcomes-criteria',
57
-    'global.view-learning-outcomes-criteria'), function($view)
58
-    {
59
-        $view->with('role', Auth::user()->role);
60
-    });
56
+    'global.view-learning-outcomes-criteria'
57
+), function ($view) {
58
+    $view->with('role', Auth::user()->role);
59
+});
61 60
 
62 61
 
63 62
 /*
@@ -66,33 +65,29 @@ View::composer(array(
66 65
 
67 66
 /** Use modified guest filter to redirect logged in user */
68 67
 Route::get('/', array('before' => 'guest', 'uses' => 'AuthController@showLogin'));
69
-Route::post('/login', array('uses'=>'AuthController@login'));
68
+Route::post('/login', array('uses' => 'AuthController@login'));
70 69
 
71 70
 /**
72 71
  * Protected Routes
73 72
  */
74
-Route::group(array('before' => 'auth|has_access'), function()
75
-{
73
+Route::group(array('before' => 'auth|has_access'), function () {
76 74
 
77 75
     /**
78 76
      * Recalculate course outcomes
79 77
      *
80
-    */
78
+     */
81 79
 
82
-    Route::get('recalculateCourses', function()
83
-    {
80
+    Route::get('recalculateCourses', function () {
84 81
 
85 82
         DB::disableQueryLog();
86 83
 
87
-        if(Auth::user()->id!=58)
84
+        if (Auth::user()->id != 58)
88 85
             Redirect::action('AuthController@showLogin');
89 86
 
90
-        try
91
-        {
87
+        try {
92 88
             $courses = Course::all();
93 89
 
94
-            foreach ($courses as $course)
95
-            {
90
+            foreach ($courses as $course) {
96 91
                 echo $course->id;
97 92
                 // Recalculate course outcomes
98 93
                 $activities = Activity::where('course_id', $course->id)
@@ -102,8 +97,7 @@ Route::group(array('before' => 'auth|has_access'), function()
102 97
 
103 98
 
104 99
                 //If there are still evaluated activities in the course, recalculate course outcomes
105
-                if(!$activities->isEmpty())
106
-                {
100
+                if (!$activities->isEmpty()) {
107 101
                     $outcomeCount = Outcome::all()->count();
108 102
 
109 103
                     // Variables to hold recalculated outcomes for the course
@@ -111,104 +105,100 @@ Route::group(array('before' => 'auth|has_access'), function()
111 105
                     $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
112 106
 
113 107
                     // For each activity
114
-                    foreach ($activities as $activity2)
115
-                    {
108
+                    foreach ($activities as $activity2) {
116 109
                         // If activity has been assessed
117
-                        if($activity2->outcomes_attempted!=NULL)
118
-                        {
110
+                        if ($activity2->outcomes_attempted != NULL) {
119 111
                             echo '<ul>';
120 112
                             // Get the achieved criteria
121 113
                             $criteria_achievement = json_decode($activity2->criteria_achieved, true);
122
-                            foreach($criteria_achievement as $criterion_id=>$criterion_achieved)
123
-                            {
114
+                            foreach ($criteria_achievement as $criterion_id => $criterion_achieved) {
124 115
                                 // Find corresponding learning outcome;
125 116
                                 $criterion = Criterion::withTrashed()->where('id', $criterion_id)->first();
126 117
 
127
-                                print '<li>'.$criterion->id.'</li>';
118
+                                print '<li>' . $criterion->id . '</li>';
128 119
 
129 120
 
130 121
                                 $outcome = Outcome::find($criterion->outcome_id);
131 122
 
132 123
                                 // If criterion is achieved (1), add 1 to both arrays
133
-                                if($criterion_achieved === 1)
134
-                                {
135
-                                    $course_outcomes_attempted[$outcome->id]+=1;
136
-                                    $course_outcomes_achieved[$outcome->id]+=1;
124
+                                if ($criterion_achieved === 1) {
125
+                                    $course_outcomes_attempted[$outcome->id] += 1;
126
+                                    $course_outcomes_achieved[$outcome->id] += 1;
137 127
                                 }
138 128
                                 // Else, only add to the attempted outcomes arrays
139
-                                elseif($criterion_achieved === 0)
140
-                                {
141
-                                    $course_outcomes_attempted[$outcome->id]+=1;
129
+                                elseif ($criterion_achieved === 0) {
130
+                                    $course_outcomes_attempted[$outcome->id] += 1;
142 131
                                 }
143 132
                             }
144 133
 
145 134
                             echo '</ul>';
146
-
147 135
                         }
148 136
                     }
149 137
 
150 138
                     // Update course
151 139
                     DB::table('courses')
152
-                    ->where('id', $course->id)
153
-                    ->update(array(
154
-                        'outcomes_attempted'=> json_encode($course_outcomes_attempted),
155
-                        'outcomes_achieved'=> json_encode($course_outcomes_achieved),
156
-                        'updated_at' => date('Y-m-d H:i:s'))
157
-                    );
140
+                        ->where('id', $course->id)
141
+                        ->update(array(
142
+                            'outcomes_attempted' => json_encode($course_outcomes_attempted),
143
+                            'outcomes_achieved' => json_encode($course_outcomes_achieved),
144
+                            'updated_at' => date('Y-m-d H:i:s')
145
+                        ));
158 146
                 }
159 147
                 // Otherwise, set them all to NULL
160
-                else
161
-                {
148
+                else {
162 149
                     DB::table('courses')
163
-                    ->where('id', $course->id)
164
-                    ->update(array(
165
-                        'outcomes_attempted'=> NULL,
166
-                        'outcomes_achieved'=> NULL,
167
-                        'updated_at' => date('Y-m-d H:i:s'))
168
-                    );
150
+                        ->where('id', $course->id)
151
+                        ->update(array(
152
+                            'outcomes_attempted' => NULL,
153
+                            'outcomes_achieved' => NULL,
154
+                            'updated_at' => date('Y-m-d H:i:s')
155
+                        ));
169 156
                 }
170 157
             }
171 158
 
172 159
             return 'success';
173
-        }
174
-        catch(Exception $e)
175
-        {
176
-            return 'failure ('.$e->getLine().'): '.$e->getMessage();
160
+        } catch (Exception $e) {
161
+            return 'failure (' . $e->getLine() . '): ' . $e->getMessage();
177 162
         }
178 163
     });
179 164
 
180 165
     /**
181
-    * Shared Routes
182
-    */
166
+     * Shared Routes
167
+     */
183 168
 
184 169
     // Fetch all criteria associated to an outcome
185
-    Route::post( 'fetchCriteria', array(
170
+    Route::post('fetchCriteria', array(
186 171
         'as' => 'fetchCriteria',
187 172
         'uses' => 'OutcomesController@fetchCriteria'
188
-    ) );
173
+    ));
189 174
 
190 175
     // Fetch a criterion for a rubric
191
-    Route::post( 'fetchCriterion', array(
176
+    Route::post('fetchCriterion', array(
192 177
         'as' => 'fetchCriterion',
193 178
         'uses' => 'CriteriaController@fetchCriterion'
194
-    ) );
179
+    ));
195 180
 
196 181
     // Fetch a criterion for a rubric
197
-    Route::post( 'fetchCriterionWithTrashed', array(
182
+    Route::post('fetchCriterionWithTrashed', array(
198 183
         'as' => 'fetchCriterionWithTrashed',
199 184
         'uses' => 'CriteriaController@fetchCriterionWithTrashed'
200
-    ) );
185
+    ));
186
+    //Fetch objectives for criteria when outcome is chosen
187
+    Route::post('fetchObjectivesForSelect', array(
188
+        'as' => 'fetchObjectivesForSelect',
189
+        'uses' => 'CriteriaController@fetchObjectivesForSelect'
190
+    ));
201 191
 
202 192
     // Fetch a criterion for a rubric with custom content
203
-    Route::post( 'fetchRubricCriterion', array(
193
+    Route::post('fetchRubricCriterion', array(
204 194
         'as' => 'fetchRubricCriterion',
205 195
         'uses' => 'RubricsController@fetchRubricCriterion'
206
-    ) );
196
+    ));
207 197
 
208 198
     // Load a rubric template
209
-    Route::post('loadTemplate', array('uses'=>'TemplatesController@fetch'));
199
+    Route::post('loadTemplate', array('uses' => 'TemplatesController@fetch'));
210 200
 
211
-    Route::post('filterSemesters', array('uses'=>'SemestersController@filterSemesters'));
201
+    Route::post('filterSemesters', array('uses' => 'SemestersController@filterSemesters'));
212 202
 
213 203
 
214 204
     // Log out user
@@ -216,49 +206,51 @@ Route::group(array('before' => 'auth|has_access'), function()
216 206
 
217 207
     // Edit and update user profile
218 208
     Route::get('profile', 'UsersController@edit');
219
-    Route::post('profile/update', array('before' => 'csrf', 'uses'=>'UsersController@update'));
209
+    Route::post('profile/update', array('before' => 'csrf', 'uses' => 'UsersController@update'));
220 210
 
221 211
     // Allows users to give feeback
222
-    Route::post('feedback/send', array('before' => 'csrf', 'uses'=>'FeedbackController@send'));
223
-    Route::resource('feedback', 'FeedbackController',
224
-                array('only' => array('create')));
212
+    Route::post('feedback/send', array('before' => 'csrf', 'uses' => 'FeedbackController@send'));
213
+    Route::resource(
214
+        'feedback',
215
+        'FeedbackController',
216
+        array('only' => array('create'))
217
+    );
225 218
 
226 219
     // Show users all learning outcomes and criteria
227 220
     Route::get('learning-outcomes-criteria', 'CriteriaController@index');
228
-    Route::post('fetchOutcome', array('before' => 'csrf', 'uses'=>'OutcomesController@fetchOutcome'));
221
+    Route::post('fetchOutcome', array('before' => 'csrf', 'uses' => 'OutcomesController@fetchOutcome'));
229 222
 
230 223
     // Show professor overview to users with courses
231 224
     Route::get('professor', 'ProfessorsController@overview');
232 225
 
233 226
     // Assessment reports for users' courses
234 227
     Route::get('my-assessment-reports', 'OutcomesController@professorAssessmentReports');
235
-    Route::post('objectives/fetch', array('before' => 'csrf', 'uses'=>'ObjectivesController@fetch'));
228
+    Route::post('objectives/fetch', array('before' => 'csrf', 'uses' => 'ObjectivesController@fetch'));
236 229
 
237 230
     /**
238 231
      * Administrator Routes
239 232
      */
240
-    Route::group( array('before' => 'admin'), function()
241
-    {
233
+    Route::group(array('before' => 'admin'), function () {
242 234
         Route::get('/administrator', 'AdministratorsController@overview');
243
-        Route::post( 'administrator/rubrics', array(
235
+        Route::post('administrator/rubrics', array(
244 236
             'as' => 'rubrics',
245 237
             'before' => 'csrf',
246 238
             'uses' => 'CriteriaController@fetch'
247
-        ) );
248
-        Route::post('createOutcome', array('before' => 'csrf', 'uses'=>'OutcomesController@create'));
249
-        Route::post('createCriterion', array('before' => 'csrf', 'uses'=>'CriteriaController@create'));
239
+        ));
240
+        Route::post('createOutcome', array('before' => 'csrf', 'uses' => 'OutcomesController@create'));
241
+        Route::post('createCriterion', array('before' => 'csrf', 'uses' => 'CriteriaController@create'));
250 242
 
251 243
         Route::get('learning-outcomes', 'OutcomesController@index');
252 244
         // TODO: Change later
253 245
         Route::get('new-learning-outcomes', 'OutcomesController@newIndex');
254 246
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@update'));
255
-        Route::post('crtiteria/update', array('before' => 'csrf', 'uses'=>'CriteriaController@update'));
256
-        Route::delete('crtiteria/delete', array('before' => 'csrf', 'uses'=>'CriteriaController@destroy'));
247
+        Route::post('crtiteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
248
+        Route::delete('crtiteria/delete', array('before' => 'csrf', 'uses' => 'CriteriaController@destroy'));
257 249
 
258 250
         Route::get('administrator/users/{query?}', 'UsersController@index');
259 251
 
260
-        Route::post('administrator/updateAccess', array('before' => 'csrf', 'uses'=>'UsersController@updateAccess'));
261
-        Route::post('administrator/users/store', array('before' => 'csrf', 'uses'=>'UsersController@store'));
252
+        Route::post('administrator/updateAccess', array('before' => 'csrf', 'uses' => 'UsersController@updateAccess'));
253
+        Route::post('administrator/users/store', array('before' => 'csrf', 'uses' => 'UsersController@store'));
262 254
 
263 255
 
264 256
         Route::get('administrator/semesters', 'SemestersController@edit');
@@ -273,17 +265,15 @@ Route::group(array('before' => 'auth|has_access'), function()
273 265
         Route::get('template/{template}', 'TemplatesController@show');
274 266
 
275 267
         Route::get('courses/reassign', 'CoursesController@reassign');
276
-        Route::post('courses/update', array('before' => 'csrf', 'uses'=>'CoursesController@update'));
268
+        Route::post('courses/update', array('before' => 'csrf', 'uses' => 'CoursesController@update'));
277 269
 
278 270
         Route::get('activities/create', 'ActivitiesController@newCreate');
279
-
280 271
     });
281 272
 
282 273
     /**
283 274
      * School Coordinator Routes
284 275
      */
285
-    Route::group( array('before' => 'scoord'), function()
286
-    {
276
+    Route::group(array('before' => 'scoord'), function () {
287 277
         Route::get('school-coordinator', 'SchoolCoordinatorsController@overview');
288 278
         Route::get('school/{id}', 'SchoolsController@show');
289 279
         Route::get('program/{id}', 'ProgramsController@show');
@@ -300,20 +290,19 @@ Route::group(array('before' => 'auth|has_access'), function()
300 290
     /**
301 291
      * Program Coordinator Routes
302 292
      */
303
-    Route::group( array('before' => 'pcoord'), function()
304
-    {
293
+    Route::group(array('before' => 'pcoord'), function () {
305 294
         Route::get('program-coordinator', 'ProgramCoordinatorsController@overview');
306 295
 
307 296
         Route::get('rubrics', 'TemplatesController@newTemplate');
308
-        Route::post('saveTemplate', array('before' => 'csrf', 'uses'=>'TemplatesController@create'));
309
-        Route::post('updateTemplate', array('before' => 'csrf', 'uses'=>'TemplatesController@update'));
310
-        Route::post('deleteTemplate', array('before' => 'csrf', 'uses'=>'TemplatesController@destroy'));
297
+        Route::post('saveTemplate', array('before' => 'csrf', 'uses' => 'TemplatesController@create'));
298
+        Route::post('updateTemplate', array('before' => 'csrf', 'uses' => 'TemplatesController@update'));
299
+        Route::post('deleteTemplate', array('before' => 'csrf', 'uses' => 'TemplatesController@destroy'));
311 300
         Route::get('criteria', 'CriteriaController@edit');
312 301
         Route::get('course/{id}', 'CoursesController@showLimited');
313 302
         Route::get('rubrics/{template_id}/download', 'TemplatesController@download');
314
-        Route::post('program/fetch', array('before' => 'csrf', 'uses'=>'ProgramsController@fetch'));
303
+        Route::post('program/fetch', array('before' => 'csrf', 'uses' => 'ProgramsController@fetch'));
315 304
 
316
-        Route::get('printRubric/{id}', 'TemplatesController@printview' );
305
+        Route::get('printRubric/{id}', 'TemplatesController@printview');
317 306
         Route::get('rubric/{rubric_id}', 'RubricsController@show_limited');
318 307
         Route::get('grouped_course/{code}/{number}/{semester_code}', 'CoursesController@showGrouped');
319 308
 
@@ -329,19 +318,25 @@ Route::group(array('before' => 'auth|has_access'), function()
329 318
 
330 319
         // Learning Objectives
331 320
         Route::get('program/{program}/objectives', 'ObjectivesController@index');
332
-        Route::post('updateObjective', array('before' => 'csrf', 'uses'=>'ObjectivesController@update'));
333
-        Route::post('program/{id}/createObjective', array('before' => 'csrf', 'uses'=>'ObjectivesController@create'));
334
-        Route::post('fetchObjective', array('before' => 'csrf', 'uses'=>'ObjectivesController@fetchObjective'));
335
-        Route::post('fetchObjectivesForCriteria', array('before' => 'csrf', 'uses'=>'ObjectivesController@fetchObjectivesForCriteria'));
336
-
337
-        // Five year plans
321
+        Route::post('updateObjective', array('before' => 'csrf', 'uses' => 'ObjectivesController@update'));
322
+        Route::post('program/{id}/createObjective', array('before' => 'csrf', 'uses' => 'ObjectivesController@create'));
323
+        Route::post('fetchObjective', array('before' => 'csrf', 'uses' => 'ObjectivesController@fetchObjective'));
324
+        Route::post('fetchObjectivesForCriteria', array('before' => 'csrf', 'uses' => 'ObjectivesController@fetchObjectivesForCriteria'));
325
+
326
+        //Objectives por Gabriel
327
+        Route::get('objective', 'Objective2Controller@edit');
328
+        Route::post('createObjective', array('before' => 'csrf', 'uses' => 'Objective2Controller@create'));
329
+        Route::post('updateObjective', array('before' => 'csrf', 'uses' => 'Objective2Controller@update'));
330
+        Route::post('fetchObjectiveWithTrashed', array('before' => 'csrf', 'uses' => 'Objective2Controller@fetchObjectiveWithTrashed'));
331
+
332
+        // Five year plans, 
338 333
         Route::get('five-year-plans', 'FiveYearPlansController@index');
339 334
         Route::get('program/{program}/five-year-plans/create', 'FiveYearPlansController@create');
340 335
         Route::get('program/{program}/five-year-plans/{five_year_plan}', 'FiveYearPlansController@show');
341 336
         Route::get('program/{program}/five-year-plans/{five_year_plan}/edit', 'FiveYearPlansController@edit');
342 337
         Route::get('five-year-plans/{five_year_plan}/ms-word', 'FiveYearPlansController@msWord');
343
-        Route::post('five-year-plans/store', array('before' => 'csrf', 'uses'=>'FiveYearPlansController@store'));
344
-        Route::post('five-year-plans/update', array('before' => 'csrf', 'uses'=>'FiveYearPlansController@update'));
338
+        Route::post('five-year-plans/store', array('before' => 'csrf', 'uses' => 'FiveYearPlansController@store'));
339
+        Route::post('five-year-plans/update', array('before' => 'csrf', 'uses' => 'FiveYearPlansController@update'));
345 340
 
346 341
 
347 342
         // Annual plans
@@ -349,8 +344,8 @@ Route::group(array('before' => 'auth|has_access'), function()
349 344
         Route::get('program/{program}/annual-plans/create', 'AnnualPlansController@create');
350 345
         Route::get('program/{program}/annual-plans/{five_year_plan}', 'AnnualPlansController@show');
351 346
         Route::get('program/{program}/annual-plans/{five_year_plan}/edit', 'AnnualPlansController@edit');
352
-        Route::post('annual-plans/store', array('before' => 'csrf', 'uses'=>'AnnualPlansController@store'));
353
-        Route::post('annual-plans/update', array('before' => 'csrf', 'uses'=>'AnnualPlansController@update'));
347
+        Route::post('annual-plans/store', array('before' => 'csrf', 'uses' => 'AnnualPlansController@store'));
348
+        Route::post('annual-plans/update', array('before' => 'csrf', 'uses' => 'AnnualPlansController@update'));
354 349
 
355 350
         Route::get('learning-outcomes/show/{id}', 'OutcomesController@show');
356 351
         // TODO: Change route name
@@ -364,9 +359,8 @@ Route::group(array('before' => 'auth|has_access'), function()
364 359
     /**
365 360
      * Professor Routes
366 361
      */
367
-    Route::group(array('prefix' => 'professor', 'before'=>'prof'), function()
368
-    {
369
-        Route::post('program', array('before' => 'csrf', 'uses'=>'ProfessorsController@program'));
362
+    Route::group(array('prefix' => 'professor', 'before' => 'prof'), function () {
363
+        Route::post('program', array('before' => 'csrf', 'uses' => 'ProfessorsController@program'));
370 364
         Route::get('activities/{activity_id}/rubrics', 'RubricsController@newRubric');
371 365
         Route::get('activities/{activity_id}/rubric', 'RubricsController@show');
372 366
         Route::get('activities/{activity_id}/rubric/{rubric_id}/download', 'RubricsController@download');
@@ -374,23 +368,23 @@ Route::group(array('before' => 'auth|has_access'), function()
374 368
         Route::get('activities/{activity_id}/assess', 'ActivitiesController@assess');
375 369
         Route::get('activities/{activity_id}/view_assessment', 'ActivitiesController@viewAssessment');
376 370
         Route::get('activities/{activity_id}/print_assessment', 'ActivitiesController@printAssessment');
377
-        Route::post('activities/saveAssessment', array('before'=>'csrf', 'uses'=>'ActivitiesController@saveAssessment'));
378
-        Route::post('activities/deleteAssessment', array('before'=>'csrf', 'uses'=>'ActivitiesController@deleteAssessment'));
371
+        Route::post('activities/saveAssessment', array('before' => 'csrf', 'uses' => 'ActivitiesController@saveAssessment'));
372
+        Route::post('activities/deleteAssessment', array('before' => 'csrf', 'uses' => 'ActivitiesController@deleteAssessment'));
379 373
         Route::delete('activities/{activity_id}/delete', 'ActivitiesController@destroy');
380
-        Route::post('activities/{activity_id}/update', array('before' => 'csrf', 'uses'=>'ActivitiesController@update'));
374
+        Route::post('activities/{activity_id}/update', array('before' => 'csrf', 'uses' => 'ActivitiesController@update'));
381 375
         Route::get('courses/{id}', 'CoursesController@show');
382 376
         Route::get('courses/{semester}/{id}/students/{number}', 'StudentsController@show');
383 377
         Route::get('courses/{semester}/{id}/students/{number}/print_report', 'StudentsController@printStudentReport');
384 378
         Route::get('activities/{id}', 'ActivitiesController@show');
385
-        Route::post('activities/{id}', array('before' => 'csrf', 'uses'=>'ActivitiesController@create'));
379
+        Route::post('activities/{id}', array('before' => 'csrf', 'uses' => 'ActivitiesController@create'));
386 380
         Route::get('students', 'StudentsController@students');
387 381
         Route::get('program', 'ProfessorsController@program');
388 382
         Route::get('personal-information', 'ProfessorsController@personalInformation');
389 383
         Route::get('manual', 'ProfessorsController@manual');
390
-        Route::post('loadRubric', array('before' => 'csrf', 'uses'=>'RubricsController@fetch'));
391
-        Route::post('saveRubric', array('before' => 'csrf', 'uses'=>'RubricsController@create'));
392
-        Route::post('updateRubric', array('before' => 'csrf', 'uses'=>'RubricsController@update'));
393
-        Route::post('deleteRubric', array('before' => 'csrf', 'uses'=>'RubricsController@destroy'));
384
+        Route::post('loadRubric', array('before' => 'csrf', 'uses' => 'RubricsController@fetch'));
385
+        Route::post('saveRubric', array('before' => 'csrf', 'uses' => 'RubricsController@create'));
386
+        Route::post('updateRubric', array('before' => 'csrf', 'uses' => 'RubricsController@update'));
387
+        Route::post('deleteRubric', array('before' => 'csrf', 'uses' => 'RubricsController@destroy'));
394 388
         Route::get('learning-outcomes-criteria', 'CriteriaController@index');
395 389
         Route::get('export_grades/{id}', 'CoursesController@exportGrades');
396 390
 
@@ -399,8 +393,5 @@ Route::group(array('before' => 'auth|has_access'), function()
399 393
         Route::get('professor-assessment-reports', 'OutcomesController@professorAssessmentReports');
400 394
 
401 395
         Route::get('general-studies-overview', 'ProfessorsController@generalStudiesOverview');
402
-
403
-
404 396
     });
405
-
406 397
 });

+ 20
- 18
app/views/local/managers/admins/_navigation.blade.php Ver arquivo

@@ -8,6 +8,7 @@
8 8
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Management<span class="caret"></span></a>
9 9
         <ul class="dropdown-menu" role="menu">
10 10
           <li>{{ HTML::linkAction('CoursesController@reassign', 'Courses') }}</li>
11
+          <li>{{ HTML::linkAction('Objective2Controller@edit', 'Objectives')}}
11 12
           <li>{{ HTML::linkAction('CriteriaController@edit', 'Criteria') }}</li>
12 13
           <li>{{ HTML::linkAction('OutcomesController@index', 'Learning Outcomes') }}</li>
13 14
           <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubric Builder') }}</li>
@@ -21,7 +22,7 @@
21 22
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Colleges and Schools<span class="caret"></span></a>
22 23
         <ul class="dropdown-menu" role="menu">
23 24
           @foreach ($schools as $school)
24
-            <li>{{ HTML::linkAction('SchoolsController@show', $school->name, array($school->id)) }}</li>
25
+          <li>{{ HTML::linkAction('SchoolsController@show', $school->name, array($school->id)) }}</li>
25 26
           @endforeach
26 27
         </ul>
27 28
       </li>
@@ -31,9 +32,9 @@
31 32
       <li class="dropdown">
32 33
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Sections<span class="caret"></span></a>
33 34
         <ul class="dropdown-menu" role="menu">
34
-        @foreach ($courses as $course)
35
+          @foreach ($courses as $course)
35 36
           <li> {{ HTML::linkAction('CoursesController@show', $course->code.$course->number.'-'.$course->section.' ('.$course->semester->code.')', array('id'=>$course->id)) }}</li>
36
-        @endforeach
37
+          @endforeach
37 38
         </ul>
38 39
       </li>
39 40
       @endif
@@ -41,37 +42,38 @@
41 42
       <li class="dropdown">
42 43
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Reports<span class="caret"></span></a>
43 44
         <ul class="dropdown-menu" role="menu">
44
-            <li>{{ HTML::linkAction('OutcomesController@managerAssessmentReports', 'Campus Reports') }}</li>
45
-            @if(count(Auth::user()->courses))
46
-              <li>{{ HTML::linkAction('OutcomesController@professorAssessmentReports', 'My Courses\' Reports') }}</li>
47
-            @endif
45
+          <li>{{ HTML::linkAction('OutcomesController@managerAssessmentReports', 'Campus Reports') }}</li>
46
+          @if(count(Auth::user()->courses))
47
+          <li>{{ HTML::linkAction('OutcomesController@professorAssessmentReports', 'My Courses\' Reports') }}</li>
48
+          @endif
48 49
         </ul>
49 50
       </li>
50 51
 
51 52
       <li class="dropdown">
52 53
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span class="caret"></span></a>
53 54
         <ul class="dropdown-menu" role="menu">
54
-            <li>{{ HTML::linkAction('FeedbackController@create', 'Feedback') }}</li>
55
-            <!-- <li><a href="{{ asset('files/OLAS-intro.pdf') }}">Introduction to OLAS</a></li> -->
56
-            <li><a href="{{ asset('files/intro-avaluo.pdf') }}">Introduction to Assessment</a></li>
57
-            <!-- <li><a href="{{ asset('files/OLAS-coords.pdf') }}">OLAS for Coordinators</a></li> -->
58
-            <li><a href="http://oeae.uprrp.edu/wp-content/uploads/2019/01/Brochure-de-OLAS-rev.-agosto-2018.pdf">Brochure</a></li>
55
+          <li>{{ HTML::linkAction('FeedbackController@create', 'Feedback') }}</li>
56
+          <!-- <li><a href="{{ asset('files/OLAS-intro.pdf') }}">Introduction to OLAS</a></li> -->
57
+          <li><a href="{{ asset('files/intro-avaluo.pdf') }}">Introduction to Assessment</a></li>
58
+          <!-- <li><a href="{{ asset('files/OLAS-coords.pdf') }}">OLAS for Coordinators</a></li> -->
59
+          <li><a href="http://oeae.uprrp.edu/wp-content/uploads/2019/01/Brochure-de-OLAS-rev.-agosto-2018.pdf">Brochure</a></li>
59 60
         </ul>
60 61
       </li>
61 62
       <li class="dropdown">
62 63
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span class="caret"></span></a>
63 64
         <ul class="dropdown-menu" role="menu">
64
-            <li>{{ HTML::linkAction('UsersController@edit', 'Profile') }}</li>
65
-            <li>{{ HTML::linkAction('AuthController@logout', 'Log out ('.Auth::user()->email.')') }}</li>
65
+          <li>{{ HTML::linkAction('UsersController@edit', 'Profile') }}</li>
66
+          <li>{{ HTML::linkAction('AuthController@logout', 'Log out ('.Auth::user()->email.')') }}</li>
66 67
         </ul>
67 68
       </li>
68 69
       <li class="dropdown">
69 70
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">NEW<span class="caret"></span></a>
70 71
         <ul class="dropdown-menu" role="menu">
71 72
           <li>{{ HTML::linkAction('OutcomesController@newIndex', 'New Index') }}</li>
72
-{{--          <li>{{ HTML::linkAction('AuthController@logout', 'Log out ('.Auth::user()->email.')') }}</li>--}}
73
-        </ul>
74
-      </li>
73
+          {{-- <li>{{ HTML::linkAction('AuthController@logout', 'Log out ('.Auth::user()->email.')') }}
74
+      </li>--}}
75
+    </ul>
76
+    </li>
75 77
     </ul>
76 78
   </div>
77
-</div>
79
+</div>

+ 715
- 278
app/views/local/managers/admins/criteria.blade.php
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 420
- 0
app/views/local/managers/admins/objectives.blade.php Ver arquivo

@@ -0,0 +1,420 @@
1
+@extends('layouts.master')
2
+
3
+@section('navigation')
4
+@include('local.managers.admins._navigation')
5
+@stop
6
+@section('main')
7
+
8
+<div class="row">
9
+    <div class="col-md-6">
10
+        <!-- Form to add a new objective -->
11
+        <div class="panel panel-default panel-button">
12
+            <div class="panel-heading">
13
+                Create
14
+            </div>
15
+            <div class="panel-body">
16
+                {{ Form::open(array('action' => 'Objective2Controller@create' )) }}
17
+                <div id='outcomeGroup'>
18
+                    <label> Associated Outcome</label>
19
+                    <div class="form-group col-md-11" id='outcomeForm'>
20
+
21
+
22
+                        {{ Form::select('outcome[0]', $outcomes, null, ['class'=>'form-control selectpicker', 'id' =>'outcome[0]']) }}
23
+
24
+                    </div>
25
+
26
+                </div>
27
+                <input type='hidden' name='counter' id='counter' value=1>
28
+                <button id='button-add-outcome' class='btn btn-md btn-secondary' onclick='addOutcomeTest()'>
29
+                    <span class='glyphicon glyphicon-plus'>
30
+
31
+                    </span>
32
+                    Add another Outcome
33
+                </button>
34
+
35
+                <!-- Associated Program -->
36
+
37
+
38
+                <div class="form-group">
39
+                    {{ Form::label('program_id', 'Associated Program') }}
40
+                    <select id="program_id" name="program_id" class="form-control selectpicker">
41
+                        <option value="0">All</option>
42
+                        @foreach ($programs as $program)
43
+                        <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
44
+                        @endforeach
45
+                    </select>
46
+                </div>
47
+
48
+
49
+                <div class="form-group">
50
+                    {{ Form::label('text', 'Text') }}
51
+                    {{ Form::text('text', '', array('class' => 'form-control')) }}
52
+                </div>
53
+
54
+
55
+
56
+                {{ Form::submit('Create', array('class' => 'btn btn-primary btn-block')) }}
57
+                {{ Form::close() }}
58
+            </div>
59
+        </div>
60
+    </div>
61
+
62
+    <div class="col-md-6">
63
+        <div class="panel panel-default panel-button">
64
+            <div class="panel-heading">
65
+                Edit
66
+            </div>
67
+            <div class="panel-body">
68
+                {{ Form::open(array('action' => 'Objective2Controller@update')) }}
69
+
70
+                <div class="form-group">
71
+                    {{ Form::label('objective_id', 'Objectives') }}
72
+                    <select id="select-objective" name="id" class="form-control selectpicker">
73
+                        @foreach ($objectives as $objective)
74
+                        <option value="{{ $objective->id }}" data-subtext="
75
+                                        @if($objective->program)
76
+                                            &nbsp;&nbsp;&nbsp;[{{ $objective->program->name }}]
77
+                                        @endif
78
+                                        ">
79
+                            {{ $objective->text }}
80
+
81
+
82
+
83
+                        </option>
84
+                        @endforeach
85
+                    </select>
86
+                </div>
87
+
88
+                <!-- Associated Outcome -->
89
+
90
+                <div class="form-group">
91
+                    <div id='assocOutcomeGroup'>
92
+                        <label>Associated Outcome</label>
93
+
94
+                        {{ Form::select('assoc_outcome[0]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
95
+
96
+                    </div>
97
+                </div>
98
+                <button id='button-add-assoc-outcome' class='btn btn-md btn-secondary' onclick='addAssoc()'>
99
+                    <span class='glyphicon glyphicon-plus'>
100
+
101
+                    </span>
102
+                    Add another Outcome
103
+                </button>
104
+
105
+
106
+                <!-- Associated Program -->
107
+                <div class="form-group">
108
+                    {{ Form::label('program_id2', 'Associated Program') }}
109
+                    <select id="program_id2" name="program_id" class="form-control selectpicker">
110
+                        <option value="0">All</option>
111
+                        @foreach ($programs as $program)
112
+                        <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
113
+                        @endforeach
114
+                    </select>
115
+                </div>
116
+
117
+                <!-- Status -->
118
+                <div class="form-group">
119
+                    {{ Form::label('status', 'Status') }}
120
+                    <span data-toggle="tooltip" data-placement="top" title="Use this option to deactivate or reactivate objectives. Inactive objective will stay in the system, but will not be available to use in new rubrics." class="glyphicon glyphicon-question-sign"></span>
121
+
122
+                    <select id="status" name="status" class="form-control">
123
+                        <option value="1">Active</option>
124
+                        <option value="0">Inactive</option>
125
+                    </select>
126
+                </div>
127
+
128
+                <div class="form-group">
129
+                    {{ Form::label('text', 'Text') }}
130
+                    {{ Form::text('text', Input::old('text'), array('class' => 'form-control', 'id'=>'objective-text')) }}
131
+                </div>
132
+                {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
133
+                {{ Form::close() }}
134
+            </div>
135
+
136
+
137
+
138
+
139
+        </div>
140
+    </div>
141
+</div>
142
+<script>
143
+    var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
144
+    var selectOptions = document.getElementById('outcome[0]').innerHTML;
145
+    var ran = false;
146
+
147
+    var counter = 1;
148
+    var counterAssoc = 1;
149
+    //Add Another Outcome
150
+
151
+    function changeOutcomeHtml() {
152
+        var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
153
+
154
+        outcomeHTML = outcomeHTML.replace('outcome[' + counter.toString() + ']', 'outcome[' + (counter + 1).toString() + ']');
155
+        counter += 1;
156
+        document.getElementById("outcomeGroup").innerHTML += outcomeHTML;
157
+
158
+
159
+
160
+
161
+        document.getElementById('button-add-outcome').onclick = addOutcome;
162
+    }
163
+
164
+    function addOutcome() {
165
+        outcomeHTML = outcomeHTML.replace('outcome[' + counter.toString() + ']', 'outcome[' + (counter + 1).toString() + ']');
166
+        counter += 1;
167
+
168
+        document.getElementById("outcomeGroup").innerHTML += outcomeHTML;
169
+    }
170
+
171
+    function addOutcomeTest() {
172
+        var $select = $('<select/>', {
173
+            'class': "selectpicker form-control",
174
+            'name': "outcome[" + counter.toString() + "]",
175
+            'data-live-search': 'true'
176
+
177
+        });
178
+        var $div = $('<div/>', {
179
+            'id': 'outcomeForm' + counter.toString(),
180
+            'class': 'form-group col-md-11'
181
+        });
182
+        var $divForButton = $('<div/>', {
183
+            'class': 'col-md-1',
184
+            'id': 'close' + counter.toString()
185
+
186
+        });
187
+        var $button = $('<button/>', {
188
+            'type': 'button',
189
+            'class': 'btn btn-primary',
190
+            'onclick': 'deleteLast()'
191
+        });
192
+        $button.append('X');
193
+        $divForButton.append($button);
194
+
195
+        $div.appendTo('#outcomeGroup')
196
+        $select.append(selectOptions);
197
+
198
+        $select.appendTo('#outcomeForm' + counter.toString()).selectpicker('refresh');
199
+        $divForButton.appendTo('#outcomeGroup');
200
+        counter += 1;
201
+        $('#counter').val(counter);
202
+
203
+    }
204
+
205
+    function deleteLast() {
206
+
207
+        div = document.getElementById('outcomeForm' + (counter - 1).toString());
208
+        div.remove();
209
+        button = document.getElementById('close' + (counter - 1).toString());
210
+        button.remove();
211
+        counter -= 1;
212
+        $('#counter').val(counter);
213
+    }
214
+
215
+    function fetchObjectiveForEditing() {
216
+        var id = $('#select-objective').find(':selected').val();
217
+
218
+        $.post(
219
+            "{{ URL::action('Objective2Controller@fetchObjectiveWithTrashed') }}", {
220
+                id: id
221
+            },
222
+            function(json) {
223
+
224
+                var text = json[0].text;
225
+
226
+
227
+
228
+                // Display info
229
+                $('#objective-text').val(text);
230
+
231
+
232
+                // Select associated outcome
233
+                var outcome_id = json[0].outcome_id;
234
+                $('#assoc_outcome0').val(outcome_id);
235
+                $('#assoc_outcome0').selectpicker('refresh');
236
+
237
+                var length = json.length;
238
+                if (ran == true) {
239
+                    for (var i = counterAssoc; i != 0; i--) {
240
+                        deleteLastAssoc(i);
241
+
242
+                    }
243
+                    counterAssoc = 1
244
+                }
245
+                for (var i = 1; i < length; i++) {
246
+                    var $select = $('<select />', {
247
+                        'class': "selectpicker form-control",
248
+                        'name': "assoc_outcome[" + i.toString() + "]",
249
+                        'data-live-search': 'true',
250
+                        'id': 'assoc_outcome' + i.toString()
251
+
252
+                    });
253
+                    var $div = $('<div />', {
254
+                        'id': 'assocOutcomeForm' + i.toString(),
255
+                        'class': 'form-group col-md-11'
256
+                    });
257
+                    var $divForButton = $('<div />', {
258
+                        'class': 'col-md-1',
259
+                        'id': 'closeAssoc' + i.toString()
260
+
261
+                    });
262
+                    var $button = $('<button />', {
263
+                        'type': 'button',
264
+                        'class': 'btn btn-primary',
265
+                        'onclick': 'deleteLastAssoc()'
266
+                    });
267
+                    $button.append('X');
268
+                    $divForButton.append($button);
269
+
270
+                    $div.appendTo('#assocOutcomeGroup')
271
+                    $select.append(selectOptions);
272
+
273
+                    $select.appendTo('#assocOutcomeForm' + i.toString()).selectpicker('refresh');
274
+                    $divForButton.appendTo('#assocOutcomeGroup');
275
+
276
+                    $('#assoc_outcome' + i.toString()).val(json[i].outcome_id);
277
+                    $('#assoc_outcome' + i.toString()).selectpicker('refresh');
278
+
279
+                    counterAssoc = i;
280
+                    ran = true;
281
+
282
+                }
283
+
284
+                // Select associated program
285
+                if (json[0].program_id) {
286
+                    $('#program_id2').val(json[0].program_id);
287
+
288
+                } else {
289
+                    $('#program_id2').val(0);
290
+                }
291
+
292
+                $('#program_id2').selectpicker('refresh');
293
+
294
+
295
+                // Select status
296
+                if (json[0].deleted_at)
297
+                    $('#status').val(0);
298
+                else
299
+                    $('#status').val(1);
300
+            },
301
+            'json'
302
+        );
303
+    }
304
+
305
+    function deleteLastAssoc() {
306
+
307
+        div = document.getElementById('assocOutcomeForm' + (counterAssoc).toString());
308
+        div.remove();
309
+        button = document.getElementById('closeAssoc' + (counterAssoc).toString());
310
+        button.remove();
311
+        counterAssoc -= 1;
312
+
313
+    }
314
+
315
+    function addAssoc() {
316
+
317
+        counterAssoc += 1;
318
+        var $select = $('<select />', {
319
+            'class': "selectpicker form-control",
320
+            'name': "assoc_outcome[" + counterAssoc.toString() + "]",
321
+            'data-live-search': 'true',
322
+            'id': 'assoc_outcome' + counterAssoc.toString()
323
+
324
+        });
325
+        var $div = $('<div />', {
326
+            'id': 'assocOutcomeForm' + counterAssoc.toString(),
327
+            'class': 'form-group col-md-11'
328
+        });
329
+        var $divForButton = $('<div />', {
330
+            'class': 'col-md-1',
331
+            'id': 'closeAssoc' + counterAssoc.toString()
332
+
333
+        });
334
+        var $button = $('<button />', {
335
+            'type': 'button',
336
+            'class': 'btn btn-primary',
337
+            'onclick': 'deleteLastAssoc()'
338
+        });
339
+        $button.append('X');
340
+        $divForButton.append($button);
341
+
342
+        $div.appendTo('#assocOutcomeGroup')
343
+        $select.append(selectOptions);
344
+
345
+        $select.appendTo('#assocOutcomeForm' + counterAssoc.toString()).selectpicker('refresh');
346
+        $divForButton.appendTo('#assocOutcomeGroup');
347
+
348
+
349
+        ran = true;
350
+
351
+
352
+
353
+    }
354
+</script>
355
+@stop
356
+
357
+@section('javascript')
358
+
359
+// --------------------------------------------------------------------------
360
+// Page load
361
+// --------------------------------------------------------------------------
362
+
363
+// Hide accordion panel contents by default
364
+$('.panel-group .panel-body').hide();
365
+
366
+$('#outcome-display').parent().hide();
367
+
368
+fetchObjectiveForEditing();
369
+// setCriterionStatus();
370
+
371
+
372
+
373
+
374
+// --------------------------------------------------------------------------
375
+// Functions
376
+// --------------------------------------------------------------------------
377
+
378
+// Fetch criterion info for editing
379
+
380
+$('#button-add-outcome').on('click', function(e) {
381
+// Prevent the default action of the clicked item. In this case that is submit
382
+e.preventDefault();
383
+
384
+
385
+return false;
386
+});
387
+$('#button-add-assoc-outcome').on('click', function(e) {
388
+// Prevent the default action of the clicked item. In this case that is submit
389
+e.preventDefault();
390
+
391
+
392
+return false;
393
+});
394
+
395
+// --------------------------------------------------------------------------
396
+// Events
397
+// --------------------------------------------------------------------------
398
+
399
+// When panel heading is clicked, toggle it
400
+$('.panel-group .panel-heading').on('click', function()
401
+{
402
+$(this).next().stop().slideToggle();
403
+})
404
+
405
+
406
+// When list item is clicked, load corresponding info
407
+$('#select-objective').on('change', function()
408
+{
409
+fetchObjectiveForEditing();
410
+$('.selectpicker').selectpicker('refresh');
411
+});
412
+
413
+// When list item is clicked, load corresponding info
414
+$('.selectpicker').on('change', function()
415
+{
416
+//alert($(this).find(':selected').val());
417
+$('.selectpicker').selectpicker('refresh');
418
+});
419
+
420
+@stop

+ 1
- 1
bootstrap/start.php Ver arquivo

@@ -26,7 +26,7 @@ $app = new Illuminate\Foundation\Application;
26 26
 
27 27
 $env = $app->detectEnvironment(array(
28 28
 
29
-	'local' => array(gethostname(), 'ubuntu', 'RPV20111.rrp.campus', 'homestead'),
29
+	'local' => array(gethostname(), 'RPV20111.rrp.campus', 'homestead'),
30 30
     'production' => array('*.com', '*.edu', '*.org'),
31 31
 
32 32
 ));

+ 1
- 0
public/.htaccess Ver arquivo

@@ -12,4 +12,5 @@
12 12
     RewriteCond %{REQUEST_FILENAME} !-d
13 13
     RewriteCond %{REQUEST_FILENAME} !-f
14 14
     RewriteRule ^ index.php [L]
15
+
15 16
 </IfModule>