if (isset($row['post_id'])) { $attachment_list = get_attachment($row['post_id']); } $id_attach = !empty($attachment_list) ? $attachment_list['id'] : ''; $sql_post_id = "SELECT post_id FROM {$table_posts} WHERE c_id = {$course_id} AND post_title='" . Database::escape_string($row['thread_title']) . "'"; $result_post_id = Database::query($sql_post_id); $row_post_id = Database::fetch_array($result_post_id); if ($origin != 'learnpath') { if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { echo '<a href="' . $forumUrl . 'editpost.php?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&thread=' . Security::remove_XSS($row['thread_id']) . '&post=' . $row_post_id['post_id'] . '&id_attach=' . $id_attach . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; if (api_resource_is_locked_by_gradebook($row['thread_id'], LINK_FORUM_THREAD)) { echo Display::return_icon('delete_na.png', get_lang('ResourceLockedByGradebook'), array(), ICON_SIZE_SMALL); } else { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&action=delete&content=thread&id=' . $row['thread_id'] . $origin_string . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeleteCompleteThread'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; } display_visible_invisible_icon('thread', $row['thread_id'], $row['visibility'], array('forum' => $my_forum, 'origin' => $origin, 'gidReq' => $groupId)); display_lock_unlock_icon('thread', $row['thread_id'], $row['locked'], array('forum' => $my_forum, 'origin' => $origin, 'gidReq' => api_get_group_id())); echo '<a href="viewforum.php?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&action=move&thread=' . $row['thread_id'] . $origin_string . '">' . Display::return_icon('move.png', get_lang('MoveThread'), array(), ICON_SIZE_SMALL) . '</a>'; } } $iconnotify = 'send_mail.gif'; if (is_array(isset($_SESSION['forum_notification']['thread']) ? $_SESSION['forum_notification']['thread'] : null)) { if (in_array($row['thread_id'], $_SESSION['forum_notification']['thread'])) { $iconnotify = 'send_mail_checked.gif'; } } $icon_liststd = 'user.png'; if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&origin=' . $origin . '&action=notify&content=thread&id=' . $row['thread_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>'; } if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
$name = $forum['last_poster_name']; $poster_id = 0; } else { $name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']); $poster_id = $forum['last_poster_id']; } echo '<td>'; if (!empty($forum['last_post_id'])) { echo $forum['last_post_date'] . ' ' . get_lang('By') . ' ' . display_user_link($poster_id, $name); } echo '</td>'; echo '<td class="td_actions">'; if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval(isset($_SESSION['id_session']) ? $_SESSION['id_session'] : null) != 0)) { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' . Security::remove_XSS($_GET['forumcategory']) . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' . Security::remove_XSS($_GET['forumcategory']) . '&action=delete&content=forum&id=' . $forum['forum_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; display_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility'], array('forumcategory' => $_GET['forumcategory'])); display_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked'], array('forumcategory' => $_GET['forumcategory'])); display_up_down_icon('forum', $forum['forum_id'], $forums_in_category); } $iconnotify = 'send_mail.gif'; if (is_array(isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : null)) { if (in_array($forum['forum_id'], $_SESSION['forum_notification']['forum'])) { $iconnotify = 'send_mail_checked.gif'; } } if (!api_is_anonymous()) { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' . Security::remove_XSS($_GET['forumcategory']) . '&action=notify&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>'; } echo '</td></tr>'; } }
$attachment_list = get_attachment($post['post_id']); $id_attach = !empty($attachment_list) ? $attachment_list['id'] : ''; // The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum // The course admin him/herself can do this off course always if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or $current_forum['allow_edit'] == 1 and $row['user_id'] == $_user['user_id'] or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { if ($locked == false) { echo "<a href=\"editpost.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&post=" . $post['post_id'] . "&id_attach=" . $id_attach . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . "</a>"; } } if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { if ($locked == false) { echo "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=delete&content=post&id=" . $post['post_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . "</a>"; } } if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { display_visible_invisible_icon('post', $post['post_id'], $post['visible'], array('forum' => $clean_forum_id, 'thread' => $clean_thread_id)); if ($count > 0) { echo "<a href=\"viewthread.php?" . api_get_cidreq() . "&gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=move&origin=" . $origin . "&post=" . $post['post_id'] . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>"; } } $userinf = api_get_user_info($post['user_id']); $user_status = api_get_status_of_user_in_course($post['user_id'], api_get_course_id()); if (api_is_allowed_to_edit(null, true)) { //if ($count>0 && $user_status!=1) { if ($count > 0) { $current_qualify_thread = show_qualify('1', $post['user_id'], $_GET['thread']); if ($locked == false) { echo "<a href=\"forumqualify.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=list&post=" . $post['post_id'] . "&user="******"&user_id=" . $post['user_id'] . "&origin=" . $origin . "&idtextqualify=" . $current_qualify_thread . "\" >" . Display::return_icon('new_test_small.gif', get_lang('Qualify')) . "</a>"; } } }
} else { $name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']); $poster_id = $forum['last_poster_id']; $userinfo = api_get_user_info($poster_id); $username = sprintf(get_lang('LoginX'), $userinfo['username']); } echo '<td nowrap="nowrap">'; if (!empty($forum['last_post_id'])) { echo api_convert_and_format_date($forum['last_post_date']) . '<br /> ' . get_lang('By') . ' ' . display_user_link($poster_id, $name, '', $username); } echo '</td>'; echo '<td class="td_actions">'; if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval($session_id) != 0)) { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&gradebook=' . $gradebook . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&gradebook=' . $gradebook . '&action=delete&content=forum&id=' . $forum['forum_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; display_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility']); display_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked']); display_up_down_icon('forum', $forum['forum_id'], $forumsInCategory); } $iconnotify = 'send_mail.gif'; $session_forum_notification = isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : false; if (is_array($session_forum_notification)) { if (in_array($forum['forum_id'], $session_forum_notification)) { $iconnotify = 'send_mail_checked.gif'; } } if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&gradebook=' . $gradebook . '&action=notify&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>'; } echo '</td></tr>'; }
// The course admin him/herself can do this off course always if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or $current_forum['allow_edit'] == 1 and $row['user_id'] == $_user['user_id'] or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { if (api_is_allowed_to_session_edit(false, true)) { if ($locked == false) { echo "<a href=\"editpost.php?" . api_get_cidreq() . "&gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&post=" . $row['post_id'] . "&origin=" . $origin . "&edit=edition&id_attach=" . $id_attach . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . "</a>"; } } } if ($origin != 'learnpath') { if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { if ($locked == false) { echo "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=delete&content=post&id=" . $row['post_id'] . "&origin=" . $origin . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . "</a>"; } } if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { display_visible_invisible_icon('post', $row['post_id'], $row['visible'], array('forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'origin' => $origin)); echo ""; if ($increment > 0) { echo "<a href=\"viewthread.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=move&post=" . $row['post_id'] . "&origin=" . $origin . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>"; } } } $user_status = api_get_status_of_user_in_course($row['user_id'], api_get_course_int_id()); $current_qualify_thread = show_qualify('1', $row['poster_id'], $_GET['thread']); if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') { $my_forum_id = $clean_forum_id; if (isset($_GET['gradebook'])) { $info_thread = get_thread_information($clean_thread_id); $my_forum_id = $info_thread['forum_id']; } if ($increment > 0 && $locked == false) {
echo api_convert_and_format_date($rows[$display_post_id]['post_date']) . '<br /><br />'; // Get attach id $attachment_list = get_attachment($display_post_id); $id_attach = !empty($attachment_list) ? $attachment_list['id'] : ''; // The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum // The course admin him/herself can do this off course always if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or $current_forum['allow_edit'] == 1 and $row['user_id'] == $_user['user_id'] or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { if ($locked == false) { echo "<a href=\"editpost.php?" . api_get_cidreq() . "&forum=" . $forumId . "&thread=" . $threadId . "&post=" . $rows[$display_post_id]['post_id'] . "&id_attach=" . $id_attach . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; } } if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) { if ($locked == false) { echo "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&forum=" . $forumId . "&thread=" . $threadId . "&action=delete&content=post&id=" . $rows[$display_post_id]['post_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . "</a>"; } display_visible_invisible_icon('post', $rows[$display_post_id]['post_id'], $rows[$display_post_id]['visible'], array('forum' => $forumId, 'thread' => $threadId, 'post' => Security::remove_XSS($_GET['post']))); // Verified the post minor $my_post = get_posts($_GET['thread']); $id_posts = array(); if (!empty($my_post) && is_array($my_post)) { foreach ($my_post as $post_value) { $id_posts[] = $post_value['post_id']; } sort($id_posts, SORT_NUMERIC); reset($id_posts); // The post minor $post_minor = (int) $id_posts[0]; $post_id = isset($_GET['post']) ? (int) $_GET['post'] : 0; if (!isset($_GET['id']) && $post_id > $post_minor) { echo "<a href=\"viewthread.php?" . api_get_cidreq() . "&gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&forum=" . $forumId . "&thread=" . $threadId . "&origin=" . $origin . "&action=move&post=" . $rows[$display_post_id]['post_id'] . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>"; }