本文整理汇总了PHP中assignment_display_lateness函数的典型用法代码示例。如果您正苦于以下问题:PHP assignment_display_lateness函数的具体用法?PHP assignment_display_lateness怎么用?PHP assignment_display_lateness使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assignment_display_lateness函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_lateness
/**
* Return a string indicating how late a submission is
*
* @param $timesubmitted int
* @return string
*/
function display_lateness($timesubmitted) {
return assignment_display_lateness($timesubmitted, $this->assignment->timedue);
}
示例2: get_mform_data_object
/**
* Prepares the data for the grading form.
*
* @param $course
* @param $assignment
* @param $submission
* @param $user
* @param $coursemodule
* @param assignment_base $assignmentinstance
* @global $USER
* @global $CFG
* @return array
*/
private function get_mform_data_object($course, $assignment, $submission, $user, $coursemodule, $assignmentinstance)
{
global $USER, $CFG;
$context = context_module::instance($coursemodule->id);
// Get grading information to see whether we should be allowed to make changed at all.
$grading_info = grade_get_grades($course->id, 'mod', 'assignment', $assignment->id, array($user->id));
$locked = $grading_info->items[0]->grades[$user->id]->locked;
$overridden = $grading_info->items[0]->grades[$user->id]->overridden;
$gradingdisabled = $locked || $overridden;
$mformdata = new stdClass();
$mformdata->context = $context;
$mformdata->maxbytes = $course->maxbytes;
$mformdata->courseid = $course->id;
$mformdata->teacher = $USER;
$mformdata->assignment = $assignment;
$mformdata->submission = $submission;
$mformdata->lateness = assignment_display_lateness($submission->timemodified, $assignment->timedue);
$mformdata->user = $user;
$mformdata->offset = false;
$mformdata->userid = $user->id;
$mformdata->cm = $coursemodule;
$mformdata->grading_info = $grading_info;
$mformdata->enableoutcomes = $CFG->enableoutcomes;
$mformdata->grade = $assignment->grade;
$mformdata->gradingdisabled = $gradingdisabled;
// TODO set nextid to the nextnode id.
$mformdata->nextid = false;
$mformdata->submissioncomment = $submission->submissioncomment;
$mformdata->submissioncommentformat = FORMAT_HTML;
$mformdata->submission_content = $assignmentinstance->print_user_files($user->id, true);
if ($assignment->assignmenttype == 'upload') {
$mformdata->fileui_options = array('subdirs' => 1, 'maxbytes' => $assignment->maxbytes, 'maxfiles' => $assignment->var1, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL);
} else {
if ($assignment->assignmenttype == 'uploadsingle') {
$mformdata->fileui_options = array('subdirs' => 0, 'maxbytes' => $CFG->userquota, 'maxfiles' => 1, 'accepted_types' => '*', 'return_types' => FILE_INTERNAL);
}
}
$advancedgradingwarning = false;
$gradingmanager = get_grading_manager($context, 'mod_assignment', 'submission');
if ($gradingmethod = $gradingmanager->get_active_method()) {
// This returns a gradingform_controller instance, not grading_controller as docs
// say.
/* @var gradingform_controller $controller */
$controller = $gradingmanager->get_controller($gradingmethod);
if ($controller->is_form_available()) {
$itemid = null;
if (!empty($submission->id)) {
$itemid = $submission->id;
}
if ($gradingdisabled && $itemid) {
$mformdata->advancedgradinginstance = $controller->get_current_instance($USER->id, $itemid);
return array($mformdata, $advancedgradingwarning);
} else {
if (!$gradingdisabled) {
$instanceid = optional_param('advancedgradinginstanceid', 0, PARAM_INT);
$mformdata->advancedgradinginstance = $controller->get_or_create_instance($instanceid, $USER->id, $itemid);
return array($mformdata, $advancedgradingwarning);
}
}
return array($mformdata, $advancedgradingwarning);
} else {
$advancedgradingwarning = $controller->form_unavailable_notification();
return array($mformdata, $advancedgradingwarning);
}
}
return array($mformdata, $advancedgradingwarning);
}