MDL-53140 question: Support localised floats when previewing a question

This commit is contained in:
Shamim Rezaie 2019-02-05 03:39:37 +11:00
parent bb4079498f
commit 197e074eba
2 changed files with 3 additions and 4 deletions

View File

@ -796,7 +796,7 @@ function question_preview_url($questionid, $preferredbehaviour = null,
}
if (!is_null($maxmark)) {
$params['maxmark'] = $maxmark;
$params['maxmark'] = format_float($maxmark, strlen($maxmark), true, true);
}
if (!is_null($displayoptions)) {

View File

@ -52,9 +52,8 @@ class preview_options_form extends moodleform {
get_string('howquestionsbehave', 'question'), $behaviours);
$mform->addHelpButton('behaviour', 'howquestionsbehave', 'question');
$mform->addElement('text', 'maxmark', get_string('markedoutof', 'question'),
$mform->addElement('float', 'maxmark', get_string('markedoutof', 'question'),
array('size' => '5'));
$mform->setType('maxmark', PARAM_FLOAT);
if ($this->_customdata['maxvariant'] > 1) {
$variants = range(1, $this->_customdata['maxvariant']);
@ -152,7 +151,7 @@ class question_preview_options extends question_display_options {
protected function get_field_types() {
return array(
'behaviour' => PARAM_ALPHA,
'maxmark' => PARAM_FLOAT,
'maxmark' => PARAM_LOCALISEDFLOAT,
'variant' => PARAM_INT,
'correctness' => PARAM_BOOL,
'marks' => PARAM_INT,