$edit = false; } ////////////end by Morteza 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 } elseif ($grouphassubmitted and $groupsubmission->id == $id) { // ok you can go } else { print_error('nopermissions', 'error', $workshopplus->view_url(), 'view or create submission'); } if ($assess and $submission->id and !$isreviewer and $canallocate and $workshopplus->assessing_allowed($USER->id)) { require_sesskey(); $assessmentid = $workshopplus->add_allocation($submission, $USER->id); redirect($workshopplus->assess_url($assessmentid)); } if ($edit) { require_once dirname(__FILE__) . '/submission_form.php'; $maxfiles = $workshopplus->nattachments; $maxbytes = $workshopplus->maxbytes; $contentopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $workshopplus->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, $workshopplus->context, 'mod_workshopplus', 'submission_content', $submission->id); $submission = file_prepare_standard_filemanager($submission, 'attachment', $attachmentopts, $workshopplus->context, 'mod_workshopplus', 'submission_attachment', $submission->id); $mform = new workshopplus_submission_form($PAGE->url, array('current' => $submission, 'workshopplus' => $workshopplus, 'contentopts' => $contentopts, 'attachmentopts' => $attachmentopts)); //print_r("SUBMIT"); //print_r($cansubmit);
$canviewallsubmissions = false; } } } } if ($isreviewer or $isauthor or $canviewallassessments and $canviewallsubmissions) { // such a user can continue } else { print_error('nopermissions', 'error', $workshopplus->view_url(), 'view this assessment'); } if ($isauthor and !$isreviewer and !$canviewallassessments and $workshopplus->phase != workshopplus::PHASE_CLOSED) { // authors can see assessments of their work at the end of workshopplus only print_error('nopermissions', 'error', $workshopplus->view_url(), 'view assessment of own work before workshopplus is closed'); } // only the reviewer is allowed to modify the assessment if ($isreviewer and $workshopplus->assessing_allowed($USER->id)) { $assessmenteditable = true; } else { $assessmenteditable = false; } // check that all required examples have been assessed by the user if ($assessmenteditable and $workshopplus->useexamples and $workshopplus->examplesmode == workshopplus::EXAMPLES_BEFORE_ASSESSMENT and !has_capability('mod/workshopplus:manageexamples', $workshopplus->context)) { // the reviewer must have submitted their own submission $reviewersubmission = $workshopplus->get_submission_by_author($assessment->reviewerid); $output = $PAGE->get_renderer('mod_workshopplus'); if (!$reviewersubmission) { // no money, no love $assessmenteditable = false; echo $output->header(); echo $output->heading(format_string($workshopplus->name)); notice(get_string('exampleneedsubmission', 'workshopplus'), new moodle_url('/mod/workshopplus/view.php', array('id' => $cm->id)));