Esempio n. 1
0
                $canviewallsubmissions = false;
            }
        }
    }
}
if ($isreviewer or $isauthor or $canviewallassessments and $canviewallsubmissions) {
    // such a user can continue
} else {
    print_error('nopermissions', 'error', $teamwork->view_url(), 'view this assessment');
}
if ($isauthor and !$isreviewer and !$canviewallassessments and $teamwork->phase != teamwork::PHASE_CLOSED) {
    // authors can see assessments of their work at the end of teamwork only
    print_error('nopermissions', 'error', $teamwork->view_url(), 'view assessment of own work before teamwork is closed');
}
// only the reviewer is allowed to modify the assessment
if ($isreviewer and $teamwork->assessing_allowed($USER->id)) {
    $assessmenteditable = true;
} else {
    $assessmenteditable = false;
}
// check that all required examples have been assessed by the user
if ($assessmenteditable and $teamwork->useexamples and $teamwork->examplesmode == teamwork::EXAMPLES_BEFORE_ASSESSMENT and !has_capability('mod/teamwork:manageexamples', $teamwork->context)) {
    // the reviewer must have submitted their own submission
    $reviewersubmission = $teamwork->get_submission_by_author($assessment->reviewerid);
    $output = $PAGE->get_renderer('mod_teamwork');
    if (!$reviewersubmission) {
        // no money, no love
        $assessmenteditable = false;
        echo $output->header();
        echo $output->heading(format_string($teamwork->name));
        notice(get_string('exampleneedsubmission', 'teamwork'), new moodle_url('/mod/teamwork/view.php', array('id' => $cm->id)));