From 62ca135d9850626470fcebf559be50588e5a2c2d Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 18 Aug 2003 05:28:30 +0000 Subject: [PATCH] More cleanups and separation of printing the grades menu into a new function --- lib/moodlelib.php | 2 +- lib/weblib.php | 30 ++++++++++++++++++++++++++++++ mod/assignment/mod.html | 11 +---------- mod/forum/lib.php | 3 --- mod/forum/mod.html | 6 +----- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 8c57b8e54c..7bd1ceb6e6 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1675,7 +1675,7 @@ function make_grades_menu($gradingtype) { } } else if ($gradingtype > 0) { for ($i=$gradingtype; $i>=0; $i--) { - $grades[$i] = $i; + $grades[$i] = "$i / $gradingtype"; } return $grades; } diff --git a/lib/weblib.php b/lib/weblib.php index 7b70c1f3a1..3bdb3272da 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1275,8 +1275,38 @@ function print_time_selector($hour, $minute, $currenttime=0) { choose_from_menu($minutes, $minute, $currentdate['minutes'], ""); } +function print_grade_menu($courseid, $name, $current) { +/// Prints a grade menu (as part of an existing form) with help +/// Showing all possible numerical grades and scales + + global $CFG, $THEME; + + $strscale = get_string("scale"); + $strscales = get_string("scales"); + + $scales = get_scales_menu($course->id); + foreach ($scales as $i => $scalename) { + $grades[-$i] = "$strscale: $scalename"; + } + $grades[0] = get_string("nograde"); + for ($i=100; $i>=1; $i--) { + $grades[$i] = $i; + } + choose_from_menu($grades, "$name", "$current", ""); + + if (empty($THEME->custompix)) { + $helpicon = "$CFG->wwwroot/pix/help.gif"; + } else { + $helpicon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif"; + } + $linkobject = "\"$strscales\""; + link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales", + $linkobject, 400, 500, $strscales); +} + function print_scale_menu($courseid, $name, $current) { /// Prints a scale menu (as part of an existing form) including help button +/// Just like print_grade_menu but without the numerical grades global $CFG, $THEME; diff --git a/mod/assignment/mod.html b/mod/assignment/mod.html index 7bcea693f1..224c612f2d 100644 --- a/mod/assignment/mod.html +++ b/mod/assignment/mod.html @@ -98,16 +98,7 @@

:

id); - $strscale = get_string("scale"); - foreach ($scales as $i => $scalename) { - $grades[-$i] = "$strscale: $scalename"; - } - $grades[0] = get_string("nograde"); - for ($i=100; $i>=1; $i--) { - $grades[$i] = $i; - } - choose_from_menu($grades, "grade", "$form->grade", ""); + print_grade_menu($course->id, "grade", "$form->grade"); ?> diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 88436d5841..8ad181a40e 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -16,9 +16,6 @@ $FORUM_TYPES = array ("general" => get_string("generalforum", "forum"), "eachuser" => get_string("eachuserforum", "forum"), "single" => get_string("singleforum", "forum") ); -$FORUM_POST_RATINGS = array ("3" => get_string("postrating3", "forum"), - "2" => get_string("postrating2", "forum"), - "1" => get_string("postrating1", "forum") ); $FORUM_OPEN_MODES = array ("2" => get_string("openmode2", "forum"), "1" => get_string("openmode1", "forum"), diff --git a/mod/forum/mod.html b/mod/forum/mod.html index 449a7f08f4..3d3cc7fed7 100644 --- a/mod/forum/mod.html +++ b/mod/forum/mod.html @@ -92,12 +92,8 @@ choose_from_menu($options, "assessed", $form->assessed, ""); helpbutton("ratings", get_string("allowratings", "forum"), "forum"); - echo "

"; - print_string("scale"); - echo ": "; + echo "
"; print_scale_menu($course->id, "scale", $form->scale); - echo "

"; - ?> -- 2.39.5