本文整理汇总了PHP中workshop::add_allocation方法的典型用法代码示例。如果您正苦于以下问题:PHP workshop::add_allocation方法的具体用法?PHP workshop::add_allocation怎么用?PHP workshop::add_allocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类workshop
的用法示例。
在下文中一共展示了workshop::add_allocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif (is_null($example->id) and $canmanage) {
// ok you can go
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'view or manage example submission');
}
if ($id and $delete and $confirm and $canmanage) {
require_sesskey();
$workshop->delete_submission($example);
redirect($workshop->view_url());
}
if ($id and $assess and $canmanage) {
// reference assessment of an example is the assessment with the weight = 1. There should be just one
// such assessment
require_sesskey();
if (!$refasid) {
$refasid = $workshop->add_allocation($example, $USER->id, 1);
}
redirect($workshop->exassess_url($refasid));
}
if ($id and $assess and $canassess) {
// training assessment of an example is the assessment with the weight = 0
require_sesskey();
$asid = $DB->get_field('workshop_assessments', 'id', array('submissionid' => $example->id, 'weight' => 0, 'reviewerid' => $USER->id));
if (!$asid) {
$asid = $workshop->add_allocation($example, $USER->id, 0);
}
if ($asid == workshop::ALLOCATION_EXISTS) {
// the training assessment of the example was not found but the allocation already
// exists. this probably means that the user is the author of the reference assessment.
echo $output->header();
echo $output->box(get_string('assessmentreferenceconflict', 'workshop'));
示例2: elseif
$edit = ($editable and $edit);
$seenaspublished = false;
// is the submission seen as a published submission?
if ($submission->id and ($ownsubmission or $canviewall or $isreviewer)) {
// ok you can go
} elseif ($submission->id and $ispublished) {
// ok you can go
$seenaspublished = true;
} elseif (is_null($submission->id) and $cansubmit) {
// ok you can go
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'view or create submission');
}
if ($assess and $submission->id and !$isreviewer and $canallocate and $workshop->assessing_allowed($USER->id)) {
require_sesskey();
$assessmentid = $workshop->add_allocation($submission, $USER->id);
redirect($workshop->assess_url($assessmentid));
}
if ($edit) {
require_once dirname(__FILE__) . '/submission_form.php';
$maxfiles = $workshop->nattachments;
$maxbytes = $workshop->maxbytes;
$contentopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $workshop->context, 'return_types' => FILE_INTERNAL | FILE_EXTERNAL);
$attachmentopts = array('subdirs' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'return_types' => FILE_INTERNAL);
$submission = file_prepare_standard_editor($submission, 'content', $contentopts, $workshop->context, 'mod_workshop', 'submission_content', $submission->id);
$submission = file_prepare_standard_filemanager($submission, 'attachment', $attachmentopts, $workshop->context, 'mod_workshop', 'submission_attachment', $submission->id);
$mform = new workshop_submission_form($PAGE->url, array('current' => $submission, 'workshop' => $workshop, 'contentopts' => $contentopts, 'attachmentopts' => $attachmentopts));
if ($mform->is_cancelled()) {
redirect($workshop->view_url());
} elseif ($cansubmit and $formdata = $mform->get_data()) {
if ($formdata->example == 0) {
示例3: trim
$failures[$reviewee] = "error::No group for name $reviewee";
continue;
}
$group = $groups[$reviewee];
if (empty($submissions_by_group[$group->id])) {
$failures[$reviewee] = "error::No submission for $reviewee";
continue;
}
$submission = $submissions_by_group[$group->id];
foreach($reviewers as $i) {
$i = trim($i);
if (empty($i)) continue;
if (!empty($users[$i])) {
$res = $workshop->add_allocation($submission, $users[$i]->id);
} else {
$failures[$i] = "error::No user for username $i";
}
}
}
}
$SESSION->workshop_upload_messages = $failures;
}
$url = new moodle_url('/mod/workshop/allocation.php', array('cmid' => $cm->id, 'method' => 'manual'));
redirect($url);