-
Notifications
You must be signed in to change notification settings - Fork 6
/
renderer.php
executable file
·694 lines (613 loc) · 26.3 KB
/
renderer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Based on core Moodle qtype_essay originating at the UK Open University
*
* @package qtype_aitext
* @subpackage aitext
* @copyright 2024 Marcus Green
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Generates the output for aitext questions.
*
* @copyright 2024 Marcus Green
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_aitext_renderer extends qtype_renderer {
/**
* Generate the display of the formulation part of the question shown at runtime
* in a quiz
*
* @param question_attempt $qa
* @param question_display_options $options
* @return string
*/
public function formulation_and_controls(question_attempt $qa,
question_display_options $options) {
global $CFG;
/** @var qtype_aitext_question $question */
$question = $qa->get_question();
/** @var qtype_aitext_format_renderer_base $responseoutput */
$responseoutput = $question->get_format_renderer($this->page);
$responseoutput->set_displayoptions($options);
// Answer field.
$step = $qa->get_last_step_with_qt_var('answer');
if (!$step->has_qt_var('answer') && empty($options->readonly)) {
// Question has never been answered, fill it with response template.
$step = new question_attempt_step(['answer' => $question->responsetemplate]);
}
if (empty($options->readonly)) {
$answer = $responseoutput->response_area_input('answer', $qa,
$step, $question->responsefieldlines, $options->context);
} else {
$answer = $responseoutput->response_area_read_only('answer', $qa,
$step, $question->responsefieldlines, $options->context);
$answer .= html_writer::nonempty_tag('p', $question->get_word_count_message_for_review($step->get_qt_data()));
if (!empty($CFG->enableplagiarism)) {
require_once($CFG->libdir . '/plagiarismlib.php');
$answer .= plagiarism_get_links((object) [
'context' => $options->context->id,
'component' => $qa->get_question()->qtype->plugin_name(),
'area' => $qa->get_usage_id(),
'itemid' => $qa->get_slot(),
'userid' => $step->get_user_id(),
'content' => $qa->get_response_summary()]);
}
}
$files = '';
if (isset($question->attachments) && $question->attachments) {
if (empty($options->readonly)) {
$files = $this->files_input($qa, $question->attachments, $options);
} else {
$files = $this->files_read_only($qa, $options);
}
}
$result = '';
$result .= html_writer::tag('div', $question->format_questiontext($qa),
['class' => 'qtext']);
$result .= html_writer::start_tag('div', ['class' => 'ablock']);
$result .= html_writer::tag('div', $answer, ['class' => 'answer']);
// If there is a response and min/max word limit is set in the form then check the response word count.
if ($qa->get_state() == question_state::$invalid) {
$result .= html_writer::nonempty_tag('div',
$question->get_validation_error($step->get_qt_data()), ['class' => 'validationerror']);
}
$result .= html_writer::tag('div', $files, ['class' => 'attachments']);
$result .= html_writer::end_tag('div');
return $result;
}
/**
* Return the ai evaluation into the feedback area, instead
* of the normal fixed/hint feedback when in preview mode.
*
* @param question_attempt $qa
* @param question_display_options $options
* @return string HTML fragment.
*/
public function feedback(question_attempt $qa, question_display_options $options) {
// Get data written in the question.php grade_response method.
// This probably should be retrieved by an api call.
$comment = $qa->get_current_manual_comment();
if ($this->page->pagetype == 'question-bank-previewquestion-preview') {
if ($comment[0] > '') {
$this->page->requires->js_call_amd('qtype_aitext/showprompt', 'init', []);
$prompt = $qa->get_last_qt_var('-aiprompt');
$showprompt = '<br/><button id=showprompt class="rounded">'. get_string('showprompt', 'qtype_aitext').'</button>';
$showprompt .= '<div id="fullprompt" class="hidden">'.$prompt .'</div>';
$comment[0] = $comment[0].$showprompt;
}
return $comment[0];
}
return '';
}
/**
* Displays any attached files when the question is in read-only mode.
* @param question_attempt $qa the question attempt to display.
* @param question_display_options $options controls what should and should
* not be displayed. Used to get the context.
*/
public function files_read_only(question_attempt $qa, question_display_options $options) {
global $CFG;
$files = $qa->get_last_qt_files('attachments', $options->context->id);
$filelist = [];
$step = $qa->get_last_step_with_qt_var('attachments');
foreach ($files as $file) {
$out = html_writer::link($qa->get_response_file_url($file),
$this->output->pix_icon(file_file_icon($file), get_mimetype_description($file),
'moodle', ['class' => 'icon']) . ' ' . s($file->get_filename()));
if (!empty($CFG->enableplagiarism)) {
require_once($CFG->libdir . '/plagiarismlib.php');
$out .= plagiarism_get_links((object)[
'context' => $options->context->id,
'component' => $qa->get_question()->qtype->plugin_name(),
'area' => $qa->get_usage_id(),
'itemid' => $qa->get_slot(),
'userid' => $step->get_user_id(),
'file' => $file]);
}
$filelist[] = html_writer::tag('li', $out, ['class' => 'mb-2']);
}
$labelbyid = $qa->get_qt_field_name('attachments') . '_label';
$fileslabel = $options->add_question_identifier_to_label(get_string('answerfiles', 'qtype_aitext'));
$output = html_writer::tag('h4', $fileslabel, ['id' => $labelbyid, 'class' => 'sr-only']);
$output .= html_writer::tag('ul', implode($filelist), [
'aria-labelledby' => $labelbyid,
'class' => 'list-unstyled m-0',
]);
return $output;
}
/**
* Displays the input control for when the student should upload a single file.
* @param question_attempt $qa the question attempt to display.
* @param int $numallowed the maximum number of attachments allowed. -1 = unlimited.
* @param question_display_options $options controls what should and should
* not be displayed. Used to get the context.
*/
public function files_input(question_attempt $qa, $numallowed,
question_display_options $options) {
global $CFG, $COURSE;
require_once($CFG->dirroot . '/lib/form/filemanager.php');
$pickeroptions = new stdClass();
$pickeroptions->mainfile = null;
$pickeroptions->maxfiles = $numallowed;
$pickeroptions->itemid = $qa->prepare_response_files_draft_itemid(
'attachments', $options->context->id);
$pickeroptions->context = $options->context;
$pickeroptions->return_types = FILE_INTERNAL | FILE_CONTROLLED_LINK;
$pickeroptions->itemid = $qa->prepare_response_files_draft_itemid(
'attachments', $options->context->id);
$pickeroptions->accepted_types = $qa->get_question()->filetypeslist;
$fm = new form_filemanager($pickeroptions);
$fm->options->maxbytes = get_user_max_upload_file_size(
$this->page->context,
$CFG->maxbytes,
$COURSE->maxbytes,
$qa->get_question()->maxbytes
);
$filesrenderer = $this->page->get_renderer('core', 'files');
$text = '';
if (!empty($qa->get_question()->filetypeslist)) {
$text = html_writer::tag('p', get_string('acceptedfiletypes', 'qtype_aitext'));
$filetypesutil = new \core_form\filetypes_util();
$filetypes = $qa->get_question()->filetypeslist;
$filetypedescriptions = $filetypesutil->describe_file_types($filetypes);
$text .= $this->render_from_template('core_form/filetypes-descriptions', $filetypedescriptions);
}
$output = html_writer::start_tag('fieldset');
$fileslabel = $options->add_question_identifier_to_label(get_string('answerfiles', 'qtype_aitext'));
$output .= html_writer::tag('legend', $fileslabel, ['class' => 'sr-only']);
$output .= $filesrenderer->render($fm);
$output .= html_writer::empty_tag('input', [
'type' => 'hidden',
'name' => $qa->get_qt_field_name('attachments'),
'value' => $pickeroptions->itemid,
]);
$output .= $text;
$output .= html_writer::end_tag('fieldset');
return $output;
}
}
/**
* Abstract out the differences between different type of response format.
*
*
* @copyright 2024
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class qtype_aitext_format_renderer_base extends plugin_renderer_base {
/** @var question_display_options Question display options instance for any necessary information for rendering the question. */
protected $displayoptions;
/**
* Question number setter.
*
* @param question_display_options $displayoptions
*/
public function set_displayoptions(question_display_options $displayoptions): void {
$this->displayoptions = $displayoptions;
}
/**
* Render the students respone when the question is in read-only mode.
*
* @param string $name the variable name this input edits.
* @param question_attempt $qa the question attempt being display.
* @param question_attempt_step $step the current step.
* @param int $lines approximate size of input box to display.
* @param object $context the context teh output belongs to.
* @return string html to display the response.
*/
abstract public function response_area_read_only($name, question_attempt $qa,
question_attempt_step $step, $lines, $context);
/**
* Render the students respone when the question is in read-only mode.
* @param string $name the variable name this input edits.
* @param question_attempt $qa the question attempt being display.
* @param question_attempt_step $step the current step.
* @param int $lines approximate size of input box to display.
* @param object $context the context teh output belongs to.
* @return string html to display the response for editing.
*/
abstract public function response_area_input($name, question_attempt $qa,
question_attempt_step $step, $lines, $context);
/**
* Specific class name to add to the input element.
*
* @return string
*/
abstract protected function class_name();
}
/**
* Where the student use the HTML editor
*
* @author Marcus Green 2024 building on work by the UK OU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_aitext_format_editor_renderer extends qtype_aitext_format_renderer_base {
/**
* Specific class name to add to the input element.
*
* @return string
*/
protected function class_name() {
return 'qtype_aitext_editor';
}
/**
* Return a read only version of the response areay. Typically for after
* a quesiton has been answered and the response cannot be modified.
* @param string $name
* @param question_attempt $qa
* @param question_attempt_step $step
* @param int $lines number of lines in the editor
* @param object $context
* @return string
* @throws coding_exception
*/
public function response_area_read_only($name, $qa, $step, $lines, $context) {
$labelbyid = $qa->get_qt_field_name($name) . '_label';
$responselabel = $this->displayoptions->add_question_identifier_to_label(get_string('answertext', 'qtype_aitext'));
$output = html_writer::tag('h4', $responselabel, ['id' => $labelbyid, 'class' => 'sr-only']);
$output .= html_writer::tag('div', $this->prepare_response($name, $qa, $step, $context), [
'role' => 'textbox',
'aria-readonly' => 'true',
'aria-labelledby' => $labelbyid,
'class' => $this->class_name() . ' qtype_aitext_response readonly',
'style' => 'min-height: ' . ($lines * 1.25) . 'em;',
]);
// Height $lines * 1.25 because that is a typical line-height on web pages.
// That seems to give results that look OK.
return $output;
}
/**
* Where the student types in their response
*
* @param string $name
* @param question_attempt $qa
* @param question_attempt_step $step
* @param int $lines lines available to type in response
* @param object $context
* @return string
* @throws coding_exception
*/
public function response_area_input($name, $qa, $step, $lines, $context) {
global $CFG;
require_once($CFG->dirroot . '/repository/lib.php');
$inputname = $qa->get_qt_field_name($name);
$responseformat = $step->get_qt_var($name . 'format');
$id = $inputname . '_id';
$editor = editors_get_preferred_editor($responseformat);
$strformats = format_text_menu();
$formats = $editor->get_supported_formats();
foreach ($formats as $fid) {
$formats[$fid] = $strformats[$fid];
}
list($draftitemid, $response) = $this->prepare_response_for_editing(
$name, $step, $context);
$editor->set_text($response);
$editor->use_editor($id, $this->get_editor_options($context),
$this->get_filepicker_options($context, $draftitemid));
$responselabel = $this->displayoptions->add_question_identifier_to_label(get_string('answertext', 'qtype_aitext'));
$output = html_writer::tag('label', $responselabel, [
'class' => 'sr-only',
'for' => $id,
]);
$output .= html_writer::start_tag('div', ['class' =>
$this->class_name() . ' qtype_aitext_response']);
$output .= html_writer::tag('div', html_writer::tag('textarea', s($response),
['id' => $id, 'name' => $inputname, 'rows' => $lines, 'cols' => 60, 'class' => 'form-control']));
$output .= html_writer::start_tag('div');
if (count($formats) == 1) {
reset($formats);
$output .= html_writer::empty_tag('input', ['type' => 'hidden',
'name' => $inputname . 'format', 'value' => key($formats)]);
} else {
$output .= html_writer::label(get_string('format'), 'menu' . $inputname . 'format', false);
$output .= ' ';
$output .= html_writer::select($formats, $inputname . 'format', $responseformat, '');
}
$output .= html_writer::end_tag('div');
$output .= $this->filepicker_html($inputname, $draftitemid);
$output .= html_writer::end_tag('div');
return $output;
}
/**
* Prepare the response for read-only display.
* @param string $name the variable name this input edits.
* @param question_attempt $qa the question
* being display.
* @param question_attempt_step $step the current step.
* @param object $context the context the attempt belongs to.
* @return string the response prepared for display.
*/
protected function prepare_response($name, question_attempt $qa,
question_attempt_step $step, $context) {
if (!$step->has_qt_var($name)) {
return '';
}
$formatoptions = new stdClass();
$formatoptions->para = false;
return format_text($step->get_qt_var($name), $step->get_qt_var($name . 'format'),
$formatoptions);
}
/**
* Prepare the response for editing.
* @param string $name the variable name this input edits.
* @param question_attempt_step $step the current step.
* @param object $context the context the attempt belongs to.
* @return array the response prepared for display.
*/
protected function prepare_response_for_editing($name,
question_attempt_step $step, $context) {
return [0, $step->get_qt_var($name)];
}
/**
* Fixed options for context and autosave is always false
*
* @param object $context the context the attempt belongs to.
* @return array options for the editor.
*/
protected function get_editor_options($context) {
// Disable the text-editor autosave because quiz has it's own auto save function.
return ['context' => $context, 'autosave' => false];
}
/**
* Redunant with the removal of the file submission option
*
* @todo remove calls to this then remove this
*
* @param object $context the context the attempt belongs to.
* @param int $draftitemid draft item id.
* @return array filepicker options for the editor.
*/
protected function get_filepicker_options($context, $draftitemid) {
return ['return_types' => FILE_INTERNAL | FILE_EXTERNAL];
}
/**
* Redundant with the removal of file submission
*
* @todo remove along with calls to it
*
* @param string $inputname input field name.
* @param int $draftitemid draft file area itemid.
* @return string HTML for the filepicker, if used.
*/
protected function filepicker_html($inputname, $draftitemid) {
return '';
}
}
/**
* Use the HTML editor with the file picker.
*
* @todo remove along with calls to it as file submission is not supported
*
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_aitext_format_editorfilepicker_renderer extends qtype_aitext_format_editor_renderer {
/**
* Specific class name to add to the input element.
*
* @return string
*/
protected function class_name() {
return 'qtype_aitext_editorfilepicker';
}
/**
* Ensure safe html is returned (?)
* @param string $name
* @param question_attempt $qa
* @param question_attempt_step $step
* @param object $context
* @return string
*/
protected function prepare_response($name, question_attempt $qa,
question_attempt_step $step, $context) {
if (!$step->has_qt_var($name)) {
return '';
}
$formatoptions = new stdClass();
$formatoptions->para = false;
$text = $qa->rewrite_response_pluginfile_urls($step->get_qt_var($name),
$context->id, 'answer', $step);
return format_text($text, $step->get_qt_var($name . 'format'), $formatoptions);
}
/**
* Process any images included with the text (?)
*
* @param string $name
* @param question_attempt_step $step
* @param object $context
* @return void
*/
protected function prepare_response_for_editing($name,
question_attempt_step $step, $context) {
return $step->prepare_response_files_draft_itemid_with_text(
$name, $context->id, $step->get_qt_var($name));
}
/**
* Get editor options for question response text area.
* @param object $context the context the attempt belongs to.
* @return array options for the editor.
*/
protected function get_editor_options($context) {
return question_utils::get_editor_options($context);
}
/**
* Get the options required to configure the filepicker for one of the editor
* toolbar buttons.
* @deprecated since 3.5
* @param mixed $acceptedtypes array of types of '*'.
* @param int $draftitemid the draft area item id.
* @param object $context the context.
* @return object the required options.
*/
protected function specific_filepicker_options($acceptedtypes, $draftitemid, $context) {
debugging('qtype_aitext_format_editorfilepicker_renderer::specific_filepicker_options() is deprecated, ' .
'use question_utils::specific_filepicker_options() instead.', DEBUG_DEVELOPER);
$filepickeroptions = new stdClass();
$filepickeroptions->accepted_types = $acceptedtypes;
$filepickeroptions->return_types = FILE_INTERNAL | FILE_EXTERNAL;
$filepickeroptions->context = $context;
$filepickeroptions->env = 'filepicker';
$options = initialise_filepicker($filepickeroptions);
$options->context = $context;
$options->client_id = uniqid();
$options->env = 'editor';
$options->itemid = $draftitemid;
return $options;
}
/**
* Probably redunant with the removal of file submission as a response
* @todo remove calls to this then remove this
*
* @param object $context the context the attempt belongs to.
* @param int $draftitemid draft item id.
* @return array filepicker options for the editor.
*/
protected function get_filepicker_options($context, $draftitemid) {
return question_utils::get_filepicker_options($context, $draftitemid);
}
/**
* Redundant with the removal of the file submission option
* @todo remove calls and this function
*
* @param string $inputname
* @param int $draftitemid
* @return string
*/
protected function filepicker_html($inputname, $draftitemid) {
$nonjspickerurl = new moodle_url('/repository/draftfiles_manager.php', [
'action' => 'browse',
'env' => 'editor',
'itemid' => $draftitemid,
'subdirs' => false,
'maxfiles' => -1,
'sesskey' => sesskey(),
]);
return html_writer::empty_tag('input', ['type' => 'hidden',
'name' => $inputname . ':itemid', 'value' => $draftitemid]) .
html_writer::tag('noscript', html_writer::tag('div',
html_writer::tag('object', '', ['type' => 'text/html',
'data' => $nonjspickerurl, 'height' => 160, 'width' => 600,
'style' => 'border: 1px solid #000;'])));
}
}
/**
* For aitexts with a plain text input box but with a proportional font
*
* @copyright 2024 Marcus Green
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_aitext_format_plain_renderer extends qtype_aitext_format_renderer_base {
/**
* Where the student keys in the response
*
* @param string $response
* @param mixed $lines
* @param mixed $attributes
* @return string
*/
protected function textarea($response, $lines, $attributes) {
$attributes['class'] = $this->class_name() . ' qtype_aitext_response form-control';
$attributes['rows'] = $lines;
$attributes['cols'] = 60;
return html_writer::tag('textarea', s($response), $attributes);
}
/**
* Specific class name to add to the input element.
*
* @return string
*/
protected function class_name() {
return 'qtype_aitext_plain';
}
/**
* Read only version of response (typically after submission)
* @param string $name
* @param question_attempt $qa
* @param question_attempt_step $step
* @param int $lines
* @param object $context
* @return string
* @throws coding_exception
*/
public function response_area_read_only($name, $qa, $step, $lines, $context) {
$id = $qa->get_qt_field_name($name) . '_id';
$responselabel = $this->displayoptions->add_question_identifier_to_label(get_string('answertext', 'qtype_aitext'));
$output = html_writer::tag('label', $responselabel, ['class' => 'sr-only', 'for' => $id]);
$output .= $this->textarea($step->get_qt_var($name), $lines, ['id' => $id, 'readonly' => 'readonly']);
return $output;
}
/**
* Text area for response to be keyed in
*
* @param string $name
* @param question_attempt $qa
* @param question_attempt_step $step
* @param int $lines
* @param object $context
* @return string
* @throws coding_exception
*/
public function response_area_input($name, $qa, $step, $lines, $context) {
$inputname = $qa->get_qt_field_name($name);
$id = $inputname . '_id';
$responselabel = $this->displayoptions->add_question_identifier_to_label(get_string('answertext', 'qtype_aitext'));
$output = html_writer::tag('label', $responselabel, ['class' => 'sr-only', 'for' => $id]);
$output .= $this->textarea($step->get_qt_var($name), $lines, ['name' => $inputname, 'id' => $id]);
$output .= html_writer::empty_tag('input', ['type' => 'hidden', 'name' => $inputname . 'format', 'value' => FORMAT_PLAIN]);
return $output;
}
}
/**
* An aitext format renderer for aitexts for plain input
*
* With an input box with a monospaced font. You might use this, for example, for a
* question where the students should type computer code.
*
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_aitext_format_monospaced_renderer extends qtype_aitext_format_plain_renderer {
/**
* Specific class name to add to the input element.
*
* @return string
*/
protected function class_name() {
return 'qtype_aitext_monospaced';
}
}