Permalink
Browse files

MDL-39369: Lesson module: fix setType() properly

  • Loading branch information...
Rossiani Wijaya
Rossiani Wijaya committed May 13, 2013
1 parent 1430866 commit 51c72ecaa531110870844d5504749321f38f1e0e
Showing with 4 additions and 8 deletions.
  1. +2 −4 mod/lesson/locallib.php
  2. +1 −2 mod/lesson/pagetypes/matching.php
  3. +1 −2 mod/lesson/pagetypes/multichoice.php
View
@@ -762,14 +762,12 @@ public function custom_definition() {}
if ($label === null) {
$label = get_string("score", "lesson");
}
- $elname = $name;
+
if (is_int($name)) {
$name = "score[$name]";
- $elname = 'score';
}
$this->_form->addElement('text', $name, $label, array('size'=>5));
- // Temporary fix until MDL-38885 gets integrated.
- $this->_form->setType($elname, PARAM_INT);
+ $this->_form->setType($name, PARAM_INT);
if ($value !== null) {
$this->_form->setDefault($name, $value);
}
@@ -477,8 +477,7 @@ public function custom_definition() {
$label = get_string('matchesanswer','lesson');
$count = $i;
$this->_form->addElement('text', 'response_editor['.$count.']', $label, array('size'=>'50'));
- // Temporary fix until MDL-38885 gets integrated.
- $this->_form->setType('response_editor', PARAM_TEXT);
+ $this->_form->setType('response_editor['.$count.']', PARAM_TEXT);
$this->_form->setDefault('response_editor['.$count.']', '');
if ($required) {
$this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client');
@@ -553,8 +553,7 @@ public function definition() {
if ($hasattempt && in_array($answer->id, $useranswers)) {
$answerid = 'answer_'.$answer->id;
$mform->addElement('hidden', 'answer['.$answer->id.']', $answer->answer);
- // Temporary fix until MDL-38885 gets integrated.
- $mform->setType('answer', PARAM_TEXT);
+ $mform->setType('answer['.$answer->id.']', PARAM_TEXT);
$mform->setDefault($answerid, true);
$mform->setDefault('answer['.$answer->id.']', true);
}

0 comments on commit 51c72ec

Please sign in to comment.