. /** * Page to edit complex grading setups for quizzes * * For quizzes with basic grading, everything can be done on edit.php. * However, more advanced options are possible, if you come to this * separate page. * * @package mod_quiz * @copyright 2023 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use mod_quiz\output\edit_grading_page; use mod_quiz\output\edit_nav_actions; use mod_quiz\quiz_settings; // The require_login check is done in question_edit_setup, but the automated checker can't see this. // phpcs:ignore moodle.Files.RequireLogin.Missing require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); require_once($CFG->dirroot . '/question/editlib.php'); list($thispageurl, $contexts, $cmid, $cm, $quiz, $pagevars) = question_edit_setup('editq', '/mod/quiz/editgrading.php', true); $PAGE->set_url($thispageurl); $PAGE->set_secondary_active_tab('mod_quiz_edit'); // You need mod/quiz:manage in addition to question capabilities to access this page. require_capability('mod/quiz:manage', $contexts->lowest()); // Get the course object and related bits. $course = get_course($quiz->course); $quizobj = new quiz_settings($quiz, $cm, $course); $structure = $quizobj->get_structure(); $editpage = new edit_grading_page($structure); $quizhasattempts = quiz_has_attempts($quiz->id); // Initialise output. $PAGE->set_pagelayout('incourse'); $output = $PAGE->get_renderer('mod_quiz', 'edit'); $PAGE->set_title(get_string('editingquizx', 'quiz', format_string($quiz->name))); $PAGE->set_heading($course->fullname); $PAGE->activityheader->disable(); $PAGE->set_secondary_active_tab('mod_quiz_edit'); $tertiarynav = new edit_nav_actions($cmid, edit_nav_actions::GRADING); $PAGE->requires->js_call_amd('mod_quiz/edit_multiple_grades', 'init'); // Do output. echo $output->header(); echo $output->render($tertiarynav); echo $output->render($editpage); echo $output->footer();