$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
}
}
- 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;
}
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;
}
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:
?>
$linkobject, 400, 500, $strscales);
}
+
function print_scale_menu_helpbutton($courseid, $scale) {
/// Prints a help button about a scale
/// scale is an object
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 "<P align=\"CENTER\">";
echo "<FORM ACTION=submissions.php METHOD=post>\n";
+ $grades = make_grades_menu($assignment->grade);
+
foreach ($submissions as $submission) {
$user = $users[$submission->userid];
assignment_print_submission($assignment, $user, $submission, $teachers, $grades);
print_scale_menu_helpbutton($course->id, $scale);
echo "<br />";
}
- } else if ($assignment->grade < 0) {
+ } else if ($assignment->grade > 0) {
echo "<b>".get_string("maximumgrade")."</b>: $assignment->grade<br>";
}