/** * @copydoc Grid::prepare */ protected function prepare() { parent::prepare(); if (in_array($this->getState(), array('add', 'edit'))) { $this->getDataDescription()->getFieldDescriptionByName('ltag_value_rtf')->setType(FieldDescription::FIELD_TYPE_TEXT); } }
protected function prepare() { parent::prepare(); if (in_array($this->getState(), ['add', 'edit'])) { $fd = $this->getDataDescription()->getFieldDescriptionByName('domain_protocol'); $fd->setType(FieldDescription::FIELD_TYPE_SELECT); $fd->loadAvailableValues([['key' => 'http', 'value' => 'http://'], ['key' => 'https', 'value' => 'https://']], 'key', 'value'); if ($this->getState() == 'add') { $this->getData()->getFieldByName('domain_port')->setData(80, true); $this->getData()->getFieldByName('domain_root')->setData('/', true); } } }
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); } }
protected function prepare() { parent::prepare(); if (in_array($this->getState(), ['add', 'edit'])) { $fd = $this->getDataDescription()->getFieldDescriptionByName('upl_id'); $fd->setType(FieldDescription::FIELD_TYPE_INT); if ($this->getState() == 'edit' && ($uplPath = $this->dbh->getScalar('share_uploads', 'upl_path', ['upl_id' => $this->getData()->getFieldByName('upl_id')->getRowData(0)]))) { $fd->setProperty('upl_path', $uplPath); $info = new FileRepoInfo(); $fileInfo = $info->analyze($uplPath); $fd->setProperty('media_type', $fileInfo->type); } $f = $this->getData()->getFieldByName($this->getParam('pk')); $f->setData($this->getParam('linkedID'), true); $f = $this->getData()->getFieldByName('session_id'); $f->setData(session_id(), true); } }
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); } }
protected function prepare() { parent::prepare(); if (in_array($this->getState(), ['add', 'edit'])) { $this->addTranslation('ERR_NO_DIV_NAME'); list($pageID) = $this->getStateParams(); $this->getDataDescription()->getFieldDescriptionByName('smap_pid')->setProperty('base', E()->getSiteManager()->getSiteByPage($pageID)->base); } }