@@ -345,8 +345,9 @@ discard block |
||
345 | 345 | $result= $this->getBody()->_addRow($result); |
346 | 346 | } |
347 | 347 | if(isset($this->_afterCompileEvents["onNewRow"])){ |
348 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
349 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
348 | + if(\is_callable($this->_afterCompileEvents["onNewRow"])) { |
|
349 | + $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
350 | + } |
|
350 | 351 | } |
351 | 352 | return $result; |
352 | 353 | } |
@@ -375,8 +376,9 @@ discard block |
||
375 | 376 | } |
376 | 377 | } |
377 | 378 | $result= parent::run($js); |
378 | - if(isset($this->_footer)) |
|
379 | - $this->_footer->run($js); |
|
379 | + if(isset($this->_footer)) { |
|
380 | + $this->_footer->run($js); |
|
381 | + } |
|
380 | 382 | $this->_runned=true; |
381 | 383 | return $result; |
382 | 384 | } |
@@ -417,8 +419,9 @@ discard block |
||
417 | 419 | |
418 | 420 | public function setColWidth($colIndex,$width){ |
419 | 421 | $part=$this->_getFirstPart(); |
420 | - if($part!==null && $part->count()>0) |
|
421 | - $part->getCell(0, $colIndex)->setWidth($width); |
|
422 | + if($part!==null && $part->count()>0) { |
|
423 | + $part->getCell(0, $colIndex)->setWidth($width); |
|
424 | + } |
|
422 | 425 | return $this; |
423 | 426 | } |
424 | 427 |
@@ -84,15 +84,17 @@ discard block |
||
84 | 84 | |
85 | 85 | public function getColspan() { |
86 | 86 | $colspan=1; |
87 | - if (\array_key_exists("colspan", $this->properties)) |
|
88 | - $colspan=$this->getProperty("colspan"); |
|
87 | + if (\array_key_exists("colspan", $this->properties)) { |
|
88 | + $colspan=$this->getProperty("colspan"); |
|
89 | + } |
|
89 | 90 | return $colspan; |
90 | 91 | } |
91 | 92 | |
92 | 93 | public function getRowspan() { |
93 | 94 | $rowspan=1; |
94 | - if (\array_key_exists("rowspan", $this->properties)) |
|
95 | - $rowspan=$this->getProperty("rowspan"); |
|
95 | + if (\array_key_exists("rowspan", $this->properties)) { |
|
96 | + $rowspan=$this->getProperty("rowspan"); |
|
97 | + } |
|
96 | 98 | return $rowspan; |
97 | 99 | } |
98 | 100 | |
@@ -129,7 +131,8 @@ discard block |
||
129 | 131 | } |
130 | 132 | |
131 | 133 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
132 | - if(!$this->_deleted) |
|
133 | - return parent::compile($js,$view); |
|
134 | + if(!$this->_deleted) { |
|
135 | + return parent::compile($js,$view); |
|
136 | + } |
|
134 | 137 | } |
135 | 138 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | foreach ($items as $k=>$v){ |
25 | 25 | $this->addItem([$k,$v]); |
26 | 26 | } |
27 | - }else{ |
|
27 | + } else{ |
|
28 | 28 | foreach ($items as $item){ |
29 | 29 | $this->addItem($item); |
30 | 30 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return \Ajax\common\html\HtmlDoubleElement |
81 | 81 | */ |
82 | 82 | public function getItem($index) { |
83 | - if (is_int($index)&& isset($this->content[$index])) |
|
84 | - return $this->content[$index]; |
|
85 | - else { |
|
83 | + if (is_int($index)&& isset($this->content[$index])) { |
|
84 | + return $this->content[$index]; |
|
85 | + } else { |
|
86 | 86 | $elm=$this->getElementById($index, $this->content); |
87 | 87 | return $elm; |
88 | 88 | } |
@@ -144,10 +144,11 @@ discard block |
||
144 | 144 | $i=0; |
145 | 145 | foreach ($properties as $k=>$v){ |
146 | 146 | $c=$this->content[$i++]; |
147 | - if(isset($c)) |
|
148 | - $c->setProperty($k,$v); |
|
149 | - else |
|
150 | - return $this; |
|
147 | + if(isset($c)) { |
|
148 | + $c->setProperty($k,$v); |
|
149 | + } else { |
|
150 | + return $this; |
|
151 | + } |
|
151 | 152 | } |
152 | 153 | return $this; |
153 | 154 | } |
@@ -165,8 +166,7 @@ discard block |
||
165 | 166 | foreach ($values as $i=>$value){ |
166 | 167 | if(isset($this->content[$i])){ |
167 | 168 | $this->content[$i]->setProperty($property,$value); |
168 | - } |
|
169 | - else{ |
|
169 | + } else{ |
|
170 | 170 | return $this; |
171 | 171 | } |
172 | 172 | } |
@@ -186,8 +186,7 @@ discard block |
||
186 | 186 | foreach ($values as $i=>$value){ |
187 | 187 | if(isset($this->content[$i])){ |
188 | 188 | $this->content[$i++]->addToProperty($property,$value); |
189 | - } |
|
190 | - else{ |
|
189 | + } else{ |
|
191 | 190 | return $this; |
192 | 191 | } |
193 | 192 | } |
@@ -216,8 +215,9 @@ discard block |
||
216 | 215 | foreach ( $this->content as $index=>$item ) { |
217 | 216 | if($item instanceof HtmlDoubleElement){ |
218 | 217 | $href=""; |
219 | - if(isset($hrefs[$index])) |
|
220 | - $href=$hrefs[$index]; |
|
218 | + if(isset($hrefs[$index])) { |
|
219 | + $href=$hrefs[$index]; |
|
220 | + } |
|
221 | 221 | $item->asLink($href,$target); |
222 | 222 | } |
223 | 223 | } |
@@ -33,8 +33,9 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | public function getProperty($name) { |
36 | - if (array_key_exists($name, $this->_self->properties)) |
|
37 | - return $this->_self->properties[$name]; |
|
36 | + if (array_key_exists($name, $this->_self->properties)) { |
|
37 | + return $this->_self->properties[$name]; |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | |
40 | 41 | /** |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | } |
77 | 78 | |
78 | 79 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
79 | - if (is_string($typeCtrl) && @class_exists($typeCtrl, true)) |
|
80 | - $typeCtrl=$typeCtrl::getConstants(); |
|
80 | + if (is_string($typeCtrl) && @class_exists($typeCtrl, true)) { |
|
81 | + $typeCtrl=$typeCtrl::getConstants(); |
|
82 | + } |
|
81 | 83 | if (\is_array($typeCtrl)) { |
82 | 84 | $this->_self->removeOldValues($this->_self->properties[$name], $typeCtrl); |
83 | 85 | } |
@@ -96,8 +98,9 @@ discard block |
||
96 | 98 | } |
97 | 99 | |
98 | 100 | public function removeProperty($name) { |
99 | - if (\array_key_exists($name, $this->_self->properties)) |
|
100 | - unset($this->_self->properties[$name]); |
|
101 | + if (\array_key_exists($name, $this->_self->properties)) { |
|
102 | + unset($this->_self->properties[$name]); |
|
103 | + } |
|
101 | 104 | return $this; |
102 | 105 | } |
103 | 106 | |
@@ -110,8 +113,9 @@ discard block |
||
110 | 113 | } |
111 | 114 | |
112 | 115 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
113 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) |
|
114 | - return $this->_self->setProperty($name, $value); |
|
116 | + if ($this->_self->ctrl($name, $value, $typeCtrl) === true) { |
|
117 | + return $this->_self->setProperty($name, $value); |
|
118 | + } |
|
115 | 119 | return $this; |
116 | 120 | } |
117 | 121 |
@@ -64,8 +64,9 @@ |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | public static function doubleBackSlashes($value){ |
67 | - if(is_string($value)) |
|
68 | - return str_replace("\\", "\\\\", $value); |
|
67 | + if(is_string($value)) { |
|
68 | + return str_replace("\\", "\\\\", $value); |
|
69 | + } |
|
69 | 70 | return $value; |
70 | 71 | } |
71 | 72 |
@@ -59,8 +59,9 @@ |
||
59 | 59 | $callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
60 | 60 | $callback.=$this->_generatePaginationScript($id); |
61 | 61 | if(isset($this->_urls["refresh"])){ |
62 | - if(isset($menu)) |
|
63 | - $js->jsonArrayOn("click", "#".$menu->getIdentifier()." a","#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]); |
|
62 | + if(isset($menu)) { |
|
63 | + $js->jsonArrayOn("click", "#".$menu->getIdentifier()." a","#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]); |
|
64 | + } |
|
64 | 65 | } |
65 | 66 | } |
66 | 67 |
@@ -61,16 +61,19 @@ discard block |
||
61 | 61 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
62 | 62 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
63 | 63 | } |
64 | - if(\is_array($this->_deleteBehavior)) |
|
65 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
66 | - if(\is_array($this->_editBehavior)) |
|
67 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
64 | + if(\is_array($this->_deleteBehavior)) { |
|
65 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
66 | + } |
|
67 | + if(\is_array($this->_editBehavior)) { |
|
68 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
69 | + } |
|
68 | 70 | if(\is_array($this->_displayBehavior)){ |
69 | 71 | $this->_generateBehavior("display",$this->_displayBehavior,$js); |
70 | 72 | } |
71 | 73 | parent::run($js); |
72 | - if(isset($this->_pagination)) |
|
73 | - $this->_associatePaginationBehavior($js,$offset); |
|
74 | + if(isset($this->_pagination)) { |
|
75 | + $this->_associatePaginationBehavior($js,$offset); |
|
76 | + } |
|
74 | 77 | $this->_associateSearchFieldBehavior($js,$offset); |
75 | 78 | |
76 | 79 | } |
@@ -105,8 +108,9 @@ discard block |
||
105 | 108 | $table->setRowCount(0, \sizeof($captions)); |
106 | 109 | $this->_generateHeader($table,$captions); |
107 | 110 | |
108 | - if(isset($this->_compileParts)) |
|
109 | - $table->setCompileParts($this->_compileParts); |
|
111 | + if(isset($this->_compileParts)) { |
|
112 | + $table->setCompileParts($this->_compileParts); |
|
113 | + } |
|
110 | 114 | |
111 | 115 | $this->_generateContent($table); |
112 | 116 | |
@@ -136,8 +140,9 @@ discard block |
||
136 | 140 | } |
137 | 141 | |
138 | 142 | protected function _applyStyleAttributes($table){ |
139 | - if(isset($this->_hiddenColumns)) |
|
140 | - $this->_hideColumns(); |
|
143 | + if(isset($this->_hiddenColumns)) { |
|
144 | + $this->_hideColumns(); |
|
145 | + } |
|
141 | 146 | if(isset($this->_colWidths)){ |
142 | 147 | foreach ($this->_colWidths as $colIndex=>$width){ |
143 | 148 | $table->setColWidth($colIndex,$width); |
@@ -173,7 +178,7 @@ discard block |
||
173 | 178 | $table->fromDatabaseObjects($objects, function($instance) use($table,$fields){ |
174 | 179 | return $this->_generateRow($instance, $fields,$table); |
175 | 180 | }); |
176 | - }else{ |
|
181 | + } else{ |
|
177 | 182 | $activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null)); |
178 | 183 | $uuids=[]; |
179 | 184 | $table->fromDatabaseObjects($objects, function($instance) use($table,$fields,&$activeValues,$groupByFields,&$uuids){ |
@@ -235,8 +240,9 @@ discard block |
||
235 | 240 | $field=$ck->getField(); |
236 | 241 | $field->setProperty("value",$dataAjax); |
237 | 242 | $field->setProperty("name", "selection[]"); |
238 | - if(isset($checkedClass)) |
|
239 | - $field->setClass($checkedClass); |
|
243 | + if(isset($checkedClass)) { |
|
244 | + $field->setClass($checkedClass); |
|
245 | + } |
|
240 | 246 | \array_unshift($values, $ck); |
241 | 247 | } |
242 | 248 | $result=$table->newRow(); |
@@ -253,8 +259,9 @@ discard block |
||
253 | 259 | |
254 | 260 | protected function _generatePagination($table){ |
255 | 261 | if(isset($this->_toolbar)){ |
256 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
257 | - $this->_toolbar->setFloated("left"); |
|
262 | + if($this->_toolbarPosition==PositionInTable::FOOTER) { |
|
263 | + $this->_toolbar->setFloated("left"); |
|
264 | + } |
|
258 | 265 | } |
259 | 266 | $footer=$table->getFooter(); |
260 | 267 | $footer->mergeCol(); |
@@ -286,8 +293,9 @@ discard block |
||
286 | 293 | |
287 | 294 | protected function _getFieldName($index){ |
288 | 295 | $fieldName=parent::_getFieldName($index); |
289 | - if(\is_object($fieldName)) |
|
290 | - $fieldName="field-".$index; |
|
296 | + if(\is_object($fieldName)) { |
|
297 | + $fieldName="field-".$index; |
|
298 | + } |
|
291 | 299 | return $fieldName."[]"; |
292 | 300 | } |
293 | 301 | |
@@ -327,7 +335,7 @@ discard block |
||
327 | 335 | $hasPart=$table->hasPart($part); |
328 | 336 | if($hasPart){ |
329 | 337 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
330 | - }else{ |
|
338 | + } else{ |
|
331 | 339 | $row=$table->getPart($part)->getRow(0); |
332 | 340 | } |
333 | 341 | $row->mergeCol(); |
@@ -359,7 +367,7 @@ discard block |
||
359 | 367 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
360 | 368 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
361 | 369 | $this->_urls["display"]=JArray::getValue($urls, "display",3); |
362 | - }else{ |
|
370 | + } else{ |
|
363 | 371 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls,"display"=>$urls]; |
364 | 372 | } |
365 | 373 | return $this; |
@@ -442,8 +450,9 @@ discard block |
||
442 | 450 | |
443 | 451 | protected function getTargetSelector($op) { |
444 | 452 | $result=$this->_targetSelector; |
445 | - if(!isset($result[$op])) |
|
446 | - $result="#".$this->identifier; |
|
453 | + if(!isset($result[$op])) { |
|
454 | + $result="#".$this->identifier; |
|
455 | + } |
|
447 | 456 | return $result[$op]; |
448 | 457 | } |
449 | 458 | |
@@ -461,8 +470,9 @@ discard block |
||
461 | 470 | } |
462 | 471 | |
463 | 472 | public function getRefreshSelector() { |
464 | - if(isset($this->_refreshSelector)) |
|
465 | - return $this->_refreshSelector; |
|
473 | + if(isset($this->_refreshSelector)) { |
|
474 | + return $this->_refreshSelector; |
|
475 | + } |
|
466 | 476 | return "#".$this->identifier." tbody"; |
467 | 477 | } |
468 | 478 | |
@@ -481,8 +491,9 @@ discard block |
||
481 | 491 | */ |
482 | 492 | public function show($modelInstance){ |
483 | 493 | if(\is_array($modelInstance)){ |
484 | - if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
485 | - $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
494 | + if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) { |
|
495 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
496 | + } |
|
486 | 497 | } |
487 | 498 | $this->_modelInstance=$modelInstance; |
488 | 499 | } |
@@ -522,8 +533,9 @@ discard block |
||
522 | 533 | } |
523 | 534 | |
524 | 535 | public function hideColumn($colIndex){ |
525 | - if(!\is_array($this->_hiddenColumns)) |
|
526 | - $this->_hiddenColumns=[]; |
|
536 | + if(!\is_array($this->_hiddenColumns)) { |
|
537 | + $this->_hiddenColumns=[]; |
|
538 | + } |
|
527 | 539 | $this->_hiddenColumns[]=$colIndex; |
528 | 540 | return $this; |
529 | 541 | } |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
28 | 28 | parent::__construct($identifier, $tagName, ""); |
29 | - if (isset($rowCount) && isset($colCount)) |
|
30 | - $this->setRowCount($rowCount, $colCount); |
|
29 | + if (isset($rowCount) && isset($colCount)) { |
|
30 | + $this->setRowCount($rowCount, $colCount); |
|
31 | + } |
|
31 | 32 | } |
32 | 33 | |
33 | 34 | /** |
@@ -112,7 +113,7 @@ discard block |
||
112 | 113 | $row=$this->getItem($row); |
113 | 114 | if (isset($row) && $row instanceof HtmlCollection) { |
114 | 115 | $col=$row->getItem($col); |
115 | - }else{ |
|
116 | + } else{ |
|
116 | 117 | $col=$row; |
117 | 118 | } |
118 | 119 | return $col; |
@@ -170,8 +171,9 @@ discard block |
||
170 | 171 | $values=\array_fill(0, $count, $values); |
171 | 172 | $isArray=false; |
172 | 173 | } |
173 | - if (JArray::dimension($values) == 1 && $isArray) |
|
174 | - $values=[ $values ]; |
|
174 | + if (JArray::dimension($values) == 1 && $isArray) { |
|
175 | + $values=[ $values ]; |
|
176 | + } |
|
175 | 177 | |
176 | 178 | $count=\min(\sizeof($values), $count); |
177 | 179 | |
@@ -198,8 +200,9 @@ discard block |
||
198 | 200 | $count=$this->count(); |
199 | 201 | for($i=0; $i < $count; $i++) { |
200 | 202 | $cell=$this->getCell($i, $colIndex); |
201 | - if($cell instanceof BaseTrait) |
|
202 | - $cell->addVariations($variations); |
|
203 | + if($cell instanceof BaseTrait) { |
|
204 | + $cell->addVariations($variations); |
|
205 | + } |
|
203 | 206 | } |
204 | 207 | return $this; |
205 | 208 | } |
@@ -208,8 +211,9 @@ discard block |
||
208 | 211 | $count=$this->count(); |
209 | 212 | for($i=0; $i < $count; $i++) { |
210 | 213 | $cell=$this->getCell($i, $colIndex); |
211 | - if(isset($cell)) |
|
212 | - $cell->addToProperty($name,$value); |
|
214 | + if(isset($cell)) { |
|
215 | + $cell->addToProperty($name,$value); |
|
216 | + } |
|
213 | 217 | } |
214 | 218 | return $this; |
215 | 219 | } |
@@ -227,8 +231,9 @@ discard block |
||
227 | 231 | $count=$this->count(); |
228 | 232 | for($i=0; $i < $count; $i++) { |
229 | 233 | $index=$this->content[$i]->getColPosition($colIndex); |
230 | - if ($index !== NULL) |
|
231 | - $this->getCell($i, $index)->$function(); |
|
234 | + if ($index !== NULL) { |
|
235 | + $this->getCell($i, $index)->$function(); |
|
236 | + } |
|
232 | 237 | } |
233 | 238 | return $this; |
234 | 239 | } |
@@ -239,8 +244,9 @@ discard block |
||
239 | 244 | $maxRow=$this->content[$i]->count(); |
240 | 245 | $index=$maxRow-$colIndex-1; |
241 | 246 | if (($cell=$this->getCell($i, $index))!== NULL){ |
242 | - if($cell->getColspan()==1) |
|
243 | - $cell->$function(); |
|
247 | + if($cell->getColspan()==1) { |
|
248 | + $cell->$function(); |
|
249 | + } |
|
244 | 250 | } |
245 | 251 | } |
246 | 252 | return $this; |
@@ -284,8 +290,9 @@ discard block |
||
284 | 290 | */ |
285 | 291 | public function getColCount() { |
286 | 292 | $result=0; |
287 | - if ($this->count() > 0) |
|
288 | - $result=$this->getItem(0)->count(); |
|
293 | + if ($this->count() > 0) { |
|
294 | + $result=$this->getItem(0)->count(); |
|
295 | + } |
|
289 | 296 | return $result; |
290 | 297 | } |
291 | 298 | |
@@ -309,8 +316,9 @@ discard block |
||
309 | 316 | |
310 | 317 | public function toDelete($rowIndex, $colIndex){ |
311 | 318 | $row=$this->getItem($rowIndex); |
312 | - if (isset($row) === true) |
|
313 | - $row->toDelete($colIndex); |
|
319 | + if (isset($row) === true) { |
|
320 | + $row->toDelete($colIndex); |
|
321 | + } |
|
314 | 322 | return $this; |
315 | 323 | } |
316 | 324 | |
@@ -408,8 +416,9 @@ discard block |
||
408 | 416 | foreach ( $rows as $row ) { |
409 | 417 | $cell=$row->getItem($colIndex); |
410 | 418 | $value=$cell->getContent(); |
411 | - if($functionExists) |
|
412 | - $value=\call_user_func($function,$value); |
|
419 | + if($functionExists) { |
|
420 | + $value=\call_user_func($function,$value); |
|
421 | + } |
|
413 | 422 | if($value!==$identiqual){ |
414 | 423 | if($counter>0 && isset($cellToMerge)){ |
415 | 424 | $cellToMerge->setRowspan($counter); |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | $this->widgetIdentifier=$identifier; |
26 | 26 | $this->values=[]; |
27 | 27 | $this->afterCompile=[]; |
28 | - if(isset($instance)) |
|
29 | - $this->setInstance($instance); |
|
28 | + if(isset($instance)) { |
|
29 | + $this->setInstance($instance); |
|
30 | + } |
|
30 | 31 | $this->setCaptions($captions); |
31 | 32 | $this->captionCallback=NULL; |
32 | 33 | $this->defaultValueFunction=function($name,$value){return $value;}; |
@@ -62,7 +63,7 @@ discard block |
||
62 | 63 | while($index<$count){ |
63 | 64 | $values[]=$this->getValue($index++); |
64 | 65 | } |
65 | - }else{ |
|
66 | + } else{ |
|
66 | 67 | while($index<$count){ |
67 | 68 | if(array_search($index, $this->groupByFields)===false){ |
68 | 69 | $values[]=$this->getValue($index); |
@@ -74,14 +75,16 @@ discard block |
||
74 | 75 | } |
75 | 76 | |
76 | 77 | public function getIdentifier($index=NULL){ |
77 | - if(!isset($index)) |
|
78 | - $index=self::$index; |
|
78 | + if(!isset($index)) { |
|
79 | + $index=self::$index; |
|
80 | + } |
|
79 | 81 | $value=$index; |
80 | 82 | if(isset($this->values["identifier"])){ |
81 | - if(\is_string($this->values["identifier"])) |
|
82 | - $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
83 | - else |
|
84 | - $value=$this->values["identifier"]($index,$this->instance); |
|
83 | + if(\is_string($this->values["identifier"])) { |
|
84 | + $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
85 | + } else { |
|
86 | + $value=$this->values["identifier"]($index,$this->instance); |
|
87 | + } |
|
85 | 88 | } |
86 | 89 | return $value; |
87 | 90 | } |
@@ -111,16 +114,16 @@ discard block |
||
111 | 114 | if($property instanceof \ReflectionProperty){ |
112 | 115 | $value=$this->_getPropertyValue($property); |
113 | 116 | $propertyName=$property->getName(); |
114 | - }elseif(\is_callable($property) && array_search($property, ["system"])===false) |
|
115 | - $value=$property($this->instance); |
|
116 | - elseif(\is_array($property)){ |
|
117 | + } elseif(\is_callable($property) && array_search($property, ["system"])===false) { |
|
118 | + $value=$property($this->instance); |
|
119 | + } elseif(\is_array($property)){ |
|
117 | 120 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
118 | 121 | $value=\implode("", $values); |
119 | - }elseif(\is_string($property)){ |
|
122 | + } elseif(\is_string($property)){ |
|
120 | 123 | $value=$property; |
121 | 124 | if(isset($this->instance->{$property})){ |
122 | 125 | $value=$this->instance->{$property}; |
123 | - }elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
126 | + } elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
124 | 127 | $value=JReflection::callMethod($this->instance, $getter, []); |
125 | 128 | } |
126 | 129 | } |
@@ -130,7 +133,7 @@ discard block |
||
130 | 133 | protected function _postGetValue($index,$propertyName,$value){ |
131 | 134 | if(isset($this->values[$index])){ |
132 | 135 | $value= $this->values[$index]($value,$this->instance,$index,self::$index); |
133 | - }else{ |
|
136 | + } else{ |
|
134 | 137 | $value=$this->_getDefaultValue($propertyName,$value, $index); |
135 | 138 | } |
136 | 139 | if(isset($this->afterCompile[$index])){ |
@@ -144,7 +147,7 @@ discard block |
||
144 | 147 | public function insertField($index,$field,$key=null){ |
145 | 148 | if(isset($key)){ |
146 | 149 | array_splice( $this->visibleProperties, $index, 0, [$key=>$field] ); |
147 | - }else{ |
|
150 | + } else{ |
|
148 | 151 | array_splice( $this->visibleProperties, $index, 0, $field ); |
149 | 152 | } |
150 | 153 | return $this; |
@@ -165,17 +168,17 @@ discard block |
||
165 | 168 | if(isset($key)){ |
166 | 169 | if(\is_array($vb[$index])){ |
167 | 170 | $this->visibleProperties[$index][$key]=$field; |
168 | - }else{ |
|
171 | + } else{ |
|
169 | 172 | $this->visibleProperties[$index]=[$vb[$index],$key=>$field]; |
170 | 173 | } |
171 | - }else{ |
|
174 | + } else{ |
|
172 | 175 | if(\is_array($vb[$index])){ |
173 | 176 | $this->visibleProperties[$index][]=$field; |
174 | - }else{ |
|
177 | + } else{ |
|
175 | 178 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
176 | 179 | } |
177 | 180 | } |
178 | - }else{ |
|
181 | + } else{ |
|
179 | 182 | return $this->insertField($index, $field); |
180 | 183 | } |
181 | 184 | return $this; |
@@ -184,7 +187,7 @@ discard block |
||
184 | 187 | public function addField($field,$key=null){ |
185 | 188 | if(isset($key)){ |
186 | 189 | $this->visibleProperties[]=[$key=>$field]; |
187 | - }else{ |
|
190 | + } else{ |
|
188 | 191 | $this->visibleProperties[]=$field; |
189 | 192 | } |
190 | 193 | return $this; |
@@ -211,9 +214,9 @@ discard block |
||
211 | 214 | $property=$this->getProperty($index); |
212 | 215 | if($property instanceof \ReflectionProperty){ |
213 | 216 | $result=$property->getName(); |
214 | - }elseif(\is_callable($property)){ |
|
217 | + } elseif(\is_callable($property)){ |
|
215 | 218 | $result=$this->visibleProperties[$index]; |
216 | - }else{ |
|
219 | + } else{ |
|
217 | 220 | $result=$property; |
218 | 221 | } |
219 | 222 | return $result; |
@@ -233,7 +236,7 @@ discard block |
||
233 | 236 | $this->reflect=new \ReflectionClass($instance); |
234 | 237 | if(JArray::count($this->visibleProperties)===0){ |
235 | 238 | $this->properties=$this->getDefaultProperties(); |
236 | - }else{ |
|
239 | + } else{ |
|
237 | 240 | foreach ($this->visibleProperties as $property){ |
238 | 241 | $this->setInstanceProperty($property); |
239 | 242 | } |
@@ -244,22 +247,23 @@ discard block |
||
244 | 247 | private function setInstanceProperty($property){ |
245 | 248 | if(\is_callable($property)){ |
246 | 249 | $this->properties[]=$property; |
247 | - }elseif(\is_string($property)){ |
|
250 | + } elseif(\is_string($property)){ |
|
248 | 251 | try{ |
249 | 252 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
250 | 253 | $rProperty=$this->reflect->getProperty($property); |
251 | 254 | $this->properties[]=$rProperty; |
252 | - }catch(\Exception $e){ |
|
255 | + } catch(\Exception $e){ |
|
253 | 256 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
254 | 257 | $this->properties[]=$property; |
255 | 258 | } |
256 | - }elseif(\is_int($property)){ |
|
259 | + } elseif(\is_int($property)){ |
|
257 | 260 | $props=$this->getDefaultProperties(); |
258 | - if(isset($props[$property])) |
|
259 | - $this->properties[]=$props[$property]; |
|
260 | - else |
|
261 | - $this->properties[]=$property; |
|
262 | - }else{ |
|
261 | + if(isset($props[$property])) { |
|
262 | + $this->properties[]=$props[$property]; |
|
263 | + } else { |
|
264 | + $this->properties[]=$property; |
|
265 | + } |
|
266 | + } else{ |
|
263 | 267 | $this->properties[]=$property; |
264 | 268 | } |
265 | 269 | } |
@@ -303,12 +307,13 @@ discard block |
||
303 | 307 | if(isset($this->captions[$index])){ |
304 | 308 | return $this->captions[$index]; |
305 | 309 | } |
306 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
307 | - return $this->properties[$index]->getName(); |
|
308 | - elseif(\is_callable($this->properties[$index])) |
|
309 | - return ""; |
|
310 | - else |
|
311 | - return $this->properties[$index]; |
|
310 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
311 | + return $this->properties[$index]->getName(); |
|
312 | + } elseif(\is_callable($this->properties[$index])) { |
|
313 | + return ""; |
|
314 | + } else { |
|
315 | + return $this->properties[$index]; |
|
316 | + } |
|
312 | 317 | } |
313 | 318 | |
314 | 319 | public function getCaptions(){ |
@@ -323,7 +328,7 @@ discard block |
||
323 | 328 | $captions[]=""; |
324 | 329 | $moreAdded=true; |
325 | 330 | } |
326 | - }else{ |
|
331 | + } else{ |
|
327 | 332 | $captions=[]; |
328 | 333 | $index=0; |
329 | 334 | while($index<$count){ |
@@ -341,8 +346,9 @@ discard block |
||
341 | 346 | } |
342 | 347 | |
343 | 348 | public function setCaption($index,$caption){ |
344 | - if(isset($this->captions)===false) |
|
345 | - $this->captions=[]; |
|
349 | + if(isset($this->captions)===false) { |
|
350 | + $this->captions=[]; |
|
351 | + } |
|
346 | 352 | $this->captions[$index]=$caption; |
347 | 353 | return $this; |
348 | 354 | } |