@@ -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 |
@@ -59,16 +59,19 @@ discard block |
||
59 | 59 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
60 | 60 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
61 | 61 | } |
62 | - if(\is_array($this->_deleteBehavior)) |
|
63 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
64 | - if(\is_array($this->_editBehavior)) |
|
65 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
62 | + if(\is_array($this->_deleteBehavior)) { |
|
63 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
64 | + } |
|
65 | + if(\is_array($this->_editBehavior)) { |
|
66 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
67 | + } |
|
66 | 68 | if(\is_array($this->_displayBehavior)){ |
67 | 69 | $this->_generateBehavior("display",$this->_displayBehavior,$js); |
68 | 70 | } |
69 | 71 | parent::run($js); |
70 | - if(isset($this->_pagination)) |
|
71 | - $this->_associatePaginationBehavior($js,$offset); |
|
72 | + if(isset($this->_pagination)) { |
|
73 | + $this->_associatePaginationBehavior($js,$offset); |
|
74 | + } |
|
72 | 75 | $this->_associateSearchFieldBehavior($js,$offset); |
73 | 76 | |
74 | 77 | } |
@@ -103,8 +106,9 @@ discard block |
||
103 | 106 | $table->setRowCount(0, \sizeof($captions)); |
104 | 107 | $this->_generateHeader($table,$captions); |
105 | 108 | |
106 | - if(isset($this->_compileParts)) |
|
107 | - $table->setCompileParts($this->_compileParts); |
|
109 | + if(isset($this->_compileParts)) { |
|
110 | + $table->setCompileParts($this->_compileParts); |
|
111 | + } |
|
108 | 112 | |
109 | 113 | $this->_generateContent($table); |
110 | 114 | |
@@ -134,8 +138,9 @@ discard block |
||
134 | 138 | } |
135 | 139 | |
136 | 140 | protected function _applyStyleAttributes($table){ |
137 | - if(isset($this->_hiddenColumns)) |
|
138 | - $this->_hideColumns(); |
|
141 | + if(isset($this->_hiddenColumns)) { |
|
142 | + $this->_hideColumns(); |
|
143 | + } |
|
139 | 144 | if(isset($this->_colWidths)){ |
140 | 145 | foreach ($this->_colWidths as $colIndex=>$width){ |
141 | 146 | $table->setColWidth($colIndex,$width); |
@@ -195,8 +200,9 @@ discard block |
||
195 | 200 | $field=$ck->getField(); |
196 | 201 | $field->setProperty("value",$dataAjax); |
197 | 202 | $field->setProperty("name", "selection[]"); |
198 | - if(isset($checkedClass)) |
|
199 | - $field->setClass($checkedClass); |
|
203 | + if(isset($checkedClass)) { |
|
204 | + $field->setClass($checkedClass); |
|
205 | + } |
|
200 | 206 | \array_unshift($values, $ck); |
201 | 207 | } |
202 | 208 | $result=$table->newRow(); |
@@ -210,8 +216,9 @@ discard block |
||
210 | 216 | |
211 | 217 | protected function _generatePagination($table){ |
212 | 218 | if(isset($this->_toolbar)){ |
213 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
214 | - $this->_toolbar->setFloated("left"); |
|
219 | + if($this->_toolbarPosition==PositionInTable::FOOTER) { |
|
220 | + $this->_toolbar->setFloated("left"); |
|
221 | + } |
|
215 | 222 | } |
216 | 223 | $footer=$table->getFooter(); |
217 | 224 | $footer->mergeCol(); |
@@ -235,8 +242,9 @@ discard block |
||
235 | 242 | |
236 | 243 | protected function _getFieldName($index){ |
237 | 244 | $fieldName=parent::_getFieldName($index); |
238 | - if(\is_object($fieldName)) |
|
239 | - $fieldName="field-".$index; |
|
245 | + if(\is_object($fieldName)) { |
|
246 | + $fieldName="field-".$index; |
|
247 | + } |
|
240 | 248 | return $fieldName."[]"; |
241 | 249 | } |
242 | 250 | |
@@ -276,7 +284,7 @@ discard block |
||
276 | 284 | $hasPart=$table->hasPart($part); |
277 | 285 | if($hasPart){ |
278 | 286 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
279 | - }else{ |
|
287 | + } else{ |
|
280 | 288 | $row=$table->getPart($part)->getRow(0); |
281 | 289 | } |
282 | 290 | $row->mergeCol(); |
@@ -308,7 +316,7 @@ discard block |
||
308 | 316 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
309 | 317 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
310 | 318 | $this->_urls["display"]=JArray::getValue($urls, "display",3); |
311 | - }else{ |
|
319 | + } else{ |
|
312 | 320 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls,"display"=>$urls]; |
313 | 321 | } |
314 | 322 | return $this; |
@@ -391,8 +399,9 @@ discard block |
||
391 | 399 | |
392 | 400 | protected function getTargetSelector($op) { |
393 | 401 | $result=$this->_targetSelector; |
394 | - if(!isset($result[$op])) |
|
395 | - $result="#".$this->identifier; |
|
402 | + if(!isset($result[$op])) { |
|
403 | + $result="#".$this->identifier; |
|
404 | + } |
|
396 | 405 | return $result[$op]; |
397 | 406 | } |
398 | 407 | |
@@ -410,8 +419,9 @@ discard block |
||
410 | 419 | } |
411 | 420 | |
412 | 421 | public function getRefreshSelector() { |
413 | - if(isset($this->_refreshSelector)) |
|
414 | - return $this->_refreshSelector; |
|
422 | + if(isset($this->_refreshSelector)) { |
|
423 | + return $this->_refreshSelector; |
|
424 | + } |
|
415 | 425 | return "#".$this->identifier." tbody"; |
416 | 426 | } |
417 | 427 | |
@@ -430,8 +440,9 @@ discard block |
||
430 | 440 | */ |
431 | 441 | public function show($modelInstance){ |
432 | 442 | if(\is_array($modelInstance)){ |
433 | - if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
434 | - $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
443 | + if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) { |
|
444 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
445 | + } |
|
435 | 446 | } |
436 | 447 | $this->_modelInstance=$modelInstance; |
437 | 448 | } |
@@ -471,8 +482,9 @@ discard block |
||
471 | 482 | } |
472 | 483 | |
473 | 484 | public function hideColumn($colIndex){ |
474 | - if(!\is_array($this->_hiddenColumns)) |
|
475 | - $this->_hiddenColumns=[]; |
|
485 | + if(!\is_array($this->_hiddenColumns)) { |
|
486 | + $this->_hiddenColumns=[]; |
|
487 | + } |
|
476 | 488 | $this->_hiddenColumns[]=$colIndex; |
477 | 489 | return $this; |
478 | 490 | } |
@@ -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 |