Преглед на файлове

Los ultimos cambios del momento

Gabriel Santiago Plaza преди 3 години
родител
ревизия
6fb0cd7597
променени са 100 файла, в които са добавени 241 реда и са изтрити 97 реда
  1. 4
    3
      app/controllers/ActivitiesController.php
  2. 26
    11
      app/controllers/AnnualPlansController.php
  3. 205
    71
      app/controllers/TransformativeActionsController.php
  4. 4
    6
      app/database/migrations/2021_06_06_001211_create_transformative_objective_table.php
  5. 2
    6
      app/database/migrations/2021_06_14_000848_create_ta_course_table.php
  6. 0
    0
      app/database/unusedMigrations/old_migrations/2014_10_05_052350_create_schools_table.php
  7. 0
    0
      app/database/unusedMigrations/old_migrations/2014_10_05_055013_create_programs_table.php
  8. 0
    0
      app/database/unusedMigrations/old_migrations/2014_10_06_050335_create_users_table.php
  9. 0
    0
      app/database/unusedMigrations/old_migrations/2014_10_12_100000_create_password_resets_table.php
  10. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_10_035949_create_rubrics_table.php
  11. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_29_210957_create_templates_table.php
  12. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_29_211309_create_courses_table.php
  13. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_29_211310_create_activities_table.php
  14. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_29_212240_create_outcomes_table.php
  15. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_29_212341_create_criteria_table.php
  16. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_29_214028_create_semesters_table.php
  17. 0
    0
      app/database/unusedMigrations/old_migrations/2014_11_30_134022_create_students_table.php
  18. 0
    0
      app/database/unusedMigrations/old_migrations/2014_12_07_214036_create_course_student_table.php
  19. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_09_171350_create_assessments_table.php
  20. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_12_204310_add_columns_to_activities_table.php
  21. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_12_222859_add_columns_to_assessments_table.php
  22. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_13_010052_add_index_to_assessments_table.php
  23. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_13_142849_add_column_to_criteria_table.php
  24. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_14_140724_add_columns_to_courses_table.php
  25. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_21_124809_add_column_to_courses_table.php
  26. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_22_195515_add_column_to_templates_table.php
  27. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_23_175455_remove_total_from_assessments_table.php
  28. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_23_175923_rename_average_in_assessments_table.php
  29. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_28_121848_add_index_to_course_student_table.php
  30. 0
    0
      app/database/unusedMigrations/old_migrations/2015_01_28_133036_add_criteria_achieved_count_to_activities_table.php
  31. 0
    0
      app/database/unusedMigrations/old_migrations/2015_02_05_133245_add_transforming_actions_to_activities_table.php
  32. 0
    0
      app/database/unusedMigrations/old_migrations/2015_02_05_143641_add_assessment_comments_to_activities_table.php
  33. 0
    0
      app/database/unusedMigrations/old_migrations/2015_02_06_145359_create_password_reminders_table.php
  34. 0
    0
      app/database/unusedMigrations/old_migrations/2015_02_19_143311_add_is_graduate_to_programs_table.php
  35. 0
    0
      app/database/unusedMigrations/old_migrations/2015_02_25_170516_add_deleted_at_to_outcomes_table.php
  36. 0
    0
      app/database/unusedMigrations/old_migrations/2015_02_25_170529_add_deleted_at_to_criteria_table.php
  37. 0
    0
      app/database/unusedMigrations/old_migrations/2015_02_27_201953_add_criteria_achieved_percentage_to_activities_table.php
  38. 0
    0
      app/database/unusedMigrations/old_migrations/2015_03_04_132321_add_copyright_and_notes_to_criteria_table.php
  39. 0
    0
      app/database/unusedMigrations/old_migrations/2015_04_13_183730_add_program_id_to_templates_table.php
  40. 0
    0
      app/database/unusedMigrations/old_migrations/2015_04_28_141931_add_is_visible_to_templates_table.php
  41. 0
    0
      app/database/unusedMigrations/old_migrations/2015_05_04_162918_remove_expected_outcome_from_outcomes_table.php
  42. 0
    0
      app/database/unusedMigrations/old_migrations/2015_05_05_083800_add_decimal_expected_outcome_to_outcomes_table.php
  43. 0
    0
      app/database/unusedMigrations/old_migrations/2015_05_18_095002_add_first_login_to_users_table.php
  44. 0
    0
      app/database/unusedMigrations/old_migrations/2015_05_18_131259_add_columns_to_semesters_table.php
  45. 0
    0
      app/database/unusedMigrations/old_migrations/2015_05_18_134926_add_semester_id_to_courses.php
  46. 0
    0
      app/database/unusedMigrations/old_migrations/2015_06_10_092319_add_name_to_semesters_table.php
  47. 0
    0
      app/database/unusedMigrations/old_migrations/2015_06_12_085247_add_visibility_to_semesters_table.php
  48. 0
    0
      app/database/unusedMigrations/old_migrations/2015_06_16_092223_add_has_access_to_users.php
  49. 0
    0
      app/database/unusedMigrations/old_migrations/2015_06_18_103255_add_expected_percentage_and_points_to_templates_table.php
  50. 0
    0
      app/database/unusedMigrations/old_migrations/2015_07_10_150430_add_email_to_students_table.php
  51. 0
    0
      app/database/unusedMigrations/old_migrations/2015_07_13_111726_add_code_to_programs_table.php
  52. 0
    0
      app/database/unusedMigrations/old_migrations/2015_07_13_132620_add_ssn_and_employee_number_to_users_table.php
  53. 0
    0
      app/database/unusedMigrations/old_migrations/2015_08_19_130733_add_semester_id_to_course_student_table.php
  54. 0
    0
      app/database/unusedMigrations/old_migrations/2015_12_10_145451_add_criteria_weights_to_activities_table.php
  55. 0
    0
      app/database/unusedMigrations/old_migrations/2016_01_12_132034_add_program_id_to_criteria_table.php
  56. 0
    0
      app/database/unusedMigrations/old_migrations/2016_01_27_093808_add_date_to_activities_table.php
  57. 0
    0
      app/database/unusedMigrations/old_migrations/2016_01_27_134306_add_draft_to_activities_table.php
  58. 0
    0
      app/database/unusedMigrations/old_migrations/2016_03_11_085258_add_school_and_concentration_codes_to_students_table.php
  59. 0
    0
      app/database/unusedMigrations/old_migrations/2016_05_09_145427_create_program_user_table.php
  60. 0
    0
      app/database/unusedMigrations/old_migrations/2016_05_10_091847_remove_program_id_from_users_table.php
  61. 0
    0
      app/database/unusedMigrations/old_migrations/2016_05_23_153434_create_objectives_table.php
  62. 0
    0
      app/database/unusedMigrations/old_migrations/2016_05_25_090412_add_active_to_objectives_table.php
  63. 0
    0
      app/database/unusedMigrations/old_migrations/2016_05_26_092328_create_criterion_objective_table.php
  64. 0
    0
      app/database/unusedMigrations/old_migrations/2016_07_15_084546_create_quinquenniums_table.php
  65. 0
    0
      app/database/unusedMigrations/old_migrations/2016_07_15_084751_create_five_year_plans_table.php
  66. 0
    0
      app/database/unusedMigrations/old_migrations/2016_07_15_090133_create_fyp_parts_table.php
  67. 0
    0
      app/database/unusedMigrations/old_migrations/2016_07_15_090203_create_fyp_part_outcomes_table.php
  68. 0
    0
      app/database/unusedMigrations/old_migrations/2016_08_03_120016_remove_methods_from_fyp_part_outcomes_table.php
  69. 0
    0
      app/database/unusedMigrations/old_migrations/2016_08_03_140525_add_unique_index_to_five_year_plans_table.php
  70. 0
    0
      app/database/unusedMigrations/old_migrations/2016_08_11_150848_remove_semester_id_from_annual_plans_table.php
  71. 0
    0
      app/database/unusedMigrations/old_migrations/2016_08_11_151247_add_year_start_and_year_end_to_annual_plans_table.php
  72. 0
    0
      app/database/unusedMigrations/old_migrations/2017_02_03_150052_add_comments_to_assessments_table.php
  73. 0
    0
      app/database/unusedMigrations/old_migrations/2018_02_12_144827_add_subcriteria_to_criteria_table.php
  74. 0
    0
      app/database/unusedMigrations/old_migrations/2018_07_26_132933_add_last_login_to_users_table.php
  75. 0
    0
      app/database/unusedMigrations/old_migrations/2018_07_26_134316_add_phone_numbers_and_extension_to_users_table.php
  76. 0
    0
      app/database/unusedMigrations/old_migrations/2018_08_09_110432_remove_password_from_users_table.php
  77. 0
    0
      app/database/unusedMigrations/old_migrations/2018_08_09_110813_remove_password_updated_and_remember_token_from_users_table.php
  78. 0
    0
      app/database/unusedMigrations/old_migrations/2018_08_10_083743_add_remember_token_to_users_table.php
  79. 0
    0
      app/database/unusedMigrations/old_migrations/2018_08_28_140328_remove_outcome_id_from_objectives_table.php
  80. 0
    0
      app/database/unusedMigrations/old_migrations/2018_08_28_141547_drop_criterion_objective_table.php
  81. 0
    0
      app/database/unusedMigrations/old_migrations/2018_08_28_142111_create_objective_outcome_table.php
  82. 0
    0
      app/database/unusedMigrations/old_migrations/2018_09_13_134104_entrust_setup_tables.php
  83. 0
    0
      app/database/unusedMigrations/old_migrations/2019_08_07_100303_add_participants_achievers_counts_to_activities_table.php
  84. 0
    0
      app/database/unusedMigrations/old_migrations/2020_03_06_122426_create_participating_programs_view.php
  85. 0
    0
      app/database/unusedMigrations/old_migrations/2020_04_04_002657_create_new_criteria_table.php
  86. 0
    0
      app/database/unusedMigrations/old_migrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php
  87. 0
    0
      app/database/unusedMigrations/old_migrations/2020_04_22_090200_alter_activities_table.php
  88. 0
    0
      app/database/unusedMigrations/old_migrations/2020_04_22_095649_create_new_criterion_rubric_table.php
  89. 0
    0
      app/database/unusedMigrations/old_migrations/2020_04_22_101110_create_new_rubric_activity_table.php
  90. 0
    0
      app/database/unusedMigrations/old_migrations/2020_05_15_123430_create_new_outcomes_table.php
  91. 0
    0
      app/database/unusedMigrations/old_migrations/2020_05_15_123902_add_mapping_columns_to_outcomes_table.php
  92. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_04_142756_create_new_assessments_table.php
  93. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_05_124915_create_activity_criterion_table.php
  94. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_05_130252_add_max_score_num_scales_new_criteria_table.php
  95. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_05_142424_create_scales_table.php
  96. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_05_142912_create_criterion_scale_table.php
  97. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_05_232429_add_assessment_comments_to_activity_criterion.php
  98. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_09_131800_add_level_activation_date_to_outcomes.php
  99. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_16_190923_create_criterion_objective_outcome_table.php
  100. 0
    0
      app/database/unusedMigrations/old_migrations/2020_10_18_145108_create_outcome_performance_table.php

+ 4
- 3
app/controllers/ActivitiesController.php Целия файл

@@ -522,7 +522,7 @@ class ActivitiesController extends \BaseController
522 522
                 DB::table('assessments')->where('activity_id', $activity->id)->delete();
523 523
 
524 524
                 // Recalculate course outcomes
525
-                $activities = DB::table('activities')
525
+                /*$activities = DB::table('activities')
526 526
                     ->where('course_id', $course->id)
527 527
                     ->where('draft', 0)
528 528
                     ->get();
@@ -588,6 +588,7 @@ class ActivitiesController extends \BaseController
588 588
                             'updated_at' => date('Y-m-d H:i:s')
589 589
                         ));
590 590
                 }
591
+            });*/
591 592
             });
592 593
 
593 594
             if (is_null($exception)) {
@@ -721,12 +722,12 @@ class ActivitiesController extends \BaseController
721 722
                 $activity->name = Input::get('name');
722 723
                 $activity->description = Input::get('description');
723 724
                 $activity->date = Input::get('date');
724
-            } elseif (Input::has('update_transforming_actions')) {
725
+            } /*elseif (Input::has('update_transforming_actions')) {
725 726
                 if (trim(Input::get('transforming_actions')) != "")
726 727
                     $activity->transforming_actions = Input::get('transforming_actions');
727 728
                 else
728 729
                     $activity->transforming_actions = NULL;
729
-            } elseif (Input::has('update_assessment_comments')) {
730
+            }*/ elseif (Input::has('update_assessment_comments')) {
730 731
                 if (trim(Input::get('assessment_comments')) != "")
731 732
                     $activity->assessment_comments = Input::get('assessment_comments');
732 733
                 else

+ 26
- 11
app/controllers/AnnualPlansController.php Целия файл

@@ -220,13 +220,28 @@ class AnnualPlansController extends \BaseController
220 220
 
221 221
       Log::info($typ_info['typ_objective_id'][$objective->id]->id);
222 222
       Log::info($annual_plan->id);
223
-      $typ_info['annual_plans_transformative'][$objective->id] = DB::select("select trans_id from annual_plan_transformative where annual_plan_id={$annual_plan->id} and typ_semester_objective_id ={$typ_info['typ_objective_id'][$objective->id]->id}");
223
+      //  $typ_info['annual_plans_transformative'][$objective->id] = DB::select(
224
+      //    "select trans_id from annual_plan_transformative
225
+      //     where annual_plan_id={$annual_plan->id} 
226
+      //     and typ_semester_objective_id ={$typ_info['typ_objective_id'][$objective->id]->id}"
227
+      //  );
224 228
       foreach ($typ_info['courses'][$objective->id] as $course) {
225
-        $typ_info['selected_criteria'][$objective->id][$course->id] = DB::select("select criteria_id, typ_semester_course_id typ_course_id from annual_plan_objective where annual_plan_id ={$annual_plan->id} and typ_semester_course_id ={$course->typ_course_id} ");
229
+        $typ_info['selected_criteria'][$objective->id][$course->typ_course_id] = DB::select("select criteria_id, typ_semester_course_id typ_course_id from annual_plan_objective where annual_plan_id ={$annual_plan->id} and typ_semester_course_id ={$course->typ_course_id} ");
230
+        $typ_info['annual_plans_transformative'][$objective->id][$course->typ_course_id] = DB::table('annual_plan_transformative')
231
+          ->select('trans_id')
232
+          ->where('annual_plan_id', $annual_plan->id)
233
+          ->where('typ_semester_course_id', $course->typ_course_id)
234
+          ->get();
235
+        $typ_info['custom_transformative'][$objective->id][$course->id] = DB::table('transformative_actions')
236
+          ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
237
+          ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
238
+          ->where('is_custom', 1)
239
+          ->where('by_professor', 0)
240
+          ->where('ta_course.course_number', $course->number)
241
+          ->where('ta_course.course_code', $course->code)
242
+          ->where('transformative_objective.objective_id', $objective->id)
243
+          ->get();
226 244
       }
227
-
228
-
229
-      $typ_info['custom_transformative'][$objective->id] = DB::select("select * from transformative_actions where is_custom =1 and by_professor=0 and id in (select ta_id from transformative_objective_course where objective_id = {$objective->id})");
230 245
     }
231 246
     $typ_info['annual_plan'] = $annual_plan;
232 247
     Log::info($typ_info);
@@ -239,7 +254,7 @@ class AnnualPlansController extends \BaseController
239 254
     $typ_id = Input::get('typ_id') + 0;
240 255
     $trans_id = Input::get('TA_id') + 0;
241 256
 
242
-    DB::delete("delete from `annual_plan_transformative` where annual_plan_id ={$annual_id} and typ_semester_objective_id ={$typ_id} and trans_id={$trans_id}");
257
+    DB::delete("delete from `annual_plan_transformative` where annual_plan_id ={$annual_id} and typ_semester_course_id ={$typ_id} and trans_id={$trans_id}");
243 258
     return;
244 259
   }
245 260
 
@@ -247,24 +262,24 @@ class AnnualPlansController extends \BaseController
247 262
   {
248 263
     $annual_id = Input::get('annual_id') + 0;
249 264
     $TA_id = Input::get('TA_id') + 0;
250
-    $typ_id = Input::get('typ_id') + 0;
265
+    $typ_id = Input::get('typ_course_id') + 0;
251 266
     $old_ta = Input::get('old_ta') + 0;
252 267
     $id = Auth::user()['id'];
253 268
     $date = date('Y-m-d');
254 269
     $date = strtotime($date);
255 270
 
256 271
 
257
-    $query = DB::select("select * from annual_plan_transformative where annual_plan_id ={$annual_id} and trans_id ={$old_ta} and typ_semester_objective_id ={$typ_id}");
272
+    $query = DB::select("select * from annual_plan_transformative where annual_plan_id ={$annual_id} and trans_id ={$old_ta} and typ_semester_course_id ={$typ_id}");
258 273
 
259 274
     if (!count($query)) {
260
-      DB::insert("insert into `annual_plan_transformative` (`annual_plan_id`,`trans_id`, `typ_semester_objective_id`, `proposing_coordinator_id`, `proposed_date`) values({$annual_id},{$TA_id},{$typ_id}, {$id}, now() ) ");
275
+      DB::insert("insert into `annual_plan_transformative` (`annual_plan_id`,`trans_id`, `typ_semester_course_id`, `proposing_coordinator_id`, `proposed_date`) values({$annual_id},{$TA_id},{$typ_id}, {$id}, now() ) ");
261 276
       return "Insert Successful";
262 277
     } else {
263 278
       if ($TA_id == 0) {
264
-        DB::delete("delete from annual_plan_transformative where trans_id={$TA_id} and annual_plan_id ={$annual_id} and typ_semester_objective_id ={$typ_id}");
279
+        DB::delete("delete from annual_plan_transformative where trans_id={$TA_id} and annual_plan_id ={$annual_id} and typ_semester_course_id ={$typ_id}");
265 280
         return "deleted";
266 281
       } else {
267
-        DB::update("update annual_plan_transformative set trans_id = {$TA_id}, proposing_coordinator_id = {$id}, proposed_date = now() where trans_id={$old_ta} and annual_plan_id ={$annual_id} and typ_semester_objective_id ={$typ_id}");
282
+        DB::update("update annual_plan_transformative set trans_id = {$TA_id}, proposing_coordinator_id = {$id}, proposed_date = now() where trans_id={$old_ta} and annual_plan_id ={$annual_id} and typ_semester_course_id ={$typ_id}");
268 283
         return "updated";
269 284
       }
270 285
     }

+ 205
- 71
app/controllers/TransformativeActionsController.php Целия файл

@@ -27,7 +27,11 @@ class TransformativeActionsController extends \BaseController
27 27
       ->orWhereNull('deactivation_date')
28 28
       ->get();
29 29
     $objectives = array();
30
-
30
+    $types = DB::table('transformative_actions')
31
+      ->select('type_of_TA')
32
+      ->where('type_of_TA', '<>', '')
33
+      ->distinct()
34
+      ->get();
31 35
     // if user is program coordinator
32 36
     if ($role == 3) {
33 37
       //1 edit panel: load the TA that
@@ -64,20 +68,23 @@ class TransformativeActionsController extends \BaseController
64 68
       // get the courses from asociated with a TA
65 69
       $course_filter_approvePanel = DB::table('ta_course')
66 70
         ->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
67
-        ->join('courses', 'courses.id', '=', 'ta_course.course_id')
71
+        ->join('courses', function ($join) {
72
+          $join->on('courses.number', '=', 'ta_course.course_number');
73
+          $join->on('courses.code', '=', 'ta_course.course_code');
74
+        })
68 75
         ->where('transformative_actions.is_custom', 1)
69 76
         ->where('transformative_actions.program_id', $program_id)
70 77
         ->where('transformative_actions.by_professor', 1)
71 78
         ->select('courses.*')
72
-        ->groupBy('courses.name', 'courses.code')
79
+        ->groupBy('courses.number', 'courses.code')
73 80
         ->orderBy('courses.name', 'ASC')
74 81
         ->orderBy('courses.code', 'ASC')
75 82
         ->get();
76 83
       // get the outcome asociated with a TA
77 84
       $outcome_filter_approvePanel = DB::table('transformative_actions')
78
-        ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
79
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
80
-        ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
85
+        ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
86
+        ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
87
+        ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
81 88
         ->where('transformative_actions.is_custom', 1)
82 89
         ->where('transformative_actions.program_id', $program_id)
83 90
         ->where('transformative_actions.by_professor', 1)
@@ -100,18 +107,21 @@ class TransformativeActionsController extends \BaseController
100 107
         ->get();
101 108
       $course_filter_editPanel =  DB::table('ta_course')
102 109
         ->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
103
-        ->join('courses', 'courses.id', '=', 'ta_course.course_id')
110
+        ->join('courses', function ($join) {
111
+          $join->on('courses.number', '=', 'ta_course.course_number');
112
+          $join->on('courses.code', '=', 'ta_course.course_code');
113
+        })
104 114
         ->where('transformative_actions.is_custom', 1)
105 115
         ->where('transformative_actions.program_id', $program_id)
106 116
         ->where('transformative_actions.by_professor', 0)
107 117
         ->select('courses.*')
108
-        ->groupBy('courses.name', 'courses.code')
118
+        ->groupBy('courses.number', 'courses.code')
109 119
         ->orderBy('courses.name', 'ASC')
110 120
         ->orderBy('courses.code', 'ASC')
111 121
         ->get();
112 122
       $outcome_filter_editPanel = DB::table('transformative_actions')
113
-        ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
114
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
123
+        ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
124
+        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
115 125
         ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
116 126
         ->where('transformative_actions.is_custom', 1)
117 127
         ->where('transformative_actions.program_id', $program_id)
@@ -124,11 +134,11 @@ class TransformativeActionsController extends \BaseController
124 134
       $courses_create = DB::table('courses')
125 135
         ->where('courses.program_id', $program_id)
126 136
         ->select('courses.*')
127
-        ->groupBy('courses.name', 'courses.code')
137
+        ->groupBy('courses.number', 'courses.code')
128 138
         ->orderBy('courses.name', 'ASC')
129 139
         ->orderBy('courses.code', 'ASC')
130 140
         ->get();
131
-    }
141
+    }/*
132 142
     // if user is profesor
133 143
     elseif ($role == 4) {
134 144
       // 1 the user can only edit TA that need approval and has been submited by the same user
@@ -157,8 +167,8 @@ class TransformativeActionsController extends \BaseController
157 167
         ->orderBy('courses.code', 'ASC')
158 168
         ->get();
159 169
       $outcome_filter_editPanel = DB::table('transformative_actions')
160
-        ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
161
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
170
+        ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
171
+        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
162 172
         ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
163 173
         ->where('transformative_actions.is_custom', 1)
164 174
         ->where('transformative_actions.user_id', Auth::user()->id)
@@ -183,10 +193,11 @@ class TransformativeActionsController extends \BaseController
183 193
         ->orderBy('courses.code', 'ASC')
184 194
         ->get();
185 195
     }
186
-
196
+*/
187 197
     return View::make('local.managers.admins.transformativeAction', compact(
188 198
       'title',
189 199
       'role',
200
+      'types',
190 201
       'outcomes',
191 202
       'schools',
192 203
       'criteria',
@@ -246,7 +257,9 @@ class TransformativeActionsController extends \BaseController
246 257
     $clean_input['objectiveid'] = Input::get('objectiveid');
247 258
     $clean_input['courseid'] = Input::get('courseid');
248 259
     $clean_input['approval'] = Input::get('approval');
260
+    $clean_input['type'] = Input::get('type_of_ta');
249 261
     $clean_input['ta_id'] = Input::get('ta_id');
262
+    $clean_input['new_type'] = Input::get('new_type');
250 263
 
251 264
     return $clean_input;
252 265
   }
@@ -263,14 +276,16 @@ class TransformativeActionsController extends \BaseController
263 276
         'courseid' => $clean_input['courseid'],
264 277
         'approval' => $clean_input['approval'],
265 278
         'ta_id' => $clean_input['ta_id'],
279
+        'type_of_ta' => $clean_input['type'],
266 280
       ),
267 281
       array(
268 282
         'text' => 'required|string',
269 283
         'description' => 'required|string',
270 284
         'objectiveid' => 'required|array',
271
-        'courseid' => 'required|array',
285
+        'courseid' => 'required|string',
272 286
         'approval' => 'integer',
273 287
         'ta_id' => 'integer',
288
+        'type_of_ta' => 'required|string'
274 289
       )
275 290
     );
276 291
   }
@@ -302,7 +317,7 @@ class TransformativeActionsController extends \BaseController
302 317
       return Redirect::to('transformativeAction')->withInput();
303 318
     } else {
304 319
 
305
-      $user_id = auth::user()->id;
320
+      $user_id = Auth::user()->id;
306 321
       $program_id = DB::table('program_user')
307 322
         ->where('user_id', $user_id)
308 323
         ->select('program_id')
@@ -313,10 +328,17 @@ class TransformativeActionsController extends \BaseController
313 328
       if ($role == 3) {
314 329
         $by_professor = 0;
315 330
       }
316
-
331
+      Log::info($clean_input['courseid']);
317 332
       // $by_professor = $clean_input['approval'];
318 333
 
334
+      $parentesis = array('(', ')');
335
+      $course_code_number = str_replace($parentesis, '', $clean_input['courseid']);
336
+
337
+      $course_code_number = explode(',', $course_code_number);
338
+
319 339
       $current_timestamp = date('Y/m/d H:i:s', time());
340
+      if ($clean_input['new_type']) $type = $clean_input['new_type'];
341
+      else $type = $clean_input['type'];
320 342
       // insert the TA
321 343
       $ta_id = DB::table('transformative_actions')->insertGetId(
322 344
         array(
@@ -327,32 +349,34 @@ class TransformativeActionsController extends \BaseController
327 349
           'program_id' => $program_id,
328 350
           'created_at' => $current_timestamp,
329 351
           'by_professor' => $by_professor,
352
+          'type_of_TA' => $type
330 353
         )
331 354
       );
332 355
 
333 356
       //
334 357
       // // insert the multiple TA_objective_program
335 358
       foreach ($clean_input['objectiveid'] as $objective_id) {
336
-        DB::table('transformative_objective_course')->insert(
359
+        DB::table('transformative_objective')->insert(
337 360
           array(
338 361
             'ta_id' => $ta_id,
339 362
             'objective_id' => $objective_id,
340
-            'program_id' => $program_id,
341
-            'created_at' => $current_timestamp,
363
+
364
+
342 365
           )
343 366
         );
344 367
       }
345 368
 
346 369
       //
347 370
       // // insert the multiple TA_course
348
-      foreach ($clean_input['courseid'] as $course_id) {
349
-        DB::table('TA_course')->insert(
350
-          array(
351
-            'ta_id' => $ta_id,
352
-            'course_id' => $course_id,
353
-          )
354
-        );
355
-      }
371
+      DB::table('TA_course')->insert(
372
+        array(
373
+          'ta_id' => $ta_id,
374
+          'course_number' => $course_code_number[1],
375
+          'course_code' => $course_code_number[0],
376
+
377
+        )
378
+      );
379
+
356 380
 
357 381
       Session::flash('status', 'success');
358 382
       Session::flash('message', 'Transformative Action created: "' . $clean_input['text'] . '".');
@@ -387,12 +411,19 @@ class TransformativeActionsController extends \BaseController
387 411
 
388 412
     $current_timestamp = date('Y/m/d H:i:s', time());
389 413
 
414
+    if (Input::get('new_type')) {
415
+      $type = Input::get('new_type');
416
+    } else {
417
+      $type = Input::get('type_of_ta');
418
+    }
419
+
390 420
     // edit the TA
391 421
     DB::table('transformative_actions')
392 422
       ->where('id', $ta_id)
393 423
       ->update([
394 424
         'by_professor' => 0,
395 425
         'updated_at' => $current_timestamp,
426
+        'type_of_TA' => $type
396 427
       ]);
397 428
 
398 429
     Session::flash('status', 'success');
@@ -442,6 +473,9 @@ class TransformativeActionsController extends \BaseController
442 473
 
443 474
       // $by_professor = $clean_input['approval'];
444 475
 
476
+      if ($clean_input['new_type']) $type = $clean_input['new_type'];
477
+      else $type = $clean_input['type'];
478
+
445 479
       $current_timestamp = date('Y/m/d H:i:s', time());
446 480
       // edit the TA
447 481
       DB::table('transformative_actions')
@@ -451,12 +485,14 @@ class TransformativeActionsController extends \BaseController
451 485
           'at_text' => $clean_input['text'],
452 486
           'description' => $clean_input['description'],
453 487
           'updated_at' => $current_timestamp,
488
+          'type_of_TA' => $type
489
+
454 490
         ]);
455 491
 
456 492
 
457 493
       $ta_id = $clean_input['ta_id'];
458 494
       $new_objective_id = $clean_input['objectiveid'];
459
-      $old_objective_id = DB::table('transformative_objective_course')
495
+      $old_objective_id = DB::table('transformative_objective')
460 496
         ->where('ta_id', $ta_id)
461 497
         ->select('objective_id')
462 498
         ->lists('objective_id');
@@ -467,7 +503,7 @@ class TransformativeActionsController extends \BaseController
467 503
           //do nothing if a new id is already in atble
468 504
         } else {
469 505
           //if old id not in new id, delete
470
-          DB::table('transformative_objective_course')
506
+          DB::table('transformative_objective')
471 507
             ->where('ta_id', $ta_id)
472 508
             ->where('objective_id', $old_id)
473 509
             ->delete();
@@ -476,18 +512,17 @@ class TransformativeActionsController extends \BaseController
476 512
 
477 513
       //
478 514
       foreach ($new_objective_id as $new_id) {
479
-        $result = DB::table('transformative_objective_course')
515
+        $result = DB::table('transformative_objective')
480 516
           ->where('objective_id', $new_id)
481 517
           ->select('objective_id')
482 518
           ->lists('objective_id');
483 519
 
484 520
         if (count($result) == 0) {
485 521
           //if the new_id does not exists, do nothing
486
-          DB::table('transformative_objective_course')->insert(
522
+          DB::table('transformative_objective')->insert(
487 523
             array(
488 524
               'ta_id' => $ta_id,
489 525
               'objective_id' => $new_id,
490
-              'program_id' => $program_id,
491 526
               'created_at' => $current_timestamp,
492 527
             )
493 528
           );
@@ -496,8 +531,17 @@ class TransformativeActionsController extends \BaseController
496 531
         }
497 532
       }
498 533
 
534
+      $parentesis = array('(', ')');
535
+      $course_code_number = str_replace($parentesis, '', $clean_input['courseid']);
536
+
537
+      $course_code_number = explode(',', $course_code_number);
538
+
539
+      DB::update(
540
+        "UPDATE `ta_course` set `course_number` = '{$course_code_number[1]}', `course_code` = '{$course_code_number[0]}' where ta_id = {$ta_id}"
541
+      );
542
+
543
+      /*$new_course_id = $clean_input['courseid'];
499 544
 
500
-      $new_course_id = $clean_input['courseid'];
501 545
       $old_course_id = DB::table('ta_course')
502 546
         ->where('ta_id', $ta_id)
503 547
         ->select('course_id')
@@ -534,7 +578,7 @@ class TransformativeActionsController extends \BaseController
534 578
         } else {
535 579
           //if the new_id already exists, do nothing
536 580
         }
537
-      }
581
+      } */
538 582
 
539 583
       Session::flash('status', 'success');
540 584
       Session::flash('message', 'Updated Transformative Action: "' . $clean_input['text'] . '".');
@@ -617,12 +661,13 @@ class TransformativeActionsController extends \BaseController
617 661
     $program_id = $program_id[0]->program_id;
618 662
 
619 663
     $objectives = DB::table('transformative_actions')
620
-      ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
621
-      ->join('objectives', 'objectives.id', '=', 'transformative_objective_course.objective_id')
664
+      ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
665
+      ->join('objectives', 'objectives.id', '=', 'transformative_objective.objective_id')
622 666
       ->where('transformative_actions.id', $ta_id)
623 667
       ->select('objectives.text as text', 'objectives.id as id')
624 668
       ->orderBy('objectives.text', 'ASC')
625 669
       ->get();
670
+    Log::info($ta_id);
626 671
 
627 672
     $an_objective = $objectives[0]->id;
628 673
     $outcome_id = DB::table('criterion_objective_outcome')
@@ -641,7 +686,10 @@ class TransformativeActionsController extends \BaseController
641 686
       ->select('objectives.text as text', 'objectives.id as id')
642 687
       ->get();
643 688
     $selected_courses = DB::table('ta_course')
644
-      ->join('courses', 'courses.id', '=', 'ta_course.course_id')
689
+      ->join('courses', function ($join) {
690
+        $join->on('courses.number', '=', 'ta_course.course_number');
691
+        $join->on('courses.code', '=', 'ta_course.course_code');
692
+      })
645 693
       ->where('ta_id', $ta_id)
646 694
       ->orderBy('courses.name', 'ASC')
647 695
       ->orderBy('courses.code', 'ASC')
@@ -694,8 +742,8 @@ class TransformativeActionsController extends \BaseController
694 742
 
695 743
     $objectives = DB::table('objectives')
696 744
       ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
697
-      ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'objectives.id')
698
-      ->where('criterion_objective_outcome.outcome_id', $outcome_id)
745
+      ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
746
+      ->where('objective_outcome.outcome_id', $outcome_id)
699 747
       ->where('objective_program.program_id', $program_id)
700 748
       ->orderBy('objectives.text', 'ASC')
701 749
       ->select('objectives.text as text', 'objectives.id as id')
@@ -743,25 +791,38 @@ class TransformativeActionsController extends \BaseController
743 791
       if ($course_id == 0) {
744 792
         $courses =  DB::table('ta_course')
745 793
           ->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
746
-          ->join('courses', 'courses.id', '=', 'ta_course.course_id')
794
+          ->join('courses', function ($join) {
795
+            $join->on('courses.number', '=', 'ta_course.course_number');
796
+            $join->on('courses.code', '=', 'ta_course.course_code');
797
+          })
747 798
           ->where('transformative_actions.is_custom', 1)
748 799
           ->where('transformative_actions.program_id', $program_id)
749 800
           ->where('transformative_actions.by_professor', 1)
750
-          ->select('courses.id')
801
+          ->select('ta_course.course_number', 'ta_course.course_code')
802
+          ->distinct()
751 803
           ->get();
752 804
 
753 805
         $course_id = array();
754 806
         foreach ($courses as $key => $course) {
755
-          array_push($course_id, $course->id);
807
+          array_push($course_id["number"], $course->course_number);
808
+          array_push($course_id["code"], $course->code);
756 809
         }
757 810
       } else {
758
-        $course_id = array($course_id);
811
+
812
+        $parentesis = array('(', ')');
813
+        $course_code_number = str_replace($parentesis, '', $course_id);
814
+
815
+        $course_code_number = explode(',', $course_code_number);
816
+
817
+        $course_id = array();
818
+        $course_id['number'] = $course_code_number[1];
819
+        $course_id['code'] = $course_code_number[0];
759 820
       }
760 821
       // if outcome isnt a desired filter, search all outcomes
761 822
       if ($outcome_id == 0) {
762 823
         $outcomes = DB::table('transformative_actions')
763
-          ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
764
-          ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
824
+          ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
825
+          ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
765 826
           ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
766 827
           ->where('transformative_actions.is_custom', 1)
767 828
           ->where('transformative_actions.program_id', $program_id)
@@ -778,16 +839,18 @@ class TransformativeActionsController extends \BaseController
778 839
       }
779 840
 
780 841
       // search TA with filters
842
+
781 843
       $filtered_at = DB::table('transformative_actions')
782 844
         ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
783
-        ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
784
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
845
+        ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
846
+        ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
785 847
         ->where('transformative_actions.is_custom', 1)
786 848
         ->where('transformative_actions.program_id', $program_id)
787 849
         ->where('transformative_actions.by_professor', 1)
788 850
         ->whereIn('transformative_actions.user_id', $professor_id)
789
-        ->whereIn('criterion_objective_outcome.outcome_id', $outcome_id)
790
-        ->whereIn('ta_course.course_id', $course_id)
851
+        ->whereIn('objective_outcome.outcome_id', $outcome_id)
852
+        ->whereIn('ta_course.course_code', $course_id['code'])
853
+        ->whereIn('ta_course.course_number', $course_id['number'])
791 854
         ->select('transformative_actions.*')
792 855
         ->groupBy('transformative_actions.id')
793 856
         ->orderBy('transformative_actions.at_text', 'ASC')
@@ -816,26 +879,39 @@ class TransformativeActionsController extends \BaseController
816 879
       if ($course_id == 0) {
817 880
         $courses =  DB::table('ta_course')
818 881
           ->join('transformative_actions', 'transformative_actions.id', '=', 'ta_course.ta_id')
819
-          ->join('courses', 'courses.id', '=', 'ta_course.course_id')
882
+          ->join('courses', function ($join) {
883
+            $join->on('courses.number', '=', 'ta_course.course_number');
884
+            $join->on('courses.code', '=', 'ta_course.course_code');
885
+          })
820 886
           ->where('transformative_actions.is_custom', 1)
821 887
           ->where('transformative_actions.program_id', $program_id)
822 888
           ->where('transformative_actions.by_professor', 0)
823
-          ->select('courses.id')
889
+          ->select('ta_course.course_number', 'ta_course.course_code')
890
+          ->distinct()
824 891
           ->get();
825 892
 
826 893
         $course_id = array();
827 894
         foreach ($courses as $key => $course) {
828
-          array_push($course_id, $course->id);
895
+          array_push($course_id["number"], $course->course_number);
896
+          array_push($course_id["code"], $course->code);
829 897
         }
830 898
       } else {
831
-        $course_id = array($course_id);
899
+
900
+        $parentesis = array('(', ')');
901
+        $course_code_number = str_replace($parentesis, '', $course_id);
902
+
903
+        $course_code_number = explode(',', $course_code_number);
904
+
905
+        $course_id = array();
906
+        $course_id['number'] = $course_code_number[1];
907
+        $course_id['code'] = $course_code_number[0];
832 908
       }
833 909
       // if outcome isnt a desired filter, search all outcomes
834 910
       if ($outcome_id == 0) {
835 911
         $outcomes = DB::table('transformative_actions')
836
-          ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
837
-          ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
838
-          ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
912
+          ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
913
+          ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
914
+          ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
839 915
           ->where('transformative_actions.is_custom', 1)
840 916
           ->where('transformative_actions.program_id', $program_id)
841 917
           ->where('transformative_actions.by_professor', 0)
@@ -853,14 +929,15 @@ class TransformativeActionsController extends \BaseController
853 929
       // search TA with filters
854 930
       $filtered_at = DB::table('transformative_actions')
855 931
         ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
856
-        ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
857
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
932
+        ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
933
+        ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
858 934
         ->where('transformative_actions.is_custom', 1)
859 935
         ->where('transformative_actions.program_id', $program_id)
860 936
         ->where('transformative_actions.by_professor', 0)
861 937
         ->whereIn('transformative_actions.user_id', $professor_id)
862
-        ->whereIn('criterion_objective_outcome.outcome_id', $outcome_id)
863
-        ->whereIn('ta_course.course_id', $course_id)
938
+        ->whereIn('objective_outcome.outcome_id', $outcome_id)
939
+        ->whereIn('ta_course.course_code', $course_id['code'])
940
+        ->whereIn('ta_course.course_number', $course_id['number'])
864 941
         ->select('transformative_actions.*')
865 942
         ->groupBy('transformative_actions.id')
866 943
         ->orderBy('transformative_actions.at_text', 'ASC')
@@ -879,22 +956,32 @@ class TransformativeActionsController extends \BaseController
879 956
           ->where('transformative_actions.is_custom', 1)
880 957
           ->where('transformative_actions.program_id', $program_id)
881 958
           ->where('transformative_actions.by_professor', 1)
882
-          ->select('courses.id')
959
+          ->select('ta_course.course_number', 'ta_course.course_code')
960
+          ->distinct()
883 961
           ->get();
884 962
 
885 963
         $course_id = array();
886 964
         foreach ($courses as $key => $course) {
887
-          array_push($course_id, $course->id);
965
+          array_push($course_id["number"], $course->course_number);
966
+          array_push($course_id["code"], $course->code);
888 967
         }
889 968
       } else {
890
-        $course_id = array($course_id);
969
+
970
+        $parentesis = array('(', ')');
971
+        $course_code_number = str_replace($parentesis, '', $course_id);
972
+
973
+        $course_code_number = explode(',', $course_code_number);
974
+
975
+        $course_id = array();
976
+        $course_id['number'] = $course_code_number[1];
977
+        $course_id['code'] = $course_code_number[0];
891 978
       }
892 979
       // if outcome isnt a desired filter, search all outcomes
893 980
       if ($outcome_id == 0) {
894 981
         $outcomes = DB::table('transformative_actions')
895
-          ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
896
-          ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
897
-          ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
982
+          ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
983
+          ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
984
+          ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
898 985
           ->where('transformative_actions.user_id', Auth::user()->id)
899 986
           ->where('transformative_actions.is_custom', 1)
900 987
           ->where('transformative_actions.program_id', $program_id)
@@ -913,14 +1000,15 @@ class TransformativeActionsController extends \BaseController
913 1000
       // search TA with filters
914 1001
       $filtered_at = DB::table('transformative_actions')
915 1002
         ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
916
-        ->join('transformative_objective_course', 'transformative_objective_course.ta_id', '=', 'transformative_actions.id')
917
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective_course.objective_id')
1003
+        ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
1004
+        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
918 1005
         ->where('transformative_actions.user_id', Auth::user()->id)
919 1006
         ->where('transformative_actions.is_custom', 1)
920 1007
         ->where('transformative_actions.program_id', $program_id)
921 1008
         ->where('transformative_actions.by_professor', 1)
922 1009
         ->whereIn('criterion_objective_outcome.outcome_id', $outcome_id)
923
-        ->whereIn('ta_course.course_id', $course_id)
1010
+        ->whereIn('ta_course.course_code', $course_id['code'])
1011
+        ->whereIn('ta_course.course_number', $course_id['number'])
924 1012
         ->select('transformative_actions.*')
925 1013
         ->groupBy('transformative_actions.id')
926 1014
         ->orderBy('transformative_actions.at_text', 'ASC')
@@ -933,6 +1021,12 @@ class TransformativeActionsController extends \BaseController
933 1021
   function postActivityCriterion($activity_id)
934 1022
   {
935 1023
     DB::beginTransaction();
1024
+
1025
+    $existing_transformative_action = DB::table('transformative_actions')
1026
+      ->join('transformative_activity_criterion', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
1027
+      ->join('activity_criterion', 'activity_criterion.id', '=', 'transformative_activity_criterion.activity_criterion_id')
1028
+      ->where('activity_id', $activity_id)
1029
+      ->delete();
936 1030
     $activity_criterion = Input::get('trans_act');
937 1031
 
938 1032
     $trans = new TransformativeAction;
@@ -949,8 +1043,19 @@ class TransformativeActionsController extends \BaseController
949 1043
     $trans->at_text = Input::get('name_trans');
950 1044
     $trans->description = Input::get('transforming_actions');
951 1045
 
1046
+    $activity = DB::table('activities')
1047
+      ->where('id', $activity_id)
1048
+      ->first();
1049
+    $course_credentials = DB::table('courses')
1050
+      ->where('id', $activity->course_id)
1051
+      ->first();
1052
+
1053
+
952 1054
     if ($trans->save()) {
953 1055
 
1056
+
1057
+
1058
+
954 1059
       foreach ($activity_criterion as $single_ac) {
955 1060
         $result = DB::insert("insert into `transformative_activity_criterion` (`trans_action_id`, `activity_criterion_id`) values ($trans->id, $single_ac)");
956 1061
         if (!$result) {
@@ -961,6 +1066,35 @@ class TransformativeActionsController extends \BaseController
961 1066
           return Redirect::to("professor/activities/{$activity_id}");
962 1067
         }
963 1068
       }
1069
+      $criteria = DB::table('activity_criterion')
1070
+        ->whereIn('id', $activity_criterion)
1071
+        ->lists('criterion_id');
1072
+
1073
+      $allObjectives = DB::table('criterion_objective_outcome')
1074
+        ->whereIn('criterion_id', $criteria)
1075
+        ->select('objective_id')
1076
+        ->distinct()
1077
+        ->lists('objective_id');
1078
+
1079
+
1080
+      foreach ($allObjectives as $objective) {
1081
+        $result2 = DB::insert("insert into `transformative_objective` (`ta_id`, `objective_id`) values ({$trans->id},{$objective})");
1082
+        if (!$result2) {
1083
+          DB::rollback();
1084
+          Session::flash('status', 'danger');
1085
+          Session::flash('message', 'Error saving Transforming Action. Try again later.');
1086
+
1087
+          return Redirect::to("professor/activities/{$activity_id}");
1088
+        }
1089
+      }
1090
+      $result3 = DB::insert("insert into `ta_course` (`ta_id`, `course_number`, `course_code`) values ({$trans->id}, '{$course_credentials->number}', '{$course_credentials->code}')");
1091
+
1092
+      if (!($result3)) {
1093
+        DB::rollback();
1094
+        Session::flash('status', 'danger');
1095
+        Session::flash('message', 'Error saving Transforming Action. Try again later.');
1096
+        return Redirect::to("professor/activities/{$activity_id}");
1097
+      }
964 1098
       DB::commit();
965 1099
       Session::flash('status', 'success');
966 1100
       Session::flash('message', 'Transformative Actions Saved.');

app/database/migrations/2021_06_06_001211_create_transformative_objective_course_table.php → app/database/migrations/2021_06_06_001211_create_transformative_objective_table.php Целия файл

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

+ 2
- 6
app/database/migrations/2021_06_14_000848_create_ta_course_table.php Целия файл

@@ -18,12 +18,8 @@ class CreateTaCourseTable extends Migration
18 18
 				->onDelete('cascade')
19 19
 				->onUpdate('cascade');
20 20
 
21
-			$table->integer('course_id')->unsigned();
22
-			$table->foreign('course_id')
23
-				->references('id')
24
-				->on('courses')
25
-				->onDelete('cascade')
26
-				->onUpdate('cascade');
21
+			$table->string('course_number');
22
+			$table->string('course_code');
27 23
 		});
28 24
 	}
29 25
 

app/database/old_migrations/2014_10_05_052350_create_schools_table.php → app/database/unusedMigrations/old_migrations/2014_10_05_052350_create_schools_table.php Целия файл


app/database/old_migrations/2014_10_05_055013_create_programs_table.php → app/database/unusedMigrations/old_migrations/2014_10_05_055013_create_programs_table.php Целия файл


app/database/old_migrations/2014_10_06_050335_create_users_table.php → app/database/unusedMigrations/old_migrations/2014_10_06_050335_create_users_table.php Целия файл


app/database/old_migrations/2014_10_12_100000_create_password_resets_table.php → app/database/unusedMigrations/old_migrations/2014_10_12_100000_create_password_resets_table.php Целия файл


app/database/old_migrations/2014_11_10_035949_create_rubrics_table.php → app/database/unusedMigrations/old_migrations/2014_11_10_035949_create_rubrics_table.php Целия файл


app/database/old_migrations/2014_11_29_210957_create_templates_table.php → app/database/unusedMigrations/old_migrations/2014_11_29_210957_create_templates_table.php Целия файл


app/database/old_migrations/2014_11_29_211309_create_courses_table.php → app/database/unusedMigrations/old_migrations/2014_11_29_211309_create_courses_table.php Целия файл


app/database/old_migrations/2014_11_29_211310_create_activities_table.php → app/database/unusedMigrations/old_migrations/2014_11_29_211310_create_activities_table.php Целия файл


app/database/old_migrations/2014_11_29_212240_create_outcomes_table.php → app/database/unusedMigrations/old_migrations/2014_11_29_212240_create_outcomes_table.php Целия файл


app/database/old_migrations/2014_11_29_212341_create_criteria_table.php → app/database/unusedMigrations/old_migrations/2014_11_29_212341_create_criteria_table.php Целия файл


app/database/old_migrations/2014_11_29_214028_create_semesters_table.php → app/database/unusedMigrations/old_migrations/2014_11_29_214028_create_semesters_table.php Целия файл


app/database/old_migrations/2014_11_30_134022_create_students_table.php → app/database/unusedMigrations/old_migrations/2014_11_30_134022_create_students_table.php Целия файл


app/database/old_migrations/2014_12_07_214036_create_course_student_table.php → app/database/unusedMigrations/old_migrations/2014_12_07_214036_create_course_student_table.php Целия файл


app/database/old_migrations/2015_01_09_171350_create_assessments_table.php → app/database/unusedMigrations/old_migrations/2015_01_09_171350_create_assessments_table.php Целия файл


app/database/old_migrations/2015_01_12_204310_add_columns_to_activities_table.php → app/database/unusedMigrations/old_migrations/2015_01_12_204310_add_columns_to_activities_table.php Целия файл


app/database/old_migrations/2015_01_12_222859_add_columns_to_assessments_table.php → app/database/unusedMigrations/old_migrations/2015_01_12_222859_add_columns_to_assessments_table.php Целия файл


app/database/old_migrations/2015_01_13_010052_add_index_to_assessments_table.php → app/database/unusedMigrations/old_migrations/2015_01_13_010052_add_index_to_assessments_table.php Целия файл


app/database/old_migrations/2015_01_13_142849_add_column_to_criteria_table.php → app/database/unusedMigrations/old_migrations/2015_01_13_142849_add_column_to_criteria_table.php Целия файл


app/database/old_migrations/2015_01_14_140724_add_columns_to_courses_table.php → app/database/unusedMigrations/old_migrations/2015_01_14_140724_add_columns_to_courses_table.php Целия файл


app/database/old_migrations/2015_01_21_124809_add_column_to_courses_table.php → app/database/unusedMigrations/old_migrations/2015_01_21_124809_add_column_to_courses_table.php Целия файл


app/database/old_migrations/2015_01_22_195515_add_column_to_templates_table.php → app/database/unusedMigrations/old_migrations/2015_01_22_195515_add_column_to_templates_table.php Целия файл


app/database/old_migrations/2015_01_23_175455_remove_total_from_assessments_table.php → app/database/unusedMigrations/old_migrations/2015_01_23_175455_remove_total_from_assessments_table.php Целия файл


app/database/old_migrations/2015_01_23_175923_rename_average_in_assessments_table.php → app/database/unusedMigrations/old_migrations/2015_01_23_175923_rename_average_in_assessments_table.php Целия файл


app/database/old_migrations/2015_01_28_121848_add_index_to_course_student_table.php → app/database/unusedMigrations/old_migrations/2015_01_28_121848_add_index_to_course_student_table.php Целия файл


app/database/old_migrations/2015_01_28_133036_add_criteria_achieved_count_to_activities_table.php → app/database/unusedMigrations/old_migrations/2015_01_28_133036_add_criteria_achieved_count_to_activities_table.php Целия файл


app/database/old_migrations/2015_02_05_133245_add_transforming_actions_to_activities_table.php → app/database/unusedMigrations/old_migrations/2015_02_05_133245_add_transforming_actions_to_activities_table.php Целия файл


app/database/old_migrations/2015_02_05_143641_add_assessment_comments_to_activities_table.php → app/database/unusedMigrations/old_migrations/2015_02_05_143641_add_assessment_comments_to_activities_table.php Целия файл


app/database/old_migrations/2015_02_06_145359_create_password_reminders_table.php → app/database/unusedMigrations/old_migrations/2015_02_06_145359_create_password_reminders_table.php Целия файл


app/database/old_migrations/2015_02_19_143311_add_is_graduate_to_programs_table.php → app/database/unusedMigrations/old_migrations/2015_02_19_143311_add_is_graduate_to_programs_table.php Целия файл


app/database/old_migrations/2015_02_25_170516_add_deleted_at_to_outcomes_table.php → app/database/unusedMigrations/old_migrations/2015_02_25_170516_add_deleted_at_to_outcomes_table.php Целия файл


app/database/old_migrations/2015_02_25_170529_add_deleted_at_to_criteria_table.php → app/database/unusedMigrations/old_migrations/2015_02_25_170529_add_deleted_at_to_criteria_table.php Целия файл


app/database/old_migrations/2015_02_27_201953_add_criteria_achieved_percentage_to_activities_table.php → app/database/unusedMigrations/old_migrations/2015_02_27_201953_add_criteria_achieved_percentage_to_activities_table.php Целия файл


app/database/old_migrations/2015_03_04_132321_add_copyright_and_notes_to_criteria_table.php → app/database/unusedMigrations/old_migrations/2015_03_04_132321_add_copyright_and_notes_to_criteria_table.php Целия файл


app/database/old_migrations/2015_04_13_183730_add_program_id_to_templates_table.php → app/database/unusedMigrations/old_migrations/2015_04_13_183730_add_program_id_to_templates_table.php Целия файл


app/database/old_migrations/2015_04_28_141931_add_is_visible_to_templates_table.php → app/database/unusedMigrations/old_migrations/2015_04_28_141931_add_is_visible_to_templates_table.php Целия файл


app/database/old_migrations/2015_05_04_162918_remove_expected_outcome_from_outcomes_table.php → app/database/unusedMigrations/old_migrations/2015_05_04_162918_remove_expected_outcome_from_outcomes_table.php Целия файл


app/database/old_migrations/2015_05_05_083800_add_decimal_expected_outcome_to_outcomes_table.php → app/database/unusedMigrations/old_migrations/2015_05_05_083800_add_decimal_expected_outcome_to_outcomes_table.php Целия файл


app/database/old_migrations/2015_05_18_095002_add_first_login_to_users_table.php → app/database/unusedMigrations/old_migrations/2015_05_18_095002_add_first_login_to_users_table.php Целия файл


app/database/old_migrations/2015_05_18_131259_add_columns_to_semesters_table.php → app/database/unusedMigrations/old_migrations/2015_05_18_131259_add_columns_to_semesters_table.php Целия файл


app/database/old_migrations/2015_05_18_134926_add_semester_id_to_courses.php → app/database/unusedMigrations/old_migrations/2015_05_18_134926_add_semester_id_to_courses.php Целия файл


app/database/old_migrations/2015_06_10_092319_add_name_to_semesters_table.php → app/database/unusedMigrations/old_migrations/2015_06_10_092319_add_name_to_semesters_table.php Целия файл


app/database/old_migrations/2015_06_12_085247_add_visibility_to_semesters_table.php → app/database/unusedMigrations/old_migrations/2015_06_12_085247_add_visibility_to_semesters_table.php Целия файл


app/database/old_migrations/2015_06_16_092223_add_has_access_to_users.php → app/database/unusedMigrations/old_migrations/2015_06_16_092223_add_has_access_to_users.php Целия файл


app/database/old_migrations/2015_06_18_103255_add_expected_percentage_and_points_to_templates_table.php → app/database/unusedMigrations/old_migrations/2015_06_18_103255_add_expected_percentage_and_points_to_templates_table.php Целия файл


app/database/old_migrations/2015_07_10_150430_add_email_to_students_table.php → app/database/unusedMigrations/old_migrations/2015_07_10_150430_add_email_to_students_table.php Целия файл


app/database/old_migrations/2015_07_13_111726_add_code_to_programs_table.php → app/database/unusedMigrations/old_migrations/2015_07_13_111726_add_code_to_programs_table.php Целия файл


app/database/old_migrations/2015_07_13_132620_add_ssn_and_employee_number_to_users_table.php → app/database/unusedMigrations/old_migrations/2015_07_13_132620_add_ssn_and_employee_number_to_users_table.php Целия файл


app/database/old_migrations/2015_08_19_130733_add_semester_id_to_course_student_table.php → app/database/unusedMigrations/old_migrations/2015_08_19_130733_add_semester_id_to_course_student_table.php Целия файл


app/database/old_migrations/2015_12_10_145451_add_criteria_weights_to_activities_table.php → app/database/unusedMigrations/old_migrations/2015_12_10_145451_add_criteria_weights_to_activities_table.php Целия файл


app/database/old_migrations/2016_01_12_132034_add_program_id_to_criteria_table.php → app/database/unusedMigrations/old_migrations/2016_01_12_132034_add_program_id_to_criteria_table.php Целия файл


app/database/old_migrations/2016_01_27_093808_add_date_to_activities_table.php → app/database/unusedMigrations/old_migrations/2016_01_27_093808_add_date_to_activities_table.php Целия файл


app/database/old_migrations/2016_01_27_134306_add_draft_to_activities_table.php → app/database/unusedMigrations/old_migrations/2016_01_27_134306_add_draft_to_activities_table.php Целия файл


app/database/old_migrations/2016_03_11_085258_add_school_and_concentration_codes_to_students_table.php → app/database/unusedMigrations/old_migrations/2016_03_11_085258_add_school_and_concentration_codes_to_students_table.php Целия файл


app/database/old_migrations/2016_05_09_145427_create_program_user_table.php → app/database/unusedMigrations/old_migrations/2016_05_09_145427_create_program_user_table.php Целия файл


app/database/old_migrations/2016_05_10_091847_remove_program_id_from_users_table.php → app/database/unusedMigrations/old_migrations/2016_05_10_091847_remove_program_id_from_users_table.php Целия файл


app/database/old_migrations/2016_05_23_153434_create_objectives_table.php → app/database/unusedMigrations/old_migrations/2016_05_23_153434_create_objectives_table.php Целия файл


app/database/old_migrations/2016_05_25_090412_add_active_to_objectives_table.php → app/database/unusedMigrations/old_migrations/2016_05_25_090412_add_active_to_objectives_table.php Целия файл


app/database/old_migrations/2016_05_26_092328_create_criterion_objective_table.php → app/database/unusedMigrations/old_migrations/2016_05_26_092328_create_criterion_objective_table.php Целия файл


app/database/old_migrations/2016_07_15_084546_create_quinquenniums_table.php → app/database/unusedMigrations/old_migrations/2016_07_15_084546_create_quinquenniums_table.php Целия файл


app/database/old_migrations/2016_07_15_084751_create_five_year_plans_table.php → app/database/unusedMigrations/old_migrations/2016_07_15_084751_create_five_year_plans_table.php Целия файл


app/database/old_migrations/2016_07_15_090133_create_fyp_parts_table.php → app/database/unusedMigrations/old_migrations/2016_07_15_090133_create_fyp_parts_table.php Целия файл


app/database/old_migrations/2016_07_15_090203_create_fyp_part_outcomes_table.php → app/database/unusedMigrations/old_migrations/2016_07_15_090203_create_fyp_part_outcomes_table.php Целия файл


app/database/old_migrations/2016_08_03_120016_remove_methods_from_fyp_part_outcomes_table.php → app/database/unusedMigrations/old_migrations/2016_08_03_120016_remove_methods_from_fyp_part_outcomes_table.php Целия файл


app/database/old_migrations/2016_08_03_140525_add_unique_index_to_five_year_plans_table.php → app/database/unusedMigrations/old_migrations/2016_08_03_140525_add_unique_index_to_five_year_plans_table.php Целия файл


app/database/old_migrations/2016_08_11_150848_remove_semester_id_from_annual_plans_table.php → app/database/unusedMigrations/old_migrations/2016_08_11_150848_remove_semester_id_from_annual_plans_table.php Целия файл


app/database/old_migrations/2016_08_11_151247_add_year_start_and_year_end_to_annual_plans_table.php → app/database/unusedMigrations/old_migrations/2016_08_11_151247_add_year_start_and_year_end_to_annual_plans_table.php Целия файл


app/database/old_migrations/2017_02_03_150052_add_comments_to_assessments_table.php → app/database/unusedMigrations/old_migrations/2017_02_03_150052_add_comments_to_assessments_table.php Целия файл


app/database/old_migrations/2018_02_12_144827_add_subcriteria_to_criteria_table.php → app/database/unusedMigrations/old_migrations/2018_02_12_144827_add_subcriteria_to_criteria_table.php Целия файл


app/database/old_migrations/2018_07_26_132933_add_last_login_to_users_table.php → app/database/unusedMigrations/old_migrations/2018_07_26_132933_add_last_login_to_users_table.php Целия файл


app/database/old_migrations/2018_07_26_134316_add_phone_numbers_and_extension_to_users_table.php → app/database/unusedMigrations/old_migrations/2018_07_26_134316_add_phone_numbers_and_extension_to_users_table.php Целия файл


app/database/old_migrations/2018_08_09_110432_remove_password_from_users_table.php → app/database/unusedMigrations/old_migrations/2018_08_09_110432_remove_password_from_users_table.php Целия файл


app/database/old_migrations/2018_08_09_110813_remove_password_updated_and_remember_token_from_users_table.php → app/database/unusedMigrations/old_migrations/2018_08_09_110813_remove_password_updated_and_remember_token_from_users_table.php Целия файл


app/database/old_migrations/2018_08_10_083743_add_remember_token_to_users_table.php → app/database/unusedMigrations/old_migrations/2018_08_10_083743_add_remember_token_to_users_table.php Целия файл


app/database/old_migrations/2018_08_28_140328_remove_outcome_id_from_objectives_table.php → app/database/unusedMigrations/old_migrations/2018_08_28_140328_remove_outcome_id_from_objectives_table.php Целия файл


app/database/old_migrations/2018_08_28_141547_drop_criterion_objective_table.php → app/database/unusedMigrations/old_migrations/2018_08_28_141547_drop_criterion_objective_table.php Целия файл


app/database/old_migrations/2018_08_28_142111_create_objective_outcome_table.php → app/database/unusedMigrations/old_migrations/2018_08_28_142111_create_objective_outcome_table.php Целия файл


app/database/old_migrations/2018_09_13_134104_entrust_setup_tables.php → app/database/unusedMigrations/old_migrations/2018_09_13_134104_entrust_setup_tables.php Целия файл


app/database/old_migrations/2019_08_07_100303_add_participants_achievers_counts_to_activities_table.php → app/database/unusedMigrations/old_migrations/2019_08_07_100303_add_participants_achievers_counts_to_activities_table.php Целия файл


app/database/old_migrations/2020_03_06_122426_create_participating_programs_view.php → app/database/unusedMigrations/old_migrations/2020_03_06_122426_create_participating_programs_view.php Целия файл


app/database/old_migrations/2020_04_04_002657_create_new_criteria_table.php → app/database/unusedMigrations/old_migrations/2020_04_04_002657_create_new_criteria_table.php Целия файл


app/database/old_migrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php → app/database/unusedMigrations/old_migrations/2020_04_04_005817_add_outcome_id_to_objectives_table.php Целия файл


app/database/old_migrations/2020_04_22_090200_alter_activities_table.php → app/database/unusedMigrations/old_migrations/2020_04_22_090200_alter_activities_table.php Целия файл


app/database/old_migrations/2020_04_22_095649_create_new_criterion_rubric_table.php → app/database/unusedMigrations/old_migrations/2020_04_22_095649_create_new_criterion_rubric_table.php Целия файл


app/database/old_migrations/2020_04_22_101110_create_new_rubric_activity_table.php → app/database/unusedMigrations/old_migrations/2020_04_22_101110_create_new_rubric_activity_table.php Целия файл


app/database/old_migrations/2020_05_15_123430_create_new_outcomes_table.php → app/database/unusedMigrations/old_migrations/2020_05_15_123430_create_new_outcomes_table.php Целия файл


app/database/old_migrations/2020_05_15_123902_add_mapping_columns_to_outcomes_table.php → app/database/unusedMigrations/old_migrations/2020_05_15_123902_add_mapping_columns_to_outcomes_table.php Целия файл


app/database/old_migrations/2020_10_04_142756_create_new_assessments_table.php → app/database/unusedMigrations/old_migrations/2020_10_04_142756_create_new_assessments_table.php Целия файл


app/database/old_migrations/2020_10_05_124915_create_activity_criterion_table.php → app/database/unusedMigrations/old_migrations/2020_10_05_124915_create_activity_criterion_table.php Целия файл


app/database/old_migrations/2020_10_05_130252_add_max_score_num_scales_new_criteria_table.php → app/database/unusedMigrations/old_migrations/2020_10_05_130252_add_max_score_num_scales_new_criteria_table.php Целия файл


app/database/old_migrations/2020_10_05_142424_create_scales_table.php → app/database/unusedMigrations/old_migrations/2020_10_05_142424_create_scales_table.php Целия файл


app/database/old_migrations/2020_10_05_142912_create_criterion_scale_table.php → app/database/unusedMigrations/old_migrations/2020_10_05_142912_create_criterion_scale_table.php Целия файл


app/database/old_migrations/2020_10_05_232429_add_assessment_comments_to_activity_criterion.php → app/database/unusedMigrations/old_migrations/2020_10_05_232429_add_assessment_comments_to_activity_criterion.php Целия файл


app/database/old_migrations/2020_10_09_131800_add_level_activation_date_to_outcomes.php → app/database/unusedMigrations/old_migrations/2020_10_09_131800_add_level_activation_date_to_outcomes.php Целия файл


app/database/old_migrations/2020_10_16_190923_create_criterion_objective_outcome_table.php → app/database/unusedMigrations/old_migrations/2020_10_16_190923_create_criterion_objective_outcome_table.php Целия файл


app/database/old_migrations/2020_10_18_145108_create_outcome_performance_table.php → app/database/unusedMigrations/old_migrations/2020_10_18_145108_create_outcome_performance_table.php Целия файл


Някои файлове не бяха показани, защото твърде много файлове са промени