From 94d0cea51196cfc80a217dd8dda5026992f12dd0 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 18 Aug 2003 04:24:12 +0000 Subject: [PATCH] Some polishing for the case when grades are set to zero (no grades). Also, if the date is set further than on year into the future then the due date is not shown. --- mod/assignment/lib.php | 2 +- mod/assignment/mod.html | 3 ++- mod/assignment/submissions.php | 10 ++++++---- mod/assignment/view.php | 22 +++++++++++----------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index cbe5617142..31342460ea 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -400,7 +400,7 @@ function assignment_print_submission($assignment, $user, $submission, $teachers, echo "cellheading\">"; } echo get_string("feedback", "assignment").":"; - choose_from_menu($grades, "g$submission->id", $submission->grade, get_string("grade")."..."); + choose_from_menu($grades, "g$submission->id", $submission->grade, get_string("nograde")); if ($submission->timemarked) { echo "  ".userdate($submission->timemarked).""; } diff --git a/mod/assignment/mod.html b/mod/assignment/mod.html index eb7f8001d8..7bcea693f1 100644 --- a/mod/assignment/mod.html +++ b/mod/assignment/mod.html @@ -103,7 +103,8 @@ foreach ($scales as $i => $scalename) { $grades[-$i] = "$strscale: $scalename"; } - for ($i=100; $i>=0; $i--) { + $grades[0] = get_string("nograde"); + for ($i=100; $i>=1; $i--) { $grades[$i] = $i; } choose_from_menu($grades, "grade", "$form->grade", ""); diff --git a/mod/assignment/submissions.php b/mod/assignment/submissions.php index 2bc61f7de8..c370eb7bff 100644 --- a/mod/assignment/submissions.php +++ b/mod/assignment/submissions.php @@ -133,10 +133,12 @@ if ($scale = get_record("scale", "id", $scaleid)) { $grades = make_menu_from_list($scale->scale); } - } - - for ($i=$assignment->grade; $i>=0; $i--) { - $grades[$i] = $i; + } else if ($assignment->grade == 0) { + $grades = NULL; + } else { + for ($i=$assignment->grade; $i>=0; $i--) { + $grades[$i] = $i; + } } // Submission sorting diff --git a/mod/assignment/view.php b/mod/assignment/view.php index 077a82d583..02d789e839 100644 --- a/mod/assignment/view.php +++ b/mod/assignment/view.php @@ -60,17 +60,18 @@ notice(get_string("activityiscurrentlyhidden")); } - - $strdifference = format_time($assignment->timedue - time()); - if (($assignment->timedue - time()) < 0) { - $strdifference = "$strdifference"; - } - $strduedate = userdate($assignment->timedue)." ($strdifference)"; - print_simple_box_start("CENTER"); print_heading($assignment->name, "CENTER"); - print_simple_box_start("CENTER"); - echo "".get_string("duedate", "assignment").": $strduedate
"; + + $timedifference = $assignment->timedue - time(); + if ($timedifference < 31536000) { // Don't bother showing dates over a year in the future + $strdifference = format_time($timedifference); + if ($timedifference < 0) { + $strdifference = "$strdifference"; + } + $strduedate = userdate($assignment->timedue)." ($strdifference)"; + echo "".get_string("duedate", "assignment").": $strduedate
"; + } if ($assignment->grade < 0) { $scaleid = - ($assignment->grade); @@ -84,7 +85,6 @@ echo "".get_string("maximumgrade").": $assignment->grade
"; } - print_simple_box_end(); echo "
"; echo format_text($assignment->description, $assignment->format); print_simple_box_end(); @@ -120,7 +120,7 @@ } if (!$submission->timemarked or $assignment->resubmit) { if ($submission and $submission->timemodified) { - echo "

".get_string("overwritewarning", "assignment")."

"; + echo "

".get_string("overwritewarning", "assignment")."

"; } print_heading(get_string("submitassignment", "assignment").":", "center"); assignment_print_upload_form($assignment); -- 2.39.5