示例#1
0
    $event->trigger();
}
$ownsubmission = $submission->authorid == $USER->id;
$canviewall = has_capability('mod/teamwork:viewallsubmissions', $teamwork->context);
$cansubmit = has_capability('mod/teamwork:submit', $teamwork->context);
$canallocate = has_capability('mod/teamwork:allocate', $teamwork->context);
$canpublish = has_capability('mod/teamwork:publishsubmissions', $teamwork->context);
$canoverride = ($teamwork->phase == teamwork::PHASE_EVALUATION and has_capability('mod/teamwork:overridegrades', $teamwork->context));
$userassessment = $teamwork->get_assessment_of_submission_by_user($submission->id, $USER->id);
$isreviewer = !empty($userassessment);
$editable = ($cansubmit and $ownsubmission);
$ispublished = ($teamwork->phase == teamwork::PHASE_CLOSED and $submission->published == 1 and has_capability('mod/teamwork:viewpublishedsubmissions', $teamwork->context));
if (empty($submission->id) and $teamwork->creating_submission_allowed($USER->id)) {
    $editable = true;
}
if ($submission->id and !$teamwork->modifying_submission_allowed($USER->id)) {
    $editable = false;
}
$instancerecord = $DB->get_record('teamwork_instance', array('id' => $instanceid));
$teamrecord = $DB->get_record('teamwork_team', array('id' => $instancerecord->team));
$ismember = $DB->get_record('teamwork_teammembers', array('userid' => $USER->id, 'team' => $teamrecord->id));
$edit = $ismember;
// Output starts here
$output = $PAGE->get_renderer('mod_teamwork');
echo $output->header();
echo $output->heading(format_string($teamwork->name), 2);
if ($edit) {
    require_once dirname(__FILE__) . '/submission_form.php';
    $maxfiles = $teamwork->nattachments;
    $maxbytes = $teamwork->maxbytes;
    $contentopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $teamwork->context, 'return_types' => FILE_INTERNAL | FILE_EXTERNAL);