本文整理汇总了PHP中FieldList::removeFieldFromGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::removeFieldFromGroup方法的具体用法?PHP FieldList::removeFieldFromGroup怎么用?PHP FieldList::removeFieldFromGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::removeFieldFromGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FieldList
/**
* Assign fields mandatory and user for group
**/
function loadAssignField2($groupid)
{
$arr_fields = $_POST[DIRECTORY_ID][DIRECTORY_OP_ADDFIELD];
$idst_group = $_POST[DIRECTORY_ID]['idst_group'];
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
if (isset($_POST[DIRECTORY_ID]['save_assignfield2'])) {
$fl = new FieldList();
$arr_fields_mandatory = $_POST[DIRECTORY_ID]['field_mandatory'];
$arr_fields_useraccess = $_POST[DIRECTORY_ID]['field_useraccess'];
foreach ($arr_fields as $id_filed => $status) {
switch ($status) {
case GROUP_FIELD_NO:
$fl->removeFieldFromGroup($id_filed, $idst_group);
break;
case GROUP_FIELD_NORMAL:
$fl->addFieldToGroup($id_filed, $idst_group, isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
break;
}
}
Util::jump_to('index.php?modname=directory&op=listgroup');
} elseif (isset($_POST[DIRECTORY_ID]['cancel_assignfield'])) {
Util::jump_to('index.php?modname=directory&op=listgroup');
}
$fl = new FieldList();
$arr_all_fields = $fl->getAllFields();
require_once _base_ . '/lib/lib.form.php';
$form = new Form();
$GLOBALS['page']->setWorkingZone('content');
$GLOBALS['page']->add(getTitleArea($this->lang->def('_GROUPS') . ': ' . $groupid, 'directory_group'));
$GLOBALS['page']->add('<div class="std_block">');
$GLOBALS['page']->add($form->openForm('directoryassignfieldgroupmandatory', 'index.php?modname=directory&op=assignfieldmandatory'));
$GLOBALS['page']->add($form->openElementSpace());
// print custom fields status
$arr_fields_normal = $fl->getFieldsFromIdst(array($idst_group));
$GLOBALS['page']->add($form->getHidden(DIRECTORY_ID . '_idst_group', DIRECTORY_ID . '[idst_group]', $idst_group));
foreach ($arr_fields as $id_filed => $status) {
$GLOBALS['page']->add($form->getHidden(DIRECTORY_ID . '_' . $id_filed, DIRECTORY_ID . '[' . DIRECTORY_OP_ADDFIELD . '][' . $id_filed . ']', $status));
}
$GLOBALS['page']->add($form->openFormLine() . '<div class="label_effect"> </div>' . '<div class="label_head">' . $this->lang->def('_MANDATORY') . '</div>' . '<div class="label_head">' . $this->lang->def('_DIRECTORY_GROUP_FIELD_WRITE') . '</div>' . $form->closeFormLine());
// checkbox for mandatory and useraccess
foreach ($arr_fields as $id_filed => $status) {
if ($status == GROUP_FIELD_NORMAL) {
$GLOBALS['page']->add($form->openFormLine() . '<div class="label_effect">' . $arr_all_fields[$id_filed][FIELD_INFO_TRANSLATION] . '</div>' . '<input class="label_head" type="checkbox"' . ' id="' . DIRECTORY_ID . '_' . $id_filed . '_mandatory"' . ' name="' . DIRECTORY_ID . '[field_mandatory][' . $id_filed . ']"' . ' value="true"');
if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_MANDATORY] == 'true') {
$GLOBALS['page']->add(' checked="checked"');
}
$GLOBALS['page']->add(' />');
$GLOBALS['page']->add($form->getLabel(DIRECTORY_ID . '_' . $id_filed . '_mandatory', $this->lang->def('_MANDATORY'), 'label_bold access-only'));
// checkbox for useraccess
$GLOBALS['page']->add('<input class="label_head" type="checkbox"' . ' id="' . DIRECTORY_ID . '_' . $id_filed . '_useraccess"' . ' name="' . DIRECTORY_ID . '[field_useraccess][' . $id_filed . ']"' . ' value="readwrite"');
if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_USERACCESS] == 'readwrite') {
$GLOBALS['page']->add(' checked="checked"');
}
$GLOBALS['page']->add(' />');
$GLOBALS['page']->add($form->getLabel(DIRECTORY_ID . '_' . $id_filed . '_useraccess', $this->lang->def('_DIRECTORY_GROUP_FIELD_WRITE'), 'label_bold access-only'));
$GLOBALS['page']->add($form->closeFormLine());
}
}
$GLOBALS['page']->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_assignfield2' . DIRECTORY_ID, DIRECTORY_ID . '[save_assignfield2]', $this->lang->def('_SAVE')) . $form->getButton('cancel_assignfield' . DIRECTORY_ID, DIRECTORY_ID . '[cancel_assignfield]', $this->lang->def('_UNDO')) . $form->closeButtonSpace());
}
示例2: assignfields_action
public function assignfields_action()
{
//check permissions
if (!$this->permissions['mod_org']) {
Util::jump_to('index.php?r=' . $this->link . '/show');
}
require_once _adm_ . '/lib/lib.field.php';
$id_org = Get::req('idst_group', DOTY_INT, 0);
$fields_use = Get::req('fields_use', DOTY_MIXED, array());
$fields_inherit = Get::req('fields_inherit', DOTY_MIXED, array());
$fields_mandatory = Get::req('fields_mandatory', DOTY_MIXED, array());
$fields_invisible = Get::req('fields_invisible', DOTY_MIXED, array());
$fields_userinherit = Get::req('fields_userinherit', DOTY_MIXED, array());
$fl = new FieldList();
$acl_man = Docebo::user()->getAclManager();
$count = 0;
$all_fields = $fl->getAllFields();
foreach ($all_fields as $field) {
$id_field = $field[FIELD_INFO_ID];
if (isset($fields_use[$id_field])) {
$arr_idgroups = array();
if (isset($fields_inherit[$id_field])) {
//$arr_idorgs = $acl_man->getGroupGDescendants($id_org);
//$arr_idorgs[] = $id_org;
//$arr_idorgs = array_unique($arr_idorgs);
$arr_idgroups[] = $acl_man->getGroupST('oc_' . $id_org);
$arr_idgroups[] = $acl_man->getGroupST('ocd_' . $id_org);
} else {
$arr_idgroups[] = $acl_man->getGroupST('oc_' . $id_org);
$fl->removeFieldFromGroup($id_field, $acl_man->getGroupST('ocd_' . $id_org));
}
foreach ($arr_idgroups as $idst_group) {
$res = $fl->addFieldToGroup($id_field, $idst_group, isset($fields_mandatory[$id_field]) ? 'true' : 'false', isset($fields_invisible[$id_field]) ? 'readwrite' : 'readonly', isset($fields_userinherit[$id_field]) ? 1 : 0);
if ($res) {
$count++;
}
}
} else {
$res = $fl->removeFieldFromGroup($id_field, $acl_man->getGroupST('oc_' . $id_org));
$res = $fl->removeFieldFromGroup($id_field, $acl_man->getGroupST('ocd_' . $id_org));
if ($res) {
$count++;
}
}
}
$output = array('success' => true, 'total' => count($fields_use), 'done' => $count);
echo $this->json->encode($output);
}
示例3: 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);
}
示例4: extendedParsing
//.........这里部分代码省略.........
$arr_groups_filterd = $acl->getSTGroupsST($folder_idst, FILTER_FOLD);
$fl->storeFieldsForUser($folder_id, $ancestor, FALSE);
//----------------------------------------------------------
$this->refresh = TRUE;
if ($this->getSelectedFolderId() == '0') {
Util::jump_to('index.php?modname=directory&op=org_chart');
}
/*} else {
$this->op = 'renamefolder';
$GLOBALS['page']->add( getErrorUi(implode('<br/>', $filled)), 'content' );
}*/
}
} elseif ($key == 'next_formfield1') {
$this->op = 'folder_field2';
} elseif ($key == 'save_formfield') {
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
if (isset($arrayState[$this->id]['field_set'])) {
$arr_fields = $arrayState[$this->id]['field_set'];
} else {
$arr_fields = array();
}
if (isset($arrayState[$this->id]['field_mandatory'])) {
$arr_fields_mandatory = $arrayState[$this->id]['field_mandatory'];
} else {
$arr_fields_mandatory = array();
}
$fl = new FieldList();
$fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
$arr_all_fields = $fl->getAllFields();
$id_folder = $this->getSelectedFolderId();
// remove all fields
foreach ($arr_all_fields as $id_field => $field) {
$fl->removeFieldFromGroup($id_field, $id_folder);
}
// add selected fields
foreach ($arr_fields as $id_field => $dummy_val) {
$fl->addFieldToGroup($id_field, $id_folder, isset($arr_fields_mandatory[$id_field]) ? $arr_fields_mandatory[$id_field] : 'false');
}
} elseif ($key == 'next1_assignfield') {
$this->op = 'assign2_field';
} elseif ($key == 'next2_assignfield') {
$this->op = 'assign3_field';
} elseif ($key == 'save_assignfield') {
$arr_fields = $arrayState[$this->id]['field_set'];
$arr_fields_mandatory = isset($arrayState[$this->id]['field_mandatory']) ? $arrayState[$this->id]['field_mandatory'] : array();
$arr_fields_useraccess = isset($arrayState[$this->id]['field_useraccess']) ? $arrayState[$this->id]['field_useraccess'] : array();
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$fl = new FieldList();
foreach ($arr_fields as $id_filed => $status) {
switch ($status) {
case ORG_CHART_FIELD_NO:
$fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()));
$fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()));
break;
case ORG_CHART_FIELD_NORMAL:
$fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()));
$fl->addFieldToGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()), isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
break;
case ORG_CHART_FIELD_DESCEND:
$fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()));
$fl->addFieldToGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()), isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
break;
}
}
} elseif ($key == $this->_getOpFolderField()) {