Beispiel #1
0
 protected function main()
 {
     $id = !($id = $this->getParam('id')) ? $this->document->getID() : $id;
     $this->setBuilder(new SimpleBuilder());
     $dd = new DataDescription();
     if ($this->getConfig()->getCurrentStateConfig() && $this->getConfig()->getCurrentStateConfig()->fields) {
         $dd->loadXML($this->getConfig()->getCurrentStateConfig()->fields);
     } else {
         $dd->load(['Id' => ['type' => FieldDescription::FIELD_TYPE_INT], 'Name' => ['type' => FieldDescription::FIELD_TYPE_STRING], 'Title' => ['type' => FieldDescription::FIELD_TYPE_STRING], 'HtmlTitle' => ['type' => FieldDescription::FIELD_TYPE_STRING], 'DescriptionRtf' => ['type' => FieldDescription::FIELD_TYPE_HTML_BLOCK]]);
     }
     $fd = new FieldDescription('Url');
     $fd->setType(FieldDescription::FIELD_TYPE_STRING);
     $dd->addFieldDescription($fd);
     $info = E()->getMap()->getDocumentInfo($id);
     $d = new Data();
     $info['Id'] = $id;
     $info['Url'] = E()->getMap()->getURLByID($id);
     $d->load([$info]);
     $this->setDataDescription($dd);
     $this->setData($d);
     $m = new AttachmentManager($this->getDataDescription(), $this->getData(), 'share_sitemap', true);
     $m->createFieldDescription();
     $m->createField('smap_id', false, $id);
     $this->addToolbar($this->loadToolbar());
     $this->js = $this->buildJS();
 }
Beispiel #2
0
 private function buildGroups(Field $field)
 {
     $builder = new SimpleBuilder();
     $data = new Data();
     $dd = new DataDescription();
     $dd->load(['id' => ['type' => FieldDescription::FIELD_TYPE_INT, 'key' => true], 'link' => ['type' => FieldDescription::FIELD_TYPE_STRING], 'title' => ['type' => FieldDescription::FIELD_TYPE_STRING], 'text' => ['type' => FieldDescription::FIELD_TYPE_HTML_BLOCK]]);
     $builder->setDataDescription($dd);
     foreach ($field as $key => $id) {
         if ($d = $this->dbh->select('SELECT t.top_id as id, top_name as `title`, top_link as link,top_text_rtf as `text`  FROM apps_tops t LEFT JOIN apps_tops_translation tt ON (tt.top_id=t.top_id) AND (lang_id=%s) WHERE (t.tg_id =%s) AND top_is_active ORDER BY top_order_num', $this->document->getLang(), $id)) {
             $data->load($d);
             $builder->setData($data);
             $am = new AttachmentManager($dd, $data, 'apps_tops');
             $am->createFieldDescription();
             $am->createField('top_id', false, $data->getFieldByName('id')->getData());
             $builder->build();
             $field->setRowData($key, $builder->getResult());
         } else {
             $field->setRowData($key, null);
         }
     }
 }
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 view()
 {
     $ap = $this->getStateParams(true);
     $this->addFilterCondition(array($this->getTableName() . '.' . $this->getPK() => $ap['id'], 'news_segment' => $ap['segment']));
     $this->setType(self::COMPONENT_TYPE_FORM);
     $this->setDataDescription($this->createDataDescription());
     $this->setBuilder($this->createBuilder());
     $this->createPager();
     $this->setData($this->createData());
     if (!$this->getData()->isEmpty()) {
         list($newsTitle) = $this->getData()->getFieldByName('news_title')->getData();
         $breadCrumbs = E()->getDocument()->componentManager->getBlockByName('breadCrumbs');
         if ($breadCrumbs) {
             $breadCrumbs->addCrumb('', $newsTitle);
         }
         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);
             }
         }
     } else {
         throw new SystemException('ERR_404', SystemException::ERR_404);
     }
     $this->addToolbar($this->loadToolbar());
     $this->js = $this->buildJS();
     foreach ($this->getDataDescription() as $fieldDescription) {
         $fieldDescription->setMode(FieldDescription::FIELD_MODE_READ);
     }
     $am = new AttachmentManager($this->getDataDescription(), $this->getData(), $this->getTableName(), true);
     $am->createFieldDescription();
     $am->createField();
 }
Beispiel #5
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);
         }
     }
 }