]> git.mjollnir.org Git - moodle.git/commitdiff
- Minor fix (locating the send ratings button correctely when the mode is entry.)
authorwillcast <willcast>
Sun, 23 Nov 2003 01:01:29 +0000 (01:01 +0000)
committerwillcast <willcast>
Sun, 23 Nov 2003 01:01:29 +0000 (01:01 +0000)
mod/glossary/lib.php
mod/glossary/view.php

index 633f7ade5fbc874cd728b6c22240c5b369e1dc43..b27f6900937f29eca110ecb6e0e0cc4486f17aec 100644 (file)
@@ -289,7 +289,10 @@ function glossary_grades($glossaryid) {
                             $total += $ra;
                             $count ++;
                         }
-                        $return->grades[$currentuser] = format_float($total/$count, 2);
+                        $return->grades[$currentuser] = (string) format_float($total/$count, 2);
+                        if ( count($ratingsuser) > 1 ) {
+                            $return->grades[$currentuser] .= " (" . count($ratingsuser) . ")";
+                        }
                     }
                 } else {
                     $return->grades[$currentuser] = "";
@@ -310,7 +313,11 @@ function glossary_grades($glossaryid) {
                     $total += $ra;
                     $count ++;
                 }
-                $return->grades[$currentuser] = format_float((float)$total/(float)$count, 2);
+                $return->grades[$currentuser] = (string) format_float((float)$total/(float)$count, 2);
+                
+                if ( count($ratingsuser) > 1 ) {
+                    $return->grades[$currentuser] .= " (" . count($ratingsuser) . ")";
+                }
             }
         } else {
             $return->grades[$currentuser] = "";
@@ -403,6 +410,7 @@ global $CFG;
 
 function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons = 1, $displayformat  = -1, $ratings = NULL) {
     global $THEME, $USER, $CFG;
+    $return = false;
     if ( $displayformat < 0 ) {
         $displayformat = $glossary->displayformat;
     }
@@ -425,18 +433,19 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook=""
         }
     
         if ( !$basicformat and $permissiongranted or $displayformat >= 2) {
-            return glossary_print_entry_by_format($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
+            $return = glossary_print_entry_by_format($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
         } else {
             switch ( $displayformat ) {
             case GLOSSARY_FORMAT_SIMPLE:
-                return glossary_print_entry_by_default($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
+                $return = glossary_print_entry_by_default($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
             break;
             case GLOSSARY_FORMAT_CONTINUOUS:
-                return glossary_print_entry_continuous($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
+                $return = glossary_print_entry_continuous($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
             break;
             }
         }
     }
+        return $return;
 }
 function  glossary_print_entry_concept($entry) {
     echo $entry->concept;
@@ -663,11 +672,20 @@ function glossary_print_entry_continuous($course, $cm, $glossary, $entry,$mode="
         echo " ";
         
         glossary_print_entry_definition($entry);
+        
+        $icons = '';
         if ( $printicons ) {
-            $icons   = glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,"html");        
-            echo "($icons)";
+            $icons = glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,"html");        
+        }        
+
+        echo '(';
+        if ( $icons ) {
+            echo $icons;
         }
         $return = glossary_print_entry_ratings($course, $entry, $ratings);
+        
+        echo ')<br>';
+
     }
     return $return;
 }
@@ -1694,8 +1712,9 @@ function glossary_print_ratings_mean($entryid, $scale) {
             $strratings = get_string("ratings", "glossary");
         }
 
-        echo "$strratings: ";
+        echo "<font size=-1>$strratings: ";
         link_to_popup_window ("/mod/glossary/report.php?id=$entryid", "ratings", $mean, 400, 600);
+        echo "</font>";
     }
 }
 
index daf1ec9a337f1355272810d9a75568a229cbcf01..4568d96ee44f7ae4dffeacfe29a28c9f9deeb64d 100644 (file)
             if ($ratings->scale = make_grades_menu($glossary->scale)) {
                 $ratings->assesstimestart = $glossary->assesstimestart;
                 $ratings->assesstimefinish = $glossary->assesstimefinish;
-                if ($glossary->assessed == 2 and !isteacher($course->id)) {
-                    $ratings->allow = false;
-                } else {
-                    $ratings->allow = true;
-                }
-
-                echo "<form name=form method=post action=rate.php>";
-                echo "<input type=hidden name=id value=\"$course->id\">";
             }
+            if ($glossary->assessed == 2 and !isteacher($course->id)) {
+                $ratings->allow = false;
+            } else {
+                $ratings->allow = true;
+            }
+
+            echo "<form name=form method=post action=rate.php>";
+            echo "<input type=hidden name=id value=\"$course->id\">";
         }
 
         foreach ($allentries as $entry) {
                 
                 if ( !$tableisopen ) {
                     if ($glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS OR 
-                        $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
+                        $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE or $mode == 'entry') {
                         print_simple_box_start("center","95%","#ffffff","5","generalbox");
                         $tableisopen = 1;
                     }
                 } 
 
                 /// and finally print the entry.
+                
                 if ( glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook,1,$displayformat,$ratings) ) {
                     $ratingsmenuused = true;
                 }
         }
         if ( $tableisopen ) {
             if ($glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS OR 
-                $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE ) {
+                $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE or $mode == 'entry') {
                 print_simple_box_end();
                 $tableisopen = 0;
             }
     }
 
     if ($ratingsmenuused) {
-        echo "<center><input type=\"submit\" value=\"".get_string("sendinratings", "glossary")."\">";
+        echo "<p><center><input type=\"submit\" value=\"".get_string("sendinratings", "glossary")."\">";
         if ($glossary->scale < 0) {
             if ($scale = get_record("scale", "id", abs($glossary->scale))) {
                 print_scale_menu_helpbutton($course->id, $scale );