openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

ColumnComponent.class.php (1168B)


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