$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') { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&origin=' . $origin . '&action=liststd&content=thread&id=' . $row['thread_id'] . '">' . Display::return_icon($icon_liststd, get_lang('StudentList'), array(), ICON_SIZE_SMALL) . '</a>';
$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>'; } }
$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>'; } } }
// Get attachment 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="editpost.php?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&thread=' . Security::remove_XSS($row['thread_id']) . '&post=' . $row_post_id['post_id'] . '&gidReq=' . $_SESSION['toolgroup'] . '&origin=' . $origin . '&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&gidReq=' . $_SESSION['toolgroup'] . '&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' => $_SESSION['toolgroup'])); display_lock_unlock_icon('thread', $row['thread_id'], $row['locked'], array('forum' => $my_forum, 'origin' => $origin, 'gidReq' => $_SESSION['toolgroup'])); echo '<a href="viewforum.php?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&action=move&gidReq=' . $_SESSION['toolgroup'] . '&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&gidReq=' . $_SESSION['toolgroup'] . '&id=' . $row['thread_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>'; } if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') { echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&origin=' . $origin . '&action=liststd&content=thread&gidReq=' . $_SESSION['toolgroup'] . '&id=' . $row['thread_id'] . '">' . Display::return_icon($icon_liststd, get_lang('StudentList'), array(), ICON_SIZE_SMALL) . '</a>';