, Ghent University * @Copyright Ghent University * @Copyright Patrick Cool * * @package chamilo.forum */ // Language file that needs to be included. $language_file = 'forum'; // Including the global initialization file. require_once '../inc/global.inc.php'; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; // The section (tabs) $this_section = SECTION_COURSES; // Notification for unauthorized people. api_protect_course_script(true); // Including additional library scripts. $nameTools = get_lang('ToolForum'); // Including necessary files require 'forumconfig.inc.php'; require_once 'forumfunction.inc.php'; /* Header and Breadcrumbs */ $gradebook = null; if (isset($_SESSION['gradebook'])) { $gradebook= $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook') ); } $current_forum_category = get_forum_categories($_GET['forumcategory']); $interbreadcrumb[] = array('url' => 'index.php?gradebook='.$gradebook.'&search='.Security::remove_XSS(urlencode(isset($_GET['search'])?$_GET['search']:'')),'name' => get_lang('Forum')); if (!empty($_GET['action']) && !empty($_GET['content'])) { if ($_GET['action']=='add' && $_GET['content']=='forum' ) { $interbreadcrumb[] = array('url' =>'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'].'&origin='.$origin,'name' => $current_forum_category['cat_title']); $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('AddForum')); } } else { $interbreadcrumb[] = array('url' => '#','name' => $current_forum_category['cat_title']); } // Are we in a lp ? $origin = ''; if (isset($_GET['origin'])) { $origin = Security::remove_XSS($_GET['origin']); } if ($origin=='learnpath') { Display::display_reduced_header(); } else { Display::display_header(null); } /* ACTIONS */ $whatsnew_post_info = isset($_SESSION['whatsnew_post_info']) ? $_SESSION['whatsnew_post_info'] : null; /* Is the user allowed here? */ // if the user is not a course administrator and the forum is hidden // then the user is not allowed here. if (!api_is_allowed_to_edit(false,true) AND ($current_forum_category && $current_forum_category['visibility']==0)) { api_not_allowed(); } /* Action Links */ echo '
';
echo ''.prepare4display($forum_category['cat_title']).$session_displayed.''. $session_img .' '; echo ''.prepare4display($forum_category['cat_comment']).''; if (api_is_allowed_to_edit(false, true) && !($forum_category['session_id'] == 0 && intval($my_session) != 0)) { echo ' | '; echo ''.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).''; echo '".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; display_visible_invisible_icon('forumcategory', $forum_category['cat_id'], $forum_category['visibility'], array('forumcategory' => $_GET['forumcategory'])); display_lock_unlock_icon('forumcategory', $forum_category['cat_id'], $forum_category['locked'], array('forumcategory' => $_GET['forumcategory'])); display_up_down_icon('forumcategory', $forum_category['cat_id'], $forum_categories_list); echo ' | '; } echo '||||
---|---|---|---|---|---|
'.get_lang('Forum').' | '; echo ''.get_lang('ForumThreads').' | '; echo ''.get_lang('Posts').' | '; echo ''.get_lang('LastPosts').' | '; echo ''.get_lang('Actions').' | '; echo '|
'; $my_whatsnew_post_info = isset($whatsnew_post_info[$forum['forum_id']]) ? $whatsnew_post_info[$forum['forum_id']] : null; if ($forum['forum_of_group'] !== '0') { if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) { echo Display::return_icon('forumgroupnew.gif'); } else { echo Display::return_icon('forumgroup.gif', get_lang('GroupForum')); } } else { if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) { echo Display::return_icon('forum.gif', get_lang('Forum')); } else { echo Display::return_icon('forum.gif'); } } echo ' | '; 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 = ' ('.get_lang('GoTo').' '.$group_title.')'; } 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 ''.prepare4display($forum['forum_title']).$session_displayed.''.$forum_title_group_addition.' '.prepare4display($forum['forum_comment']).' | ';
//$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 ''.$my_number_threads.' | '; echo ''.$my_number_posts.' | '; // 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 ''; if (!empty($forum['last_post_id'])) { echo $forum['last_post_date'].' '.get_lang('By').' '.display_user_link($poster_id, $name); } echo ' | '; echo ''; if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval(isset($_SESSION['id_session']) ? $_SESSION['id_session'] : null) != 0)) { echo ''.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).''; echo '".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; 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 ''.Display::return_icon($iconnotify, get_lang('NotifyMe')).''; } echo ' |
'.get_lang('NoForumInThisCategory').' |