From: stronk7 Date: Sun, 8 Aug 2004 18:00:32 +0000 (+0000) Subject: Now the RSS link is showed in the list of forums. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=33f48f030e6a772884ff4ec83845f33dcdf8fb9d;p=moodle.git Now the RSS link is showed in the list of forums. Now going to the glossary... Bug 1706 (http://moodle.org/bugs/bug.php?op=show&bugid=1706) --- diff --git a/mod/forum/index.php b/mod/forum/index.php index 47dd7eca0e..e23c883464 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -2,6 +2,7 @@ require_once("../../config.php"); require_once("lib.php"); + require_once("$CFG->dirroot/rss/rsslib.php"); optional_variable($id); // course @@ -34,6 +35,7 @@ $strdescription = get_string("description"); $strdiscussions = get_string("discussions", "forum"); $strsubscribed = get_string("subscribed", "forum"); + $strrss = get_string("rss"); $searchform = forum_print_search_form($course, "", true, "plain"); @@ -48,6 +50,12 @@ $generaltable->align[] = "CENTER"; } + if ($show_rss = ($can_subscribe && isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) && + $CFG->enablerssfeeds && $CFG->forum_enablerssfeeds)) { + $generaltable->head[] = $strrss; + $generaltable->align[] = "CENTER"; + } + $learningtable = $generaltable; // Headers etc are the same // Parse and organise all the forums. Most forums are course modules but @@ -146,7 +154,24 @@ $sublink = "id\">$subscribed"; } } - $generaltable->data[] = array ($forumlink, "$forum->intro", "$count", $sublink); + //If this forum has RSS activated, calculate it + if ($show_rss) { + $rsslink = ''; + if ($forum->rsstype and $forum->rssarticles) { + //Calculate the tolltip text + if ($forum->rsstype == 1) { + $tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name); + } else { + $tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name); + } + //Get html code for RSS link + $rsslink = rss_get_link($course->id, $USER->id, "forum", $forum->id, $tooltiptext); + } + //Save data + $generaltable->data[] = array ($forumlink, "$forum->intro", "$count", $sublink,$rsslink); + } else { + $generaltable->data[] = array ($forumlink, "$forum->intro", "$count", $sublink); + } } else { $generaltable->data[] = array ($forumlink, "$forum->intro", "$count"); } @@ -213,7 +238,24 @@ $sublink = "id\">$subscribed"; } } - $learningtable->data[] = array ($printsection, $forumlink, "$forum->intro", "$count", "$sublink"); + //If this forum has RSS activated, calculate it + if ($show_rss) { + $rsslink = ''; + if ($forum->rsstype and $forum->rssarticles) { + //Calculate the tolltip text + if ($forum->rsstype == 1) { + $tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name); + } else { + $tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name); + } + //Get html code for RSS link + $rsslink = rss_get_link($course->id, $USER->id, "forum", $forum->id, $tooltiptext); + } + //Save data + $learningtable->data[] = array ($printsection,$forumlink, "$forum->intro", "$count", $sublink,$rsslink); + } else { + $learningtable->data[] = array ($printsection,$forumlink, "$forum->intro", "$count", $sublink); + } } else { $learningtable->data[] = array ($printsection, $forumlink, "$forum->intro", "$count"); }