本文整理汇总了PHP中HTML_QuickForm_input::onQuickFormEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm_input::onQuickFormEvent方法的具体用法?PHP HTML_QuickForm_input::onQuickFormEvent怎么用?PHP HTML_QuickForm_input::onQuickFormEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm_input
的用法示例。
在下文中一共展示了HTML_QuickForm_input::onQuickFormEvent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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':
// constant values override both default and submitted ones
// default values are overriden by submitted
$value = $this->_findValue($caller->_constantValues);
if (null === $value) {
// if no boxes were checked, then there is no value in the array
// yet we don't want to display default value in this case
if ($caller->isSubmitted()) {
$value = $this->_findValue($caller->_submitValues);
} else {
$value = $this->_findValue($caller->_defaultValues);
}
}
if (null !== $value || $caller->isSubmitted()) {
$this->setChecked($value);
}
break;
case 'setGroupValue':
$this->setChecked($arg);
break;
default:
parent::onQuickFormEvent($event, $arg, $caller);
}
return true;
}
示例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
*/
function onQuickFormEvent($event, $arg, &$caller)
{
switch ($event) {
case 'updateValue':
// constant values override both default and submitted ones
// default values are overriden by submitted
$value = $this->_findValue($caller->_constantValues);
if (null === $value) {
$value = $this->_findValue($caller->_submitValues);
if (null === $value) {
$value = $this->_findValue($caller->_defaultValues);
}
}
if (!is_null($value) && $value == $this->getValue()) {
$this->setChecked(true);
} else {
$this->setChecked(false);
}
break;
case 'setGroupValue':
if ($arg == $this->getValue()) {
$this->setChecked(true);
} else {
$this->setChecked(false);
}
break;
default:
parent::onQuickFormEvent($event, $arg, $caller);
}
return true;
}
示例3: onQuickFormEvent
/**
* Called by HTML_QuickForm whenever form event is made on this element.
* Adds necessary rules to the element and checks that coorenct instance of gradingform_instance
* is passed in attributes
*
* @param string $event Name of event
* @param mixed $arg event arguments
* @param object $caller calling object
* @return bool
* @throws moodle_exception
*/
public function onQuickFormEvent($event, $arg, &$caller)
{
if ($event == 'createElement') {
$attributes = $arg[2];
if (!is_array($attributes) || !array_key_exists('gradinginstance', $attributes) || !$attributes['gradinginstance'] instanceof gradingform_instance) {
throw new moodle_exception('exc_gradingformelement', 'grading');
}
}
$name = $this->getName();
if ($name && $caller->elementExists($name)) {
$caller->addRule($name, $this->get_gradinginstance()->default_validation_error_message(), 'gradingvalidated', $this->gradingattributes);
}
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
*/
function onQuickFormEvent($event, $arg, &$caller)
{
switch ($event) {
case 'updateValue':
// constant values override both default and submitted ones
$value = $this->_findValue($caller->_constantValues);
if (null === $value) {
// we should retrieve value from submitted values when form is submitted,
// else set value from defaults values
if ($caller->isSubmitted()) {
$value = $this->_findValue($caller->_submitValues);
} else {
$value = $this->_findValue($caller->_defaultValues);
}
}
if (!is_null($value) && $value == $this->getValue()) {
$this->setChecked(true);
} else {
$this->setChecked(false);
}
break;
case 'setGroupValue':
if ($arg == $this->getValue()) {
$this->setChecked(true);
} else {
$this->setChecked(false);
}
break;
default:
parent::onQuickFormEvent($event, $arg, $caller);
}
return true;
}
示例5: onQuickFormEvent
function onQuickFormEvent($event, $arg, &$caller)
{
if ($event == 'updateValue' && is_callable(array($caller, 'applyFilter'))) {
$caller->applyFilter($this->getName(), array($this, 'reg2time'));
}
return parent::onQuickFormEvent($event, $arg, $caller);
}