Пример #1
0
 /**
  * @copydoc Grid::build
  */
 public function build()
 {
     if ($this->getState() == 'main') {
         if ($param = $this->getParam('bind')) {
             $this->setProperty('linkedComponent', $param);
         }
         $result = Component::build();
         if (($component = $this->document->componentManager->getBlockByName($param)) && $this->isEditable) {
             if ($this->js) {
                 $result->documentElement->appendChild($result->importNode($this->js, true));
             }
             $result->documentElement->appendChild($result->createElement('recordset'));
             if (($tbs = $this->getToolbar()) && !empty($tbs)) {
                 foreach ($tbs as $tb) {
                     if ($toolbar = $tb->build()) {
                         $result->documentElement->appendChild($result->importNode($toolbar, true));
                     }
                 }
             }
         }
     } else {
         if ($this->getType() !== self::COMPONENT_TYPE_LIST) {
             $this->setProperty('exttype', 'grid');
         }
         $result = parent::build();
     }
     return $result;
 }
Пример #2
0
 /**
  * @copydoc DataSet::build
  */
 public function build()
 {
     $result = '';
     switch ($this->getState()) {
         case 'ban':
             $result = $this->userEditor->build();
             break;
         case 'banip':
             $result = $this->banIPEditor->build();
             break;
         default:
             $result = parent::build();
             break;
     }
     return $result;
 }
Пример #3
0
 public function build()
 {
     $result = parent::build();
     try {
         if (!$this->getParam('var')) {
             throw new \InvalidArgumentException();
         }
         $code = E()->getSiteManager()->getCurrentSite()->{$this->getParam('var')};
         if (!$code) {
             throw new \InvalidArgumentException();
         }
         $result->documentElement->appendChild(new \DOMText($code));
     } catch (\InvalidArgumentException $e) {
         $result = false;
     }
     return $result;
 }