Skip to content

Commit

Permalink
Moved renderer from using $OUTPUT to $this->output and also
Browse files Browse the repository at this point in the history
$PAGE to use $this->page
  • Loading branch information
marcusgreen committed Dec 8, 2024
1 parent 9c76a5a commit 42d6bc5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -97,7 +97,7 @@ 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',
$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']]);
}
Expand All @@ -117,7 +117,7 @@ public function formulation_and_controls(question_attempt $qa,
if (get_config('qtype_aitext', 'uselocalaimanager')) {
$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 . '"]']);
}

Expand Down Expand Up @@ -332,7 +332,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;
Expand Down Expand Up @@ -378,7 +377,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'
Expand Down Expand Up @@ -697,7 +696,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;
Expand Down Expand Up @@ -743,7 +741,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'
Expand Down

0 comments on commit 42d6bc5

Please sign in to comment.