@@ -56,10 +56,12 @@ discard block |
||
56 | 56 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
57 | 57 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
58 | 58 | } |
59 | - if(\is_array($this->_deleteBehavior)) |
|
60 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
61 | - if(\is_array($this->_editBehavior)) |
|
62 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
59 | + if(\is_array($this->_deleteBehavior)) { |
|
60 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
61 | + } |
|
62 | + if(\is_array($this->_editBehavior)) { |
|
63 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
64 | + } |
|
63 | 65 | return parent::run($js); |
64 | 66 | } |
65 | 67 | |
@@ -95,12 +97,14 @@ discard block |
||
95 | 97 | $table->setRowCount(0, \sizeof($captions)); |
96 | 98 | $this->_generateHeader($table,$captions); |
97 | 99 | |
98 | - if(isset($this->_compileParts)) |
|
99 | - $table->setCompileParts($this->_compileParts); |
|
100 | + if(isset($this->_compileParts)) { |
|
101 | + $table->setCompileParts($this->_compileParts); |
|
102 | + } |
|
100 | 103 | |
101 | 104 | if(isset($this->_searchField) && isset($js)){ |
102 | - if(isset($this->_urls["refresh"])) |
|
103 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
105 | + if(isset($this->_urls["refresh"])) { |
|
106 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
107 | + } |
|
104 | 108 | } |
105 | 109 | |
106 | 110 | $this->_generateContent($table); |
@@ -118,8 +122,9 @@ discard block |
||
118 | 122 | |
119 | 123 | $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
120 | 124 | $this->_compileForm(); |
121 | - if(isset($this->_hiddenColumns)) |
|
122 | - $this->_hideColumns(); |
|
125 | + if(isset($this->_hiddenColumns)) { |
|
126 | + $this->_hideColumns(); |
|
127 | + } |
|
123 | 128 | $this->_generated=true; |
124 | 129 | } |
125 | 130 | return parent::compile($js,$view); |
@@ -169,8 +174,9 @@ discard block |
||
169 | 174 | $field=$ck->getField(); |
170 | 175 | $field->setProperty("value",$id); |
171 | 176 | $field->setProperty("name", "selection[]"); |
172 | - if(isset($checkedClass)) |
|
173 | - $field->setClass($checkedClass); |
|
177 | + if(isset($checkedClass)) { |
|
178 | + $field->setClass($checkedClass); |
|
179 | + } |
|
174 | 180 | \array_unshift($values, $ck); |
175 | 181 | } |
176 | 182 | $result=$table->newRow(); |
@@ -183,8 +189,9 @@ discard block |
||
183 | 189 | |
184 | 190 | protected function _generatePagination($table,$js=NULL){ |
185 | 191 | if(isset($this->_toolbar)){ |
186 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
187 | - $this->_toolbar->setFloated("left"); |
|
192 | + if($this->_toolbarPosition==PositionInTable::FOOTER) { |
|
193 | + $this->_toolbar->setFloated("left"); |
|
194 | + } |
|
188 | 195 | } |
189 | 196 | $footer=$table->getFooter(); |
190 | 197 | $footer->mergeCol(); |
@@ -241,7 +248,7 @@ discard block |
||
241 | 248 | $hasPart=$table->hasPart($part); |
242 | 249 | if($hasPart){ |
243 | 250 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
244 | - }else{ |
|
251 | + } else{ |
|
245 | 252 | $row=$table->getPart($part)->getRow(0); |
246 | 253 | } |
247 | 254 | $row->mergeCol(); |
@@ -266,7 +273,7 @@ discard block |
||
266 | 273 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
267 | 274 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
268 | 275 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
269 | - }else{ |
|
276 | + } else{ |
|
270 | 277 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
271 | 278 | } |
272 | 279 | return $this; |
@@ -340,8 +347,9 @@ discard block |
||
340 | 347 | |
341 | 348 | protected function getTargetSelector() { |
342 | 349 | $result=$this->_targetSelector; |
343 | - if(!isset($result)) |
|
344 | - $result="#".$this->identifier; |
|
350 | + if(!isset($result)) { |
|
351 | + $result="#".$this->identifier; |
|
352 | + } |
|
345 | 353 | return $result; |
346 | 354 | } |
347 | 355 | |
@@ -356,8 +364,9 @@ discard block |
||
356 | 364 | } |
357 | 365 | |
358 | 366 | public function getRefreshSelector() { |
359 | - if(isset($this->_refreshSelector)) |
|
360 | - return $this->_refreshSelector; |
|
367 | + if(isset($this->_refreshSelector)) { |
|
368 | + return $this->_refreshSelector; |
|
369 | + } |
|
361 | 370 | return "#".$this->identifier." tbody"; |
362 | 371 | } |
363 | 372 | |
@@ -376,8 +385,9 @@ discard block |
||
376 | 385 | */ |
377 | 386 | public function show($modelInstance){ |
378 | 387 | if(\is_array($modelInstance)){ |
379 | - if(\is_array(array_values($modelInstance)[0])) |
|
380 | - $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
388 | + if(\is_array(array_values($modelInstance)[0])) { |
|
389 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
390 | + } |
|
381 | 391 | } |
382 | 392 | $this->_modelInstance=$modelInstance; |
383 | 393 | } |
@@ -417,8 +427,9 @@ discard block |
||
417 | 427 | } |
418 | 428 | |
419 | 429 | public function hideColumn($colIndex){ |
420 | - if(!\is_array($this->_hiddenColumns)) |
|
421 | - $this->_hiddenColumns=[]; |
|
430 | + if(!\is_array($this->_hiddenColumns)) { |
|
431 | + $this->_hiddenColumns=[]; |
|
432 | + } |
|
422 | 433 | $this->_hiddenColumns[]=$colIndex; |
423 | 434 | return $this; |
424 | 435 | } |
@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | $this->widgetIdentifier=$identifier; |
24 | 24 | $this->values=[]; |
25 | 25 | $this->afterCompile=[]; |
26 | - if(isset($instance)) |
|
27 | - $this->setInstance($instance); |
|
26 | + if(isset($instance)) { |
|
27 | + $this->setInstance($instance); |
|
28 | + } |
|
28 | 29 | $this->setCaptions($captions); |
29 | 30 | $this->captionCallback=NULL; |
30 | 31 | $this->defaultValueFunction=function($name,$value){return $value;}; |
@@ -62,14 +63,16 @@ discard block |
||
62 | 63 | } |
63 | 64 | |
64 | 65 | public function getIdentifier($index=NULL){ |
65 | - if(!isset($index)) |
|
66 | - $index=self::$index; |
|
66 | + if(!isset($index)) { |
|
67 | + $index=self::$index; |
|
68 | + } |
|
67 | 69 | $value=$index; |
68 | 70 | if(isset($this->values["identifier"])){ |
69 | - if(\is_string($this->values["identifier"])) |
|
70 | - $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
71 | - else |
|
72 | - $value=$this->values["identifier"]($index,$this->instance); |
|
71 | + if(\is_string($this->values["identifier"])) { |
|
72 | + $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
73 | + } else { |
|
74 | + $value=$this->values["identifier"]($index,$this->instance); |
|
75 | + } |
|
73 | 76 | } |
74 | 77 | return $value; |
75 | 78 | } |
@@ -99,16 +102,16 @@ discard block |
||
99 | 102 | if($property instanceof \ReflectionProperty){ |
100 | 103 | $value=$this->_getPropertyValue($property, $index); |
101 | 104 | $propertyName=$property->getName(); |
102 | - }elseif(\is_callable($property)) |
|
103 | - $value=$property($this->instance); |
|
104 | - elseif(\is_array($property)){ |
|
105 | + } elseif(\is_callable($property)) { |
|
106 | + $value=$property($this->instance); |
|
107 | + } elseif(\is_array($property)){ |
|
105 | 108 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
106 | 109 | $value=\implode("", $values); |
107 | - }elseif(\is_string($property)){ |
|
110 | + } elseif(\is_string($property)){ |
|
108 | 111 | $value=$property; |
109 | 112 | if(isset($this->instance->{$property})){ |
110 | 113 | $value=$this->instance->{$property}; |
111 | - }elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
114 | + } elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
112 | 115 | $value=JReflection::callMethod($this->instance, $getter, []); |
113 | 116 | } |
114 | 117 | } |
@@ -118,7 +121,7 @@ discard block |
||
118 | 121 | protected function _postGetValue($index,$propertyName,$value){ |
119 | 122 | if(isset($this->values[$index])){ |
120 | 123 | $value= $this->values[$index]($value,$this->instance,$index); |
121 | - }else{ |
|
124 | + } else{ |
|
122 | 125 | $value=$this->_getDefaultValue($propertyName,$value, $index); |
123 | 126 | } |
124 | 127 | if(isset($this->afterCompile[$index])){ |
@@ -139,10 +142,10 @@ discard block |
||
139 | 142 | if(isset($vb[$index])){ |
140 | 143 | if(\is_array($vb[$index])){ |
141 | 144 | $this->visibleProperties[$index][]=$field; |
142 | - }else{ |
|
145 | + } else{ |
|
143 | 146 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
144 | 147 | } |
145 | - }else{ |
|
148 | + } else{ |
|
146 | 149 | return $this->insertField($index, $field); |
147 | 150 | } |
148 | 151 | return $this; |
@@ -169,9 +172,9 @@ discard block |
||
169 | 172 | $property=$this->getProperty($index); |
170 | 173 | if($property instanceof \ReflectionProperty){ |
171 | 174 | $result=$property->getName(); |
172 | - }elseif(\is_callable($property)){ |
|
175 | + } elseif(\is_callable($property)){ |
|
173 | 176 | $result=$this->visibleProperties[$index]; |
174 | - }else{ |
|
177 | + } else{ |
|
175 | 178 | $result=$property; |
176 | 179 | } |
177 | 180 | return $result; |
@@ -191,7 +194,7 @@ discard block |
||
191 | 194 | $this->reflect=new \ReflectionClass($instance); |
192 | 195 | if(\sizeof($this->visibleProperties)===0){ |
193 | 196 | $this->properties=$this->getDefaultProperties(); |
194 | - }else{ |
|
197 | + } else{ |
|
195 | 198 | foreach ($this->visibleProperties as $property){ |
196 | 199 | $this->setInstanceProperty($property); |
197 | 200 | } |
@@ -202,22 +205,23 @@ discard block |
||
202 | 205 | private function setInstanceProperty($property){ |
203 | 206 | if(\is_callable($property)){ |
204 | 207 | $this->properties[]=$property; |
205 | - }elseif(\is_string($property)){ |
|
208 | + } elseif(\is_string($property)){ |
|
206 | 209 | try{ |
207 | 210 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
208 | 211 | $rProperty=$this->reflect->getProperty($property); |
209 | 212 | $this->properties[]=$rProperty; |
210 | - }catch(\Exception $e){ |
|
213 | + } catch(\Exception $e){ |
|
211 | 214 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
212 | 215 | $this->properties[]=$property; |
213 | 216 | } |
214 | - }elseif(\is_int($property)){ |
|
217 | + } elseif(\is_int($property)){ |
|
215 | 218 | $props=$this->getDefaultProperties(); |
216 | - if(isset($props[$property])) |
|
217 | - $this->properties[]=$props[$property]; |
|
218 | - else |
|
219 | - $this->properties[]=$property; |
|
220 | - }else{ |
|
219 | + if(isset($props[$property])) { |
|
220 | + $this->properties[]=$props[$property]; |
|
221 | + } else { |
|
222 | + $this->properties[]=$property; |
|
223 | + } |
|
224 | + } else{ |
|
221 | 225 | $this->properties[]=$property; |
222 | 226 | } |
223 | 227 | } |
@@ -261,12 +265,13 @@ discard block |
||
261 | 265 | if(isset($this->captions[$index])){ |
262 | 266 | return $this->captions[$index]; |
263 | 267 | } |
264 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
265 | - return $this->properties[$index]->getName(); |
|
266 | - elseif(\is_callable($this->properties[$index])) |
|
267 | - return ""; |
|
268 | - else |
|
269 | - return $this->properties[$index]; |
|
268 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
269 | + return $this->properties[$index]->getName(); |
|
270 | + } elseif(\is_callable($this->properties[$index])) { |
|
271 | + return ""; |
|
272 | + } else { |
|
273 | + return $this->properties[$index]; |
|
274 | + } |
|
270 | 275 | } |
271 | 276 | |
272 | 277 | public function getCaptions(){ |
@@ -275,7 +280,7 @@ discard block |
||
275 | 280 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
276 | 281 | $captions[]=""; |
277 | 282 | } |
278 | - }else{ |
|
283 | + } else{ |
|
279 | 284 | $captions=[]; |
280 | 285 | $index=0; |
281 | 286 | $count=$this->count(); |
@@ -291,8 +296,9 @@ discard block |
||
291 | 296 | } |
292 | 297 | |
293 | 298 | public function setCaption($index,$caption){ |
294 | - if(isset($this->captions)===false) |
|
295 | - $this->captions=[]; |
|
299 | + if(isset($this->captions)===false) { |
|
300 | + $this->captions=[]; |
|
301 | + } |
|
296 | 302 | $this->captions[$index]=$caption; |
297 | 303 | return $this; |
298 | 304 | } |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | $rules=$attributes["rules"]; |
65 | 65 | if(\is_array($rules)){ |
66 | 66 | $element->addRules($rules); |
67 | - } |
|
68 | - else{ |
|
67 | + } else{ |
|
69 | 68 | $element->addRule($rules); |
70 | 69 | } |
71 | 70 | unset($attributes["rules"]); |
@@ -117,8 +116,9 @@ discard block |
||
117 | 116 | public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){ |
118 | 117 | return $this->_fieldAs(function($id,$name,$value) use($icon){ |
119 | 118 | $lbl=new HtmlLabel($id,$value); |
120 | - if(isset($icon)) |
|
121 | - $lbl->addIcon($icon); |
|
119 | + if(isset($icon)) { |
|
120 | + $lbl->addIcon($icon); |
|
121 | + } |
|
122 | 122 | return $lbl; |
123 | 123 | }, $index,$attributes,"label"); |
124 | 124 | } |
@@ -126,8 +126,9 @@ discard block |
||
126 | 126 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
127 | 127 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
128 | 128 | $header=new HtmlHeader($id,$niveau,$value); |
129 | - if(isset($icon)) |
|
130 | - $header->asIcon($icon, $value); |
|
129 | + if(isset($icon)) { |
|
130 | + $header->asIcon($icon, $value); |
|
131 | + } |
|
131 | 132 | return $header; |
132 | 133 | }, $index,$attributes,"header"); |
133 | 134 | } |
@@ -135,7 +136,9 @@ discard block |
||
135 | 136 | |
136 | 137 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
137 | 138 | $this->setValueFunction($index,function($img) use($size,$circular){ |
138 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
139 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
140 | + $image->setCircular(); |
|
141 | + } |
|
139 | 142 | return $image; |
140 | 143 | }); |
141 | 144 | return $this; |
@@ -230,14 +233,14 @@ discard block |
||
230 | 233 | $i=0; |
231 | 234 | if(JArray::isAssociative($types)){ |
232 | 235 | foreach ($types as $type=>$attributes){ |
233 | - if(\is_int($type)) |
|
234 | - $this->fieldAs($i++,$attributes,[]); |
|
235 | - else{ |
|
236 | + if(\is_int($type)) { |
|
237 | + $this->fieldAs($i++,$attributes,[]); |
|
238 | + } else{ |
|
236 | 239 | $type=preg_replace('/\d/', '', $type ); |
237 | 240 | $this->fieldAs($i++,$type,$attributes); |
238 | 241 | } |
239 | 242 | } |
240 | - }else{ |
|
243 | + } else{ |
|
241 | 244 | foreach ($types as $type){ |
242 | 245 | $this->fieldAs($i++,$type); |
243 | 246 | } |
@@ -249,7 +252,7 @@ discard block |
||
249 | 252 | if(\method_exists($this, $method)){ |
250 | 253 | if(!\is_array($attributes)){ |
251 | 254 | $attributes=[$index]; |
252 | - }else{ |
|
255 | + } else{ |
|
253 | 256 | \array_unshift($attributes, $index); |
254 | 257 | } |
255 | 258 | \call_user_func_array([$this,$method], $attributes); |