本文整理匯總了PHP中HTML_QuickForm::insertElementBefore方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTML_QuickForm::insertElementBefore方法的具體用法?PHP HTML_QuickForm::insertElementBefore怎麽用?PHP HTML_QuickForm::insertElementBefore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::insertElementBefore方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}
}