Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d699cd1e54
Fetching contributors…

Cannot retrieve contributors at this time

file 100 lines (81 sloc) 3.707 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
<?PHP // $Id$

    require("../../config.php");
    require("lib.php");

    optional_variable($id); // Course Module ID
    optional_variable($a); // Assignment ID

    if ($id) {
        if (! $cm = get_record("course_modules", "id", $id)) {
            error("Course Module ID was incorrect");
        }
    
        if (! $course = get_record("course", "id", $cm->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");

    if ($course->category) {
        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}

$strassignments = get_string("modulenameplural", "assignment");
$strassignment = get_string("modulename", "assignment");

print_header("$course->shortname: $assignment->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strassignments</A> -> $assignment->name",
"", "", true, update_module_icon($cm->id, $course->id));

if (isteacher($course->id)) {
if ($submissions = assignment_get_all_submissions($assignment)) {
$count = count($submissions);
} else {
$count = 0;
}
echo "<P align=right><A HREF=\"submissions.php?id=$assignment->id\">".
get_string("viewsubmissions", "assignment", $count)."</A></P>";
}

$strdifference = format_time($assignment->timedue - time());
$strduedate = userdate($assignment->timedue)." ($strdifference)";

print_simple_box_start("CENTER");
print_heading(get_string("assignmentdetails", "assignment").":", "CENTER");
print_simple_box_start("CENTER");
echo "<B>".get_string("duedate", "assignment")."</B>: $strduedate<BR>";
echo "<B>".get_string("maximumgrade")."</B>: $assignment->grade<BR>";
print_simple_box_end();
echo "<BR>";
echo text_to_html($assignment->description);
print_simple_box_end();
echo "<BR>";

if (!isteacher($course->id)) {
if ($submission = assignment_get_submission($assignment, $USER)) {
print_simple_box_start("center");
echo "<CENTER>";
print_heading(get_string("yoursubmission","assignment").":", "CENTER");
echo "<P><FONT SIZE=-1><B>".get_string("lastmodified")."</B>: ".userdate($submission->timemodified)."</FONT></P>";
assignment_print_user_files($assignment, $USER);
print_simple_box_end();
} else {
print_heading(get_string("notsubmittedyet","assignment"));
}
echo "<HR SIZE=1 NOSHADE>";
if ($submission->grade) {
print_heading(get_string("submissionfeedback", "assignment").":", "CENTER");
assignment_print_feedback($course, $submission);
} else {
if ($submission) {
echo "<P ALIGN=CENTER>".get_string("overwritewarning", "assignment")."</P>";
}
assignment_print_upload_form($assignment);
}
}
print_footer($course);

?>
Something went wrong with that request. Please try again.