|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ajax\semantic\html\elements; |
|
4
|
|
|
|
|
5
|
|
|
use Ajax\semantic\html\base\constants\SegmentType; |
|
6
|
|
|
use Ajax\semantic\html\base\HtmlSemCollection; |
|
7
|
|
|
use Ajax\semantic\html\base\constants\Sens; |
|
8
|
|
|
use Ajax\JsUtils; |
|
9
|
|
|
|
|
10
|
|
|
class HtmlSegmentGroups extends HtmlSemCollection{ |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
public function __construct( $identifier, $items=array()){ |
|
14
|
|
|
parent::__construct( $identifier, "div","ui segments"); |
|
15
|
|
|
$this->addItems($items); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
protected function createItem($value){ |
|
20
|
|
|
return new HtmlSegment("segment-".$this->count(),$value); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
protected function createCondition($value){ |
|
24
|
|
|
return !($value instanceof HtmlSegment); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Defines the group type |
|
29
|
|
|
* @param string $type one of "raised","stacked","piled" default : "" |
|
30
|
|
|
* @return \Ajax\semantic\html\elements\HtmlSegmentGroups |
|
31
|
|
|
*/ |
|
32
|
|
|
public function setType($type){ |
|
33
|
|
|
return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function setSens($sens=Sens::VERTICAL){ |
|
37
|
|
|
return $this->addToPropertyCtrl("class", $sens, Sens::getConstants()); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function run(JsUtils $js){ |
|
41
|
|
|
$result= parent::run($js); |
|
42
|
|
|
return $result->setItemSelector(".ui.segment"); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public static function group($identifier,$items=array(),$type="",$sens=Sens::VERTICAL){ |
|
46
|
|
|
$group=new HtmlSegmentGroups($identifier,$items); |
|
47
|
|
|
$group->setSens($sens); |
|
48
|
|
|
return $group->setType($type); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
} |