當前位置: 首頁>>代碼示例>>PHP>>正文


PHP workshop::assessing_allowed方法代碼示例

本文整理匯總了PHP中workshop::assessing_allowed方法的典型用法代碼示例。如果您正苦於以下問題:PHP workshop::assessing_allowed方法的具體用法?PHP workshop::assessing_allowed怎麽用?PHP workshop::assessing_allowed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在workshop的用法示例。


在下文中一共展示了workshop::assessing_allowed方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

$isreviewer             = ($USER->id == $assessment->reviewerid);
$isauthor               = ($USER->id == $submission->authorid);

if ($isreviewer or $isauthor or ($canviewallassessments and $canviewallsubmissions)) {
    // such a user can continue
} else {
    print_error('nopermissions', 'error', $workshop->view_url(), 'view this assessment');
}

if ($isauthor and !$isreviewer and !$canviewallassessments and $workshop->phase != workshop::PHASE_CLOSED) {
    // authors can see assessments of their work at the end of workshop only
    print_error('nopermissions', 'error', $workshop->view_url(), 'view assessment of own work before workshop is closed');
}

// only the reviewer is allowed to modify the assessment
if ($isreviewer and $workshop->assessing_allowed($USER->id)) {
    $assessmenteditable = true;
} else {
    $assessmenteditable = false;
}

// check that all required examples have been assessed by the user
if ($assessmenteditable and $workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_ASSESSMENT
        and !has_capability('mod/workshop:manageexamples', $workshop->context)) {
    // the reviewer must have submitted their own submission
    $reviewersubmission = $workshop->get_submission_by_author($assessment->reviewerid);
    if (!$reviewersubmission) {
        // no money, no love
        $assessmenteditable = false;
        echo $output->header();
        echo $output->heading(get_string('exampleneedsubmission', 'workshop'), 2);
開發者ID:nigeldaley,項目名稱:moodle,代碼行數:31,代碼來源:assessment.php

示例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());
開發者ID:alanaipe2015,項目名稱:moodle,代碼行數:31,代碼來源:submission.php

示例3:

$canviewallsubmissions = has_capability('mod/workshop:viewallsubmissions', $workshop->context);
$cansetassessmentweight = has_capability('mod/workshop:allocate', $workshop->context);
$canoverridegrades = has_capability('mod/workshop:overridegrades', $workshop->context);
$isreviewer = $USER->id == $assessment->reviewerid;
$isauthor = $USER->id == $submission->authorid;
if ($isreviewer or $isauthor or $canviewallassessments and $canviewallsubmissions) {
    // such a user can continue
} else {
    print_error('nopermissions', 'error', $workshop->view_url(), 'view this assessment');
}
if ($isauthor and !$isreviewer and !$canviewallassessments and $workshop->phase != workshop::PHASE_CLOSED) {
    // authors can see assessments of their work at the end of workshop only
    print_error('nopermissions', 'error', $workshop->view_url(), 'view assessment of own work before workshop is closed');
}
// only the reviewer is allowed to modify the assessment
if ($isreviewer and $workshop->assessing_allowed()) {
    $assessmenteditable = true;
} else {
    $assessmenteditable = false;
}
// check that all required examples have been assessed by the user
if ($assessmenteditable and $workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_ASSESSMENT and !has_capability('mod/workshop:manageexamples', $workshop->context)) {
    // the reviewer must have submitted their own submission
    $reviewersubmission = $workshop->get_submission_by_author($assessment->reviewerid);
    if (!$reviewersubmission) {
        // no money, no love
        $assessmenteditable = false;
        echo $output->header();
        echo $output->heading(get_string('exampleneedsubmission', 'workshop'), 2);
        echo $output->footer();
        exit;
開發者ID:vuchannguyen,項目名稱:web,代碼行數:31,代碼來源:assessment.php


注:本文中的workshop::assessing_allowed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。