コード例 #1
0
ファイル: Branding.php プロジェクト: energine-cmf/energine
 /**
  * @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;
 }
コード例 #2
0
ファイル: Ads.php プロジェクト: energine-cmf/energine
 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();
 }
コード例 #3
0
 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');
             }
         }
     }
 }
コード例 #4
0
 /**
  * @copydoc DBDataSet::prepare
  */
 protected function prepare()
 {
     parent::prepare();
     if ($this->document->getUser()->isAuthenticated() && ($captcha = $this->getDataDescription()->getFieldDescriptionByName('captcha'))) {
         $this->getDataDescription()->removeFieldDescription($captcha);
     }
 }
コード例 #5
0
ファイル: Register.php プロジェクト: energine-cmf/energine
 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);
     }
 }
コード例 #6
0
 /**
  * @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);
         }
     }
 }
コード例 #7
0
ファイル: UserProfile.php プロジェクト: energine-cmf/energine
 protected function createData()
 {
     $result = parent::createData();
     if ($field = $result->getFieldByName('u_password')) {
         $field->setData('');
     }
     return $result;
 }
コード例 #8
0
ファイル: Feed.php プロジェクト: energine-cmf/energine
 protected function defineParams()
 {
     return array_merge(parent::defineParams(), ['active' => true, 'showAll' => false, 'id' => false, 'limit' => false, 'editable' => false, 'orderField' => false, 'exclude' => false]);
 }
コード例 #9
0
ファイル: Grid.php プロジェクト: energine-cmf/energine
 /**
  * @copydoc DBDataSet::prepare
  */
 protected function prepare()
 {
     parent::prepare();
     if ($this->getType() == self::COMPONENT_TYPE_LIST) {
         $this->createFilter();
     }
 }
コード例 #10
0
ファイル: Form.php プロジェクト: energine-cmf/energine
 /**
  * @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();
     }
 }
コード例 #11
0
ファイル: TagCloud.php プロジェクト: energine-cmf/energine
 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;
 }