@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | use Ajax\JsUtils; |
12 | 12 | |
13 | 13 | class HtmlTD extends HtmlSemDoubleElement { |
14 | - use TextAlignmentTrait,TableElementTrait; |
|
14 | + use TextAlignmentTrait, TableElementTrait; |
|
15 | 15 | |
16 | 16 | private $_container; |
17 | 17 | |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | |
20 | 20 | private $_col; |
21 | 21 | |
22 | - private $_colMerged = false; |
|
22 | + private $_colMerged=false; |
|
23 | 23 | |
24 | - private $_rowMerged = false; |
|
24 | + private $_rowMerged=false; |
|
25 | 25 | |
26 | - private $_deleted = false; |
|
26 | + private $_deleted=false; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | * @param mixed $content |
32 | 32 | * @param string $tagName |
33 | 33 | */ |
34 | - public function __construct($identifier, $content = NULL, $tagName = "td") { |
|
34 | + public function __construct($identifier, $content=NULL, $tagName="td") { |
|
35 | 35 | parent::__construct($identifier, $tagName, "", $content); |
36 | - $this->_variations = [ |
|
36 | + $this->_variations=[ |
|
37 | 37 | Variation::COLLAPSING |
38 | 38 | ]; |
39 | - $this->_states = [ |
|
39 | + $this->_states=[ |
|
40 | 40 | State::ACTIVE, |
41 | 41 | State::POSITIVE, |
42 | 42 | State::NEGATIVE, |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | public function setContainer($container, $row, $col) { |
50 | - $this->_container = $container; |
|
51 | - $this->_row = $row; |
|
52 | - $this->_col = $col; |
|
50 | + $this->_container=$container; |
|
51 | + $this->_row=$row; |
|
52 | + $this->_col=$col; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setValue($value) { |
56 | - $this->content = $value; |
|
56 | + $this->content=$value; |
|
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | public function setRowspan($rowspan) { |
66 | - $to = min($this->_container->count(), $this->_row + $rowspan - 1); |
|
67 | - for ($i = $to; $i > $this->_row; $i --) { |
|
66 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
67 | + for ($i=$to; $i>$this->_row; $i--) { |
|
68 | 68 | $this->_container->toDelete($i, $this->_col); |
69 | 69 | } |
70 | 70 | $this->setProperty("rowspan", $rowspan); |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | public function setRowspanned($rowspan) { |
75 | - $to = min($this->_container->count(), $this->_row + $rowspan - 1); |
|
76 | - for ($i = $to; $i > $this->_row; $i --) { |
|
75 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
76 | + for ($i=$to; $i>$this->_row; $i--) { |
|
77 | 77 | $this->_container->toRowspanned($i, $this->_col); |
78 | 78 | } |
79 | 79 | $this->setProperty("rowspan", $rowspan); |
@@ -81,16 +81,16 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | public function mergeRow() { |
84 | - if (! $this->_rowMerged) { |
|
85 | - $this->_rowMerged = true; |
|
84 | + if (!$this->_rowMerged) { |
|
85 | + $this->_rowMerged=true; |
|
86 | 86 | return $this->setRowspan($this->_container->count()); |
87 | 87 | } |
88 | 88 | return $this->_container; |
89 | 89 | } |
90 | 90 | |
91 | 91 | public function mergeCol() { |
92 | - if (! $this->_colMerged) { |
|
93 | - $this->_colMerged = true; |
|
92 | + if (!$this->_colMerged) { |
|
93 | + $this->_colMerged=true; |
|
94 | 94 | return $this->setColspan($this->_container->getRow($this->_row) |
95 | 95 | ->count()); |
96 | 96 | } |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | public function setColspan($colspan) { |
101 | - $to = min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1); |
|
102 | - for ($i = $to; $i > $this->_col; $i --) { |
|
103 | - $this->_container->delete($this->_row, $this->_col + 1); |
|
101 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
102 | + for ($i=$to; $i>$this->_col; $i--) { |
|
103 | + $this->_container->delete($this->_row, $this->_col+1); |
|
104 | 104 | } |
105 | 105 | $this->setProperty("colspan", $colspan); |
106 | 106 | return $this->_container; |
107 | 107 | } |
108 | 108 | |
109 | 109 | public function getColspan() { |
110 | - $colspan = 1; |
|
110 | + $colspan=1; |
|
111 | 111 | if (\array_key_exists("colspan", $this->properties)) |
112 | - $colspan = $this->getProperty("colspan"); |
|
112 | + $colspan=$this->getProperty("colspan"); |
|
113 | 113 | return $colspan; |
114 | 114 | } |
115 | 115 | |
116 | 116 | public function getRowspan() { |
117 | - $rowspan = 1; |
|
117 | + $rowspan=1; |
|
118 | 118 | if (\array_key_exists("rowspan", $this->properties)) |
119 | - $rowspan = $this->getProperty("rowspan"); |
|
119 | + $rowspan=$this->getProperty("rowspan"); |
|
120 | 120 | return $rowspan; |
121 | 121 | } |
122 | 122 | |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | return $this; |
133 | 133 | } |
134 | 134 | |
135 | - public function setSelectable($href = "#") { |
|
135 | + public function setSelectable($href="#") { |
|
136 | 136 | if (\is_string($this->content)) { |
137 | - $this->content = new HtmlLink("", $href, $this->content); |
|
137 | + $this->content=new HtmlLink("", $href, $this->content); |
|
138 | 138 | } |
139 | 139 | return $this->addToProperty("class", "selectable"); |
140 | 140 | } |
141 | 141 | |
142 | 142 | public function setWidth($width) { |
143 | 143 | if (\is_int($width)) { |
144 | - $width = Wide::getConstants()["W" . $width]; |
|
144 | + $width=Wide::getConstants()["W".$width]; |
|
145 | 145 | } |
146 | 146 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
147 | 147 | return $this->addToPropertyCtrl("class", "wide", array( |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | public function toDelete() { |
153 | - $this->_deleted = true; |
|
153 | + $this->_deleted=true; |
|
154 | 154 | return $this; |
155 | 155 | } |
156 | 156 | |
157 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
158 | - if (! $this->_deleted) |
|
157 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
158 | + if (!$this->_deleted) |
|
159 | 159 | return parent::compile($js, $view); |
160 | 160 | } |
161 | 161 | } |
@@ -108,15 +108,17 @@ discard block |
||
108 | 108 | |
109 | 109 | public function getColspan() { |
110 | 110 | $colspan = 1; |
111 | - if (\array_key_exists("colspan", $this->properties)) |
|
112 | - $colspan = $this->getProperty("colspan"); |
|
111 | + if (\array_key_exists("colspan", $this->properties)) { |
|
112 | + $colspan = $this->getProperty("colspan"); |
|
113 | + } |
|
113 | 114 | return $colspan; |
114 | 115 | } |
115 | 116 | |
116 | 117 | public function getRowspan() { |
117 | 118 | $rowspan = 1; |
118 | - if (\array_key_exists("rowspan", $this->properties)) |
|
119 | - $rowspan = $this->getProperty("rowspan"); |
|
119 | + if (\array_key_exists("rowspan", $this->properties)) { |
|
120 | + $rowspan = $this->getProperty("rowspan"); |
|
121 | + } |
|
120 | 122 | return $rowspan; |
121 | 123 | } |
122 | 124 | |
@@ -155,7 +157,8 @@ discard block |
||
155 | 157 | } |
156 | 158 | |
157 | 159 | public function compile(JsUtils $js = NULL, &$view = NULL) { |
158 | - if (! $this->_deleted) |
|
159 | - return parent::compile($js, $view); |
|
160 | + if (! $this->_deleted) { |
|
161 | + return parent::compile($js, $view); |
|
162 | + } |
|
160 | 163 | } |
161 | 164 | } |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) { |
34 | 34 | parent::__construct($identifier, $tagName, ""); |
35 | - if (isset($rowCount) && isset($colCount)) |
|
36 | - $this->setRowCount($rowCount, $colCount); |
|
35 | + if (isset($rowCount) && isset($colCount)) { |
|
36 | + $this->setRowCount($rowCount, $colCount); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | /** |
@@ -193,10 +194,11 @@ discard block |
||
193 | 194 | $values = \array_fill(0, $count, $values); |
194 | 195 | $isArray = false; |
195 | 196 | } |
196 | - if (JArray::dimension($values) == 1 && $isArray) |
|
197 | - $values = [ |
|
197 | + if (JArray::dimension($values) == 1 && $isArray) { |
|
198 | + $values = [ |
|
198 | 199 | $values |
199 | 200 | ]; |
201 | + } |
|
200 | 202 | |
201 | 203 | $count = \min(\sizeof($values), $count); |
202 | 204 | |
@@ -223,8 +225,9 @@ discard block |
||
223 | 225 | $count = $this->count(); |
224 | 226 | for ($i = 0; $i < $count; $i ++) { |
225 | 227 | $cell = $this->getCell($i, $colIndex); |
226 | - if ($cell instanceof BaseTrait) |
|
227 | - $cell->addVariations($variations); |
|
228 | + if ($cell instanceof BaseTrait) { |
|
229 | + $cell->addVariations($variations); |
|
230 | + } |
|
228 | 231 | } |
229 | 232 | return $this; |
230 | 233 | } |
@@ -233,8 +236,9 @@ discard block |
||
233 | 236 | $count = $this->count(); |
234 | 237 | for ($i = 0; $i < $count; $i ++) { |
235 | 238 | $cell = $this->getCell($i, $colIndex); |
236 | - if (isset($cell)) |
|
237 | - $cell->addToProperty($name, $value); |
|
239 | + if (isset($cell)) { |
|
240 | + $cell->addToProperty($name, $value); |
|
241 | + } |
|
238 | 242 | } |
239 | 243 | return $this; |
240 | 244 | } |
@@ -252,8 +256,9 @@ discard block |
||
252 | 256 | $count = $this->count(); |
253 | 257 | for ($i = 0; $i < $count; $i ++) { |
254 | 258 | $index = $this->content[$i]->getColPosition($colIndex); |
255 | - if ($index !== NULL) |
|
256 | - $this->getCell($i, $index)->$function(); |
|
259 | + if ($index !== NULL) { |
|
260 | + $this->getCell($i, $index)->$function(); |
|
261 | + } |
|
257 | 262 | } |
258 | 263 | return $this; |
259 | 264 | } |
@@ -264,8 +269,9 @@ discard block |
||
264 | 269 | $maxRow = $this->content[$i]->count(); |
265 | 270 | $index = $maxRow - $colIndex - 1; |
266 | 271 | if (($cell = $this->getCell($i, $index)) !== NULL) { |
267 | - if ($cell->getColspan() == 1) |
|
268 | - $cell->$function(); |
|
272 | + if ($cell->getColspan() == 1) { |
|
273 | + $cell->$function(); |
|
274 | + } |
|
269 | 275 | } |
270 | 276 | } |
271 | 277 | return $this; |
@@ -311,8 +317,9 @@ discard block |
||
311 | 317 | */ |
312 | 318 | public function getColCount() { |
313 | 319 | $result = 0; |
314 | - if ($this->count() > 0) |
|
315 | - $result = $this->getItem(0)->count(); |
|
320 | + if ($this->count() > 0) { |
|
321 | + $result = $this->getItem(0)->count(); |
|
322 | + } |
|
316 | 323 | return $result; |
317 | 324 | } |
318 | 325 | |
@@ -337,15 +344,17 @@ discard block |
||
337 | 344 | |
338 | 345 | public function toDelete($rowIndex, $colIndex) { |
339 | 346 | $row = $this->getItem($rowIndex); |
340 | - if (isset($row) === true) |
|
341 | - $row->toDelete($colIndex); |
|
347 | + if (isset($row) === true) { |
|
348 | + $row->toDelete($colIndex); |
|
349 | + } |
|
342 | 350 | return $this; |
343 | 351 | } |
344 | 352 | |
345 | 353 | public function toRowspanned($rowIndex, $colIndex) { |
346 | 354 | $row = $this->getItem($rowIndex); |
347 | - if (isset($row) === true) |
|
348 | - $row->toRowspanned($colIndex); |
|
355 | + if (isset($row) === true) { |
|
356 | + $row->toRowspanned($colIndex); |
|
357 | + } |
|
349 | 358 | return $this; |
350 | 359 | } |
351 | 360 | |
@@ -455,8 +464,9 @@ discard block |
||
455 | 464 | foreach ($rows as $row) { |
456 | 465 | $cell = $row->getItem($colIndex); |
457 | 466 | $value = $cell->getContent(); |
458 | - if ($functionExists) |
|
459 | - $value = \call_user_func($function, $value); |
|
467 | + if ($functionExists) { |
|
468 | + $value = \call_user_func($function, $value); |
|
469 | + } |
|
460 | 470 | if ($value !== $identiqual) { |
461 | 471 | if ($counter > 0 && isset($cellToMerge)) { |
462 | 472 | $cellToMerge->setRowspanned($counter); |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | class HtmlTableContent extends HtmlSemCollection { |
17 | 17 | protected $_focusable=false; |
18 | 18 | |
19 | - protected $_tdTagNames = [ |
|
19 | + protected $_tdTagNames=[ |
|
20 | 20 | "thead" => "th", |
21 | 21 | "tbody" => "td", |
22 | 22 | "tfoot" => "th" |
23 | 23 | ]; |
24 | 24 | |
25 | - protected $_merged = false; |
|
25 | + protected $_merged=false; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param int $rowCount |
32 | 32 | * @param int $colCount |
33 | 33 | */ |
34 | - public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) { |
|
34 | + public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
|
35 | 35 | parent::__construct($identifier, $tagName, ""); |
36 | 36 | if (isset($rowCount) && isset($colCount)) |
37 | 37 | $this->setRowCount($rowCount, $colCount); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @return HtmlTableContent |
45 | 45 | */ |
46 | 46 | public function setRowCount($rowCount, $colCount) { |
47 | - $count = $this->count(); |
|
48 | - for ($i = $count; $i < $rowCount; $i ++) { |
|
47 | + $count=$this->count(); |
|
48 | + for ($i=$count; $i<$rowCount; $i++) { |
|
49 | 49 | $this->addItem($colCount); |
50 | 50 | } |
51 | 51 | return $this; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function refreshTR() { |
59 | - $this->_template = "%wrapContentBefore%%content%%wrapContentAfter%"; |
|
59 | + $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | * @return HtmlTR |
68 | 68 | */ |
69 | 69 | protected function createItem($value) { |
70 | - $count = $this->count(); |
|
71 | - $tr = new HtmlTR(""); |
|
70 | + $count=$this->count(); |
|
71 | + $tr=new HtmlTR(""); |
|
72 | 72 | $tr->setContainer($this, $count); |
73 | - if($this->_focusable) { |
|
73 | + if ($this->_focusable) { |
|
74 | 74 | $tr->setProperty('tabindex', $count); |
75 | 75 | } |
76 | 76 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
77 | - if (isset($value) === true) { |
|
77 | + if (isset($value)===true) { |
|
78 | 78 | $tr->setColCount($value); |
79 | 79 | } |
80 | 80 | return $tr; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | return $this->addItem($row); |
103 | 103 | } |
104 | 104 | |
105 | - public function addMergeRow($colCount, $value = null) { |
|
106 | - $row = $this->addRow($colCount); |
|
105 | + public function addMergeRow($colCount, $value=null) { |
|
106 | + $row=$this->addRow($colCount); |
|
107 | 107 | $row->mergeCol(); |
108 | 108 | if (isset($value)) { |
109 | 109 | $row->setValues([ |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | * @return HtmlTD|HtmlDoubleElement |
130 | 130 | */ |
131 | 131 | public function getCell($row, $col) { |
132 | - $row = $this->getItem($row); |
|
132 | + $row=$this->getItem($row); |
|
133 | 133 | if (isset($row) && $row instanceof HtmlCollection) { |
134 | - $col = $row->getItem($col); |
|
134 | + $col=$row->getItem($col); |
|
135 | 135 | } else { |
136 | - $col = $row; |
|
136 | + $col=$row; |
|
137 | 137 | } |
138 | 138 | return $col; |
139 | 139 | } |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * @param mixed $value |
155 | 155 | * @return HtmlTableContent |
156 | 156 | */ |
157 | - public function setCellValue($row, $col, $value = "") { |
|
158 | - $cell = $this->getCell($row, $col); |
|
159 | - if (isset($cell) === true) { |
|
157 | + public function setCellValue($row, $col, $value="") { |
|
158 | + $cell=$this->getCell($row, $col); |
|
159 | + if (isset($cell)===true) { |
|
160 | 160 | $cell->setValue($value); |
161 | 161 | } |
162 | 162 | return $this; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @param mixed $values |
169 | 169 | */ |
170 | - public function setValues($values = array()) { |
|
171 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
170 | + public function setValues($values=array()) { |
|
171 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
172 | 172 | $row->setValues($_values); |
173 | 173 | }); |
174 | 174 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param mixed $values |
180 | 180 | */ |
181 | - public function addValues($values = array()) { |
|
182 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
181 | + public function addValues($values=array()) { |
|
182 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
183 | 183 | $row->addValues($_values); |
184 | 184 | }); |
185 | 185 | } |
@@ -191,42 +191,42 @@ discard block |
||
191 | 191 | * @param callable $callback |
192 | 192 | */ |
193 | 193 | protected function _addOrSetValues($values, $callback) { |
194 | - $count = $this->count(); |
|
195 | - $isArray = true; |
|
196 | - if (! \is_array($values)) { |
|
197 | - $values = \array_fill(0, $count, $values); |
|
198 | - $isArray = false; |
|
194 | + $count=$this->count(); |
|
195 | + $isArray=true; |
|
196 | + if (!\is_array($values)) { |
|
197 | + $values=\array_fill(0, $count, $values); |
|
198 | + $isArray=false; |
|
199 | 199 | } |
200 | - if (JArray::dimension($values) == 1 && $isArray) |
|
201 | - $values = [ |
|
200 | + if (JArray::dimension($values)==1 && $isArray) |
|
201 | + $values=[ |
|
202 | 202 | $values |
203 | 203 | ]; |
204 | 204 | |
205 | - $count = \min(\sizeof($values), $count); |
|
205 | + $count=\min(\sizeof($values), $count); |
|
206 | 206 | |
207 | - for ($i = 0; $i < $count; $i ++) { |
|
208 | - $row = $this->content[$i]; |
|
207 | + for ($i=0; $i<$count; $i++) { |
|
208 | + $row=$this->content[$i]; |
|
209 | 209 | $callback($row, $values[$i]); |
210 | 210 | } |
211 | 211 | return $this; |
212 | 212 | } |
213 | 213 | |
214 | - public function setColValues($colIndex, $values = array()) { |
|
215 | - $count = $this->count(); |
|
216 | - if (! \is_array($values)) { |
|
217 | - $values = \array_fill(0, $count, $values); |
|
214 | + public function setColValues($colIndex, $values=array()) { |
|
215 | + $count=$this->count(); |
|
216 | + if (!\is_array($values)) { |
|
217 | + $values=\array_fill(0, $count, $values); |
|
218 | 218 | } |
219 | - $count = \min(\sizeof($values), $count); |
|
220 | - for ($i = 0; $i < $count; $i ++) { |
|
219 | + $count=\min(\sizeof($values), $count); |
|
220 | + for ($i=0; $i<$count; $i++) { |
|
221 | 221 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
222 | 222 | } |
223 | 223 | return $this; |
224 | 224 | } |
225 | 225 | |
226 | - public function addColVariations($colIndex, $variations = array()) { |
|
227 | - $count = $this->count(); |
|
228 | - for ($i = 0; $i < $count; $i ++) { |
|
229 | - $cell = $this->getCell($i, $colIndex); |
|
226 | + public function addColVariations($colIndex, $variations=array()) { |
|
227 | + $count=$this->count(); |
|
228 | + for ($i=0; $i<$count; $i++) { |
|
229 | + $cell=$this->getCell($i, $colIndex); |
|
230 | 230 | if ($cell instanceof BaseTrait) |
231 | 231 | $cell->addVariations($variations); |
232 | 232 | } |
@@ -234,41 +234,41 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | public function addPropertyCol($colIndex, $name, $value) { |
237 | - $count = $this->count(); |
|
238 | - for ($i = 0; $i < $count; $i ++) { |
|
239 | - $cell = $this->getCell($i, $colIndex); |
|
237 | + $count=$this->count(); |
|
238 | + for ($i=0; $i<$count; $i++) { |
|
239 | + $cell=$this->getCell($i, $colIndex); |
|
240 | 240 | if (isset($cell)) |
241 | 241 | $cell->addToProperty($name, $value); |
242 | 242 | } |
243 | 243 | return $this; |
244 | 244 | } |
245 | 245 | |
246 | - public function setRowValues($rowIndex, $values = array()) { |
|
247 | - $count = $this->count(); |
|
248 | - if (! \is_array($values)) { |
|
249 | - $values = \array_fill(0, $count, $values); |
|
246 | + public function setRowValues($rowIndex, $values=array()) { |
|
247 | + $count=$this->count(); |
|
248 | + if (!\is_array($values)) { |
|
249 | + $values=\array_fill(0, $count, $values); |
|
250 | 250 | } |
251 | 251 | $this->getItem($rowIndex)->setValues($values); |
252 | 252 | return $this; |
253 | 253 | } |
254 | 254 | |
255 | 255 | private function colAlign($colIndex, $function) { |
256 | - $count = $this->count(); |
|
257 | - for ($i = 0; $i < $count; $i ++) { |
|
258 | - $index = $this->content[$i]->getColPosition($colIndex); |
|
259 | - if ($index !== NULL) |
|
256 | + $count=$this->count(); |
|
257 | + for ($i=0; $i<$count; $i++) { |
|
258 | + $index=$this->content[$i]->getColPosition($colIndex); |
|
259 | + if ($index!==NULL) |
|
260 | 260 | $this->getCell($i, $index)->$function(); |
261 | 261 | } |
262 | 262 | return $this; |
263 | 263 | } |
264 | 264 | |
265 | 265 | private function colAlignFromRight($colIndex, $function) { |
266 | - $count = $this->count(); |
|
267 | - for ($i = 0; $i < $count; $i ++) { |
|
268 | - $maxRow = $this->content[$i]->count(); |
|
269 | - $index = $maxRow - $colIndex - 1; |
|
270 | - if (($cell = $this->getCell($i, $index)) !== NULL) { |
|
271 | - if ($cell->getColspan() == 1) |
|
266 | + $count=$this->count(); |
|
267 | + for ($i=0; $i<$count; $i++) { |
|
268 | + $maxRow=$this->content[$i]->count(); |
|
269 | + $index=$maxRow-$colIndex-1; |
|
270 | + if (($cell=$this->getCell($i, $index))!==NULL) { |
|
271 | + if ($cell->getColspan()==1) |
|
272 | 272 | $cell->$function(); |
273 | 273 | } |
274 | 274 | } |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | * @return int |
315 | 315 | */ |
316 | 316 | public function getColCount() { |
317 | - $result = 0; |
|
318 | - if ($this->count() > 0) |
|
319 | - $result = $this->getItem(0)->count(); |
|
317 | + $result=0; |
|
318 | + if ($this->count()>0) |
|
319 | + $result=$this->getItem(0)->count(); |
|
320 | 320 | return $result; |
321 | 321 | } |
322 | 322 | |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | * @param int $colIndex |
328 | 328 | * @return HtmlTableContent |
329 | 329 | */ |
330 | - public function delete($rowIndex, $colIndex = NULL) { |
|
330 | + public function delete($rowIndex, $colIndex=NULL) { |
|
331 | 331 | if (isset($colIndex)) { |
332 | - $row = $this->getItem($rowIndex); |
|
333 | - if (isset($row) === true) { |
|
332 | + $row=$this->getItem($rowIndex); |
|
333 | + if (isset($row)===true) { |
|
334 | 334 | $row->delete($colIndex); |
335 | 335 | } |
336 | 336 | } else { |
@@ -340,24 +340,24 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | public function toDelete($rowIndex, $colIndex) { |
343 | - $row = $this->getItem($rowIndex); |
|
344 | - if (isset($row) === true) |
|
343 | + $row=$this->getItem($rowIndex); |
|
344 | + if (isset($row)===true) |
|
345 | 345 | $row->toDelete($colIndex); |
346 | 346 | return $this; |
347 | 347 | } |
348 | 348 | |
349 | 349 | public function toRowspanned($rowIndex, $colIndex) { |
350 | - $row = $this->getItem($rowIndex); |
|
351 | - if (isset($row) === true) |
|
350 | + $row=$this->getItem($rowIndex); |
|
351 | + if (isset($row)===true) |
|
352 | 352 | $row->toRowspanned($colIndex); |
353 | 353 | return $this; |
354 | 354 | } |
355 | 355 | |
356 | - public function mergeCol($rowIndex = 0, $colIndex = 0) { |
|
356 | + public function mergeCol($rowIndex=0, $colIndex=0) { |
|
357 | 357 | return $this->getItem($rowIndex)->mergeCol($colIndex); |
358 | 358 | } |
359 | 359 | |
360 | - public function mergeRow($rowIndex = 0, $colIndex = 0) { |
|
360 | + public function mergeRow($rowIndex=0, $colIndex=0) { |
|
361 | 361 | return $this->getItem($rowIndex)->mergeRow($colIndex); |
362 | 362 | } |
363 | 363 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return HtmlTableContent |
378 | 378 | */ |
379 | 379 | public function conditionalCellFormat($callback, $format) { |
380 | - $rows = $this->content; |
|
380 | + $rows=$this->content; |
|
381 | 381 | foreach ($rows as $row) { |
382 | 382 | $row->conditionalCellFormat($callback, $format); |
383 | 383 | } |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | public function conditionalColFormat($colIndex, $callback, $format) { |
388 | - $rows = $this->content; |
|
388 | + $rows=$this->content; |
|
389 | 389 | foreach ($rows as $row) { |
390 | - $cell = $row->getItem($colIndex); |
|
390 | + $cell=$row->getItem($colIndex); |
|
391 | 391 | $cell->conditionnalCellFormat($callback, $format); |
392 | 392 | } |
393 | 393 | return $this; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @return HtmlTableContent |
401 | 401 | */ |
402 | 402 | public function conditionalRowFormat($callback, $format) { |
403 | - $rows = $this->content; |
|
403 | + $rows=$this->content; |
|
404 | 404 | foreach ($rows as $row) { |
405 | 405 | $row->conditionalRowFormat($callback, $format); |
406 | 406 | } |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | } |
409 | 409 | |
410 | 410 | public function hideColumn($colIndex) { |
411 | - $rows = $this->content; |
|
411 | + $rows=$this->content; |
|
412 | 412 | foreach ($rows as $row) { |
413 | - $cell = $row->getItem($colIndex); |
|
413 | + $cell=$row->getItem($colIndex); |
|
414 | 414 | $cell->addToProperty("style", "display:none;"); |
415 | 415 | } |
416 | 416 | return $this; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @return HtmlTableContent |
423 | 423 | */ |
424 | 424 | public function applyCells($callback) { |
425 | - $rows = $this->content; |
|
425 | + $rows=$this->content; |
|
426 | 426 | foreach ($rows as $row) { |
427 | 427 | $row->applyCells($callback); |
428 | 428 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @return HtmlTableContent |
436 | 436 | */ |
437 | 437 | public function applyRows($callback) { |
438 | - $rows = $this->content; |
|
438 | + $rows=$this->content; |
|
439 | 439 | foreach ($rows as $row) { |
440 | 440 | $row->apply($callback); |
441 | 441 | } |
@@ -450,28 +450,28 @@ discard block |
||
450 | 450 | * @see https://fomantic-ui.com/collections/table.html#definition needs rowspanned class |
451 | 451 | * @since fomantic-ui 2.4.8 |
452 | 452 | */ |
453 | - public function mergeIdentiqualValues($colIndex, $function = "strip_tags") { |
|
454 | - $rows = $this->content; |
|
455 | - $identiqual = null; |
|
456 | - $counter = 0; |
|
457 | - $cellToMerge = null; |
|
458 | - $functionExists = \function_exists($function); |
|
453 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
454 | + $rows=$this->content; |
|
455 | + $identiqual=null; |
|
456 | + $counter=0; |
|
457 | + $cellToMerge=null; |
|
458 | + $functionExists=\function_exists($function); |
|
459 | 459 | foreach ($rows as $row) { |
460 | - $cell = $row->getItem($colIndex); |
|
461 | - $value = $cell->getContent(); |
|
460 | + $cell=$row->getItem($colIndex); |
|
461 | + $value=$cell->getContent(); |
|
462 | 462 | if ($functionExists) |
463 | - $value = \call_user_func($function, $value); |
|
464 | - if ($value !== $identiqual) { |
|
465 | - if ($counter > 0 && isset($cellToMerge)) { |
|
463 | + $value=\call_user_func($function, $value); |
|
464 | + if ($value!==$identiqual) { |
|
465 | + if ($counter>0 && isset($cellToMerge)) { |
|
466 | 466 | $cellToMerge->setRowspanned($counter); |
467 | 467 | } |
468 | - $counter = 0; |
|
469 | - $cellToMerge = $cell; |
|
470 | - $identiqual = $value; |
|
468 | + $counter=0; |
|
469 | + $cellToMerge=$cell; |
|
470 | + $identiqual=$value; |
|
471 | 471 | } |
472 | - $counter ++; |
|
472 | + $counter++; |
|
473 | 473 | } |
474 | - if ($counter > 0 && isset($cellToMerge)) { |
|
474 | + if ($counter>0 && isset($cellToMerge)) { |
|
475 | 475 | $cellToMerge->setRowspanned($counter); |
476 | 476 | } |
477 | 477 | return $this; |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | } |
483 | 483 | |
484 | 484 | public function _setMerged($value) { |
485 | - $this->_merged = $value; |
|
485 | + $this->_merged=$value; |
|
486 | 486 | return $this; |
487 | 487 | } |
488 | 488 | |
@@ -490,6 +490,6 @@ discard block |
||
490 | 490 | * @param bool $focusable |
491 | 491 | */ |
492 | 492 | public function setFocusable(bool $focusable): void { |
493 | - $this->_focusable = $focusable; |
|
493 | + $this->_focusable=$focusable; |
|
494 | 494 | } |
495 | 495 | } |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | class HtmlGridSystem extends HtmlBsDoubleElement { |
17 | 17 | private $rows; |
18 | 18 | |
19 | - public function __construct($identifier,$numRows=1,$numCols=NULL){ |
|
20 | - parent::__construct($identifier,"div"); |
|
19 | + public function __construct($identifier, $numRows=1, $numCols=NULL) { |
|
20 | + parent::__construct($identifier, "div"); |
|
21 | 21 | $this->setProperty("class", "container-fluid"); |
22 | 22 | $this->rows=array(); |
23 | - $this->setNumRows($numRows,$numCols); |
|
23 | + $this->setNumRows($numRows, $numCols); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param int $numCols |
29 | 29 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
30 | 30 | */ |
31 | - public function addRow($numCols=NULL){ |
|
32 | - $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols); |
|
31 | + public function addRow($numCols=NULL) { |
|
32 | + $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1), $numCols); |
|
33 | 33 | $this->rows[]=$row; |
34 | 34 | return $row; |
35 | 35 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @param boolean $force add the row at $index if true |
41 | 41 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
42 | 42 | */ |
43 | - public function getRow($index,$force=true){ |
|
44 | - if($index<sizeof($this->rows)){ |
|
43 | + public function getRow($index, $force=true) { |
|
44 | + if ($index<sizeof($this->rows)) { |
|
45 | 45 | $result=$this->rows[$index-1]; |
46 | - }else if ($force){ |
|
46 | + } else if ($force) { |
|
47 | 47 | $this->setNumRows($index); |
48 | 48 | $result=$this->rows[$index-1]; |
49 | 49 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param int $numCols |
57 | 57 | * @return \Ajax\bootstrap\html\HtmlGridSystem |
58 | 58 | */ |
59 | - public function setNumRows($numRows,$numCols=NULL){ |
|
60 | - for($i=sizeof($this->rows);$i<$numRows;$i++){ |
|
59 | + public function setNumRows($numRows, $numCols=NULL) { |
|
60 | + for ($i=sizeof($this->rows); $i<$numRows; $i++) { |
|
61 | 61 | $this->addRow($numCols); |
62 | 62 | } |
63 | 63 | return $this; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @param boolean $force add the cell at $row,$col if true |
70 | 70 | * @return HtmlGridCol |
71 | 71 | */ |
72 | - public function getCell($row,$col,$force=true){ |
|
73 | - $row=$this->getRow($row,$force); |
|
74 | - if(isset($row)){ |
|
75 | - $col=$row->getCol($col,$force); |
|
72 | + public function getCell($row, $col, $force=true) { |
|
73 | + $row=$this->getRow($row, $force); |
|
74 | + if (isset($row)) { |
|
75 | + $col=$row->getCol($col, $force); |
|
76 | 76 | } |
77 | 77 | return $col; |
78 | 78 | } |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | * @param int $col |
83 | 83 | * @return HtmlGridCol |
84 | 84 | */ |
85 | - public function getCellAt($row,$col,$force=true){ |
|
86 | - $row=$this->getRow($row,$force); |
|
87 | - if(isset($row)){ |
|
88 | - $col=$row->getColAt($col,$force); |
|
85 | + public function getCellAt($row, $col, $force=true) { |
|
86 | + $row=$this->getRow($row, $force); |
|
87 | + if (isset($row)) { |
|
88 | + $col=$row->getColAt($col, $force); |
|
89 | 89 | } |
90 | 90 | return $col; |
91 | 91 | } |
92 | 92 | |
93 | 93 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
94 | - foreach ($this->rows as $row){ |
|
94 | + foreach ($this->rows as $row) { |
|
95 | 95 | $this->addContent($row); |
96 | 96 | } |
97 | - return parent::compile($js,$view); |
|
97 | + return parent::compile($js, $view); |
|
98 | 98 | } |
99 | - public function setContentForAll($content){ |
|
100 | - foreach ($this->rows as $row){ |
|
99 | + public function setContentForAll($content) { |
|
100 | + foreach ($this->rows as $row) { |
|
101 | 101 | $row->setContentForAll($content); |
102 | 102 | } |
103 | 103 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | public function getRow($index,$force=true){ |
44 | 44 | if($index<sizeof($this->rows)){ |
45 | 45 | $result=$this->rows[$index-1]; |
46 | - }else if ($force){ |
|
46 | + } else if ($force){ |
|
47 | 47 | $this->setNumRows($index); |
48 | 48 | $result=$this->rows[$index-1]; |
49 | 49 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->uiName = "tabs"; |
|
17 | + $this->uiName="tabs"; |
|
18 | 18 | } |
19 | 19 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __construct(JsUtils $js) { |
18 | 18 | parent::__construct($js); |
19 | - $this->uiName = "autocomplete"; |
|
19 | + $this->uiName="autocomplete"; |
|
20 | 20 | $this->setParam("minLength", 3); |
21 | 21 | } |
22 | 22 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function setAjaxSource($url) { |
31 | 31 | if (JString::startsWith($url, "/")) { |
32 | - $url = $this->js->getUrl($url); |
|
32 | + $url=$this->js->getUrl($url); |
|
33 | 33 | } |
34 | - $ajax = "%function (request, response) { |
|
34 | + $ajax="%function (request, response) { |
|
35 | 35 | $.ajax({ |
36 | 36 | url: '{$url}', |
37 | 37 | dataType: 'jsonp', |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | * @return $this |
53 | 53 | */ |
54 | 54 | public function setSource($source) { |
55 | - $source = str_ireplace(array( |
|
55 | + $source=str_ireplace(array( |
|
56 | 56 | "\"", |
57 | 57 | "'" |
58 | 58 | ), "%quote%", $source); |
59 | - return $this->setParam("source", "%" . $source . "%"); |
|
59 | + return $this->setParam("source", "%".$source."%"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function __construct(JsUtils $js) { |
17 | 17 | parent::__construct($js); |
18 | - $this->uiName = "button"; |
|
18 | + $this->uiName="button"; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function setIcons($value) { |
44 | 44 | if (is_string($value)) { |
45 | 45 | if (JString::startsWith($value, "{")); |
46 | - $value = "%" . $value . "%"; |
|
46 | + $value="%".$value."%"; |
|
47 | 47 | } |
48 | 48 | return $this->setParam("icons", $value); |
49 | 49 | } |
@@ -14,29 +14,29 @@ discard block |
||
14 | 14 | |
15 | 15 | protected $attachTo; |
16 | 16 | |
17 | - protected $buttons = array(); |
|
17 | + protected $buttons=array(); |
|
18 | 18 | |
19 | 19 | public function __construct(JsUtils $js) { |
20 | 20 | parent::__construct($js); |
21 | - $this->params = array( |
|
21 | + $this->params=array( |
|
22 | 22 | "dialogClass" => "no-close" |
23 | 23 | ); |
24 | 24 | $this->addCancelBtn("Annuler"); |
25 | 25 | } |
26 | 26 | |
27 | 27 | public function getScript() { |
28 | - $allParams = $this->params; |
|
29 | - $jsonButtons = array(); |
|
28 | + $allParams=$this->params; |
|
29 | + $jsonButtons=array(); |
|
30 | 30 | foreach ($this->buttons as $button) { |
31 | - $jsonButtons[] = $button->getParams(); |
|
31 | + $jsonButtons[]=$button->getParams(); |
|
32 | 32 | } |
33 | - $allParams["buttons"] = $jsonButtons; |
|
34 | - $this->jquery_code_for_compile[] = "$( '" . $this->attachTo . "' ).dialog(" . $this->getParamsAsJSON($allParams) . ");"; |
|
35 | - $result = implode("", $this->jquery_code_for_compile); |
|
36 | - $result = str_ireplace("\"%", "", $result); |
|
37 | - $result = str_ireplace("%\"", "", $result); |
|
38 | - $result = str_ireplace("\\n", "", $result); |
|
39 | - $result = str_ireplace("\\t", "", $result); |
|
33 | + $allParams["buttons"]=$jsonButtons; |
|
34 | + $this->jquery_code_for_compile[]="$( '".$this->attachTo."' ).dialog(".$this->getParamsAsJSON($allParams).");"; |
|
35 | + $result=implode("", $this->jquery_code_for_compile); |
|
36 | + $result=str_ireplace("\"%", "", $result); |
|
37 | + $result=str_ireplace("%\"", "", $result); |
|
38 | + $result=str_ireplace("\\n", "", $result); |
|
39 | + $result=str_ireplace("\\t", "", $result); |
|
40 | 40 | return $result; |
41 | 41 | } |
42 | 42 | |
@@ -46,26 +46,26 @@ discard block |
||
46 | 46 | * identifiant CSS |
47 | 47 | */ |
48 | 48 | public function attach($identifier) { |
49 | - $this->attachTo = $identifier; |
|
49 | + $this->attachTo=$identifier; |
|
50 | 50 | } |
51 | 51 | |
52 | - public function addCancelBtn($caption = "Annuler", $position = NULL) { |
|
52 | + public function addCancelBtn($caption="Annuler", $position=NULL) { |
|
53 | 53 | $this->insertBtn(DialogButton::cancelButton($caption), $position); |
54 | 54 | } |
55 | 55 | |
56 | - public function addSubmitBtn(JsUtils $js, $url, $form, $responseElement, $caption = "Valider", $position = NULL) { |
|
56 | + public function addSubmitBtn(JsUtils $js, $url, $form, $responseElement, $caption="Valider", $position=NULL) { |
|
57 | 57 | $this->insertBtn(DialogButton::submitButton($js, $url, $form, $responseElement, $caption), $position); |
58 | 58 | } |
59 | 59 | |
60 | - public function addButton($caption, $jsCode, $position = NULL) { |
|
60 | + public function addButton($caption, $jsCode, $position=NULL) { |
|
61 | 61 | $this->insertBtn(new DialogButton($caption, $jsCode), $position); |
62 | 62 | } |
63 | 63 | |
64 | - private function insertBtn($insert, $position = NULL) { |
|
65 | - if ($position != NULL) { |
|
66 | - $this->buttons = array_splice($this->buttons, $position, 0, $insert); |
|
64 | + private function insertBtn($insert, $position=NULL) { |
|
65 | + if ($position!=NULL) { |
|
66 | + $this->buttons=array_splice($this->buttons, $position, 0, $insert); |
|
67 | 67 | } else { |
68 | - $this->buttons[] = $insert; |
|
68 | + $this->buttons[]=$insert; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->uiName = "spinner"; |
|
17 | + $this->uiName="spinner"; |
|
18 | 18 | } |
19 | 19 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function __construct(JsUtils $js) { |
17 | 17 | parent::__construct($js); |
18 | - $this->uiName = "tooltip"; |
|
18 | + $this->uiName="tooltip"; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |