[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/quiz/yui/src/modform/js/ -> modform.js (source)

   1  /**
   2   * The modform class has all the JavaScript specific to mod/quiz/mod_form.php.
   3   *
   4   * @module moodle-mod_quiz-modform
   5   */
   6  
   7  var MODFORM = function() {
   8      MODFORM.superclass.constructor.apply(this, arguments);
   9  };
  10  
  11  /**
  12   * The coursebase class to provide shared functionality to Modules within
  13   * Moodle.
  14   *
  15   * @class M.course.coursebase
  16   * @constructor
  17   */
  18  Y.extend(MODFORM, Y.Base, {
  19      repaginateCheckbox: null,
  20      qppSelect: null,
  21      qppInitialValue: 0,
  22  
  23      initializer: function () {
  24          this.repaginateCheckbox = Y.one('#id_repaginatenow');
  25          if (!this.repaginateCheckbox) {
  26              // The checkbox only appears when editing an existing quiz.
  27              return;
  28          }
  29  
  30          this.qppSelect = Y.one('#id_questionsperpage');
  31          this.qppInitialValue = this.qppSelect.get('value');
  32          this.qppSelect.on('change', this.qppChanged, this);
  33          Y.one('#id_shufflequestions').on('change', this.qppChanged, this);
  34      },
  35  
  36      qppChanged: function() {
  37          Y.later(50, this, function() {
  38              if (!this.repaginateCheckbox.get('disabled')) {
  39                  this.repaginateCheckbox.set('checked', this.qppSelect.get('value') !== this.qppInitialValue);
  40              }
  41          });
  42      }
  43  
  44  });
  45  
  46  // Ensure that M.course exists and that coursebase is initialised correctly
  47  M.mod_quiz = M.mod_quiz || {};
  48  M.mod_quiz.modform = M.mod_quiz.modform || new MODFORM();
  49  M.mod_quiz.modform.init = function() {
  50      return new MODFORM();
  51  };


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1