示例#1
0
 /**
  * Edit ad.
  * Modify input DataDescription argument by adding to it an information about ad.
  *
  * @param Data $d Data.
  * @param DataDescription $dd Data description.
  */
 public function edit(Data $d, DataDescription $dd)
 {
     $fds = $this->dbh->getColumnsInfo(self::TABLE_NAME);
     unset($fds['smap_id']);
     $fds['ad_id']['key'] = false;
     foreach ($fds as $key => $value) {
         $fds[$key]['tabName'] = 'TXT_ADS';
     }
     $dd->load($fds);
     $data = $this->dbh->select(self::TABLE_NAME, array_keys($fds), array('smap_id' => $d->getFieldByName('smap_id')->getRowData(0)));
     if (is_array($data)) {
         //Тут как всегда проблема с загрузкой значений в мультиязычный билдер
         foreach ($data[0] as $fieldName => $fieldData) {
             $f = new Field($fieldName);
             for ($i = 0, $l = sizeof(E()->getLanguage()->getLanguages()); $i < $l; $i++) {
                 $f->setRowData($i, $fieldData);
             }
             $d->addField($f);
         }
     }
 }
示例#2
0
 /**
  * Get comments, build and integrate as field @c $fieldName into Data and DataDescription.
  *
  * @param DataDescription $desc Data description.
  * @param Data $data Data.
  * @param int|array $targetIds Comment ID(s)
  * @param string $fieldName Field name.
  */
 public function createAndAddField(DataDescription $desc, Data $data, $targetIds, $fieldName = 'comments')
 {
     $desc->addFieldDescription($this->createFieldDescription($fieldName));
     $data->addField($this->createField($targetIds));
 }
示例#3
0
 /**
  * Success.
  */
 protected function success()
 {
     $this->setBuilder($this->createBuilder());
     $dataDescription = new DataDescription();
     $ddi = new FieldDescription('result');
     $ddi->setType(FieldDescription::FIELD_TYPE_TEXT);
     $ddi->setMode(FieldDescription::FIELD_MODE_READ);
     $ddi->removeProperty('title');
     $dataDescription->addFieldDescription($ddi);
     $data = new Data();
     $di = new Field('result');
     $di->setData($this->translate('TXT_FEEDBACK_SUCCESS_SEND'));
     $data->addField($di);
     $this->setDataDescription($dataDescription);
     $this->setData($data);
     $this->setAction('');
     $this->addToolbar($this->loadToolbar());
 }
示例#4
0
 /**
  * Return empty recordset.
  */
 private function returnEmptyRecordset()
 {
     //Тип форми змінюється для того, щоб xslt опрацював помилку не в Grid'і.
     $this->setType(self::COMPONENT_TYPE_FORM_ALTER);
     $this->removeProperty('exttype');
     $f = new Field('error_msg');
     $fd = new FieldDescription('error_msg');
     $fd->setType(FieldDescription::FIELD_TYPE_STRING);
     $fd->setMode(FieldDescription::FIELD_MODE_READ);
     $f->setData($this->translate('ERROR_NO_FORM'), true);
     $d = new Data();
     $dd = new DataDescription();
     $d->addField($f);
     $dd->addFieldDescription($fd);
     $this->setData($d);
     $this->setDataDescription($dd);
     $this->setBuilder(new SimpleBuilder());
 }
示例#5
0
 /**
  * Show registration result.
  */
 protected function success()
 {
     //если в сессии нет переменной saved значит этот метод пытаются вызвать напрямую. Не выйдет!
     /*if (!isset($_SESSION['saved'])) {
           throw new SystemException('ERR_404', SystemException::ERR_404);
       }*/
     //unset($_SESSION['saved']);
     if ($textBlock = $this->document->componentManager->getBlockByName('RegTextBlock')) {
         $textBlock->disable();
     }
     $this->setBuilder($this->createBuilder());
     $dataDescription = new DataDescription();
     $ddi = new FieldDescription('success_message');
     $ddi->setType(FieldDescription::FIELD_TYPE_TEXT);
     $ddi->setMode(FieldDescription::FIELD_MODE_READ);
     $ddi->removeProperty('title');
     $dataDescription->addFieldDescription($ddi);
     $data = new Data();
     $di = new Field('success_message');
     $di->setData($this->translate('TXT_USER_REGISTRED'));
     $data->addField($di);
     $this->setDataDescription($dataDescription);
     $this->setData($data);
 }
示例#6
0
 /**
  * @copydoc DataSet::createData
  */
 protected function createData()
 {
     $result = new Data();
     $cal = $this->getCalendar();
     $fields = array();
     for ($i = 0; $i < 7; $i++) {
         $fields[$i] = new Field('DOW_' . $i);
     }
     foreach ($this->calendar as $row => $rowItems) {
         for ($i = 0; $i < 7; $i++) {
             if ($ci = $cal->getItemByIndex($row, $i)) {
                 $fields[$i]->setRowData($row, $ci);
                 foreach ($ci as $propertyName => $propertyValue) {
                     $fields[$i]->setRowProperty($row, $propertyName, $propertyValue);
                 }
             }
         }
     }
     array_map(function ($f) use($result) {
         $result->addField($f);
     }, $fields);
     return $result;
 }
示例#7
0
 /**
  * Return empty recordset.
  */
 private function returnEmptyRecordset()
 {
     $f = new Field('error_msg');
     $fd = new FieldDescription('error_msg');
     $fd->setType(FieldDescription::FIELD_TYPE_STRING);
     $fd->setMode(FieldDescription::FIELD_MODE_READ);
     $f->setData('ERROR_NO_FORM', true);
     $d = new Data();
     $dd = new DataDescription();
     $d->addField($f);
     $dd->addFieldDescription($fd);
     $this->setData($d);
     $this->setDataDescription($dd);
     $this->setBuilder(new SimpleBuilder());
 }
示例#8
0
 protected function createData()
 {
     $data = new Data();
     $field = new Field($this->getName());
     $field->setData($this->getContent());
     $data->addField($field);
     return $data;
 }