@@ -47,9 +47,9 @@ |
||
47 | 47 | $rules=$attributes["rules"]; |
48 | 48 | if(\is_array($rules)){ |
49 | 49 | $element->addRules($rules); |
50 | + } else { |
|
51 | + $element->addRule($rules); |
|
50 | 52 | } |
51 | - else |
|
52 | - $element->addRule($rules); |
|
53 | 53 | unset($attributes["rules"]); |
54 | 54 | } |
55 | 55 | } |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | $name=$attributes["name"]; |
36 | 36 | } |
37 | 37 | $element=$elementCallback($this->_getFieldIdentifier($prefix),$name,$value,""); |
38 | - if(\is_array($attributes)) |
|
39 | - $this->_applyAttributes($element, $attributes,$index); |
|
38 | + if(\is_array($attributes)) { |
|
39 | + $this->_applyAttributes($element, $attributes,$index); |
|
40 | + } |
|
40 | 41 | return $element; |
41 | 42 | }); |
42 | 43 | return $this; |
@@ -70,8 +71,9 @@ discard block |
||
70 | 71 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
71 | 72 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
72 | 73 | $header=new HtmlHeader($id,$niveau,$value); |
73 | - if(isset($icon)) |
|
74 | - $header->asIcon($icon, $value); |
|
74 | + if(isset($icon)) { |
|
75 | + $header->asIcon($icon, $value); |
|
76 | + } |
|
75 | 77 | return $header; |
76 | 78 | }, $index,$attributes,"header"); |
77 | 79 | } |
@@ -79,7 +81,9 @@ discard block |
||
79 | 81 | |
80 | 82 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
81 | 83 | $this->setValueFunction($index,function($img) use($size,$circular){ |
82 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
84 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
85 | + $image->setCircular(); |
|
86 | + } |
|
83 | 87 | return $image; |
84 | 88 | }); |
85 | 89 | return $this; |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | $this->widgetIdentifier=$identifier; |
21 | 21 | $this->values=[]; |
22 | 22 | $this->afterCompile=[]; |
23 | - if(isset($instance)) |
|
24 | - $this->setInstance($instance); |
|
23 | + if(isset($instance)) { |
|
24 | + $this->setInstance($instance); |
|
25 | + } |
|
25 | 26 | $this->setCaptions($captions); |
26 | 27 | $this->captionCallback=NULL; |
27 | 28 | } |
@@ -38,8 +39,9 @@ discard block |
||
38 | 39 | |
39 | 40 | public function getIdentifier(){ |
40 | 41 | $value=self::$index; |
41 | - if(isset($this->values["identifier"])) |
|
42 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
42 | + if(isset($this->values["identifier"])) { |
|
43 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
44 | + } |
|
43 | 45 | return $value; |
44 | 46 | } |
45 | 47 | |
@@ -62,19 +64,19 @@ discard block |
||
62 | 64 | $value=$property->getValue($this->instance); |
63 | 65 | if(isset($this->values[$index])){ |
64 | 66 | $value= $this->values[$index]($value,$this->instance,$index); |
65 | - }else{ |
|
67 | + } else{ |
|
66 | 68 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
67 | 69 | } |
68 | - }else{ |
|
69 | - if(\is_callable($property)) |
|
70 | - $value=$property($this->instance); |
|
71 | - elseif(\is_array($property)){ |
|
70 | + } else{ |
|
71 | + if(\is_callable($property)) { |
|
72 | + $value=$property($this->instance); |
|
73 | + } elseif(\is_array($property)){ |
|
72 | 74 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
73 | 75 | $value=\implode("", $values); |
74 | - }else{ |
|
76 | + } else{ |
|
75 | 77 | if(isset($this->values[$index])){ |
76 | 78 | $value= $this->values[$index]($property,$this->instance,$index); |
77 | - }else{ |
|
79 | + } else{ |
|
78 | 80 | $value=$property; |
79 | 81 | } |
80 | 82 | } |
@@ -97,10 +99,10 @@ discard block |
||
97 | 99 | if(isset($vb[$index])){ |
98 | 100 | if(\is_array($vb[$index])){ |
99 | 101 | $this->visibleProperties[$index][]=$field; |
100 | - }else{ |
|
102 | + } else{ |
|
101 | 103 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
102 | 104 | } |
103 | - }else{ |
|
105 | + } else{ |
|
104 | 106 | return $this->insertField($index, $field); |
105 | 107 | } |
106 | 108 | return $this; |
@@ -136,26 +138,27 @@ discard block |
||
136 | 138 | $this->reflect=new \ReflectionClass($instance); |
137 | 139 | if(\sizeof($this->visibleProperties)===0){ |
138 | 140 | $this->properties=$this->getDefaultProperties(); |
139 | - }else{ |
|
141 | + } else{ |
|
140 | 142 | foreach ($this->visibleProperties as $property){ |
141 | 143 | if(\is_callable($property)){ |
142 | 144 | $this->properties[]=$property; |
143 | - }elseif(\is_string($property)){ |
|
145 | + } elseif(\is_string($property)){ |
|
144 | 146 | try{ |
145 | 147 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
146 | 148 | $rProperty=$this->reflect->getProperty($property); |
147 | 149 | $this->properties[]=$rProperty; |
148 | - }catch(\Exception $e){ |
|
150 | + } catch(\Exception $e){ |
|
149 | 151 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
150 | 152 | $this->properties[]=$property; |
151 | 153 | } |
152 | - }elseif(\is_int($property)){ |
|
154 | + } elseif(\is_int($property)){ |
|
153 | 155 | $props=$this->getDefaultProperties(); |
154 | - if(isset($props[$property])) |
|
155 | - $this->properties[]=$props[$property]; |
|
156 | - else |
|
157 | - $this->properties[]=$property; |
|
158 | - }else{ |
|
156 | + if(isset($props[$property])) { |
|
157 | + $this->properties[]=$props[$property]; |
|
158 | + } else { |
|
159 | + $this->properties[]=$property; |
|
160 | + } |
|
161 | + } else{ |
|
159 | 162 | $this->properties[]=$property; |
160 | 163 | } |
161 | 164 | } |
@@ -202,12 +205,13 @@ discard block |
||
202 | 205 | if(isset($this->captions[$index])){ |
203 | 206 | return $this->captions[$index]; |
204 | 207 | } |
205 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
206 | - return $this->properties[$index]->getName(); |
|
207 | - elseif(\is_callable($this->properties[$index])) |
|
208 | - return ""; |
|
209 | - else |
|
210 | - return $this->properties[$index]; |
|
208 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
209 | + return $this->properties[$index]->getName(); |
|
210 | + } elseif(\is_callable($this->properties[$index])) { |
|
211 | + return ""; |
|
212 | + } else { |
|
213 | + return $this->properties[$index]; |
|
214 | + } |
|
211 | 215 | } |
212 | 216 | |
213 | 217 | public function getCaptions(){ |
@@ -216,7 +220,7 @@ discard block |
||
216 | 220 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
217 | 221 | $captions[]=""; |
218 | 222 | } |
219 | - }else{ |
|
223 | + } else{ |
|
220 | 224 | $captions=[]; |
221 | 225 | $index=0; |
222 | 226 | $count=$this->count(); |
@@ -232,8 +236,9 @@ discard block |
||
232 | 236 | } |
233 | 237 | |
234 | 238 | public function setCaption($index,$caption){ |
235 | - if(isset($this->captions)===false) |
|
236 | - $this->captions=[]; |
|
239 | + if(isset($this->captions)===false) { |
|
240 | + $this->captions=[]; |
|
241 | + } |
|
237 | 242 | $this->captions[$index]=$caption; |
238 | 243 | return $this; |
239 | 244 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if(\sizeof($this->_compileParts)<3){ |
233 | 233 | $this->_template="%content%"; |
234 | 234 | $this->refresh(); |
235 | - }else{ |
|
235 | + } else{ |
|
236 | 236 | if ($this->propertyContains("class", "sortable")) { |
237 | 237 | $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
238 | 238 | } |
@@ -255,8 +255,9 @@ discard block |
||
255 | 255 | $result= $this->getBody()->_addRow($result); |
256 | 256 | } |
257 | 257 | if(isset($this->_afterCompileEvents["onNewRow"])){ |
258 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
259 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
258 | + if(\is_callable($this->_afterCompileEvents["onNewRow"])) { |
|
259 | + $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
260 | + } |
|
260 | 261 | } |
261 | 262 | return $result; |
262 | 263 | } |
@@ -277,8 +278,9 @@ discard block |
||
277 | 278 | |
278 | 279 | public function run(JsUtils $js){ |
279 | 280 | $result= parent::run($js); |
280 | - if(isset($this->_footer)) |
|
281 | - $this->_footer->run($js); |
|
281 | + if(isset($this->_footer)) { |
|
282 | + $this->_footer->run($js); |
|
283 | + } |
|
282 | 284 | return $result; |
283 | 285 | } |
284 | 286 |
@@ -17,8 +17,9 @@ |
||
17 | 17 | |
18 | 18 | public function setBasic($very=false) { |
19 | 19 | $table=$this->getTable(); |
20 | - if ($very) |
|
21 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
20 | + if ($very) { |
|
21 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
22 | + } |
|
22 | 23 | return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
23 | 24 | } |
24 | 25 |
@@ -14,21 +14,24 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos < sizeof($values)) |
|
18 | - return $values[$pos]; |
|
17 | + if ($pos < sizeof($values)) { |
|
18 | + return $values[$pos]; |
|
19 | + } |
|
19 | 20 | } |
20 | 21 | |
21 | 22 | public static function getConditionalValue($array, $key, $condition) { |
22 | 23 | $result=NULL; |
23 | 24 | if (array_key_exists($key, $array)) { |
24 | 25 | $result=$array[$key]; |
25 | - if ($condition($result) === true) |
|
26 | - return $result; |
|
26 | + if ($condition($result) === true) { |
|
27 | + return $result; |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | $values=array_values($array); |
29 | 31 | foreach ( $values as $val ) { |
30 | - if ($condition($val) === true) |
|
31 | - return $val; |
|
32 | + if ($condition($val) === true) { |
|
33 | + return $val; |
|
34 | + } |
|
32 | 35 | } |
33 | 36 | return $result; |
34 | 37 | } |
@@ -36,8 +39,9 @@ discard block |
||
36 | 39 | public static function getDefaultValue($array, $key, $default=NULL) { |
37 | 40 | if (array_key_exists($key, $array)) { |
38 | 41 | return $array[$key]; |
39 | - } else |
|
40 | - return $default; |
|
42 | + } else { |
|
43 | + return $default; |
|
44 | + } |
|
41 | 45 | } |
42 | 46 | |
43 | 47 | public static function implode($glue, $pieces) { |
@@ -84,7 +88,7 @@ discard block |
||
84 | 88 | foreach ($objects as $object){ |
85 | 89 | $result[]=self::callFunction($object, $modelFunction); |
86 | 90 | } |
87 | - }else{ |
|
91 | + } else{ |
|
88 | 92 | foreach ($objects as $object){ |
89 | 93 | $result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction); |
90 | 94 | } |
@@ -93,9 +97,9 @@ discard block |
||
93 | 97 | } |
94 | 98 | |
95 | 99 | private static function callFunction($object,$callback){ |
96 | - if(\is_string($callback)) |
|
97 | - return \call_user_func(array($object, $callback),[]); |
|
98 | - else if (\is_callable($callback)){ |
|
100 | + if(\is_string($callback)) { |
|
101 | + return \call_user_func(array($object, $callback),[]); |
|
102 | + } else if (\is_callable($callback)){ |
|
99 | 103 | return $callback($object); |
100 | 104 | } |
101 | 105 | } |
@@ -50,8 +50,9 @@ |
||
50 | 50 | $comp=$item->compile($js); |
51 | 51 | if(isset($js)){ |
52 | 52 | $bs=$item->run($js); |
53 | - if(isset($bs)) |
|
54 | - $this->params['onShow']=$bs->getScript(); |
|
53 | + if(isset($bs)) { |
|
54 | + $this->params['onShow']=$bs->getScript(); |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | $item=$comp; |
57 | 58 | } |