MDL-66147 mod_assign: submissions overview page shows time interval
Use get_time_interval_string() on the teacher only page, to show how long after the course start the assignment is due for each user.
This commit is contained in:
@@ -430,6 +430,9 @@ $string['quickgrading'] = 'Quick grading';
|
||||
$string['quickgradingresult'] = 'Quick grading';
|
||||
$string['quickgradingchangessaved'] = 'The grade changes were saved';
|
||||
$string['quickgrading_help'] = 'Quick grading allows you to assign grades (and outcomes) directly in the submissions table. Quick grading is not compatible with advanced grading and is not recommended when there are multiple markers.';
|
||||
$string['relativedatessubmissiontimeleft'] = 'Calculated for each student';
|
||||
$string['relativedatessubmissionduedateafter'] = '{$a->datediffstr} after course start';
|
||||
$string['relativedatessubmissionduedatebefore'] = '{$a->datediffstr} before course start';
|
||||
$string['removeallgroupoverrides'] = 'Delete all group overrides';
|
||||
$string['removealluseroverrides'] = 'Delete all user overrides';
|
||||
$string['reopenuntilpassincompatiblewithblindmarking'] = 'Reopen until pass option is incompatible with blind marking, because the grades are not released to the gradebook until the student identities are revealed.';
|
||||
|
||||
+36
-27
@@ -5562,8 +5562,9 @@ class assign {
|
||||
*/
|
||||
public function get_assign_grading_summary_renderable($activitygroup = null) {
|
||||
|
||||
$instance = $this->get_instance();
|
||||
$instance = $this->get_default_instance(); // Grading summary requires the raw dates, regardless of relativedates mode.
|
||||
$cm = $this->get_course_module();
|
||||
$course = $this->get_course();
|
||||
|
||||
$draft = ASSIGN_SUBMISSION_STATUS_DRAFT;
|
||||
$submitted = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
|
||||
@@ -5584,35 +5585,43 @@ class assign {
|
||||
}
|
||||
}
|
||||
|
||||
$summary = new assign_grading_summary($this->count_teams($activitygroup),
|
||||
$instance->submissiondrafts,
|
||||
$this->count_submissions_with_status($draft, $activitygroup),
|
||||
$this->is_any_submission_plugin_enabled(),
|
||||
$this->count_submissions_with_status($submitted, $activitygroup),
|
||||
$instance->cutoffdate,
|
||||
$instance->duedate,
|
||||
$this->get_course_module()->id,
|
||||
$this->count_submissions_need_grading($activitygroup),
|
||||
$instance->teamsubmission,
|
||||
$warnofungroupedusers,
|
||||
$this->can_grade(),
|
||||
$isvisible);
|
||||
$summary = new assign_grading_summary(
|
||||
$this->count_teams($activitygroup),
|
||||
$instance->submissiondrafts,
|
||||
$this->count_submissions_with_status($draft, $activitygroup),
|
||||
$this->is_any_submission_plugin_enabled(),
|
||||
$this->count_submissions_with_status($submitted, $activitygroup),
|
||||
$instance->cutoffdate,
|
||||
$instance->duedate,
|
||||
$this->get_course_module()->id,
|
||||
$this->count_submissions_need_grading($activitygroup),
|
||||
$instance->teamsubmission,
|
||||
$warnofungroupedusers,
|
||||
$course->relativedatesmode,
|
||||
$course->startdate,
|
||||
$this->can_grade(),
|
||||
$isvisible
|
||||
);
|
||||
} else {
|
||||
// The active group has already been updated in groups_print_activity_menu().
|
||||
$countparticipants = $this->count_participants($activitygroup);
|
||||
$summary = new assign_grading_summary($countparticipants,
|
||||
$instance->submissiondrafts,
|
||||
$this->count_submissions_with_status($draft, $activitygroup),
|
||||
$this->is_any_submission_plugin_enabled(),
|
||||
$this->count_submissions_with_status($submitted, $activitygroup),
|
||||
$instance->cutoffdate,
|
||||
$instance->duedate,
|
||||
$this->get_course_module()->id,
|
||||
$this->count_submissions_need_grading($activitygroup),
|
||||
$instance->teamsubmission,
|
||||
assign_grading_summary::WARN_GROUPS_NO,
|
||||
$this->can_grade(),
|
||||
$isvisible);
|
||||
$summary = new assign_grading_summary(
|
||||
$countparticipants,
|
||||
$instance->submissiondrafts,
|
||||
$this->count_submissions_with_status($draft, $activitygroup),
|
||||
$this->is_any_submission_plugin_enabled(),
|
||||
$this->count_submissions_with_status($submitted, $activitygroup),
|
||||
$instance->cutoffdate,
|
||||
$instance->duedate,
|
||||
$this->get_course_module()->id,
|
||||
$this->count_submissions_need_grading($activitygroup),
|
||||
$instance->teamsubmission,
|
||||
assign_grading_summary::WARN_GROUPS_NO,
|
||||
$course->relativedatesmode,
|
||||
$course->startdate,
|
||||
$this->can_grade(),
|
||||
$isvisible
|
||||
);
|
||||
}
|
||||
|
||||
return $summary;
|
||||
|
||||
@@ -748,6 +748,10 @@ class assign_grading_summary implements renderable {
|
||||
public $teamsubmission = false;
|
||||
/** @var boolean warnofungroupedusers - Do we need to warn people that there are users without groups */
|
||||
public $warnofungroupedusers = false;
|
||||
/** @var boolean relativedatesmode - Is the course a relative dates mode course or not */
|
||||
public $courserelativedatesmode = false;
|
||||
/** @var int coursestartdate - start date of the course as a unix timestamp*/
|
||||
public $coursestartdate;
|
||||
/** @var boolean cangrade - Can the current user grade students? */
|
||||
public $cangrade = false;
|
||||
/** @var boolean isvisible - Is the assignment's context module visible to students? */
|
||||
@@ -774,6 +778,8 @@ class assign_grading_summary implements renderable {
|
||||
* @param int $submissionsneedgradingcount
|
||||
* @param bool $teamsubmission
|
||||
* @param string $warnofungroupedusers
|
||||
* @param bool $courserelativedatesmode true if the course is using relative dates, false otherwise.
|
||||
* @param int $coursestartdate unix timestamp representation of the course start date.
|
||||
* @param bool $cangrade
|
||||
* @param bool $isvisible
|
||||
*/
|
||||
@@ -788,6 +794,8 @@ class assign_grading_summary implements renderable {
|
||||
$submissionsneedgradingcount,
|
||||
$teamsubmission,
|
||||
$warnofungroupedusers,
|
||||
$courserelativedatesmode,
|
||||
$coursestartdate,
|
||||
$cangrade = true,
|
||||
$isvisible = true) {
|
||||
$this->participantcount = $participantcount;
|
||||
@@ -801,6 +809,8 @@ class assign_grading_summary implements renderable {
|
||||
$this->submissionsneedgradingcount = $submissionsneedgradingcount;
|
||||
$this->teamsubmission = $teamsubmission;
|
||||
$this->warnofungroupedusers = $warnofungroupedusers;
|
||||
$this->courserelativedatesmode = $courserelativedatesmode;
|
||||
$this->coursestartdate = $coursestartdate;
|
||||
$this->cangrade = $cangrade;
|
||||
$this->isvisible = $isvisible;
|
||||
}
|
||||
|
||||
+20
-5
@@ -312,15 +312,30 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
if ($summary->duedate) {
|
||||
// Due date.
|
||||
$duedate = $summary->duedate;
|
||||
if ($summary->courserelativedatesmode) {
|
||||
// Returns a formatted string, in the format '10d 10h 45m'.
|
||||
$diffstr = get_time_interval_string($duedate, $summary->coursestartdate);
|
||||
if ($duedate >= $summary->coursestartdate) {
|
||||
$userduedate = get_string('relativedatessubmissionduedateafter', 'mod_assign', ['datediffstr' => $diffstr]);
|
||||
} else {
|
||||
$userduedate = get_string('relativedatessubmissionduedatebefore', 'mod_assign', ['datediffstr' => $diffstr]);
|
||||
}
|
||||
} else {
|
||||
$userduedate = userdate($duedate);
|
||||
}
|
||||
$this->add_table_row_tuple($t, get_string('duedate', 'assign'),
|
||||
userdate($duedate));
|
||||
$userduedate);
|
||||
|
||||
// Time remaining.
|
||||
$due = '';
|
||||
if ($duedate - $time <= 0) {
|
||||
$due = get_string('assignmentisdue', 'assign');
|
||||
if ($summary->courserelativedatesmode) {
|
||||
$due = get_string('relativedatessubmissiontimeleft', 'mod_assign');
|
||||
} else {
|
||||
$due = format_time($duedate - $time);
|
||||
$due = '';
|
||||
if ($duedate - $time <= 0) {
|
||||
$due = get_string('assignmentisdue', 'assign');
|
||||
} else {
|
||||
$due = format_time($duedate - $time);
|
||||
}
|
||||
}
|
||||
$this->add_table_row_tuple($t, get_string('timeremaining', 'assign'), $due);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user