} // 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))); echo $output->footer(); exit; } else { $examples = $workshopplus->get_examples_for_reviewer($assessment->reviewerid); foreach ($examples as $exampleid => $example) { if (is_null($example->grade)) { $assessmenteditable = false; echo $output->header(); echo $output->heading(format_string($workshopplus->name)); notice(get_string('exampleneedassessed', 'workshopplus'), new moodle_url('/mod/workshopplus/view.php', array('id' => $cm->id))); echo $output->footer(); exit; } } } } // load the grading strategy logic $strategy = $workshopplus->grading_strategy_instance(); if (is_null($assessment->grade) and !$assessmenteditable) {
// check this flag against the group membership yet if (groups_get_activity_groupmode($workshopplus->cm) == SEPARATEGROUPS) { // user must have accessallgroups or share at least one group with the submission author if (!has_capability('moodle/site:accessallgroups', $workshopplus->context)) { $usersgroups = groups_get_activity_allowed_groups($workshopplus->cm); $authorsgroups = groups_get_all_groups($workshopplus->course->id, $submission->authorid, $workshopplus->cm->groupingid, 'g.id'); $sharedgroups = array_intersect_key($usersgroups, $authorsgroups); if (empty($sharedgroups)) { $canviewall = false; } } } } if ($editable and $workshopplus->useexamples and $workshopplus->examplesmode == workshopplus::EXAMPLES_BEFORE_SUBMISSION and !has_capability('mod/workshopplus:manageexamples', $workshopplus->context)) { // check that all required examples have been assessed by the user $examples = $workshopplus->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? ////////////By Morteza /// find the group id of the current user $usergroups = groups_get_user_groups($course->id, $USER->id); $currentgroupid = $usergroups[0][0]; // Get the current group name from the group id.
/** * 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 workshopplus::get_examples_for_reviewer() for the format of returned value * @return array */ public function get_examples() { if (is_null($this->examples)) { $this->examples = $this->workshopplus->get_examples_for_reviewer($this->userid); } return $this->examples; }