| @@ 857-871 (lines=15) @@ | ||
| 854 | ||
| 855 | $id = Database::insert($tbl_lp, $params); |
|
| 856 | ||
| 857 | if ($id > 0) { |
|
| 858 | $sql = "UPDATE $tbl_lp SET id = iid WHERE iid = $id"; |
|
| 859 | Database::query($sql); |
|
| 860 | ||
| 861 | // Insert into item_property. |
|
| 862 | api_item_property_update( |
|
| 863 | $courseInfo, |
|
| 864 | TOOL_LEARNPATH, |
|
| 865 | $id, |
|
| 866 | 'LearnpathAdded', |
|
| 867 | $userId |
|
| 868 | ); |
|
| 869 | api_set_default_visibility($id, TOOL_LEARNPATH, 0, $courseInfo, $session_id, $userId); |
|
| 870 | return $id; |
|
| 871 | } |
|
| 872 | break; |
|
| 873 | } |
|
| 874 | } |
|
| @@ 770-790 (lines=21) @@ | ||
| 767 | ]; |
|
| 768 | ||
| 769 | $last_id = Database::insert($table_forums, $params); |
|
| 770 | if ($last_id > 0) { |
|
| 771 | $sql = "UPDATE $table_forums SET forum_id = iid WHERE iid = $last_id"; |
|
| 772 | Database::query($sql); |
|
| 773 | ||
| 774 | api_item_property_update( |
|
| 775 | $courseInfo, |
|
| 776 | TOOL_FORUM, |
|
| 777 | $last_id, |
|
| 778 | 'ForumAdded', |
|
| 779 | api_get_user_id(), |
|
| 780 | $groupInfo |
|
| 781 | ); |
|
| 782 | ||
| 783 | api_set_default_visibility( |
|
| 784 | $last_id, |
|
| 785 | TOOL_FORUM, |
|
| 786 | $group_id, |
|
| 787 | $courseInfo |
|
| 788 | ); |
|
| 789 | } |
|
| 790 | $return_message = get_lang('ForumAdded'); |
|
| 791 | if ($returnId) { |
|
| 792 | return $last_id; |
|
| 793 | } |
|
| @@ 4776-4781 (lines=6) @@ | ||
| 4773 | $safe_post_id = (int) $post_id; |
|
| 4774 | $safe_id_attach = (int) $id_attach; |
|
| 4775 | // Storing the attachments if any. |
|
| 4776 | if ($result) { |
|
| 4777 | $sql = "UPDATE $table_forum_attachment SET filename = '$safe_file_name', comment = '$safe_file_comment', path = '$safe_new_file_name', post_id = '$safe_post_id', size ='".$attachment['size']."' |
|
| 4778 | WHERE c_id = $course_id AND id = '$safe_id_attach'"; |
|
| 4779 | Database::query($sql); |
|
| 4780 | api_item_property_update( |
|
| 4781 | $_course, |
|
| 4782 | TOOL_FORUM_ATTACH, |
|
| 4783 | $safe_id_attach, |
|
| 4784 | 'ForumAttachmentUpdated', |
|