/** * Returns example submissions to be assessed by the owner of the planner * * This is here to cache the DB query because the same list is needed later in view.php * * @see workshop::get_examples_for_reviewer() for the format of returned value * @return array */ public function get_examples() { if (is_null($this->examples)) { $this->examples = $this->workshop->get_examples_for_reviewer($this->userid); } return $this->examples; }
// check this flag against the group membership yet if (groups_get_activity_groupmode($workshop->cm) == SEPARATEGROUPS) { // user must have accessallgroups or share at least one group with the submission author if (!has_capability('moodle/site:accessallgroups', $workshop->context)) { $usersgroups = groups_get_activity_allowed_groups($workshop->cm); $authorsgroups = groups_get_all_groups($workshop->course->id, $submission->authorid, $workshop->cm->groupingid, 'g.id'); $sharedgroups = array_intersect_key($usersgroups, $authorsgroups); if (empty($sharedgroups)) { $canviewall = false; } } } } if ($editable and $workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_SUBMISSION and !has_capability('mod/workshop:manageexamples', $workshop->context)) { // check that all required examples have been assessed by the user $examples = $workshop->get_examples_for_reviewer($USER->id); foreach ($examples as $exampleid => $example) { if (is_null($example->grade)) { $editable = false; break; } } } $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;
} // 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; } else { $examples = $workshop->get_examples_for_reviewer($assessment->reviewerid); foreach ($examples as $exampleid => $example) { if (is_null($example->grade)) { $assessmenteditable = false; echo $output->header(); echo $output->heading(get_string('exampleneedassessed', 'workshop'), 2); echo $output->footer(); exit; } } } } // load the grading strategy logic $strategy = $workshop->grading_strategy_instance();