diff --git a/lib/datalib.php b/lib/datalib.php index b1acf849e37..324e775066f 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -108,7 +108,7 @@ function table_column($table, $oldfield, $field, $type="integer", $size="10", $after = "AFTER `$after`"; } - execute_sql("ALTER TABLE {$CFG->prefix}$table $operation $type $signed $default $null $after"); + return execute_sql("ALTER TABLE {$CFG->prefix}$table $operation $type $signed $default $null $after"); break; case "postgres7": // From Petri Asikainen @@ -161,7 +161,7 @@ function table_column($table, $oldfield, $field, $type="integer", $size="10", } } - execute_sql("ALTER TABLE {$CFG->prefix}$table ALTER COLUMN $field SET DEFAULT $default"); + return execute_sql("ALTER TABLE {$CFG->prefix}$table ALTER COLUMN $field SET DEFAULT $default"); break; @@ -188,7 +188,7 @@ function table_column($table, $oldfield, $field, $type="integer", $size="10", } execute_sql("ALTER TABLE {$CFG->prefix}$table ALTER COLUMN $field SET $null"); - execute_sql("ALTER TABLE {$CFG->prefix}$table ALTER COLUMN $field SET $default"); + return execute_sql("ALTER TABLE {$CFG->prefix}$table ALTER COLUMN $field SET $default"); break; } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 937556af4e4..8c57b8e54c5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1662,6 +1662,26 @@ function make_menu_from_list($list, $separator=",") { return $outarray; } +function make_grades_menu($gradingtype) { +/// Creates an array that represents all the current grades that +/// can be chosen using the given grading type. Negative numbers +/// are scales, zero is no grade, and positive numbers are maximum +/// grades. + + $grades = array(); + if ($gradingtype < 0) { + if ($scale = get_record("scale", "id", - $gradingtype)) { + return make_menu_from_list($scale->scale); + } + } else if ($gradingtype > 0) { + for ($i=$gradingtype; $i>=0; $i--) { + $grades[$i] = $i; + } + return $grades; + } + return $grades; +} + // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140: ?> diff --git a/lib/weblib.php b/lib/weblib.php index 155ed61e034..7b70c1f3a17 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1292,6 +1292,7 @@ function print_scale_menu($courseid, $name, $current) { $linkobject, 400, 500, $strscales); } + function print_scale_menu_helpbutton($courseid, $scale) { /// Prints a help button about a scale /// scale is an object diff --git a/mod/assignment/submissions.php b/mod/assignment/submissions.php index c370eb7bff3..4e7208a4587 100644 --- a/mod/assignment/submissions.php +++ b/mod/assignment/submissions.php @@ -126,21 +126,6 @@ add_to_log($course->id, "assignment", "view submissions", "submissions.php?id=$assignment->id", "$assignment->id"); } - $grades = array(); - - if ($assignment->grade < 0) { - $scaleid = - ($assignment->grade); - if ($scale = get_record("scale", "id", $scaleid)) { - $grades = make_menu_from_list($scale->scale); - } - } else if ($assignment->grade == 0) { - $grades = NULL; - } else { - for ($i=$assignment->grade; $i>=0; $i--) { - $grades[$i] = $i; - } - } - // Submission sorting print_simple_box_start("CENTER", "50%"); echo "
"; @@ -154,6 +139,8 @@ echo "