api_item_property_update($_course, $constants[$content], $id, $target_visibility, api_get_user_id()); // Note: Check if this returns true or false => returnmessage depends on it.
@ -997,8 +998,9 @@ function change_lock_status($content, $id, $action)
* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
* @param $direction do we want to move it up or down.
* @param $id the id of the content we want to make invisible
* @todo consider removing the table_item_property calls here but this can prevent unwanted side effects when a forum does not have an entry in
* the item_property table but does have one in the forum table.
* @todo consider removing the table_item_property calls here but this can
* prevent unwanted side effects when a forum does not have an entry in
* the item_property table but does have one in the forum table.
* @return string language variable
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@ -1111,7 +1113,8 @@ function class_visible_invisible($current_visibility_status)
* Retrieve all the information off the forum categories (or one specific) for the current course.
* The categories are sorted according to their sorting order (cat_order
*
* @param int $id default ''. When an id is passed we only find the information about that specific forum category. If no id is passed we get all the forum categories.
* @param int $id default ''. When an id is passed we only find the information
* about that specific forum category. If no id is passed we get all the forum categories.
* @return array containing all the information about all the forum categories
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@ -1216,8 +1219,10 @@ function get_forums_in_category($cat_id)
}
/**
* Retrieve all the forums (regardless of their category) or of only one. The forums are sorted according to the forum_order.
* Since it does not take the forum category into account there probably will be two or more forums that have forum_order=1, ...
* Retrieve all the forums (regardless of their category) or of only one.
* The forums are sorted according to the forum_order.
* Since it does not take the forum category into account there probably
* will be two or more forums that have forum_order=1, ...
* @param int forum id
* @param string course db name
* @return an array containing all the information about the forums (regardless of their category)
function get_last_post_by_thread($course_id, $thread_id, $forum_id, $show_visible = true)
{
if (empty($thread_id) || empty($forum_id) || empty($course_id)) {
@ -1461,7 +1476,8 @@ function get_last_post_by_thread($course_id, $thread_id, $forum_id, $show_visibl
* @param int $forum_id the id of the forum we want to know the last post information of.
* @param bool $show_invisibles
* @param string course db name
* @return array containing all the information about the last post (last_post_id, last_poster_id, last_post_date, last_poster_name, last_poster_lastname, last_poster_firstname)
* @return array containing all the information about the last post
@ -2087,7 +2106,8 @@ function store_thread($current_forum, $values)
$last_post_id = Database::insert_id();
// Now we have to update the thread table to fill the thread_last_post field (so that we know when the thread has been updated for the last time).
$sql = "UPDATE $table_threads SET thread_last_post='".Database::escape_string($last_post_id)."' WHERE c_id = $course_id AND thread_id='".Database::escape_string($last_thread_id)."'";
$sql = "UPDATE $table_threads SET thread_last_post='".Database::escape_string($last_post_id)."'
WHERE c_id = $course_id AND thread_id='".Database::escape_string($last_thread_id)."'";
$result = Database::query($sql);
$message = get_lang('NewThreadStored');
// Storing the attachments if any.
@ -2103,8 +2123,7 @@ function store_thread($current_forum, $values)
$sql = "SELECT * FROM $table_notification WHERE c_id = ".api_get_course_int_id()." AND (forum_id = '".Database::escape_string($current_forum['forum_id'])."' OR thread_id = '".Database::escape_string($thread_id)."' ) ";
$sql = "SELECT * FROM $table_notification
WHERE
c_id = ".api_get_course_int_id()." AND
(
forum_id = '".Database::escape_string($current_forum['forum_id'])."' OR
@ -137,18 +137,18 @@ if ($origin == 'learnpath') {
/* Actions */
// Change visibility of a forum or a forum category.
if (($my_action == 'invisible' OR $my_action=='visible') AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) {
$message = change_visibility($_GET['content'], $_GET['id'], $_GET['action']); // Note: This has to be cleaned first.
if (($my_action == 'lock' OR $my_action == 'unlock') AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) {
$message = change_lock_status($_GET['content'], $_GET['id'], $my_action); // Note: This has to be cleaned first.
if ($my_action == 'delete' AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) {
if ($my_action == 'delete' AND isset($_GET['content']) AND isset($_GET['id']) AND (api_is_allowed_to_edit(false, true) OR GroupManager::is_tutor_of_group(api_get_user_id(), $group_id))) {
$message = delete_post($_GET['id']); // Note: This has to be cleaned first.
$message = delete_post($_GET['id']);
}
if (($my_action == 'invisible' OR $my_action == 'visible') AND isset($_GET['id']) AND (api_is_allowed_to_edit(false, true) OR GroupManager::is_tutor_of_group(api_get_user_id(), $group_id))) {
$message = approve_post($_GET['id'], $_GET['action']); // Note: This has to be cleaned first.