本文整理匯總了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);
}