2004-09-12 16:24:41 +00:00
|
|
|
<?php // $Id$
|
2002-06-20 15:15:22 +00:00
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
2005-01-25 06:09:31 +00:00
|
|
|
require_once("$CFG->libdir/rsslib.php");
|
2002-06-20 15:15:22 +00:00
|
|
|
|
|
|
|
optional_variable($id); // course
|
|
|
|
|
|
|
|
if ($id) {
|
|
|
|
if (! $course = get_record("course", "id", $id)) {
|
|
|
|
error("Course ID is incorrect");
|
|
|
|
}
|
|
|
|
} else {
|
2002-08-02 09:19:45 +00:00
|
|
|
if (! $course = get_site()) {
|
2002-06-20 15:15:22 +00:00
|
|
|
error("Could not find a top-level course!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-13 07:00:35 +00:00
|
|
|
require_course_login($course);
|
2002-06-20 15:15:22 +00:00
|
|
|
|
2004-03-13 10:41:07 +00:00
|
|
|
$currentgroup = get_current_group($course->id);
|
|
|
|
|
2002-07-31 14:19:35 +00:00
|
|
|
unset($SESSION->fromdiscussion);
|
2002-06-20 15:15:22 +00:00
|
|
|
|
2002-08-02 09:19:45 +00:00
|
|
|
add_to_log($course->id, "forum", "view forums", "index.php?id=$course->id");
|
|
|
|
|
|
|
|
$strforums = get_string("forums", "forum");
|
2002-12-23 15:33:40 +00:00
|
|
|
$strforum = get_string("forum", "forum");
|
|
|
|
$strdescription = get_string("description");
|
|
|
|
$strdiscussions = get_string("discussions", "forum");
|
|
|
|
$strsubscribed = get_string("subscribed", "forum");
|
2005-01-29 09:49:42 +00:00
|
|
|
$strunreadposts = get_string("unreadposts", "forum");
|
2005-04-24 13:27:20 +00:00
|
|
|
$strtracking = get_string('tracking', 'forum');
|
2005-04-25 17:45:15 +00:00
|
|
|
$strmarkallread = get_string('markallread', 'forum');
|
|
|
|
$strtrackforum = get_string('trackforum', 'forum');
|
|
|
|
$strnotrackforum = get_string('notrackforum', 'forum');
|
|
|
|
$strsubscribe = get_string('subscribe', 'forum');
|
|
|
|
$strunsubscribe = get_string('unsubscribe', 'forum');
|
|
|
|
$stryes = get_string('yes');
|
|
|
|
$strno = get_string('no');
|
2004-08-08 18:00:32 +00:00
|
|
|
$strrss = get_string("rss");
|
2002-12-23 15:33:40 +00:00
|
|
|
|
2005-03-09 20:50:37 +00:00
|
|
|
$searchform = forum_search_form($course);
|
2002-06-20 15:15:22 +00:00
|
|
|
|
2002-08-02 09:19:45 +00:00
|
|
|
|
2004-09-17 03:00:20 +00:00
|
|
|
// Start of the table for General Forums
|
2002-08-02 09:19:45 +00:00
|
|
|
|
2003-09-17 06:20:25 +00:00
|
|
|
$generaltable->head = array ($strforum, $strdescription, $strdiscussions);
|
2005-01-30 05:14:03 +00:00
|
|
|
$generaltable->align = array ('left', 'left', 'center');
|
2005-01-29 09:49:42 +00:00
|
|
|
|
2005-04-25 18:36:32 +00:00
|
|
|
if ($usetracking = forum_tp_can_track_forums()) {
|
2005-04-26 16:27:51 +00:00
|
|
|
$untracked = forum_tp_get_untracked_forums($USER->id, $course->id);
|
2005-04-25 18:36:32 +00:00
|
|
|
|
2005-01-29 09:49:42 +00:00
|
|
|
$generaltable->head[] = $strunreadposts;
|
2005-01-30 05:14:03 +00:00
|
|
|
$generaltable->align[] = 'center';
|
2005-04-24 13:27:20 +00:00
|
|
|
|
|
|
|
$generaltable->head[] = $strtracking;
|
|
|
|
$generaltable->align[] = 'center';
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
2002-06-20 15:15:22 +00:00
|
|
|
|
2004-10-05 23:21:38 +00:00
|
|
|
if ($can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin())) {
|
2003-09-17 06:20:25 +00:00
|
|
|
$generaltable->head[] = $strsubscribed;
|
2005-01-30 05:14:03 +00:00
|
|
|
$generaltable->align[] = 'center';
|
2002-06-20 15:15:22 +00:00
|
|
|
}
|
|
|
|
|
2005-02-16 10:40:48 +00:00
|
|
|
if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
|
2004-10-05 23:21:38 +00:00
|
|
|
isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
2004-08-08 18:00:32 +00:00
|
|
|
$CFG->enablerssfeeds && $CFG->forum_enablerssfeeds)) {
|
|
|
|
$generaltable->head[] = $strrss;
|
2005-01-30 05:14:03 +00:00
|
|
|
$generaltable->align[] = 'center';
|
2004-08-08 18:00:32 +00:00
|
|
|
}
|
|
|
|
|
2003-09-17 06:20:25 +00:00
|
|
|
|
2004-09-21 11:41:58 +00:00
|
|
|
// Parse and organise all the forums. Most forums are course modules but
|
|
|
|
// some special ones are not. These get placed in the general forums
|
2004-03-13 10:41:07 +00:00
|
|
|
// category with the forums in section 0.
|
|
|
|
|
|
|
|
$generalforums = array(); // For now
|
|
|
|
$learningforums = get_all_instances_in_course("forum", $course);
|
|
|
|
|
|
|
|
if ($forums = get_records("forum", "course", $id, "name ASC")) { // All known forums
|
|
|
|
|
|
|
|
if ($learningforums) { // Copy "full" data into this complete array
|
2004-03-13 12:01:28 +00:00
|
|
|
foreach ($learningforums as $key => $learningforum) {
|
|
|
|
$learningforum->keyreference = $key;
|
2004-03-13 10:56:38 +00:00
|
|
|
$forums[$learningforum->id] = $learningforum;
|
2004-03-13 10:41:07 +00:00
|
|
|
}
|
|
|
|
}
|
2003-09-17 06:20:25 +00:00
|
|
|
|
2002-07-20 17:56:21 +00:00
|
|
|
foreach ($forums as $forum) {
|
2004-03-13 10:56:38 +00:00
|
|
|
if (!isset($forum->visible)) {
|
2004-04-01 03:45:34 +00:00
|
|
|
$forum->visible = instance_is_visible("forum", $forum);
|
|
|
|
if (!$forum->visible and !isteacher($course->id)) {
|
|
|
|
if (isset($forum->keyreference)) {
|
|
|
|
unset($learningforums[$forum->keyreference]);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2004-03-13 10:56:38 +00:00
|
|
|
}
|
2002-07-20 18:20:19 +00:00
|
|
|
switch ($forum->type) {
|
2002-07-31 16:13:55 +00:00
|
|
|
case "news":
|
|
|
|
case "social":
|
|
|
|
$generalforums[] = $forum;
|
2004-03-13 12:01:28 +00:00
|
|
|
if (isset($forum->keyreference)) { // Should always be
|
|
|
|
unset($learningforums[$forum->keyreference]);
|
2004-03-13 10:41:07 +00:00
|
|
|
}
|
2002-07-20 18:20:19 +00:00
|
|
|
break;
|
2004-09-21 11:41:58 +00:00
|
|
|
case "teacher":
|
2002-07-20 18:20:19 +00:00
|
|
|
if (isteacher($course->id)) {
|
2004-03-13 10:41:07 +00:00
|
|
|
$forum->visible = true;
|
2002-07-20 18:20:19 +00:00
|
|
|
$generalforums[] = $forum;
|
|
|
|
}
|
|
|
|
break;
|
2002-08-03 08:16:31 +00:00
|
|
|
default:
|
2004-03-13 10:56:38 +00:00
|
|
|
if (!$course->category or empty($forum->section)) { // Site level or section 0
|
2002-08-03 08:16:31 +00:00
|
|
|
$generalforums[] = $forum;
|
2004-03-13 12:01:28 +00:00
|
|
|
if (isset($forum->keyreference)) {
|
|
|
|
unset($learningforums[$forum->keyreference]);
|
2004-03-13 10:56:38 +00:00
|
|
|
}
|
2004-09-21 11:41:58 +00:00
|
|
|
}
|
2002-08-03 08:16:31 +00:00
|
|
|
break;
|
2002-07-20 17:56:21 +00:00
|
|
|
}
|
2002-07-20 18:20:19 +00:00
|
|
|
}
|
|
|
|
}
|
2002-07-20 17:56:21 +00:00
|
|
|
|
2004-03-13 10:41:07 +00:00
|
|
|
/// First, let's process the general forums and build up a display
|
|
|
|
|
|
|
|
if ($generalforums) {
|
|
|
|
foreach ($generalforums as $forum) {
|
|
|
|
if (isset($forum->groupmode)) {
|
|
|
|
$groupmode = groupmode($course, $forum); /// Can do this because forum->groupmode is defined
|
|
|
|
} else {
|
|
|
|
$groupmode = NOGROUPS;
|
|
|
|
}
|
2004-09-21 11:41:58 +00:00
|
|
|
|
2004-03-13 10:41:07 +00:00
|
|
|
if ($groupmode == SEPARATEGROUPS and !isteacheredit($course->id)) {
|
2004-07-07 17:42:53 +00:00
|
|
|
$count = count_records_select("forum_discussions", "forum = '$forum->id' AND (groupid = '$currentgroup' OR groupid = '-1')");
|
2004-03-13 10:41:07 +00:00
|
|
|
} else {
|
|
|
|
$count = count_records("forum_discussions", "forum", "$forum->id");
|
|
|
|
}
|
2004-09-21 11:41:58 +00:00
|
|
|
|
2005-04-26 16:27:51 +00:00
|
|
|
if ($usetracking) {
|
|
|
|
if (($forum->trackingtype == FORUM_TRACKING_ON) || !isset($untracked[$forum->id])) {
|
2005-04-24 13:27:20 +00:00
|
|
|
$groupid = ($groupmode==SEPARATEGROUPS && !isteacheredit($course->id)) ? $currentgroup : false;
|
|
|
|
$unread = forum_tp_count_forum_unread_posts($USER->id, $forum->id, $groupid);
|
|
|
|
if ($unread > 0) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>';
|
|
|
|
$unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?id='.
|
|
|
|
$forum->id.'&mark=read"><img src="'.$CFG->pixpath.'/t/clear.gif" alt="" /></a></span>';
|
2005-04-24 13:27:20 +00:00
|
|
|
} else {
|
|
|
|
$unreadlink = '<span class="read"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>';
|
|
|
|
}
|
2005-04-26 16:27:51 +00:00
|
|
|
if ($forum->trackingtype == FORUM_TRACKING_OPTIONAL) {
|
|
|
|
$trackedlink = '<a title="'.$strnotrackforum.'" href="settracking.php?id='.
|
|
|
|
$forum->id.'">'.$stryes.'</a>';
|
|
|
|
}
|
2005-01-29 09:49:42 +00:00
|
|
|
} else {
|
2005-04-25 17:45:15 +00:00
|
|
|
$unreadlink = '-';
|
2005-04-26 16:27:51 +00:00
|
|
|
$trackedlink = '<a title="'.$strtrackforum.'" href="settracking.php?id='.
|
|
|
|
$forum->id.'">'.$strno.'</a>';
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-20 05:19:52 +00:00
|
|
|
$introoptions->para=false;
|
|
|
|
$forum->intro = format_text(shorten_text(trim($forum->intro), $CFG->forum_shortpost), FORMAT_HTML, $introoptions);
|
2004-03-13 10:41:07 +00:00
|
|
|
|
|
|
|
if ($forum->visible) {
|
2005-03-26 01:57:40 +00:00
|
|
|
$forumlink = "<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>";
|
2005-04-20 05:19:52 +00:00
|
|
|
$discussionlink = "<a href=\"view.php?f=$forum->id\">".$count."</a>";
|
2004-03-13 10:41:07 +00:00
|
|
|
} else {
|
2005-03-26 01:57:40 +00:00
|
|
|
$forumlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>";
|
2005-04-20 05:19:52 +00:00
|
|
|
$discussionlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".$count."</a>";
|
2004-03-13 10:41:07 +00:00
|
|
|
}
|
|
|
|
|
2004-10-05 23:21:38 +00:00
|
|
|
//If this forum has RSS activated, calculate it
|
|
|
|
$rsslink = '';
|
|
|
|
if ($show_rss) {
|
|
|
|
if ($forum->rsstype and $forum->rssarticles) {
|
|
|
|
//Calculate the tolltip text
|
|
|
|
if ($forum->rsstype == 1) {
|
2005-03-26 01:57:40 +00:00
|
|
|
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",format_string($forum->name));
|
2004-10-05 23:21:38 +00:00
|
|
|
} else {
|
2005-03-26 01:57:40 +00:00
|
|
|
$tooltiptext = get_string("rsssubscriberssposts","forum",format_string($forum->name));
|
2004-10-05 23:21:38 +00:00
|
|
|
}
|
|
|
|
if (empty($USER->id)) {
|
|
|
|
$userid = 0;
|
|
|
|
} else {
|
|
|
|
$userid = $USER->id;
|
|
|
|
}
|
|
|
|
//Get html code for RSS link
|
|
|
|
$rsslink = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-13 10:41:07 +00:00
|
|
|
if ($can_subscribe) {
|
|
|
|
if (forum_is_forcesubscribed($forum->id)) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$sublink = $stryes;
|
2004-03-13 10:41:07 +00:00
|
|
|
} else {
|
|
|
|
if ($groupmode and !isteacheredit($course->id) and !mygroupid($course->id)) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$sublink = $strno; // Can't subscribe to a group forum (not in a group)
|
2005-03-26 01:57:40 +00:00
|
|
|
$forumlink = format_string($forum->name,true);
|
2004-03-13 10:41:07 +00:00
|
|
|
} else {
|
|
|
|
if (forum_is_subscribed($USER->id, $forum->id)) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$subscribed = $stryes;
|
2004-03-13 10:41:07 +00:00
|
|
|
$subtitle = get_string("unsubscribe", "forum");
|
|
|
|
} else {
|
2005-04-25 17:45:15 +00:00
|
|
|
$subscribed = $strno;
|
2004-03-13 10:41:07 +00:00
|
|
|
$subtitle = get_string("subscribe", "forum");
|
|
|
|
}
|
|
|
|
$sublink = "<a title=\"$subtitle\" href=\"subscribe.php?id=$forum->id\">$subscribed</a>";
|
|
|
|
}
|
|
|
|
}
|
2005-04-20 05:19:52 +00:00
|
|
|
$row = array ($forumlink, $forum->intro, $discussionlink);
|
2005-04-25 18:36:32 +00:00
|
|
|
if ($usetracking) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $unreadlink;
|
2005-04-24 13:27:20 +00:00
|
|
|
$row[] = $trackedlink; // Tracking.
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
|
|
|
$row[] = $sublink;
|
2004-10-05 23:21:38 +00:00
|
|
|
if (!empty($rsslink)) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $rsslink;
|
2004-08-08 18:00:32 +00:00
|
|
|
}
|
2005-01-29 09:49:42 +00:00
|
|
|
$generaltable->data[] = $row;
|
2004-03-13 10:41:07 +00:00
|
|
|
} else {
|
2005-04-20 05:19:52 +00:00
|
|
|
$row = array ($forumlink, $forum->intro, $discussionlink);
|
2005-04-25 18:36:32 +00:00
|
|
|
if ($usetracking) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $unreadlink;
|
2005-04-24 13:27:20 +00:00
|
|
|
$row[] = $trackedlink; // Tracking.
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
2004-10-05 23:21:38 +00:00
|
|
|
if (!empty($rsslink)) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $rsslink;
|
2004-10-05 23:21:38 +00:00
|
|
|
}
|
2005-01-29 09:49:42 +00:00
|
|
|
$generaltable->data[] = $row;
|
2004-03-13 10:41:07 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-21 11:41:58 +00:00
|
|
|
}
|
2004-03-13 10:41:07 +00:00
|
|
|
|
2004-09-17 03:00:20 +00:00
|
|
|
|
|
|
|
// Start of the table for Learning Forums
|
|
|
|
$learningtable->head = array ($strforum, $strdescription, $strdiscussions);
|
|
|
|
$learningtable->align = array ("left", "left", "center");
|
|
|
|
|
2005-04-25 18:36:32 +00:00
|
|
|
if ($usetracking) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$learningtable->head[] = $strunreadposts;
|
2005-01-30 05:14:03 +00:00
|
|
|
$learningtable->align[] = 'center';
|
2005-04-24 13:27:20 +00:00
|
|
|
|
|
|
|
$learningtable->head[] = $strtracking;
|
|
|
|
$learningtable->align[] = 'center';
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
|
|
|
|
2004-10-05 23:21:38 +00:00
|
|
|
if ($can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin())) {
|
2004-09-17 03:00:20 +00:00
|
|
|
$learningtable->head[] = $strsubscribed;
|
2005-01-30 05:14:03 +00:00
|
|
|
$learningtable->align[] = 'center';
|
2004-09-17 03:00:20 +00:00
|
|
|
}
|
|
|
|
|
2005-02-16 10:40:48 +00:00
|
|
|
if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
|
2004-10-05 23:21:38 +00:00
|
|
|
isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
2004-09-17 03:00:20 +00:00
|
|
|
$CFG->enablerssfeeds && $CFG->forum_enablerssfeeds)) {
|
|
|
|
$learningtable->head[] = $strrss;
|
2005-01-30 05:14:03 +00:00
|
|
|
$learningtable->align[] = 'center';
|
2004-09-17 03:00:20 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 12:01:28 +00:00
|
|
|
/// Now let's process the learning forums
|
2004-03-13 10:41:07 +00:00
|
|
|
|
2002-08-03 08:16:31 +00:00
|
|
|
if ($course->category) { // Only real courses have learning forums
|
|
|
|
// Add extra field for section number, at the front
|
2003-09-17 06:20:25 +00:00
|
|
|
array_unshift($learningtable->head, "");
|
|
|
|
array_unshift($learningtable->align, "center");
|
2004-09-21 11:41:58 +00:00
|
|
|
|
2004-01-26 08:05:44 +00:00
|
|
|
|
2002-10-25 14:46:42 +00:00
|
|
|
if ($learningforums) {
|
2004-01-26 08:05:44 +00:00
|
|
|
$currentsection = "";
|
|
|
|
|
2004-01-29 05:59:26 +00:00
|
|
|
foreach ($learningforums as $key => $forum) {
|
2004-03-13 10:41:07 +00:00
|
|
|
$groupmode = groupmode($course, $forum); /// Can do this because forum->groupmode is defined
|
2004-09-21 11:41:58 +00:00
|
|
|
|
2004-03-13 10:41:07 +00:00
|
|
|
if ($groupmode == SEPARATEGROUPS and !isteacheredit($course->id)) {
|
2004-03-13 11:26:29 +00:00
|
|
|
$count = count_records("forum_discussions", "forum", "$forum->id", "groupid", $currentgroup);
|
2004-03-13 10:41:07 +00:00
|
|
|
} else {
|
|
|
|
$count = count_records("forum_discussions", "forum", "$forum->id");
|
|
|
|
}
|
2004-09-21 11:41:58 +00:00
|
|
|
|
2005-04-26 16:27:51 +00:00
|
|
|
if ($usetracking) {
|
|
|
|
if (($forum->trackingtype == FORUM_TRACKING_ON) ||
|
|
|
|
!isset($untracked[$forum->id])) {
|
2005-04-24 13:27:20 +00:00
|
|
|
$groupid = ($groupmode==SEPARATEGROUPS && !isteacheredit($course->id)) ? $currentgroup : false;
|
|
|
|
$unread = forum_tp_count_forum_unread_posts($USER->id, $forum->id, $groupid);
|
|
|
|
if ($unread > 0) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>';
|
|
|
|
$unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?id='.
|
|
|
|
$forum->id.'&mark=read"><img src="'.$CFG->pixpath.'/t/clear.gif" alt="" /></a></span>';
|
2005-04-24 13:27:20 +00:00
|
|
|
} else {
|
2005-04-25 03:56:02 +00:00
|
|
|
$unreadlink = '<span class="read"><a href="view.php?f='.$forum->id.'">'.$unread.'</a></span>';
|
2005-04-24 13:27:20 +00:00
|
|
|
}
|
2005-04-26 16:27:51 +00:00
|
|
|
if ($forum->trackingtype == FORUM_TRACKING_OPTIONAL) {
|
|
|
|
$trackedlink = '<a title="'.$strnotrackforum.'" href="settracking.php?id='.
|
|
|
|
$forum->id.'">'.$stryes.'</a>';
|
|
|
|
}
|
2005-01-29 09:49:42 +00:00
|
|
|
} else {
|
2005-04-25 17:45:15 +00:00
|
|
|
$unreadlink = '-';
|
|
|
|
$trackedlink = '<a title="'.$strtrackforum.'" href="settracking.php?id='.$forum->id.'">'.$strno.'</a>';
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-20 05:19:52 +00:00
|
|
|
$introoptions->para=false;
|
|
|
|
$forum->intro = format_text(shorten_text(trim($forum->intro), $CFG->forum_shortpost), FORMAT_HTML, $introoptions);
|
2004-09-21 11:41:58 +00:00
|
|
|
|
2004-01-26 08:05:44 +00:00
|
|
|
if ($forum->section != $currentsection) {
|
|
|
|
$printsection = $forum->section;
|
2004-01-26 09:48:20 +00:00
|
|
|
if ($currentsection) {
|
|
|
|
$learningtable->data[] = 'hr';
|
|
|
|
}
|
2004-01-26 08:05:44 +00:00
|
|
|
$currentsection = $forum->section;
|
|
|
|
} else {
|
|
|
|
$printsection = "";
|
|
|
|
}
|
|
|
|
|
2003-04-25 05:24:29 +00:00
|
|
|
if ($forum->visible) {
|
2005-03-26 01:57:40 +00:00
|
|
|
$forumlink = "<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>";
|
2005-04-20 05:19:52 +00:00
|
|
|
$discussionlink = "<a href=\"view.php?f=$forum->id\">".$count."</a>";
|
2003-04-24 17:15:59 +00:00
|
|
|
} else {
|
2005-03-26 01:57:40 +00:00
|
|
|
$forumlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>";
|
2005-04-20 05:19:52 +00:00
|
|
|
$discussionlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".$count."</a>";
|
2003-04-24 17:15:59 +00:00
|
|
|
}
|
2004-09-21 11:41:58 +00:00
|
|
|
|
2004-10-05 23:21:38 +00:00
|
|
|
//If this forum has RSS activated, calculate it
|
|
|
|
$rsslink = '';
|
|
|
|
if ($show_rss) {
|
|
|
|
if ($forum->rsstype and $forum->rssarticles) {
|
|
|
|
//Calculate the tolltip text
|
|
|
|
if ($forum->rsstype == 1) {
|
2005-03-26 01:57:40 +00:00
|
|
|
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",format_string($forum->name));
|
2004-10-05 23:21:38 +00:00
|
|
|
} else {
|
2005-03-26 01:57:40 +00:00
|
|
|
$tooltiptext = get_string("rsssubscriberssposts","forum",format_string($forum->name));
|
2004-10-05 23:21:38 +00:00
|
|
|
}
|
|
|
|
if (empty($USER->id)) {
|
|
|
|
$userid = 0;
|
|
|
|
} else {
|
|
|
|
$userid = $USER->id;
|
|
|
|
}
|
|
|
|
//Get html code for RSS link
|
|
|
|
$rsslink = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
|
|
|
}
|
|
|
|
}
|
2005-02-16 10:40:48 +00:00
|
|
|
|
2002-08-03 08:16:31 +00:00
|
|
|
if ($can_subscribe) {
|
|
|
|
if (forum_is_forcesubscribed($forum->id)) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$sublink = $stryes;
|
2002-07-31 14:19:35 +00:00
|
|
|
} else {
|
2004-03-13 10:41:07 +00:00
|
|
|
if ($groupmode and !isteacheredit($course->id) and !mygroupid($course->id)) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$sublink = $strno; // Can't subscribe to a group forum (not in a group)
|
2004-03-13 12:01:28 +00:00
|
|
|
if ($groupmode == SEPARATEGROUPS) {
|
2005-03-26 01:57:40 +00:00
|
|
|
$forumlink = format_string($forum->name,true);
|
2004-03-13 12:01:28 +00:00
|
|
|
}
|
2002-08-03 08:16:31 +00:00
|
|
|
} else {
|
2004-01-26 08:05:44 +00:00
|
|
|
if (forum_is_subscribed($USER->id, $forum->id)) {
|
2005-04-25 17:45:15 +00:00
|
|
|
$subscribed = $stryes;
|
|
|
|
$subtitle = $strunsubscribe;
|
2004-01-26 08:05:44 +00:00
|
|
|
} else {
|
2005-04-25 17:45:15 +00:00
|
|
|
$subscribed = $strno;
|
|
|
|
$subtitle = $strsubscribe;
|
2004-01-26 08:05:44 +00:00
|
|
|
}
|
|
|
|
$sublink = "<a title=\"$subtitle\" href=\"subscribe.php?id=$forum->id\">$subscribed</a>";
|
2002-08-03 08:16:31 +00:00
|
|
|
}
|
2002-07-31 14:19:35 +00:00
|
|
|
}
|
2005-01-29 09:49:42 +00:00
|
|
|
|
2005-04-20 05:19:52 +00:00
|
|
|
$row = array ($printsection, $forumlink, $forum->intro, $discussionlink);
|
2005-04-25 18:36:32 +00:00
|
|
|
if ($usetracking) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $unreadlink;
|
2005-04-24 13:27:20 +00:00
|
|
|
$row[] = $trackedlink; // Tracking.
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
|
|
|
$row[] = $sublink;
|
2004-10-05 23:21:38 +00:00
|
|
|
if (!empty($rsslink)) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $rsslink;
|
2004-08-08 18:00:32 +00:00
|
|
|
}
|
2005-01-29 09:49:42 +00:00
|
|
|
$learningtable->data[] = $row;
|
|
|
|
|
2002-08-03 08:16:31 +00:00
|
|
|
} else {
|
2005-04-20 05:19:52 +00:00
|
|
|
$row = array ($printsection, $forumlink, $forum->intro, $discussionlink);
|
2005-04-25 18:36:32 +00:00
|
|
|
if ($usetracking) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $unreadlink;
|
2005-04-24 13:27:20 +00:00
|
|
|
$row[] = $trackedlink; // Tracking.
|
2005-01-29 09:49:42 +00:00
|
|
|
}
|
2004-10-05 23:21:38 +00:00
|
|
|
if (!empty($rsslink)) {
|
2005-01-29 09:49:42 +00:00
|
|
|
$row[] = $rsslink;
|
2004-10-05 23:21:38 +00:00
|
|
|
}
|
2005-01-29 09:49:42 +00:00
|
|
|
$learningtable->data[] = $row;
|
2002-06-20 15:15:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-17 06:20:25 +00:00
|
|
|
|
|
|
|
/// Output the page
|
|
|
|
|
|
|
|
if ($course->category) {
|
|
|
|
print_header("$course->shortname: $strforums", "$course->fullname",
|
2004-09-17 03:00:20 +00:00
|
|
|
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $strforums",
|
2003-09-17 06:20:25 +00:00
|
|
|
"", "", true, $searchform, navmenu($course));
|
|
|
|
} else {
|
2004-09-21 11:41:58 +00:00
|
|
|
print_header("$course->shortname: $strforums", "$course->fullname", "$strforums",
|
2003-09-17 06:20:25 +00:00
|
|
|
"", "", true, $searchform, navmenu($course));
|
|
|
|
}
|
|
|
|
|
2003-12-31 06:44:39 +00:00
|
|
|
if ($generalforums) {
|
|
|
|
print_heading(get_string("generalforums", "forum"));
|
|
|
|
print_table($generaltable);
|
|
|
|
}
|
2003-09-17 06:20:25 +00:00
|
|
|
|
2003-12-31 06:44:39 +00:00
|
|
|
if ($learningforums) {
|
|
|
|
print_heading(get_string("learningforums", "forum"));
|
|
|
|
print_table($learningtable);
|
|
|
|
}
|
2002-06-20 15:15:22 +00:00
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
2005-03-26 01:57:40 +00:00
|
|
|
?>
|