@@ -5,18 +5,18 @@ discard block |
||
5 | 5 | use Ajax\common\html\html5\HtmlCollection; |
6 | 6 | use Ajax\semantic\html\base\SegmentType; |
7 | 7 | |
8 | -class HtmlSegmentGroups extends HtmlCollection{ |
|
8 | +class HtmlSegmentGroups extends HtmlCollection { |
|
9 | 9 | |
10 | 10 | |
11 | - public function __construct( $identifier, $items=array()){ |
|
12 | - parent::__construct( $identifier, "div"); |
|
11 | + public function __construct($identifier, $items=array()) { |
|
12 | + parent::__construct($identifier, "div"); |
|
13 | 13 | $this->setClass("ui segments"); |
14 | 14 | $this->addItems($items); |
15 | 15 | } |
16 | 16 | |
17 | 17 | |
18 | - protected function createItem($value){ |
|
19 | - return new HtmlSegment("segment-".$this->count(),$value); |
|
18 | + protected function createItem($value) { |
|
19 | + return new HtmlSegment("segment-".$this->count(), $value); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | * @param string $type one of "raised","stacked","piled" default : "" |
25 | 25 | * @return \Ajax\semantic\html\elements\HtmlSegmentGroups |
26 | 26 | */ |
27 | - public function setType($type){ |
|
27 | + public function setType($type) { |
|
28 | 28 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
29 | 29 | } |
30 | 30 | |
31 | - public function setSens($sens="vertical"){ |
|
32 | - return $this->addToPropertyCtrl("class", $sens, array("vertical","horizontal")); |
|
31 | + public function setSens($sens="vertical") { |
|
32 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | - public static function group($identifier,$items=array(),$type="",$sens="vertical"){ |
|
37 | - $group=new HtmlSegmentGroups($identifier,$items); |
|
36 | + public static function group($identifier, $items=array(), $type="", $sens="vertical") { |
|
37 | + $group=new HtmlSegmentGroups($identifier, $items); |
|
38 | 38 | $group->setSens($sens); |
39 | 39 | return $group->setType($type); |
40 | 40 | } |
@@ -20,6 +20,9 @@ |
||
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + */ |
|
23 | 26 | public function __construct($identifier, $tagName="ul") { |
24 | 27 | parent::__construct($identifier, $tagName); |
25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * @param string $type one of text,item |
27 | 27 | * @return \Ajax\semantic\html\collections\HtmlMenu |
28 | 28 | */ |
29 | - public function setType($type=""){ |
|
30 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
29 | + public function setType($type="") { |
|
30 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
31 | 31 | } |
32 | 32 | |
33 | - public function setActiveItem($index){ |
|
33 | + public function setActiveItem($index) { |
|
34 | 34 | $item=$this->getItem($index); |
35 | - if($item!==null){ |
|
35 | + if ($item!==null) { |
|
36 | 36 | $item->addToProperty("class", "active"); |
37 | 37 | } |
38 | 38 | return $this; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * {@inheritDoc} |
43 | 43 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
44 | 44 | */ |
45 | - public function addItem($item){ |
|
45 | + public function addItem($item) { |
|
46 | 46 | $item=parent::addItem($item); |
47 | - if(!$item instanceof HtmlMenu) |
|
48 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
49 | - else{ |
|
47 | + if (!$item instanceof HtmlMenu) |
|
48 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
49 | + else { |
|
50 | 50 | $this->setSecondary(); |
51 | 51 | } |
52 | 52 | } |
@@ -55,51 +55,51 @@ discard block |
||
55 | 55 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
56 | 56 | */ |
57 | 57 | protected function createItem($value) { |
58 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
58 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
59 | 59 | return $itemO->setClass("item"); |
60 | 60 | } |
61 | 61 | |
62 | - public function setInverted(){ |
|
62 | + public function setInverted() { |
|
63 | 63 | return $this->addToProperty("class", "inverted"); |
64 | 64 | } |
65 | 65 | |
66 | - public function setSecondary(){ |
|
66 | + public function setSecondary() { |
|
67 | 67 | return $this->addToProperty("class", "secondary"); |
68 | 68 | } |
69 | 69 | |
70 | - public function setVertical(){ |
|
70 | + public function setVertical() { |
|
71 | 71 | return $this->addToProperty("class", "vertical"); |
72 | 72 | } |
73 | 73 | |
74 | - public function setPosition($value="right"){ |
|
75 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
74 | + public function setPosition($value="right") { |
|
75 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
76 | 76 | } |
77 | 77 | |
78 | - public function setPointing($value=Pointing::POINTING){ |
|
79 | - return $this->addToPropertyCtrl("class", $value,Pointing::getConstants()); |
|
78 | + public function setPointing($value=Pointing::POINTING) { |
|
79 | + return $this->addToPropertyCtrl("class", $value, Pointing::getConstants()); |
|
80 | 80 | } |
81 | 81 | |
82 | - public function asTab($vertical=false){ |
|
83 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
84 | - if($vertical===true) |
|
82 | + public function asTab($vertical=false) { |
|
83 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
84 | + if ($vertical===true) |
|
85 | 85 | $this->setVertical(); |
86 | 86 | return $this->addToProperty("class", "tabular"); |
87 | 87 | } |
88 | 88 | |
89 | - public function asPagination(){ |
|
90 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
89 | + public function asPagination() { |
|
90 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
91 | 91 | return $this->addToProperty("class", "pagination"); |
92 | 92 | } |
93 | 93 | |
94 | - public function setFixed(){ |
|
94 | + public function setFixed() { |
|
95 | 95 | return $this->addToProperty("class", "fixed"); |
96 | 96 | } |
97 | 97 | |
98 | - public function setFluid(){ |
|
98 | + public function setFluid() { |
|
99 | 99 | return $this->addToProperty("class", "fluid"); |
100 | 100 | } |
101 | 101 | |
102 | - public function setCompact(){ |
|
102 | + public function setCompact() { |
|
103 | 103 | return $this->addToProperty("class", "compact"); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | \ No newline at end of file |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function addItem($item){ |
46 | 46 | $item=parent::addItem($item); |
47 | - if(!$item instanceof HtmlMenu) |
|
48 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
49 | - else{ |
|
47 | + if(!$item instanceof HtmlMenu) { |
|
48 | + $item->addToPropertyCtrl("class", "item",array("item")); |
|
49 | + } else{ |
|
50 | 50 | $this->setSecondary(); |
51 | 51 | } |
52 | 52 | } |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | public function asTab($vertical=false){ |
83 | 83 | $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
84 | - if($vertical===true) |
|
85 | - $this->setVertical(); |
|
84 | + if($vertical===true) { |
|
85 | + $this->setVertical(); |
|
86 | + } |
|
86 | 87 | return $this->addToProperty("class", "tabular"); |
87 | 88 | } |
88 | 89 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
31 | 31 | } |
32 | 32 | |
33 | - public function setExclusive($value){ |
|
33 | + public function setExclusive($value) { |
|
34 | 34 | return $this->setParam("exclusive", $value); |
35 | 35 | } |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $popup the css selector of the popup |
40 | 40 | * @return \Ajax\semantic\components\Popup |
41 | 41 | */ |
42 | - public function setPopup($popup){ |
|
42 | + public function setPopup($popup) { |
|
43 | 43 | return $this->setParam("popup", $popup); |
44 | 44 | } |
45 | 45 | //TODO other events implementation |
@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Wide extends BaseEnum { |
5 | - const W1="one", W2="two", W3="three", W4="four",W5="five", W6="six", W7="seven", W8="eight",W9="nine",W10="ten",W11="eleven",W12="twelve",W13="thirteen",W14="fourteen",W15="fifteen",W16="sixteen"; |
|
5 | + const W1="one", W2="two", W3="three", W4="four", W5="five", W6="six", W7="seven", W8="eight", W9="nine", W10="ten", W11="eleven", W12="twelve", W13="thirteen", W14="fourteen", W15="fifteen", W16="sixteen"; |
|
6 | 6 | } |
7 | 7 | \ No newline at end of file |
@@ -9,8 +9,9 @@ |
||
9 | 9 | public function __construct($identifier,$width){ |
10 | 10 | parent::__construct($identifier,"div"); |
11 | 11 | $this->setClass("column"); |
12 | - if(isset($width)) |
|
13 | - $this->setWidth($width); |
|
12 | + if(isset($width)) { |
|
13 | + $this->setWidth($width); |
|
14 | + } |
|
14 | 15 | } |
15 | 16 | |
16 | 17 | public function setWidth($width){ |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlGridCol extends HtmlSemDoubleElement{ |
|
16 | - public function __construct($identifier,$width){ |
|
17 | - parent::__construct($identifier,"div"); |
|
15 | +class HtmlGridCol extends HtmlSemDoubleElement { |
|
16 | + public function __construct($identifier, $width) { |
|
17 | + parent::__construct($identifier, "div"); |
|
18 | 18 | $this->setClass("column"); |
19 | - if(isset($width)) |
|
19 | + if (isset($width)) |
|
20 | 20 | $this->setWidth($width); |
21 | 21 | } |
22 | 22 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | * @param int $width |
26 | 26 | * @return \Ajax\semantic\html\content\HtmlGridCol |
27 | 27 | */ |
28 | - public function setWidth($width){ |
|
29 | - if(\is_int($width)){ |
|
28 | + public function setWidth($width) { |
|
29 | + if (\is_int($width)) { |
|
30 | 30 | $width=Wide::getConstants()["W".$width]; |
31 | 31 | } |
32 | 32 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
33 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
33 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | * @param string $value left or right |
39 | 39 | * @return \Ajax\semantic\html\content\HtmlGridCol |
40 | 40 | */ |
41 | - public function setFloated($value="left"){ |
|
41 | + public function setFloated($value="left") { |
|
42 | 42 | return $this->addToProperty("class", $value." floated"); |
43 | 43 | } |
44 | 44 | |
45 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
46 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
45 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
46 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
47 | 47 | } |
48 | 48 | |
49 | - public function setValue($value){ |
|
49 | + public function setValue($value) { |
|
50 | 50 | $this->content=$value; |
51 | 51 | } |
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -14,10 +14,11 @@ |
||
14 | 14 | if(isset($numCols)){ |
15 | 15 | $numCols=min(16,$numCols); |
16 | 16 | $numCols=max(1,$numCols); |
17 | - if($colSizing) |
|
18 | - $width=(int)(16/$numCols); |
|
19 | - else |
|
20 | - $this->_colSize=16/$numCols; |
|
17 | + if($colSizing) { |
|
18 | + $width=(int)(16/$numCols); |
|
19 | + } else { |
|
20 | + $this->_colSize=16/$numCols; |
|
21 | + } |
|
21 | 22 | for ($i=0;$i<$numCols;$i++){ |
22 | 23 | $this->addItem($width); |
23 | 24 | } |
@@ -16,6 +16,10 @@ discard block |
||
16 | 16 | class HtmlGridRow extends HtmlCollection{ |
17 | 17 | |
18 | 18 | private $_colSize; |
19 | + |
|
20 | + /** |
|
21 | + * @param string $identifier |
|
22 | + */ |
|
19 | 23 | public function __construct( $identifier,$numCols=NULL,$colSizing=false){ |
20 | 24 | parent::__construct( $identifier,"div"); |
21 | 25 | $this->setClass("row"); |
@@ -49,7 +53,7 @@ discard block |
||
49 | 53 | /** |
50 | 54 | * return the col at $index |
51 | 55 | * @param int $index |
52 | - * @return \Ajax\semantic\html\collections\HtmlGridCol |
|
56 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
53 | 57 | */ |
54 | 58 | public function getCol($index){ |
55 | 59 | return $this->getItem($index); |
@@ -16,23 +16,23 @@ discard block |
||
16 | 16 | * @author jc |
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | -class HtmlGridRow extends HtmlCollection{ |
|
19 | +class HtmlGridRow extends HtmlCollection { |
|
20 | 20 | |
21 | 21 | private $_colSize; |
22 | 22 | private $_implicite=false; |
23 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
24 | - parent::__construct( $identifier,"div"); |
|
23 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
24 | + parent::__construct($identifier, "div"); |
|
25 | 25 | $this->_implicite=$implicite; |
26 | 26 | $this->setClass("row"); |
27 | 27 | $width=null; |
28 | - if(isset($numCols)){ |
|
29 | - $numCols=min(16,$numCols); |
|
30 | - $numCols=max(1,$numCols); |
|
31 | - if($colSizing) |
|
32 | - $width=(int)(16/$numCols); |
|
28 | + if (isset($numCols)) { |
|
29 | + $numCols=min(16, $numCols); |
|
30 | + $numCols=max(1, $numCols); |
|
31 | + if ($colSizing) |
|
32 | + $width=(int) (16 / $numCols); |
|
33 | 33 | else |
34 | - $this->_colSize=16/$numCols; |
|
35 | - for ($i=0;$i<$numCols;$i++){ |
|
34 | + $this->_colSize=16 / $numCols; |
|
35 | + for ($i=0; $i<$numCols; $i++) { |
|
36 | 36 | $this->addItem($width); |
37 | 37 | } |
38 | 38 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | * @param int $width |
44 | 44 | * @return \Ajax\semantic\html\content\HtmlGridRow |
45 | 45 | */ |
46 | - public function setWidth($width){ |
|
47 | - if(\is_int($width)){ |
|
46 | + public function setWidth($width) { |
|
47 | + if (\is_int($width)) { |
|
48 | 48 | $width=Wide::getConstants()["W".$width]; |
49 | 49 | } |
50 | 50 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
51 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
51 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param int $index |
57 | 57 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
58 | 58 | */ |
59 | - public function getCol($index){ |
|
59 | + public function getCol($index) { |
|
60 | 60 | return $this->getItem($index); |
61 | 61 | } |
62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * stretch the row contents to take up the entire column height |
65 | 65 | * @return \Ajax\semantic\html\content\HtmlGridRow |
66 | 66 | */ |
67 | - public function setStretched(){ |
|
67 | + public function setStretched() { |
|
68 | 68 | return $this->addToProperty("class", "stretched"); |
69 | 69 | } |
70 | 70 | |
@@ -72,23 +72,23 @@ discard block |
||
72 | 72 | * @param string $color |
73 | 73 | * @return \Ajax\semantic\html\content\HtmlGridRow |
74 | 74 | */ |
75 | - public function setColor($color){ |
|
76 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
75 | + public function setColor($color) { |
|
76 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
77 | 77 | } |
78 | 78 | |
79 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
80 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
79 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
80 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
81 | 81 | } |
82 | 82 | |
83 | - public function setValues($values,$force=false){ |
|
83 | + public function setValues($values, $force=false) { |
|
84 | 84 | $count=$this->count(); |
85 | - if($force===true){ |
|
86 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
87 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
85 | + if ($force===true) { |
|
86 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
87 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
88 | 88 | } |
89 | 89 | } |
90 | - $count=\min(array($this->count(),\sizeof($values))); |
|
91 | - for($i=0;$i<$count;$i++){ |
|
90 | + $count=\min(array($this->count(), \sizeof($values))); |
|
91 | + for ($i=0; $i<$count; $i++) { |
|
92 | 92 | $this->content[$i]->setValue($values[$i]); |
93 | 93 | } |
94 | 94 | } |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | * {@inheritDoc} |
98 | 98 | * @see \Ajax\common\html\HtmlCollection::createItem() |
99 | 99 | */ |
100 | - protected function createItem($value){ |
|
101 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
100 | + protected function createItem($value) { |
|
101 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
102 | 102 | return $col; |
103 | 103 | } |
104 | 104 | |
105 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
106 | - if($this->_implicite===true){ |
|
105 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
106 | + if ($this->_implicite===true) { |
|
107 | 107 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
108 | 108 | } |
109 | - return parent::compile($js,$view); |
|
109 | + return parent::compile($js, $view); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |
@@ -25,47 +25,47 @@ |
||
25 | 25 | * @param string $type one of "raised","stacked","piled" default : "" |
26 | 26 | * @return \Ajax\semantic\html\elements\HtmlSegment |
27 | 27 | */ |
28 | - public function setType($type){ |
|
28 | + public function setType($type) { |
|
29 | 29 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
30 | 30 | } |
31 | 31 | |
32 | - public function setSens($sens="vertical"){ |
|
33 | - return $this->addToPropertyCtrl("class", $sens, array("vertical","horizontal")); |
|
32 | + public function setSens($sens="vertical") { |
|
33 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
34 | 34 | } |
35 | 35 | |
36 | - public function setInverted(){ |
|
36 | + public function setInverted() { |
|
37 | 37 | return $this->addToProperty("class", "inverted"); |
38 | 38 | } |
39 | 39 | |
40 | - public function setAttached(){ |
|
40 | + public function setAttached() { |
|
41 | 41 | return $this->addToProperty("class", "attached"); |
42 | 42 | } |
43 | 43 | |
44 | - public function setEmphasis($value="secondary"){ |
|
45 | - return $this->addToPropertyCtrl("class", $value, array("secondary","tertiary","")); |
|
44 | + public function setEmphasis($value="secondary") { |
|
45 | + return $this->addToPropertyCtrl("class", $value, array("secondary", "tertiary", "")); |
|
46 | 46 | } |
47 | 47 | |
48 | - public function setCircular(){ |
|
48 | + public function setCircular() { |
|
49 | 49 | return $this->addToProperty("class", "circular"); |
50 | 50 | } |
51 | 51 | |
52 | - public function clear(){ |
|
52 | + public function clear() { |
|
53 | 53 | return $this->addToProperty("class", "clearing"); |
54 | 54 | } |
55 | 55 | |
56 | - public function setFloating($value="left"){ |
|
57 | - return $this->addToPropertyCtrl("class", "floated ".$value,array("floated right","floated left")); |
|
56 | + public function setFloating($value="left") { |
|
57 | + return $this->addToPropertyCtrl("class", "floated ".$value, array("floated right", "floated left")); |
|
58 | 58 | } |
59 | 59 | |
60 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
61 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
60 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
61 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
62 | 62 | } |
63 | 63 | |
64 | - public function setCompact(){ |
|
64 | + public function setCompact() { |
|
65 | 65 | return $this->addToProperty("class", "compact"); |
66 | 66 | } |
67 | 67 | |
68 | - public function setBasic(){ |
|
68 | + public function setBasic() { |
|
69 | 69 | return $this->setProperty("class", "ui basic segment"); |
70 | 70 | } |
71 | 71 |
@@ -101,8 +101,9 @@ discard block |
||
101 | 101 | * @return \Ajax\semantic\html\collections\HtmlGrid |
102 | 102 | */ |
103 | 103 | public function setPadded($value=NULL){ |
104 | - if(isset($value)) |
|
105 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
104 | + if(isset($value)) { |
|
105 | + $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
106 | + } |
|
106 | 107 | return $this->addToProperty("class", "padded"); |
107 | 108 | } |
108 | 109 | |
@@ -124,8 +125,9 @@ discard block |
||
124 | 125 | * @see \Ajax\common\html\HtmlCollection::createItem() |
125 | 126 | */ |
126 | 127 | protected function createItem($value){ |
127 | - if($this->_createCols===false) |
|
128 | - $value=null; |
|
128 | + if($this->_createCols===false) { |
|
129 | + $value=null; |
|
130 | + } |
|
129 | 131 | $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing); |
130 | 132 | return $item; |
131 | 133 | } |
@@ -19,6 +19,11 @@ discard block |
||
19 | 19 | private $_createCols; |
20 | 20 | private $_colSizing=true; |
21 | 21 | private $_implicitRows=false; |
22 | + |
|
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + * @param integer $numCols |
|
26 | + */ |
|
22 | 27 | public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
23 | 28 | parent::__construct( $identifier, "div"); |
24 | 29 | $this->_implicitRows=$implicitRows; |
@@ -51,7 +56,7 @@ discard block |
||
51 | 56 | /** |
52 | 57 | * return the row at $index |
53 | 58 | * @param int $index |
54 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
59 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
55 | 60 | */ |
56 | 61 | public function getRow($index){ |
57 | 62 | return $this->getItem($index); |
@@ -14,24 +14,24 @@ discard block |
||
14 | 14 | * @author jc |
15 | 15 | * @version 1.001 |
16 | 16 | */ |
17 | -class HtmlGrid extends HtmlCollection{ |
|
17 | +class HtmlGrid extends HtmlCollection { |
|
18 | 18 | |
19 | 19 | private $_createCols; |
20 | 20 | private $_colSizing=true; |
21 | 21 | private $_implicitRows=false; |
22 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
23 | - parent::__construct( $identifier, "div"); |
|
22 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
23 | + parent::__construct($identifier, "div"); |
|
24 | 24 | $this->_implicitRows=$implicitRows; |
25 | 25 | $this->_createCols=$createCols; |
26 | - if(isset($numCols)){ |
|
26 | + if (isset($numCols)) { |
|
27 | 27 | //if($this->_createCols){ |
28 | 28 | $this->_colSizing=false; |
29 | 29 | //} |
30 | 30 | $cols=Wide::getConstants()["W".$numCols]; |
31 | 31 | $this->setClass($cols." column"); |
32 | 32 | } |
33 | - $this->addToProperty("class","ui grid"); |
|
34 | - $this->setNumRows($numRows,$numCols); |
|
33 | + $this->addToProperty("class", "ui grid"); |
|
34 | + $this->setNumRows($numRows, $numCols); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * @param int $numCols |
41 | 41 | * @return \Ajax\semantic\html\collections\HtmlGrid |
42 | 42 | */ |
43 | - public function setNumRows($numRows,$numCols=NULL){ |
|
43 | + public function setNumRows($numRows, $numCols=NULL) { |
|
44 | 44 | $count=$this->count(); |
45 | - for($i=$count;$i<$numRows;$i++){ |
|
45 | + for ($i=$count; $i<$numRows; $i++) { |
|
46 | 46 | $this->addItem($numCols); |
47 | 47 | } |
48 | 48 | return $this; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param int $index |
54 | 54 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
55 | 55 | */ |
56 | - public function getRow($index){ |
|
56 | + public function getRow($index) { |
|
57 | 57 | return $this->getItem($index); |
58 | 58 | } |
59 | 59 | |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | * @param int $col |
63 | 63 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
64 | 64 | */ |
65 | - public function getCell($row,$col){ |
|
65 | + public function getCell($row, $col) { |
|
66 | 66 | $row=$this->getItem($row); |
67 | - if(isset($row)){ |
|
67 | + if (isset($row)) { |
|
68 | 68 | $col=$row->getItem($col); |
69 | 69 | } |
70 | 70 | return $col; |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @param boolean $vertically |
76 | 76 | * @return \Ajax\semantic\html\collections\HtmlGrid |
77 | 77 | */ |
78 | - public function setDivided($vertically=false){ |
|
79 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
78 | + public function setDivided($vertically=false) { |
|
79 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
80 | 80 | return $this->addToProperty("class", $value); |
81 | 81 | } |
82 | 82 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @param boolean $internal true for internal cells |
86 | 86 | * @return \Ajax\semantic\html\collections\HtmlGrid |
87 | 87 | */ |
88 | - public function setCelled($internal=false){ |
|
89 | - $value=($internal===true)?"internal celled":"celled"; |
|
88 | + public function setCelled($internal=false) { |
|
89 | + $value=($internal===true) ? "internal celled" : "celled"; |
|
90 | 90 | return $this->addToProperty("class", $value); |
91 | 91 | } |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * automatically resize all elements to split the available width evenly |
95 | 95 | * @return \Ajax\semantic\html\collections\HtmlGrid |
96 | 96 | */ |
97 | - public function setEqualWidth(){ |
|
97 | + public function setEqualWidth() { |
|
98 | 98 | return $this->addToProperty("class", "equal width"); |
99 | 99 | } |
100 | 100 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * @param string $value |
104 | 104 | * @return \Ajax\semantic\html\collections\HtmlGrid |
105 | 105 | */ |
106 | - public function setPadded($value=NULL){ |
|
107 | - if(isset($value)) |
|
108 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
106 | + public function setPadded($value=NULL) { |
|
107 | + if (isset($value)) |
|
108 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
109 | 109 | return $this->addToProperty("class", "padded"); |
110 | 110 | } |
111 | 111 | |
@@ -113,41 +113,41 @@ discard block |
||
113 | 113 | * @param boolean $very |
114 | 114 | * @return \Ajax\semantic\html\collections\HtmlGrid |
115 | 115 | */ |
116 | - public function setRelaxed($very=false){ |
|
117 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
116 | + public function setRelaxed($very=false) { |
|
117 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
118 | 118 | return $this->addToProperty("class", $value); |
119 | 119 | } |
120 | 120 | |
121 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
122 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
121 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
122 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
123 | 123 | } |
124 | 124 | |
125 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
126 | - return $this->addToPropertyCtrl("class", $value,VerticalAlignment::getConstants()); |
|
125 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
126 | + return $this->addToPropertyCtrl("class", $value, VerticalAlignment::getConstants()); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
130 | 130 | * {@inheritDoc} |
131 | 131 | * @see \Ajax\common\html\HtmlCollection::createItem() |
132 | 132 | */ |
133 | - protected function createItem($value){ |
|
134 | - if($this->_createCols===false) |
|
133 | + protected function createItem($value) { |
|
134 | + if ($this->_createCols===false) |
|
135 | 135 | $value=null; |
136 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
136 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
137 | 137 | return $item; |
138 | 138 | } |
139 | 139 | |
140 | - public function setValues($values){ |
|
140 | + public function setValues($values) { |
|
141 | 141 | $count=$this->count(); |
142 | - if($this->_createCols===false){ |
|
143 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
142 | + if ($this->_createCols===false) { |
|
143 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
144 | 144 | $colSize=\sizeof($values[$i]); |
145 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
145 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
146 | 146 | } |
147 | 147 | } |
148 | - $count=\min(array($this->count(),\sizeof($values))); |
|
149 | - for($i=0;$i<$count;$i++){ |
|
150 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
148 | + $count=\min(array($this->count(), \sizeof($values))); |
|
149 | + for ($i=0; $i<$count; $i++) { |
|
150 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | class TextAlignment extends BaseEnum { |
8 | - const LEFT="left aligned",CENTER="center aligned",RIGHT="right aligned",JUSTIFIED="justified"; |
|
8 | + const LEFT="left aligned", CENTER="center aligned", RIGHT="right aligned", JUSTIFIED="justified"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |