' .
'
';
if ($assignment->duedate) {
$userdate = userdate($assignment->duedate);
$basestr .= '
' . $strduedate . ': ' . $userdate . '
';
} else {
$basestr .= '
' . $strduedateno . '
';
}
if ($assignment->cutoffdate) {
if ($assignment->cutoffdate == $assignment->duedate) {
$basestr .= '
' . $strnolatesubmissions . '
';
} else {
$userdate = userdate($assignment->cutoffdate);
$basestr .= '
' . $strcutoffdate . ': ' . $userdate . '
';
}
}
// Show only relevant information.
if (!empty($submitdetails)) {
$basestr .= $submitdetails;
}
if (!empty($gradedetails)) {
$basestr .= $gradedetails;
}
$basestr .= '
';
if (empty($htmlarray[$assignment->course]['assign'])) {
$htmlarray[$assignment->course]['assign'] = $basestr;
} else {
$htmlarray[$assignment->course]['assign'] .= $basestr;
}
}
return true;
}
/**
* This api generates html to be displayed to students in print overview section, related to their submission status of the given
* assignment.
*
* @deprecated since 3.3
* @todo The final deprecation of this function will take place in Moodle 3.7 - see MDL-57487.
* @param array $mysubmissions list of submissions of current user indexed by assignment id.
* @param string $sqlassignmentids sql clause used to filter open assignments.
* @param array $assignmentidparams sql params used to filter open assignments.
* @param stdClass $assignment current assignment
*
* @return bool|string html to display , false if nothing needs to be displayed.
* @throws coding_exception
*/
function assign_get_mysubmission_details_for_print_overview(&$mysubmissions, $sqlassignmentids, $assignmentidparams,
$assignment) {
global $USER, $DB;
debugging('The function assign_get_mysubmission_details_for_print_overview() is now deprecated.', DEBUG_DEVELOPER);
if ($assignment->nosubmissions) {
// Offline assignment. No need to display alerts for offline assignments.
return false;
}
$strnotsubmittedyet = get_string('notsubmittedyet', 'assign');
if (!isset($mysubmissions)) {
// Get all user submissions, indexed by assignment id.
$dbparams = array_merge(array($USER->id), $assignmentidparams, array($USER->id));
$mysubmissions = $DB->get_records_sql('SELECT a.id AS assignment,
a.nosubmissions AS nosubmissions,
g.timemodified AS timemarked,
g.grader AS grader,
g.grade AS grade,
s.status AS status
FROM {assign} a, {assign_submission} s
LEFT JOIN {assign_grades} g ON
g.assignment = s.assignment AND
g.userid = ? AND
g.attemptnumber = s.attemptnumber
WHERE a.id ' . $sqlassignmentids . ' AND
s.latest = 1 AND
s.assignment = a.id AND
s.userid = ?', $dbparams);
}
$submitdetails = '';
$submitdetails .= '';
$submitdetails .= get_string('mysubmission', 'assign');
$submission = false;
if (isset($mysubmissions[$assignment->id])) {
$submission = $mysubmissions[$assignment->id];
}
if ($submission && $submission->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
// A valid submission already exists, no need to notify students about this.
return false;
}
// We need to show details only if a valid submission doesn't exist.
if (!$submission ||
!$submission->status ||
$submission->status == ASSIGN_SUBMISSION_STATUS_DRAFT ||
$submission->status == ASSIGN_SUBMISSION_STATUS_NEW
) {
$submitdetails .= $strnotsubmittedyet;
} else {
$submitdetails .= get_string('submissionstatus_' . $submission->status, 'assign');
}
if ($assignment->markingworkflow) {
$workflowstate = $DB->get_field('assign_user_flags', 'workflowstate', array('assignment' =>
$assignment->id, 'userid' => $USER->id));
if ($workflowstate) {
$gradingstatus = 'markingworkflowstate' . $workflowstate;
} else {
$gradingstatus = 'markingworkflowstate' . ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED;
}
} else if (!empty($submission->grade) && $submission->grade !== null && $submission->grade >= 0) {
$gradingstatus = ASSIGN_GRADING_STATUS_GRADED;
} else {
$gradingstatus = ASSIGN_GRADING_STATUS_NOT_GRADED;
}
$submitdetails .= ', ' . get_string($gradingstatus, 'assign');
$submitdetails .= '
';
return $submitdetails;
}
/**
* This api generates html to be displayed to teachers in print overview section, related to the grading status of the given
* assignment's submissions.
*
* @deprecated since 3.3
* @todo The final deprecation of this function will take place in Moodle 3.7 - see MDL-57487.
* @param array $unmarkedsubmissions list of submissions of that are currently unmarked indexed by assignment id.
* @param string $sqlassignmentids sql clause used to filter open assignments.
* @param array $assignmentidparams sql params used to filter open assignments.
* @param stdClass $assignment current assignment
* @param context $context context of the assignment.
*
* @return bool|string html to display , false if nothing needs to be displayed.
* @throws coding_exception
*/
function assign_get_grade_details_for_print_overview(&$unmarkedsubmissions, $sqlassignmentids, $assignmentidparams,
$assignment, $context) {
global $DB;
debugging('The function assign_get_grade_details_for_print_overview() is now deprecated.', DEBUG_DEVELOPER);
if (!isset($unmarkedsubmissions)) {
// Build up and array of unmarked submissions indexed by assignment id/ userid
// for use where the user has grading rights on assignment.
$dbparams = array_merge(array(ASSIGN_SUBMISSION_STATUS_SUBMITTED), $assignmentidparams);
$rs = $DB->get_recordset_sql('SELECT s.assignment as assignment,
s.userid as userid,
s.id as id,
s.status as status,
g.timemodified as timegraded
FROM {assign_submission} s
LEFT JOIN {assign_grades} g ON
s.userid = g.userid AND
s.assignment = g.assignment AND
g.attemptnumber = s.attemptnumber
LEFT JOIN {assign} a ON
a.id = s.assignment
WHERE
( g.timemodified is NULL OR
s.timemodified >= g.timemodified OR
g.grade IS NULL OR
(g.grade = -1 AND
a.grade < 0)) AND
s.timemodified IS NOT NULL AND
s.status = ? AND
s.latest = 1 AND
s.assignment ' . $sqlassignmentids, $dbparams);
$unmarkedsubmissions = array();
foreach ($rs as $rd) {
$unmarkedsubmissions[$rd->assignment][$rd->userid] = $rd->id;
}
$rs->close();
}
// Count how many people can submit.
$submissions = 0;
if ($students = get_enrolled_users($context, 'mod/assign:view', 0, 'u.id')) {
foreach ($students as $student) {
if (isset($unmarkedsubmissions[$assignment->id][$student->id])) {
$submissions++;
}
}
}
if ($submissions) {
$urlparams = array('id' => $assignment->coursemodule, 'action' => 'grading');
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$gradedetails = '