course)) { error("Course is misconfigured"); } if (! $assignment = get_record("assignment", "id", $cm->instance)) { error("Course module is incorrect"); } } else { if (! $assignment = get_record("assignment", "id", $a)) { error("Course module is incorrect"); } if (! $course = get_record("course", "id", $assignment->course)) { error("Course is misconfigured"); } if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id)) { error("Course Module ID was incorrect"); } } require_login($course->id); add_to_log($course->id, "assignment", "view", "view.php?id=$cm->id", $assignment->id, $cm->id); if ($course->category) { $navigation = "id\">$course->shortname ->"; } $strassignments = get_string("modulenameplural", "assignment"); $strassignment = get_string("modulename", "assignment"); print_header("$course->shortname: $assignment->name", "$course->fullname", "$navigation id>$strassignments -> $assignment->name", "", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm)); if (isteacher($course->id)) { echo '

'; if ($assignment->type == OFFLINE) { echo "id\">". get_string("viewfeedback", "assignment").""; } else { $currentgroup = get_current_group($course->id); if ($currentgroup and isteacheredit($course->id)) { $group = get_record("groups", "id", $currentgroup); $groupname = " ($group->name)"; } else { $groupname = ""; } $count = assignment_count_real_submissions($assignment, $currentgroup); echo "id\">". get_string("viewsubmissions", "assignment", $count)."$groupname"; } echo '

'; } else if (!$cm->visible) { notice(get_string("activityiscurrentlyhidden")); } print_simple_box_start("CENTER"); print_heading($assignment->name, "CENTER"); $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); if ($scale = get_record("scale", "id", $scaleid)) { $scalegrades = make_menu_from_list($scale->scale); echo "".get_string("grade").": $scale->name "; print_scale_menu_helpbutton($course->id, $scale); echo "
"; } } else if ($assignment->grade > 0) { echo "".get_string("maximumgrade").": $assignment->grade
"; } echo "
"; echo format_text($assignment->description, $assignment->format); print_simple_box_end(); echo "
"; if (!isteacher($course->id) and !isguest()) { $submission = assignment_get_submission($assignment, $USER); if ($assignment->type == OFFLINE) { if ($submission->timemarked) { if (isset($scalegrades)) { $submission->grade = $scalegrades[$submission->grade]; } assignment_print_feedback($course, $submission); } } else { if ($submission and $submission->timemodified) { print_simple_box_start("center"); echo "
"; print_heading(get_string("yoursubmission","assignment").":", "center"); echo "

".get_string("lastmodified").": ".userdate($submission->timemodified)."

"; assignment_print_user_files($assignment, $USER); print_simple_box_end(); } else { print_heading(get_string("notsubmittedyet","assignment")); } echo "
"; if ($submission and $submission->timemarked) { print_heading(get_string("submissionfeedback", "assignment").":", "center"); if (isset($scalegrades)) { $submission->grade = $scalegrades[$submission->grade]; } assignment_print_feedback($course, $submission); } if (!$submission->timemarked or $assignment->resubmit) { if ($submission and $submission->timemodified) { echo "

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

"; } print_heading(get_string("submitassignment", "assignment").":", "center"); assignment_print_upload_form($assignment); } } } print_footer($course); ?>