Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-38714 Lesson module: add setType for hidden and text inputs

  • Loading branch information...
commit 747d5b1cf6bb96e44ee259d02b1670bba6297dcc 1 parent cf5a329
rwijaya rwijaya authored
5 mod/lesson/locallib.php
@@ -722,6 +722,7 @@ public function custom_definition() {}
722 722
723 723 if ($this->_customdata['edit'] === true) {
724 724 $mform->addElement('hidden', 'edit', 1);
  725 + $mform->setType('edit', PARAM_BOOL);
725 726 $this->add_action_buttons(get_string('cancel'), get_string('savepage', 'lesson'));
726 727 } else if ($this->qtype === 'questiontype') {
727 728 $this->add_action_buttons(get_string('cancel'), get_string('addaquestionpage', 'lesson'));
@@ -761,10 +762,14 @@ public function custom_definition() {}
761 762 if ($label === null) {
762 763 $label = get_string("score", "lesson");
763 764 }
  765 + $elname = $name;
764 766 if (is_int($name)) {
765 767 $name = "score[$name]";
  768 + $elname = 'score';
766 769 }
767 770 $this->_form->addElement('text', $name, $label, array('size'=>5));
  771 + // Temporary fix until MDL-38885 gets integrated.
  772 + $this->_form->setType($elname, PARAM_INT);
768 773 if ($value !== null) {
769 774 $this->_form->setDefault($name, $value);
770 775 }
5 mod/lesson/pagetypes/matching.php
@@ -477,6 +477,8 @@ public function custom_definition() {
477 477 $label = get_string('matchesanswer','lesson');
478 478 $count = $i;
479 479 $this->_form->addElement('text', 'response_editor['.$count.']', $label, array('size'=>'50'));
  480 + // Temporary fix until MDL-38885 gets integrated.
  481 + $this->_form->setType('response_editor', PARAM_TEXT);
480 482 $this->_form->setDefault('response_editor['.$count.']', '');
481 483 if ($required) {
482 484 $this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client');
@@ -525,7 +527,8 @@ public function definition() {
525 527 if ($hasattempt) {
526 528 $responseid = 'response_'.$answer->id;
527 529 $mform->addElement('hidden', 'response['.$answer->id.']', htmlspecialchars(trim($answers[$useranswers[$i]]->response)));
528   - $mform->setType('response['.$answer->id.']', PARAM_TEXT);
  530 + // Temporary fixed until MDL-38885 gets integrated
  531 + $mform->setType('response', PARAM_TEXT);
529 532 }
530 533 $mform->addElement('select', $responseid, format_text($answer->answer,$answer->answerformat,$options), $responseoptions, $disabled);
531 534 $mform->setType($responseid, PARAM_TEXT);
3  mod/lesson/pagetypes/multichoice.php
@@ -553,7 +553,8 @@ public function definition() {
553 553 if ($hasattempt && in_array($answer->id, $useranswers)) {
554 554 $answerid = 'answer_'.$answer->id;
555 555 $mform->addElement('hidden', 'answer['.$answer->id.']', $answer->answer);
556   - $mform->setType('answer['.$answer->id.']', PARAM_TEXT);
  556 + // Temporary fix until MDL-38885 gets integrated.
  557 + $mform->setType('answer', PARAM_TEXT);
557 558 $mform->setDefault($answerid, true);
558 559 $mform->setDefault('answer['.$answer->id.']', true);
559 560 }

0 comments on commit 747d5b1

Please sign in to comment.
Something went wrong with that request. Please try again.