function onQuickFormEvent($event, $arg, &$caller) { global $OUTPUT; switch ($event) { case 'addElement': $this->_contextid = $arg[3]['contextid']; $this->_filearea = $arg[3]['filearea']; $this->_fileareaitemid = $arg[3]['itemid']; $this->_format = $arg[4]; break; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object &$caller calling object * @since 1.0 * @access public * @return void * @throws */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'updateValue': // do NOT use submitted values for static elements $value = $this->_findValue($caller->_constantValues); if (null === $value) { $value = $this->_findValue($caller->_defaultValues); } if (null !== $value) { $this->setValue($value); } break; default: parent::onQuickFormEvent($event, $arg, $caller); } return true; }
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); } }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object &$caller calling object * @since 1.0 * @access public * @return void * @throws */ function onQuickFormEvent($event, $arg, &$caller) { // do not use submit values for button-type elements $type = $this->getType(); if ('updateValue' != $event || 'submit' != $type && 'reset' != $type && 'image' != $type && 'button' != $type) { parent::onQuickFormEvent($event, $arg, $caller); } else { $value = $this->_findValue($caller->_constantValues); if (null === $value) { $value = $this->_findValue($caller->_defaultValues); } if (null !== $value) { $this->setValue($value); } } return true; }
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; } }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @return bool */ function onQuickFormEvent($event, $arg, &$caller) { if ('updateValue' == $event) { $value = $this->_findValue($caller->_constantValues); if (null === $value) { $value = $this->_findValue($caller->_submitValues); // Fix for bug #4465 & #5269 // XXX: should we push this to element::onQuickFormEvent()? if (null === $value && (!$caller->isSubmitted() || !$this->getMultiple())) { $value = $this->_findValue($caller->_defaultValues); } } if (null !== $value) { $this->setValue($value); } return true; } else { return parent::onQuickFormEvent($event, $arg, $caller); } }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @return bool */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $caller->setType($arg[0], PARAM_INT); break; } return parent::onQuickFormEvent($event, $arg, $caller); }
function onQuickFormEvent($event, $arg, &$caller) { if ('updateValue' != $event) { return parent::onQuickFormEvent($event, $arg, $caller); } else { $value = $this->_findValue($caller->_constantValues); if (null === $value) { $value = $this->_findValue($caller->_defaultValues); } if (null !== $value) { $this->setValue($value); } } return true; }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object &$caller calling object * @since 1.0 * @access public * @return void */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'updateValue': $this->_createElementsIfNotExist(); foreach (array_keys($this->_elements) as $key) { if ($this->_appendName) { $elementName = $this->_elements[$key]->getName(); if (is_null($elementName)) { $this->_elements[$key]->setName($this->getName()); } elseif ('' === $elementName) { $this->_elements[$key]->setName($this->getName() . '[' . $key . ']'); } else { $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']'); } } $this->_elements[$key]->onQuickFormEvent('updateValue', $arg, $caller); if ($this->_appendName) { $this->_elements[$key]->setName($elementName); } } break; default: parent::onQuickFormEvent($event, $arg, $caller); } return true; }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @return bool */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $caller->setType($arg[0] . '[format]', PARAM_ALPHANUM); $caller->setType($arg[0] . '[itemid]', PARAM_INT); break; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string Name of event * @param mixed event arguments * @param object calling object * @since 1.0 * @access public * @return bool */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'updateValue': if ($caller->getAttribute('method') == 'get') { return PEAR::raiseError('Cannot add a file upload field to a GET method form'); } HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller); $caller->updateAttributes(array('enctype' => 'multipart/form-data')); $caller->setMaxFileSize(); break; case 'addElement': $this->onQuickFormEvent('createElement', $arg, $caller); return $this->onQuickFormEvent('updateValue', null, $caller); break; case 'createElement': $className = get_class($this); $this->{$className}($arg[0], $arg[1], $arg[2]); break; } return true; }
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); } }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string Name of event * @param mixed event arguments * @param object calling object * @access public * @return bool true */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'updateValue': foreach (array_keys($this->_rows) as $key) { foreach (array_keys($this->_rows[$key]) as $key2) { $this->_rows[$key][$key2]->onQuickFormEvent('updateValue', null, $caller); } } break; default: parent::onQuickFormEvent($event, $arg, $caller); } return true; }
function onQuickFormEvent($event, $arg, &$caller) { if ('updateValue' == $event) { return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller); } else { return parent::onQuickFormEvent($event, $arg, $caller); } }