本文整理汇总了PHP中FieldList::setGroupFieldsTable方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::setGroupFieldsTable方法的具体用法?PHP FieldList::setGroupFieldsTable怎么用?PHP FieldList::setGroupFieldsTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::setGroupFieldsTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FieldList
/**
* @param string $id_folder folder destination of fields
* @param array $arr_fields an array with fields to attach to folder
* any element of folder is an array:
* key => array( 'fvalue', 'mandatory' )
* - key is the field name in current language
* - fvalue is the value of the field
* - mandatory is TRUE if this field is mandatory
*/
function _add_custom_fields($id_folder, $arr_fields)
{
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$fl = new FieldList();
$fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
$fl->setFieldEntryTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDENTRYTABLE);
$arr_all_fields = $fl->getFlatAllFields(false, false, $this->default_lang);
// remove all fields
foreach ($arr_all_fields as $id_field => $ftranslation) {
$fl->removeFieldFromGroup($id_field, $id_folder);
}
$arr_all_fields_translation = array_flip($arr_all_fields);
$arr_fields_value = array();
// add selected fields
foreach ($arr_fields as $field_translation => $field_data) {
if (isset($arr_all_fields_translation[$field_translation])) {
$field_id = $arr_all_fields_translation[$field_translation];
$fl->addFieldToGroup($field_id, $id_folder, $field_data['mandatory']);
$arr_fields_value[$field_id] = $field_data['fvalue'];
} else {
die("Field non trovato: {$field_translation}");
}
}
$fl->storeDirectFieldsForUser($id_folder, $arr_fields_value, FALSE);
}
示例2: array
function loadFolderField2()
{
if (isset($_POST[$this->id]['field_set'])) {
$arr_fields = $_POST[$this->id]['field_set'];
} else {
$arr_fields = array();
}
$id_folder = $_POST[$this->id]['id_folder'];
$id_folder_desc = $_POST[$this->id]['id_folder_desc'];
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$fl = new FieldList();
$fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
$arr_all_fields = $fl->getAllFields();
require_once _base_ . '/lib/lib.form.php';
$form = new Form();
$tree .= $form->openElementSpace();
$tree .= $this->printState();
$tree .= $form->getHidden($this->id . '_id_folder', $this->id . '[id_folder]', $id_folder);
$tree .= $form->getHidden($this->id . '_id_folder_desc', $this->id . '[id_folder_desc]', $id_folder_desc);
foreach ($arr_fields as $id_field => $status) {
$tree .= $form->getHidden($this->id . '_' . $id_field, $this->id . '[field_set][' . $id_field . ']', '');
}
// data from previous selected fields
$arr_fields_prev = $fl->getFieldsFromIdst(array($id_folder), FALSE);
foreach ($arr_fields as $id_field) {
if (isset($arr_fields_prev[$id_field]) && $arr_fields_prev[$id_field][FIELD_INFO_MANDATORY] == 'true') {
$checked = TRUE;
} else {
$checked = FALSE;
}
$field = $arr_all_fields[$id_field];
$tree .= $form->getCheckbox($field[FIELD_INFO_TRANSLATION], $this->id . '_' . $field[FIELD_INFO_ID], $this->id . '[field_mandatory][' . $field[FIELD_INFO_ID] . ']', 'true', $checked);
}
$tree .= $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_formfield' . $this->id, $this->id . '[save_formfield]', $this->lang->def('_SAVE')) . $form->getButton($this->_getCancelId(), $this->_getCancelId(), $this->lang->def('_UNDO')) . $form->closeButtonSpace();
return $tree;
}