| @@ 433-449 (lines=17) @@ | ||
| 430 | ]; |
|
| 431 | Database::insert($t_course, $params); |
|
| 432 | } |
|
| 433 | } else { |
|
| 434 | $sql = "SELECT value FROM $t_course |
|
| 435 | WHERE c_id = $courseId AND variable = '$variable' "; |
|
| 436 | $result = Database::query($sql); |
|
| 437 | if (!Database::num_rows($result)) { |
|
| 438 | ||
| 439 | $params = [ |
|
| 440 | 'c_id' => $courseId, |
|
| 441 | 'variable' => $variable, |
|
| 442 | 'subkey' => $plugin_name, |
|
| 443 | 'value' => $value, |
|
| 444 | 'category' => 'plugins', |
|
| 445 | 'type' => $type |
|
| 446 | ]; |
|
| 447 | Database::insert($t_course, $params); |
|
| 448 | } |
|
| 449 | } |
|
| 450 | } |
|
| 451 | } |
|
| 452 | ||
| @@ 989-1010 (lines=22) @@ | ||
| 986 | $user_id |
|
| 987 | ); |
|
| 988 | ||
| 989 | } else { |
|
| 990 | // insert |
|
| 991 | $params = [ |
|
| 992 | 'c_id' => $this->course_int_id, |
|
| 993 | 'thematic_id' => $thematic_id, |
|
| 994 | 'title' => $title, |
|
| 995 | 'description' => $description, |
|
| 996 | 'description_type' => $description_type |
|
| 997 | ]; |
|
| 998 | $last_id = Database::insert($tbl_thematic_plan, $params); |
|
| 999 | if ($last_id) { |
|
| 1000 | $sql = "UPDATE $tbl_thematic_plan SET id = iid WHERE iid = $last_id"; |
|
| 1001 | Database::query($sql); |
|
| 1002 | api_item_property_update( |
|
| 1003 | $_course, |
|
| 1004 | 'thematic_plan', |
|
| 1005 | $last_id, |
|
| 1006 | "ThematicPlanAdded", |
|
| 1007 | $user_id |
|
| 1008 | ); |
|
| 1009 | } |
|
| 1010 | } |
|
| 1011 | } else { |
|
| 1012 | // insert |
|
| 1013 | $params = [ |
|
| @@ 1011-1033 (lines=23) @@ | ||
| 1008 | ); |
|
| 1009 | } |
|
| 1010 | } |
|
| 1011 | } else { |
|
| 1012 | // insert |
|
| 1013 | $params = [ |
|
| 1014 | 'c_id' => $this->course_int_id, |
|
| 1015 | 'thematic_id' => $thematic_id, |
|
| 1016 | 'title' => $title, |
|
| 1017 | 'description' => $description, |
|
| 1018 | 'description_type' => $description_type |
|
| 1019 | ]; |
|
| 1020 | $last_id = Database::insert($tbl_thematic_plan, $params); |
|
| 1021 | ||
| 1022 | if ($last_id) { |
|
| 1023 | $sql = "UPDATE $tbl_thematic_plan SET id = iid WHERE iid = $last_id"; |
|
| 1024 | Database::query($sql); |
|
| 1025 | api_item_property_update( |
|
| 1026 | $_course, |
|
| 1027 | 'thematic_plan', |
|
| 1028 | $last_id, |
|
| 1029 | "ThematicPlanAdded", |
|
| 1030 | $user_id |
|
| 1031 | ); |
|
| 1032 | } |
|
| 1033 | } |
|
| 1034 | ||
| 1035 | return $affected_rows; |
|
| 1036 | } |
|