} 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']); } if (!empty($forum['last_post_id'])) { $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' ' . api_convert_and_format_date($forum['last_post_date']) . '<br /> ' . get_lang('By') . ' ' . display_user_link($poster_id, $name, '', $username); } $html .= '</div>'; $html .= '<div class="col-md-4">'; if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval($sessionId) != 0)) { $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&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>'; $html .= return_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility']); $html .= return_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked']); $html .= return_up_down_icon('forum', $forum['forum_id'], $forumsInCategory); } $iconnotify = 'notification_mail_na.png'; $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 = 'notification_mail.png'; } } if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=notify&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe'), null, ICON_SIZE_SMALL) . '</a>'; } $html .= '</div>'; $html .= '</div>'; $html .= '</div>';
/** * This function takes care of the display of the lock icon * * @param $content what is it that we want to (un)lock: forum category, forum, thread, post * @param $id the id of the content we want to (un)lock * @param $current_visibility_status what is the current status of the visibility (0 = invisible, 1 = visible) * @return void display the lock HTML. * * @author Patrick Cool <*****@*****.**>, Ghent University * @version february 2006, dokeos 1.8 */ function display_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters = '') { echo return_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters); }
} else { $name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']); $poster_id = $forum['last_poster_id']; } $html .= '<div class="col-md-6">'; if (!empty($forum['last_post_id'])) { $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' '; $html .= api_convert_and_format_date($forum['last_post_date']) . ' ' . get_lang('By') . ' ' . display_user_link($poster_id, $name); } $html .= '</div>'; $html .= '<div class="col-md-4">'; if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && $sessionId != 0)) { $html .= '<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>'; $html .= '<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>'; $html .= return_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility'], array('forumcategory' => $_GET['forumcategory'])); $html .= return_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked'], array('forumcategory' => $_GET['forumcategory'])); $html .= return_up_down_icon('forum', $forum['forum_id'], $forums_in_category); } $iconnotify = 'notification_mail_na.png'; if (is_array(isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : null)) { if (in_array($forum['forum_id'], $_SESSION['forum_notification']['forum'])) { $iconnotify = 'notification_mail.png'; } } if (!api_is_anonymous()) { $html .= '<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>'; } $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; $html .= '</div>';
// Get attachment id. if (isset($row['post_id'])) { $attachment_list = get_attachment($row['post_id']); } $id_attach = !empty($attachment_list) ? $attachment_list['id'] : ''; $iconsEdit = ''; if ($origin != 'learnpath') { if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) { $iconsEdit .= '<a href="' . $forumUrl . 'editthread.php?' . $cidreq . '&forum=' . intval($my_forum) . '&thread=' . intval($row['thread_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)) { $iconsEdit .= Display::return_icon('delete_na.png', get_lang('ResourceLockedByGradebook'), array(), ICON_SIZE_SMALL); } else { $iconsEdit .= '<a href="' . api_get_self() . '?' . $cidreq . '&forum=' . intval($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>'; } $iconsEdit .= return_visible_invisible_icon('thread', $row['thread_id'], $row['visibility'], array('forum' => $my_forum, 'origin' => $origin, 'gidReq' => $groupId)); $iconsEdit .= return_lock_unlock_icon('thread', $row['thread_id'], $row['locked'], array('forum' => $my_forum, 'origin' => $origin, 'gidReq' => api_get_group_id())); $iconsEdit .= '<a href="viewforum.php?' . $cidreq . '&forum=' . intval($my_forum) . '&action=move&thread=' . $row['thread_id'] . $origin_string . '">' . Display::return_icon('move.png', get_lang('MoveThread'), array(), ICON_SIZE_SMALL) . '</a>'; } } $iconnotify = 'notification_mail_na.png'; if (is_array(isset($_SESSION['forum_notification']['thread']) ? $_SESSION['forum_notification']['thread'] : null)) { if (in_array($row['thread_id'], $_SESSION['forum_notification']['thread'])) { $iconnotify = 'notification_mail.png'; } } $icon_liststd = 'user.png'; if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { $iconsEdit .= '<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') { $iconsEdit .= '<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>';