Example #1
0
 function onQuickFormEvent($event, $arg, &$caller)
 {
     if ('updateValue' == $event) {
         // we need to call setValue(), 'cause the default/constant value
         // may be in fact a timestamp, not an array
         return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
     } else {
         return parent::onQuickFormEvent($event, $arg, $caller);
     }
 }
 function onQuickFormEvent($event, $arg, &$caller)
 {
     if ('updateValue' == $event) {
         // we need to call setValue() so that the secondary option
         // matches the main option
         return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
     } else {
         $ret = parent::onQuickFormEvent($event, $arg, $caller);
         // add onreset handler to form to properly reset hierselect (see bug #2970)
         if ('addElement' == $event) {
             $onReset = $caller->getAttribute('onreset');
             if (strlen($onReset)) {
                 if (strpos($onReset, '_hs_setupOnReset')) {
                     $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset)));
                 } else {
                     $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
                 }
             } else {
                 $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
             }
         }
         return $ret;
     }
 }
Example #3
0
 function onQuickFormEvent($event, $arg, &$caller)
 {
     if ('updateValue' == $event) {
         return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
     } else {
         return parent::onQuickFormEvent($event, $arg, $caller);
     }
 }
Example #4
0
 function onQuickFormEvent($event, $arg, &$caller)
 {
     if ('updateValue' == $event) {
         // we need to call setValue() so that the secondary option
         // matches the main option
         return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
     } else {
         return parent::onQuickFormEvent($event, $arg, $caller);
     }
 }
Example #5
0
 /**
  * Called by HTML_QuickForm whenever form event is made on this element
  *
  * If this function is overridden and parent is not called the element must be responsible for
  * storing the MoodleQuickForm object, see {@link MoodleQuickForm_group::setMoodleForm()}
  *
  * @param     string $event Name of event
  * @param     mixed $arg event arguments
  * @param     mixed $caller calling object
  */
 public function onQuickFormEvent($event, $arg, &$caller)
 {
     $this->setMoodleForm($caller);
     return parent::onQuickFormEvent($event, $arg, $caller);
 }