本文整理汇总了PHP中workshop::get_submission_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP workshop::get_submission_by_id方法的具体用法?PHP workshop::get_submission_by_id怎么用?PHP workshop::get_submission_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类workshop
的用法示例。
在下文中一共展示了workshop::get_submission_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// instant assessment required
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
if (isguestuser()) {
print_error('guestsarenotallowed');
}
$workshoprecord = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshoprecord, $cm, $course);
$PAGE->set_url($workshop->submission_url(), array('cmid' => $cmid, 'id' => $id));
if ($edit) {
$PAGE->url->param('edit', $edit);
}
if ($id) {
// submission is specified
$submission = $workshop->get_submission_by_id($id);
$params = array('objectid' => $submission->id, 'context' => $workshop->context, 'courseid' => $workshop->course->id, 'relateduserid' => $submission->authorid, 'other' => array('workshopid' => $workshop->id));
$event = \mod_workshop\event\submission_viewed::create($params);
$event->trigger();
} else {
// no submission specified
if (!($submission = $workshop->get_submission_by_author($USER->id))) {
$submission = new stdclass();
$submission->id = null;
$submission->authorid = $USER->id;
$submission->example = 0;
$submission->grade = null;
$submission->gradeover = null;
$submission->published = null;
$submission->feedbackauthor = null;
$submission->feedbackauthorformat = editors_get_preferred_format();
示例2: redirect
$record->gradinggradeover = $workshop->raw_grade_value($data->gradinggradeover, $workshop->gradinggrade);
$record->gradinggradeoverby = $USER->id;
$record->feedbackreviewer = $data->feedbackreviewer;
$record->feedbackreviewerformat = $data->feedbackreviewerformat;
}
$DB->update_record('workshop_assessments', $record);
redirect($workshop->view_url());
}
}
// output starts here
$output = $PAGE->get_renderer('mod_workshop'); // workshop renderer
echo $output->header();
echo $output->heading(get_string('assessedsubmission', 'workshop'), 2);
$submission = $workshop->get_submission_by_id($submission->id); // reload so can be passed to the renderer
echo $output->render($workshop->prepare_submission($submission, has_capability('mod/workshop:viewauthornames', $workshop->context)));
// show instructions for assessing as they may contain important information
// for evaluating the assessment
if (trim($workshop->instructreviewers)) {
$instructions = file_rewrite_pluginfile_urls($workshop->instructreviewers, 'pluginfile.php', $PAGE->context->id,
'mod_workshop', 'instructreviewers', 0, workshop::instruction_editors_options($PAGE->context));
print_collapsible_region_start('', 'workshop-viewlet-instructreviewers', get_string('instructreviewers', 'workshop'));
echo $output->box(format_text($instructions, $workshop->instructreviewersformat, array('overflowdiv'=>true)), array('generalbox', 'instructions'));
print_collapsible_region_end();
}
// extend the current assessment record with user details
$assessment = $workshop->get_assessment_by_id($assessment->id);