Pārlūkot izejas kodu

creo que ahora si

Gabriel Santiago Plaza 3 gadus atpakaļ
vecāks
revīzija
0a9acbc46d

app/controllers/.gitkeep → app/.gitkeep Parādīt failu


+ 16
- 11
app/controllers/AnnualPlansController.php Parādīt failu

@@ -134,12 +134,13 @@ class AnnualPlansController extends \BaseController
134 134
     $title = "Annual Plans";
135 135
     //$typ_parts = DB::select("select * from typ_parts");
136 136
     if (!$typ_id) {
137
-      $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0]->id;
137
+      $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0];
138 138
     } else {
139
-      $current_typ = DB::select("select * from three_year_plan where id ={$typ_id}")[0]->id;
139
+      $current_typ = DB::select("select * from three_year_plan where id ={$typ_id}")[0];
140 140
     }
141 141
     Log::info($current_typ);
142 142
 
143
+
143 144
     $program = Program::where('id', '=', $program_id)->first();
144 145
     $annual_plans = DB::select("select * from annual_plans where program_id = {$program_id} order by id desc limit 5");
145 146
     Log::info($annual_plans);
@@ -147,13 +148,13 @@ class AnnualPlansController extends \BaseController
147 148
     $allSemesterOrder = array();
148 149
     foreach ($annual_plans as $an_plan) {
149 150
       Log::info($an_plan->id);
150
-      $outcomes[$an_plan->id]["first"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id ={$current_typ} ))");
151
+      $outcomes[$an_plan->id]["first"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id ={$current_typ->id} ))");
151 152
       $allSemesterOrder[$an_plan->id]["first"] = DB::select("select * from semesters where id = {$an_plan->semester_start}")[0];
152
-      $outcomes[$an_plan->id]["second"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id ={$an_plan->semester_end} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id = {$current_typ} ))");
153
+      $outcomes[$an_plan->id]["second"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id ={$an_plan->semester_end} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id = {$current_typ->id} ))");
153 154
       $allSemesterOrder[$an_plan->id]["second"] = DB::select("select * from semesters where id = {$an_plan->semester_end}")[0];
154 155
     }
155 156
     $alltyp = DB::select('select * from three_year_plan order by id desc');
156
-
157
+    $current_typ = $current_typ->id;
157 158
     return View::make('local.managers.sCoords.annual-plans', compact('title', 'annual_plans', 'current_typ', 'program', 'outcomes', 'allSemesterOrder', 'alltyp'));
158 159
   }
159 160
 
@@ -256,14 +257,18 @@ class AnnualPlansController extends \BaseController
256 257
     foreach ($transformative_action_info as $trans) {
257 258
       $json_to_send['Trans_act'][$trans->id] = $trans;
258 259
       $json_to_send['outcomes'][$trans->id] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where id in(select typ_semester_outcome_id from typ_semester_objectives where id in (select typ_semester_objective_id from annual_plan_transformative where trans_id ={$trans->id} and annual_plan_id = {$annual_id})))");
259
-      $json_to_send['typ_objective'][$trans->id] = DB::select("select * from typ_semester_objectives where id in (select typ_semester_objective_id from annual_plan_transformative where annual_plan_id ={$annual_id} and trans_id = {$trans->id})");
260
-      foreach ($json_to_send['typ_objective'][$trans->id] as $typ) {
261
-        $json_to_send['objective'][$typ->id][$trans->id] = DB::select("select * from objectives where id = {$typ->objective_id}");
262
-        $json_to_send['coordinator'][$typ->id][$trans->id] = DB::select("select * from users where id in (select proposing_coordinator_id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id})");
263
-        $json_to_send['proposed_date'][$typ->id][$trans->id] = DB::select("select proposed_date from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ");
264
-        $json_to_send['all_info_report'][$typ->id][$trans->id] = DB::select("select art.accomplished, art.cycle_of_life, semesters.name, art.semester_continue,  art.annual_trans_id, art.supervised_coordinator_id  from annual_report_transformative art, (select id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ) apt, semesters  where art.annual_trans_id = apt.id and semesters.id = art.semester_used");
260
+
261
+      foreach ($json_to_send['outcomes'][$trans->id] as $outcome) {
262
+        $json_to_send['typ_objective'][$outcome->id][$trans->id] = DB::select("select * from typ_semester_objectives where typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id ={$outcome->id}) and id in (select typ_semester_objective_id from annual_plan_transformative where annual_plan_id ={$annual_id} and trans_id = {$trans->id})");
263
+        foreach ($json_to_send['typ_objective'][$outcome->id][$trans->id] as $typ) {
264
+          $json_to_send['objective'][$outcome->id][$typ->id][$trans->id] = DB::select("select * from objectives where id = {$typ->objective_id}");
265
+          $json_to_send['coordinator'][$outcome->id][$typ->id][$trans->id] = DB::select("select * from users where id in (select proposing_coordinator_id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id})");
266
+          $json_to_send['proposed_date'][$outcome->id][$typ->id][$trans->id] = DB::select("select proposed_date from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ");
267
+          $json_to_send['all_info_report'][$outcome->id][$typ->id][$trans->id] = DB::select("select art.accomplished, art.cycle_of_life, semesters.name, art.semester_continue,  art.annual_trans_id, art.supervised_coordinator_id  from annual_report_transformative art, (select id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ) apt, semesters  where art.annual_trans_id = apt.id and semesters.id = art.semester_used");
268
+        }
265 269
       }
266 270
 
271
+
267 272
       if ($trans->user_id) {
268 273
         $json_to_send['suggested'][$trans->id] = DB::select("select * from users where id = {$trans->user_id}");
269 274
       }

+ 1
- 1
app/controllers/Objective2Controller.php Parādīt failu

@@ -93,7 +93,7 @@ class Objective2Controller extends \BaseController
93 93
 		}
94 94
 
95 95
 		$clean_input['program_id'] = Input::get('program_id');
96
-
96
+		Log::info(Input::get('program_id'));
97 97
 
98 98
 		return $clean_input;
99 99
 	}

+ 238
- 221
app/controllers/ThreeYearPlanController.php Parādīt failu

@@ -7,63 +7,54 @@ class ThreeYearPlanController extends \BaseController
7 7
 
8 8
   public function threeYearsReport()
9 9
   {
10
-      $user_id = auth::user()->id;
10
+    $user_id = auth::user()->id;
11 11
 
12
-      // el ID de los semestres que el usuario tiene seleccionado.
13
-      $semesters_ids = Session::get('semesters_ids');
14
-      // buscar informacion de los semestres seleccionados
15
-      $semesters = Semester::whereIn('id',$semesters_ids)->get();
12
+    // el ID de los semestres que el usuario tiene seleccionado.
13
+    $semesters_ids = Session::get('semesters_ids');
14
+    // buscar informacion de los semestres seleccionados
15
+    $semesters = Semester::whereIn('id', $semesters_ids)->get();
16 16
 
17
-      $title = "Three Year Plans Planning";
18
-      $outcomes = Outcome::orderBy('name', 'ASC')
19
-          ->where('deactivation_date','=','0000-00-00')
20
-          ->orWhereNull('deactivation_date')
21
-          ->get();
22
-      // $outcomes = DB::table('outcomes')
23
-      //     ->orderBy('name', 'asc')
24
-      //     ->get();
25
-      $typs = DB::table('three_year_plan')
26
-          ->orderBy('year_start', 'asc')
27
-          ->get();
28
-      $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
29
-      // $criteria = DB::table('criteria')
30
-      //     ->orderBy('name', 'asc')
31
-      //     ->get();
32
-      $program_id = DB::table('program_user')
33
-      ->where('user_id',$user_id)
34
-      // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
17
+    $title = "Three Year Plans Planning";
18
+    $outcomes = Outcome::orderBy('name', 'ASC')
19
+      ->where('deactivation_date', '=', '0000-00-00')
20
+      ->orWhereNull('deactivation_date')
21
+      ->get();
22
+    $typs = DB::table('three_year_plan')
23
+      ->orderBy('year_start', 'asc')
24
+      ->get();
25
+    $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
26
+    $program_id = DB::table('program_user')
27
+      ->where('user_id', $user_id)
35 28
       ->select('program_id')
36 29
       ->get();
37
-      $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
38
-
39
-      // se annadio la nueva variable
40
-      return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
30
+    $program_id = $program_id[0]->program_id;
41 31
 
32
+    // se annadio la nueva variable
33
+    return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
42 34
   }
43 35
 
44 36
 
45 37
   public function fetchThreeYears()
46 38
   {
47
-      $id = Input::get('id');
39
+    $id = Input::get('id');
48 40
 
49
-      $semesters = DB::table('typ_semesters')
50
-          ->join('semesters','semesters.id','=','typ_semesters.semester_id')
51
-          ->where('typ_semesters.typ_id',$id)
52
-          // ->select('semesters.*')
53
-          ->orderBy('typ_semesters.semester_id', 'asc')
54
-          ->get();
55
-      $typs = DB::table('three_year_plan')
56
-          ->where('id',$id)
57
-          ->orderBy('year_start', 'asc')
58
-          ->get();
41
+    $semesters = DB::table('typ_semesters')
42
+      ->join('semesters', 'semesters.id', '=', 'typ_semesters.semester_id')
43
+      ->where('typ_semesters.typ_id', $id)
44
+      // ->select('semesters.*')
45
+      ->orderBy('typ_semesters.semester_id', 'asc')
46
+      ->get();
47
+    $typs = DB::table('three_year_plan')
48
+      ->where('id', $id)
49
+      ->orderBy('year_start', 'asc')
50
+      ->get();
59 51
 
60
-      $typs  = $typs[0];
61
-      $typs->semesters = $semesters;
52
+    $typs  = $typs[0];
53
+    $typs->semesters = $semesters;
62 54
 
63
-      return array
64
-      (
65
-          'typ' => $typs,
66
-      );
55
+    return array(
56
+      'typ' => $typs,
57
+    );
67 58
   }
68 59
 
69 60
   public function update_typ_outcomes_semesters()
@@ -71,25 +62,26 @@ class ThreeYearPlanController extends \BaseController
71 62
     $outcomeSemesterArray = json_decode(Input::get('outcomeSemesterArray'), true);
72 63
     $typ_id = Input::get('typ_id');
73 64
 
74
-    $user_id = auth::user()->id; //ya, tester es 60
65
+    $user_id = auth::user()->id;
75 66
     $program_id = DB::table('program_user')
76
-    ->where('user_id',$user_id)
77
-    // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
78
-    ->select('program_id')
79
-    ->get();
80
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
67
+      ->where('user_id', $user_id)
68
+      ->select('program_id')
69
+      ->get();
70
+    $program_id = $program_id[0]->program_id;
81 71
 
82 72
 
83 73
     $result = DB::table('typ_program')
84
-        ->where('three_year_plan_id',$typ_id)
85
-        ->where('program_id',$program_id)
86
-        ->get();
74
+      ->where('three_year_plan_id', $typ_id)
75
+      ->where('program_id', $program_id)
76
+      ->get();
87 77
 
88 78
     // create the relation if it doesnt exist
89
-    if(count($result) == 0){
79
+    if (count($result) == 0) {
90 80
       $typ_program_id = DB::table('typ_program')->insertGetId(
91
-          array('three_year_plan_id' => $typ_id,
92
-                'program_id' => $program_id)
81
+        array(
82
+          'three_year_plan_id' => $typ_id,
83
+          'program_id' => $program_id
84
+        )
93 85
       );
94 86
     } else {
95 87
       $typ_program_id = $result[0]->id;
@@ -104,35 +96,36 @@ class ThreeYearPlanController extends \BaseController
104 96
       foreach ($outcome_semester["semesters"] as $semester) {
105 97
         $insert = $semester[1];
106 98
 
107
-        $outcome_id = explode("-sem",$semester[0])[0];
99
+        $outcome_id = explode("-sem", $semester[0])[0];
108 100
 
109
-        $semester_code = explode("-sem",$semester[0])[1];
101
+        $semester_code = explode("-sem", $semester[0])[1];
110 102
         $result = DB::table('semesters')
111
-            ->where('code',$semester_code)
112
-            ->select('id')
113
-            ->get();
114
-        if(count($result) == 0){
103
+          ->where('code', $semester_code)
104
+          ->select('id')
105
+          ->get();
106
+        if (count($result) == 0) {
115 107
           continue;
116 108
         }
117 109
         $semester_id = $result[0]->id;
118 110
 
119 111
         // verify if it exists
120 112
         $result = DB::table('typ_semester_outcome')
121
-            ->where('typ_program_id',$typ_program_id)
122
-            ->where('semester_id',$semester_id)
123
-            ->where('outcome_id',$outcome_id)
124
-            ->get();
113
+          ->where('typ_program_id', $typ_program_id)
114
+          ->where('semester_id', $semester_id)
115
+          ->where('outcome_id', $outcome_id)
116
+          ->get();
125 117
 
126 118
         // if true, it should get inserted
127 119
         if ($insert == true) {
128 120
           // if == 0, then insert
129
-          if(count($result) == 0){
121
+          if (count($result) == 0) {
130 122
             $_ = DB::table('typ_semester_outcome')->insertGetId(
131
-                array('typ_program_id' => $typ_program_id,
132
-                      'semester_id' => $semester_id,
133
-                      'outcome_id' => $outcome_id)
123
+              array(
124
+                'typ_program_id' => $typ_program_id,
125
+                'semester_id' => $semester_id,
126
+                'outcome_id' => $outcome_id
127
+              )
134 128
             );
135
-
136 129
           }
137 130
           //if exists, then do nothing
138 131
 
@@ -141,16 +134,16 @@ class ThreeYearPlanController extends \BaseController
141 134
         else { //value == false
142 135
 
143 136
           // if == 0, it doesnt exist. we do nothing
144
-          if(count($result) == 0){
137
+          if (count($result) == 0) {
145 138
             //pass
146 139
           }
147 140
           //if exists, then do nothing
148 141
           else {
149 142
             DB::table('typ_semester_outcome')
150
-                ->where('typ_program_id', $typ_program_id)
151
-                ->where('semester_id', $semester_id)
152
-                ->where('outcome_id', $outcome_id)
153
-                ->delete();
143
+              ->where('typ_program_id', $typ_program_id)
144
+              ->where('semester_id', $semester_id)
145
+              ->where('outcome_id', $outcome_id)
146
+              ->delete();
154 147
           }
155 148
         }
156 149
       }
@@ -173,29 +166,27 @@ class ThreeYearPlanController extends \BaseController
173 166
 
174 167
       //buscar id del typ
175 168
       $result = DB::table('typ_program')
176
-          ->where('three_year_plan_id',$typ_id)
177
-          ->where('program_id',$program_id)
178
-          ->get();
169
+        ->where('three_year_plan_id', $typ_id)
170
+        ->where('program_id', $program_id)
171
+        ->get();
179 172
       $typ_program_id = $result[0]->id;
180 173
 
181 174
       // buscar si existe el outcome_semester
182 175
       $result = DB::table('typ_semester_outcome')
183
-          ->join('semesters','semesters.id','=','typ_semester_outcome.semester_id')
184
-          ->where('typ_program_id',$typ_program_id)
185
-          ->where('semesters.code',$semester_code)
186
-          ->where('outcome_id',$outcome_id)
187
-          ->get();
176
+        ->join('semesters', 'semesters.id', '=', 'typ_semester_outcome.semester_id')
177
+        ->where('typ_program_id', $typ_program_id)
178
+        ->where('semesters.code', $semester_code)
179
+        ->where('outcome_id', $outcome_id)
180
+        ->get();
188 181
 
189 182
       // if it doesnt exist
190
-      if (count($result)==0){
191
-        array_push($box_value,array($box_id,0));
183
+      if (count($result) == 0) {
184
+        array_push($box_value, array($box_id, 0));
192 185
       } else {
193
-        array_push($box_value,array($box_id,1));
186
+        array_push($box_value, array($box_id, 1));
194 187
       }
195
-
196 188
     }
197
-    return array
198
-    (
189
+    return array(
199 190
       'box_value' => ($box_value)
200 191
     );
201 192
   }
@@ -214,54 +205,54 @@ class ThreeYearPlanController extends \BaseController
214 205
     // new_objective_id: (new_objective_id)
215 206
 
216 207
     // get program_id
217
-    $user_id = auth::user()->id; //ya, tester es 60
208
+    $user_id = auth::user()->id;
218 209
     $program_id = DB::table('program_user')
219
-        ->where('user_id',$user_id)
220
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
221
-        ->select('program_id')
222
-        ->get();
223
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
210
+      ->where('user_id', $user_id)
211
+      ->select('program_id')
212
+      ->get();
213
+    $program_id = $program_id[0]->program_id;
224 214
 
225 215
     // get typ_program_id
226 216
     $result = DB::table('typ_program')
227
-        ->where('three_year_plan_id',$typ_id)
228
-        ->where('program_id',$program_id)
229
-        ->get();
217
+      ->where('three_year_plan_id', $typ_id)
218
+      ->where('program_id', $program_id)
219
+      ->get();
230 220
     $typ_program_id = $result[0]->id;
231 221
 
232 222
     // get typ_semester_outcome_id
233 223
     $result = DB::table('typ_semester_outcome')
234
-        ->where('typ_program_id',$typ_program_id)
235
-        ->where('semester_id',$semester_id)
236
-        ->where('outcome_id',$outcome_id)
237
-        ->get();
224
+      ->where('typ_program_id', $typ_program_id)
225
+      ->where('semester_id', $semester_id)
226
+      ->where('outcome_id', $outcome_id)
227
+      ->get();
238 228
     $typ_semester_outcome_id = $result[0]->id;
239 229
 
240 230
     //delete old objective relation if it exists
241 231
     if ($previous_objective_id != 'nothing_selected') {
242 232
       $result = DB::table('typ_semester_objectives')
243
-          ->where('typ_semester_outcome_id',$typ_semester_outcome_id)
244
-          ->where('objective_id',$previous_objective_id)
245
-          ->get();
233
+        ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
234
+        ->where('objective_id', $previous_objective_id)
235
+        ->get();
246 236
       if (count($result) != 0) {
247 237
         DB::table('typ_semester_objectives')
248
-            ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
249
-            ->where('objective_id', $previous_objective_id)
250
-            ->delete();
238
+          ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
239
+          ->where('objective_id', $previous_objective_id)
240
+          ->delete();
251 241
       }
252 242
     }
253 243
 
254 244
     //create new objective relation
255 245
     if ($new_objective_id != 'nothing_selected') {
256 246
       $result = DB::table('typ_semester_objectives')
257
-          ->where('typ_semester_outcome_id',$typ_semester_outcome_id)
258
-          ->where('objective_id',$new_objective_id)
259
-          ->get();
247
+        ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
248
+        ->where('objective_id', $new_objective_id)
249
+        ->get();
260 250
       if (count($result) == 0) {
261 251
         $_ = DB::table('typ_semester_objectives')->insertGetId(
262
-            array(
263
-              'typ_semester_outcome_id' => $typ_semester_outcome_id,
264
-              'objective_id' => $new_objective_id)
252
+          array(
253
+            'typ_semester_outcome_id' => $typ_semester_outcome_id,
254
+            'objective_id' => $new_objective_id
255
+          )
265 256
         );
266 257
       }
267 258
     }
@@ -271,31 +262,30 @@ class ThreeYearPlanController extends \BaseController
271 262
   public function section2_arrive()
272 263
   {
273 264
     // get program_id
274
-    $user_id = auth::user()->id; //ya, tester es 60
265
+    $user_id = auth::user()->id;
275 266
     $program_id = DB::table('program_user')
276
-        ->where('user_id',$user_id)
277
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
278
-        ->select('program_id')
279
-        ->get();
280
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
267
+      ->where('user_id', $user_id)
268
+      ->select('program_id')
269
+      ->get();
270
+    $program_id = $program_id[0]->program_id;
281 271
 
282 272
     // get typ_program_id
283 273
     $typ_id = Input::get('typ_id');
284 274
     $result = DB::table('typ_program')
285
-        ->where('three_year_plan_id',$typ_id)
286
-        ->where('program_id',$program_id)
287
-        ->get();
275
+      ->where('three_year_plan_id', $typ_id)
276
+      ->where('program_id', $program_id)
277
+      ->get();
288 278
     $typ_program_id = $result[0]->id;
289 279
 
290 280
 
291 281
     //search selected outcomes,semesters and get their objectives
292 282
     $selected_outcomes = DB::table('typ_semester_outcome')
293
-        ->join('outcomes','outcomes.id','=','typ_semester_outcome.outcome_id')
294
-        ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
295
-        ->distinct('typ_semester_outcome.outcome_id')
296
-        ->select('typ_semester_outcome.outcome_id')
297
-        ->orderBy('outcomes.name', 'asc')
298
-        ->get();
283
+      ->join('outcomes', 'outcomes.id', '=', 'typ_semester_outcome.outcome_id')
284
+      ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
285
+      ->distinct('typ_semester_outcome.outcome_id')
286
+      ->select('typ_semester_outcome.outcome_id')
287
+      ->orderBy('outcomes.name', 'asc')
288
+      ->get();
299 289
 
300 290
     $selected_objectives_array = array();
301 291
     $outcomes_info_array = array();
@@ -308,18 +298,18 @@ class ThreeYearPlanController extends \BaseController
308 298
 
309 299
       $outcome_id = $outcome->outcome_id;
310 300
       $result_outcomes = DB::table('outcomes')
311
-          ->where('outcomes.id',$outcome_id)
312
-          ->orderBy('outcomes.name', 'asc')
313
-          ->get();
301
+        ->where('outcomes.id', $outcome_id)
302
+        ->orderBy('outcomes.name', 'asc')
303
+        ->get();
314 304
 
315 305
       foreach ($result_outcomes as $outcome_) {
316 306
 
317 307
         $result_semesters = DB::table('typ_semester_outcome')
318
-            ->join('semesters','semesters.id','=','typ_semester_outcome.semester_id')
319
-            ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
320
-            ->where('typ_semester_outcome.outcome_id',$outcome_->id)
321
-            ->select('typ_semester_outcome.id','typ_semester_outcome.semester_id','semesters.code','semesters.name')
322
-            ->get();
308
+          ->join('semesters', 'semesters.id', '=', 'typ_semester_outcome.semester_id')
309
+          ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
310
+          ->where('typ_semester_outcome.outcome_id', $outcome_->id)
311
+          ->select('typ_semester_outcome.id', 'typ_semester_outcome.semester_id', 'semesters.code', 'semesters.name')
312
+          ->get();
323 313
         // buscar info sobre selected_semsters
324 314
         $outcome_->selected_semesters = array();
325 315
         foreach ($result_semesters as $semesters_) {
@@ -327,10 +317,10 @@ class ThreeYearPlanController extends \BaseController
327 317
 
328 318
           // lookup previusly selected objectives
329 319
           $result_objectives = DB::table('typ_semester_objectives')
330
-              ->join('objectives','objectives.id','=','typ_semester_objectives.objective_id')
331
-              ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
332
-              ->orderBy('typ_semester_objectives.id', 'asc')
333
-              ->get();
320
+            ->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
321
+            ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
322
+            ->orderBy('typ_semester_objectives.id', 'asc')
323
+            ->get();
334 324
 
335 325
           $semesters_->selected_objectives = array();
336 326
           foreach ($result_objectives as $objectives_) {
@@ -339,15 +329,15 @@ class ThreeYearPlanController extends \BaseController
339 329
           }
340 330
 
341 331
           // lookup available objectives
342
-          $result_objectives = DB::table('criterion_objective_outcome')
343
-              ->join('outcomes','outcomes.id','=','criterion_objective_outcome.outcome_id')
344
-              ->join('objectives','objectives.id','=','criterion_objective_outcome.objective_id')
345
-              ->join('objective_program','objective_program.objective_id','=','objectives.id')
346
-              ->where('objective_program.program_id',$program_id)
347
-              ->where('criterion_objective_outcome.outcome_id',$outcome_id)
348
-              ->select('objectives.id','objectives.text','outcomes.name as outcome_name')
349
-              ->orderBy('objectives.text', 'asc')
350
-              ->get();
332
+          $result_objectives = DB::table('objective_outcome')
333
+            ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
334
+            ->join('objectives', 'objectives.id', '=', 'objective_outcome.objective_id')
335
+            ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
336
+            ->where('objective_program.program_id', $program_id)
337
+            ->where('objective_outcome.outcome_id', $outcome_id)
338
+            ->select('objectives.id', 'objectives.text', 'outcomes.name as outcome_name')
339
+            ->orderBy('objectives.text', 'asc')
340
+            ->get();
351 341
 
352 342
           $semesters_->available_objectives = array();
353 343
           foreach ($result_objectives as $objectives_) {
@@ -366,31 +356,30 @@ class ThreeYearPlanController extends \BaseController
366 356
   public function section3_arrive()
367 357
   {
368 358
     // get program_id
369
-    $user_id = auth::user()->id; //ya, tester es 60
359
+    $user_id = auth::user()->id;
370 360
     $program_id = DB::table('program_user')
371
-        ->where('user_id',$user_id)
372
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
373
-        ->select('program_id')
374
-        ->get();
375
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
361
+      ->where('user_id', $user_id)
362
+      ->select('program_id')
363
+      ->get();
364
+    $program_id = $program_id[0]->program_id;
376 365
 
377 366
     // get typ_program_id
378 367
     $typ_id = Input::get('typ_id');
379 368
     $result = DB::table('typ_program')
380
-        ->where('three_year_plan_id',$typ_id)
381
-        ->where('program_id',$program_id)
382
-        ->get();
369
+      ->where('three_year_plan_id', $typ_id)
370
+      ->where('program_id', $program_id)
371
+      ->get();
383 372
     $typ_program_id = $result[0]->id;
384 373
 
385 374
 
386 375
     //search selected outcomes,semesters and get their objectives
387 376
     $selected_outcomes = DB::table('typ_semester_outcome')
388
-        ->join('outcomes','outcomes.id','=','typ_semester_outcome.outcome_id')
389
-        ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
390
-        ->distinct('typ_semester_outcome.outcome_id')
391
-        ->select('typ_semester_outcome.outcome_id')
392
-        ->orderBy('outcomes.name', 'asc')
393
-        ->get();
377
+      ->join('outcomes', 'outcomes.id', '=', 'typ_semester_outcome.outcome_id')
378
+      ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
379
+      ->distinct('typ_semester_outcome.outcome_id')
380
+      ->select('typ_semester_outcome.outcome_id')
381
+      ->orderBy('outcomes.name', 'asc')
382
+      ->get();
394 383
 
395 384
     $selected_objectives_array = array();
396 385
     $outcomes_info_array = array();
@@ -403,17 +392,17 @@ class ThreeYearPlanController extends \BaseController
403 392
 
404 393
       $outcome_id = $outcome->outcome_id;
405 394
       $result_outcomes = DB::table('outcomes')
406
-          ->where('outcomes.id',$outcome_id)
407
-          ->get();
395
+        ->where('outcomes.id', $outcome_id)
396
+        ->get();
408 397
 
409 398
       foreach ($result_outcomes as $outcome_) {
410 399
 
411 400
         $result_semesters = DB::table('typ_semester_outcome')
412
-            ->join('semesters','semesters.id','=','typ_semester_outcome.semester_id')
413
-            ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
414
-            ->where('typ_semester_outcome.outcome_id',$outcome_->id)
415
-            ->select('typ_semester_outcome.id','typ_semester_outcome.semester_id','semesters.code','semesters.name')
416
-            ->get();
401
+          ->join('semesters', 'semesters.id', '=', 'typ_semester_outcome.semester_id')
402
+          ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
403
+          ->where('typ_semester_outcome.outcome_id', $outcome_->id)
404
+          ->select('typ_semester_outcome.id', 'typ_semester_outcome.semester_id', 'semesters.code', 'semesters.name')
405
+          ->get();
417 406
         // buscar info sobre selected_semsters
418 407
         $outcome_->selected_semesters = array();
419 408
         foreach ($result_semesters as $semesters_) {
@@ -421,27 +410,27 @@ class ThreeYearPlanController extends \BaseController
421 410
 
422 411
           $typ_semester_outcome_id = $semesters_->id;
423 412
           $result_objectives = DB::table('typ_semester_objectives')
424
-              ->join('objectives','objectives.id','=','typ_semester_objectives.objective_id')
425
-              ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
426
-              ->select('typ_semester_objectives.id as typ_semester_objectives_id','objectives.*','typ_semester_objectives.*')
427
-              ->orderBy('typ_semester_objectives.id', 'asc')
428
-              ->get();
413
+            ->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
414
+            ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
415
+            ->select('typ_semester_objectives.id as typ_semester_objectives_id', 'objectives.*', 'typ_semester_objectives.*')
416
+            ->orderBy('typ_semester_objectives.id', 'asc')
417
+            ->get();
429 418
 
430 419
           $semesters_->selected_objectives = array();
431 420
           foreach ($result_objectives as $objectives_) {
432 421
             $objective_id = $objectives_->objective_id;
433 422
             $program_id = $objectives_->program_id;
434 423
             $result_courses = DB::table('objective_program')
435
-                ->join('objectives','objectives.id','=','objective_program.objective_id')
436
-                ->join('courses','courses.program_id','=','objective_program.program_id')
437
-                ->where('objective_program.objective_id', $objective_id)
438
-                ->where('objective_program.program_id', $program_id)
439
-                ->where('courses.semester_id', $semester_id)
440
-                ->distinct('courses.name','courses.code')
441
-                ->select('courses.id as course_id','courses.name','courses.code','objective_program.objective_id','objective_program.program_id')
442
-                ->orderBy('courses.name', 'asc')
443
-                ->groupBy('courses.name','courses.code')
444
-                ->get();
424
+              ->join('objectives', 'objectives.id', '=', 'objective_program.objective_id')
425
+              ->join('courses', 'courses.program_id', '=', 'objective_program.program_id')
426
+              ->where('objective_program.objective_id', $objective_id)
427
+              ->where('objective_program.program_id', $program_id)
428
+              ->where('courses.semester_id', $semester_id)
429
+              ->distinct('courses.name', 'courses.code')
430
+              ->select('courses.id as course_id', 'courses.name', 'courses.code', 'objective_program.objective_id', 'objective_program.program_id')
431
+              ->orderBy('courses.name', 'asc')
432
+              ->groupBy('courses.name', 'courses.code')
433
+              ->get();
445 434
 
446 435
             $objectives_->available_courses = array();
447 436
             foreach ($result_courses as $courses_) {
@@ -451,11 +440,11 @@ class ThreeYearPlanController extends \BaseController
451 440
             // search for previusly selected courses
452 441
             $typ_semester_objective_id = $objectives_->typ_semester_objectives_id;
453 442
             $result_courses = DB::table('typ_semester_courses')
454
-                ->join('courses','courses.id','=','typ_semester_courses.course_id')
455
-                ->where('typ_semester_courses.typ_semester_objective_id', $typ_semester_objective_id)
456
-                ->select('courses.id as course_id','courses.*','typ_semester_courses.*')
457
-                ->orderBy('courses.name', 'asc')
458
-                ->get();
443
+              ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
444
+              ->where('typ_semester_courses.typ_semester_objective_id', $typ_semester_objective_id)
445
+              ->select('courses.id as course_id', 'courses.*', 'typ_semester_courses.*')
446
+              ->orderBy('courses.name', 'asc')
447
+              ->get();
459 448
 
460 449
             $objectives_->selected_courses = array();
461 450
             foreach ($result_courses as $courses_) {
@@ -490,66 +479,94 @@ class ThreeYearPlanController extends \BaseController
490 479
     // new_course_id: (new_course_id)
491 480
 
492 481
     // get program_id
493
-    $user_id = auth::user()->id; //ya, tester es 60
482
+    $user_id = auth::user()->id;
494 483
     $program_id = DB::table('program_user')
495
-        ->where('user_id',$user_id)
496
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
497
-        ->select('program_id')
498
-        ->get();
499
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
484
+      ->where('user_id', $user_id)
485
+      ->select('program_id')
486
+      ->get();
487
+    $program_id = $program_id[0]->program_id;
500 488
 
501 489
     // get typ_program_id
502 490
     $result = DB::table('typ_program')
503
-        ->where('three_year_plan_id',$typ_id)
504
-        ->where('program_id',$program_id)
505
-        ->get();
491
+      ->where('three_year_plan_id', $typ_id)
492
+      ->where('program_id', $program_id)
493
+      ->get();
506 494
     $typ_program_id = $result[0]->id;
507 495
 
508 496
     // get typ_semester_outcome_id
509 497
     $result = DB::table('typ_semester_outcome')
510
-        ->where('typ_program_id',$typ_program_id)
511
-        ->where('semester_id',$semester_id)
512
-        ->where('outcome_id',$outcome_id)
513
-        ->get();
498
+      ->where('typ_program_id', $typ_program_id)
499
+      ->where('semester_id', $semester_id)
500
+      ->where('outcome_id', $outcome_id)
501
+      ->get();
514 502
     $typ_semester_outcome_id = $result[0]->id;
515 503
 
516 504
     // get typ_semester_objective_id
517 505
     $result = DB::table('typ_semester_objectives')
518
-        ->where('typ_semester_outcome_id',$typ_semester_outcome_id)
519
-        ->where('objective_id',$objective_id)
520
-        ->get();
506
+      ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
507
+      ->where('objective_id', $objective_id)
508
+      ->get();
521 509
     $typ_semester_objective_id = $result[0]->id;
522 510
 
523 511
     //delete old objective relation if it exists
524 512
     if ($previous_course_id != 'nothing_selected') {
525 513
       $result = DB::table('typ_semester_courses')
526
-          ->where('typ_semester_objective_id',$typ_semester_objective_id)
527
-          ->where('course_id',$previous_course_id)
528
-          ->get();
514
+        ->where('typ_semester_objective_id', $typ_semester_objective_id)
515
+        ->where('course_id', $previous_course_id)
516
+        ->get();
529 517
       if (count($result) != 0) {
530 518
         DB::table('typ_semester_courses')
531
-            ->where('typ_semester_objective_id', $typ_semester_objective_id)
532
-            ->where('course_id', $previous_course_id)
533
-            ->delete();
519
+          ->where('typ_semester_objective_id', $typ_semester_objective_id)
520
+          ->where('course_id', $previous_course_id)
521
+          ->delete();
534 522
       }
535 523
     }
536 524
 
537 525
     //create new objective relation
538 526
     if ($new_course_id != 'nothing_selected') {
539 527
       $result = DB::table('typ_semester_courses')
540
-          ->where('typ_semester_objective_id',$typ_semester_objective_id)
541
-          ->where('course_id',$new_course_id)
542
-          ->get();
528
+        ->where('typ_semester_objective_id', $typ_semester_objective_id)
529
+        ->where('course_id', $new_course_id)
530
+        ->get();
543 531
       if (count($result) == 0) {
544 532
         $_ = DB::table('typ_semester_courses')->insertGetId(
545
-            array(
546
-              'typ_semester_objective_id' => $typ_semester_objective_id,
547
-              'course_id' => $new_course_id)
533
+          array(
534
+            'typ_semester_objective_id' => $typ_semester_objective_id,
535
+            'course_id' => $new_course_id
536
+          )
548 537
         );
549 538
       }
550 539
     }
551 540
     return 'update succes?';
552 541
   }
553 542
 
543
+  public function createAnnualPlan($program_id)
544
+  {
545
+    $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0];
546
+    $count = 0;
547
+    $yearStartPlusOne = $current_typ->year_start + 1;
548
+    $yearStart = $current_typ->year_start;
549
+    while ($count < 3) {
550
+
551
+
552
+
553
+      $firstSemester = DB::select("select * from semesters where name like 'First Semester {$yearStart}-{$yearStartPlusOne}'");
554 554
 
555
+      $secondSemester = DB::select("select * from semesters where name like 'Second Semester {$yearStart}-{$yearStartPlusOne}'");
556
+      if (count($firstSemester) && count($secondSemester)) {
557
+        $query = DB::select("select * from annual_plans where semester_start ={$firstSemester[0]->id} and semester_end ={$secondSemester[0]->id} and program_id = {$program_id}");
558
+        if (!count($query)) {
559
+          DB::insert("insert into annual_plans (academic_year, semester_start, semester_end, program_id) values ('{$yearStart}-{$yearStartPlusOne}', {$firstSemester->id}, {$secondSemester->id}, {$program_id})");
560
+        }
561
+        $count++;
562
+        $yearStart++;
563
+        $yearStartPlusOne++;
564
+      } else {
565
+        $count++;
566
+        $yearStart++;
567
+        $yearStartPlusOne++;
568
+        continue;
569
+      }
570
+    }
571
+  }
555 572
 }

+ 0
- 33
app/database/migrations/2021_01_31_165057_fix_objectives_table_2.php Parādīt failu

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

+ 0
- 51
app/database/migrations/2021_03_29_151542_create_annual_report_transformative.php Parādīt failu

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

+ 33
- 0
app/database/unusedMigrations/2021_01_31_165057_fix_objectives_table_2.php Parādīt failu

@@ -0,0 +1,33 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class FixObjectivesTable2 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
+
18
+			//$table->dropForeign('objectives_program_id_foreign');
19
+			//$table->dropColumn('program_id');
20
+			//$table->dropColumn('outcome_id');
21
+		});
22
+	}
23
+
24
+	/**
25
+	 * Reverse the migrations.
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function down()
30
+	{
31
+		//
32
+	}
33
+}

app/database/migrations/2021_01_31_171210_fix_criterion_scale.php → app/database/unusedMigrations/2021_01_31_171210_fix_criterion_scale.php Parādīt failu


+ 15
- 11
app/routes.php Parādīt failu

@@ -183,10 +183,12 @@ Route::group(array('before' => 'auth|has_access'), function () {
183 183
         'as' => 'fetchAllCriterion',
184 184
         'uses' => 'CriteriaController@fetchAllCriterion'
185 185
     ));
186
-    Route::post('delete', array(
187
-        'as' => 'delete',
186
+    Route::post('deleteCriterion', array(
187
+        'as' => 'deleteCriterion',
188 188
         'uses' => 'CriteriaController@delete'
189 189
     ));
190
+
191
+
190 192
     Route::post('delete', array(
191 193
         'as' => 'delete',
192 194
         'uses' => 'TransformativeActionsController@deleteTA'
@@ -247,9 +249,9 @@ Route::group(array('before' => 'auth|has_access'), function () {
247 249
     Route::get('transformativeAction', array('uses' => 'TransformativeActionsController@editTA'));
248 250
     Route::post('transformativeAction/createTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@createTA'));
249 251
     Route::post('transformativeAction/selectTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@selectTA'));
250
-    Route::post('transformativeAction/updateTA', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@updateTA'));
251
-    Route::post('transformativeAction/filterTA', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@filterTA'));
252
-    Route::post('transformativeAction/objectivesFromOutcome', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@objectivesFromOutcome'));
252
+    Route::post('transformativeAction/updateTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@updateTA'));
253
+    Route::post('transformativeAction/filterTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@filterTA'));
254
+    Route::post('transformativeAction/objectivesFromOutcome', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@objectivesFromOutcome'));
253 255
 
254 256
     /**
255 257
      * Administrator Routes
@@ -322,6 +324,8 @@ Route::group(array('before' => 'auth|has_access'), function () {
322 324
         Route::post('createCriterion', array('before' => 'csrf', 'uses' => 'CriteriaController@create'));
323 325
         Route::get('school-objective', 'Objective2Controller@editSchool');
324 326
         Route::get('school-criteria', 'CriteriaController@editSchool');
327
+        Route::post('crtiteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
328
+
325 329
         //Show users annual plan
326 330
         Route::get('annual-plan-program/{program_id}/{typ_id?}', 'AnnualPlansController@showPlan');
327 331
         Route::post('annual-plan-fetchTYP/{program_id}/{typ_id}', 'AnnualPlansController@fetchTYP');
@@ -337,7 +341,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
337 341
 
338 342
         // Show users plan de tres a~nos
339 343
         Route::get('three-years-plan', 'ThreeYearPlanController@threeYearsReport');
340
-        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses'=>'ThreeYearPlanController@fetchThreeYears'));
344
+        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@fetchThreeYears'));
341 345
         Route::post('typ/lookUp', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@lookup_typ_semester_outcome'));
342 346
         Route::post('section2_arrive', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_arrive'));
343 347
         Route::post('section2_on_change', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_on_change'));
@@ -346,7 +350,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
346 350
         Route::post('typ/getObjectives', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@getObjectivesForTYP'));
347 351
         Route::post('typ/updateOutcomeSemsters', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@typ_update_outcomes_semesters'));
348 352
         Route::post('typ/update', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@update_typ_outcomes_semesters'));
349
-
353
+        Route::post('createAnnualPlan/{program_id}', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@createAnnualPlan'));
350 354
     });
351 355
 
352 356
 
@@ -370,6 +374,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
370 374
 
371 375
         //Criteria and objectives
372 376
         Route::get('program-criteria', 'CriteriaController@editProgram');
377
+        Route::post('crtiteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
373 378
         Route::get('program-objective', 'Objective2Controller@editProgram');
374 379
 
375 380
         // Print program report
@@ -440,11 +445,11 @@ Route::group(array('before' => 'auth|has_access'), function () {
440 445
 
441 446
 
442 447
         // Transformative Actions
443
-        Route::post('transformativeAction/approveTA', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@approveTA'));
448
+        Route::post('transformativeAction/approveTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@approveTA'));
444 449
 
445 450
         // Show users plan de tres a~nos
446 451
         Route::get('three-years-plan', 'ThreeYearPlanController@threeYearsReport');
447
-        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses'=>'ThreeYearPlanController@fetchThreeYears'));
452
+        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@fetchThreeYears'));
448 453
         Route::post('typ/lookUp', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@lookup_typ_semester_outcome'));
449 454
         Route::post('section2_arrive', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_arrive'));
450 455
         Route::post('section2_on_change', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_on_change'));
@@ -453,8 +458,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
453 458
         Route::post('typ/getObjectives', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@getObjectivesForTYP'));
454 459
         Route::post('typ/updateOutcomeSemsters', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@typ_update_outcomes_semesters'));
455 460
         Route::post('typ/update', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@update_typ_outcomes_semesters'));
456
-
457
-
461
+        Route::post('createAnnualPlan/{program_id}', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@createAnnualPlan'));
458 462
     });
459 463
 
460 464
 

+ 4
- 1
app/views/global/view-three-year-plan.blade.php Parādīt failu

@@ -342,7 +342,10 @@ $(document).ready(function()
342 342
   // Events
343 343
   // --------------------------------------------------------------------------
344 344
 
345
-
345
+$('.go-to-temp').on('click', function(){
346
+  $.post(
347
+    "{{ URL::action('ThreeYearPlanController@createAnnualPlan', array($program_id))}}");
348
+});
346 349
 
347 350
     // When list item is clicked, load corresponding info
348 351
     //section 1

+ 17
- 3
app/views/local/managers/admins/criteria.blade.php Parādīt failu

@@ -107,7 +107,11 @@
107 107
             <div class="panel-body">
108 108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
109 109
 
110
-
110
+                <button class="btn btn-md btn-secondary filterButton">
111
+                    <span class="glyphicon glyphicon-plus">
112
+                    </span>
113
+                    Filters
114
+                  </button>
111 115
                 <div class="form-group">
112 116
                     {{ Form::label('program_id2', 'Associated Program')}}
113 117
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
@@ -320,9 +324,19 @@
320 324
         }
321 325
 
322 326
     }
327
+  
323 328
 
324
-
325
-
329
+    $('.filterSection').hide();
330
+    $('.filterButton').on('click', function()
331
+{
332
+  var span = $(this).find('span');
333
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
334
+    span.attr('class','glyphicon glyphicon-minus');
335
+  } else{
336
+    span.attr('class','glyphicon glyphicon-plus');
337
+  }
338
+  $('.filterSection').toggle(533);
339
+});
326 340
     function numberOfScales(string, Scales) {
327 341
         var maximum = $('#maximum_score').val();
328 342
         var amountOfScale = parseInt($('#' + string).val());

+ 1
- 1
app/views/local/managers/admins/new_criteria.blade.php Parādīt failu

@@ -430,7 +430,7 @@
430 430
     }
431 431
 
432 432
 
433
-
433
+    $('.filterSection').hide();
434 434
     //Delete Outcome and OptGroup associated
435 435
 
436 436
     function deleteLast(outcomeForm, outcomeDiv, closeButton, objectiveGroup) {

+ 32
- 7
app/views/local/managers/pCoords/criteria.blade.php Parādīt failu

@@ -51,7 +51,7 @@
51 51
                     <br>
52 52
 
53 53
 
54
-
54
+                    <input type = "hidden" id = "{{ $programs[0]->name }}"  name="program_id[]" value="{{$programs[0]->id}}">
55 55
                     <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
56 56
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
57 57
 
@@ -107,7 +107,12 @@
107 107
             <div class="panel-body">
108 108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
109 109
 
110
-
110
+                <button class="btn btn-md btn-secondary filterButton">
111
+                    <span class="glyphicon glyphicon-plus">
112
+                    </span>
113
+                    Filters
114
+                  </button>
115
+                <div class="filterSection">
111 116
                 <div class="form-group">
112 117
                     {{ Form::label('program_id2', 'Associated Program')}}
113 118
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
@@ -121,6 +126,7 @@
121 126
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
122 127
 
123 128
                 </div>
129
+                </div>
124 130
 
125 131
                 <div class="form-group">
126 132
                     {{ Form::label('criterion_id', 'Criterion') }}
@@ -175,7 +181,8 @@
175 181
 
176 182
                     {{ Form::label('program_id2', 'Associated Program') }}<br><br>
177 183
 
178
-
184
+                    <input type = "hidden" id = "{{ $programs[0]->name }}"  name="program_id[]" value="{{$programs[0]->id}}">
185
+                 
179 186
                     <input type="checkbox" id="assoc_program_id_{{ $programs[0]->id }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
180 187
                     <label for="assoc_program_id_{{ $programs[0]->id }}"> {{ $programs[0]->name }} <sub>[{{ $programs[0]->school->name }}]</sub></label><br>
181 188
 
@@ -232,12 +239,12 @@
232 239
                     {{ Form::label('notes', 'Additional Notes') }}
233 240
                     {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
234 241
                 </div>
235
-                <div id='delete'>
236
-
237
-                </div>
242
+               
238 243
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
239 244
                 {{ Form::close() }}
245
+ <div id='delete'>
240 246
 
247
+                </div>
241 248
 
242 249
             </div>
243 250
         </div>
@@ -320,6 +327,17 @@
320 327
     }
321 328
 
322 329
 
330
+$('.filterSection').hide();
331
+    $('.filterButton').on('click', function()
332
+{
333
+  var span = $(this).find('span');
334
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
335
+    span.attr('class','glyphicon glyphicon-minus');
336
+  } else{
337
+    span.attr('class','glyphicon glyphicon-plus');
338
+  }
339
+  $('.filterSection').toggle(533);
340
+});
323 341
 
324 342
     function numberOfScales(string, Scales) {
325 343
         var maximum = $('#maximum_score').val();
@@ -866,7 +884,7 @@
866 884
                 assocObjectiveCounter = json.objectives.length;
867 885
 
868 886
 
869
-
887
+                
870 888
 
871 889
 
872 890
 
@@ -972,6 +990,13 @@ e.preventDefault();
972 990
 
973 991
 return false;
974 992
 });
993
+$('.filterButton').on('click', function(e) {
994
+    // Prevent the default action of the clicked item. In this case that is submit
995
+    e.preventDefault();
996
+    
997
+    
998
+    return false;
999
+    });
975 1000
 $('#button-add-objective-assoc').on('click', function(e) {
976 1001
 // Prevent the default action of the clicked item. In this case that is submit
977 1002
 e.preventDefault();

+ 5
- 9
app/views/local/managers/pCoords/objectives.blade.php Parādīt failu

@@ -40,7 +40,7 @@
40 40
                     <br>
41 41
 
42 42
 
43
-
43
+                    <input type ="hidden" id='{{ $programs[0]->name }}' name="program_id[]" value="{{$programs[0]->id}}">
44 44
                     <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
45 45
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
46 46
 
@@ -110,7 +110,8 @@
110 110
                     <br>
111 111
 
112 112
 
113
-
113
+                    <input type ="hidden" id='assoc_program_id_{{ $programs[0]->id }}' name="program_id[]" value="{{$programs[0]->id}}">
114
+                   
114 115
                     <input type="checkbox" id="{{ $programs[0]->name }}" id="assoc_program_id_{{$programs[0]->id}}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
115 116
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
116 117
 
@@ -135,9 +136,7 @@
135 136
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
136 137
                 {{ Form::close() }}
137 138
             </div>
138
-            <div id="text">
139
-                <p>lmao</p>
140
-            </div>
139
+
141 140
 
142 141
 
143 142
 
@@ -359,10 +358,7 @@
359 358
             'json'
360 359
         );
361 360
     }
362
-    },
363
-    'json'
364
-    );
365
-    }
361
+   
366 362
 
367 363
     function deleteLastAssoc() {
368 364
 

+ 18
- 2
app/views/local/managers/sCoords/criteria.blade.php Parādīt failu

@@ -106,8 +106,12 @@
106 106
             </div>
107 107
             <div class="panel-body">
108 108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
109
-
110
-
109
+                <button class="btn btn-md btn-secondary filterButton">
110
+                    <span class="glyphicon glyphicon-plus">
111
+                    </span>
112
+                    Filters
113
+                  </button>
114
+                <div class="filterSection">
111 115
                 <div class="form-group">
112 116
                     {{ Form::label('program_id2', 'Associated Program')}}
113 117
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
@@ -121,6 +125,7 @@
121 125
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
122 126
 
123 127
                 </div>
128
+                </div>
124 129
 
125 130
                 <div class="form-group">
126 131
                     {{ Form::label('criterion_id', 'Criterion') }}
@@ -244,6 +249,17 @@
244 249
     </div>
245 250
 </div>
246 251
 <script>
252
+    $('.filterSection').hide();
253
+    $('.filterButton').on('click', function()
254
+{
255
+  var span = $(this).find('span');
256
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
257
+    span.attr('class','glyphicon glyphicon-minus');
258
+  } else{
259
+    span.attr('class','glyphicon glyphicon-plus');
260
+  }
261
+  $('.filterSection').toggle(533);
262
+});
247 263
     var selectOptions = document.getElementById('outcome0').innerHTML;
248 264
 
249 265
     var counter = 1;