| @@ 735-755 (lines=21) @@ | ||
| 732 | 'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : 0 |
|
| 733 | ]; |
|
| 734 | $last_id = Database::insert($table_forums, $params); |
|
| 735 | if ($last_id > 0) { |
|
| 736 | ||
| 737 | $sql = "UPDATE $table_forums SET forum_id = iid WHERE iid = $last_id"; |
|
| 738 | Database::query($sql); |
|
| 739 | ||
| 740 | api_item_property_update( |
|
| 741 | $courseInfo, |
|
| 742 | TOOL_FORUM, |
|
| 743 | $last_id, |
|
| 744 | 'ForumAdded', |
|
| 745 | api_get_user_id(), |
|
| 746 | $group_id |
|
| 747 | ); |
|
| 748 | ||
| 749 | api_set_default_visibility( |
|
| 750 | $last_id, |
|
| 751 | TOOL_FORUM, |
|
| 752 | $group_id, |
|
| 753 | $courseInfo |
|
| 754 | ); |
|
| 755 | } |
|
| 756 | $return_message = get_lang('ForumAdded'); |
|
| 757 | if ($returnId) { |
|
| 758 | ||
| @@ 4769-4774 (lines=6) @@ | ||
| 4766 | $safe_post_id = (int) $post_id; |
|
| 4767 | $safe_id_attach = (int) $id_attach; |
|
| 4768 | // Storing the attachments if any. |
|
| 4769 | if ($result) { |
|
| 4770 | $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']."' |
|
| 4771 | WHERE c_id = $course_id AND id = '$safe_id_attach'"; |
|
| 4772 | Database::query($sql); |
|
| 4773 | api_item_property_update($_course, TOOL_FORUM_ATTACH, $safe_id_attach, 'ForumAttachmentUpdated', api_get_user_id()); |
|
| 4774 | } |
|
| 4775 | } |
|
| 4776 | } |
|
| 4777 | } |
|
| @@ 867-881 (lines=15) @@ | ||
| 864 | ||
| 865 | $id = Database::insert($tbl_lp, $params); |
|
| 866 | ||
| 867 | if ($id > 0) { |
|
| 868 | $sql = "UPDATE $tbl_lp SET id = iid WHERE iid = $id"; |
|
| 869 | Database::query($sql); |
|
| 870 | ||
| 871 | // Insert into item_property. |
|
| 872 | api_item_property_update( |
|
| 873 | $courseInfo, |
|
| 874 | TOOL_LEARNPATH, |
|
| 875 | $id, |
|
| 876 | 'LearnpathAdded', |
|
| 877 | $userId |
|
| 878 | ); |
|
| 879 | api_set_default_visibility($id, TOOL_LEARNPATH, 0, $courseInfo, $session_id, $userId); |
|
| 880 | return $id; |
|
| 881 | } |
|
| 882 | break; |
|
| 883 | } |
|
| 884 | } |
|