本文整理汇总了PHP中HTML_QuickForm_element::onQuickFormEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm_element::onQuickFormEvent方法的具体用法?PHP HTML_QuickForm_element::onQuickFormEvent怎么用?PHP HTML_QuickForm_element::onQuickFormEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm_element
的用法示例。
在下文中一共展示了HTML_QuickForm_element::onQuickFormEvent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onQuickFormEvent
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);
}
示例2: onQuickFormEvent
/**
* 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;
}
示例3: onQuickFormEvent
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);
}
}
示例4: onQuickFormEvent
/**
* 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;
}
示例5: onQuickFormEvent
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;
}
}
示例6: onQuickFormEvent
/**
* 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);
}
}
示例7: onQuickFormEvent
/**
* 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);
}
示例8: onQuickFormEvent
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;
}
示例9: onQuickFormEvent
/**
* 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;
}
示例10: onQuickFormEvent
/**
* 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);
}
示例11: onQuickFormEvent
/**
* 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;
}
示例12: onQuickFormEvent
/**
* 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;
}