|
|
|
|
95
|
$program_id = Input::get('program_fetch');
|
95
|
$program_id = Input::get('program_fetch');
|
96
|
$outcome_id = Input::get('outcome_fetch');
|
96
|
$outcome_id = Input::get('outcome_fetch');
|
97
|
$json = array();
|
97
|
$json = array();
|
98
|
- $json['criterion'] = DB::select("SELECT * FROM `criteria` where id in (select criterion_id from criterion_objective_outcome where outcome_id ={$outcome_id}) and id in(select criterion_id from program_criterion where program_id = {$program_id})");
|
|
|
|
|
98
|
+ $json['criterion'] = DB::select("SELECT * FROM `criteria` where id in (select criterion_id from criterion_objective_outcome join program_criterion_objective_outcome on program_criterion_objective_outcome.cri_obj_out = criterion_objective_outcome.id where outcome_id ={$outcome_id} and program_id = {$program_id}) ");
|
99
|
|
99
|
|
100
|
return json_encode($json);
|
100
|
return json_encode($json);
|
101
|
}
|
101
|
}
|
|
|
|
|
544
|
$outcome_objective = str_replace($parentesis, '', $objective_id);
|
544
|
$outcome_objective = str_replace($parentesis, '', $objective_id);
|
545
|
|
545
|
|
546
|
$outcome_objective = explode(',', $outcome_objective);
|
546
|
$outcome_objective = explode(',', $outcome_objective);
|
547
|
- DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$outcome_objective[1]},{$outcome_objective[0]}, {$criterionId})");
|
|
|
|
|
547
|
+ $cobo_id = DB::table('criterion_objective_outcome')
|
|
|
548
|
+ ->insertGetId(array(
|
|
|
549
|
+ "objective_id" => $outcome_objective[1],
|
|
|
550
|
+ "outcome_id" => $outcome_objective[0],
|
|
|
551
|
+ "criterion_id" => $criterionId
|
|
|
552
|
+ ));
|
|
|
553
|
+
|
|
|
554
|
+ foreach ($clean_input['program_id'] as $program_id) {
|
|
|
555
|
+ DB::table('program_criterion_objective_outcome')
|
|
|
556
|
+ ->insert(array(
|
|
|
557
|
+ 'program_id' => $program_id,
|
|
|
558
|
+ 'cri_obj_out_id' => $cobo_id
|
|
|
559
|
+ ));
|
|
|
560
|
+ }
|
|
|
561
|
+ //DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$outcome_objective[1]},{$outcome_objective[0]}, {$criterionId})");
|
|
|
562
|
+
|
548
|
}
|
563
|
}
|
549
|
|
564
|
|
550
|
|
565
|
|
|
|
|
|
855
|
$parentesis = array('(', ')');
|
870
|
$parentesis = array('(', ')');
|
856
|
if ($criterion->save()) {
|
871
|
if ($criterion->save()) {
|
857
|
$criterionId = $criterion->id;
|
872
|
$criterionId = $criterion->id;
|
858
|
- DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
|
|
|
|
|
873
|
+ DB::table('criterion_objective_outcome as cobo')
|
|
|
874
|
+ ->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'cobo.id')
|
|
|
875
|
+ ->where($criterionId)
|
|
|
876
|
+ ->delete();
|
|
|
877
|
+ // DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
|
859
|
DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
|
878
|
DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
|
860
|
|
879
|
|
861
|
foreach ($clean_input['objective_id'] as $objective_id) {
|
880
|
foreach ($clean_input['objective_id'] as $objective_id) {
|
|
|
|
|
863
|
$outcome_objective = str_replace($parentesis, '', $objective_id);
|
882
|
$outcome_objective = str_replace($parentesis, '', $objective_id);
|
864
|
|
883
|
|
865
|
$outcome_objective = explode(',', $outcome_objective);
|
884
|
$outcome_objective = explode(',', $outcome_objective);
|
866
|
- DB::insert("insert into `criterion_objective_outcome` (`objective_id`, `outcome_id`, `criterion_id`) values ({$outcome_objective[1]},{$outcome_objective[0]}, {$criterionId})");
|
|
|
|
|
885
|
+ $cobo_id = DB::table('criterion_objective_outcome')
|
|
|
886
|
+ ->insertGetId(array(
|
|
|
887
|
+ "objective_id" => $outcome_objective[1],
|
|
|
888
|
+ "outcome_id" => $outcome_objective[0],
|
|
|
889
|
+ "criterion_id" => $criterionId
|
|
|
890
|
+ ));
|
|
|
891
|
+
|
|
|
892
|
+ foreach ($clean_input['program_id'] as $program_id) {
|
|
|
893
|
+ DB::table('program_criterion_objective_outcome')
|
|
|
894
|
+ ->insert(array(
|
|
|
895
|
+ 'program_id' => $program_id,
|
|
|
896
|
+ 'cri_obj_out_id' => $cobo_id
|
|
|
897
|
+ ));
|
|
|
898
|
+ }
|
867
|
}
|
899
|
}
|
868
|
|
900
|
|
869
|
/*DB::delete("delete from `scales` where id in (select scale_id id from criterion_scale where criterion_id = {$criterionId})");
|
901
|
/*DB::delete("delete from `scales` where id in (select scale_id id from criterion_scale where criterion_id = {$criterionId})");
|