From 37d543b54581f3661a73756491e78f12a2bd1c93 Mon Sep 17 00:00:00 2001 From: willcast Date: Sun, 23 Nov 2003 01:01:29 +0000 Subject: [PATCH] - Minor fix (locating the send ratings button correctely when the mode is entry.) --- mod/glossary/lib.php | 35 +++++++++++++++++++++++++++-------- mod/glossary/view.php | 23 ++++++++++++----------- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 633f7ade5f..b27f690093 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -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 ')
'; + } return $return; } @@ -1694,8 +1712,9 @@ function glossary_print_ratings_mean($entryid, $scale) { $strratings = get_string("ratings", "glossary"); } - echo "$strratings: "; + echo "$strratings: "; link_to_popup_window ("/mod/glossary/report.php?id=$entryid", "ratings", $mean, 400, 600); + echo ""; } } diff --git a/mod/glossary/view.php b/mod/glossary/view.php index daf1ec9a33..4568d96ee4 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -281,15 +281,15 @@ 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 "
"; - echo "id\">"; } + if ($glossary->assessed == 2 and !isteacher($course->id)) { + $ratings->allow = false; + } else { + $ratings->allow = true; + } + + echo ""; + echo "id\">"; } foreach ($allentries as $entry) { @@ -384,7 +384,7 @@ 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; } @@ -400,6 +400,7 @@ } /// and finally print the entry. + if ( glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook,1,$displayformat,$ratings) ) { $ratingsmenuused = true; } @@ -409,7 +410,7 @@ } 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; } @@ -420,7 +421,7 @@ } if ($ratingsmenuused) { - echo "
"; + echo "

"; if ($glossary->scale < 0) { if ($scale = get_record("scale", "id", abs($glossary->scale))) { print_scale_menu_helpbutton($course->id, $scale ); -- 2.39.5