From: danmarsden Date: Wed, 27 Aug 2008 22:02:16 +0000 (+0000) Subject: MDL-10767 - set values of checkboxes correctly X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ea38a6b98a25628604495bdda145c9326efdece6;p=moodle.git MDL-10767 - set values of checkboxes correctly --- diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index 229427588a..669cb1bd6e 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -252,6 +252,22 @@ class mod_scorm_mod_form extends moodleform_mod { return $errors; } - + //need to translate the "options" field. + function set_data($default_values) { + if (is_object($default_values)) { + if (!empty($default_values->options)) { + $options = explode(',', $default_values->options); + foreach ($options as $option) { + $opt = explode('=', $option); + if (isset($opt[1])) { + $default_values->$opt[0] = $opt[1]; + } + } + } + $default_values = (array)$default_values; + } + $this->data_preprocessing($default_values); + parent::set_data($default_values); //never slashed for moodleform_mod + } } ?> \ No newline at end of file