Merge branch 'MDL-51142-29' of git://github.com/damyon/moodle into MOODLE_29_STABLE
This commit is contained in:
@@ -898,7 +898,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
$this->get_group_and_submission($row->id, $group, $submission, -1);
|
||||
if ($submission && $submission->timemodified && $submission->status != ASSIGN_SUBMISSION_STATUS_NEW) {
|
||||
$o = userdate($submission->timemodified);
|
||||
} else if ($row->timesubmitted) {
|
||||
} else if ($row->timesubmitted && $row->status != ASSIGN_SUBMISSION_STATUS_NEW) {
|
||||
$o = userdate($row->timesubmitted);
|
||||
}
|
||||
|
||||
@@ -937,11 +937,16 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
$status = $row->status;
|
||||
}
|
||||
|
||||
$displaystatus = $status;
|
||||
if ($displaystatus == 'new') {
|
||||
$displaystatus = '';
|
||||
}
|
||||
|
||||
if ($this->assignment->is_any_submission_plugin_enabled()) {
|
||||
|
||||
$o .= $this->output->container(get_string('submissionstatus_' . $status, 'assign'),
|
||||
array('class'=>'submissionstatus' .$status));
|
||||
if ($due && $timesubmitted > $due) {
|
||||
$o .= $this->output->container(get_string('submissionstatus_' . $displaystatus, 'assign'),
|
||||
array('class'=>'submissionstatus' .$displaystatus));
|
||||
if ($due && $timesubmitted > $due && $status != ASSIGN_SUBMISSION_STATUS_NEW) {
|
||||
$usertime = format_time($timesubmitted - $due);
|
||||
$latemessage = get_string('submittedlateshort',
|
||||
'assign',
|
||||
@@ -957,7 +962,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
if (!$instance->markingworkflow) {
|
||||
if ($row->grade !== null && $row->grade >= 0) {
|
||||
$o .= $this->output->container(get_string('graded', 'assign'), 'submissiongraded');
|
||||
} else if (!$timesubmitted) {
|
||||
} else if (!$timesubmitted || $status == ASSIGN_SUBMISSION_STATUS_NEW) {
|
||||
$now = time();
|
||||
if ($due && ($now > $due)) {
|
||||
$overduestr = get_string('overdue', 'assign', format_time($now - $due));
|
||||
|
||||
@@ -672,7 +672,13 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
if ($submission) {
|
||||
$row = new html_table_row();
|
||||
$cell1 = new html_table_cell(get_string('timemodified', 'assign'));
|
||||
$cell2 = new html_table_cell(userdate($submission->timemodified));
|
||||
|
||||
if ($submission->status != ASSIGN_SUBMISSION_STATUS_NEW) {
|
||||
$cell2 = new html_table_cell(userdate($submission->timemodified));
|
||||
} else {
|
||||
$cell2 = new html_table_cell('-');
|
||||
}
|
||||
|
||||
$row->cells = array($cell1, $cell2);
|
||||
$t->data[] = $row;
|
||||
|
||||
|
||||
@@ -229,6 +229,49 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
|
||||
$this->assertContains(get_string('submittedlateshort', 'assign', format_time(2*24*60*60 + $difftime)), $output);
|
||||
}
|
||||
|
||||
public function test_gradingtable_status_rendering() {
|
||||
global $PAGE;
|
||||
|
||||
// Setup the assignment.
|
||||
$this->create_extra_users();
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$time = time();
|
||||
$assign = $this->create_instance(array(
|
||||
'assignsubmission_onlinetext_enabled' => 1,
|
||||
'duedate' => $time - 4 * 24 * 60 * 60,
|
||||
));
|
||||
$PAGE->set_url(new moodle_url('/mod/assign/view.php', array(
|
||||
'id' => $assign->get_course_module()->id,
|
||||
'action' => 'grading',
|
||||
)));
|
||||
|
||||
// Check that the assignment is late.
|
||||
$gradingtable = new assign_grading_table($assign, 1, '', 0, true);
|
||||
$output = $assign->get_renderer()->render($gradingtable);
|
||||
$this->assertContains(get_string('submissionstatus_', 'assign'), $output);
|
||||
$difftime = time() - $time;
|
||||
$this->assertContains(get_string('overdue', 'assign', format_time(4 * 24 * 60 * 60 + $difftime)), $output);
|
||||
|
||||
// Simulate a student viewing the assignment without submitting.
|
||||
$this->setUser($this->students[0]);
|
||||
$submission = $assign->get_user_submission($this->students[0]->id, true);
|
||||
$submission->status = ASSIGN_SUBMISSION_STATUS_NEW;
|
||||
$assign->testable_update_submission($submission, $this->students[0]->id, true, false);
|
||||
$submittedtime = time();
|
||||
|
||||
// Verify output.
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$gradingtable = new assign_grading_table($assign, 1, '', 0, true);
|
||||
$output = $assign->get_renderer()->render($gradingtable);
|
||||
$difftime = $submittedtime - $time;
|
||||
$this->assertContains(get_string('overdue', 'assign', format_time(4 * 24 * 60 * 60 + $difftime)), $output);
|
||||
|
||||
$document = new DOMDocument();
|
||||
$document->loadHTML($output);
|
||||
$xpath = new DOMXPath($document);
|
||||
$this->assertEquals('', $xpath->evaluate('string(//td[@id="mod_assign_grading_r0_c8"])'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that group submission information is rendered correctly in the
|
||||
* grading table.
|
||||
|
||||
Reference in New Issue
Block a user