Now the RSS link is showed in the list of glossaries.
authorstronk7 <stronk7>
Sun, 8 Aug 2004 18:44:45 +0000 (18:44 +0000)
committerstronk7 <stronk7>
Sun, 8 Aug 2004 18:44:45 +0000 (18:44 +0000)
Bug 1706
(http://moodle.org/bugs/bug.php?op=show&bugid=1706)

mod/glossary/index.php

index e593754c192dbcd6a01048d8fc8940ef8f572167..8c5364e3ff691db0259ddcb97ef07a31b679a599 100644 (file)
@@ -5,6 +5,7 @@
 
     require_once("../../config.php");
     require_once("lib.php");
+    require_once("$CFG->dirroot/rss/rsslib.php");
 
     require_variable($id);   // course
 
@@ -21,6 +22,7 @@
 
     $strglossarys = get_string("modulenameplural", "glossary");
     $strglossary  = get_string("modulename", "glossary");
+    $strrss = get_string("rss");
 
 
 /// Print the header
         $table->align = array ("LEFT", "CENTER");
     }
 
+    $can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin());
+
+    if ($show_rss = ($can_subscribe && isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
+                     $CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds)) {
+        $table->head[] = $strrss;
+        $table->align[] = "CENTER";
+    }
+
     $currentsection = "";
 
     foreach ($glossarys as $glossary) {
 
         $count = count_records_sql("SELECT COUNT(*) FROM {$CFG->prefix}glossary_entries where (glossaryid = $glossary->id or sourceglossaryid = $glossary->id)");
 
+        //If this glossary has RSS activated, calculate it
+        if ($show_rss) {
+            $rsslink = '';
+            if ($glossary->rsstype and $glossary->rssarticles) {
+                //Calculate the tolltip text
+                $tooltiptext = get_string("rsssubscriberss","glossary",$glossary->name);
+                //Get html code for RSS link
+                $rsslink = rss_get_link($course->id, $USER->id, "glossary", $glossary->id, $tooltiptext);
+            }
+        }
+
         if ($course->format == "weeks" or $course->format == "topics") {
-            $table->data[] = array ($printsection, $link, $count);
+            $linedata = array ($printsection, $link, $count);
         } else {
-            $table->data[] = array ($link, $count);
+            $linedata = array ($link, $count);
+        }
+
+        if ($show_rss) {
+            $linedata[] = $rsslink;
         }
+
+        $table->data[] = $linedata;
     }
 
     echo "<br />";