Example #1
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = null)
 {
     parent::__construct($name, $params);
     $this->setType(self::COMPONENT_TYPE_LIST);
     $this->setTableName('share_tags');
     $this->bindedBlock = $this->document->componentManager->getBlockByName($this->getParam('bind'));
     if (!$this->bindedBlock) {
         throw new SystemException('ERR_TAGCLOUD_NOT_BINDED', SystemException::ERR_DEVELOPER);
     }
     if ($filerId = intval($this->getParam('id'))) {
         $this->filterId = $filerId;
     } else {
         if ($this->getParam('id') == self::ID_PARENT_FILTER) {
             $map = E()->getMap();
             $this->filterId = $map->getParent($this->document->getID());
             $this->setProperty('template', $map->getURLByID($this->filterId));
         } else {
             if ($this->getParam('id') != self::ID_ALL_FILTER) {
                 $this->filterId = $this->document->getID();
             }
         }
     }
     $this->tagsInfo = $this->getTagsInfo();
     $this->addFilterCondition(array($this->getTableName() . '.tag_id' => simplifyDBResult($this->tagsInfo, 'tag_id')));
     $this->addTranslation('TXT_TAGS');
 }
 public function __construct($name, $module, array $params = NULL)
 {
     parent::__construct($name, $module, $params);
     $this->setTableName('mail_subscriptions');
     $this->setFilter(['subscription_is_active' => '1', 'subscription_is_hidden' => '0']);
     $this->setParam('active', true);
 }
Example #3
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = null)
 {
     $params['active'] = false;
     parent::__construct($name, $params);
     $this->setTableName('apps_branding');
     $this->setFilter(array('brand_id' => $this->findNearestParentBrandID()));
     $this->setParam('recordsPerPage', false);
 }
Example #4
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = NULL)
 {
     parent::__construct($name, $params);
     $this->setAction((string) $this->config->getStateConfig('save')->uri_patterns->pattern, false);
     $this->setType(self::COMPONENT_TYPE_FORM_ADD);
     $this->user = new User();
     $this->setTableName(User::USER_TABLE_NAME);
     $this->addTranslation('TXT_ENTER_CAPTCHA');
     if (!$this->getTitle()) {
         $this->setTitle($this->translate('TXT_' . strtoupper($this->getName())));
     }
 }
Example #5
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = NULL)
 {
     parent::__construct($name, $params);
     //Если title не указан  - устанавливаем дефолтный
     if (!$this->getProperty('title')) {
         $this->setProperty('title', $this->translate('TXT_' . strtoupper($this->getName())));
     }
     $this->setProperty('exttype', 'feed');
     $this->setParam('onlyCurrentLang', true);
     if ($this->getParam('editable') && $this->document->isEditable()) {
         $this->setProperty('editable', 'editable');
     }
     //@todo по хорошему тут должно быть ограничение не для main а для всех списков
     if ($this->getState() == 'main') {
         if (!($this->filterID = $this->getParam('id'))) {
             $this->filterID = $this->document->getID();
         }
         if ($this->getParam('showAll')) {
             if (!is_array($this->filterID)) {
                 $this->filterID = (array) $this->filterID;
             }
             $filters = $this->filterID;
             foreach ($filters as $filterID) {
                 $par = E()->getMap(E()->getSiteManager()->getSiteByPage($filterID)->id)->getTree()->getNodeById($filterID);
                 if ($par) {
                     $this->filterID = array_merge($this->filterID, array_keys($par->getDescendants()->asList(false)));
                 }
             }
         }
         if ($orderParam = $this->getParam('orderField')) {
             if (is_array($orderParam)) {
                 $field = $orderParam[0];
                 $dir = !empty($orderParam[1]) ? strtoupper($orderParam[1]) : QAL::ASC;
             } else {
                 $field = $orderParam;
                 $dir = QAL::ASC;
             }
             if (!in_array($dir, [QAL::ASC, QAL::DESC])) {
                 $dir = QAL::ASC;
             }
             $this->setOrder([$field => $dir]);
         }
         $this->addFilterCondition(['smap_id' => $this->filterID]);
         if ($excludedIDs = $this->getParam('exclude')) {
             $this->addFilterCondition($this->getTableName() . '.' . $this->getPK() . ' NOT IN (' . (is_array($excludedIDs) ? implode(',', $excludedIDs) : $excludedIDs) . ')');
         }
         if ($limit = $this->getParam('limit')) {
             $this->setLimit([0, $limit]);
             $this->setParam('recordsPerPage', false);
         }
     }
 }
Example #6
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = null)
 {
     parent::__construct($name, $params);
     //$tableName = $this->getParam('tableName');
     /*if(!($tableName)){
           $this->setTableName('apps_feedback');
       }else {
           $this->setTableName($tableName);
       }*/
     $this->setType(self::COMPONENT_TYPE_FORM_ADD);
     $this->setAction('send');
     $this->addTranslation('TXT_ENTER_CAPTCHA');
 }
Example #7
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = NULL)
 {
     parent::__construct($name, $params);
     $filter = ['form_is_active' => 1];
     if ($formID = $this->getParam('id')) {
         $filter['form_id'] = $formID;
     }
     $this->formID = $this->dbh->getScalar('frm_forms', 'form_id', $filter, 'RAND()', 1);
     //If formID is actual number, but we don't have table with name form_$formID, then set formID to false.
     //Otherwiste setTableName.
     if (!$this->formID || !$this->dbh->tableExists($tableName = FormConstructor::getDatabase() . '.' . FormConstructor::TABLE_PREFIX . $this->formID)) {
         $this->formID = false;
     } else {
         $this->setTableName($tableName);
     }
     $this->setType(self::COMPONENT_TYPE_FORM_ADD);
     $this->setAction('send');
     $this->addTranslation('TXT_ENTER_CAPTCHA');
 }
Example #8
0
 public function __construct($name, $module, array $params = NULL)
 {
     parent::__construct($name, $module, $params);
     $this->setTableName('ads_items');
 }
Example #9
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = null)
 {
     parent::__construct($name, $params);
     $this->setTableName('user_users');
     $this->setType(self::COMPONENT_TYPE_FORM_ALTER);
 }
Example #10
0
 /**
  * @copydoc DBDataSet::__construct
  */
 public function __construct($name, array $params = NULL)
 {
     parent::__construct($name, $params);
     $this->setProperty('exttype', 'grid');
     if (!$this->getParam('recordsPerPage')) {
         $this->setParam('recordsPerPage', DataSet::RECORD_PER_PAGE);
     }
     if (!$this->getTitle()) {
         $this->setTitle($this->translate('TXT_' . strtoupper($this->getName())));
     }
     if ($this->getParam('order')) {
         if (in_array($this->getParam('order'), array_keys($this->dbh->getColumnsInfo($this->getTableName())))) {
             $this->orderColumn = $this->getParam('order');
         }
     }
     $this->logClass = $this->getConfigValue('site.action_log');
 }