@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class RevealType extends BaseEnum { |
8 | - const FADE="fade",MOVE="move",ROTATE="rotate"; |
|
8 | + const FADE="fade", MOVE="move", ROTATE="rotate"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
14 | 14 | public abstract function addToProperty($name, $value, $separator=" "); |
15 | 15 | |
16 | - public function addVariation($variation){ |
|
16 | + public function addVariation($variation) { |
|
17 | 17 | return $this->addToPropertyCtrl("class", $variation, $this->_variations); |
18 | 18 | } |
19 | 19 | |
20 | - public function addState($state){ |
|
20 | + public function addState($state) { |
|
21 | 21 | return $this->addToPropertyCtrl("class", $state, $this->_states); |
22 | 22 | } |
23 | 23 | |
24 | - public function setVariation($variation){ |
|
24 | + public function setVariation($variation) { |
|
25 | 25 | $this->setPropertyCtrl("class", $variation, $this->_variations); |
26 | 26 | return $this->addToProperty("class", $this->_baseClass); |
27 | 27 | } |
28 | 28 | |
29 | - public function setState($state){ |
|
29 | + public function setState($state) { |
|
30 | 30 | $this->setPropertyCtrl("class", $state, $this->_states); |
31 | 31 | return $this->addToProperty("class", $this->_baseClass); |
32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * {@inheritDoc} |
36 | 36 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
37 | 37 | */ |
38 | - public function setSize($size){ |
|
38 | + public function setSize($size) { |
|
39 | 39 | return $this->addToPropertyCtrl("class", $size, Size::getConstants()); |
40 | 40 | } |
41 | 41 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * show it is currently unable to be interacted with |
44 | 44 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
45 | 45 | */ |
46 | - public function setDisabled(){ |
|
46 | + public function setDisabled() { |
|
47 | 47 | return $this->addToProperty("class", "disabled"); |
48 | 48 | } |
49 | 49 | |
@@ -51,25 +51,25 @@ discard block |
||
51 | 51 | * @param string $color |
52 | 52 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
53 | 53 | */ |
54 | - public function setColor($color){ |
|
55 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
54 | + public function setColor($color) { |
|
55 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
60 | 60 | */ |
61 | - public function setFluid(){ |
|
61 | + public function setFluid() { |
|
62 | 62 | return $this->addToProperty("class", "fluid"); |
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | 66 | * can be formatted to appear on dark backgrounds |
67 | 67 | */ |
68 | - public function setInverted(){ |
|
68 | + public function setInverted() { |
|
69 | 69 | return $this->addToProperty("class", "inverted"); |
70 | 70 | } |
71 | 71 | |
72 | - public function setCircular(){ |
|
72 | + public function setCircular() { |
|
73 | 73 | return $this->addToProperty("class", "circular"); |
74 | 74 | } |
75 | 75 | } |
76 | 76 | \ No newline at end of file |
@@ -16,26 +16,26 @@ discard block |
||
16 | 16 | * @author jc |
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | -class HtmlGrid extends HtmlSemCollection{ |
|
19 | +class HtmlGrid extends HtmlSemCollection { |
|
20 | 20 | use TextAlignmentTrait; |
21 | 21 | private $_createCols; |
22 | 22 | private $_colSizing=true; |
23 | 23 | private $_implicitRows=false; |
24 | 24 | |
25 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
26 | - parent::__construct( $identifier, "div","ui grid"); |
|
25 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
26 | + parent::__construct($identifier, "div", "ui grid"); |
|
27 | 27 | $this->_implicitRows=$implicitRows; |
28 | 28 | $this->_createCols=$createCols; |
29 | - if(isset($numCols)){ |
|
29 | + if (isset($numCols)) { |
|
30 | 30 | //if($this->_createCols){ |
31 | 31 | $this->_colSizing=false; |
32 | 32 | //} |
33 | 33 | $this->setWide($numCols); |
34 | 34 | } |
35 | - $this->setRowsCount($numRows,$numCols); |
|
35 | + $this->setRowsCount($numRows, $numCols); |
|
36 | 36 | } |
37 | 37 | |
38 | - public function asSegment(){ |
|
38 | + public function asSegment() { |
|
39 | 39 | return $this->addToPropertyCtrl("class", "segment", array("segment")); |
40 | 40 | } |
41 | 41 | |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * Defines the grid width (alias for setWidth) |
44 | 44 | * @param int $wide |
45 | 45 | */ |
46 | - public function setWide($wide){ |
|
46 | + public function setWide($wide) { |
|
47 | 47 | $wide=Wide::getConstants()["W".$wide]; |
48 | 48 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
49 | - return $this->addToPropertyCtrl("class","column",array("column")); |
|
49 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param int $width |
55 | 55 | * @return \Ajax\semantic\html\collections\HtmlGrid |
56 | 56 | */ |
57 | - public function setWidth($width){ |
|
57 | + public function setWidth($width) { |
|
58 | 58 | return $this->setWide($width); |
59 | 59 | } |
60 | 60 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param int $colsCount number of columns to create |
64 | 64 | * @return mixed |
65 | 65 | */ |
66 | - public function addRow($colsCount=NULL){ |
|
66 | + public function addRow($colsCount=NULL) { |
|
67 | 67 | $rowCount=$this->rowCount()+1; |
68 | - $this->setRowsCount($rowCount,$colsCount,true); |
|
68 | + $this->setRowsCount($rowCount, $colsCount, true); |
|
69 | 69 | return $this->content[$rowCount-1]; |
70 | 70 | } |
71 | 71 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * @param int $width with of the column to add |
75 | 75 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
76 | 76 | */ |
77 | - public function addCol($width=NULL){ |
|
77 | + public function addCol($width=NULL) { |
|
78 | 78 | $colCount=$this->colCount()+1; |
79 | - $this->setColsCount($colCount,true,$width); |
|
80 | - if($this->hasOnlyCols($this->count())) |
|
79 | + $this->setColsCount($colCount, true, $width); |
|
80 | + if ($this->hasOnlyCols($this->count())) |
|
81 | 81 | return $this->content[$colCount-1]; |
82 | 82 | return $this; |
83 | 83 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @param array $sizes array of width of the columns to create |
87 | 87 | * @return \Ajax\semantic\html\collections\HtmlGrid |
88 | 88 | */ |
89 | - public function addCols($sizes=array()){ |
|
90 | - foreach ($sizes as $size){ |
|
89 | + public function addCols($sizes=array()) { |
|
90 | + foreach ($sizes as $size) { |
|
91 | 91 | $this->addCol($size); |
92 | 92 | } |
93 | 93 | return $this; |
@@ -99,28 +99,28 @@ discard block |
||
99 | 99 | * @param int $colsCount |
100 | 100 | * @return \Ajax\semantic\html\collections\HtmlGrid |
101 | 101 | */ |
102 | - public function setRowsCount($rowsCount,$colsCount=NULL,$force=false){ |
|
102 | + public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
|
103 | 103 | $count=$this->count(); |
104 | - if($rowsCount<2 && $force===false){ |
|
105 | - for($i=$count;$i<$colsCount;$i++){ |
|
104 | + if ($rowsCount<2 && $force===false) { |
|
105 | + for ($i=$count; $i<$colsCount; $i++) { |
|
106 | 106 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
107 | 107 | } |
108 | - }else{ |
|
109 | - if($this->hasOnlyCols($count)){ |
|
108 | + }else { |
|
109 | + if ($this->hasOnlyCols($count)) { |
|
110 | 110 | $tmpContent=$this->content; |
111 | 111 | $item=$this->addItem($colsCount); |
112 | 112 | $item->setContent($tmpContent); |
113 | 113 | $this->content=array(); |
114 | 114 | $count=1; |
115 | 115 | } |
116 | - for($i=$count;$i<$rowsCount;$i++){ |
|
116 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
117 | 117 | $this->addItem($colsCount); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | return $this; |
121 | 121 | } |
122 | 122 | |
123 | - protected function hasOnlyCols($count){ |
|
123 | + protected function hasOnlyCols($count) { |
|
124 | 124 | return $count>0 && $this->content[0] instanceof HtmlGridCol; |
125 | 125 | } |
126 | 126 | |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | * @param int $width |
132 | 132 | * @return \Ajax\semantic\html\collections\HtmlGrid |
133 | 133 | */ |
134 | - public function setColsCount($numCols,$toCreate=true,$width=NULL){ |
|
135 | - if(isset($width)===false) |
|
134 | + public function setColsCount($numCols, $toCreate=true, $width=NULL) { |
|
135 | + if (isset($width)===false) |
|
136 | 136 | $this->setWide($numCols); |
137 | - if($toCreate==true){ |
|
137 | + if ($toCreate==true) { |
|
138 | 138 | $count=$this->count(); |
139 | - if($count==0 || $this->hasOnlyCols($count)){ |
|
140 | - for($i=$count;$i<$numCols;$i++){ |
|
141 | - $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i,$width)); |
|
139 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
140 | + for ($i=$count; $i<$numCols; $i++) { |
|
141 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
142 | 142 | } |
143 | - }else{ |
|
144 | - for($i=0;$i<$count;$i++){ |
|
143 | + }else { |
|
144 | + for ($i=0; $i<$count; $i++) { |
|
145 | 145 | $this->getItem($i)->setColsCount($numCols); |
146 | 146 | } |
147 | 147 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param int $index |
155 | 155 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
156 | 156 | */ |
157 | - public function getRow($index){ |
|
157 | + public function getRow($index) { |
|
158 | 158 | return $this->getItem($index); |
159 | 159 | } |
160 | 160 | |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * Returns the row count |
163 | 163 | * @return int |
164 | 164 | */ |
165 | - public function rowCount(){ |
|
165 | + public function rowCount() { |
|
166 | 166 | $count=$this->count(); |
167 | - if($this->hasOnlyCols($count)) |
|
167 | + if ($this->hasOnlyCols($count)) |
|
168 | 168 | return 0; |
169 | 169 | return $count; |
170 | 170 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * Returns the column count |
174 | 174 | * @return int |
175 | 175 | */ |
176 | - public function colCount(){ |
|
176 | + public function colCount() { |
|
177 | 177 | $count=$this->count(); |
178 | - if($this->hasOnlyCols($count)) |
|
178 | + if ($this->hasOnlyCols($count)) |
|
179 | 179 | return $count; |
180 | - if($count>0) |
|
180 | + if ($count>0) |
|
181 | 181 | return $this->getItem(0)->count(); |
182 | 182 | return 0; |
183 | 183 | } |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * @param int $col |
189 | 189 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
190 | 190 | */ |
191 | - public function getCell($row,$col){ |
|
192 | - if($row<2 && $this->hasOnlyCols($this->count())) |
|
191 | + public function getCell($row, $col) { |
|
192 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
193 | 193 | return $this->getItem($col); |
194 | 194 | $row=$this->getItem($row); |
195 | - if(isset($row)){ |
|
195 | + if (isset($row)) { |
|
196 | 196 | $col=$row->getItem($col); |
197 | 197 | } |
198 | 198 | return $col; |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * @param boolean $vertically |
204 | 204 | * @return \Ajax\semantic\html\collections\HtmlGrid |
205 | 205 | */ |
206 | - public function setDivided($vertically=false){ |
|
207 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
208 | - return $this->addToPropertyCtrl("class", $value,array("divided")); |
|
206 | + public function setDivided($vertically=false) { |
|
207 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
208 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | * @param boolean $internally true for internal cells |
214 | 214 | * @return \Ajax\semantic\html\collections\HtmlGrid |
215 | 215 | */ |
216 | - public function setCelled($internally=false){ |
|
217 | - $value=($internally===true)?"internally celled":"celled"; |
|
218 | - return $this->addToPropertyCtrl("class", $value,array("celled","internally celled")); |
|
216 | + public function setCelled($internally=false) { |
|
217 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
218 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | 222 | * A grid can have its columns centered |
223 | 223 | */ |
224 | - public function setCentered(){ |
|
225 | - return $this->addToPropertyCtrl("class", "centered",array("centered")); |
|
224 | + public function setCentered() { |
|
225 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | 229 | * automatically resize all elements to split the available width evenly |
230 | 230 | * @return \Ajax\semantic\html\collections\HtmlGrid |
231 | 231 | */ |
232 | - public function setEqualWidth(){ |
|
232 | + public function setEqualWidth() { |
|
233 | 233 | return $this->addToProperty("class", "equal width"); |
234 | 234 | } |
235 | 235 | |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | * @param string $value |
239 | 239 | * @return \Ajax\semantic\html\collections\HtmlGrid |
240 | 240 | */ |
241 | - public function setPadded($value=NULL){ |
|
242 | - if(isset($value)) |
|
243 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
241 | + public function setPadded($value=NULL) { |
|
242 | + if (isset($value)) |
|
243 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
244 | 244 | return $this->addToProperty("class", "padded"); |
245 | 245 | } |
246 | 246 | |
@@ -248,23 +248,23 @@ discard block |
||
248 | 248 | * @param boolean $very |
249 | 249 | * @return \Ajax\semantic\html\collections\HtmlGrid |
250 | 250 | */ |
251 | - public function setRelaxed($very=false){ |
|
252 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
253 | - return $this->addToPropertyCtrl("class", $value,array("relaxed","very relaxed")); |
|
251 | + public function setRelaxed($very=false) { |
|
252 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
253 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
254 | 254 | } |
255 | 255 | |
256 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
257 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
256 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
257 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | 261 | * {@inheritDoc} |
262 | 262 | * @see \Ajax\common\html\HtmlCollection::createItem() |
263 | 263 | */ |
264 | - protected function createItem($value){ |
|
265 | - if($this->_createCols===false) |
|
264 | + protected function createItem($value) { |
|
265 | + if ($this->_createCols===false) |
|
266 | 266 | $value=null; |
267 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
267 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
268 | 268 | return $item; |
269 | 269 | } |
270 | 270 | |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | * Sets $values to the grid |
273 | 273 | * @param array $values |
274 | 274 | */ |
275 | - public function setValues($values,$force=true){ |
|
275 | + public function setValues($values, $force=true) { |
|
276 | 276 | $count=$this->count(); |
277 | - if($this->_createCols===false || $force===true){ |
|
278 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
277 | + if ($this->_createCols===false || $force===true) { |
|
278 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
279 | 279 | $colSize=\sizeof($values[$i]); |
280 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
280 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
281 | 281 | } |
282 | 282 | } |
283 | - $count=\min(array($this->count(),\sizeof($values))); |
|
284 | - for($i=0;$i<$count;$i++){ |
|
285 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
283 | + $count=\min(array($this->count(), \sizeof($values))); |
|
284 | + for ($i=0; $i<$count; $i++) { |
|
285 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * stretch the row contents to take up the entire column height |
291 | 291 | * @return \Ajax\semantic\html\content\HtmlGridRow |
292 | 292 | */ |
293 | - public function setStretched(){ |
|
293 | + public function setStretched() { |
|
294 | 294 | return $this->addToProperty("class", "stretched"); |
295 | 295 | } |
296 | 296 |
@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | protected $_input; |
14 | 14 | protected $_params=array(); |
15 | 15 | |
16 | - public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL,$type=NULL) { |
|
17 | - $input=new HtmlFormInput($identifier,$label,"checkbox",$value); |
|
16 | + public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $type=NULL) { |
|
17 | + $input=new HtmlFormInput($identifier, $label, "checkbox", $value); |
|
18 | 18 | parent::__construct("ck-field-".$identifier, $input); |
19 | - if(isset($label)){ |
|
19 | + if (isset($label)) { |
|
20 | 20 | $input->swapLabel(); |
21 | 21 | $label=$input->getLabel(); |
22 | 22 | $label->setClass="hidden"; |
23 | - $label->setProperty("tabindex",0); |
|
23 | + $label->setProperty("tabindex", 0); |
|
24 | 24 | } |
25 | 25 | $this->_input=$input; |
26 | - $input->getField()->addToProperty("class","hidden"); |
|
26 | + $input->getField()->addToProperty("class", "hidden"); |
|
27 | 27 | } |
28 | 28 | |
29 | - public function setType($checkboxType){ |
|
29 | + public function setType($checkboxType) { |
|
30 | 30 | return $this->_input->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants()); |
31 | 31 | } |
32 | 32 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | return $this; |
40 | 40 | } |
41 | 41 | |
42 | - public function setReadonly(){ |
|
43 | - $this->_input->getField()->setProperty("disabled","disabled"); |
|
44 | - return $this->_input->addToProperty("class","read-only"); |
|
42 | + public function setReadonly() { |
|
43 | + $this->_input->getField()->setProperty("disabled", "disabled"); |
|
44 | + return $this->_input->addToProperty("class", "read-only"); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param string $action action to execute : check, uncheck or NULL for toggle |
51 | 51 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
52 | 52 | */ |
53 | - public function attachEvent($selector,$action=NULL){ |
|
54 | - if(isset($action)!==false || \is_numeric($action)===true){ |
|
53 | + public function attachEvent($selector, $action=NULL) { |
|
54 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
55 | 55 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
56 | - }else{ |
|
56 | + }else { |
|
57 | 57 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
58 | 58 | } |
59 | 59 | $js=\str_replace("%identifier%", $this->_input->getIdentifier(), $js); |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | * @param array $events associative array of events to attach ex : ["#bt-toggle","check"=>"#bt-check","uncheck"=>"#bt-uncheck"] |
66 | 66 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
67 | 67 | */ |
68 | - public function attachEvents($events=array()){ |
|
69 | - if(\is_array($events)){ |
|
70 | - foreach ($events as $action=>$selector){ |
|
71 | - $this->attachEvent($selector,$action); |
|
68 | + public function attachEvents($events=array()) { |
|
69 | + if (\is_array($events)) { |
|
70 | + foreach ($events as $action=>$selector) { |
|
71 | + $this->attachEvent($selector, $action); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | return $this; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | class HtmlMenu extends HtmlSemCollection { |
25 | 25 | |
26 | 26 | public function __construct($identifier, $items=array()) { |
27 | - parent::__construct($identifier, "div","ui menu"); |
|
27 | + parent::__construct($identifier, "div", "ui menu"); |
|
28 | 28 | $this->addItems($items); |
29 | 29 | } |
30 | 30 | |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | * @param string $type one of text,item |
34 | 34 | * @return \Ajax\semantic\html\collections\HtmlMenu |
35 | 35 | */ |
36 | - public function setType($type=""){ |
|
37 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
36 | + public function setType($type="") { |
|
37 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
38 | 38 | } |
39 | 39 | |
40 | - public function setActiveItem($index){ |
|
40 | + public function setActiveItem($index) { |
|
41 | 41 | $item=$this->getItem($index); |
42 | - if($item!==null){ |
|
42 | + if ($item!==null) { |
|
43 | 43 | $item->addToProperty("class", "active"); |
44 | 44 | } |
45 | 45 | return $this; |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | * {@inheritDoc} |
50 | 50 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
51 | 51 | */ |
52 | - public function addItem($item){ |
|
53 | - if($item instanceof HtmlInput || $item instanceof HtmlImg){ |
|
54 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier,"div",""); |
|
52 | + public function addItem($item) { |
|
53 | + if ($item instanceof HtmlInput || $item instanceof HtmlImg) { |
|
54 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
55 | 55 | $itemO->setContent($item); |
56 | 56 | $item=$itemO; |
57 | 57 | } |
58 | 58 | $item=parent::addItem($item); |
59 | - if(!$item instanceof HtmlMenu) |
|
60 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
61 | - else{ |
|
59 | + if (!$item instanceof HtmlMenu) |
|
60 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
61 | + else { |
|
62 | 62 | $this->setSecondary(); |
63 | 63 | } |
64 | 64 | return $item; |
65 | 65 | } |
66 | 66 | |
67 | - public function generateMenuAsItem($menu,$header=null){ |
|
67 | + public function generateMenuAsItem($menu, $header=null) { |
|
68 | 68 | $count=$this->count(); |
69 | - $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"div"); |
|
70 | - if(isset($header)){ |
|
71 | - $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count,"div","header"); |
|
69 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
70 | + if (isset($header)) { |
|
71 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
72 | 72 | $headerItem->setContent($header); |
73 | 73 | $item->addContent($headerItem); |
74 | 74 | } |
@@ -76,24 +76,24 @@ discard block |
||
76 | 76 | $item->addContent($menu); |
77 | 77 | return $item; |
78 | 78 | } |
79 | - public function addMenuAsItem($menu,$header=null){ |
|
80 | - return $this->addItem($this->generateMenuAsItem($menu,$header)); |
|
79 | + public function addMenuAsItem($menu, $header=null) { |
|
80 | + return $this->addItem($this->generateMenuAsItem($menu, $header)); |
|
81 | 81 | } |
82 | 82 | |
83 | - public function addPopupAsItem($value,$identifier, $content=""){ |
|
84 | - $value=new HtmlSemDoubleElement($identifier,"a","browse item",$value); |
|
83 | + public function addPopupAsItem($value, $identifier, $content="") { |
|
84 | + $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
|
85 | 85 | $value->addContent(new HtmlIcon("", "dropdown")); |
86 | 86 | $value=$this->addItem($value); |
87 | - $popup=new HtmlPopup($value,"popup-".$this->identifier."-".$this->count(),$content); |
|
87 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
88 | 88 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
89 | - $this->wrap("",$popup); |
|
89 | + $this->wrap("", $popup); |
|
90 | 90 | return $popup; |
91 | 91 | } |
92 | 92 | |
93 | - public function addDropdownAsItem($value,$items=NULL){ |
|
93 | + public function addDropdownAsItem($value, $items=NULL) { |
|
94 | 94 | $dd=$value; |
95 | - if(\is_string($value)){ |
|
96 | - $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(),$value,$items); |
|
95 | + if (\is_string($value)) { |
|
96 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
97 | 97 | } |
98 | 98 | return $this->addItem($dd); |
99 | 99 | } |
@@ -102,51 +102,51 @@ discard block |
||
102 | 102 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
103 | 103 | */ |
104 | 104 | protected function createItem($value) { |
105 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
105 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
106 | 106 | return $itemO->setClass("item"); |
107 | 107 | } |
108 | 108 | |
109 | - public function setInverted(){ |
|
109 | + public function setInverted() { |
|
110 | 110 | return $this->addToProperty("class", "inverted"); |
111 | 111 | } |
112 | 112 | |
113 | - public function setSecondary(){ |
|
113 | + public function setSecondary() { |
|
114 | 114 | return $this->addToProperty("class", "secondary"); |
115 | 115 | } |
116 | 116 | |
117 | - public function setVertical(){ |
|
118 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
117 | + public function setVertical() { |
|
118 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
119 | 119 | } |
120 | 120 | |
121 | - public function setPosition($value="right"){ |
|
122 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
121 | + public function setPosition($value="right") { |
|
122 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
123 | 123 | } |
124 | 124 | |
125 | - public function setPointing($value=Direction::NONE){ |
|
126 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
125 | + public function setPointing($value=Direction::NONE) { |
|
126 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
127 | 127 | } |
128 | 128 | |
129 | - public function asTab($vertical=false){ |
|
130 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
131 | - if($vertical===true) |
|
129 | + public function asTab($vertical=false) { |
|
130 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
131 | + if ($vertical===true) |
|
132 | 132 | $this->setVertical(); |
133 | 133 | return $this->addToProperty("class", "tabular"); |
134 | 134 | } |
135 | 135 | |
136 | - public function asPagination(){ |
|
137 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
136 | + public function asPagination() { |
|
137 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
138 | 138 | return $this->addToProperty("class", "pagination"); |
139 | 139 | } |
140 | 140 | |
141 | - public function setFixed(){ |
|
141 | + public function setFixed() { |
|
142 | 142 | return $this->addToProperty("class", "fixed"); |
143 | 143 | } |
144 | 144 | |
145 | - public function setFluid(){ |
|
145 | + public function setFluid() { |
|
146 | 146 | return $this->addToProperty("class", "fluid"); |
147 | 147 | } |
148 | 148 | |
149 | - public function setCompact(){ |
|
149 | + public function setCompact() { |
|
150 | 150 | return $this->addToProperty("class", "compact"); |
151 | 151 | } |
152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function fromDatabaseObject($object, $function) { |
157 | 157 | $return=$function($object); |
158 | - if(\is_array($return)) |
|
158 | + if (\is_array($return)) |
|
159 | 159 | $this->addItems($return); |
160 | 160 | else |
161 | 161 | $this->addItem($return); |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | * @param int $width |
167 | 167 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
168 | 168 | */ |
169 | - public function setWidth($width){ |
|
170 | - if(\is_int($width)){ |
|
169 | + public function setWidth($width) { |
|
170 | + if (\is_int($width)) { |
|
171 | 171 | $width=Wide::getConstants()["W".$width]; |
172 | 172 | } |
173 | 173 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
174 | - return $this->addToPropertyCtrl("class", "item",array("item")); |
|
174 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
175 | 175 | } |
176 | 176 | |
177 | - public function addImage($identifier, $src="", $alt=""){ |
|
178 | - return $this->addItem(new HtmlImg($identifier,$src,$alt)); |
|
177 | + public function addImage($identifier, $src="", $alt="") { |
|
178 | + return $this->addItem(new HtmlImg($identifier, $src, $alt)); |
|
179 | 179 | } |
180 | 180 | |
181 | - public static function vertical($identifier,$items=array()){ |
|
182 | - return (new HtmlMenu($identifier,$items))->setVertical(); |
|
181 | + public static function vertical($identifier, $items=array()) { |
|
182 | + return (new HtmlMenu($identifier, $items))->setVertical(); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | \ No newline at end of file |
@@ -12,70 +12,70 @@ |
||
12 | 12 | public function __construct($identifier, $content) { |
13 | 13 | parent::__construct($identifier, "div", "step"); |
14 | 14 | $this->content=array(); |
15 | - if(\is_array($content)){ |
|
16 | - if(JArray::isAssociative($content)===false){ |
|
17 | - $icon=JArray::getValue($content, "icon",0); |
|
18 | - $title=JArray::getValue($content, "title",1); |
|
19 | - $desc=JArray::getValue($content, "description",2); |
|
20 | - $status=JArray::getValue($content, "status",3); |
|
21 | - }else{ |
|
15 | + if (\is_array($content)) { |
|
16 | + if (JArray::isAssociative($content)===false) { |
|
17 | + $icon=JArray::getValue($content, "icon", 0); |
|
18 | + $title=JArray::getValue($content, "title", 1); |
|
19 | + $desc=JArray::getValue($content, "description", 2); |
|
20 | + $status=JArray::getValue($content, "status", 3); |
|
21 | + }else { |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
25 | 25 | $status=@$content["status"]; |
26 | 26 | } |
27 | - if(isset($icon)===true){ |
|
27 | + if (isset($icon)===true) { |
|
28 | 28 | $this->setIcon($icon); |
29 | 29 | } |
30 | - if(isset($status)===true){ |
|
30 | + if (isset($status)===true) { |
|
31 | 31 | $this->setStatus($status); |
32 | 32 | } |
33 | - if(isset($title)===true){ |
|
34 | - $this->setTitle($title,$desc); |
|
33 | + if (isset($title)===true) { |
|
34 | + $this->setTitle($title, $desc); |
|
35 | 35 | } |
36 | - }else{ |
|
36 | + }else { |
|
37 | 37 | $this->setContent($content); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | - public function setIcon($icon){ |
|
41 | + public function setIcon($icon) { |
|
42 | 42 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
43 | 43 | } |
44 | 44 | |
45 | - private function createContent(){ |
|
46 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
45 | + private function createContent() { |
|
46 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
47 | 47 | return $this->content["content"]; |
48 | 48 | } |
49 | 49 | |
50 | - public function setTitle($title,$description=NULL){ |
|
51 | - $title=new HtmlSemDoubleElement("","div","title",$title); |
|
52 | - if(\array_key_exists("content", $this->content)===false){ |
|
50 | + public function setTitle($title, $description=NULL) { |
|
51 | + $title=new HtmlSemDoubleElement("", "div", "title", $title); |
|
52 | + if (\array_key_exists("content", $this->content)===false) { |
|
53 | 53 | $this->createContent(); |
54 | 54 | } |
55 | 55 | $this->content["content"]->addContent($title); |
56 | - if(isset($description)){ |
|
57 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
56 | + if (isset($description)) { |
|
57 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
58 | 58 | $this->content["content"]->addContent($description); |
59 | 59 | } |
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 | |
63 | - public function setActive(){ |
|
63 | + public function setActive() { |
|
64 | 64 | return $this->setStatus(StepStatus::ACTIVE); |
65 | 65 | } |
66 | 66 | |
67 | - public function setCompleted(){ |
|
67 | + public function setCompleted() { |
|
68 | 68 | return $this->setStatus(StepStatus::COMPLETED); |
69 | 69 | } |
70 | 70 | |
71 | - public function setStatus($status){ |
|
71 | + public function setStatus($status) { |
|
72 | 72 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
73 | 73 | } |
74 | 74 | |
75 | - public function asLink(){ |
|
75 | + public function asLink() { |
|
76 | 76 | return $this->setTagName("a"); |
77 | 77 | } |
78 | - public function removeStatus(){ |
|
78 | + public function removeStatus() { |
|
79 | 79 | $this->removePropertyValues("class", StepStatus::getConstants()); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $title=JArray::getValue($content, "title",1); |
19 | 19 | $desc=JArray::getValue($content, "description",2); |
20 | 20 | $status=JArray::getValue($content, "status",3); |
21 | - }else{ |
|
21 | + } else{ |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if(isset($title)===true){ |
34 | 34 | $this->setTitle($title,$desc); |
35 | 35 | } |
36 | - }else{ |
|
36 | + } else{ |
|
37 | 37 | $this->setContent($content); |
38 | 38 | } |
39 | 39 | } |