Example #1
0
 /**
  * Renders the openning tag for the datagrid control which will render table caption if present.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function renderBeginTag($writer)
 {
     parent::renderBeginTag($writer);
     if (($caption = $this->getCaption()) !== '') {
         if (($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) {
             $writer->addAttribute('align', strtolower($align));
         }
         $writer->renderBeginTag('caption');
         $writer->write($caption);
         $writer->renderEndTag();
     }
 }
Example #2
0
 /**
  * Renders the data list control.
  * This method overrides the parent implementation.
  * @param THtmlWriter writer for rendering purpose.
  */
 public function render($writer)
 {
     if ($this->getHasControls()) {
         if ($this->getItemCount() > 0) {
             $this->applyItemStyles();
             $repeatInfo = $this->getRepeatInfo();
             $repeatInfo->renderRepeater($writer, $this);
         } else {
             if ($this->_emptyTemplate !== null || $this->getEmptyRenderer() !== '') {
                 parent::render($writer);
             }
         }
     }
 }
 /**
  * Returns the attributes to be rendered.
  * This method overrides the parent's implementation to default to 
  * adding a [] to the name
  * @return ArrayObject attributes to be rendered
  */
 protected function getAttributesToRender()
 {
     $url = $this->getBackImageUrl();
     if (strlen($url)) {
         $this->setStyle(array('background-image' => "url({$url})"));
     }
     $attributes = parent::getAttributesToRender();
     if (($cellSpacing = $this->getCellSpacing()) >= 0) {
         $attributes['cellspacing'] = $cellSpacing;
     } else {
         $attributes['cellspacing'] = '0';
     }
     if (($cellPadding = $this->getCellPadding()) >= 0) {
         $attributes['cellpadding'] = $cellPadding;
     } else {
         $attributes['cellpadding'] = '0';
     }
     $grid = $this->getGridLines();
     if ($grid != 'None') {
         if ($grid == 'Horizontal') {
             $attributes['rules'] = 'rows';
         } else {
             if ($grid == 'Both') {
                 $attributes['rules'] = 'all';
             } else {
                 if ($grid == 'Vertical') {
                     $attributes['rules'] = 'cols';
                 }
             }
         }
         if (!isset($attributes['border'])) {
             $attributes['border'] = '1';
         }
     }
     $align = $this->getHorizontalAlign();
     if ($align != 'NotSet') {
         $attributes['align'] = $align;
     }
     return $attributes;
 }
 /**
  * Returns the attributes to be rendered.
  * @return ArrayObject attributes to be rendered
  */
 protected function getAttributesToRender()
 {
     $attributes = parent::getAttributesToRender();
     if ($this->getRepeatLayout() === 'Table') {
         if (($cellSpacing = $this->getCellSpacing()) >= 0) {
             $attributes['cellspacing'] = $cellSpacing;
         } else {
             $attributes['cellspacing'] = '0';
         }
         if (($cellPadding = $this->getCellPadding()) >= 0) {
             $attributes['cellpadding'] = $cellPadding;
         } else {
             $attributes['cellpadding'] = '0';
         }
         $grid = $this->getGridLines();
         if ($grid != 'None') {
             if ($grid == 'Horizontal') {
                 $attributes['rules'] = 'rows';
             } else {
                 if ($grid == 'Both') {
                     $attributes['rules'] = 'all';
                 } else {
                     if ($grid == 'Vertical') {
                         $attributes['rules'] = 'cols';
                     }
                 }
             }
             if (!isset($attributes['border'])) {
                 $attributes['border'] = '1';
             }
         }
         $align = $this->getHorizontalAlign();
         if ($align != 'NotSet') {
             $attributes['align'] = $align;
         }
     }
     return $attributes;
 }