Ejemplo n.º 1
0
 echo '<td>' . $row['thread_replies'] . '</td>';
 echo '<td>' . $row['thread_views'] . '</td>';
 // display the author name
 $tab_poster_info = api_get_user_info($row['user_id']);
 $poster_username = sprintf(get_lang('LoginX'), $tab_poster_info['username']);
 if ($origin != 'learnpath') {
     echo '<td>' . display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']), '', $poster_username) . '</td>';
 } else {
     echo '<td>' . Display::tag('span', api_get_person_name($row['firstname'], $row['lastname']), array("title" => api_htmlentities($poster_username, ENT_QUOTES))) . '</td>';
 }
 $last_post_info = get_last_post_by_thread($row['c_id'], $row['thread_id'], $row['forum_id'], is_allowed_to_edit());
 $last_post = null;
 if ($last_post_info) {
     $poster_info = api_get_user_info($last_post_info['poster_id']);
     $post_date = api_convert_and_format_date($last_post_info['post_date']);
     $last_post = $post_date . ' ' . get_lang('By') . ' ' . display_user_link($last_post_info['poster_id'], $poster_info['complete_name'], '', $poster_info['username']);
 }
 /*
             if ($row['last_poster_user_id'] == '0') {
                 $name = $row['poster_name'];
                 $last_poster_username = "";
             } else {
                 $name = api_get_person_name($row['last_poster_firstname'], $row['last_poster_lastname']);
                 $tab_last_poster_info = api_get_user_info($row['last_poster_user_id']);
                 $last_poster_username = sprintf(get_lang('LoginX'), $tab_last_poster_info['username']);
             }
             // If the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread.
             if (($row['visible'] == '1' OR api_is_allowed_to_edit(false, true)) && $origin != 'learnpath') {
                 $last_post = $post_date.' '.get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name, '', $last_poster_username);
             } elseif ($origin != 'learnpath') {
                 $last_post_sql = "SELECT post.*, user.firstname, user.lastname, user.username FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' AND post.c_id=".api_get_course_int_id()." ORDER BY post_id DESC";
 // the number of topics and posts
 $my_number_threads = isset($forum['number_of_threads']) ? $forum['number_of_threads'] : '';
 $my_number_posts = isset($forum['number_of_posts']) ? $forum['number_of_posts'] : '';
 echo '<td>' . $my_number_threads . '</td>';
 echo '<td>' . $my_number_posts . '</td>';
 // the last post in the forum
 if ($forum['last_poster_name'] != '') {
     $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() . '&amp;forumcategory=' . Security::remove_XSS($_GET['forumcategory']) . '&amp;action=edit&amp;content=forum&amp;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() . '&amp;forumcategory=' . Security::remove_XSS($_GET['forumcategory']) . '&amp;action=delete&amp;content=forum&amp;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';
     }
Ejemplo n.º 3
0
 $html .= Display::return_icon('post-forum.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
 $html .= ' ' . $number_threads . '<br>' . $newPost . '</div>';
 $html .= '<div class="col-md-6">';
 // The last post in the forum.
 if ($forum['last_poster_name'] != '') {
     $name = $forum['last_poster_name'];
     $poster_id = 0;
     $username = "";
 } 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';
Ejemplo n.º 4
0
 }
 $indent = $post['indent_cnt'] * '20';
 echo "<div style=\"margin-left: " . $indent . "px;\">";
 echo "<table width=\"100%\"  class=\"post\" cellspacing=\"5\" border=\"0\">";
 echo "<tr>";
 echo "<td rowspan=\"3\" class=\"{$leftclass}\">";
 $username = sprintf(get_lang('LoginX'), $post['username']);
 if ($post['user_id'] == '0') {
     $name = $post['poster_name'];
 } else {
     $name = api_get_person_name($post['firstname'], $post['lastname']);
 }
 if (api_get_course_setting('allow_user_image_forum')) {
     echo '<br />' . display_user_image($post['user_id'], $name, $origin) . '<br />';
 }
 echo display_user_link($post['user_id'], $name, $origin, $username) . "<br />";
 echo api_convert_and_format_date($post['post_date']) . '<br /><br />';
 // get attach id
 $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'] . "&amp;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() . "&amp;gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&amp;forum=" . $clean_forum_id . "&amp;thread=" . $clean_thread_id . "&amp;action=delete&amp;content=post&amp;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>";
     }
Ejemplo n.º 5
0
 $html .= '<div class="row">';
 $html .= '<div class="col-md-2">';
 $html .= Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL);
 $html .= ' ' . $my_number_threads . '<br>' . $newPost . '</div>';
 // the last post in the forum
 if ($forum['last_poster_name'] != '') {
     $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'];
 }
 $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';
     }
Ejemplo n.º 6
0
         $closedPost = Display::tag('div', '<i class="fa fa-exclamation-triangle"></i> ' . get_lang('ForumLocked'), array('class' => 'alert alert-warning post-closed'));
     }
     if ($current_thread['locked'] == 1) {
         $closedPost = Display::tag('div', '<i class="fa fa-exclamation-triangle"></i> ' . get_lang('ThreadLocked'), array('class' => 'alert alert-warning post-closed'));
     }
 }
 $html = '';
 $html .= '<div class="panel panel-default forum-post">';
 $html .= '<div class="panel-body">';
 $html .= '<div class="row">';
 $html .= '<div class="col-md-2">';
 if ($origin != 'learnpath') {
     if (api_get_course_setting('allow_user_image_forum')) {
         $html .= '<div class="thumbnail">' . display_user_image($row['user_id'], $name) . '</div>';
     }
     $html .= Display::tag('h4', display_user_link($row['user_id'], $name), array('class' => 'title-username'));
 } else {
     $html .= Display::tag('span', $name, array('title' => api_htmlentities($username, ENT_QUOTES)));
 }
 $html .= Display::tag('p', api_convert_and_format_date($row['post_date']), array('class' => 'post-date'));
 // get attach id
 $attachment_list = get_attachment($row['post_id']);
 $id_attach = !empty($attachment_list) ? $attachment_list['iid'] : '';
 $iconEdit = '';
 // 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($userId, $groupId) || $current_forum['allow_edit'] == 1 && $row['user_id'] == $_user['user_id'] || api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) {
     if (api_is_allowed_to_session_edit(false, true)) {
         if ($locked == false) {
             $iconEdit .= "<a href=\"editpost.php?" . api_get_cidreq() . "&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>";
Ejemplo n.º 7
0
 echo '<td>' . $number_threads . '</td>';
 echo '<td>' . $number_posts . '</td>';
 // The last post in the forum.
 if ($forum['last_poster_name'] != '') {
     $name = $forum['last_poster_name'];
     $poster_id = 0;
     $username = "";
 } 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() . '&amp;gradebook=' . $gradebook . '&amp;action=edit&amp;content=forum&amp;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() . '&amp;gradebook=' . $gradebook . '&amp;action=delete&amp;content=forum&amp;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';
Ejemplo n.º 8
0
     $messageclass = 'forum_message_post_text';
     $leftclass = 'forum_message_left';
 }
 echo "<tr>";
 echo "<td rowspan=\"3\" class=\"{$leftclass}\">";
 if ($row['user_id'] == '0') {
     $name = prepare4display($row['poster_name']);
 } else {
     $name = api_get_person_name($row['firstname'], $row['lastname']);
 }
 $username = sprintf(get_lang('LoginX'), $row['username']);
 if ($origin != 'learnpath') {
     if (api_get_course_setting('allow_user_image_forum')) {
         echo '<br />' . display_user_image($row['user_id'], $name) . '<br />';
     }
     echo display_user_link($row['user_id'], $name, '', $username) . '<br />';
 } else {
     echo Display::tag('span', $name, array('title' => api_htmlentities($username, ENT_QUOTES))) . '<br />';
 }
 $group_id = api_get_group_id();
 echo api_convert_and_format_date($row['post_date']) . '<br /><br />';
 // get attach id
 $attachment_list = get_attachment($row['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 (api_is_allowed_to_session_edit(false, true)) {
         if ($locked == false) {
             echo "<a href=\"editpost.php?" . api_get_cidreq() . "&amp;gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&amp;forum=" . $clean_forum_id . "&amp;thread=" . $clean_thread_id . "&amp;post=" . $row['post_id'] . "&amp;origin=" . $origin . "&amp;edit=edition&amp;id_attach=" . $id_attach . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . "</a>";
         }
// Displaying the message
// We mark the image we are displaying as set
unset($whatsnew_post_info[$forumId][$threadId][$rows[$display_post_id]['post_id']]);
echo "<table width=\"100%\" class=\"forum_table\" cellspacing=\"5\" border=\"0\">";
echo "<tr>";
echo "<td rowspan=\"3\" class=\"{$leftclass}\">";
$username = sprintf(get_lang('LoginX'), $rows[$display_post_id]['username']);
if ($rows[$display_post_id]['user_id'] == '0') {
    $name = prepare4display($rows[$display_post_id]['poster_name']);
} else {
    $name = api_get_person_name($rows[$display_post_id]['firstname'], $rows[$display_post_id]['lastname']);
}
if (api_get_course_setting('allow_user_image_forum')) {
    echo '<br />' . display_user_image($rows[$display_post_id]['user_id'], $name, $origin) . '<br />';
}
echo display_user_link($rows[$display_post_id]['user_id'], $name, $origin, $username) . "<br />";
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>";
    }
 $html .= '<div class="col-md-offset-' . $indent . '" >';
 $html .= '<div class="panel panel-default forum-post">';
 $html .= '<div class="panel-body">';
 $html .= '<div class="row">';
 $html .= '<div class="col-md-2">';
 $username = sprintf(get_lang('LoginX'), $post['username']);
 if ($post['user_id'] == '0') {
     $name = $post['poster_name'];
 } else {
     $name = api_get_person_name($post['firstname'], $post['lastname']);
 }
 if ($origin != 'learnpath') {
     if (api_get_course_setting('allow_user_image_forum')) {
         $html .= '<div class="thumbnail">' . display_user_image($post['user_id'], $name, $origin) . '</div>';
     }
     $html .= Display::tag('h4', display_user_link($post['user_id'], $name, $origin, $username), array('class' => 'title-username'));
 } else {
     if (api_get_course_setting('allow_user_image_forum')) {
         $html .= '<div class="thumbnail">' . display_user_image($post['user_id'], $name, $origin) . '</div>';
     }
     $html .= Display::tag('p', $name, array('title' => api_htmlentities($username, ENT_QUOTES), 'class' => 'lead'));
 }
 if ($origin != 'learnpath') {
     $html .= Display::tag('p', api_convert_and_format_date($post['post_date']), array('class' => 'post-date'));
 } else {
     $html .= Display::tag('p', api_convert_and_format_date($post['post_date'], DATE_TIME_FORMAT_SHORT), array('class' => 'text-muted'));
 }
 // get attach id
 $attachment_list = get_attachment($post['post_id']);
 $id_attach = !empty($attachment_list) ? $attachment_list['iid'] : '';
 $iconEdit = '';