print_error('nopermissions', 'error', $teamwork->view_url(), 'assess example submission'); } // only the reviewer is allowed to modify the assessment if ($canmanage and $assessment->weight == 1 or $isreviewer and $teamwork->assessing_examples_allowed()) { $assessmenteditable = true; } else { $assessmenteditable = false; } // load the grading strategy logic $strategy = $teamwork->grading_strategy_instance(); // load the assessment form and process the submitted data eventually $mform = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, $assessmenteditable); // Set data managed by the teamwork core, subplugins set their own data themselves. $currentdata = (object) array('feedbackauthor' => $assessment->feedbackauthor, 'feedbackauthorformat' => $assessment->feedbackauthorformat); if ($assessmenteditable and $teamwork->overallfeedbackmode) { $currentdata = file_prepare_standard_editor($currentdata, 'feedbackauthor', $teamwork->overall_feedback_content_options(), $teamwork->context, 'mod_teamwork', 'overallfeedback_content', $assessment->id); if ($teamwork->overallfeedbackfiles) { $currentdata = file_prepare_standard_filemanager($currentdata, 'feedbackauthorattachment', $teamwork->overall_feedback_attachment_options(), $teamwork->context, 'mod_teamwork', 'overallfeedback_attachment', $assessment->id); } } $mform->set_data($currentdata); if ($mform->is_cancelled()) { redirect($teamwork->view_url()); } elseif ($assessmenteditable and $data = $mform->get_data()) { // Let the grading strategy subplugin save its data. $rawgrade = $strategy->save_assessment($assessment, $data); // Store the data managed by the teamwork core. $coredata = (object) array('id' => $assessment->id); if (isset($data->feedbackauthor_editor)) { $coredata->feedbackauthor_editor = $data->feedbackauthor_editor; $coredata = file_postupdate_standard_editor($coredata, 'feedbackauthor', $teamwork->overall_feedback_content_options(), $teamwork->context, 'mod_teamwork', 'overallfeedback_content', $assessment->id);