本文整理汇总了PHP中HTML_QuickForm::elementExists方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::elementExists方法的具体用法?PHP HTML_QuickForm::elementExists怎么用?PHP HTML_QuickForm::elementExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::elementExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _validate
private function _validate()
{
if ($this->action == TIP_FORM_ACTION_DELETE || $this->action == TIP_FORM_ACTION_CUSTOM) {
// Special case: GET driven form
$this->_form->freeze();
return TIP::getGet('process', 'int') == 1;
}
// Add element and form rules
isset($this->validator) && $this->_form->addFormRule($this->validator);
foreach (array_keys($this->fields) as $id) {
if ($this->_form->elementExists($id)) {
$this->_addGuessedRules($id);
$this->_addCustomRules($id);
}
}
$stage_id = $this->id . '.stage';
$last_stage = HTTP_Session2::get($stage_id);
if (!$this->_form->isSubmitted() || isset($last_stage) && $last_stage < $this->_stage) {
HTTP_Session2::set($stage_id, $this->_stage);
$valid = false;
} elseif (is_null($last_stage)) {
// No last stage defined
TIP::notifyError('double');
$valid = null;
} else {
// Validation
$this->_form->applyFilter('__ALL__', array('TIP', 'extendedTrim'));
$valid = $this->_form->validate();
}
// Perform uploads (if needed)
if (is_callable(array('HTML_QuickForm_attachment', 'doUploads'))) {
HTML_QuickForm_attachment::doUploads($this->_form);
}
return $valid;
}
示例2: addTagsToForm
/**
* Adds tag checkboxes to form passed as first parameter
* 2nd parameter is the actual name of the fields used to add tags
* @param HTML_QuickForm
* @param string default _tags
*/
public function addTagsToForm(HTML_QuickForm $form, $fieldname, DB_DataObject $obj)
{
$tags = DB_DataObject::factory('tag');
$tags->archived = 0;
// @todo add this field to tags table
$tag_record = DB_DataObject::factory('tag_record');
$tags->joinAdd($tag_record);
$tags->whereAdd("tag_record.tagged_table = '" . $obj->__table . "'");
$tags->selectAdd();
$tags->selectAdd('tag.*');
$tags->groupBy('tag.strip');
if ($tags->find()) {
while ($tags->fetch()) {
$taglist[$tags->id] = $tags->strip;
}
foreach ($taglist as $id => $strip) {
$arr[] = MyQuickForm::createElement('checkbox', $fieldname . '[' . $id . ']', '', $strip);
$arr2[] = MyQuickForm::createElement('checkbox', 'exc_' . $fieldname . '[' . $id . ']', '', $strip);
}
$grp = MyQuickForm::createElement('group', $fieldname, __('Including Tags'), $arr, null, false);
$grp2 = MyQuickForm::createElement('group', 'exc_' . $fieldname, __('Excluding Tags'), $arr2, null, false);
if ($form->elementExists('__submit__')) {
$form->insertElementBefore($grp, '__submit__');
$form->insertElementBefore($grp2, '__submit__');
} else {
$form->addElement($grp);
$form->addElement($grp2);
}
}
}