/** * @copydoc DBDataSet::createDataDescription */ protected function createDataDescription() { $result = parent::createDataDescription(); $result->getFieldDescriptionByName('brand_main_img')->setType(FieldDescription::FIELD_TYPE_STRING); foreach ($result as $fd) { $fd->setMode(FieldDescription::FIELD_MODE_READ); } return $result; }
public function main() { $type = $this->getParam('type'); $this->setProperty('type', $type); $type_id = $this->dbh->getScalar('ads_types', 'ads_type_id', array('ads_type_sysname' => $type)); $this->setFilter(['ads_type_id' => $type_id, 'ads_item_is_active' => 1]); if ($limit = $this->getParam('limit')) { $this->setLimit([0, $limit]); } if ($order = $this->getParam('order')) { if ($order == 'rand') { $this->setOrder('RAND()'); } else { $this->setOrder('ads_item_order_num'); } } parent::main(); }
protected function prepare() { parent::prepare(); // data description для информера if (in_array($this->getState(), ['main'])) { $data = $this->getData(); $dd = $this->getDataDescription(); if ($data) { $fd = new FieldDescription('is_subscribed'); $fd->setType(FieldDescription::FIELD_TYPE_BOOL); $dd->addFieldDescription($fd); $f = new Field('is_subscribed'); $data->addField($f); $f_subscription_id = $data->getFieldByName('subscription_id'); $subscribed = $this->dbh->getColumn('mail_subscriptions2users', 'subscription_id', array('u_id' => $this->document->getUser()->getID())); foreach ($f_subscription_id as $i => $row) { $f->setRowData($i, in_array($row, $subscribed) ? '1' : '0'); } } } }
/** * @copydoc DBDataSet::prepare */ protected function prepare() { parent::prepare(); if ($this->document->getUser()->isAuthenticated() && ($captcha = $this->getDataDescription()->getFieldDescriptionByName('captcha'))) { $this->getDataDescription()->removeFieldDescription($captcha); } }
protected function prepare() { parent::prepare(); //u_id и u_is_active нам не нужны ни при каких раскладах if ($this->getDataDescription()->getFieldDescriptionByName('u_id')) { $this->getDataDescription()->removeFieldDescription($this->getDataDescription()->getFieldDescriptionByName('u_id')); } if ($this->getDataDescription()->getFieldDescriptionByName('u_is_active')) { $this->getDataDescription()->removeFieldDescription($this->getDataDescription()->getFieldDescriptionByName('u_is_active')); } //Тут таки нужно вернуться к параметру confirmationNeeded if ($this->getDataDescription()->getFieldDescriptionByName('u_password')) { $this->getDataDescription()->removeFieldDescription($this->getDataDescription()->getFieldDescriptionByName('u_password')); } if ($this->getDataDescription()->getFieldDescriptionByName('u_name')) { $this->getDataDescription()->getFieldDescriptionByName('u_name')->setType(FieldDescription::FIELD_TYPE_EMAIL); } }
/** * @copydoc Feed::view */ protected function view() { $this->addFilterCondition(['smap_id' => $this->document->getID()]); DBDataSet::view(); $this->addTranslation('BTN_RETURN_LIST'); $am = new AttachmentManager($this->getDataDescription(), $this->getData(), $this->getTableName(), true); $am->createFieldDescription(); $am->createField(); if ($f = $this->getData()->getFieldByName('smap_id')) { foreach ($f as $key => $value) { $site = E()->getSiteManager()->getSiteByPage($value); $f->setRowProperty($key, 'url', E()->getMap($site->id)->getURLByID($value)); $f->setRowProperty($key, 'base', $site->base); } } }
protected function createData() { $result = parent::createData(); if ($field = $result->getFieldByName('u_password')) { $field->setData(''); } return $result; }
protected function defineParams() { return array_merge(parent::defineParams(), ['active' => true, 'showAll' => false, 'id' => false, 'limit' => false, 'editable' => false, 'orderField' => false, 'exclude' => false]); }
/** * @copydoc DBDataSet::prepare */ protected function prepare() { parent::prepare(); if ($this->getType() == self::COMPONENT_TYPE_LIST) { $this->createFilter(); } }
/** * @copydoc DBDataSet::main */ protected function main() { //If we don't have such form - return recodset with error //Otherwise run main method if (!$this->formID) { $this->returnEmptyRecordset(); } else { parent::main(); $this->buildForm(); } }
protected function createData() { $result = parent::createData(); if (is_array($this->tagsInfo)) { $tagsFrq = array(); foreach ($this->tagsInfo as $tag) { $tagsFrq[$tag['tag_id']] = $tag['frq']; } $f = $result->getFieldByName('tag_id'); for ($i = 0; $i < $result->getRowCount(); $i++) { $f->setRowProperty($i, 'frequency', $tagsFrq[$f->getRowData($i)]); } } return $result; }