]> git.mjollnir.org Git - moodle.git/commitdiff
- Adding View comments link to the new display format
authorwillcast <willcast>
Tue, 18 Nov 2003 03:25:28 +0000 (03:25 +0000)
committerwillcast <willcast>
Tue, 18 Nov 2003 03:25:28 +0000 (03:25 +0000)
mod/glossary/lib.php

index e5ac29b965077a57b7f3d034de5ac741d86fc449..7a7a2b479e8332088e38f8975c11919a588c0d58 100644 (file)
@@ -403,21 +403,14 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
     $ismainglossary = $glossary->mainglossary;
        
     $return = "<font size=1>";
-
     if (!$entry->approved) {
         $return .= get_string("entryishidden","glossary");
     }
-    $count = count_records("glossary_comments","entryid",$entry->id);
-    if ($count) {
-        $return .= " <a href=\"comments.php?id=$cm->id&eid=$entry->id\">$count ";
-        if ($count == 1) {
-            $return .= get_string("comment", "glossary");
-        } else {
-            $return .= get_string("comments", "glossary");
-        }
-        $return .= "</a>";
-    }
-    $return .= "</font>";
+    $return .= "</font> ";
+
+    $return .= glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook);
+
+    
     if ( $glossary->allowcomments and !isguest()) {
         $return .= " <a title=\"" . get_string("addcomment","glossary") . "\" href=\"comment.php?id=$cm->id&eid=$entry->id\"><img src=\"comment.gif\" height=16 width=16 border=0></a> ";
     }
@@ -458,6 +451,29 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
     }
 }
 
+function glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook, $type = 'print') {
+    $return = '';
+
+    $count = count_records("glossary_comments","entryid",$entry->id);
+    if ($count) {
+        $return = "<font size=1>";
+        $return .= "<a href=\"comments.php?id=$cm->id&eid=$entry->id\">$count ";
+        if ($count == 1) {
+            $return .= get_string("comment", "glossary");
+        } else {
+            $return .= get_string("comments", "glossary");
+        }
+        $return .= "</a>";
+        $return .= "</font>";
+    }
+
+    if ($type == 'print') {
+        echo $return;
+    } else {
+        return $return;
+    }
+}
+
 function  glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook,$printicons) {
 
     $aliases = glossary_print_entry_aliases($course, $cm, $glossary, $entry, $mode, $hook,"html");