Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Page to edit complex grading setups for quizzes
19
 *
20
 * For quizzes with basic grading, everything can be done on edit.php.
21
 * However, more advanced options are possible, if you come to this
22
 * separate page.
23
 *
24
 * @package   mod_quiz
25
 * @copyright 2023 The Open University
26
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
 
29
use mod_quiz\output\edit_grading_page;
30
use mod_quiz\output\edit_nav_actions;
31
use mod_quiz\quiz_settings;
32
 
33
// The require_login check is done in question_edit_setup, but the automated checker can't see this.
34
// phpcs:ignore moodle.Files.RequireLogin.Missing
35
require_once(__DIR__ . '/../../config.php');
36
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
37
require_once($CFG->dirroot . '/question/editlib.php');
38
 
39
list($thispageurl, $contexts, $cmid, $cm, $quiz, $pagevars) =
40
        question_edit_setup('editq', '/mod/quiz/editgrading.php', true);
41
 
42
$PAGE->set_url($thispageurl);
43
$PAGE->set_secondary_active_tab('mod_quiz_edit');
44
 
45
// You need mod/quiz:manage in addition to question capabilities to access this page.
46
require_capability('mod/quiz:manage', $contexts->lowest());
47
 
48
// Get the course object and related bits.
49
$course = get_course($quiz->course);
50
$quizobj = new quiz_settings($quiz, $cm, $course);
51
$structure = $quizobj->get_structure();
52
$editpage = new edit_grading_page($structure);
53
 
54
$quizhasattempts = quiz_has_attempts($quiz->id);
55
 
56
// Initialise output.
57
$PAGE->set_pagelayout('incourse');
58
 
59
$output = $PAGE->get_renderer('mod_quiz', 'edit');
60
 
61
$PAGE->set_title(get_string('editingquizx', 'quiz', format_string($quiz->name)));
62
$PAGE->set_heading($course->fullname);
63
$PAGE->activityheader->disable();
64
$PAGE->set_secondary_active_tab('mod_quiz_edit');
65
$tertiarynav = new edit_nav_actions($cmid, edit_nav_actions::GRADING);
66
 
67
$PAGE->requires->js_call_amd('mod_quiz/edit_multiple_grades', 'init');
68
 
69
// Do output.
70
echo $output->header();
71
echo $output->render($tertiarynav);
72
echo $output->render($editpage);
73
echo $output->footer();