MDL-76614 quiz: mod_quiz_renderer => mod_quiz\output\renderer
This commit is contained in:
+16
-15
@@ -29,6 +29,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use mod_quiz\access_manager;
|
||||
use mod_quiz\output\links_to_other_attempts;
|
||||
use mod_quiz\output\renderer;
|
||||
use mod_quiz\question\bank\qbank_helper;
|
||||
use mod_quiz\question\display_options;
|
||||
|
||||
@@ -1698,11 +1699,11 @@ class quiz_attempt {
|
||||
*
|
||||
* @param int $slot identifies the question in the attempt.
|
||||
* @param bool $reviewing is the being printed on an attempt or a review page.
|
||||
* @param mod_quiz_renderer $renderer the quiz renderer.
|
||||
* @param renderer $renderer the quiz renderer.
|
||||
* @param moodle_url $thispageurl the URL of the page this question is being printed on.
|
||||
* @return string HTML for the question in its current state.
|
||||
*/
|
||||
public function render_question($slot, $reviewing, mod_quiz_renderer $renderer, $thispageurl = null) {
|
||||
public function render_question($slot, $reviewing, renderer $renderer, $thispageurl = null) {
|
||||
if ($this->is_blocked_by_previous_question($slot)) {
|
||||
$placeholderqa = $this->make_blocked_question_placeholder($slot);
|
||||
|
||||
@@ -1725,12 +1726,12 @@ class quiz_attempt {
|
||||
* @param int $slot identifies the question in the attempt.
|
||||
* @param bool $reviewing is the being printed on an attempt or a review page.
|
||||
* @param moodle_url $thispageurl the URL of the page this question is being printed on.
|
||||
* @param mod_quiz_renderer $renderer the quiz renderer.
|
||||
* @param renderer $renderer the quiz renderer.
|
||||
* @param int|null $seq the seq number of the past state to display.
|
||||
* @return string HTML fragment.
|
||||
*/
|
||||
protected function render_question_helper($slot, $reviewing, $thispageurl,
|
||||
mod_quiz_renderer $renderer, $seq) {
|
||||
renderer $renderer, $seq) {
|
||||
$originalslot = $this->get_original_slot($slot);
|
||||
$number = $this->get_question_number($originalslot);
|
||||
$displayoptions = $this->get_display_options_with_edit_link($reviewing, $slot, $thispageurl);
|
||||
@@ -1811,12 +1812,12 @@ class quiz_attempt {
|
||||
* @param int $slot the slot number of a question in this quiz attempt.
|
||||
* @param int $seq the seq number of the past state to display.
|
||||
* @param bool $reviewing is the being printed on an attempt or a review page.
|
||||
* @param mod_quiz_renderer $renderer the quiz renderer.
|
||||
* @param renderer $renderer the quiz renderer.
|
||||
* @param moodle_url $thispageurl the URL of the page this question is being printed on.
|
||||
* @return string HTML for the question in its current state.
|
||||
*/
|
||||
public function render_question_at_step($slot, $seq, $reviewing,
|
||||
mod_quiz_renderer $renderer, $thispageurl = null) {
|
||||
renderer $renderer, $thispageurl = null) {
|
||||
return $this->render_question_helper($slot, $reviewing, $thispageurl, $renderer, $seq);
|
||||
}
|
||||
|
||||
@@ -1867,13 +1868,13 @@ class quiz_attempt {
|
||||
/**
|
||||
* Get the navigation panel object for this attempt.
|
||||
*
|
||||
* @param mod_quiz_renderer $output the quiz renderer to use to output things.
|
||||
* @param renderer $output the quiz renderer to use to output things.
|
||||
* @param string $panelclass The type of panel, quiz_attempt_nav_panel or quiz_review_nav_panel
|
||||
* @param int $page the current page number.
|
||||
* @param bool $showall whether we are showing the whole quiz on one page. (Used by review.php.)
|
||||
* @return block_contents the requested object.
|
||||
*/
|
||||
public function get_navigation_panel(mod_quiz_renderer $output,
|
||||
public function get_navigation_panel(renderer $output,
|
||||
$panelclass, $page, $showall = false) {
|
||||
$panel = new $panelclass($this, $this->get_display_options(true), $page, $showall);
|
||||
|
||||
@@ -2845,19 +2846,19 @@ abstract class quiz_nav_panel_base {
|
||||
/**
|
||||
* Hook for subclasses to override.
|
||||
*
|
||||
* @param mod_quiz_renderer $output the quiz renderer to use.
|
||||
* @param renderer $output the quiz renderer to use.
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function render_before_button_bits(mod_quiz_renderer $output) {
|
||||
public function render_before_button_bits(renderer $output) {
|
||||
return '';
|
||||
}
|
||||
|
||||
abstract public function render_end_bits(mod_quiz_renderer $output);
|
||||
abstract public function render_end_bits(renderer $output);
|
||||
|
||||
/**
|
||||
* Render the restart preview button.
|
||||
*
|
||||
* @param mod_quiz_renderer $output the quiz renderer to use.
|
||||
* @param renderer $output the quiz renderer to use.
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
protected function render_restart_preview_link($output) {
|
||||
@@ -2917,12 +2918,12 @@ class quiz_attempt_nav_panel extends quiz_nav_panel_base {
|
||||
}
|
||||
}
|
||||
|
||||
public function render_before_button_bits(mod_quiz_renderer $output) {
|
||||
public function render_before_button_bits(renderer $output) {
|
||||
return html_writer::tag('div', get_string('navnojswarning', 'quiz'),
|
||||
array('id' => 'quiznojswarning'));
|
||||
}
|
||||
|
||||
public function render_end_bits(mod_quiz_renderer $output) {
|
||||
public function render_end_bits(renderer $output) {
|
||||
if ($this->page == -1) {
|
||||
// Don't link from the summary page to itself.
|
||||
return '';
|
||||
@@ -2946,7 +2947,7 @@ class quiz_review_nav_panel extends quiz_nav_panel_base {
|
||||
return $this->attemptobj->review_url($slot, -1, $this->showall, $this->page);
|
||||
}
|
||||
|
||||
public function render_end_bits(mod_quiz_renderer $output) {
|
||||
public function render_end_bits(renderer $output) {
|
||||
$html = '';
|
||||
if ($this->attemptobj->get_num_pages() > 1) {
|
||||
if ($this->showall) {
|
||||
|
||||
@@ -21,7 +21,7 @@ use mod_quiz\form\preflight_check_form;
|
||||
use mod_quiz\local\access_rule_base;
|
||||
use mod_quiz\question\display_options;
|
||||
use mod_quiz_mod_form;
|
||||
use mod_quiz_renderer;
|
||||
use mod_quiz\output\renderer;
|
||||
use moodle_page;
|
||||
use moodle_url;
|
||||
use MoodleQuickForm;
|
||||
@@ -524,10 +524,10 @@ class access_manager {
|
||||
*
|
||||
* This method does not return;
|
||||
*
|
||||
* @param mod_quiz_renderer $output the quiz renderer.
|
||||
* @param renderer $output the quiz renderer.
|
||||
* @param string $message optional message to output while redirecting.
|
||||
*/
|
||||
public function back_to_view_page(mod_quiz_renderer $output, string $message = ''): void {
|
||||
public function back_to_view_page(renderer $output, string $message = ''): void {
|
||||
// Actually return type 'never' on the previous line, once 8.1 is our minimum PHP version.
|
||||
if ($this->attempt_must_be_in_popup()) {
|
||||
echo $output->close_attempt_popup(new moodle_url($this->quizobj->view_url()), $message);
|
||||
@@ -542,11 +542,11 @@ class access_manager {
|
||||
*
|
||||
* @param stdClass $attempt the attempt object
|
||||
* @param mixed $nolongerused not used any more.
|
||||
* @param mod_quiz_renderer $output quiz renderer instance.
|
||||
* @param renderer $output quiz renderer instance.
|
||||
* @return string some HTML, the $linktext either unmodified or wrapped in a
|
||||
* link to the review page.
|
||||
*/
|
||||
public function make_review_link(stdClass $attempt, $nolongerused, mod_quiz_renderer $output): string {
|
||||
public function make_review_link(stdClass $attempt, $nolongerused, renderer $output): string {
|
||||
|
||||
// If the attempt is still open, don't link.
|
||||
if (in_array($attempt->state, [quiz_attempt::IN_PROGRESS, quiz_attempt::OVERDUE])) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -58,4 +58,5 @@ $renamedclasses = [
|
||||
'quiz_add_random_form' => 'mod_quiz\form\add_random_form',
|
||||
'mod_quiz_links_to_other_attempts' => 'mod_quiz\output\links_to_other_attempts',
|
||||
'mod_quiz_view_object' => 'mod_quiz\output\view_page',
|
||||
'mod_quiz_renderer' => 'mod_quiz\output\renderer',
|
||||
];
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot . '/mod/quiz/lib.php');
|
||||
require_once($CFG->dirroot . '/mod/quiz/renderer.php');
|
||||
require_once($CFG->dirroot . '/mod/quiz/attemptlib.php');
|
||||
require_once($CFG->libdir . '/completionlib.php');
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
+7
-1414
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
namespace mod_quiz;
|
||||
|
||||
use mod_quiz\output\renderer;
|
||||
use quiz_attempt;
|
||||
use mod_quiz\question\display_options;
|
||||
|
||||
@@ -517,7 +518,7 @@ class locallib_test extends \advanced_testcase {
|
||||
$generator = $this->getDataGenerator();
|
||||
/** @var mod_quiz_generator $quizgenerator */
|
||||
$quizgenerator = $generator->get_plugin_generator('mod_quiz');
|
||||
/** @var mod_quiz_renderer $renderer */
|
||||
/** @var renderer $renderer */
|
||||
$renderer = $PAGE->get_renderer('mod_quiz');
|
||||
|
||||
// Course with quiz and a group - plus some others, to verify they don't get counted.
|
||||
|
||||
@@ -42,6 +42,7 @@ This files describes API changes in the quiz code.
|
||||
- quiz_add_random_form => mod_quiz\form\add_random_form
|
||||
- mod_quiz_links_to_other_attempts => mod_quiz\output\links_to_other_attempts
|
||||
- mod_quiz_view_object => mod_quiz\output\view_page
|
||||
- mod_quiz_renderer => mod_quiz\output\renderer
|
||||
|
||||
* The following classes have been deprecated:
|
||||
- mod_quiz_overdue_attempt_updater - merged into mod_quiz\task\update_overdue_attempts
|
||||
@@ -59,6 +60,7 @@ This files describes API changes in the quiz code.
|
||||
- mod/quiz/cronlib.php
|
||||
- mod/quiz/override_form.php
|
||||
- mod/quiz/accessrule/accessrulebase.php
|
||||
- mod/quiz/renderer.php
|
||||
|
||||
|
||||
=== 4.1 ===
|
||||
|
||||
+2
-1
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
use mod_quiz\access_manager;
|
||||
use mod_quiz\output\renderer;
|
||||
use mod_quiz\output\view_page;
|
||||
|
||||
require_once(__DIR__ . '/../../config.php');
|
||||
@@ -149,7 +150,7 @@ if (html_is_blank($quiz->intro)) {
|
||||
$PAGE->activityheader->set_description('');
|
||||
}
|
||||
$PAGE->add_body_class('limitedwidth');
|
||||
/** @var mod_quiz_renderer $output */
|
||||
/** @var renderer $output */
|
||||
$output = $PAGE->get_renderer('mod_quiz');
|
||||
|
||||
// Print table with existing attempts.
|
||||
|
||||
Reference in New Issue
Block a user