@@ -81,6 +81,9 @@ discard block |
||
81 | 81 | $this->addItems($function($object)); |
82 | 82 | } |
83 | 83 | |
84 | + /** |
|
85 | + * @param \Closure $callBack |
|
86 | + */ |
|
84 | 87 | public function apply($callBack){ |
85 | 88 | foreach ($this->content as $item){ |
86 | 89 | $callBack($item); |
@@ -96,7 +99,7 @@ discard block |
||
96 | 99 | } |
97 | 100 | /** |
98 | 101 | * The item factory |
99 | - * @param string|HtmlDoubleElement $value |
|
102 | + * @param string $value |
|
100 | 103 | */ |
101 | 104 | protected abstract function createItem($value); |
102 | 105 | } |
103 | 106 | \ No newline at end of file |
@@ -7,29 +7,29 @@ discard block |
||
7 | 7 | |
8 | 8 | abstract class HtmlCollection extends HtmlDoubleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$tagName="div"){ |
|
11 | - parent::__construct($identifier,$tagName); |
|
10 | + public function __construct($identifier, $tagName="div") { |
|
11 | + parent::__construct($identifier, $tagName); |
|
12 | 12 | $this->content=array(); |
13 | 13 | } |
14 | 14 | |
15 | - public function addItems($items){ |
|
16 | - if(JArray::isAssociative($items)){ |
|
17 | - foreach ($items as $k=>$v){ |
|
18 | - $this->addItem([$k,$v]); |
|
15 | + public function addItems($items) { |
|
16 | + if (JArray::isAssociative($items)) { |
|
17 | + foreach ($items as $k=>$v) { |
|
18 | + $this->addItem([$k, $v]); |
|
19 | 19 | } |
20 | - }else{ |
|
21 | - foreach ($items as $item){ |
|
20 | + }else { |
|
21 | + foreach ($items as $item) { |
|
22 | 22 | $this->addItem($item); |
23 | 23 | } |
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | - public function setItems($items){ |
|
27 | + public function setItems($items) { |
|
28 | 28 | $this->content=$items; |
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
32 | - public function getItems(){ |
|
32 | + public function getItems() { |
|
33 | 33 | return $this->content; |
34 | 34 | } |
35 | 35 | |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * @param HtmlDoubleElement|string $item |
39 | 39 | * @return \Ajax\common\html\HtmlDoubleElement |
40 | 40 | */ |
41 | - public function addItem($item){ |
|
41 | + public function addItem($item) { |
|
42 | 42 | $itemO=$item; |
43 | - if(\is_object($item)===false){ |
|
43 | + if (\is_object($item)===false) { |
|
44 | 44 | $itemO=$this->createItem($item); |
45 | 45 | } |
46 | 46 | $this->addContent($itemO); |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | return $this; |
67 | 67 | } |
68 | 68 | |
69 | - public function removeItem($index){ |
|
69 | + public function removeItem($index) { |
|
70 | 70 | return array_splice($this->content, $index, 1); |
71 | 71 | } |
72 | 72 | |
73 | - public function count(){ |
|
73 | + public function count() { |
|
74 | 74 | return \sizeof($this->content); |
75 | 75 | } |
76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $this->addItems($function($object)); |
82 | 82 | } |
83 | 83 | |
84 | - public function apply($callBack){ |
|
85 | - foreach ($this->content as $item){ |
|
84 | + public function apply($callBack) { |
|
85 | + foreach ($this->content as $item) { |
|
86 | 86 | $callBack($item); |
87 | 87 | } |
88 | 88 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | foreach ($items as $k=>$v){ |
18 | 18 | $this->addItem([$k,$v]); |
19 | 19 | } |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | foreach ($items as $item){ |
22 | 22 | $this->addItem($item); |
23 | 23 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
54 | 54 | */ |
55 | 55 | public function getItem($index) { |
56 | - if (is_int($index)) |
|
57 | - return $this->content[$index]; |
|
58 | - else { |
|
56 | + if (is_int($index)) { |
|
57 | + return $this->content[$index]; |
|
58 | + } else { |
|
59 | 59 | $elm=$this->getElementById($index, $this->content); |
60 | 60 | return $elm; |
61 | 61 | } |
@@ -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 |
@@ -9,6 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | class HtmlLabel extends HtmlSemDoubleElement { |
11 | 11 | |
12 | + /** |
|
13 | + * @param string $identifier |
|
14 | + */ |
|
12 | 15 | public function __construct($identifier,$caption="",$tagName="div") { |
13 | 16 | parent::__construct($identifier,$tagName); |
14 | 17 | $this->setProperty("class", "ui label"); |
@@ -16,7 +19,6 @@ discard block |
||
16 | 19 | } |
17 | 20 | |
18 | 21 | /** |
19 | - * @param string $side |
|
20 | 22 | * @return \Ajax\semantic\html\elements\HtmlLabel |
21 | 23 | */ |
22 | 24 | public function setPointing($value=Pointing::POINTING){ |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | |
10 | 10 | class HtmlLabel extends HtmlSemDoubleElement { |
11 | 11 | |
12 | - public function __construct($identifier,$caption="",$tagName="div") { |
|
13 | - parent::__construct($identifier,$tagName); |
|
12 | + public function __construct($identifier, $caption="", $tagName="div") { |
|
13 | + parent::__construct($identifier, $tagName); |
|
14 | 14 | $this->setProperty("class", "ui label"); |
15 | 15 | $this->content=$caption; |
16 | 16 | } |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | * @param string $side |
20 | 20 | * @return \Ajax\semantic\html\elements\HtmlLabel |
21 | 21 | */ |
22 | - public function setPointing($value=Pointing::POINTING){ |
|
23 | - return $this->addToPropertyCtrl("class", $value,Pointing::getConstants()); |
|
22 | + public function setPointing($value=Pointing::POINTING) { |
|
23 | + return $this->addToPropertyCtrl("class", $value, Pointing::getConstants()); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @param string $side |
28 | 28 | * @return \Ajax\semantic\html\elements\HtmlLabel |
29 | 29 | */ |
30 | - public function toCorner($side="left"){ |
|
31 | - return $this->addToPropertyCtrl("class", $side." corner",array("right corner","left corner")); |
|
30 | + public function toCorner($side="left") { |
|
31 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @return \Ajax\semantic\html\elements\HtmlLabel |
36 | 36 | */ |
37 | - public function asTag(){ |
|
37 | + public function asTag() { |
|
38 | 38 | return $this->addToProperty("class", "tag"); |
39 | 39 | } |
40 | 40 | |
41 | - public function setBasic(){ |
|
41 | + public function setBasic() { |
|
42 | 42 | return $this->addToProperty("class", "basic"); |
43 | 43 | } |
44 | 44 | |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | * @param string $before |
50 | 50 | * @return \Ajax\semantic\html\elements\HtmlLabel |
51 | 51 | */ |
52 | - public function addImage($src,$alt="",$before=true){ |
|
52 | + public function addImage($src, $alt="", $before=true) { |
|
53 | 53 | $this->addToProperty("class", "image"); |
54 | - return $this->addContent(new HtmlImg("image-".$this->identifier,$src,$alt),$before); |
|
54 | + return $this->addContent(new HtmlImg("image-".$this->identifier, $src, $alt), $before); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @param string $detail |
59 | 59 | * @return \Ajax\common\html\HtmlDoubleElement |
60 | 60 | */ |
61 | - public function addDetail($detail){ |
|
62 | - $div=new HtmlDoubleElement("detail-".$this->identifier,$this->tagName); |
|
61 | + public function addDetail($detail) { |
|
62 | + $div=new HtmlDoubleElement("detail-".$this->identifier, $this->tagName); |
|
63 | 63 | $div->setClass("detail"); |
64 | 64 | $div->setContent($detail); |
65 | 65 | $this->addContent($div); |
@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Size extends BaseEnum { |
5 | - const MASSIVE="massive",HUGE="huge",BIG="big",LARGE="large",MEDIUM="",SMALL="small",MINI="mini",TINY="tiny"; |
|
5 | + const MASSIVE="massive", HUGE="huge", BIG="big", LARGE="large", MEDIUM="", SMALL="small", MINI="mini", TINY="tiny"; |
|
6 | 6 | } |
7 | 7 | \ No newline at end of file |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | class HtmlHeader extends HtmlSemDoubleElement { |
10 | 10 | |
11 | - public function __construct($identifier, $niveau=1,$content=NULL,$type="page") { |
|
11 | + public function __construct($identifier, $niveau=1, $content=NULL, $type="page") { |
|
12 | 12 | parent::__construct($identifier, "div"); |
13 | 13 | $this->setClass("ui header"); |
14 | - if(isset($type)){ |
|
15 | - if($type=="page"){ |
|
14 | + if (isset($type)) { |
|
15 | + if ($type=="page") { |
|
16 | 16 | $this->asPageHeader($niveau); |
17 | 17 | }else |
18 | 18 | $this->asContentHeader($niveau); |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | $this->content=$content; |
21 | 21 | } |
22 | 22 | |
23 | - public function asPageHeader($niveau){ |
|
23 | + public function asPageHeader($niveau) { |
|
24 | 24 | $this->tagName="h".$niveau; |
25 | 25 | } |
26 | 26 | |
27 | - public function asContentHeader($niveau){ |
|
27 | + public function asContentHeader($niveau) { |
|
28 | 28 | $this->tagName="div"; |
29 | - if(\is_int($niveau)){ |
|
29 | + if (\is_int($niveau)) { |
|
30 | 30 | $niveau=Size::getConstantValues()[$niveau]; |
31 | 31 | } |
32 | 32 | $this->setSize($niveau); |
33 | 33 | } |
34 | 34 | |
35 | - public function asIcon($icon,$content,$subHeader=NULL){ |
|
35 | + public function asIcon($icon, $content, $subHeader=NULL) { |
|
36 | 36 | $this->addToProperty("class", "icon"); |
37 | 37 | $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
38 | - $contentElm=new HtmlDoubleElement("content-".$this->identifier,"div"); |
|
38 | + $contentElm=new HtmlDoubleElement("content-".$this->identifier, "div"); |
|
39 | 39 | $contentElm->setClass("content")->setContent($content); |
40 | - if(isset($subHeader)){ |
|
41 | - $sub=new HtmlDoubleElement("subheader-".$this->identifier,"div"); |
|
40 | + if (isset($subHeader)) { |
|
41 | + $sub=new HtmlDoubleElement("subheader-".$this->identifier, "div"); |
|
42 | 42 | $sub->setClass("sub header"); |
43 | 43 | $sub->setContent($subHeader); |
44 | 44 | $contentElm->addContent($sub); |
45 | 45 | } |
46 | - $this->content=array($icon,$contentElm); |
|
46 | + $this->content=array($icon, $contentElm); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -14,8 +14,9 @@ |
||
14 | 14 | if(isset($type)){ |
15 | 15 | if($type=="page"){ |
16 | 16 | $this->asPageHeader($niveau); |
17 | - }else |
|
18 | - $this->asContentHeader($niveau); |
|
17 | + } else { |
|
18 | + $this->asContentHeader($niveau); |
|
19 | + } |
|
19 | 20 | } |
20 | 21 | $this->content=$content; |
21 | 22 | } |
@@ -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 |
@@ -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 |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlIconMenu extends HtmlMenu{ |
|
15 | +class HtmlIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "icon"); |
25 | 25 | } |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | protected function createItem($value) { |
33 | 33 | $count=\sizeof($this->content); |
34 | 34 | $value=new HtmlIcon("icon-".$count, $value); |
35 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
35 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
36 | 36 | return $itemO->setClass("item"); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlLabeledIconMenu extends HtmlMenu{ |
|
15 | +class HtmlLabeledIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "labeled icon"); |
25 | 25 | } |
26 | 26 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | protected function createItem($value) { |
32 | 32 | $text=""; |
33 | 33 | $v=$value; |
34 | - if(\is_array($value)){ |
|
34 | + if (\is_array($value)) { |
|
35 | 35 | $v=@$value[0]; |
36 | 36 | $text=@$value[1]; |
37 | 37 | } |
38 | 38 | $count=\sizeof($this->content); |
39 | 39 | $value=new HtmlIcon("icon-".$count, $v); |
40 | - $value->wrap("",$text); |
|
41 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
40 | + $value->wrap("", $text); |
|
41 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
42 | 42 | return $itemO->setClass("item"); |
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |