id, $course->id)) { error("Course Module ID was incorrect"); } if (!isteacher($course->id)) { error("Only teachers can look at this page"); } /// Create the assignment class: require ($CFG->dirroot.'/mod/assignment/type/'.$assignment->assignmenttype.'/assignment.class.php'); $assignmentclass = 'assignment_'.$assignment->assignmenttype; $ass_obj = new $assignmentclass($cm->id, $assignment, $cm, $course); $strassignments = get_string("modulenameplural", "assignment"); $strassignment = get_string("modulename", "assignment"); $strsubmissions = get_string("submissions", "assignment"); $strsendreminder = get_string('sendreminder', 'block_marking'); $strnumreminderssent = get_string('numreminderssent', 'block_marking'); $strlastremindersent = get_string('lastremindersent', 'block_marking'); /// Check to see if groups are being used in this assignment if ($groupmode = groupmode($course, $cm)) { // Groups are being used if (empty($currentgroup)) { $currentgroup = setup_and_print_groups($course, $groupmode, "marking.php?id=$id&mid=$mid&sort=$sort&dir=$dir"); } else { setup_and_print_groups($course, $groupmode, "marking.php?id=$id&mid=$mid&sort=$sort&dir=$dir"); } } else { $currentgroup = false; } /// Get all teachers and students $teachers = get_course_teachers($course->id); /// Show any specific group of users requested. if ($currentgroup) { $users = get_group_students($currentgroup); } else { $users = get_course_students($course->id); } if (!$users) { print_heading(get_string("nostudentsyet")); exit; } $submissions = array(); /// Make some easy ways to reference submissions // if ($submissions = $ass_obj->get_submissions($sort, $dir)) { if ($submissions = assignment_get_all_submissions($ass_obj->assignment, $sort, $dir)) { foreach ($submissions as $submission) { $submissionbyuser[$submission->userid] = $submission; } } /// Get all existing submissions and check for missing ones foreach($users as $user) { if (!isset($submissionbyuser[$user->id])) { // Need to create empty entry $newsubmission->assignment = $assignment->id; $newsubmission->userid = $user->id; $newsubmission->timecreated = time(); if (!insert_record("assignment_submissions", $newsubmission)) { error("Could not insert a new empty submission"); } } } if (isset($newsubmission)) { // Get them all out again to be sure // $submissions = $ass_obj->get_submissions($sort, $dir); $submissions = assignment_get_all_submissions($ass_obj->assignment, $sort, $dir); } /// If data is being submitted, then process it if ($data = data_submitted($CFG->wwwroot.'/blocks/marking/marking.php')) { if (isset($data->sendreminders)) { mb_send_all_reminders($data, $users, $course, $cm); $message = get_string('sentreminders', 'block_marking'); redirect('marking.php?id='.$id.'&mid='.$mid, $message, 3); } /// If we're only submitting a single feedback, set the submittal array to just that one. if (isset($data->submitsub)) { $data->sub_id = array(key($data->submitsub)); } foreach ($data->sub_id as $sub_id) { $submission = $submissions[$sub_id]; $reqresubmit = isset($data->reqresubmit[$sub_id]) ? 1 : 0; // Only update entries where feedback has actually changed. if (($data->grade[$sub_id] <> $submission->grade) || ($data->comment[$sub_id] <> addslashes($submission->comment)) || $reqresubmit) { unset($newsubmission); $newsubmission->grade = $data->grade[$sub_id]; $newsubmission->comment = $data->comment[$sub_id]; $newsubmission->teacher = $USER->id; $newsubmission->timemarked = $timenow; $newsubmission->mailed = 0; // Make sure mail goes out (again, even) $newsubmission->id = $sub_id; if ($reqresubmit) { $newsubmission->comment .= "\n\n".'
'. get_string('resubmitmessage', 'block_marking').'
'; } // Make sure that we aren't overwriting any recent feedback from other teachers. (see bug #324) if ($timewas < $submission->timemarked && (!empty($submission->grade)) && (!empty($submission->comment))) { notify(get_string("failedupdatefeedback", "assignment", fullname($users[$submission->userid])) . "'.get_string("duedate", "assignment").':'.$strduedate.
'
'.$gradetext.'
'.get_string('markingcriteria', 'block_marking').': '.
format_text($assignment->description, $assignment->format);
if ($averageturnaround) {
echo '
'.get_string('averageturnaround', 'block_marking', (int)$averageturnaround);
} else {
echo '
'.get_string('noaverageturnaround', 'block_marking');
}
echo '
'.get_string('studentsnotsubmitted', 'block_marking').':
'; echo ''; } print_simple_box_end(); function mb_local_assignment_print_submission($ass_obj, $user, $submission, $teachers, $grades, $id, $mid, $allowedtograde=false) { global $THEME, $USER, $CFG; static $strsavefeedback; if (empty($strsavefeedback)) { $strsavefeedback = get_string('savefeedback', 'block_marking'); } echo "\n"; } else { echo "\n | "; } print_user_picture($user->id, $ass_obj->assignment->course, $user->picture); echo " | "; /// mrc - 20041117 - Begin Customization: /// Show submitted time as well as modified time (resubmittal). echo "";
echo '
| ||||
"; if ($submission->timemodified) { $ass_obj->print_user_files($user->id); } else { print_string("notsubmittedyet", "assignment"); } echo " | ||||||
"; if ($submission->timemodified) { $ass_obj->print_user_files($user->id); } else { print_string("notsubmittedyet", "assignment"); } echo " | ||||||
"; if (!$submission->teacher) { $submission->teacher = $USER->id; } print_user_picture($submission->teacher, $ass_obj->assignment->course, $teachers[$submission->teacher]->picture); echo " | ";
if (!$submission->grade and !$submission->timemarked) {
$submission->grade = -1; /// Hack to stop zero being selected on the menu below (so it shows 'no grade')
}
if ($allowedtograde) {
echo 'id.'] value="'.$submission->id.'">';
echo '
\n"; } /// Used by uasort to reorder the unmarked first by creation date in ascending order. function mb_sort_unmarked_first($a, $b) { if ($a->overdue == $b->overdue) { return 0; } else { return ($a->timecreated < $b->timecreated) ? -1: 1; } } ?> |