当前位置: 首页>>代码示例>>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;未经允许,请勿转载。