@@ -77,8 +77,9 @@ discard block |
||
77 | 77 | public function addCol($width=NULL) { |
78 | 78 | $colCount=$this->colCount() + 1; |
79 | 79 | $this->setColsCount($colCount, true, $width); |
80 | - if ($this->hasOnlyCols($this->count())) |
|
81 | - return $this->content[$colCount - 1]; |
|
80 | + if ($this->hasOnlyCols($this->count())) { |
|
81 | + return $this->content[$colCount - 1]; |
|
82 | + } |
|
82 | 83 | return $this; |
83 | 84 | } |
84 | 85 | |
@@ -166,8 +167,9 @@ discard block |
||
166 | 167 | */ |
167 | 168 | public function rowCount() { |
168 | 169 | $count=$this->count(); |
169 | - if ($this->hasOnlyCols($count)) |
|
170 | - return 0; |
|
170 | + if ($this->hasOnlyCols($count)) { |
|
171 | + return 0; |
|
172 | + } |
|
171 | 173 | return $count; |
172 | 174 | } |
173 | 175 | |
@@ -177,10 +179,12 @@ discard block |
||
177 | 179 | */ |
178 | 180 | public function colCount() { |
179 | 181 | $count=$this->count(); |
180 | - if ($this->hasOnlyCols($count)) |
|
181 | - return $count; |
|
182 | - if ($count > 0) |
|
183 | - return $this->getItem(0)->count(); |
|
182 | + if ($this->hasOnlyCols($count)) { |
|
183 | + return $count; |
|
184 | + } |
|
185 | + if ($count > 0) { |
|
186 | + return $this->getItem(0)->count(); |
|
187 | + } |
|
184 | 188 | return 0; |
185 | 189 | } |
186 | 190 | |
@@ -191,8 +195,9 @@ discard block |
||
191 | 195 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
192 | 196 | */ |
193 | 197 | public function getCell($row, $col) { |
194 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
195 | - return $this->getItem($col); |
|
198 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
199 | + return $this->getItem($col); |
|
200 | + } |
|
196 | 201 | $row=$this->getItem($row); |
197 | 202 | if (isset($row)) { |
198 | 203 | $col=$row->getItem($col); |
@@ -241,8 +246,9 @@ discard block |
||
241 | 246 | * @return \Ajax\semantic\html\collections\HtmlGrid |
242 | 247 | */ |
243 | 248 | public function setPadded($value=NULL) { |
244 | - if (isset($value)) |
|
245 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
249 | + if (isset($value)) { |
|
250 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
251 | + } |
|
246 | 252 | return $this->addToProperty("class", "padded"); |
247 | 253 | } |
248 | 254 | |
@@ -267,8 +273,9 @@ discard block |
||
267 | 273 | * @see \Ajax\common\html\HtmlCollection::createItem() |
268 | 274 | */ |
269 | 275 | protected function createItem($value) { |
270 | - if ($this->_createCols === false) |
|
271 | - $value=null; |
|
276 | + if ($this->_createCols === false) { |
|
277 | + $value=null; |
|
278 | + } |
|
272 | 279 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
273 | 280 | return $item; |
274 | 281 | } |
@@ -22,6 +22,9 @@ discard block |
||
22 | 22 | private $_colSizing=true; |
23 | 23 | private $_implicitRows=false; |
24 | 24 | |
25 | + /** |
|
26 | + * @param string $identifier |
|
27 | + */ |
|
25 | 28 | public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
26 | 29 | parent::__construct($identifier, "div", "ui grid"); |
27 | 30 | $this->_implicitRows=$implicitRows; |
@@ -158,7 +161,7 @@ discard block |
||
158 | 161 | /** |
159 | 162 | * return the row at $index |
160 | 163 | * @param int $index |
161 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
164 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
162 | 165 | */ |
163 | 166 | public function getRow($index) { |
164 | 167 | return $this->getItem($index); |
@@ -297,7 +300,7 @@ discard block |
||
297 | 300 | |
298 | 301 | /** |
299 | 302 | * stretch the row contents to take up the entire column height |
300 | - * @return \Ajax\semantic\html\content\HtmlGridRow |
|
303 | + * @return HtmlGrid |
|
301 | 304 | */ |
302 | 305 | public function setStretched() { |
303 | 306 | return $this->addToProperty("class", "stretched"); |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | public function asSegment() { |
39 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
39 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function asContainer() { |
43 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
43 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * @param int $wide |
49 | 49 | */ |
50 | 50 | public function setWide($wide) { |
51 | - $wide=Wide::getConstants()["W" . $wide]; |
|
51 | + $wide=Wide::getConstants()["W".$wide]; |
|
52 | 52 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
53 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
53 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @return mixed |
69 | 69 | */ |
70 | 70 | public function addRow($colsCount=NULL) { |
71 | - $rowCount=$this->rowCount() + 1; |
|
71 | + $rowCount=$this->rowCount()+1; |
|
72 | 72 | $this->setRowsCount($rowCount, $colsCount, true); |
73 | - return $this->content[$rowCount - 1]; |
|
73 | + return $this->content[$rowCount-1]; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
80 | 80 | */ |
81 | 81 | public function addCol($width=NULL) { |
82 | - $colCount=$this->colCount() + 1; |
|
82 | + $colCount=$this->colCount()+1; |
|
83 | 83 | $this->setColsCount($colCount, true, $width); |
84 | 84 | if ($this->hasOnlyCols($this->count())) |
85 | - return $this->content[$colCount - 1]; |
|
85 | + return $this->content[$colCount-1]; |
|
86 | 86 | return $this; |
87 | 87 | } |
88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return \Ajax\semantic\html\collections\HtmlGrid |
93 | 93 | */ |
94 | 94 | public function addCols($sizes=array()) { |
95 | - foreach ( $sizes as $size ) { |
|
95 | + foreach ($sizes as $size) { |
|
96 | 96 | $this->addCol($size); |
97 | 97 | } |
98 | 98 | return $this; |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
108 | 108 | $count=$this->count(); |
109 | - if ($rowsCount < 2 && $force === false) { |
|
110 | - for($i=$count; $i < $colsCount; $i++) { |
|
111 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
109 | + if ($rowsCount<2 && $force===false) { |
|
110 | + for ($i=$count; $i<$colsCount; $i++) { |
|
111 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
112 | 112 | } |
113 | - } else { |
|
113 | + }else { |
|
114 | 114 | if ($this->hasOnlyCols($count)) { |
115 | 115 | $tmpContent=$this->content; |
116 | 116 | $item=$this->addItem($colsCount); |
117 | 117 | $item->setContent($tmpContent); |
118 | - $this->content=array (); |
|
118 | + $this->content=array(); |
|
119 | 119 | $count=1; |
120 | 120 | } |
121 | - for($i=$count; $i < $rowsCount; $i++) { |
|
121 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
122 | 122 | $this->addItem($colsCount); |
123 | 123 | } |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | protected function hasOnlyCols($count) { |
129 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
129 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | /*if (isset($width)==false) { |
141 | 141 | $this->setWide($numCols); |
142 | 142 | }*/ |
143 | - if ($toCreate == true) { |
|
143 | + if ($toCreate==true) { |
|
144 | 144 | $count=$this->count(); |
145 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
146 | - for($i=$count; $i < $numCols; $i++) { |
|
147 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
145 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
146 | + for ($i=$count; $i<$numCols; $i++) { |
|
147 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
148 | 148 | } |
149 | - } else { |
|
150 | - for($i=0; $i < $count; $i++) { |
|
149 | + }else { |
|
150 | + for ($i=0; $i<$count; $i++) { |
|
151 | 151 | $this->getItem($i)->setColsCount($numCols); |
152 | 152 | } |
153 | 153 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $count=$this->count(); |
184 | 184 | if ($this->hasOnlyCols($count)) |
185 | 185 | return $count; |
186 | - if ($count > 0) |
|
186 | + if ($count>0) |
|
187 | 187 | return $this->getItem(0)->count(); |
188 | 188 | return 0; |
189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
196 | 196 | */ |
197 | 197 | public function getCell($row, $col) { |
198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
198 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
199 | 199 | return $this->getItem($col); |
200 | 200 | $row=$this->getItem($row); |
201 | 201 | if (isset($row)) { |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * @return \Ajax\semantic\html\collections\HtmlGrid |
211 | 211 | */ |
212 | 212 | public function setDivided($vertically=false) { |
213 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
214 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
213 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
214 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | * @return \Ajax\semantic\html\collections\HtmlGrid |
221 | 221 | */ |
222 | 222 | public function setCelled($internally=false) { |
223 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
224 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
223 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
224 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
228 | 228 | * A grid can have its columns centered |
229 | 229 | */ |
230 | 230 | public function setCentered() { |
231 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
231 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function setPadded($value=NULL) { |
248 | 248 | if (isset($value)) |
249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
249 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
250 | 250 | return $this->addToProperty("class", "padded"); |
251 | 251 | } |
252 | 252 | |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | * @return \Ajax\semantic\html\collections\HtmlGrid |
257 | 257 | */ |
258 | 258 | public function setRelaxed($very=false) { |
259 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
260 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
259 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
260 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
264 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
264 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | * @see \Ajax\common\html\HtmlCollection::createItem() |
272 | 272 | */ |
273 | 273 | protected function createItem($value) { |
274 | - if ($this->_createCols === false) |
|
274 | + if ($this->_createCols===false) |
|
275 | 275 | $value=null; |
276 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
276 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
277 | 277 | return $item; |
278 | 278 | } |
279 | 279 | |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function setValues($values, $force=true) { |
285 | 285 | $count=$this->count(); |
286 | - if ($this->_createCols === false || $force === true) { |
|
287 | - for($i=$count; $i < \sizeof($values); $i++) { |
|
286 | + if ($this->_createCols===false || $force===true) { |
|
287 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
288 | 288 | $colSize=\sizeof($values[$i]); |
289 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
289 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
290 | 290 | } |
291 | 291 | } |
292 | - $count=\min(array ($this->count(),\sizeof($values) )); |
|
293 | - for($i=0; $i < $count; $i++) { |
|
294 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
292 | + $count=\min(array($this->count(), \sizeof($values))); |
|
293 | + for ($i=0; $i<$count; $i++) { |
|
294 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 |
@@ -14,8 +14,8 @@ |
||
14 | 14 | */ |
15 | 15 | public function setAttachment(HtmlSemDoubleElement $toElement, $value=Side::BOTH) { |
16 | 16 | if (isset($toElement)) { |
17 | - $toElement->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
17 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
18 | 18 | } |
19 | - return $this->addToPropertyCtrl("class", $value . " attached", Side::getConstantValues("attached")); |
|
19 | + return $this->addToPropertyCtrl("class", $value." attached", Side::getConstantValues("attached")); |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -9,7 +9,6 @@ |
||
9 | 9 | |
10 | 10 | /** |
11 | 11 | * |
12 | - * @param string $side |
|
13 | 12 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
14 | 13 | */ |
15 | 14 | public function setAttachment(HtmlSemDoubleElement $toElement, $value=Side::BOTH) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @return \Ajax\semantic\html\elements\HtmlDivider |
23 | 23 | */ |
24 | 24 | public function setVertical() { |
25 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical","horizontal" )); |
|
25 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical", "horizontal")); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return \Ajax\semantic\html\elements\HtmlDivider |
31 | 31 | */ |
32 | 32 | public function setHorizontal() { |
33 | - return $this->addToPropertyCtrl("class", "horizontal", array ("vertical","horizontal" )); |
|
33 | + return $this->addToPropertyCtrl("class", "horizontal", array("vertical", "horizontal")); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | const ACTIVE="active", DISABLED="disabled", ERROR="error", FOCUS="focus", LOADING="loading", NEGATIVE="negative", POSITIVE="positive", SUCCESS="success", WARNING="warning"; |
10 | 10 | |
11 | 11 | public static function add($state, $elements) { |
12 | - if (\is_array($state) === false) { |
|
12 | + if (\is_array($state)===false) { |
|
13 | 13 | $state=\explode(" ", $state); |
14 | 14 | } |
15 | 15 | if (\is_array($elements)) { |
16 | - foreach ( $elements as $element ) { |
|
16 | + foreach ($elements as $element) { |
|
17 | 17 | if ($element instanceof BaseHtml) { |
18 | 18 | self::_add($state, $element); |
19 | 19 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | private static function _add($states, $element) { |
25 | - foreach ( $states as $state ) { |
|
26 | - $element->addToPropertyCtrl("class", $state, array ($state )); |
|
25 | + foreach ($states as $state) { |
|
26 | + $element->addToPropertyCtrl("class", $state, array($state)); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | * @version 1.001 |
19 | 19 | */ |
20 | 20 | class HtmlSegment extends HtmlSemDoubleElement { |
21 | - use AttachedTrait,TextAlignmentTrait; |
|
21 | + use AttachedTrait, TextAlignmentTrait; |
|
22 | 22 | |
23 | 23 | public function __construct($identifier, $content="") { |
24 | 24 | parent::__construct($identifier, "div", "ui segment"); |
25 | - $this->_variations=\array_merge($this->_variations, [ Variation::PADDED,Variation::COMPACT ]); |
|
26 | - $this->_states=\array_merge($this->_states, [ State::LOADING ]); |
|
25 | + $this->_variations=\array_merge($this->_variations, [Variation::PADDED, Variation::COMPACT]); |
|
26 | + $this->_states=\array_merge($this->_states, [State::LOADING]); |
|
27 | 27 | $this->content=$content; |
28 | 28 | } |
29 | 29 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | public function setSens($sens="vertical") { |
40 | - return $this->addToPropertyCtrl("class", $sens, array ("vertical","horizontal" )); |
|
40 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function setEmphasis($value=Emphasis::SECONDARY) { |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | public function asContainer() { |
64 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
64 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
65 | 65 | } |
66 | 66 | |
67 | - public function addGrid($numRows=1, $numCols=NULL){ |
|
68 | - $grid=new HtmlGrid("Grid-".$this->identifier,$numRows,$numCols); |
|
67 | + public function addGrid($numRows=1, $numCols=NULL) { |
|
68 | + $grid=new HtmlGrid("Grid-".$this->identifier, $numRows, $numCols); |
|
69 | 69 | $this->content=$grid; |
70 | 70 | return $grid; |
71 | 71 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | class HtmlContainer extends HtmlSemDoubleElement { |
14 | 14 | use TextAlignmentTrait; |
15 | 15 | public function __construct($identifier, $content="") { |
16 | - parent::__construct($identifier, "div","ui container"); |
|
16 | + parent::__construct($identifier, "div", "ui container"); |
|
17 | 17 | $this->content=$content; |
18 | 18 | } |
19 | 19 | |
20 | - public function asText(){ |
|
20 | + public function asText() { |
|
21 | 21 | return $this->addToProperty("class", "text"); |
22 | 22 | } |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Ajax\bootstrap\html\base\CssSize; |
5 | 5 | use Ajax\JsUtils; |
6 | - |
|
7 | 6 | use Ajax\bootstrap\html\base\HtmlBsDoubleElement; |
8 | 7 | |
9 | 8 | /** |
@@ -14,6 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
16 | 16 | private $cols; |
17 | + |
|
18 | + /** |
|
19 | + * @param string $identifier |
|
20 | + * @param integer $numCols |
|
21 | + */ |
|
17 | 22 | public function __construct($identifier,$numCols=NULL){ |
18 | 23 | parent::__construct($identifier,"div"); |
19 | 24 | $this->setProperty("class", "row"); |
@@ -86,6 +91,11 @@ discard block |
||
86 | 91 | $this->delete($size,$start+1, $width); |
87 | 92 | } |
88 | 93 | } |
94 | + |
|
95 | + /** |
|
96 | + * @param integer $start |
|
97 | + * @param integer $width |
|
98 | + */ |
|
89 | 99 | public function delete($size=CssSize::SIZE_MD,$start,$width){ |
90 | 100 | while($start<sizeof($this->cols)+1 && $width>0){ |
91 | 101 | $col=$this->getColAt($start,false); |
@@ -14,89 +14,89 @@ |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
16 | 16 | private $cols; |
17 | - public function __construct($identifier,$numCols=NULL){ |
|
18 | - parent::__construct($identifier,"div"); |
|
17 | + public function __construct($identifier, $numCols=NULL) { |
|
18 | + parent::__construct($identifier, "div"); |
|
19 | 19 | $this->setProperty("class", "row"); |
20 | 20 | $this->cols=array(); |
21 | - if(isset($numCols)){ |
|
22 | - $numCols=min(12,$numCols); |
|
23 | - $numCols=max(1,$numCols); |
|
24 | - $width=12/$numCols; |
|
25 | - for ($i=0;$i<$numCols;$i++){ |
|
26 | - $this->addCol(CssSize::SIZE_MD,$width); |
|
21 | + if (isset($numCols)) { |
|
22 | + $numCols=min(12, $numCols); |
|
23 | + $numCols=max(1, $numCols); |
|
24 | + $width=12 / $numCols; |
|
25 | + for ($i=0; $i<$numCols; $i++) { |
|
26 | + $this->addCol(CssSize::SIZE_MD, $width); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - public function addCol($size=CssSize::SIZE_MD,$width=1){ |
|
32 | - $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1),$size,$width); |
|
31 | + public function addCol($size=CssSize::SIZE_MD, $width=1) { |
|
32 | + $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1), $size, $width); |
|
33 | 33 | $this->cols[]=$col; |
34 | 34 | return $col; |
35 | 35 | } |
36 | 36 | |
37 | - public function addColAt($size=CssSize::SIZE_MD,$width=1,$offset=1){ |
|
38 | - $col=$this->addCol($size,$width); |
|
39 | - return $col->setOffset($size, max($offset,sizeof($this->cols)+1)); |
|
37 | + public function addColAt($size=CssSize::SIZE_MD, $width=1, $offset=1) { |
|
38 | + $col=$this->addCol($size, $width); |
|
39 | + return $col->setOffset($size, max($offset, sizeof($this->cols)+1)); |
|
40 | 40 | } |
41 | 41 | |
42 | - public function getCol($index,$force=true){ |
|
42 | + public function getCol($index, $force=true) { |
|
43 | 43 | $result=null; |
44 | - if($index<sizeof($this->cols)+1){ |
|
44 | + if ($index<sizeof($this->cols)+1) { |
|
45 | 45 | $result=$this->cols[$index-1]; |
46 | - }else if ($force){ |
|
47 | - $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
|
46 | + }else if ($force) { |
|
47 | + $result=$this->addColAt(CssSize::SIZE_MD, 1, $index); |
|
48 | 48 | } |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - public function getColAt($offset,$force=true){ |
|
52 | + public function getColAt($offset, $force=true) { |
|
53 | 53 | $result=null; |
54 | - foreach ($this->cols as $col){ |
|
54 | + foreach ($this->cols as $col) { |
|
55 | 55 | $offsets=$col->getOffsets(); |
56 | - if($result=array_search($offset, $offsets)){ |
|
56 | + if ($result=array_search($offset, $offsets)) { |
|
57 | 57 | break; |
58 | 58 | } |
59 | 59 | } |
60 | - if(!$result || isset($result)==false){ |
|
61 | - $result=$this->getCol($offset,$force); |
|
60 | + if (!$result || isset($result)==false) { |
|
61 | + $result=$this->getCol($offset, $force); |
|
62 | 62 | } |
63 | 63 | return $result; |
64 | 64 | } |
65 | 65 | |
66 | 66 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
67 | 67 | |
68 | - foreach ($this->cols as $col){ |
|
68 | + foreach ($this->cols as $col) { |
|
69 | 69 | $this->addContent($col); |
70 | 70 | } |
71 | - return parent::compile($js,$view); |
|
71 | + return parent::compile($js, $view); |
|
72 | 72 | } |
73 | 73 | public function getCols() { |
74 | 74 | return $this->cols; |
75 | 75 | } |
76 | 76 | |
77 | - public function setContentForAll($content){ |
|
78 | - foreach ($this->cols as $col){ |
|
77 | + public function setContentForAll($content) { |
|
78 | + foreach ($this->cols as $col) { |
|
79 | 79 | $col->setContent($content); |
80 | 80 | } |
81 | 81 | } |
82 | - public function merge($size=CssSize::SIZE_MD,$start,$width){ |
|
83 | - $col=$this->getColAt($start,false); |
|
84 | - if(isset($col)){ |
|
85 | - $col->setWidth($size,$width+1); |
|
86 | - $this->delete($size,$start+1, $width); |
|
82 | + public function merge($size=CssSize::SIZE_MD, $start, $width) { |
|
83 | + $col=$this->getColAt($start, false); |
|
84 | + if (isset($col)) { |
|
85 | + $col->setWidth($size, $width+1); |
|
86 | + $this->delete($size, $start+1, $width); |
|
87 | 87 | } |
88 | 88 | } |
89 | - public function delete($size=CssSize::SIZE_MD,$start,$width){ |
|
90 | - while($start<sizeof($this->cols)+1 && $width>0){ |
|
91 | - $col=$this->getColAt($start,false); |
|
92 | - if(isset($col)){ |
|
89 | + public function delete($size=CssSize::SIZE_MD, $start, $width) { |
|
90 | + while ($start<sizeof($this->cols)+1 && $width>0) { |
|
91 | + $col=$this->getColAt($start, false); |
|
92 | + if (isset($col)) { |
|
93 | 93 | $widthCol=$col->getWidth($size); |
94 | - if($widthCol<=$width){ |
|
94 | + if ($widthCol<=$width) { |
|
95 | 95 | unset($this->cols[$start-1]); |
96 | - $this->cols = array_values($this->cols); |
|
96 | + $this->cols=array_values($this->cols); |
|
97 | 97 | $width=$width-$widthCol; |
98 | 98 | } |
99 | - }else{ |
|
99 | + }else { |
|
100 | 100 | $width=0; |
101 | 101 | } |
102 | 102 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $result=null; |
44 | 44 | if($index<sizeof($this->cols)+1){ |
45 | 45 | $result=$this->cols[$index-1]; |
46 | - }else if ($force){ |
|
46 | + } else if ($force){ |
|
47 | 47 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
48 | 48 | } |
49 | 49 | return $result; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->cols = array_values($this->cols); |
97 | 97 | $width=$width-$widthCol; |
98 | 98 | } |
99 | - }else{ |
|
99 | + } else{ |
|
100 | 100 | $width=0; |
101 | 101 | } |
102 | 102 | } |
@@ -55,6 +55,9 @@ discard block |
||
55 | 55 | return $this->_semantic; |
56 | 56 | } |
57 | 57 | |
58 | + /** |
|
59 | + * @param JsUtils $jsUtils |
|
60 | + */ |
|
58 | 61 | public function __construct($params,$jsUtils) { |
59 | 62 | $this->params=array(); |
60 | 63 | foreach ( $params as $key => $val ) { |
@@ -175,7 +178,7 @@ discard block |
||
175 | 178 | * |
176 | 179 | * @param string $element |
177 | 180 | * @param array $options |
178 | - * @return void |
|
181 | + * @return string |
|
179 | 182 | */ |
180 | 183 | public function sortable($element, $options=array()) { |
181 | 184 | if (count($options)>0) { |
@@ -306,6 +309,7 @@ discard block |
||
306 | 309 | |
307 | 310 | /** |
308 | 311 | * A wrapper for writing document.ready() |
312 | + * @param string $js |
|
309 | 313 | * @return string |
310 | 314 | */ |
311 | 315 | public function _document_ready($js) { |
@@ -353,6 +357,9 @@ discard block |
||
353 | 357 | return $value; |
354 | 358 | } |
355 | 359 | |
360 | + /** |
|
361 | + * @param string $input |
|
362 | + */ |
|
356 | 363 | private function minify($input) { |
357 | 364 | if(trim($input) === "") return $input; |
358 | 365 | return preg_replace( |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | * jQuery Class |
18 | 18 | */ |
19 | 19 | class Jquery { |
20 | - use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait; |
|
20 | + use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait; |
|
21 | 21 | protected $_ui; |
22 | 22 | protected $_bootstrap; |
23 | 23 | protected $_semantic; |
24 | 24 | protected $libraryFile; |
25 | 25 | protected $_javascript_folder='js'; |
26 | - protected $jquery_code_for_load=array (); |
|
27 | - protected $jquery_code_for_compile=array (); |
|
26 | + protected $jquery_code_for_load=array(); |
|
27 | + protected $jquery_code_for_compile=array(); |
|
28 | 28 | protected $jquery_corner_active=FALSE; |
29 | 29 | protected $jquery_table_sorter_active=FALSE; |
30 | 30 | protected $jquery_table_sorter_pager_active=FALSE; |
31 | 31 | protected $jsUtils; |
32 | 32 | |
33 | - protected $jquery_events=array ( |
|
34 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
33 | + protected $jquery_events=array( |
|
34 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | public function ui($ui=NULL) { |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | return $this->_semantic; |
56 | 56 | } |
57 | 57 | |
58 | - public function __construct($params,$jsUtils) { |
|
58 | + public function __construct($params, $jsUtils) { |
|
59 | 59 | $this->params=array(); |
60 | - foreach ( $params as $key => $val ) { |
|
60 | + foreach ($params as $key => $val) { |
|
61 | 61 | $this->params[$key]=$params[$key]; |
62 | 62 | } |
63 | 63 | $this->jsUtils=$jsUtils; |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function _output($array_js='') { |
127 | 127 | if (!is_array($array_js)) { |
128 | - $array_js=array ( |
|
128 | + $array_js=array( |
|
129 | 129 | $array_js |
130 | 130 | ); |
131 | 131 | } |
132 | 132 | |
133 | - foreach ( $array_js as $js ) { |
|
133 | + foreach ($array_js as $js) { |
|
134 | 134 | $this->jquery_code_for_compile[]="\t$js\n"; |
135 | 135 | } |
136 | 136 | } |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | * @param string $param |
143 | 143 | * @param boolean $immediatly delayed if false |
144 | 144 | */ |
145 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
145 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
146 | 146 | $element=$this->_prep_element($element); |
147 | 147 | if (isset($param)) { |
148 | 148 | $param=$this->_prep_value($param); |
149 | 149 | $str="$({$element}).{$jQueryCall}({$param});"; |
150 | - } else |
|
150 | + }else |
|
151 | 151 | $str="$({$element}).{$jQueryCall}();"; |
152 | 152 | if ($immediatly) |
153 | 153 | $this->jquery_code_for_compile[]=$str; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param boolean $immediatly delayed if false |
162 | 162 | * @return string |
163 | 163 | */ |
164 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
164 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
165 | 165 | $to=$this->_prep_element($to); |
166 | 166 | $element=$this->_prep_element($element); |
167 | 167 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function sortable($element, $options=array()) { |
181 | 181 | if (count($options)>0) { |
182 | - $sort_options=array (); |
|
183 | - foreach ( $options as $k => $v ) { |
|
182 | + $sort_options=array(); |
|
183 | + foreach ($options as $k => $v) { |
|
184 | 184 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
185 | 185 | } |
186 | 186 | $sort_options=implode(",", $sort_options); |
187 | - } else { |
|
187 | + }else { |
|
188 | 188 | $sort_options=''; |
189 | 189 | } |
190 | 190 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
215 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
216 | 216 | if (is_array($js)) { |
217 | 217 | $js=implode("\n\t\t", $js); |
218 | 218 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
227 | 227 | else |
228 | 228 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
229 | - if($immediatly) |
|
229 | + if ($immediatly) |
|
230 | 230 | $this->jquery_code_for_compile[]=$event; |
231 | 231 | return $event; |
232 | 232 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | // External references |
268 | 268 | $external_scripts=implode('', $this->jquery_code_for_load); |
269 | - extract(array ( |
|
269 | + extract(array( |
|
270 | 270 | 'library_src' => $external_scripts |
271 | 271 | )); |
272 | 272 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | $script.='});'; |
282 | 282 | |
283 | 283 | $this->jquery_code_for_compile=array(); |
284 | - if($this->params["debug"]==false){ |
|
284 | + if ($this->params["debug"]==false) { |
|
285 | 285 | $script=$this->minify($script); |
286 | 286 | } |
287 | 287 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
288 | 288 | |
289 | - if ($view!==NULL){ |
|
290 | - $this->jsUtils->createScriptVariable($view,$view_var, $output); |
|
289 | + if ($view!==NULL) { |
|
290 | + $this->jsUtils->createScriptVariable($view, $view_var, $output); |
|
291 | 291 | } |
292 | 292 | return $output; |
293 | 293 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @return void |
303 | 303 | */ |
304 | 304 | public function _clear_compile() { |
305 | - $this->jquery_code_for_compile=array (); |
|
305 | + $this->jquery_code_for_compile=array(); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -311,12 +311,12 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function _document_ready($js) { |
313 | 313 | if (!is_array($js)) { |
314 | - $js=array ( |
|
314 | + $js=array( |
|
315 | 315 | $js |
316 | 316 | ); |
317 | 317 | } |
318 | 318 | |
319 | - foreach ( $js as $script ) { |
|
319 | + foreach ($js as $script) { |
|
320 | 320 | $this->jquery_code_for_compile[]=$script; |
321 | 321 | } |
322 | 322 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return string |
331 | 331 | */ |
332 | 332 | public function _prep_element($element) { |
333 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
333 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
334 | 334 | $element='"'.addslashes($element).'"'; |
335 | 335 | } |
336 | 336 | return $element; |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | if (is_array($value)) { |
349 | 349 | $value=implode(",", $value); |
350 | 350 | } |
351 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
351 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
352 | 352 | $value='"'.$value.'"'; |
353 | 353 | } |
354 | 354 | return $value; |
355 | 355 | } |
356 | 356 | |
357 | 357 | private function minify($input) { |
358 | - if(trim($input) === "") return $input; |
|
358 | + if (trim($input)==="") return $input; |
|
359 | 359 | return preg_replace( |
360 | 360 | array( |
361 | 361 | // Remove comment(s) |
@@ -147,10 +147,12 @@ discard block |
||
147 | 147 | if (isset($param)) { |
148 | 148 | $param=$this->_prep_value($param); |
149 | 149 | $str="$({$element}).{$jQueryCall}({$param});"; |
150 | - } else |
|
151 | - $str="$({$element}).{$jQueryCall}();"; |
|
152 | - if ($immediatly) |
|
153 | - $this->jquery_code_for_compile[]=$str; |
|
150 | + } else { |
|
151 | + $str="$({$element}).{$jQueryCall}();"; |
|
152 | + } |
|
153 | + if ($immediatly) { |
|
154 | + $this->jquery_code_for_compile[]=$str; |
|
155 | + } |
|
154 | 156 | return $str; |
155 | 157 | } |
156 | 158 | /** |
@@ -165,8 +167,9 @@ discard block |
||
165 | 167 | $to=$this->_prep_element($to); |
166 | 168 | $element=$this->_prep_element($element); |
167 | 169 | $str="$({$to}).{$jQueryCall}({$element});"; |
168 | - if ($immediatly) |
|
169 | - $this->jquery_code_for_compile[]=$str; |
|
170 | + if ($immediatly) { |
|
171 | + $this->jquery_code_for_compile[]=$str; |
|
172 | + } |
|
170 | 173 | return $str; |
171 | 174 | } |
172 | 175 | |
@@ -222,12 +225,14 @@ discard block |
||
222 | 225 | if ($stopPropagation===true) { |
223 | 226 | $js="event.stopPropagation();\n".$js; |
224 | 227 | } |
225 | - if (array_search($event, $this->jquery_events)===false) |
|
226 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
227 | - else |
|
228 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
229 | - if($immediatly) |
|
230 | - $this->jquery_code_for_compile[]=$event; |
|
228 | + if (array_search($event, $this->jquery_events)===false) { |
|
229 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
230 | + } else { |
|
231 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
232 | + } |
|
233 | + if($immediatly) { |
|
234 | + $this->jquery_code_for_compile[]=$event; |
|
235 | + } |
|
231 | 236 | return $event; |
232 | 237 | } |
233 | 238 | |
@@ -355,7 +360,9 @@ discard block |
||
355 | 360 | } |
356 | 361 | |
357 | 362 | private function minify($input) { |
358 | - if(trim($input) === "") return $input; |
|
363 | + if(trim($input) === "") { |
|
364 | + return $input; |
|
365 | + } |
|
359 | 366 | return preg_replace( |
360 | 367 | array( |
361 | 368 | // Remove comment(s) |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\semantic\html\base\HtmlSemNavElement; |
6 | 6 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
7 | - |
|
8 | 7 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 8 | use Ajax\JsUtils; |
10 | 9 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->startIndex=$startIndex; |
52 | 52 | $this->autoActive=$autoActive; |
53 | 53 | $this->_contentSeparator="<div class='divider'> / </div>"; |
54 | - $this->_hrefFunction=function ($e) { |
|
54 | + $this->_hrefFunction=function($e) { |
|
55 | 55 | return $e->getContent(); |
56 | 56 | }; |
57 | 57 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumbs |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function setActive($index=null) { |
82 | 82 | if (!isset($index)) { |
83 | - $index=sizeof($this->content) - 1; |
|
83 | + $index=sizeof($this->content)-1; |
|
84 | 84 | } |
85 | 85 | $activeItem=$this->content[$index]; |
86 | 86 | $activeItem->addToProperty("class", "active"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param Dispatcher $dispatcher the request dispatcher |
94 | 94 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
95 | 95 | */ |
96 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
96 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
97 | 97 | return $this->addItems($js->fromDispatcher($dispatcher)); |
98 | 98 | } |
99 | 99 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | if (!isset($index)) { |
108 | 108 | $index=sizeof($this->content); |
109 | 109 | } |
110 | - if ($this->absolutePaths === true) { |
|
110 | + if ($this->absolutePaths===true) { |
|
111 | 111 | return $this->_hrefFunction($this->content[$index]); |
112 | - } else { |
|
113 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
112 | + }else { |
|
113 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
114 | 114 | return $this->_hrefFunction($e); |
115 | - }, $this->content), $this->startIndex, $index + 1)); |
|
115 | + }, $this->content), $this->startIndex, $index+1)); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $this->setActive(); |
147 | 147 | } |
148 | 148 | $count=$this->count(); |
149 | - for($i=1; $i < $count; $i++) { |
|
150 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
149 | + for ($i=1; $i<$count; $i++) { |
|
150 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
151 | 151 | } |
152 | 152 | return parent::compile($js, $view); |
153 | 153 | } |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
158 | 158 | */ |
159 | 159 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
160 | - foreach ( $this->content as $element ) { |
|
160 | + foreach ($this->content as $element) { |
|
161 | 161 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
162 | 162 | } |
163 | 163 | return $this; |
164 | 164 | } |
165 | 165 | |
166 | 166 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
167 | - foreach ( $this->content as $element ) { |
|
168 | - if ($element->getProperty($this->attr) != NULL){ |
|
167 | + foreach ($this->content as $element) { |
|
168 | + if ($element->getProperty($this->attr)!=NULL) { |
|
169 | 169 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
170 | 170 | } |
171 | 171 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function createItem($value) { |
182 | 182 | $count=$this->count(); |
183 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
183 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
184 | 184 | if (\is_array($value)) |
185 | 185 | $itemO->fromArray($value); |
186 | 186 | else { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | public function addIconAt($icon, $index) { |
193 | 193 | $item=$this->getItem($index); |
194 | 194 | if (isset($item)) { |
195 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
195 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
196 | 196 | $item->wrapContent($icon); |
197 | 197 | } |
198 | 198 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | public function addItem($item) { |
201 | 201 | $count=$this->count(); |
202 | 202 | $itemO=parent::addItem($item); |
203 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
203 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
204 | 204 | $itemO->setProperty($this->attr, $this->getHref($count)); |
205 | 205 | return $itemO; |
206 | 206 | } |
@@ -181,9 +181,9 @@ |
||
181 | 181 | protected function createItem($value) { |
182 | 182 | $count=$this->count(); |
183 | 183 | $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
184 | - if (\is_array($value)) |
|
185 | - $itemO->fromArray($value); |
|
186 | - else { |
|
184 | + if (\is_array($value)) { |
|
185 | + $itemO->fromArray($value); |
|
186 | + } else { |
|
187 | 187 | $itemO->setContent($value); |
188 | 188 | } |
189 | 189 | return $itemO; |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | * Associate an ajax get to the breadcrumb elements, displayed in $targetSelector |
65 | 65 | * $attr member is used to build each element url |
66 | 66 | * @param string $targetSelector the target of the get |
67 | - * @param string $attr the html attribute used to build the elements url |
|
68 | - * @return HtmlBreadcrumbs |
|
67 | + * @return HtmlBreadcrumb |
|
69 | 68 | */ |
70 | 69 | public function autoGetOnClick($targetSelector) { |
71 | 70 | return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
@@ -91,7 +90,7 @@ discard block |
||
91 | 90 | * Add new elements in breadcrumbs corresponding to request dispatcher : controllerName, actionName, parameters |
92 | 91 | * @param JsUtils $js |
93 | 92 | * @param Dispatcher $dispatcher the request dispatcher |
94 | - * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
|
93 | + * @return HtmlBreadcrumb |
|
95 | 94 | */ |
96 | 95 | public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
97 | 96 | return $this->addItems($js->fromDispatcher($dispatcher)); |
@@ -120,7 +119,7 @@ discard block |
||
120 | 119 | * sets the function who generates the href elements. |
121 | 120 | * default : function($element){return $element->getContent()} |
122 | 121 | * @param function $_hrefFunction |
123 | - * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
|
122 | + * @return HtmlBreadcrumb |
|
124 | 123 | */ |
125 | 124 | public function setHrefFunction($_hrefFunction) { |
126 | 125 | $this->_hrefFunction=$_hrefFunction; |