1
|
|
|
<?php |
2
|
|
|
namespace Ajax\semantic\html\collections\table\traits; |
3
|
|
|
|
4
|
|
|
trait TableTrait{ |
5
|
|
|
/** |
6
|
|
|
* @return HtmlTable |
7
|
|
|
*/ |
8
|
|
|
abstract protected function getTable(); |
9
|
|
|
|
10
|
|
|
protected function addToPropertyTable($property,$value){ |
11
|
|
|
return $this->getTable()->addToProperty($property, $value); |
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
public function setCelled() { |
15
|
|
|
return $this->addToPropertyTable("class", "celled"); |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
public function setBasic($very=false) { |
19
|
|
|
$table=$this->getTable(); |
20
|
|
|
if ($very) |
21
|
|
|
$table->addToPropertyCtrl("class", "very", array ("very" )); |
22
|
|
|
return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function setCollapsing() { |
26
|
|
|
return $this->addToPropertyTable("class", "collapsing"); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function setDefinition() { |
30
|
|
|
return $this->addToPropertyTable("class", "definition"); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function setStructured() { |
34
|
|
|
return $this->addToPropertyTable("class", "structured"); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function setSortable($colIndex=NULL) { |
38
|
|
|
$table=$this->getTable(); |
39
|
|
|
if (isset($colIndex) && $table->hasPart("thead")) { |
40
|
|
|
$table->getHeader()->sort($colIndex); |
41
|
|
|
} |
42
|
|
|
return $table->addToProperty("class", "sortable"); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function setSingleLine() { |
46
|
|
|
return $this->addToPropertyTable("class", "single line"); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function setFixed() { |
50
|
|
|
return $this->addToPropertyTable("class", "fixed"); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function setSelectable() { |
54
|
|
|
return $this->addToPropertyTable("class", "selectable"); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function setStriped() { |
58
|
|
|
return $this->addToPropertyTable("class", "striped"); |
59
|
|
|
} |
60
|
|
|
} |