瀏覽代碼

Update AnnualPlansController.php

父節點
當前提交
75a3429132
共有 1 個檔案被更改,包括 10 行新增11 行删除
  1. 10
    11
      app/controllers/AnnualPlansController.php

+ 10
- 11
app/controllers/AnnualPlansController.php 查看文件

@@ -160,7 +160,7 @@ class AnnualPlansController extends \BaseController
160 160
       annual_plans.id as id 
161 161
     from annual_plans 
162 162
     join annual_cycle on annual_cycle_id = annual_cycle.id 
163
-    where program_id = 110 
163
+    where program_id = {$program_id} 
164 164
     and(
165 165
       semester_start in(
166 166
         select semester_id 
@@ -178,6 +178,7 @@ class AnnualPlansController extends \BaseController
178 178
     // Log::info($annual_plans);
179 179
     $outcomes = array();
180 180
     $allSemesterOrder = array();
181
+    Log::info($annual_plans);
181 182
     /*foreach ($annual_plans as $an_plan) {
182 183
       Log::info($an_plan->id);
183 184
       $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} ))");
@@ -330,21 +331,19 @@ class AnnualPlansController extends \BaseController
330 331
     }
331 332
   }
332 333
 
333
-  public function CreateOrEdit($program_id){
334
+  public function CreateOrEdit($program_id)
335
+  {
334 336
 
335 337
     $semester_id = Input::get('semester_id');
336 338
     $expected_target = Input::get('expected_target');
337
-    
339
+
338 340
     $exist = DB::select("select * from target_outcomes_program where program_id = {$program_id} and semester_id = {$semester_id}");
339
-    
340
-    
341
-    if($exist){
342
-      //update
343
-      DB::update("update target_outcomes_program set expected_target = {$expected_target}, updated_at = now() where program_id = {$program_id} and semester_id = {$semester_id}");
344
-    }
345 341
 
346 342
 
347
-    else{
343
+    if ($exist) {
344
+      //update
345
+      DB::update("update target_outcomes_program set expected_target = {$expected_target}, updated_at = now() where program_id = {$program_id} and semester_id = {$semester_id}");
346
+    } else {
348 347
       //create a new one
349 348
       DB::insert("insert into target_outcomes_program (program_id, semester_id, expected_target, created_at, updated_at) values({$program_id}, {$semester_id}, '{$expected_target}', '{now()}', '{now()}')");
350 349
     }
@@ -619,4 +618,4 @@ class AnnualPlansController extends \BaseController
619 618
 
620 619
     return $outcome;
621 620
   }
622
-}
621
+}