Beispiel #1
0
 /**
  * @copydoc DataSet::main
  */
 protected function main()
 {
     parent::main();
     //Сначала проверили есть ли свой код баннера
     $result = $this->dbh->select(AdsManager::TABLE_NAME, true, array('smap_id' => $this->document->getID()), array('smap_id' => QAL::DESC), 1);
     //Если нет собственного  - ищем у родителей
     if (!is_array($result)) {
         $result = false;
         //Список идентфикаторов родителей в порядке увелечения уровня
         $IDs = array_reverse(array_keys(E()->getMap()->getParents($this->document->getID())));
         $tmp = $this->dbh->select(AdsManager::TABLE_NAME, true, array('smap_id' => $IDs));
         if (is_array($tmp)) {
             $tmp = convertDBResult($tmp, 'smap_id');
         }
         //перебираем записи родителей
         foreach ($IDs as $id) {
             //если есть родитель с рекламой
             if (isset($tmp[$id])) {
                 $result = array($tmp[$id]);
                 //дальше смотреть нет смысла
                 break;
             }
         }
     }
     if (is_array($result)) {
         //We don't need smap_id, so don't write it to Data
         unset($result[0]['smap_id']);
         foreach ($result[0] as $key => $value) {
             $fd = new FieldDescription($key);
             if (in_array($key, array('ad_id'))) {
                 $fd->setType(FieldDescription::FIELD_TYPE_INT);
             } else {
                 $fd->setType(FieldDescription::FIELD_TYPE_TEXT);
             }
             $this->getDataDescription()->addFieldDescription($fd);
         }
         $this->getData()->load($result);
     }
 }
Beispiel #2
0
 protected function main()
 {
     E()->getController()->getTransformer()->setFileName('../core/modules/seo/transformers/robots_txt.xslt', true);
     parent::main();
     $this->setBuilder(new SimpleBuilder());
 }
Beispiel #3
0
 protected function main()
 {
     parent::main();
     if ($this->getDataDescription()->isEmpty()) {
         $this->getDataDescription()->loadXML(new \SimpleXMLElement('<fields>
                         <field name="Id" type="integer" key="1"/>
                         <field name="Pid" type="integer"/>
                         <field name="Name" type="string"/>
                         <field name="Segment" type="string"/>
                         <field name="DescriptionRtf" type="string"/>
                     </fields>'));
     }
     if (!$this->getData()->isEmpty()) {
         foreach (['Site', 'Redirect'] as $fieldName) {
             $FD = new FieldDescription($fieldName);
             $FD->setType(FieldDescription::FIELD_TYPE_STRING);
             $this->getDataDescription()->addFieldDescription($FD);
         }
     }
     if ($this->getDataDescription()->getFieldDescriptionByName('attachments')) {
         $am = new AttachmentManager($this->getDataDescription(), $this->getData(), 'share_sitemap');
         $am->createFieldDescription();
         if ($f = $this->getData()->getFieldByName('Id')) {
             $am->createField('smap_id', !$this->getParam('allAttachments'), $f->getData());
         }
     }
     if ($this->getDataDescription()->getFieldDescriptionByName('tags')) {
         $m = new TagManager($this->getDataDescription(), $this->getData(), 'share_sitemap');
         $m->createFieldDescription();
         $m->createField();
     }
 }
Beispiel #4
0
 protected function main()
 {
     parent::main();
     if ($this->getParam('bind')) {
         $this->bindComponent = $this->document->componentManager->getBlockByName($this->getParam('bind'));
         if (!$this->isTree and $this->pager) {
             $ap = $this->bindComponent->getStateParams(true);
             $subUrl = '';
             if (isset($ap['themeID'])) {
                 $subUrl = $ap['themeID'] . '/';
             }
             $this->pager->setProperty('additional_url', $subUrl);
         }
     }
 }