Example #1
0
 /**
  * Renders the repeated items.
  * @param THtmlWriter writer for the rendering purpose
  * @param IRepeatInfoUser repeat information user
  */
 public function renderRepeater($writer, IRepeatInfoUser $user)
 {
     if ($this->_repeatLayout === TRepeatLayout::Table) {
         $control = new TTable();
         if ($this->_caption !== '') {
             $control->setCaption($this->_caption);
             $control->setCaptionAlign($this->_captionAlign);
         }
     } else {
         if ($this->_repeatLayout === TRepeatLayout::Raw) {
             $this->renderRawContents($writer, $user);
             return;
         } else {
             $control = new TWebControl();
         }
     }
     $control->setID($user->getClientID());
     $control->copyBaseAttributes($user);
     if ($user->getHasStyle()) {
         $control->getStyle()->copyFrom($user->getStyle());
     }
     $control->renderBeginTag($writer);
     $writer->writeLine();
     if ($this->_repeatDirection === TRepeatDirection::Vertical) {
         $this->renderVerticalContents($writer, $user);
     } else {
         $this->renderHorizontalContents($writer, $user);
     }
     $control->renderEndTag($writer);
 }
Example #2
0
 /**
  * Renders the datagrid.
  * @param THtmlWriter writer for the rendering purpose
  */
 public function render($writer)
 {
     if ($this->getHasControls()) {
         $this->groupCells();
         if ($this->_useEmptyTemplate) {
             $control = new TWebControl();
             $control->setID($this->getClientID());
             $control->copyBaseAttributes($this);
             if ($this->getHasStyle()) {
                 $control->getStyle()->copyFrom($this->getStyle());
             }
             $control->renderBeginTag($writer);
             $this->renderContents($writer);
             $control->renderEndTag($writer);
         } else {
             if ($this->getViewState('ItemCount', 0) > 0) {
                 $this->applyItemStyles();
                 if ($this->_topPager) {
                     $this->_topPager->renderControl($writer);
                     $writer->writeLine();
                 }
                 $this->renderTable($writer);
                 if ($this->_bottomPager) {
                     $writer->writeLine();
                     $this->_bottomPager->renderControl($writer);
                 }
             }
         }
     }
 }