diff --git a/renderer.php b/renderer.php index 4ebeac4..ddab3eb 100755 --- a/renderer.php +++ b/renderer.php @@ -43,7 +43,7 @@ class qtype_aitext_renderer extends qtype_renderer { */ public function formulation_and_controls(question_attempt $qa, question_display_options $options) { - global $CFG, $PAGE, $USER; + global $CFG, $USER; /** @var qtype_aitext_question $question */ $question = $qa->get_question(); @@ -96,8 +96,9 @@ public function formulation_and_controls(question_attempt $qa, $uniqid = uniqid(); $result .= html_writer::tag('div', '', ['data-content' => 'local_ai_manager_infobox', 'data-boxid' => $uniqid]); - $PAGE->requires->js_call_amd('local_ai_manager/infobox', 'renderInfoBox', - ['qtype_aitext', $USER->id, '[data-content="local_ai_manager_infobox"][data-boxid="' . $uniqid . '"]', ['feedback']]); + $this->page->requires->js_call_amd('local_ai_manager/infobox', 'renderInfoBox', + ['qtype_aitext', $USER->id, '[data-content="local_ai_manager_infobox"][data-boxid="' . $uniqid . '"]', + ['feedback']]); $result .= html_writer::tag('div', $question->format_questiontext($qa), ['class' => 'qtext']); @@ -113,7 +114,7 @@ public function formulation_and_controls(question_attempt $qa, $result .= html_writer::end_tag('div'); $result .= html_writer::tag('div', '', ['data-content' => 'local_ai_manager_warningbox', 'data-boxid' => $uniqid]); - $PAGE->requires->js_call_amd('local_ai_manager/warningbox', 'renderWarningBox', + $this->page->requires->js_call_amd('local_ai_manager/warningbox', 'renderWarningBox', ['[data-content="local_ai_manager_warningbox"][data-boxid="' . $uniqid . '"]']); return $result; @@ -327,7 +328,6 @@ protected function class_name() { * @throws coding_exception */ public function response_area_read_only($name, $qa, $step, $lines, $context) { - global $OUTPUT; $question = $qa->get_question(); $uniqid = uniqid(); $readonlyareaid = 'aitext_readonly_area' . $uniqid; @@ -373,7 +373,7 @@ public function response_area_read_only($name, $qa, $step, $lines, $context) { $btnoptions = ['id' => $spellcheckeditbuttonid, 'class' => 'btn btn-link']; $output .= html_writer::tag( 'button', - $OUTPUT->pix_icon( + $this->output->pix_icon( 'i/edit', get_string('spellcheckedit', 'qtype_aitext'), 'moodle' @@ -692,7 +692,6 @@ protected function class_name() { */ public function response_area_read_only($name, $qa, $step, $lines, $context) { // CARE: This is basically duplicating response_area_read_only from qtype_aitext_format_editor_renderer. - global $OUTPUT; $question = $qa->get_question(); $uniqid = uniqid(); $readonlyareaid = 'aitext_readonly_area' . $uniqid; @@ -738,7 +737,7 @@ public function response_area_read_only($name, $qa, $step, $lines, $context) { $btnoptions = ['id' => $spellcheckeditbuttonid, 'class' => 'btn btn-link']; $output .= html_writer::tag( 'button', - $OUTPUT->pix_icon( + $this->output->pix_icon( 'i/edit', get_string('spellcheckedit', 'qtype_aitext'), 'moodle'