, Ghent University * @Copyright Ghent University * @Copyright Patrick Cool * * @package dokeos.forum */ // name of the language file that needs to be included $language_file = 'forum'; // including the global dokeos init file require '../inc/global.inc.php'; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; // including the global dokeos file require '../inc/global.inc.php'; // the section (tabs) $this_section=SECTION_COURSES; // notice for unauthorized people. api_protect_course_script(true); // including additional library scripts require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); $nameTools=get_lang('Forum'); /* ----------------------------------------------------------- Including necessary files ----------------------------------------------------------- */ require 'forumconfig.inc.php'; require_once 'forumfunction.inc.php'; /* ============================================================================== MAIN DISPLAY SECTION ============================================================================== */ /* ----------------------------------------------------------- Header and Breadcrumbs ----------------------------------------------------------- */ if (isset($_SESSION['gradebook'])){ $gradebook= $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook=='view') { $interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook') ); } $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" => $nameTools); $interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id']."&origin=".$origin."&search=".Security::remove_XSS(urlencode(isset($_GET['search'])?$_GET['search']:'')),"name" => prepare4display($current_forum_category['cat_title'])); if (!empty($_GET['action']) && !empty($_GET['content'])) { if ($_GET['action']=='add' && $_GET['content']=='forum' ) { $interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&action=add&content=forum', 'name' => get_lang('AddForum')); } } //are we in a lp ? $origin = ''; if (isset($_GET['origin'])) { $origin = Security::remove_XSS($_GET['origin']); } if ($origin=='learnpath') { include(api_get_path(INCLUDE_PATH).'reduced_header.inc.php'); } else { Display :: display_header(null); //api_display_tool_title($nameTools); } /* ------------------------------------------------------------------------------------------------------ ACTIONS ------------------------------------------------------------------------------------------------------ */ $whatsnew_post_info=$_SESSION['whatsnew_post_info']; /* ----------------------------------------------------------- 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['visibility']==0) { forum_not_allowed_here(); } /* ----------------------------------------------------------- Action Links ----------------------------------------------------------- */ echo '
| ";
echo ''.prepare4display($forum_category['cat_title']).' '; echo ''.prepare4display($forum_category['cat_comment']).''; echo " | \n";
if (api_is_allowed_to_edit(false,true) && !($forum_category['session_id']==0 && intval($my_session)!=0)) {
echo ''; echo "".icon('../img/edit.gif',get_lang('Edit')).""; echo "".icon('../img/delete.gif',get_lang('Delete')).""; 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 " | \n"; } echo "\t||||
|---|---|---|---|---|---|
| ".get_lang('Forum')." | \n"; echo "\t\t".get_lang('Topics')." | \n"; echo "\t\t".get_lang('Posts')." | \n"; echo "\t\t".get_lang('LastPosts')." | \n"; echo "\t\t".get_lang('Actions')." | \n"; echo "\t|
| "; $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) and !empty($my_whatsnew_post_info)) { echo icon('../img/forumgroupnew.gif'); } else { echo icon('../img/forumgroup.gif', get_lang('GroupForum')); } } else { if (is_array($my_whatsnew_post_info) and !empty($my_whatsnew_post_info)) { echo icon('../img/forum.gif', get_lang('Forum')); } else { echo icon('../img/forum.gif'); } } echo " | \n"; 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 "\t\t".prepare4display($forum['forum_title']).$session_displayed.''.$forum_title_group_addition.' '.prepare4display($forum['forum_comment'])." | \n";
//$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 "\t\t".$my_number_threads." | \n"; echo "\t\t".$my_number_posts." | \n"; // 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 "\t\t"; if (!empty($forum['last_post_id'])) { echo $forum['last_post_date']." ".get_lang('By').' '.display_user_link($poster_id, $name); } echo " | \n"; echo "\t\t"; if (api_is_allowed_to_edit(false,true) && !($forum['session_id']==0 && intval(isset($_SESSION['id_session'])?$_SESSION['id_session']:null)!=0)) { echo "".icon('../img/edit.gif',get_lang('Edit')).""; echo "".icon('../img/delete.gif',get_lang('Delete')).""; 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 "".icon('../img/'.$iconnotify,get_lang('NotifyMe')).""; } echo " | \n"; echo "\t
| ".get_lang('NoForumInThisCategory')." | |||||