, Ghent University * @copyright Ghent University * @copyright Patrick Cool * * @package chamilo.forum */ require_once __DIR__.'/../inc/global.inc.php'; $current_course_tool = TOOL_FORUM; $htmlHeadXtra[] = ''; // The section (tabs). $this_section = SECTION_COURSES; // Notification for unauthorized people. api_protect_course_script(true); $nameTools = get_lang('Forums'); $_course = api_get_course_info(); $sessionId = api_get_session_id(); $_user = api_get_user_info(); // Including necessary files. require_once 'forumconfig.inc.php'; require_once 'forumfunction.inc.php'; if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') { $_SESSION['gradebook'] = Security::remove_XSS($_GET['gradebook']); $gradebook = $_SESSION['gradebook']; } elseif (empty($_GET['gradebook'])) { unset($_SESSION['gradebook']); $gradebook = ''; } if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'), ); } $search_forum = isset($_GET['search']) ? Security::remove_XSS($_GET['search']) : ''; /* ACTIONS */ $actions = isset($_GET['action']) ? $_GET['action'] : ''; if ($actions === 'add') { switch ($_GET['content']) { case 'forum': $interbreadcrumb[] = array( 'url' => 'index.php?search='.$search_forum.'&'.api_get_cidreq(), 'name' => get_lang('Forum'), ); $interbreadcrumb[] = array( 'url' => '#', 'name' => get_lang('AddForum'), ); break; case 'forumcategory': $interbreadcrumb[] = array( 'url' => 'index.php?search='.$search_forum.'&'.api_get_cidreq(), 'name' => get_lang('Forum'), ); $interbreadcrumb[] = array( 'url' => '#', 'name' => get_lang('AddForumCategory'), ); break; default: break; } } else { $interbreadcrumb[] = array( 'url' => '#', 'name' => get_lang('ForumCategories'), ); } Display::display_header(''); // Tool introduction Display::display_introduction_section(TOOL_FORUM); $form_count = 0; if (api_is_allowed_to_edit(false, true)) { //if is called from a learning path lp_id $lp_id = isset($_REQUEST['lp_id']) ? intval($_REQUEST['lp_id']) : null; handle_forum_and_forumcategories($lp_id); } // Notification if ($actions == 'notify' && isset($_GET['content']) && isset($_GET['id'])) { if ( api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false ) { api_not_allowed(); } $return_message = set_notification($_GET['content'], $_GET['id']); echo Display::return_message($return_message, 'confirm', false); } get_whats_new(); $whatsnew_post_info = Session::read('whatsnew_post_info'); /* TRACKING */ Event::event_access_tool(TOOL_FORUM); /* RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS note: we do this here just after het handling of the actions to be sure that we already incorporate the latest changes */ // Step 1: We store all the forum categories in an array $forum_categories. $forumCategories = get_forum_categories(); // Step 2: We find all the forums (only the visible ones if it is a student). // display group forum in general forum tool depending to configuration option $setting = api_get_setting('display_groups_forum_in_general_tool'); $forum_list = get_forums('', '', $setting === 'true'); $user_id = api_get_user_id(); /* RETRIEVING ALL GROUPS AND THOSE OF THE USER */ // The groups of the user. $groups_of_user = array(); $groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id); // All groups in the course (and sorting them as the // id of the group = the key of the array). if (!api_is_anonymous()) { $all_groups = GroupManager::get_group_list(); if (is_array($all_groups)) { foreach ($all_groups as $group) { $all_groups[$group['id']] = $group; } } } /* ACTION LINKS */ echo '
'.$number_threads.' '.get_lang('ForumThreads').'
' . '