@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $icon=@$content[0]; |
19 | 19 | $title=@$content[1]; |
20 | 20 | $desc=@$content[2]; |
21 | - }else{ |
|
21 | + } else{ |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if(isset($title)){ |
30 | 30 | $this->setTitle($title); |
31 | 31 | } |
32 | - }else{ |
|
32 | + } else{ |
|
33 | 33 | $this->setContent($content); |
34 | 34 | } |
35 | 35 | } |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | $this->_colSizing=false; |
30 | 30 | $this->setWide($numCols); |
31 | 31 | } |
32 | - if($createCols) |
|
33 | - $this->setRowsCount($numRows, $numCols); |
|
32 | + if($createCols) { |
|
33 | + $this->setRowsCount($numRows, $numCols); |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | |
36 | 37 | public function asSegment() { |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | public function addCol($width=NULL) { |
83 | 84 | $colCount=$this->colCount() + 1; |
84 | 85 | $this->setColsCount($colCount, true, $width); |
85 | - if ($this->hasOnlyCols($this->count())) |
|
86 | - return $this->content[$colCount - 1]; |
|
86 | + if ($this->hasOnlyCols($this->count())) { |
|
87 | + return $this->content[$colCount - 1]; |
|
88 | + } |
|
87 | 89 | return $this; |
88 | 90 | } |
89 | 91 | |
@@ -178,8 +180,9 @@ discard block |
||
178 | 180 | */ |
179 | 181 | public function rowCount() { |
180 | 182 | $count=$this->count(); |
181 | - if ($this->hasOnlyCols($count)) |
|
182 | - return 0; |
|
183 | + if ($this->hasOnlyCols($count)) { |
|
184 | + return 0; |
|
185 | + } |
|
183 | 186 | return $count; |
184 | 187 | } |
185 | 188 | |
@@ -189,10 +192,12 @@ discard block |
||
189 | 192 | */ |
190 | 193 | public function colCount() { |
191 | 194 | $count=$this->count(); |
192 | - if ($this->hasOnlyCols($count)) |
|
193 | - return $count; |
|
194 | - if ($count > 0) |
|
195 | - return $this->getItem(0)->count(); |
|
195 | + if ($this->hasOnlyCols($count)) { |
|
196 | + return $count; |
|
197 | + } |
|
198 | + if ($count > 0) { |
|
199 | + return $this->getItem(0)->count(); |
|
200 | + } |
|
196 | 201 | return 0; |
197 | 202 | } |
198 | 203 | |
@@ -203,8 +208,9 @@ discard block |
||
203 | 208 | * @return HtmlGridCol |
204 | 209 | */ |
205 | 210 | public function getCell($row, $col) { |
206 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
207 | - return $this->getItem($col); |
|
211 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
212 | + return $this->getItem($col); |
|
213 | + } |
|
208 | 214 | $row=$this->getItem($row); |
209 | 215 | if (isset($row)) { |
210 | 216 | $col=$row->getItem($col); |
@@ -253,8 +259,9 @@ discard block |
||
253 | 259 | * @return \Ajax\semantic\html\collections\HtmlGrid |
254 | 260 | */ |
255 | 261 | public function setPadded($value=NULL) { |
256 | - if (isset($value)) |
|
257 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
262 | + if (isset($value)) { |
|
263 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
264 | + } |
|
258 | 265 | return $this->addToProperty("class", "padded"); |
259 | 266 | } |
260 | 267 | |
@@ -279,8 +286,9 @@ discard block |
||
279 | 286 | * @see \Ajax\common\html\HtmlCollection::createItem() |
280 | 287 | */ |
281 | 288 | protected function createItem($value) { |
282 | - if ($this->_createCols === false) |
|
283 | - $value=null; |
|
289 | + if ($this->_createCols === false) { |
|
290 | + $value=null; |
|
291 | + } |
|
284 | 292 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
285 | 293 | return $item; |
286 | 294 | } |
@@ -63,15 +63,17 @@ discard block |
||
63 | 63 | */ |
64 | 64 | private function getFieldButton($caption,$visibleHover=true){ |
65 | 65 | $bt= new HtmlButton($this->cleanIdentifier($caption),$caption); |
66 | - if($visibleHover) |
|
67 | - $this->_visibleOver($bt); |
|
66 | + if($visibleHover) { |
|
67 | + $this->_visibleOver($bt); |
|
68 | + } |
|
68 | 69 | return $bt; |
69 | 70 | } |
70 | 71 | |
71 | 72 | private function getFieldButtons($buttons,$visibleHover=true){ |
72 | 73 | $bts=new HtmlButtonGroups("",$buttons); |
73 | - if($visibleHover) |
|
74 | - $this->_visibleOver($bts); |
|
74 | + if($visibleHover) { |
|
75 | + $this->_visibleOver($bts); |
|
76 | + } |
|
75 | 77 | return $bts; |
76 | 78 | } |
77 | 79 | |
@@ -88,8 +90,9 @@ discard block |
||
88 | 90 | return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){ |
89 | 91 | $button=new HtmlButton($id,$value,$cssStyle); |
90 | 92 | $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
91 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
92 | - $this->_visibleOver($button); |
|
93 | + if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) { |
|
94 | + $this->_visibleOver($button); |
|
95 | + } |
|
93 | 96 | return $button; |
94 | 97 | }, $index,$attributes); |
95 | 98 | } |
@@ -160,8 +163,9 @@ discard block |
||
160 | 163 | private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
161 | 164 | $bt=$this->getFieldButton("",$visibleHover); |
162 | 165 | $bt->asIcon($icon); |
163 | - if(isset($class)) |
|
164 | - $bt->addClass($class); |
|
166 | + if(isset($class)) { |
|
167 | + $bt->addClass($class); |
|
168 | + } |
|
165 | 169 | return $bt; |
166 | 170 | } |
167 | 171 |
@@ -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); |
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,self::$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; |
@@ -174,9 +177,9 @@ discard block |
||
174 | 177 | $property=$this->getProperty($index); |
175 | 178 | if($property instanceof \ReflectionProperty){ |
176 | 179 | $result=$property->getName(); |
177 | - }elseif(\is_callable($property)){ |
|
180 | + } elseif(\is_callable($property)){ |
|
178 | 181 | $result=$this->visibleProperties[$index]; |
179 | - }else{ |
|
182 | + } else{ |
|
180 | 183 | $result=$property; |
181 | 184 | } |
182 | 185 | return $result; |
@@ -196,7 +199,7 @@ discard block |
||
196 | 199 | $this->reflect=new \ReflectionClass($instance); |
197 | 200 | if(JArray::count($this->visibleProperties)===0){ |
198 | 201 | $this->properties=$this->getDefaultProperties(); |
199 | - }else{ |
|
202 | + } else{ |
|
200 | 203 | foreach ($this->visibleProperties as $property){ |
201 | 204 | $this->setInstanceProperty($property); |
202 | 205 | } |
@@ -207,22 +210,23 @@ discard block |
||
207 | 210 | private function setInstanceProperty($property){ |
208 | 211 | if(\is_callable($property)){ |
209 | 212 | $this->properties[]=$property; |
210 | - }elseif(\is_string($property)){ |
|
213 | + } elseif(\is_string($property)){ |
|
211 | 214 | try{ |
212 | 215 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
213 | 216 | $rProperty=$this->reflect->getProperty($property); |
214 | 217 | $this->properties[]=$rProperty; |
215 | - }catch(\Exception $e){ |
|
218 | + } catch(\Exception $e){ |
|
216 | 219 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
217 | 220 | $this->properties[]=$property; |
218 | 221 | } |
219 | - }elseif(\is_int($property)){ |
|
222 | + } elseif(\is_int($property)){ |
|
220 | 223 | $props=$this->getDefaultProperties(); |
221 | - if(isset($props[$property])) |
|
222 | - $this->properties[]=$props[$property]; |
|
223 | - else |
|
224 | - $this->properties[]=$property; |
|
225 | - }else{ |
|
224 | + if(isset($props[$property])) { |
|
225 | + $this->properties[]=$props[$property]; |
|
226 | + } else { |
|
227 | + $this->properties[]=$property; |
|
228 | + } |
|
229 | + } else{ |
|
226 | 230 | $this->properties[]=$property; |
227 | 231 | } |
228 | 232 | } |
@@ -266,12 +270,13 @@ discard block |
||
266 | 270 | if(isset($this->captions[$index])){ |
267 | 271 | return $this->captions[$index]; |
268 | 272 | } |
269 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
270 | - return $this->properties[$index]->getName(); |
|
271 | - elseif(\is_callable($this->properties[$index])) |
|
272 | - return ""; |
|
273 | - else |
|
274 | - return $this->properties[$index]; |
|
273 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
274 | + return $this->properties[$index]->getName(); |
|
275 | + } elseif(\is_callable($this->properties[$index])) { |
|
276 | + return ""; |
|
277 | + } else { |
|
278 | + return $this->properties[$index]; |
|
279 | + } |
|
275 | 280 | } |
276 | 281 | |
277 | 282 | public function getCaptions(){ |
@@ -282,7 +287,7 @@ discard block |
||
282 | 287 | for($i=$captionsSize;$i<$count;$i++){ |
283 | 288 | $captions[]=""; |
284 | 289 | } |
285 | - }else{ |
|
290 | + } else{ |
|
286 | 291 | $captions=[]; |
287 | 292 | $index=0; |
288 | 293 | while($index<$count){ |
@@ -297,8 +302,9 @@ discard block |
||
297 | 302 | } |
298 | 303 | |
299 | 304 | public function setCaption($index,$caption){ |
300 | - if(isset($this->captions)===false) |
|
301 | - $this->captions=[]; |
|
305 | + if(isset($this->captions)===false) { |
|
306 | + $this->captions=[]; |
|
307 | + } |
|
302 | 308 | $this->captions[$index]=$caption; |
303 | 309 | return $this; |
304 | 310 | } |