protected function createDataDescription() { $result = parent::createDataDescription(); if (in_array($this->getState(), ['add', 'edit'])) { $fd = new FieldDescription('news_is_top'); $fd->setType(FieldDescription::FIELD_TYPE_BOOL); $fd->setProperty('tag', 'top'); $result->addFieldDescription($fd, DataDescription::FIELD_POSITION_AFTER, $this->getPK()); } return $result; }
protected function prepare() { parent::prepare(); if (in_array($this->getState(), array('add', 'edit'))) { $fd = new FieldDescription('questions'); $fd->setType(FieldDescription::FIELD_TYPE_TAB); $fd->setProperty('title', $this->translate('TAB_VOTE_QUESTIONS')); $this->getDataDescription()->addFieldDescription($fd); $field = new Field('questions'); $state = $this->getState(); $tab_url = ($state != 'add' ? $this->getData()->getFieldByName($this->getPK())->getRowData(0) : '') . '/question/'; $field->setData($tab_url, true); $this->getData()->addField($field); } }
/** * Create data description. * * @return DataDescription * * @note Since it is impossible to change the list of fields, the required values will be forced to reset. */ protected function createDataDescription() { $result = new DataDescription(); $field = new FieldDescription('Id'); $field->setType(FieldDescription::FIELD_TYPE_INT); $field->setProperty('key', true); $result->addFieldDescription($field); $field = new FieldDescription('Name'); $field->setType(FieldDescription::FIELD_TYPE_STRING); $result->addFieldDescription($field); $field = new FieldDescription('Segment'); $field->setType(FieldDescription::FIELD_TYPE_STRING); $result->addFieldDescription($field); $field = new FieldDescription('Title'); $field->setType(FieldDescription::FIELD_TYPE_STRING); $result->addFieldDescription($field); return $result; }
protected function mainState() { $dd = new DataDescription(); $fd = new FieldDescription('id'); $fd->setProperty('key', true); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dd->addFieldDescription($fd); $fd = new FieldDescription('name'); $fd->setType(FieldDescription::FIELD_TYPE_STRING); $dd->addFieldDescription($fd); $fd = new FieldDescription('data'); $fd->setType(FieldDescription::FIELD_TYPE_CUSTOM); $dd->addFieldDescription($fd); $d = new Data(); $d->load($this->dbh->select('SELECT t.tg_id as id, tg_name as `name`, t.tg_id as data FROM apps_top_groups t LEFT JOIN apps_top_groups_translation tt ON (tt.tg_id = t.tg_id) AND (lang_id=%s) WHERE site_id = %s ORDER by tg_order_num', $this->document->getLang(), E()->getSiteManager()->getCurrentSite()->id)); $this->setData($d); $this->setDataDescription($dd); $this->js = $this->buildJS(); $this->buildGroups($this->getData()->getFieldByName('data')); }
/** * Build for for editing component parameters. * The form creation is based on XML widget's data received per POST request. * * @throws SystemException 'ERR_INSUFFICIENT_DATA' * @throws SystemException 'ERR_BAD_XML_DESCR' */ protected function buildParamsForm() { if (!isset($_POST['modalBoxData'])) { throw new SystemException('ERR_INSUFFICIENT_DATA'); } if (!($widgetXML = simplexml_load_string($_POST['modalBoxData']))) { throw new SystemException('ERR_BAD_XML_DESCR'); } list($componentName) = $this->getStateParams(); $component = ComponentManager::findBlockByName($widgetXML, $componentName); $dd = new DataDescription(); $d = new Data(); $this->setType(self::COMPONENT_TYPE_FORM_ALTER); $this->setDataDescription($dd); $this->setData($d); $this->setBuilder(new Builder()); $this->js = $this->buildJS(); foreach ($component->params->children() as $param) { $paramName = (string) $param['name']; $paramType = isset($param['type']) ? (string) $param['type'] : FieldDescription::FIELD_TYPE_STRING; $fd = new FieldDescription($paramName); if (isset($param['nullable'])) { $fd->setProperty('nullable', true); } $fd->setType($paramType)->setProperty('tabName', E()->Utils->translate('TAB_PARAMS')); if ($paramType == FieldDescription::FIELD_TYPE_SELECT && isset($param['values'])) { $availableValues = array(); foreach (explode('|', (string) $param['values']) as $value) { array_push($availableValues, array('key' => $value, 'value' => $value)); } $fd->loadAvailableValues($availableValues, 'key', 'value'); } $dd->addFieldDescription($fd); $f = new Field($paramName); $f->setRowData(0, $param); $d->addField($f); } $this->addToolbar($this->loadToolbar()); }
protected function prepare() { parent::prepare(); if (in_array($this->getState(), array('add', 'edit'))) { $fd = new FieldDescription('domains'); $fd->setType(FieldDescription::FIELD_TYPE_TAB); $fd->setProperty('title', $this->translate('TAB_DOMAINS')); $this->getDataDescription()->addFieldDescription($fd); $field = new Field('domains'); $state = $this->getState(); $tab_url = ($state != 'add' ? $this->getData()->getFieldByName($this->getPK())->getRowData(0) : '') . '/domains/'; $field->setData($tab_url, true); $this->getData()->addField($field); $fd = $this->getDataDescription()->getFieldDescriptionByName('site_folder'); $fd->setType(FieldDescription::FIELD_TYPE_SELECT); $fd->loadAvailableValues($this->loadFoldersData(), 'key', 'value'); if ($this->getData()->getFieldByName('site_is_default')->getRowData(0) == 1) { $this->getDataDescription()->getFieldDescriptionByName('site_is_default')->setMode(FieldDescription::FIELD_MODE_READ); } $tagField = new FieldDescription('tags'); $tagField->setType(FieldDescription::FIELD_TYPE_STRING); $tagField->removeProperty('pattern'); $this->getDataDescription()->addFieldDescription($tagField); if ($this->getState() == 'add') { //Добавляем селект позволяющий скопировать структуру одного из существующих сайтов в новый $fd = new FieldDescription('copy_site_structure'); $fd->setType(FieldDescription::FIELD_TYPE_SELECT); $fd->loadAvailableValues($this->dbh->select('SELECT ss.site_id, site_name FROM share_sites ss LEFT JOIN share_sites_translation sst ON ss.site_id = sst.site_id WHERE lang_id =%s ', $this->document->getLang()), 'site_id', 'site_name'); $this->getDataDescription()->addFieldDescription($fd); } else { $this->getDataDescription()->getFieldDescriptionByName($this->getPK())->setType(FieldDescription::FIELD_TYPE_INT)->setMode(FieldDescription::FIELD_MODE_READ); $tm = new TagManager($this->getDataDescription(), $this->getData(), $this->getTableName()); $tm->createFieldDescription(); $tm->createField(); } } }
protected function prepare() { parent::prepare(); if (in_array($this->getState(), ['add', 'edit'])) { $fd = new FieldDescription('users'); $fd->setType(FieldDescription::FIELD_TYPE_TAB); $fd->setProperty('title', $this->translate('TAB_SUBSCRIBED_USERS')); $this->getDataDescription()->addFieldDescription($fd); $field = new Field('users'); $state = $this->getState(); $tab_url = ($state != 'add' ? $this->getData()->getFieldByName($this->getPK())->getRowData(0) : '') . '/users/'; $field->setData($tab_url, true); $this->getData()->addField($field); $fd = new FieldDescription('emails'); $fd->setType(FieldDescription::FIELD_TYPE_TAB); $fd->setProperty('title', $this->translate('TAB_SUBSCRIBED_EMAILS')); $this->getDataDescription()->addFieldDescription($fd); $field = new Field('emails'); $state = $this->getState(); $tab_url = ($state != 'add' ? $this->getData()->getFieldByName($this->getPK())->getRowData(0) : '') . '/email/'; $field->setData($tab_url, true); $this->getData()->addField($field); } }
/** * @copydoc DataSet::createDataDescription */ protected function createDataDescription() { $result = new DataDescription(); /* <field name="Id" type="integer" key="1"/> <field name="Pid" type="integer"/> <field name="Name" type="string"/> <field name="Segment" type="string"/> <field name="Redirect" type="string"/> */ foreach (array('Id', 'Pid', 'Name', 'Segment', 'Redirect') as $fieldName) { $fd = new FieldDescription($fieldName); if (in_array($fieldName, array('Id', 'Pid'))) { $fd->setType(FieldDescription::FIELD_TYPE_INT); } else { $fd->setType(FieldDescription::FIELD_TYPE_STRING); } if ($fieldName == 'Id') { $fd->setProperty('key', 1); } $result->addFieldDescription($fd); } return $result; }
/** * Create new data description. * * @return DataDescription */ public function createNewDataDescription() { $dataDescription = new DataDescription(); $fd = new FieldDescription('comment_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $fd->setProperty('key', true); // для построения дерева $dataDescription->addFieldDescription($fd); // если у нас древовидная структура - добавляем предка if ($this->isTree) { $fd = new FieldDescription('comment_parent_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dataDescription->addFieldDescription($fd); } // комментиркемая сущность $fd = new FieldDescription('target_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('u_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('comment_created'); $fd->setType(FieldDescription::FIELD_TYPE_DATETIME); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('comment_name'); $fd->setType(FieldDescription::FIELD_TYPE_STRING); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('comment_approved'); $fd->setType(FieldDescription::FIELD_TYPE_BOOL); $dataDescription->addFieldDescription($fd); // Инфа о юзере $fd = new FieldDescription('u_fullname'); $fd->setType(FieldDescription::FIELD_TYPE_STRING); $dataDescription->addFieldDescription($fd); return $dataDescription; }
/** * @copydoc Grid::edit */ protected function edit() { parent::edit(); $this->buildRightsTab($smapID = $this->getData()->getFieldByName('smap_id')->getRowData(0)); //Выводим УРЛ в поле сегмента $field = $this->getData()->getFieldByName('smap_pid'); $site = E()->getSiteManager()->getSiteByID($this->getData()->getFieldByName('site_id')->getRowData(0)); foreach ([Document::TMPL_CONTENT, Document::TMPL_LAYOUT] as $type) { if ($f = $this->getDataDescription()->getFieldDescriptionByName('smap_' . $type)) { $f->setType(FieldDescription::FIELD_TYPE_SELECT); $old_value = $this->getData()->getFieldByName('smap_' . $type)->getRowData(0); $template_data = $this->loadTemplateData($type, $site->folder, $old_value); $f->loadAvailableValues($template_data, 'key', 'value'); } } //Если изменен - вносим исправления в список возможных значений if ($contentXMLFieldData = $this->dbh->getScalar($this->getTableName(), 'smap_content_xml', ['smap_id' => $this->getData()->getFieldByName('smap_id')->getRowData(0)])) { $contentFilename = $this->getData()->getFieldByName('smap_content')->getRowData(0); $contentFD = $this->getDataDescription()->getFieldDescriptionByName('smap_content'); $contentFD->setProperty('reset', $this->translate('TXT_RESET_CONTENT')); $av =& $contentFD->getAvailableValues(); if (isset($av[$contentFilename])) { $av[$contentFilename]['value'] .= ' - ' . $this->translate('TXT_CHANGED'); } $newField = new FieldDescription('smap_content_xml'); $newField->setProperty('nullable', true); $newField->setType(FieldDescription::FIELD_TYPE_CODE); $newField->setProperty('tableName', $this->getTableName()); $newField->setProperty('tabName', $contentFD->getPropertyValue('tabName')); $this->getDataDescription()->addFieldDescription($newField, DataDescription::FIELD_POSITION_AFTER, 'smap_content'); $newField = new Field('smap_content_xml'); $doc = new \DOMDocument(); $doc->loadXML($contentXMLFieldData); $doc->formatOutput = true; $doc->preserveWhiteSpace = true; $newField->setData($doc->saveXML(null, LIBXML_NOEMPTYTAG), true); $this->getData()->addField($newField); unset($contentFilename, $contentFD, $av, $doc, $newField); } $smapSegment = ''; if ($field->getRowData(0) !== null) { $smapSegment = E()->getMap($site->id)->getURLByID($field->getRowData(0)); $this->getDataDescription()->getFieldDescriptionByName('smap_segment')->removeProperty('nullable'); } else { $this->getDataDescription()->getFieldDescriptionByName('smap_pid')->setMode(FieldDescription::FIELD_MODE_READ)->setType(FieldDescription::FIELD_TYPE_HIDDEN); foreach (['smap_is_disabled', 'smap_segment', 'smap_redirect_url', 'smap_meta_robots', 'smap_meta_keywords', 'smap_meta_description'] as $fieldName) { if ($f = $this->getDataDescription()->getFieldDescriptionByName($fieldName)) { $this->getDataDescription()->removeFieldDescription($f); } } } $smapName = $this->dbh->getScalar($this->getTranslationTableName(), 'smap_name', ['smap_id' => $field->getRowData(0), 'lang_id' => $this->document->getLang()]); for ($i = 0; $i < ($langs = count(E()->getLanguage()->getLanguages())); $i++) { $field->setRowProperty($i, 'data_name', $smapName); $field->setRowProperty($i, 'segment', $smapSegment); } $tm = new TagManager($this->getDataDescription(), $this->getData(), $this->getTableName()); $tm->createFieldDescription(); $tm->createField(); $this->getDataDescription()->getFieldDescriptionByName('smap_id')->setType(FieldDescription::FIELD_TYPE_INT)->setMode(FieldDescription::FIELD_MODE_READ); if (class_exists('AdsManager', false) && AdsManager::isActive()) { $ads = new AdsManager(); $ads->edit($this->getData(), $this->getDataDescription()); } }
/** * Edit directory. * @param int $uplID Upload ID. */ private function editDir($uplID) { $this->setFilter(['upl_id' => $uplID]); $this->setType(self::COMPONENT_TYPE_FORM_ALTER); $this->setBuilder($this->createBuilder()); $dd = new DataDescription(); $f = new FieldDescription('upl_id'); $f->setProperty('tableName', $this->getTableName()); $f->setType(FieldDescription::FIELD_TYPE_HIDDEN); $f->setProperty('key', true); $dd->addFieldDescription($f); $f = new FieldDescription('upl_pid'); $f->setProperty('tableName', $this->getTableName()); $f->setType(FieldDescription::FIELD_TYPE_HIDDEN); $dd->addFieldDescription($f); $f = new FieldDescription('upl_title'); $f->setProperty('tableName', $this->getTableName()); $f->setType(FieldDescription::FIELD_TYPE_STRING); $dd->addFieldDescription($f); $this->setDataDescription($dd); $this->setData($this->createData()); $this->addToolbar($this->loadToolbar()); $this->js = $this->buildJS(); $this->setAction('save-dir/'); }
/** * Build the list of additional files. * @param string $tableName Table name. * @param bool $data Data. * @see DivisionEditor * @see ProductEditor * @note It is used for the cases when additional tab with attached files to the record should be created. */ protected function linkExtraManagers($tableName, $data = false) { if ($this->dbh->tableExists($tableName . AttachmentManager::ATTACH_TABLE_SUFFIX) && $this->getState() != 'attachments') { $fd = new FieldDescription('attached_files'); $fd->setType(FieldDescription::FIELD_TYPE_TAB); $fd->setProperty('title', $this->translate('TAB_ATTACHED_FILES')); $fd->setProperty('tableName', $tableName . AttachmentManager::ATTACH_TABLE_SUFFIX); $this->getDataDescription()->addFieldDescription($fd); $field = new Field('attached_files'); $state = $this->getState(); $tab_url = ($state != 'add' ? $this->getData()->getFieldByName($this->getPK())->getRowData(0) : '') . '/attachments/'; $field->setData($tab_url, true); $this->getData()->addField($field); } if ($this->dbh->getTagsTablename($this->getTableName())) { $tm = new TagManager($this->getDataDescription(), $this->getData(), $this->getTableName()); $tm->createFieldDescription(); $tm->createField(); } }
protected function createDataDescription() { $result = parent::createDataDescription(); if ($this->getState() == 'main') { if (!($fd = $result->getFieldDescriptionByName('smap_id'))) { $fd = new FieldDescription('smap_id'); $fd->setProperty('tableName', $this->getTableName()); $result->addFieldDescription($fd); } $fd->setType(FieldDescription::FIELD_TYPE_HIDDEN); } return $result; }
protected function main() { parent::main(); if ($f = $this->getDataDescription()->getFieldDescriptionByName('u_id')) { $f->setType(FieldDescription::FIELD_TYPE_STRING); } if ($f = $this->getDataDescription()->getFieldDescriptionByName('target_id')) { $f->setType(FieldDescription::FIELD_TYPE_STRING); } foreach ($this->commentTables as $i => $table) { //пропускаем текущую таблицу - для неё уже создана нулевая вкладка // посути $this->currTabIndex может быть равен только нулю if ($i == $this->currTabIndex) { continue; } $fd = new FieldDescription($table . '_edit'); $fd->setType(FieldDescription::FIELD_TYPE_HIDDEN); $fd->setProperty('tabName', 'TAB_' . $table); $this->getDataDescription()->addFieldDescription($fd); } }
protected function createDataDescription() { $result = parent::createdataDescription(); if ($field = $result->getFieldDescriptionByName('u_is_active')) { $result->removeFieldDescription($field); } if ($field = $result->getFieldDescriptionByName('u_password')) { $field->setProperty('message2', $this->translate('ERR_PWD_MISMATCH')); $result->removeFieldDescription($field); $result->addFieldDescription($field); } if ($this->getState() !== 'save') { if ($result->getFieldDescriptionByName('u_password')) { $field = new FieldDescription('u_password2'); $field->setProperty('message2', $this->translate('ERR_PWD_MISMATCH')); $field->setType(FieldDescription::FIELD_TYPE_PWD); $field->setProperty('customField', true); //$field->setProperty('title', $this->translate('FIELD_U_PASSWORD2')); $field->setProperty('title', 'FIELD_U_PASSWORD2'); $result->addFieldDescription($field); } } return $result; }
protected function createDataDescription() { $dd = LinkingEditor::createDataDescription(); if (in_array($this->getState(), ['add', 'edit'])) { $dd->getFieldDescriptionByName('smap_id')->setType(FieldDescription::FIELD_TYPE_SMAP_SELECTOR); $fd = new FieldDescription('news_is_top'); $fd->setType(FieldDescription::FIELD_TYPE_BOOL); $fd->setProperty('tag', 'top'); $dd->addFieldDescription($fd, DataDescription::FIELD_POSITION_AFTER, $this->getPK()); } return $dd; }
/** * Build result as JSON. * * @param array $comment Comment. * @return IBuilder */ protected function buildResult($comment) { $builder = new CommentsJSONBuilder(); $dataDescription = new DataDescription(); $this->setDataDescription($dataDescription); $localData = new Data(); $this->setData($localData); $localData->load($comment); $fd = new FieldDescription('comment_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dataDescription->addFieldDescription($fd); if ($this->isTree) { $fd = new FieldDescription('is_tree'); $fd->setType(FieldDescription::FIELD_TYPE_BOOL); $dataDescription->addFieldDescription($fd); if (isset($comment[0]['comment_parent_id'])) { $fd = new FieldDescription('comment_parent_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dataDescription->addFieldDescription($fd); } } $fd = new FieldDescription('target_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('comment_name'); $fd->setType(FieldDescription::FIELD_TYPE_STRING); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('u_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('comment_created'); $fd->setType(FieldDescription::FIELD_TYPE_DATETIME); $fd->setProperty('outputFormat', '%E'); $dataDescription->addFieldDescription($fd); $fd = new FieldDescription('comment_approved'); $fd->setType(FieldDescription::FIELD_TYPE_BOOL); $dataDescription->addFieldDescription($fd); $builder->setData($localData); $builder->setDataDescription($dataDescription); //добавляем поля о прокоментировавшем $fd = new FieldDescription('u_fullname'); $fd->setType(FieldDescription::FIELD_TYPE_STRING); $dataDescription->addFieldDescription($fd); return $builder; }
protected function createDataDescription() { $result = parent::createDataDescription(); if (in_array($this->getState(), array('add', 'edit'))) { foreach ($result as $fieldDescription) { $fieldDescription->setProperty('tabName', E()->Utils->translate('TXT_USER_EDITOR')); } $result->getFieldDescriptionByName('u_name')->setType(FieldDescription::FIELD_TYPE_EMAIL); if ($fd = $result->getFieldDescriptionByName('u_is_active')) { $result->removeFieldDescription($fd); } $fd = new FieldDescription('group_id'); $fd->setSystemType(FieldDescription::FIELD_TYPE_INT); $fd->setType(FieldDescription::FIELD_TYPE_MULTI); $fd->setProperty('tabName', E()->Utils->translate('TXT_USER_GROUPS')); $fd->setProperty('customField', true); $data = $this->dbh->select('user_groups', array('group_id', 'group_name'), 'group_id IN(select group_id from user_groups where group_default=0)'); $fd->loadAvailableValues($data, 'group_id', 'group_name'); $result->addFieldDescription($fd); } if ($this->getType() == self::COMPONENT_TYPE_FORM_ALTER && ($f = $result->getFieldDescriptionByName('u_password'))) { $f->removeProperty('pattern'); $f->removeProperty('message'); $f->setProperty('nullable', true); } return $result; }
protected function createDataDescription() { $dd = parent::createDataDescription(); $fd = $dd->getFieldDescriptionByName($this->getParam('pk')); $fd->setType(FieldDescription::FIELD_TYPE_HIDDEN); $fd = $dd->getFieldDescriptionByName('session_id'); $fd->setType(FieldDescription::FIELD_TYPE_HIDDEN); if ($this->getState() == 'getRawData' || $this->getState() == 'main') { $fd = $dd->getFieldDescriptionByName('upl_id'); $fd->setType(FieldDescription::FIELD_TYPE_HIDDEN); $field = new FieldDescription('upl_path'); $field->setType(FieldDescription::FIELD_TYPE_FILE); $field->setProperty('title', 'FIELD_IMG_FILENAME_IMG'); $field->setProperty('customField', true); $dd->addFieldDescription($field); $field = new FieldDescription('upl_name'); $field->setType(FieldDescription::FIELD_TYPE_CUSTOM); $field->setProperty('title', 'FIELD_IMG_FILENAME'); $field->setProperty('customField', true); $dd->addFieldDescription($field); } return $dd; }
/** * Build tab with division rights. * * @return DOMNode */ private function buildDivRightsData() { $builder = new TreeBuilder(); $builder->setTree(TreeConverter::convert($this->dbh->select('share_sitemap', ['smap_id', 'smap_pid'], null, ['smap_order_num' => QAL::ASC]), 'smap_id', 'smap_pid')); $id = $this->getFilter(); $id = !empty($id) ? current($id) : ''; $data = convertDBResult($this->dbh->select('select s.smap_id as Id, smap_pid as Pid, site_id as Site, smap_name as Name ' . 'from share_sitemap s ' . 'left join share_sitemap_translation st on st.smap_id = s.smap_id ' . 'where lang_id=%s', E()->getLanguage()->getCurrent()), 'Id'); foreach ($data as $smapID => $smapInfo) { $data[$smapID]['RightsId'] = E()->getMap($smapInfo['Site'])->getDocumentRights($smapID, $id); $data[$smapID]['Site'] = E()->getSiteManager()->getSiteByID($smapInfo['Site'])->name; } $dataObject = new Data(); $dataObject->load($data); $builder->setData($dataObject); $dataDescriptionObject = new DataDescription(); $f = new FieldDescription('Id'); $f->setType(FieldDescription::FIELD_TYPE_INT); $f->setProperty('key', true); $dataDescriptionObject->addFieldDescription($f); $f = new FieldDescription('Pid'); $f->setType(FieldDescription::FIELD_TYPE_INT); $dataDescriptionObject->addFieldDescription($f); $f = new FieldDescription('Name'); $f->setType(FieldDescription::FIELD_TYPE_STRING); $dataDescriptionObject->addFieldDescription($f); $f = new FieldDescription('Site'); $f->setType(FieldDescription::FIELD_TYPE_STRING); $dataDescriptionObject->addFieldDescription($f); $f = new FieldDescription('RightsId'); $f->setType(FieldDescription::FIELD_TYPE_SELECT); if ($this->getState() == 'view') { $f->setMode(FieldDescription::FIELD_MODE_READ); } $rights = $this->dbh->select('user_group_rights', ['right_id', 'right_const']); $rights = array_merge([['right_id' => 0, 'right_const' => 'NO_RIGHTS']], $rights); foreach ($rights as $key => $value) { $rights[$key]['right_const'] = $this->translate('TXT_' . $value['right_const']); } $f->loadAvailableValues($rights, 'right_id', 'right_const'); $dataDescriptionObject->addFieldDescription($f); $builder->setData($dataObject); $builder->setDataDescription($dataDescriptionObject); $builder->build(); return $builder->getResult(); }