Browse Source

Gabriel, trabajo hasta 11/17

Añadí un readmePLease.txt que creo que abarca lo más importante.
parent
commit
fc142f4fe2
48 changed files with 3246 additions and 963 deletions
  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 View File

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

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
 	| Application URL
21
 	| Application URL
24
 	| the Artisan command line tool. You should set this to the root of
25
 	| the Artisan command line tool. You should set this to the root of
25
 	| your application so that it is used when running Artisan tasks.
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
 	|
140
 	|
140
 	*/
141
 	*/
141
 
142
 
142
-	'manifest' => storage_path().'/meta',
143
+	'manifest' => storage_path() . '/meta',
143
 
144
 
144
 	/*
145
 	/*
145
 	|--------------------------------------------------------------------------
146
 	|--------------------------------------------------------------------------
193
 		'Validator'         => 'Illuminate\Support\Facades\Validator',
194
 		'Validator'         => 'Illuminate\Support\Facades\Validator',
194
 		'View'              => 'Illuminate\Support\Facades\View',
195
 		'View'              => 'Illuminate\Support\Facades\View',
195
 		'PDF'				=> 'Barryvdh\DomPDF\Facade',
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 View File

47
 	'connections' => array(
47
 	'connections' => array(
48
 
48
 
49
 		'mysql' => array(
49
 		'mysql' => array(
50
+
50
 			'driver'    => 'mysql',
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
 			'charset'   => 'utf8',
56
 			'charset'   => 'utf8',
56
 			'collation' => 'utf8_unicode_ci',
57
 			'collation' => 'utf8_unicode_ci',
57
 			'prefix'    => '',
58
 			'prefix'    => '',
58
-            'engine'    => 'InnoDB',
59
+			'engine'    => 'InnoDB',
59
 		),
60
 		),
60
 	),
61
 	),
61
 
62
 

+ 171
- 261
app/controllers/ActivitiesController.php View File

2
 
2
 
3
 use Illuminate\Database\Eloquent\Collection;
3
 use Illuminate\Database\Eloquent\Collection;
4
 
4
 
5
-class ActivitiesController extends \BaseController {
5
+class ActivitiesController extends \BaseController
6
+{
6
 
7
 
7
     /**
8
     /**
8
      * Save a new activity
9
      * Save a new activity
13
     public function create($id)
14
     public function create($id)
14
     {
15
     {
15
         /** Validation rules */
16
         /** Validation rules */
17
+
16
         $validator = Validator::make(
18
         $validator = Validator::make(
17
             array(
19
             array(
18
                 'name' => Input::get('name'),
20
                 'name' => Input::get('name'),
19
                 'description' => Input::get('description')
21
                 'description' => Input::get('description')
20
             ),
22
             ),
21
             array(
23
             array(
22
-                'name' => 'required|unique:activities,course_id,'.$id,
24
+                'name' => 'required|unique:activities,course_id,' . $id,
23
                 'description' => 'required|min:10'
25
                 'description' => 'required|min:10'
24
             )
26
             )
25
         );
27
         );
26
 
28
 
29
+
27
         /** If validation fails */
30
         /** If validation fails */
28
-        if ($validator->fails())
29
-        {
31
+        if ($validator->fails()) {
30
             /** Prepare error message */
32
             /** Prepare error message */
31
             $message = 'Error(s) creating a new Activity<ul>';
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
             /** Send error message and old data */
41
             /** Send error message and old data */
41
             Session::flash('status', 'danger');
42
             Session::flash('status', 'danger');
42
             Session::flash('message', $message);
43
             Session::flash('message', $message);
43
             return Redirect::back()->withInput();
44
             return Redirect::back()->withInput();
44
-        }
45
-        else
46
-        {
45
+        } else {
47
             /** Instantiate new activity */
46
             /** Instantiate new activity */
48
             $activity = new Activity;
47
             $activity = new Activity;
49
-            $activity->name= Input::get('name');
48
+            $activity->name = Input::get('name');
50
             $activity->description = Input::get('description');
49
             $activity->description = Input::get('description');
51
             $activity->course_id = $id;
50
             $activity->course_id = $id;
52
             $activity->date = date('Y-m-d');
51
             $activity->date = date('Y-m-d');
53
 
52
 
54
             /** If activity is saved, send success message */
53
             /** If activity is saved, send success message */
55
-            if($activity->save())
56
-            {
54
+            if ($activity->save()) {
57
                 Session::flash('status', 'success');
55
                 Session::flash('status', 'success');
58
                 Session::flash('message', 'Activity created.');
56
                 Session::flash('message', 'Activity created.');
59
                 return Redirect::action('ActivitiesController@show', array($activity->id));
57
                 return Redirect::action('ActivitiesController@show', array($activity->id));
60
             }
58
             }
61
 
59
 
62
             /** If saving fails, send error message and old data */
60
             /** If saving fails, send error message and old data */
63
-            else
64
-            {
61
+            else {
65
                 Session::flash('status', 'warning');
62
                 Session::flash('status', 'warning');
66
                 Session::flash('message', 'Error adding Activity. Please try again later.');
63
                 Session::flash('message', 'Error adding Activity. Please try again later.');
67
                 return Redirect::back()->withInput();
64
                 return Redirect::back()->withInput();
76
         $instruments = Rubric::all();
73
         $instruments = Rubric::all();
77
         $courses = Course::where('user_id', Auth::user()->id)->get();
74
         $courses = Course::where('user_id', Auth::user()->id)->get();
78
         $outcomes = Outcome::with('objectives')->get();
75
         $outcomes = Outcome::with('objectives')->get();
79
-//        var_dump($outcomes[0]->objectives);
76
+        //        var_dump($outcomes[0]->objectives);
80
         $objectives_by_outcome = Collection::make([]);
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
             $objectives_by_outcome->put($outcome->id, $outcome->objectives);
80
             $objectives_by_outcome->put($outcome->id, $outcome->objectives);
84
-//            var_dump($objectives);
81
+            //            var_dump($objectives);
85
         });
82
         });
86
         $criteria_by_objective = Collection::make([]);
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
                 $criteria_by_objective->put($objective->id, $objective->criteria);
86
                 $criteria_by_objective->put($objective->id, $objective->criteria);
90
             });
87
             });
91
         });
88
         });
92
         $transforming_actions = [];
89
         $transforming_actions = [];
93
         $course = Course::find($course_id);
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
             compact(
95
             compact(
98
                 'title',
96
                 'title',
99
                 'course',
97
                 'course',
116
         $activity = Activity::find($id);
114
         $activity = Activity::find($id);
117
 
115
 
118
         // If activity does not exist, display 404
116
         // If activity does not exist, display 404
119
-        if(!$activity)
117
+        if (!$activity)
120
             App::abort('404');
118
             App::abort('404');
121
 
119
 
122
         // Get activity's course
120
         // Get activity's course
127
             App::abort('403', 'Access Forbidden');
125
             App::abort('403', 'Access Forbidden');
128
 
126
 
129
         // Get active semesters
127
         // Get active semesters
130
-        $active_semesters= array();
128
+        $active_semesters = array();
131
         $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();
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
         $outcomes_achieved = json_decode($activity->outcomes_achieved, true);
136
         $outcomes_achieved = json_decode($activity->outcomes_achieved, true);
141
         $outcomes_attempted = json_decode($activity->outcomes_attempted, true);
137
         $outcomes_attempted = json_decode($activity->outcomes_attempted, true);
142
 
138
 
149
         $activity = Activity::find($id);
145
         $activity = Activity::find($id);
150
 
146
 
151
         // If activity does not exist, display 404
147
         // If activity does not exist, display 404
152
-        if(!$activity)
148
+        if (!$activity)
153
             App::abort('404');
149
             App::abort('404');
154
 
150
 
155
         // Get activity's course
151
         // Get activity's course
167
         $rubric_contents = json_decode($rubric->contents);
163
         $rubric_contents = json_decode($rubric->contents);
168
 
164
 
169
         // Get results
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
         // Decode the scores (blade workaround)
168
         // Decode the scores (blade workaround)
173
         $scores_array = array();
169
         $scores_array = array();
174
-        foreach ($assessments as $index=>$assessment)
175
-        {
170
+        foreach ($assessments as $index => $assessment) {
176
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
171
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
177
         }
172
         }
178
 
173
 
181
 
176
 
182
     public function saveAssessment()
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
                     // Student assessment data
182
                     // Student assessment data
191
                     $student_data = json_decode(Input::get('student_scores'));
183
                     $student_data = json_decode(Input::get('student_scores'));
192
 
184
 
198
                     $activity = Activity::find(Input::get('activity_id'));
190
                     $activity = Activity::find(Input::get('activity_id'));
199
 
191
 
200
                     // Create or update student scores
192
                     // Create or update student scores
201
-                    if($activity->outcomes_attempted==NULL)
202
-                    {
193
+                    if ($activity->outcomes_attempted == NULL) {
203
                         // For each student, save her/his assessment in the db
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
                             // Find student by id
196
                             // Find student by id
207
                             $student = Student::find($single_student_data->student_id);
197
                             $student = Student::find($single_student_data->student_id);
208
 
198
 
209
                             $comments = trim($single_student_data->comments);
199
                             $comments = trim($single_student_data->comments);
210
-                            if($comments=='')
211
-                            {
200
+                            if ($comments == '') {
212
                                 $comments = NULL;
201
                                 $comments = NULL;
213
                             }
202
                             }
214
 
203
 
215
                             // Add the assessment to the pivot table
204
                             // Add the assessment to the pivot table
216
                             $student->assessed_activities()->attach($activity->id, array(
205
                             $student->assessed_activities()->attach($activity->id, array(
217
                                 'scores' => json_encode($single_student_data->scores),
206
                                 'scores' => json_encode($single_student_data->scores),
218
-                                'percentage'=>$single_student_data->percentage,
207
+                                'percentage' => $single_student_data->percentage,
219
                                 'comments' => $single_student_data->comments
208
                                 'comments' => $single_student_data->comments
220
                             ));
209
                             ));
221
                         }
210
                         }
222
-                    }
223
-                    else
224
-                    {
211
+                    } else {
225
                         // For each student, save her/his assessment in the db
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
                             // Find student by id
214
                             // Find student by id
229
                             $student = Student::find($single_student_data->student_id);
215
                             $student = Student::find($single_student_data->student_id);
230
 
216
 
231
                             $comments = trim($single_student_data->comments);
217
                             $comments = trim($single_student_data->comments);
232
-                            if($comments=='')
233
-                            {
218
+                            if ($comments == '') {
234
                                 $comments = NULL;
219
                                 $comments = NULL;
235
                             }
220
                             }
236
 
221
 
237
                             // Update the assessment in the pivot table
222
                             // Update the assessment in the pivot table
238
                             $student->assessed_activities()->updateExistingPivot($activity->id, array(
223
                             $student->assessed_activities()->updateExistingPivot($activity->id, array(
239
                                 'scores' => json_encode($single_student_data->scores),
224
                                 'scores' => json_encode($single_student_data->scores),
240
-                                'percentage'=>$single_student_data->percentage,
225
+                                'percentage' => $single_student_data->percentage,
241
                                 'comments' => $single_student_data->comments
226
                                 'comments' => $single_student_data->comments
242
                             ));
227
                             ));
243
-
244
                         }
228
                         }
245
-
246
                     }
229
                     }
247
 
230
 
248
 
231
 
256
                     $course_outcomes_attempted = NULL;
239
                     $course_outcomes_attempted = NULL;
257
                     $course_outcomes_achieved = NULL;
240
                     $course_outcomes_achieved = NULL;
258
 
241
 
259
-                    if($course->outcomes_attempted==NULL)
260
-                    {
242
+                    if ($course->outcomes_attempted == NULL) {
261
                         $course_outcomes_attempted = array_fill(1, $outcomeCount, 0);
243
                         $course_outcomes_attempted = array_fill(1, $outcomeCount, 0);
262
                         $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
244
                         $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
263
-                    }
264
-                    else
265
-                    {
245
+                    } else {
266
                         // the second argument is necessary to convert it into an array
246
                         // the second argument is necessary to convert it into an array
267
                         $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
247
                         $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
268
                         $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
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
                         // Find corresponding learning outcome
253
                         // Find corresponding learning outcome
275
                         $criterion = Criterion::withTrashed()->find($criterion_id);
254
                         $criterion = Criterion::withTrashed()->find($criterion_id);
276
                         $outcome = Outcome::find($criterion->outcome_id);
255
                         $outcome = Outcome::find($criterion->outcome_id);
277
 
256
 
278
                         // If criterion is achieved (1), add 1 to all arrays
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
                         // Else if it's 0, only add to the attempted outcomes arrays
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
                     // If all values are 0, throw exception
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
                         throw new Exception("Error Processing Request", 1);
273
                         throw new Exception("Error Processing Request", 1);
297
 
274
 
298
 
275
 
305
 
282
 
306
 
283
 
307
                     // Publish results if not a draft. That is, update the activity's course.
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
                         // Update course
286
                         // Update course
311
                         $course->outcomes_achieved = json_encode($course_outcomes_achieved);
287
                         $course->outcomes_achieved = json_encode($course_outcomes_achieved);
312
                         $course->outcomes_attempted = json_encode($course_outcomes_attempted);
288
                         $course->outcomes_attempted = json_encode($course_outcomes_attempted);
313
                         $course->save();
289
                         $course->save();
314
 
290
 
315
                         $activity->draft = false;
291
                         $activity->draft = false;
316
-
317
-                    }
318
-                    else
319
-                    {
292
+                    } else {
320
                         // Set draft to true
293
                         // Set draft to true
321
                         $activity->draft = true;
294
                         $activity->draft = true;
322
                     }
295
                     }
334
 
307
 
335
                     // Check if any assessed activities remain
308
                     // Check if any assessed activities remain
336
                     $remainingAssessed = false;
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
                             break;
313
                             break;
343
                         }
314
                         }
344
                     }
315
                     }
345
 
316
 
346
                     //If there are still evaluated activities in the course, recalculate course outcomes
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
                         $outcomeCount = Outcome::all()->count();
319
                         $outcomeCount = Outcome::all()->count();
350
 
320
 
351
                         // Variables to hold recalculated outcomes for the course
321
                         // Variables to hold recalculated outcomes for the course
353
                         $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
323
                         $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
354
 
324
 
355
                         // For each activity
325
                         // For each activity
356
-                        foreach ($activities as $activity2)
357
-                        {
326
+                        foreach ($activities as $activity2) {
358
                             // If activity has been assessed
327
                             // If activity has been assessed
359
-                            if($activity2->outcomes_attempted!=NULL)
360
-                            {
328
+                            if ($activity2->outcomes_attempted != NULL) {
361
                                 // Get the achieved criteria
329
                                 // Get the achieved criteria
362
                                 $criteria_achievement = json_decode($activity2->criteria_achieved, true);
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
                                     // Find corresponding learning outcome;
332
                                     // Find corresponding learning outcome;
366
                                     $criterion = Criterion::withTrashed()->find($criterion_id);
333
                                     $criterion = Criterion::withTrashed()->find($criterion_id);
367
                                     $outcome = Outcome::find($criterion->outcome_id);
334
                                     $outcome = Outcome::find($criterion->outcome_id);
368
 
335
 
369
                                     // If criterion is achieved (1), add 1 to both arrays
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
                                     // Else, only add to the attempted outcomes arrays
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
 
348
 
384
                         // Update course
349
                         // Update course
385
                         DB::table('courses')
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
                     // Otherwise, set them all to NULL
358
                     // Otherwise, set them all to NULL
394
-                    else
395
-                    {
359
+                    else {
396
                         DB::table('courses')
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
                 Session::flash('status', 'success');
372
                 Session::flash('status', 'success');
411
                 Session::flash('message', 'Assessment Saved. To add transforming actions click "Transforming Actions".');
373
                 Session::flash('message', 'Assessment Saved. To add transforming actions click "Transforming Actions".');
412
                 return action('ActivitiesController@show', array(Input::get('activity_id')));
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
             Session::flash('status', 'danger');
379
             Session::flash('status', 'danger');
420
             Session::flash('message', 'Error saving assessment. Try again later.');
380
             Session::flash('message', 'Error saving assessment. Try again later.');
421
 
381
 
422
             return action('ActivitiesController@show', array(Input::get('activity_id')));
382
             return action('ActivitiesController@show', array(Input::get('activity_id')));
423
-
424
         }
383
         }
425
     }
384
     }
426
 
385
 
427
     public function deleteAssessment()
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
                 $activity = DB::table('activities')->where('id', Input::get('id'))->first();
391
                 $activity = DB::table('activities')->where('id', Input::get('id'))->first();
435
 
392
 
436
                 $course = DB::table('courses')->where('id', $activity->course_id)->first();
393
                 $course = DB::table('courses')->where('id', $activity->course_id)->first();
441
                     ->where('id', Input::get('id'))
398
                     ->where('id', Input::get('id'))
442
                     ->update(array(
399
                     ->update(array(
443
                         'draft' => 0,
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
                 // Delete students score
410
                 // Delete students score
454
                 DB::table('assessments')->where('activity_id', $activity->id)->delete();
411
                 DB::table('assessments')->where('activity_id', $activity->id)->delete();
462
 
419
 
463
                 // Check if any assessed activties remain
420
                 // Check if any assessed activties remain
464
                 $remainingAssessed = false;
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
                         break;
425
                         break;
471
                     }
426
                     }
472
                 }
427
                 }
473
 
428
 
474
                 //If there are still evaluated activities in the course, recalculate course outcomes
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
                     $outcomeCount = Outcome::all()->count();
431
                     $outcomeCount = Outcome::all()->count();
478
 
432
 
479
                     // Variables to hold recalculated outcomes for the course
433
                     // Variables to hold recalculated outcomes for the course
481
                     $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
435
                     $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
482
 
436
 
483
                     // For each activity
437
                     // For each activity
484
-                    foreach ($activities as $activity)
485
-                    {
438
+                    foreach ($activities as $activity) {
486
                         // If activity has been assessed
439
                         // If activity has been assessed
487
-                        if($activity->outcomes_attempted!=NULL)
488
-                        {
440
+                        if ($activity->outcomes_attempted != NULL) {
489
                             // Get the achieved criteria
441
                             // Get the achieved criteria
490
                             $criteria_achievement = json_decode($activity->criteria_achieved, true);
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
                                 // Find corresponding learning outcome;
444
                                 // Find corresponding learning outcome;
494
                                 $criterion = Criterion::withTrashed()->find($criterion_id);
445
                                 $criterion = Criterion::withTrashed()->find($criterion_id);
495
                                 $outcome = Outcome::find($criterion->outcome_id);
446
                                 $outcome = Outcome::find($criterion->outcome_id);
496
 
447
 
497
                                 // If criterion is achieved (1), add 1 to both arrays
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
                                 // Else, only add to the attempted outcomes arrays
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
 
460
 
512
                     // Update course
461
                     // Update course
513
                     DB::table('courses')
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
                 // Otherwise, set them all to NULL
470
                 // Otherwise, set them all to NULL
522
-                else
523
-                {
471
+                else {
524
                     DB::table('courses')
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
                 Session::flash('status', 'success');
483
                 Session::flash('status', 'success');
537
                 Session::flash('message', 'Assessment deleted.');
484
                 Session::flash('message', 'Assessment deleted.');
538
                 return Redirect::back();
485
                 return Redirect::back();
539
             }
486
             }
540
-
541
-        }
542
-        catch (Exception $e)
543
-        {
487
+        } catch (Exception $e) {
544
             Session::flash('status', 'danger');
488
             Session::flash('status', 'danger');
545
             Session::flash('message', 'Error saving  assessment. Try again later.');
489
             Session::flash('message', 'Error saving  assessment. Try again later.');
546
 
490
 
552
     {
496
     {
553
         $course = Activity::find($id)->course;
497
         $course = Activity::find($id)->course;
554
 
498
 
555
-        if(Activity::destroy($id))
556
-        {
499
+        if (Activity::destroy($id)) {
557
             // Recalculate course outcomes
500
             // Recalculate course outcomes
558
             $activities = $course->activities;
501
             $activities = $course->activities;
559
 
502
 
560
             // Check if any assessed activties remain
503
             // Check if any assessed activties remain
561
             $remainingAssessed = false;
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
                     break;
508
                     break;
568
                 }
509
                 }
569
             }
510
             }
570
 
511
 
571
             //If there are still evaluated activities in the course, recalculate course outcomes
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
                 $outcomeCount = Outcome::all()->count();
514
                 $outcomeCount = Outcome::all()->count();
575
 
515
 
576
                 // Variables to hold recalculated outcomes for the course
516
                 // Variables to hold recalculated outcomes for the course
578
                 $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
518
                 $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
579
 
519
 
580
                 // For each activity
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
                 // Update course
544
                 // Update course
610
                 $course->outcomes_achieved = json_encode($course_outcomes_achieved);
545
                 $course->outcomes_achieved = json_encode($course_outcomes_achieved);
611
                 $course->outcomes_attempted = json_encode($course_outcomes_attempted);
546
                 $course->outcomes_attempted = json_encode($course_outcomes_attempted);
612
-            }
613
-            else
614
-            {
547
+            } else {
615
                 $course->outcomes_achieved = NULL;
548
                 $course->outcomes_achieved = NULL;
616
                 $course->outcomes_attempted = NULL;
549
                 $course->outcomes_attempted = NULL;
617
             }
550
             }
618
 
551
 
619
-            if($course->save())
620
-            {
552
+            if ($course->save()) {
621
                 Session::flash('status', 'success');
553
                 Session::flash('status', 'success');
622
                 Session::flash('message', 'Activity deleted.');
554
                 Session::flash('message', 'Activity deleted.');
623
-            }
624
-            else
625
-            {
555
+            } else {
626
                 Session::flash('status', 'danger');
556
                 Session::flash('status', 'danger');
627
                 Session::flash('message', 'Error deleting activity. Try again later.');
557
                 Session::flash('message', 'Error deleting activity. Try again later.');
628
                 return Redirect::back();
558
                 return Redirect::back();
629
             }
559
             }
630
 
560
 
631
             return Redirect::action('CoursesController@show', array($course->id));
561
             return Redirect::action('CoursesController@show', array($course->id));
632
-        }
633
-        else
634
-        {
562
+        } else {
635
             Session::flash('status', 'danger');
563
             Session::flash('status', 'danger');
636
             Session::flash('message', 'Error deleting activity. Try again later.');
564
             Session::flash('message', 'Error deleting activity. Try again later.');
637
             return Redirect::back();
565
             return Redirect::back();
640
 
568
 
641
     public function update($id)
569
     public function update($id)
642
     {
570
     {
643
-        try
644
-        {
571
+        try {
645
             $activity = Activity::find($id);
572
             $activity = Activity::find($id);
646
 
573
 
647
-            if(Input::has('update_activity_information'))
648
-            {
574
+            if (Input::has('update_activity_information')) {
649
                 /** Validation rules */
575
                 /** Validation rules */
650
                 $validator = Validator::make(
576
                 $validator = Validator::make(
651
                     array(
577
                     array(
654
                         'date' => Input::get('date'),
580
                         'date' => Input::get('date'),
655
                     ),
581
                     ),
656
                     array(
582
                     array(
657
-                        'name' => 'required|unique:activities,course_id,'.$id,
583
+                        'name' => 'required|unique:activities,course_id,' . $id,
658
                         'description' => 'required|min:10',
584
                         'description' => 'required|min:10',
659
                         'date' => 'required|dateFormat:Y-m-d'
585
                         'date' => 'required|dateFormat:Y-m-d'
660
                     ),
586
                     ),
661
                     array(
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
                 /** If validation fails */
592
                 /** If validation fails */
667
-                if ($validator->fails())
668
-                {
593
+                if ($validator->fails()) {
669
                     /** Prepare error message */
594
                     /** Prepare error message */
670
                     $message = 'Error(s) updating the Activity<ul>';
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
                     /** Send error message and old data */
603
                     /** Send error message and old data */
680
                     Session::flash('status', 'warning');
604
                     Session::flash('status', 'warning');
686
                 $activity->name = Input::get('name');
610
                 $activity->name = Input::get('name');
687
                 $activity->description = Input::get('description');
611
                 $activity->description = Input::get('description');
688
                 $activity->date = Input::get('date');
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
                     $activity->transforming_actions = Input::get('transforming_actions');
615
                     $activity->transforming_actions = Input::get('transforming_actions');
694
                 else
616
                 else
695
                     $activity->transforming_actions = NULL;
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
                     $activity->assessment_comments = Input::get('assessment_comments');
620
                     $activity->assessment_comments = Input::get('assessment_comments');
701
                 else
621
                 else
702
                     $activity->assessment_comments = NULL;
622
                     $activity->assessment_comments = NULL;
703
-            }
704
-            else
705
-            {
623
+            } else {
706
                 Session::flash('status', 'danger');
624
                 Session::flash('status', 'danger');
707
                 Session::flash('message', 'Error updating Activity. Please try again later.');
625
                 Session::flash('message', 'Error updating Activity. Please try again later.');
708
                 return Redirect::action('ActivitiesController@show', array($activity->id));
626
                 return Redirect::action('ActivitiesController@show', array($activity->id));
714
             Session::flash('status', 'success');
632
             Session::flash('status', 'success');
715
             Session::flash('message', 'Activity succesfully updated.');
633
             Session::flash('message', 'Activity succesfully updated.');
716
             return Redirect::action('ActivitiesController@show', array($activity->id));
634
             return Redirect::action('ActivitiesController@show', array($activity->id));
717
-
718
-        }
719
-        catch(Exception $e)
720
-        {
635
+        } catch (Exception $e) {
721
             Session::flash('status', 'warning');
636
             Session::flash('status', 'warning');
722
             Session::flash('message', 'Error updating Activity. Please try again later.');
637
             Session::flash('message', 'Error updating Activity. Please try again later.');
723
             return Redirect::action('ActivitiesController@show', array($activity->id));
638
             return Redirect::action('ActivitiesController@show', array($activity->id));
724
         }
639
         }
725
-
726
     }
640
     }
727
 
641
 
728
     //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.
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
         $activity = Activity::find($id);
646
         $activity = Activity::find($id);
733
 
647
 
734
         // If activity does not exist, display 404
648
         // If activity does not exist, display 404
735
-        if(!$activity)
649
+        if (!$activity)
736
             App::abort('404');
650
             App::abort('404');
737
 
651
 
738
         // Get activity's course
652
         // Get activity's course
756
 
670
 
757
         // Decode the scores (blade workaround)
671
         // Decode the scores (blade workaround)
758
         $scores_array = array();
672
         $scores_array = array();
759
-        foreach ($assessments as $index=>$assessment)
760
-        {
673
+        foreach ($assessments as $index => $assessment) {
761
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
674
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
762
         }
675
         }
763
 
676
 
769
         $activity = Activity::find($id);
682
         $activity = Activity::find($id);
770
 
683
 
771
         // If activity does not exist, display 404
684
         // If activity does not exist, display 404
772
-        if(!$activity)
685
+        if (!$activity)
773
             App::abort('404');
686
             App::abort('404');
774
 
687
 
775
         // Get activity's course
688
         // Get activity's course
793
 
706
 
794
         // Decode the scores (blade workaround)
707
         // Decode the scores (blade workaround)
795
         $scores_array = array();
708
         $scores_array = array();
796
-        foreach ($assessments as $index=>$assessment)
797
-        {
709
+        foreach ($assessments as $index => $assessment) {
798
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
710
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
799
         }
711
         }
800
 
712
 
801
         return View::make('local.professors.print_assessment', compact('activity', 'title', 'students', 'course', 'rubric_contents', 'assessments', 'scores_array', 'rubric'));
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 View File

1
 <?php
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
      * Display a listing of the resource.
9
      * Display a listing of the resource.
7
      *
10
      *
11
+     * 
8
      * @return Response
12
      * @return Response
9
      */
13
      */
10
     public function fetchCriterion()
14
     public function fetchCriterion()
11
     {
15
     {
12
         return Criterion::find(Input::get('id'));
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
     public function fetchCriterionWithTrashed()
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
         // dd($input);
50
         // dd($input);
24
         Log::info('isCriterionUnique');
51
         Log::info('isCriterionUnique');
25
 
52
 
26
-        if(Input::get('program_id')!=0)
53
+        if (Input::get('program_id') != 0)
27
             $program_id = $input['program_id'];
54
             $program_id = $input['program_id'];
28
         else
55
         else
29
             $program_id = NULL;
56
             $program_id = NULL;
30
 
57
 
31
-        $saved_criterion = Criterion::
32
-            withTrashed()
58
+        $saved_criterion = Criterion::withTrashed()
33
             ->where('name', '=', $input['name'])
59
             ->where('name', '=', $input['name'])
34
             ->where('outcome_id', '=', $input['outcome_id'])
60
             ->where('outcome_id', '=', $input['outcome_id'])
35
             ->where('program_id', '=', $program_id)
61
             ->where('program_id', '=', $program_id)
39
             // ->where('description78', '=', $input['description78'])
65
             // ->where('description78', '=', $input['description78'])
40
             ->first();
66
             ->first();
41
 
67
 
42
-    
43
 
68
 
44
-        if($saved_criterion)
69
+
70
+        if ($saved_criterion)
45
             return false;
71
             return false;
46
         else
72
         else
47
             return true;
73
             return true;
56
 
82
 
57
         $trimmed = trim(preg_replace('/\t+/', '', Input::get('subcriteria')));
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
             $trimmed = NULL;
89
             $trimmed = NULL;
64
-        }
65
-        else{
90
+        } else {
66
             $trimmed = json_encode(preg_split('/\r\n/', $trimmed));
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
         $clean_input['subcriteria'] = $trimmed;
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
         $clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
107
         $clean_input['program_id'] = trim(preg_replace('/\t+/', '', Input::get('program_id')));
75
         $clean_input['description12'] = trim(preg_replace('/\t+/', '', Input::get('description12')));
108
         $clean_input['description12'] = trim(preg_replace('/\t+/', '', Input::get('description12')));
76
         $clean_input['description34'] = trim(preg_replace('/\t+/', '', Input::get('description34')));
109
         $clean_input['description34'] = trim(preg_replace('/\t+/', '', Input::get('description34')));
78
         $clean_input['description78'] = trim(preg_replace('/\t+/', '', Input::get('description78')));
111
         $clean_input['description78'] = trim(preg_replace('/\t+/', '', Input::get('description78')));
79
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
112
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
80
         $clean_input['notes'] = trim(preg_replace('/\t+/', '', Input::get('notes')));
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
         return $clean_input;
118
         return $clean_input;
83
     }
119
     }
100
             array(
136
             array(
101
                 'name' => 'required|string',
137
                 'name' => 'required|string',
102
                 'subcriteria' => 'string',
138
                 'subcriteria' => 'string',
103
-                'outcome_id' => 'required|numeric|integer',
139
+                'outcome_id' => 'required|array',
104
                 'description12' => 'required|string',
140
                 'description12' => 'required|string',
105
                 'description34' => 'required|string',
141
                 'description34' => 'required|string',
106
                 'description56' => 'required|string',
142
                 'description56' => 'required|string',
130
         $validator = $this->makeValidator($clean_input);
166
         $validator = $this->makeValidator($clean_input);
131
 
167
 
132
         /** If validation fails */
168
         /** If validation fails */
133
-        if ($validator->fails())
134
-        {
169
+        if ($validator->fails()) {
135
             /** Prepare error message */
170
             /** Prepare error message */
136
             $message = '<p>Error(s) creating a new Criterion:</p><ul>';
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
             /** Send error message and old data */
179
             /** Send error message and old data */
146
             Session::flash('status', 'danger');
180
             Session::flash('status', 'danger');
147
             Session::flash('message', $message);
181
             Session::flash('message', $message);
148
             return Redirect::to('criteria')->withInput();
182
             return Redirect::to('criteria')->withInput();
149
-        }
150
-        else
151
-        {
183
+        } else {
152
             // Check criterion uniqueness
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
                 Session::flash('status', 'danger');
187
                 Session::flash('status', 'danger');
157
                 Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name and associated program are the same.');
188
                 Session::flash('message', 'This criterion is a duplicate of an already saved criterion because its name and associated program are the same.');
158
                 return Redirect::to('criteria')->withInput();
189
                 return Redirect::to('criteria')->withInput();
159
-            }
190
+            }*/
160
 
191
 
161
             /** Instantiate new criterion */
192
             /** Instantiate new criterion */
162
             $criterion = new Criterion;
193
             $criterion = new Criterion;
163
-            $criterion->name= $clean_input['name'];
194
+            $criterion->name = $clean_input['name'];
164
             $criterion->subcriteria = $clean_input['subcriteria'];
195
             $criterion->subcriteria = $clean_input['subcriteria'];
165
-            $criterion->outcome_id= $clean_input['outcome_id'];
196
+
166
             $criterion->description12 = $clean_input['description12'];
197
             $criterion->description12 = $clean_input['description12'];
167
             $criterion->description34 = $clean_input['description34'];
198
             $criterion->description34 = $clean_input['description34'];
168
             $criterion->description56 = $clean_input['description56'];
199
             $criterion->description56 = $clean_input['description56'];
169
             $criterion->description78 = $clean_input['description78'];
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
                 $criterion->copyright = $clean_input['copyright'];
205
                 $criterion->copyright = $clean_input['copyright'];
173
 
206
 
174
-            if(Input::get('notes'))
207
+            if (Input::get('notes'))
175
                 $criterion->notes = $clean_input['notes'];
208
                 $criterion->notes = $clean_input['notes'];
176
 
209
 
177
             // Set program
210
             // Set program
178
-            if(Input::get('program_id')!=0)
211
+            if (Input::get('program_id') != 0)
179
                 $criterion->program_id = $clean_input['program_id'];
212
                 $criterion->program_id = $clean_input['program_id'];
180
             else
213
             else
181
                 $criterion->program_id = NULL;
214
                 $criterion->program_id = NULL;
182
 
215
 
183
 
216
 
184
             /** If criterion is saved, send success message */
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
                 Session::flash('status', 'success');
233
                 Session::flash('status', 'success');
188
-                Session::flash('message', 'Criterion created: "'.$criterion->name.'".');
234
+                Session::flash('message', 'Criterion created: "' . $criterion->name . '".');
189
                 return Redirect::to('criteria')->withInput(Input::only('outcome_id'));
235
                 return Redirect::to('criteria')->withInput(Input::only('outcome_id'));
190
             }
236
             }
191
 
237
 
192
             /** If saving fails, send error message and old data */
238
             /** If saving fails, send error message and old data */
193
-            else
194
-            {
239
+            else {
195
                 Session::flash('status', 'danger');
240
                 Session::flash('status', 'danger');
196
                 Session::flash('message', '<p>Error creating Criterion. Please try again later.</p>');
241
                 Session::flash('message', '<p>Error creating Criterion. Please try again later.</p>');
197
                 return Redirect::to('learning-outcomes-criteria')->withInput();
242
                 return Redirect::to('learning-outcomes-criteria')->withInput();
202
     public function edit()
247
     public function edit()
203
     {
248
     {
204
         $title = "Criteria";
249
         $title = "Criteria";
205
-        $outcomes = Outcome::orderBy('name', 'ASC')->get();
250
+        $outcomes = Outcome::orderBy('name', 'ASC')->lists('name', 'id');
251
+
206
         $schools = School::orderBy('name', 'ASC')->get();
252
         $schools = School::orderBy('name', 'ASC')->get();
207
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
253
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
208
         $programs = Program::orderBy('name', 'ASC')->get();
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
     public function update()
308
     public function update()
214
     {
309
     {
215
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
310
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
216
 
311
 
217
-        $clean_input = $this->cleanInput();
312
+        $clean_input = $this->cleanInputEdit();
218
 
313
 
219
         /** Validation rules */
314
         /** Validation rules */
220
         $validator = $this->makeValidator($clean_input);
315
         $validator = $this->makeValidator($clean_input);
221
 
316
 
222
         /** If validation fails */
317
         /** If validation fails */
223
-        if ($validator->fails())
224
-        {
318
+        if ($validator->fails()) {
225
             /** Prepare error message */
319
             /** Prepare error message */
226
             $message = 'Error(s) updating the Criterion: <ul>';
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
             /** Send error message and old data */
328
             /** Send error message and old data */
236
             Session::flash('status', 'danger');
329
             Session::flash('status', 'danger');
237
             Session::flash('message', $message);
330
             Session::flash('message', $message);
238
             return Redirect::back()->withInput();
331
             return Redirect::back()->withInput();
239
-        }
240
-        else
241
-        {
332
+        } else {
242
 
333
 
243
             // // Check criterion uniqueness
334
             // // Check criterion uniqueness
244
             // if(!$this->isCriterionUnique($clean_input, $criterion))
335
             // if(!$this->isCriterionUnique($clean_input, $criterion))
250
             // }
341
             // }
251
 
342
 
252
             /** Set info */
343
             /** Set info */
253
-            $criterion->name= $clean_input['name'];
344
+            $criterion->name = $clean_input['name'];
254
             $criterion->subcriteria = $clean_input['subcriteria'];
345
             $criterion->subcriteria = $clean_input['subcriteria'];
255
-            $criterion->outcome_id= $clean_input['outcome_id'];
346
+            //$criterion->outcome_id = $clean_input['outcome_id'];
256
             $criterion->description12 = $clean_input['description12'];
347
             $criterion->description12 = $clean_input['description12'];
257
             $criterion->description34 = $clean_input['description34'];
348
             $criterion->description34 = $clean_input['description34'];
258
             $criterion->description56 = $clean_input['description56'];
349
             $criterion->description56 = $clean_input['description56'];
259
             $criterion->description78 = $clean_input['description78'];
350
             $criterion->description78 = $clean_input['description78'];
260
 
351
 
352
+
353
+
261
             // Set program
354
             // Set program
262
-            if(Input::get('program_id')!=0)
355
+            if (Input::get('program_id') != 0)
263
                 $criterion->program_id = Input::get('program_id');
356
                 $criterion->program_id = Input::get('program_id');
264
             else
357
             else
265
                 $criterion->program_id = NULL;
358
                 $criterion->program_id = NULL;
266
 
359
 
267
             // Set status
360
             // Set status
268
-            if(Input::get('status')==0)
361
+            if (Input::get('status') == 0)
269
                 $criterion->deleted_at = date('Y-m-d H:i:s');
362
                 $criterion->deleted_at = date('Y-m-d H:i:s');
270
             else
363
             else
271
                 $criterion->deleted_at = NULL;
364
                 $criterion->deleted_at = NULL;
272
 
365
 
273
-            if(Input::get('copyright'))
366
+            if (Input::get('copyright'))
274
                 $criterion->copyright = $clean_input['copyright'];
367
                 $criterion->copyright = $clean_input['copyright'];
275
             else
368
             else
276
-                $criterion->copyright=NULL;
369
+                $criterion->copyright = NULL;
277
 
370
 
278
-            if(Input::get('notes'))
371
+            if (Input::get('notes'))
279
                 $criterion->notes = $clean_input['notes'];
372
                 $criterion->notes = $clean_input['notes'];
280
             else
373
             else
281
-                $criterion->notes=NULL;
374
+                $criterion->notes = NULL;
282
 
375
 
283
             /** If criterion is updated, send success message */
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
                 Session::flash('status', 'success');
388
                 Session::flash('status', 'success');
287
-                Session::flash('message', 'Updated criterion: "'.$criterion->name.'"');
389
+                Session::flash('message', 'Updated criterion: "' . $criterion->name . '"');
288
                 return Redirect::back();
390
                 return Redirect::back();
289
             }
391
             }
290
 
392
 
291
             /** If saving fails, send error message and old data */
393
             /** If saving fails, send error message and old data */
292
-            else
293
-            {
394
+            else {
294
                 Session::flash('status', 'danger');
395
                 Session::flash('status', 'danger');
295
                 Session::flash('message', 'Error updating the Criterion. Please try again later.');
396
                 Session::flash('message', 'Error updating the Criterion. Please try again later.');
296
                 return Redirect::back()->withInput();
397
                 return Redirect::back()->withInput();
306
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
407
         $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
307
 
408
 
308
         return View::make('global.view-learning-outcomes-criteria', compact('title', 'outcomes', 'schools', 'criteria'));
409
         return View::make('global.view-learning-outcomes-criteria', compact('title', 'outcomes', 'schools', 'criteria'));
309
-
310
     }
410
     }
311
 
411
 
312
     public function destroy()
412
     public function destroy()
313
     {
413
     {
314
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
414
         $criterion = Criterion::withTrashed()->find(Input::get('id'));
315
-        if(!$criterion->trashed())
316
-        {
317
-            try
318
-            {
415
+        if (!$criterion->trashed()) {
416
+            try {
319
                 $criterion->delete();
417
                 $criterion->delete();
320
                 Session::flash('status', 'success');
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
                 Session::flash('status', 'danger');
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
             return Redirect::back();
424
             return Redirect::back();
329
-        }
330
-        else
331
-        {
332
-            try
333
-            {
425
+        } else {
426
+            try {
334
                 $criterion->restore();
427
                 $criterion->restore();
335
                 Session::flash('status', 'success');
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
                 Session::flash('status', 'danger');
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
             return Redirect::back();
434
             return Redirect::back();
344
-
345
         }
435
         }
346
     }
436
     }
347
 
437
 
348
     public function filterCriteria()
438
     public function filterCriteria()
349
     {
439
     {
350
-        switch (Input::get('filter'))
351
-        {
440
+        switch (Input::get('filter')) {
352
             case 'all':
441
             case 'all':
353
                 return Criteria::all();
442
                 return Criteria::all();
354
                 break;
443
                 break;
355
 
444
 
356
             case 'school':
445
             case 'school':
357
                 // If scoord
446
                 // If scoord
358
-                if(Auth::user()->role == '2')
359
-                {
447
+                if (Auth::user()->role == '2') {
360
 
448
 
361
                     // Fetch all the programs whose school is the user's
449
                     // Fetch all the programs whose school is the user's
362
                     $program_ids = DB::table('programs')->where('school_id', Auth::user()->school_id)->lists('id');
450
                     $program_ids = DB::table('programs')->where('school_id', Auth::user()->school_id)->lists('id');
363
 
451
 
364
                     // Return all criteria belonging to any of those programs
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
                         ->orderBy('name', 'ASC')
454
                         ->orderBy('name', 'ASC')
368
                         ->get();
455
                         ->get();
369
                 }
456
                 }
370
 
457
 
371
                 // If pcoord
458
                 // If pcoord
372
-                else
373
-                {
459
+                else {
374
                     // Fetch all the programs from the user's school;
460
                     // Fetch all the programs from the user's school;
375
                     $program_ids = DB::table('programs')->where('school_id', Auth::user()->programs[0]->school->id)->lists('id');
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
                         ->orderBy('name', 'ASC')
464
                         ->orderBy('name', 'ASC')
380
                         ->get();
465
                         ->get();
381
                 }
466
                 }
383
                 break;
468
                 break;
384
 
469
 
385
             case 'program':
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
                     ->orderBy('name', 'ASC')
472
                     ->orderBy('name', 'ASC')
389
                     ->get();
473
                     ->get();
390
                 break;
474
                 break;

+ 331
- 0
app/controllers/Objective2Controller.php View File

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

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

1
 <?php
1
 <?php
2
 
2
 
3
-class RubricsController extends \BaseController {
3
+class RubricsController extends \BaseController
4
+{
4
 
5
 
5
     /**
6
     /**
6
      * Show the form for creating a new rubric
7
      * Show the form for creating a new rubric
15
         if (!$activity)
16
         if (!$activity)
16
             App::abort('404');
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
         // Select templates that belong to everyone or belong to the activity's course's school
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
         $rubrics = Auth::user()->rubrics;
32
         $rubrics = Auth::user()->rubrics;
34
         $outcomes = Outcome::orderBy('name', 'ASC')->get();
33
         $outcomes = Outcome::orderBy('name', 'ASC')->get();
48
 
47
 
49
         DB::beginTransaction();
48
         DB::beginTransaction();
50
 
49
 
51
-        try
52
-        {
50
+        try {
53
             // Get rubric contents
51
             // Get rubric contents
54
-            $rubric_contents= json_decode(Input::get('contents'));
52
+            $rubric_contents = json_decode(Input::get('contents'));
55
 
53
 
56
             // Process rubric
54
             // Process rubric
57
             $rubric = new Rubric;
55
             $rubric = new Rubric;
73
             Session::flash('message', 'Rubric assigned.');
71
             Session::flash('message', 'Rubric assigned.');
74
 
72
 
75
             return action('ActivitiesController@show', array($activity->id));
73
             return action('ActivitiesController@show', array($activity->id));
74
+        } catch (Exception $e) {
76
 
75
 
77
-
78
-        }
79
-        catch(Exception $e)
80
-        {
81
             DB::rollBack();
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
 
107
 
112
         try {
108
         try {
113
             // Get associated activity
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
             // If the associated activity has been assessed, delete the records
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
                 DB::table('assessments')->where('activity_id', '=', $activity->id)->delete();
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
             $rubric->save();
121
             $rubric->save();
133
 
127
 
134
             // Check if any assessed activities remain
128
             // Check if any assessed activities remain
135
             $remainingAssessed = false;
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
                     break;
133
                     break;
142
                 }
134
                 }
143
             }
135
             }
144
 
136
 
145
             //If there are still evaluated activities in the course, recalculate course outcomes
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
                 // Variables to hold recalculated outcomes for the course
139
                 // Variables to hold recalculated outcomes for the course
149
                 $course_outcomes_attempted = array_fill(1, Outcome::all()->count(), 0);
140
                 $course_outcomes_attempted = array_fill(1, Outcome::all()->count(), 0);
150
                 $course_outcomes_achieved = array_fill(1, Outcome::all()->count(), 0);
141
                 $course_outcomes_achieved = array_fill(1, Outcome::all()->count(), 0);
151
 
142
 
152
                 // For each activity
143
                 // For each activity
153
-                foreach ($activities as $activity)
154
-                {
144
+                foreach ($activities as $activity) {
155
                     // If activity has been assessed
145
                     // If activity has been assessed
156
-                    if($activity->outcomes_attempted!=NULL)
157
-                    {
146
+                    if ($activity->outcomes_attempted != NULL) {
158
                         // Get the achieved criteria
147
                         // Get the achieved criteria
159
                         $criteria_achievement = json_decode($activity->criteria_achieved, true);
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
                             // Find corresponding learning outcome;
150
                             // Find corresponding learning outcome;
163
                             $criterion = Criterion::find($criterion_id);
151
                             $criterion = Criterion::find($criterion_id);
164
                             $outcome = Outcome::find($criterion->outcome_id);
152
                             $outcome = Outcome::find($criterion->outcome_id);
165
 
153
 
166
                             // If criterion is achieved (1), add 1 to both arrays
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
                             // Else, only add to the attempted outcomes arrays
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
                 // Update course
167
                 // Update course
182
                 $course->outcomes_achieved = json_encode($course_outcomes_achieved);
168
                 $course->outcomes_achieved = json_encode($course_outcomes_achieved);
183
                 $course->outcomes_attempted = json_encode($course_outcomes_attempted);
169
                 $course->outcomes_attempted = json_encode($course_outcomes_attempted);
184
-
185
-            }
186
-            else
187
-            {
170
+            } else {
188
                 // Update course
171
                 // Update course
189
                 $course->outcomes_achieved = NULL;
172
                 $course->outcomes_achieved = NULL;
190
                 $course->outcomes_attempted = NULL;
173
                 $course->outcomes_attempted = NULL;
191
-
192
             }
174
             }
193
 
175
 
194
             $course->save();
176
             $course->save();
198
             Session::flash('message', 'Rubric updated.');
180
             Session::flash('message', 'Rubric updated.');
199
 
181
 
200
             return action('ActivitiesController@show', array($activity->id));
182
             return action('ActivitiesController@show', array($activity->id));
201
-        }
202
-        catch (Exception $e)
203
-        {
183
+        } catch (Exception $e) {
204
             DB::rollBack();
184
             DB::rollBack();
205
             Session::flash('status', 'danger');
185
             Session::flash('status', 'danger');
206
             Session::flash('message', 'Error: The rubric could not be updated. Try again later.');
186
             Session::flash('message', 'Error: The rubric could not be updated. Try again later.');
216
     {
196
     {
217
         $rubric = Rubric::find(Input::get('id'));
197
         $rubric = Rubric::find(Input::get('id'));
218
 
198
 
219
-        if($rubric->delete())
220
-        {
199
+        if ($rubric->delete()) {
221
             Session::flash('status', 'success');
200
             Session::flash('status', 'success');
222
             Session::flash('message', 'Rubric deleted.');
201
             Session::flash('message', 'Rubric deleted.');
223
-        }
224
-        else
225
-        {
202
+        } else {
226
             Session::flash('status', 'danger');
203
             Session::flash('status', 'danger');
227
             Session::flash('message', 'Error: The rubric could not be deleted. Try again later.');
204
             Session::flash('message', 'Error: The rubric could not be deleted. Try again later.');
228
         }
205
         }
243
 
220
 
244
         // If activity does not belong to the requesting user, display 403
221
         // If activity does not belong to the requesting user, display 403
245
         if ($course->user_id != Auth::id())
222
         if ($course->user_id != Auth::id())
246
-                App::abort('403', 'Access Forbidden');
223
+            App::abort('403', 'Access Forbidden');
247
 
224
 
248
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
225
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
249
-        $title = $activity->name.': '.$rubric->name;
226
+        $title = $activity->name . ': ' . $rubric->name;
250
         return View::make('local.professors.viewrubric', compact('rubric', 'activity', 'title', 'course'));
227
         return View::make('local.professors.viewrubric', compact('rubric', 'activity', 'title', 'course'));
251
     }
228
     }
252
 
229
 
259
     {
236
     {
260
         // If user is a professor, display 403.
237
         // If user is a professor, display 403.
261
         if (Auth::user()->role == 4)
238
         if (Auth::user()->role == 4)
262
-                App::abort('403', 'Access Forbidden');
239
+            App::abort('403', 'Access Forbidden');
263
 
240
 
264
         $rubric = Rubric::where('id', '=', $rubric_id)->firstOrFail();
241
         $rubric = Rubric::where('id', '=', $rubric_id)->firstOrFail();
265
         $title = $rubric->name;
242
         $title = $rubric->name;
275
 
252
 
276
         // If activity does not belong to the requesting user, display 403
253
         // If activity does not belong to the requesting user, display 403
277
         if ($course->user_id != Auth::id())
254
         if ($course->user_id != Auth::id())
278
-                App::abort('403', 'Access Forbidden');
255
+            App::abort('403', 'Access Forbidden');
279
 
256
 
280
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
257
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
281
-        $title = $activity->name.': '.$rubric->name;
258
+        $title = $activity->name . ': ' . $rubric->name;
282
         return View::make('local.professors.downloadrubric', compact('rubric', 'activity', 'title', 'course'));
259
         return View::make('local.professors.downloadrubric', compact('rubric', 'activity', 'title', 'course'));
283
     }
260
     }
284
 
261
 
290
 
267
 
291
         // If activity does not belong to the requesting user, display 403
268
         // If activity does not belong to the requesting user, display 403
292
         if ($course->user_id != Auth::id())
269
         if ($course->user_id != Auth::id())
293
-                App::abort('403', 'Access Forbidden');
270
+            App::abort('403', 'Access Forbidden');
294
 
271
 
295
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
272
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
296
-        $title = $activity->name.': '.$rubric->name;
273
+        $title = $activity->name . ': ' . $rubric->name;
297
         return View::make('local.professors.printrubric', compact('rubric', 'activity', 'title', 'course'));
274
         return View::make('local.professors.printrubric', compact('rubric', 'activity', 'title', 'course'));
298
     }
275
     }
299
 
276
 
304
 
281
 
305
         $rubric_contents = json_decode($rubric->contents);
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
                 return json_encode($criterion);
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 View File

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

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

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

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

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

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

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

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

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

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

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

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

1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+use Illuminate\Support\Facades\Schema;
6
+
7
+class 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 View File

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

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

3
 use Illuminate\Database\Migrations\Migration;
3
 use Illuminate\Database\Migrations\Migration;
4
 use Illuminate\Database\Schema\Blueprint;
4
 use Illuminate\Database\Schema\Blueprint;
5
 
5
 
6
-class RemoveOutcomeIdFromObjectivesTable extends Migration {
6
+class RemoveOutcomeIdFromObjectivesTable extends Migration
7
+{
7
 
8
 
8
 	/**
9
 	/**
9
 	 * Run the migrations.
10
 	 * Run the migrations.
12
 	 */
13
 	 */
13
 	public function up()
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
 			$table->dropColumn('outcome_id');
18
 			$table->dropColumn('outcome_id');
19
 		});
19
 		});
20
 	}
20
 	}
27
 	 */
27
 	 */
28
 	public function down()
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
 			$table
35
 			$table
37
 				->foreign('outcome_id')
36
 				->foreign('outcome_id')
38
 				->references('id')
37
 				->references('id')
41
 				->onUpdate('cascade');
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 View File


+ 52
- 0
app/database/unusedMigrations/2020_10_05_124915_create_activity_criterion_table.php View File

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

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

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

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

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

1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+use Illuminate\Support\Facades\Schema;
6
+
7
+class 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 View File

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

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

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

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

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

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

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
 |
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
 			return Response::make('Unauthorized', 401);
41
 			return Response::make('Unauthorized', 401);
48
-		}
49
-		else
50
-		{
42
+		} else {
51
 			return Redirect::guest('/');
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
 	return Auth::basic();
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
 		Session::flash('status', 'info');
55
 		Session::flash('status', 'info');
67
 		Session::flash('message', 'At this time, access to OLAS is limited to some users. Check back later or contact an administrator.');
56
 		Session::flash('message', 'At this time, access to OLAS is limited to some users. Check back later or contact an administrator.');
68
 		Auth::logout();
57
 		Auth::logout();
69
 		return Redirect::action('AuthController@showLogin');
58
 		return Redirect::action('AuthController@showLogin');
70
 	}
59
 	}
71
-
72
 });
60
 });
73
 /*
61
 /*
74
 |--------------------------------------------------------------------------
62
 |--------------------------------------------------------------------------
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
 		switch (Auth::user()->role) {
74
 		switch (Auth::user()->role) {
89
 			case 1:
75
 			case 1:
90
 				return Redirect::to('administrator');
76
 				return Redirect::to('administrator');
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
 		switch (Auth::user()->role) {
106
 		switch (Auth::user()->role) {
123
 			case 2:
107
 			case 2:
124
 				return Redirect::to('school-coordinator');
108
 				return Redirect::to('school-coordinator');
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
 			case 3:
137
 			case 3:
157
 				return Redirect::to('program-coordinator');
138
 				return Redirect::to('program-coordinator');
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
 		return Redirect::to('professor');
160
 		return Redirect::to('professor');
182
 	}
161
 	}
183
 });
162
 });
192
 |
171
 |
193
 */
172
 */
194
 
173
 
195
-Route::filter('prof', function()
196
-{
174
+Route::filter('prof', function () {
197
 	// If user has no courses then s/he is not a professor
175
 	// If user has no courses then s/he is not a professor
198
 	// and must be redirected to her/his overview page
176
 	// and must be redirected to her/his overview page
199
-	if (!count(Auth::user()->courses))
200
-	{
177
+	if (!count(Auth::user()->courses)) {
201
 		switch (Auth::user()->role) {
178
 		switch (Auth::user()->role) {
202
 			case 1:
179
 			case 1:
203
 				return Redirect::to('administrator');
180
 				return Redirect::to('administrator');
225
 |
202
 |
226
 */
203
 */
227
 
204
 
228
-Route::filter('csrf', function()
229
-{
205
+Route::filter('csrf', function () {
230
 	$token = Request::ajax() ? Request::header('X-CSRF-Token') : Input::get('_token');
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 View File

1
 <?php
1
 <?php
2
 
2
 
3
+use Illuminate\Database\Eloquent\SoftDeletingTrait;
4
+
3
 class Objective extends Eloquent
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
      * Return the program that the objective belongs to
38
      * Return the program that the objective belongs to
35
      *
39
      *
36
      * @return Illuminate\Database\Eloquent\Model
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 View File

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

24
 	    return $this->hasMany('Objective');
24
 	    return $this->hasMany('Objective');
25
 //		return $this->belongsToMany('Objective', 'objective_outcome');
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 View File

7
 
7
 
8
 use Zizaco\Entrust\HasRole;
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
 	use UserTrait, RemindableTrait, HasRole;
13
 	use UserTrait, RemindableTrait, HasRole;
13
 
14
 
31
 	protected $fillable = array('ssn', 'first_name', 'surnames', 'email', 'role', 'school_id', 'has_access', 'cell_phone', 'office_phone', 'office_extension');
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
 	public function program()
48
 	public function program()

+ 106
- 115
app/routes.php View File

33
     'local.managers.admins._navigation',
33
     'local.managers.admins._navigation',
34
     'local.managers.sCoords._navigation',
34
     'local.managers.sCoords._navigation',
35
     'local.managers.pCoords._navigation',
35
     'local.managers.pCoords._navigation',
36
-    ), function($view)
37
-{
36
+), function ($view) {
38
     // Get user's courses' numbers
37
     // Get user's courses' numbers
39
     $courses = Auth::user()->courses;
38
     $courses = Auth::user()->courses;
40
 
39
 
54
     'local.managers.shared.program',
53
     'local.managers.shared.program',
55
     'local.managers.shared.rubrics',
54
     'local.managers.shared.rubrics',
56
     'global.view-learning-outcomes-criteria',
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
 
65
 
67
 /** Use modified guest filter to redirect logged in user */
66
 /** Use modified guest filter to redirect logged in user */
68
 Route::get('/', array('before' => 'guest', 'uses' => 'AuthController@showLogin'));
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
  * Protected Routes
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
      * Recalculate course outcomes
76
      * Recalculate course outcomes
79
      *
77
      *
80
-    */
78
+     */
81
 
79
 
82
-    Route::get('recalculateCourses', function()
83
-    {
80
+    Route::get('recalculateCourses', function () {
84
 
81
 
85
         DB::disableQueryLog();
82
         DB::disableQueryLog();
86
 
83
 
87
-        if(Auth::user()->id!=58)
84
+        if (Auth::user()->id != 58)
88
             Redirect::action('AuthController@showLogin');
85
             Redirect::action('AuthController@showLogin');
89
 
86
 
90
-        try
91
-        {
87
+        try {
92
             $courses = Course::all();
88
             $courses = Course::all();
93
 
89
 
94
-            foreach ($courses as $course)
95
-            {
90
+            foreach ($courses as $course) {
96
                 echo $course->id;
91
                 echo $course->id;
97
                 // Recalculate course outcomes
92
                 // Recalculate course outcomes
98
                 $activities = Activity::where('course_id', $course->id)
93
                 $activities = Activity::where('course_id', $course->id)
102
 
97
 
103
 
98
 
104
                 //If there are still evaluated activities in the course, recalculate course outcomes
99
                 //If there are still evaluated activities in the course, recalculate course outcomes
105
-                if(!$activities->isEmpty())
106
-                {
100
+                if (!$activities->isEmpty()) {
107
                     $outcomeCount = Outcome::all()->count();
101
                     $outcomeCount = Outcome::all()->count();
108
 
102
 
109
                     // Variables to hold recalculated outcomes for the course
103
                     // Variables to hold recalculated outcomes for the course
111
                     $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
105
                     $course_outcomes_achieved = array_fill(1, $outcomeCount, 0);
112
 
106
 
113
                     // For each activity
107
                     // For each activity
114
-                    foreach ($activities as $activity2)
115
-                    {
108
+                    foreach ($activities as $activity2) {
116
                         // If activity has been assessed
109
                         // If activity has been assessed
117
-                        if($activity2->outcomes_attempted!=NULL)
118
-                        {
110
+                        if ($activity2->outcomes_attempted != NULL) {
119
                             echo '<ul>';
111
                             echo '<ul>';
120
                             // Get the achieved criteria
112
                             // Get the achieved criteria
121
                             $criteria_achievement = json_decode($activity2->criteria_achieved, true);
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
                                 // Find corresponding learning outcome;
115
                                 // Find corresponding learning outcome;
125
                                 $criterion = Criterion::withTrashed()->where('id', $criterion_id)->first();
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
                                 $outcome = Outcome::find($criterion->outcome_id);
121
                                 $outcome = Outcome::find($criterion->outcome_id);
131
 
122
 
132
                                 // If criterion is achieved (1), add 1 to both arrays
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
                                 // Else, only add to the attempted outcomes arrays
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
                             echo '</ul>';
134
                             echo '</ul>';
146
-
147
                         }
135
                         }
148
                     }
136
                     }
149
 
137
 
150
                     // Update course
138
                     // Update course
151
                     DB::table('courses')
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
                 // Otherwise, set them all to NULL
147
                 // Otherwise, set them all to NULL
160
-                else
161
-                {
148
+                else {
162
                     DB::table('courses')
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
             return 'success';
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
     // Fetch all criteria associated to an outcome
169
     // Fetch all criteria associated to an outcome
185
-    Route::post( 'fetchCriteria', array(
170
+    Route::post('fetchCriteria', array(
186
         'as' => 'fetchCriteria',
171
         'as' => 'fetchCriteria',
187
         'uses' => 'OutcomesController@fetchCriteria'
172
         'uses' => 'OutcomesController@fetchCriteria'
188
-    ) );
173
+    ));
189
 
174
 
190
     // Fetch a criterion for a rubric
175
     // Fetch a criterion for a rubric
191
-    Route::post( 'fetchCriterion', array(
176
+    Route::post('fetchCriterion', array(
192
         'as' => 'fetchCriterion',
177
         'as' => 'fetchCriterion',
193
         'uses' => 'CriteriaController@fetchCriterion'
178
         'uses' => 'CriteriaController@fetchCriterion'
194
-    ) );
179
+    ));
195
 
180
 
196
     // Fetch a criterion for a rubric
181
     // Fetch a criterion for a rubric
197
-    Route::post( 'fetchCriterionWithTrashed', array(
182
+    Route::post('fetchCriterionWithTrashed', array(
198
         'as' => 'fetchCriterionWithTrashed',
183
         'as' => 'fetchCriterionWithTrashed',
199
         'uses' => 'CriteriaController@fetchCriterionWithTrashed'
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
     // Fetch a criterion for a rubric with custom content
192
     // Fetch a criterion for a rubric with custom content
203
-    Route::post( 'fetchRubricCriterion', array(
193
+    Route::post('fetchRubricCriterion', array(
204
         'as' => 'fetchRubricCriterion',
194
         'as' => 'fetchRubricCriterion',
205
         'uses' => 'RubricsController@fetchRubricCriterion'
195
         'uses' => 'RubricsController@fetchRubricCriterion'
206
-    ) );
196
+    ));
207
 
197
 
208
     // Load a rubric template
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
     // Log out user
204
     // Log out user
216
 
206
 
217
     // Edit and update user profile
207
     // Edit and update user profile
218
     Route::get('profile', 'UsersController@edit');
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
     // Allows users to give feeback
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
     // Show users all learning outcomes and criteria
219
     // Show users all learning outcomes and criteria
227
     Route::get('learning-outcomes-criteria', 'CriteriaController@index');
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
     // Show professor overview to users with courses
223
     // Show professor overview to users with courses
231
     Route::get('professor', 'ProfessorsController@overview');
224
     Route::get('professor', 'ProfessorsController@overview');
232
 
225
 
233
     // Assessment reports for users' courses
226
     // Assessment reports for users' courses
234
     Route::get('my-assessment-reports', 'OutcomesController@professorAssessmentReports');
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
      * Administrator Routes
231
      * Administrator Routes
239
      */
232
      */
240
-    Route::group( array('before' => 'admin'), function()
241
-    {
233
+    Route::group(array('before' => 'admin'), function () {
242
         Route::get('/administrator', 'AdministratorsController@overview');
234
         Route::get('/administrator', 'AdministratorsController@overview');
243
-        Route::post( 'administrator/rubrics', array(
235
+        Route::post('administrator/rubrics', array(
244
             'as' => 'rubrics',
236
             'as' => 'rubrics',
245
             'before' => 'csrf',
237
             'before' => 'csrf',
246
             'uses' => 'CriteriaController@fetch'
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
         Route::get('learning-outcomes', 'OutcomesController@index');
243
         Route::get('learning-outcomes', 'OutcomesController@index');
252
         // TODO: Change later
244
         // TODO: Change later
253
         Route::get('new-learning-outcomes', 'OutcomesController@newIndex');
245
         Route::get('new-learning-outcomes', 'OutcomesController@newIndex');
254
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@update'));
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
         Route::get('administrator/users/{query?}', 'UsersController@index');
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
         Route::get('administrator/semesters', 'SemestersController@edit');
256
         Route::get('administrator/semesters', 'SemestersController@edit');
273
         Route::get('template/{template}', 'TemplatesController@show');
265
         Route::get('template/{template}', 'TemplatesController@show');
274
 
266
 
275
         Route::get('courses/reassign', 'CoursesController@reassign');
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
         Route::get('activities/create', 'ActivitiesController@newCreate');
270
         Route::get('activities/create', 'ActivitiesController@newCreate');
279
-
280
     });
271
     });
281
 
272
 
282
     /**
273
     /**
283
      * School Coordinator Routes
274
      * School Coordinator Routes
284
      */
275
      */
285
-    Route::group( array('before' => 'scoord'), function()
286
-    {
276
+    Route::group(array('before' => 'scoord'), function () {
287
         Route::get('school-coordinator', 'SchoolCoordinatorsController@overview');
277
         Route::get('school-coordinator', 'SchoolCoordinatorsController@overview');
288
         Route::get('school/{id}', 'SchoolsController@show');
278
         Route::get('school/{id}', 'SchoolsController@show');
289
         Route::get('program/{id}', 'ProgramsController@show');
279
         Route::get('program/{id}', 'ProgramsController@show');
300
     /**
290
     /**
301
      * Program Coordinator Routes
291
      * Program Coordinator Routes
302
      */
292
      */
303
-    Route::group( array('before' => 'pcoord'), function()
304
-    {
293
+    Route::group(array('before' => 'pcoord'), function () {
305
         Route::get('program-coordinator', 'ProgramCoordinatorsController@overview');
294
         Route::get('program-coordinator', 'ProgramCoordinatorsController@overview');
306
 
295
 
307
         Route::get('rubrics', 'TemplatesController@newTemplate');
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
         Route::get('criteria', 'CriteriaController@edit');
300
         Route::get('criteria', 'CriteriaController@edit');
312
         Route::get('course/{id}', 'CoursesController@showLimited');
301
         Route::get('course/{id}', 'CoursesController@showLimited');
313
         Route::get('rubrics/{template_id}/download', 'TemplatesController@download');
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
         Route::get('rubric/{rubric_id}', 'RubricsController@show_limited');
306
         Route::get('rubric/{rubric_id}', 'RubricsController@show_limited');
318
         Route::get('grouped_course/{code}/{number}/{semester_code}', 'CoursesController@showGrouped');
307
         Route::get('grouped_course/{code}/{number}/{semester_code}', 'CoursesController@showGrouped');
319
 
308
 
329
 
318
 
330
         // Learning Objectives
319
         // Learning Objectives
331
         Route::get('program/{program}/objectives', 'ObjectivesController@index');
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
         Route::get('five-year-plans', 'FiveYearPlansController@index');
333
         Route::get('five-year-plans', 'FiveYearPlansController@index');
339
         Route::get('program/{program}/five-year-plans/create', 'FiveYearPlansController@create');
334
         Route::get('program/{program}/five-year-plans/create', 'FiveYearPlansController@create');
340
         Route::get('program/{program}/five-year-plans/{five_year_plan}', 'FiveYearPlansController@show');
335
         Route::get('program/{program}/five-year-plans/{five_year_plan}', 'FiveYearPlansController@show');
341
         Route::get('program/{program}/five-year-plans/{five_year_plan}/edit', 'FiveYearPlansController@edit');
336
         Route::get('program/{program}/five-year-plans/{five_year_plan}/edit', 'FiveYearPlansController@edit');
342
         Route::get('five-year-plans/{five_year_plan}/ms-word', 'FiveYearPlansController@msWord');
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
         // Annual plans
342
         // Annual plans
349
         Route::get('program/{program}/annual-plans/create', 'AnnualPlansController@create');
344
         Route::get('program/{program}/annual-plans/create', 'AnnualPlansController@create');
350
         Route::get('program/{program}/annual-plans/{five_year_plan}', 'AnnualPlansController@show');
345
         Route::get('program/{program}/annual-plans/{five_year_plan}', 'AnnualPlansController@show');
351
         Route::get('program/{program}/annual-plans/{five_year_plan}/edit', 'AnnualPlansController@edit');
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
         Route::get('learning-outcomes/show/{id}', 'OutcomesController@show');
350
         Route::get('learning-outcomes/show/{id}', 'OutcomesController@show');
356
         // TODO: Change route name
351
         // TODO: Change route name
364
     /**
359
     /**
365
      * Professor Routes
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
         Route::get('activities/{activity_id}/rubrics', 'RubricsController@newRubric');
364
         Route::get('activities/{activity_id}/rubrics', 'RubricsController@newRubric');
371
         Route::get('activities/{activity_id}/rubric', 'RubricsController@show');
365
         Route::get('activities/{activity_id}/rubric', 'RubricsController@show');
372
         Route::get('activities/{activity_id}/rubric/{rubric_id}/download', 'RubricsController@download');
366
         Route::get('activities/{activity_id}/rubric/{rubric_id}/download', 'RubricsController@download');
374
         Route::get('activities/{activity_id}/assess', 'ActivitiesController@assess');
368
         Route::get('activities/{activity_id}/assess', 'ActivitiesController@assess');
375
         Route::get('activities/{activity_id}/view_assessment', 'ActivitiesController@viewAssessment');
369
         Route::get('activities/{activity_id}/view_assessment', 'ActivitiesController@viewAssessment');
376
         Route::get('activities/{activity_id}/print_assessment', 'ActivitiesController@printAssessment');
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
         Route::delete('activities/{activity_id}/delete', 'ActivitiesController@destroy');
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
         Route::get('courses/{id}', 'CoursesController@show');
375
         Route::get('courses/{id}', 'CoursesController@show');
382
         Route::get('courses/{semester}/{id}/students/{number}', 'StudentsController@show');
376
         Route::get('courses/{semester}/{id}/students/{number}', 'StudentsController@show');
383
         Route::get('courses/{semester}/{id}/students/{number}/print_report', 'StudentsController@printStudentReport');
377
         Route::get('courses/{semester}/{id}/students/{number}/print_report', 'StudentsController@printStudentReport');
384
         Route::get('activities/{id}', 'ActivitiesController@show');
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
         Route::get('students', 'StudentsController@students');
380
         Route::get('students', 'StudentsController@students');
387
         Route::get('program', 'ProfessorsController@program');
381
         Route::get('program', 'ProfessorsController@program');
388
         Route::get('personal-information', 'ProfessorsController@personalInformation');
382
         Route::get('personal-information', 'ProfessorsController@personalInformation');
389
         Route::get('manual', 'ProfessorsController@manual');
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
         Route::get('learning-outcomes-criteria', 'CriteriaController@index');
388
         Route::get('learning-outcomes-criteria', 'CriteriaController@index');
395
         Route::get('export_grades/{id}', 'CoursesController@exportGrades');
389
         Route::get('export_grades/{id}', 'CoursesController@exportGrades');
396
 
390
 
399
         Route::get('professor-assessment-reports', 'OutcomesController@professorAssessmentReports');
393
         Route::get('professor-assessment-reports', 'OutcomesController@professorAssessmentReports');
400
 
394
 
401
         Route::get('general-studies-overview', 'ProfessorsController@generalStudiesOverview');
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 View File

8
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Management<span class="caret"></span></a>
8
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Management<span class="caret"></span></a>
9
         <ul class="dropdown-menu" role="menu">
9
         <ul class="dropdown-menu" role="menu">
10
           <li>{{ HTML::linkAction('CoursesController@reassign', 'Courses') }}</li>
10
           <li>{{ HTML::linkAction('CoursesController@reassign', 'Courses') }}</li>
11
+          <li>{{ HTML::linkAction('Objective2Controller@edit', 'Objectives')}}
11
           <li>{{ HTML::linkAction('CriteriaController@edit', 'Criteria') }}</li>
12
           <li>{{ HTML::linkAction('CriteriaController@edit', 'Criteria') }}</li>
12
           <li>{{ HTML::linkAction('OutcomesController@index', 'Learning Outcomes') }}</li>
13
           <li>{{ HTML::linkAction('OutcomesController@index', 'Learning Outcomes') }}</li>
13
           <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubric Builder') }}</li>
14
           <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubric Builder') }}</li>
21
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Colleges and Schools<span class="caret"></span></a>
22
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Colleges and Schools<span class="caret"></span></a>
22
         <ul class="dropdown-menu" role="menu">
23
         <ul class="dropdown-menu" role="menu">
23
           @foreach ($schools as $school)
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
           @endforeach
26
           @endforeach
26
         </ul>
27
         </ul>
27
       </li>
28
       </li>
31
       <li class="dropdown">
32
       <li class="dropdown">
32
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Sections<span class="caret"></span></a>
33
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Sections<span class="caret"></span></a>
33
         <ul class="dropdown-menu" role="menu">
34
         <ul class="dropdown-menu" role="menu">
34
-        @foreach ($courses as $course)
35
+          @foreach ($courses as $course)
35
           <li> {{ HTML::linkAction('CoursesController@show', $course->code.$course->number.'-'.$course->section.' ('.$course->semester->code.')', array('id'=>$course->id)) }}</li>
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
         </ul>
38
         </ul>
38
       </li>
39
       </li>
39
       @endif
40
       @endif
41
       <li class="dropdown">
42
       <li class="dropdown">
42
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Reports<span class="caret"></span></a>
43
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Reports<span class="caret"></span></a>
43
         <ul class="dropdown-menu" role="menu">
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
         </ul>
49
         </ul>
49
       </li>
50
       </li>
50
 
51
 
51
       <li class="dropdown">
52
       <li class="dropdown">
52
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span class="caret"></span></a>
53
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span class="caret"></span></a>
53
         <ul class="dropdown-menu" role="menu">
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
         </ul>
60
         </ul>
60
       </li>
61
       </li>
61
       <li class="dropdown">
62
       <li class="dropdown">
62
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span class="caret"></span></a>
63
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span class="caret"></span></a>
63
         <ul class="dropdown-menu" role="menu">
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
         </ul>
67
         </ul>
67
       </li>
68
       </li>
68
       <li class="dropdown">
69
       <li class="dropdown">
69
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">NEW<span class="caret"></span></a>
70
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">NEW<span class="caret"></span></a>
70
         <ul class="dropdown-menu" role="menu">
71
         <ul class="dropdown-menu" role="menu">
71
           <li>{{ HTML::linkAction('OutcomesController@newIndex', 'New Index') }}</li>
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
     </ul>
77
     </ul>
76
   </div>
78
   </div>
77
-</div>
79
+</div>

+ 715
- 278
app/views/local/managers/admins/criteria.blade.php
File diff suppressed because it is too large
View File


+ 420
- 0
app/views/local/managers/admins/objectives.blade.php View File

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

26
 
26
 
27
 $env = $app->detectEnvironment(array(
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
     'production' => array('*.com', '*.edu', '*.org'),
30
     'production' => array('*.com', '*.edu', '*.org'),
31
 
31
 
32
 ));
32
 ));

+ 1
- 0
public/.htaccess View File

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