Column.class.php (1273B)
1 <?php 2 3 namespace template_engine\components; 4 5 use template_engine\components\html\Component; 6 use template_engine\element\CMSElement; 7 8 class ColumnComponent extends Component 9 { 10 public $width; 11 public $style; 12 public $class; 13 public $colspan; 14 public $rowspan; 15 public $header = false; 16 public $title; 17 public $url; 18 public $action; 19 public $id; 20 public $name; 21 22 public function createElement() 23 { 24 $column = new CMSElement( ($this->header?'th':'td') ); 25 26 if ( $this->width ) 27 $column->addAttribute('width',$this->width); 28 29 if ( $this->style ) 30 $column->addAttribute('style',$this->style); 31 32 if ( $this->colspan ) 33 $column->addAttribute('colspan',$this->colspan); 34 35 if ( $this->rowspan ) 36 $column->addAttribute('rowspan',$this->rowspan); 37 38 if ( $this->rowspan ) 39 $column->addAttribute('rowspan',$this->rowspan); 40 if ( $this->title ) 41 $column->addAttribute('title',$this->title); 42 43 if ( $this->id ) 44 { 45 $column->addAttribute('data-name' ,$this->name ); 46 $column->addAttribute('data-action',$this->action); 47 $column->addAttribute('data-id' ,$this->id ); 48 $column->addStyleClass('clickable'); 49 } 50 if ( $this->class ) 51 $column->addStyleClass( Component::splitByComma($this->class) ); 52 53 return $column; 54 } 55 }