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 setCompact($very=false) { |
26
|
|
|
$table=$this->getTable(); |
27
|
|
|
if ($very) |
28
|
|
|
$table->addToPropertyCtrl("class", "very", array ("very" )); |
29
|
|
|
return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function setCollapsing() { |
33
|
|
|
return $this->addToPropertyTable("class", "collapsing"); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function setDefinition() { |
37
|
|
|
return $this->addToPropertyTable("class", "definition"); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function setStructured() { |
41
|
|
|
return $this->addToPropertyTable("class", "structured"); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function setSortable($colIndex=NULL) { |
45
|
|
|
$table=$this->getTable(); |
46
|
|
|
if (isset($colIndex) && $table->hasPart("thead")) { |
47
|
|
|
$table->getHeader()->sort($colIndex); |
48
|
|
|
} |
49
|
|
|
return $table->addToProperty("class", "sortable"); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function setSingleLine() { |
53
|
|
|
return $this->addToPropertyTable("class", "single line"); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function setFixed() { |
57
|
|
|
return $this->addToPropertyTable("class", "fixed"); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function setSelectable() { |
61
|
|
|
return $this->addToPropertyTable("class", "selectable"); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setStriped() { |
65
|
|
|
return $this->addToPropertyTable("class", "striped"); |
66
|
|
|
} |
67
|
|
|
} |