More cleanups and separation of printing the grades menu into a new function

This commit is contained in:
moodler 2003-08-18 05:28:30 +00:00
parent fdc47ee6c9
commit 62ca135d98
5 changed files with 33 additions and 19 deletions

View File

@ -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;
}

View File

@ -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 = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$strscales\" src=\"$helpicon\">";
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;

View File

@ -98,16 +98,7 @@
<td align=right><p><b><?php print_string("grade") ?>:</b></p></td>
<td>
<?php
$scales = get_scales_menu($course->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");
?>
</td>
</tr>

View File

@ -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"),

View File

@ -92,12 +92,8 @@
choose_from_menu($options, "assessed", $form->assessed, "");
helpbutton("ratings", get_string("allowratings", "forum"), "forum");
echo "<p><b>";
print_string("scale");
echo ":</b> ";
echo "<br />";
print_scale_menu($course->id, "scale", $form->scale);
echo "</p>";
?>
</td>
</tr>