course)) { error("Course is misconfigured"); } if (! $exercise = get_record("exercise", "id", $cm->instance)) { error("Course module is incorrect"); } require_login($course->id); if ($course->category) { $navigation = "id\">$course->shortname ->"; } $strexercises = get_string("modulenameplural", "exercise"); $strexercise = get_string("modulename", "exercise"); $strsubmissions = get_string("submissions", "exercise"); // ... print the header and... print_header("$course->shortname: $exercise->name", "$course->fullname", "$navigation id>$strexercises -> id\">$exercise->name -> $strsubmissions", "", "", true); //...get the action! require_variable($action); /******************* admin amend title ************************************/ if ($action == 'adminamendtitle' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } if (empty($_GET['sid'])) { error("Admin Amend Title: submission id missing"); } $submission = get_record("exercise_submissions", "id", $_GET['sid']); print_heading(get_string("amendtitle", "exercise")); ?>
\n"; } /******************* admin clear late (flag) ************************************/ elseif ($action == 'adminclearlate' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } if (empty($_GET['sid'])) { error("Admin clear late flag: submission id missing"); } if (!$submission = get_record("exercise_submissions", "id", $_GET['sid'])) { error("Admin clear late flag: can not get submission record"); } if (set_field("exercise_submissions", "late", 0, "id", $_GET['sid'])) { print_heading(get_string("clearlateflag", "exercise")." ".get_string("ok")); } add_to_log($course->id, "exercise", "late flag cleared", "view.php?id=$cm->id", "submission $submission->id"); print_continue("submissions.php?id=$cm->id&action=adminlist"); } /******************* admin confirm delete ************************************/ elseif ($action == 'adminconfirmdelete' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } if (empty($_GET['sid'])) { error("Admin confirm delete: submission id missing"); } if (!$submission = get_record("exercise_submissions", "id", $_GET['sid'])) { error("Admin delete: can not get submission record"); } if (isteacher($course->id, $submission->userid)) { if (!isteacheredit($course->id)) { error("Only teacher with editing permissions can delete teacher submissions."); } } notice_yesno(get_string("confirmdeletionofthisitem","exercise", get_string("submission", "exercise")), "submissions.php?action=admindelete&id=$cm->id&sid=$_GET[sid]", "submissions.php?id=$cm->id&action=adminlist"); } /******************* admin delete ************************************/ elseif ($action == 'admindelete' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } if (empty($_GET['sid'])) { error("Admin delete: submission id missing"); } if (!$submission = get_record("exercise_submissions", "id", $_GET['sid'])) { error("Admin delete: can not get submission record"); } print_string("deleting", "exercise"); // first get any assessments... if ($assessments = exercise_get_assessments($submission)) { foreach($assessments as $assessment) { // ...and all the associated records... delete_records("exercise_grades", "assessmentid", $assessment->id); echo "."; } // ...now delete the assessments... delete_records("exercise_assessments", "submissionid", $submission->id); } // ...and the submission record... delete_records("exercise_submissions", "id", $submission->id); // ..and finally the submitted file exercise_delete_submitted_files($exercise, $submission); add_to_log($course->id, "exercise", "delete", "view.php?id=$cm->id", "submission $submission->id"); print_continue("submissions.php?id=$cm->id&action=adminlist"); } /******************* admin (confirm) late flag ************************************/ elseif ($action == 'adminlateflag' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } if (empty($_GET['sid'])) { error("Admin confirm late flag: submission id missing"); } if (!$submission = get_record("exercise_submissions", "id", $_GET['sid'])) { error("Admin confirm late flag: can not get submission record"); } notice_yesno(get_string("clearlateflag","exercise")."?", "submissions.php?action=adminclearlate&id=$cm->id&sid=$_GET[sid]", "submissions.php?id=$cm->id&action=adminlist"); } /******************* list all submissions ************************************/ elseif ($action == 'adminlist' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } echo "Exercise Version-> $module->version
"; exercise_list_submissions_for_admin($exercise); print_continue("view.php?id=$cm->id"); } /******************* admin update title ************************************/ elseif ($action == 'adminupdatetitle' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } if (empty($_POST['sid'])) { error("Admin Update Title: submission id missing"); } if (set_field("exercise_submissions", "title", $_POST['title'], "id", $_POST['sid'])) { print_heading(get_string("amendtitle", "exercise")." ".get_string("ok")); } print_continue("submissions.php?id=$cm->id&action=adminlist"); } /*************** display final grades (by teacher) ***************************/ elseif ($action == 'displayfinalgrades') { // Get all the students if (!$users = get_course_students($course->id, "u.firstname, u.lastname")) { print_heading(get_string("nostudentsyet")); print_footer($course); exit; } // get the final weights from the database $teacherweight = get_field("exercise","teacherweight", "id", $exercise->id); $gradingweight = get_field("exercise","gradingweight", "id", $exercise->id); // show the final grades as stored in the tables... print_heading_with_help(get_string("displayoffinalgrades", "exercise"), "finalgrades", "exercise"); echo "cellheading2\">".$course->student." | "; echo "cellheading2\">".get_string("submission", "exercise")." | "; echo "cellheading2\" align=\"center\">".get_string("gradeforassessment", "exercise")." | "; echo "cellheading2\" align=\"center\">".get_string("gradeforsubmission", "exercise")." | "; echo "cellheading2\" align=\"center\">".get_string("overallgrade", "exercise")." |
cellheading2\">".get_string("weights", "exercise")." | "; echo "cellheading2\"> | \n"; echo "cellheading2\" align=\"center\">$EXERCISE_FWEIGHTS[$gradingweight] | \n"; echo "cellheading2\" align=\"center\">$EXERCISE_FWEIGHTS[$teacherweight] | \n"; echo "cellheading2\"> |
$user->firstname $user->lastname | \n"; echo "".exercise_print_submission_title($exercise, $submission)." | \n"; echo "".number_format($ownassessment->gradinggrade * $exercise->grade / COMMENTSCALE, 1)." | "; echo "$grade | "; echo "$overallgrade |