MDL-62358 Question: Improve number function

Support all 'question numbers' that might be needed
This commit is contained in:
Huong Nguyen
2018-06-14 19:43:55 +07:00
parent 9e7c397889
commit 628b4c86af
3 changed files with 41 additions and 6 deletions
+6 -6
View File
@@ -156,15 +156,15 @@ class core_question_renderer extends plugin_renderer_base {
* @return HTML fragment.
*/
protected function number($number) {
if (trim($number) === '') {
return '';
}
$numbertext = '';
if (is_numeric($number)) {
if (trim($number) === 'i') {
$numbertext = get_string('information', 'question');
} else {
$numbertext = get_string('questionx', 'question',
html_writer::tag('span', $number, array('class' => 'qno')));
} else if ($number == 'i') {
$numbertext = get_string('information', 'question');
}
if (!$numbertext) {
return '';
}
return html_writer::tag('h3', $numbertext, array('class' => 'no'));
}