$class = 'row_even'; } echo "<tr class=\"{$class}\">"; echo '<td>'; $my_whatsnew_post_info = isset($whatsnew_post_info[$my_forum][$row['thread_id']]) ? $whatsnew_post_info[$my_forum][$row['thread_id']] : null; if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) { echo Display::return_icon('forumthread.gif'); } else { echo Display::return_icon('forumthread.gif'); } if ($row['thread_sticky'] == 1) { echo Display::return_icon('exclamation.gif'); } echo '</td>'; echo '<td>'; echo '<a href="viewthread.php?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&origin=' . $origin . '&thread=' . $row['thread_id'] . $origin_string . '&search=' . Security::remove_XSS(urlencode($my_search)) . '" ' . class_visible_invisible($row['visibility']) . '>' . prepare4display($row['thread_title']) . '</a></td>'; 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']);
} echo '</td>'; if ($forum['forum_of_group'] != '0') { $my_all_groups_forum_name = isset($all_groups[$forum['forum_of_group']]['name']) ? $all_groups[$forum['forum_of_group']]['name'] : null; $my_all_groups_forum_id = isset($all_groups[$forum['forum_of_group']]['id']) ? $all_groups[$forum['forum_of_group']]['id'] : null; $group_title = api_substr($my_all_groups_forum_name, 0, 30); $forum_title_group_addition = ' (<a href="../group/group_space.php?' . api_get_cidreq() . '&gidReq=' . $my_all_groups_forum_id . '" class="forum_group_link">' . get_lang('GoTo') . ' ' . $group_title . '</a>)'; } else { $forum_title_group_addition = ''; } if ((!isset($_SESSION['id_session']) || $_SESSION['id_session'] == 0) && !empty($forum['session_name'])) { $session_displayed = ' (' . $forum['session_name'] . ')'; } else { $session_displayed = ''; } echo '<td><a href="viewforum.php?' . api_get_cidreq() . '&gidReq=' . $forum['forum_of_group'] . '&forum=' . $forum['forum_id'] . '&origin=' . $origin . '&search=' . Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')) . '" ' . class_visible_invisible($forum['visibility']) . '>' . prepare4display($forum['forum_title']) . $session_displayed . '</a>' . $forum_title_group_addition . '<br />' . prepare4display($forum['forum_comment']) . '</td>'; //$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated // 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 ($origin != 'learnpath') { echo '<div class="actions">'; echo '<span style="float:right;">' . search_link() . '</span>'; if ($origin == 'group') { echo '<a href="../group/group_space.php?' . api_get_cidreq() . '&gidReq=' . Security::remove_XSS($_GET['gidReq']) . '&gradebook=' . $gradebook . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('Groups'), '', ICON_SIZE_MEDIUM) . '</a>'; } else { echo '<a href="index.php?gradebook=' . $gradebook . '">' . Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM) . '</a>'; } echo '<a href="viewforum.php?forum=' . Security::remove_XSS($_GET['forum']) . '&gidReq=' . Security::remove_XSS($_GET['gidReq']) . '&origin=' . $origin . '">' . Display::return_icon('forum.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; } /* Display Forum Category and the Forum information */ echo "<table class=\"forum_table\" width=\"100%\">"; // The forum category echo "<tr><th class=\"forum_head\" colspan=\"2\">"; echo '<a href="viewforum.php?&origin=' . $origin . '&forum=' . $current_forum['forum_id'] . '" ' . class_visible_invisible($current_forum['visibility']) . '>' . prepare4display($current_forum['forum_title']) . '</a><br />'; echo '<span class="forum_description">' . prepare4display($current_forum['forum_comment']) . '</span>'; echo "</th>"; echo "</tr>"; echo '</table>'; // The form for the reply $values = show_edit_post_form($current_post, $current_thread, $current_forum, isset($_SESSION['formelements']) ? $_SESSION['formelements'] : ''); if (!empty($values) and isset($_POST['SubmitPost'])) { store_edit_post($values); $option_chek = isset($values['thread_qualify_gradebook']) ? $values['thread_qualify_gradebook'] : null; // values 1 or 0 if (1 == $option_chek) { $id = $values['thread_id']; $title_gradebook = Security::remove_XSS(stripslashes($values['calification_notebook_title'])); $value_calification = $values['numeric_calification']; $weight_calification = $values['weight_calification'];
$session_img = api_get_session_image($forum['session_id'], $_user['status']); if ($forum['forum_of_group'] != '0') { $my_all_groups_forum_name = isset($all_groups[$forum['forum_of_group']]['name']) ? $all_groups[$forum['forum_of_group']]['name'] : null; $my_all_groups_forum_id = isset($all_groups[$forum['forum_of_group']]['id']) ? $all_groups[$forum['forum_of_group']]['id'] : null; $group_title = api_substr($my_all_groups_forum_name, 0, 30); $forum_title_group_addition = ' (<a href="../group/group_space.php?' . api_get_cidreq() . '&gidReq=' . $forum['forum_of_group'] . '" class="forum_group_link">' . get_lang('GoTo') . ' ' . $group_title . '</a>)' . $session_img; } else { $forum_title_group_addition = ''; } if ((!isset($_SESSION['id_session']) || $_SESSION['id_session'] == 0) && !empty($forum['session_name'])) { $session_displayed = ' (' . $forum['session_name'] . ')'; } else { $session_displayed = ''; } $forum['forum_of_group'] == 0 ? $groupid = '' : ($groupid = $forum['forum_of_group']); echo '<td><a href="viewforum.php?' . api_get_cidreq() . '&gidReq=' . intval($groupid) . '&forum=' . intval($forum['forum_id']) . '" ' . class_visible_invisible(strval(intval($forum['visibility']))) . '>'; //Forum title echo prepare4display($forum['forum_title']) . $session_displayed . '</a>' . $forum_title_group_addition . '<br />'; echo '<span class="forum_description">' . prepare4display($forum['forum_comment']) . '</span>'; echo '</td>'; //$number_forum_topics_and_posts = get_post_topics_of_forum($forum['forum_id']); // deprecated // The number of topics and posts. $number_threads = isset($forum['number_of_threads']) ? $forum['number_of_threads'] : null; $number_posts = isset($forum['number_of_posts']) ? $forum['number_of_posts'] : null; 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 = "";