@@ -109,15 +109,18 @@ discard block |
||
109 | 109 | $flag=false; |
110 | 110 | $index=0; |
111 | 111 | while ( !$flag && $index < sizeof($elements) ) { |
112 | - if ($elements[$index] instanceof BaseHtml) |
|
113 | - $flag=($callback($elements[$index])); |
|
112 | + if ($elements[$index] instanceof BaseHtml) { |
|
113 | + $flag=($callback($elements[$index])); |
|
114 | + } |
|
114 | 115 | $index++; |
115 | 116 | } |
116 | - if ($flag === true) |
|
117 | - return $elements[$index - 1]; |
|
117 | + if ($flag === true) { |
|
118 | + return $elements[$index - 1]; |
|
119 | + } |
|
118 | 120 | } elseif ($elements instanceof BaseHtml) { |
119 | - if ($callback($elements)) |
|
120 | - return $elements; |
|
121 | + if ($callback($elements)) { |
|
122 | + return $elements; |
|
123 | + } |
|
121 | 124 | } |
122 | 125 | return null; |
123 | 126 | } |
@@ -143,8 +146,9 @@ discard block |
||
143 | 146 | |
144 | 147 | public function fromArray($array) { |
145 | 148 | foreach ( $this as $key => $value ) { |
146 | - if(array_key_exists($key, $array)===true) |
|
147 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
149 | + if(array_key_exists($key, $array)===true) { |
|
150 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
151 | + } |
|
148 | 152 | } |
149 | 153 | foreach ( $array as $key => $value ) { |
150 | 154 | if($this->_callSetter($key, $key, $value, $array)===false){ |
@@ -213,11 +217,11 @@ discard block |
||
213 | 217 | if(\strstr($result, "%{$key}%")!==false){ |
214 | 218 | if (\is_array($value)) { |
215 | 219 | $v=PropertyWrapper::wrap($value, $js,$view); |
216 | - }elseif($value instanceof \stdClass){ |
|
220 | + } elseif($value instanceof \stdClass){ |
|
217 | 221 | $v=\print_r($value,true); |
218 | - }elseif ($value instanceof BaseHtml){ |
|
222 | + } elseif ($value instanceof BaseHtml){ |
|
219 | 223 | $v=$value->compile($js,$view); |
220 | - }else{ |
|
224 | + } else{ |
|
221 | 225 | $v=$value; |
222 | 226 | } |
223 | 227 | $result=str_replace("%{$key}%", $v, $result); |
@@ -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)) |
|
84 | - return $this->content[$index]; |
|
85 | - else { |
|
83 | + if (is_int($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 | } |
@@ -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 | } |
@@ -58,18 +58,21 @@ discard block |
||
58 | 58 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
59 | 59 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
60 | 60 | } |
61 | - if(\is_array($this->_deleteBehavior)) |
|
62 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
63 | - if(\is_array($this->_editBehavior)) |
|
64 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
61 | + if(\is_array($this->_deleteBehavior)) { |
|
62 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
63 | + } |
|
64 | + if(\is_array($this->_editBehavior)) { |
|
65 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
66 | + } |
|
65 | 67 | if(\is_array($this->_displayBehavior)){ |
66 | 68 | $this->_displayBehavior["jsCallback"]='$("#dataTable").hide();'; |
67 | 69 | $this->_generateBehavior("display",$this->_displayBehavior,$js); |
68 | 70 | } |
69 | 71 | parent::run($js); |
70 | 72 | $this->_associateSearchFieldBehavior($js,$offset); |
71 | - if(isset($this->_pagination)) |
|
72 | - $this->_associatePaginationBehavior($js,$offset); |
|
73 | + if(isset($this->_pagination)) { |
|
74 | + $this->_associatePaginationBehavior($js,$offset); |
|
75 | + } |
|
73 | 76 | } |
74 | 77 | |
75 | 78 | protected function _generateBehavior($op,$params,JsUtils $js){ |
@@ -102,8 +105,9 @@ discard block |
||
102 | 105 | $table->setRowCount(0, \sizeof($captions)); |
103 | 106 | $this->_generateHeader($table,$captions); |
104 | 107 | |
105 | - if(isset($this->_compileParts)) |
|
106 | - $table->setCompileParts($this->_compileParts); |
|
108 | + if(isset($this->_compileParts)) { |
|
109 | + $table->setCompileParts($this->_compileParts); |
|
110 | + } |
|
107 | 111 | |
108 | 112 | $this->_generateContent($table); |
109 | 113 | |
@@ -133,8 +137,9 @@ discard block |
||
133 | 137 | } |
134 | 138 | |
135 | 139 | protected function _applyStyleAttributes($table){ |
136 | - if(isset($this->_hiddenColumns)) |
|
137 | - $this->_hideColumns(); |
|
140 | + if(isset($this->_hiddenColumns)) { |
|
141 | + $this->_hideColumns(); |
|
142 | + } |
|
138 | 143 | if(isset($this->_colWidths)){ |
139 | 144 | foreach ($this->_colWidths as $colIndex=>$width){ |
140 | 145 | $table->setColWidth($colIndex,$width); |
@@ -194,8 +199,9 @@ discard block |
||
194 | 199 | $field=$ck->getField(); |
195 | 200 | $field->setProperty("value",$dataAjax); |
196 | 201 | $field->setProperty("name", "selection[]"); |
197 | - if(isset($checkedClass)) |
|
198 | - $field->setClass($checkedClass); |
|
202 | + if(isset($checkedClass)) { |
|
203 | + $field->setClass($checkedClass); |
|
204 | + } |
|
199 | 205 | \array_unshift($values, $ck); |
200 | 206 | } |
201 | 207 | $result=$table->newRow(); |
@@ -209,8 +215,9 @@ discard block |
||
209 | 215 | |
210 | 216 | protected function _generatePagination($table){ |
211 | 217 | if(isset($this->_toolbar)){ |
212 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
213 | - $this->_toolbar->setFloated("left"); |
|
218 | + if($this->_toolbarPosition==PositionInTable::FOOTER) { |
|
219 | + $this->_toolbar->setFloated("left"); |
|
220 | + } |
|
214 | 221 | } |
215 | 222 | $footer=$table->getFooter(); |
216 | 223 | $footer->mergeCol(); |
@@ -234,8 +241,9 @@ discard block |
||
234 | 241 | |
235 | 242 | protected function _getFieldName($index){ |
236 | 243 | $fieldName=parent::_getFieldName($index); |
237 | - if(\is_object($fieldName)) |
|
238 | - $fieldName="field-".$index; |
|
244 | + if(\is_object($fieldName)) { |
|
245 | + $fieldName="field-".$index; |
|
246 | + } |
|
239 | 247 | return $fieldName."[]"; |
240 | 248 | } |
241 | 249 | |
@@ -275,7 +283,7 @@ discard block |
||
275 | 283 | $hasPart=$table->hasPart($part); |
276 | 284 | if($hasPart){ |
277 | 285 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
278 | - }else{ |
|
286 | + } else{ |
|
279 | 287 | $row=$table->getPart($part)->getRow(0); |
280 | 288 | } |
281 | 289 | $row->mergeCol(); |
@@ -307,7 +315,7 @@ discard block |
||
307 | 315 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
308 | 316 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
309 | 317 | $this->_urls["display"]=JArray::getValue($urls, "display",3); |
310 | - }else{ |
|
318 | + } else{ |
|
311 | 319 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls,"display"=>$urls]; |
312 | 320 | } |
313 | 321 | return $this; |
@@ -390,8 +398,9 @@ discard block |
||
390 | 398 | |
391 | 399 | protected function getTargetSelector($op) { |
392 | 400 | $result=$this->_targetSelector; |
393 | - if(!isset($result[$op])) |
|
394 | - $result="#".$this->identifier; |
|
401 | + if(!isset($result[$op])) { |
|
402 | + $result="#".$this->identifier; |
|
403 | + } |
|
395 | 404 | return $result[$op]; |
396 | 405 | } |
397 | 406 | |
@@ -409,8 +418,9 @@ discard block |
||
409 | 418 | } |
410 | 419 | |
411 | 420 | public function getRefreshSelector() { |
412 | - if(isset($this->_refreshSelector)) |
|
413 | - return $this->_refreshSelector; |
|
421 | + if(isset($this->_refreshSelector)) { |
|
422 | + return $this->_refreshSelector; |
|
423 | + } |
|
414 | 424 | return "#".$this->identifier." tbody"; |
415 | 425 | } |
416 | 426 | |
@@ -429,8 +439,9 @@ discard block |
||
429 | 439 | */ |
430 | 440 | public function show($modelInstance){ |
431 | 441 | if(\is_array($modelInstance)){ |
432 | - if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
433 | - $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
442 | + if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) { |
|
443 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
444 | + } |
|
434 | 445 | } |
435 | 446 | $this->_modelInstance=$modelInstance; |
436 | 447 | } |
@@ -470,8 +481,9 @@ discard block |
||
470 | 481 | } |
471 | 482 | |
472 | 483 | public function hideColumn($colIndex){ |
473 | - if(!\is_array($this->_hiddenColumns)) |
|
474 | - $this->_hiddenColumns=[]; |
|
484 | + if(!\is_array($this->_hiddenColumns)) { |
|
485 | + $this->_hiddenColumns=[]; |
|
486 | + } |
|
475 | 487 | $this->_hiddenColumns[]=$colIndex; |
476 | 488 | return $this; |
477 | 489 | } |