@@ -29,15 +29,17 @@ |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (!\is_array($this->content)) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
34 | - else |
|
35 | - $this->content=array(); |
|
32 | + if(isset($this->content)) { |
|
33 | + $this->content=array ($this->content); |
|
34 | + } else { |
|
35 | + $this->content=array(); |
|
36 | + } |
|
37 | + } |
|
38 | + if($before) { |
|
39 | + array_unshift($this->content,$content); |
|
40 | + } else { |
|
41 | + $this->content []=$content; |
|
36 | 42 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
39 | - else |
|
40 | - $this->content []=$content; |
|
41 | 43 | return $this; |
42 | 44 | } |
43 | 45 |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getProperty($name) { |
53 | - if (array_key_exists($name, $this->properties)) |
|
54 | - return $this->properties[$name]; |
|
53 | + if (array_key_exists($name, $this->properties)) { |
|
54 | + return $this->properties[$name]; |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | |
57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
61 | 62 | } |
62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
63 | 64 | $v=@$this->properties[$name]; |
64 | - if (isset($v) && $v !== "") |
|
65 | - $v=$v . $separator . $value; |
|
66 | - else |
|
67 | - $v=$value; |
|
65 | + if (isset($v) && $v !== "") { |
|
66 | + $v=$v . $separator . $value; |
|
67 | + } else { |
|
68 | + $v=$value; |
|
69 | + } |
|
68 | 70 | |
69 | 71 | return $this->setProperty($name, $v); |
70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
119 | 121 | } |
120 | 122 | |
121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
123 | - return $this->setProperty($name, $value); |
|
124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
125 | + return $this->setProperty($name, $value); |
|
126 | + } |
|
124 | 127 | return $this; |
125 | 128 | } |
126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
150 | 153 | } |
151 | 154 | |
152 | 155 | public function removeProperty($name) { |
153 | - if (\array_key_exists($name, $this->properties)) |
|
154 | - unset($this->properties[$name]); |
|
156 | + if (\array_key_exists($name, $this->properties)) { |
|
157 | + unset($this->properties[$name]); |
|
158 | + } |
|
155 | 159 | return $this; |
156 | 160 | } |
157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
171 | 175 | } |
172 | 176 | |
173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
174 | - if (@class_exists($typeCtrl, true)) |
|
175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
178 | + if (@class_exists($typeCtrl, true)) { |
|
179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
180 | + } |
|
176 | 181 | if (\is_array($typeCtrl)) { |
177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
178 | 183 | } |
@@ -213,8 +218,9 @@ discard block |
||
213 | 218 | |
214 | 219 | public function fromArray($array) { |
215 | 220 | foreach ( $this as $key => $value ) { |
216 | - if(array_key_exists($key, $array)===true) |
|
217 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
221 | + if(array_key_exists($key, $array)===true) { |
|
222 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
223 | + } |
|
218 | 224 | } |
219 | 225 | foreach ( $array as $key => $value ) { |
220 | 226 | if($this->_callSetter($key, $key, $value, $array)===false){ |
@@ -265,15 +271,18 @@ discard block |
||
265 | 271 | $flag=false; |
266 | 272 | $index=0; |
267 | 273 | while ( !$flag && $index < sizeof($elements) ) { |
268 | - if ($elements[$index] instanceof BaseHtml) |
|
269 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
274 | + if ($elements[$index] instanceof BaseHtml) { |
|
275 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
276 | + } |
|
270 | 277 | $index++; |
271 | 278 | } |
272 | - if ($flag === true) |
|
273 | - return $elements[$index - 1]; |
|
279 | + if ($flag === true) { |
|
280 | + return $elements[$index - 1]; |
|
281 | + } |
|
274 | 282 | } elseif ($elements instanceof BaseHtml) { |
275 | - if ($elements->getIdentifier() === $identifier) |
|
276 | - return $elements; |
|
283 | + if ($elements->getIdentifier() === $identifier) { |
|
284 | + return $elements; |
|
285 | + } |
|
277 | 286 | } |
278 | 287 | return null; |
279 | 288 | } |
@@ -283,15 +292,18 @@ discard block |
||
283 | 292 | $flag=false; |
284 | 293 | $index=0; |
285 | 294 | while ( !$flag && $index < sizeof($elements) ) { |
286 | - if ($elements[$index] instanceof BaseHtml) |
|
287 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
295 | + if ($elements[$index] instanceof BaseHtml) { |
|
296 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
297 | + } |
|
288 | 298 | $index++; |
289 | 299 | } |
290 | - if ($flag === true) |
|
291 | - return $elements[$index - 1]; |
|
300 | + if ($flag === true) { |
|
301 | + return $elements[$index - 1]; |
|
302 | + } |
|
292 | 303 | } elseif ($elements instanceof BaseHtml) { |
293 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
294 | - return $elements; |
|
304 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
305 | + return $elements; |
|
306 | + } |
|
295 | 307 | } |
296 | 308 | return null; |
297 | 309 | } |
@@ -46,8 +46,9 @@ discard block |
||
46 | 46 | } |
47 | 47 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
48 | 48 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$jsCallback)."});\n"; |
49 | - if ($immediatly) |
|
50 | - $this->jquery_code_for_compile[]=$retour; |
|
49 | + if ($immediatly) { |
|
50 | + $this->jquery_code_for_compile[]=$retour; |
|
51 | + } |
|
51 | 52 | return $retour; |
52 | 53 | } |
53 | 54 | |
@@ -55,15 +56,17 @@ discard block |
||
55 | 56 | $url=$this->_correctAjaxUrl($url); |
56 | 57 | $retour="url='".$url."';\n"; |
57 | 58 | $slash="/"; |
58 | - if(JString::endswith($url, "/")===true) |
|
59 | - $slash=""; |
|
59 | + if(JString::endswith($url, "/")===true) { |
|
60 | + $slash=""; |
|
61 | + } |
|
60 | 62 | if(JString::isNotNull($attr)){ |
61 | - if ($attr==="value") |
|
62 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
63 | - elseif ($attr==="html") |
|
64 | - $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
65 | - elseif($attr!=null && $attr!=="") |
|
66 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
63 | + if ($attr==="value") { |
|
64 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
65 | + } elseif ($attr==="html") { |
|
66 | + $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
67 | + } elseif($attr!=null && $attr!=="") { |
|
68 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
69 | + } |
|
67 | 70 | } |
68 | 71 | return $retour; |
69 | 72 | } |
@@ -85,8 +88,9 @@ discard block |
||
85 | 88 | } |
86 | 89 | |
87 | 90 | protected function _correctAjaxUrl($url) { |
88 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
89 | - $url=substr($url, 0, strlen($url)-1); |
|
91 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
92 | + $url=substr($url, 0, strlen($url)-1); |
|
93 | + } |
|
90 | 94 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
91 | 95 | $url=$this->jsUtils->getUrl($url); |
92 | 96 | } |
@@ -110,8 +114,9 @@ discard block |
||
110 | 114 | $retour.="\t".$jsCallback."\n". |
111 | 115 | "\t$(document).trigger('jsonReady',[data]);\n". |
112 | 116 | "});\n"; |
113 | - if ($immediatly) |
|
114 | - $this->jquery_code_for_compile[]=$retour; |
|
117 | + if ($immediatly) { |
|
118 | + $this->jquery_code_for_compile[]=$retour; |
|
119 | + } |
|
115 | 120 | return $retour; |
116 | 121 | } |
117 | 122 | |
@@ -150,7 +155,7 @@ discard block |
||
150 | 155 | if($context===null){ |
151 | 156 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
152 | 157 | $newElm = "$('#'+newId)"; |
153 | - }else{ |
|
158 | + } else{ |
|
154 | 159 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
155 | 160 | $newElm = $context.".find('#'+newId)"; |
156 | 161 | } |
@@ -160,8 +165,9 @@ discard block |
||
160 | 165 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
161 | 166 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
162 | 167 | $retour.="\t".$jsCallback."\n"."});\n"; |
163 | - if ($immediatly) |
|
164 | - $this->jquery_code_for_compile[]=$retour; |
|
168 | + if ($immediatly) { |
|
169 | + $this->jquery_code_for_compile[]=$retour; |
|
170 | + } |
|
165 | 171 | return $retour; |
166 | 172 | } |
167 | 173 | /** |
@@ -202,8 +208,9 @@ discard block |
||
202 | 208 | }});\n"; |
203 | 209 | $retour.="$('#".$form."').submit();\n"; |
204 | 210 | } |
205 | - if ($immediatly) |
|
206 | - $this->jquery_code_for_compile[]=$retour; |
|
211 | + if ($immediatly) { |
|
212 | + $this->jquery_code_for_compile[]=$retour; |
|
213 | + } |
|
207 | 214 | return $retour; |
208 | 215 | } |
209 | 216 |
@@ -66,8 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | $table->setRowCount(0, \sizeof($captions)); |
68 | 68 | $table->setHeaderValues($captions); |
69 | - if(isset($this->_compileParts)) |
|
70 | - $table->setCompileParts($this->_compileParts); |
|
69 | + if(isset($this->_compileParts)) { |
|
70 | + $table->setCompileParts($this->_compileParts); |
|
71 | + } |
|
71 | 72 | if(isset($this->_searchField) && isset($js)){ |
72 | 73 | $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
73 | 74 | } |
@@ -158,7 +159,7 @@ discard block |
||
158 | 159 | $hasPart=$table->hasPart($part); |
159 | 160 | if($hasPart){ |
160 | 161 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
161 | - }else{ |
|
162 | + } else{ |
|
162 | 163 | $row=$table->getPart($part)->getRow(0); |
163 | 164 | } |
164 | 165 | $row->mergeCol(); |
@@ -282,8 +283,9 @@ discard block |
||
282 | 283 | private function getDefaultButton($icon,$class=null){ |
283 | 284 | $bt=$this->getFieldButton(""); |
284 | 285 | $bt->asIcon($icon); |
285 | - if(isset($class)) |
|
286 | - $bt->addToProperty("class", $class); |
|
286 | + if(isset($class)) { |
|
287 | + $bt->addToProperty("class", $class); |
|
288 | + } |
|
287 | 289 | return $bt; |
288 | 290 | } |
289 | 291 |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | $this->widgetIdentifier=$identifier; |
22 | 22 | $this->values=[]; |
23 | 23 | $this->afterCompile=[]; |
24 | - if(isset($instance)) |
|
25 | - $this->setInstance($instance); |
|
24 | + if(isset($instance)) { |
|
25 | + $this->setInstance($instance); |
|
26 | + } |
|
26 | 27 | $this->setCaptions($captions); |
27 | 28 | $this->captionCallback=NULL; |
28 | 29 | $this->defaultValueFunction=function($name,$value){return $value;}; |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | |
41 | 42 | public function getIdentifier(){ |
42 | 43 | $value=self::$index; |
43 | - if(isset($this->values["identifier"])) |
|
44 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
44 | + if(isset($this->values["identifier"])) { |
|
45 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
46 | + } |
|
45 | 47 | return $value; |
46 | 48 | } |
47 | 49 | |
@@ -65,19 +67,19 @@ discard block |
||
65 | 67 | $value=$property->getValue($this->instance); |
66 | 68 | if(isset($this->values[$index])){ |
67 | 69 | $value= $this->values[$index]($value,$this->instance,$index); |
68 | - }else{ |
|
70 | + } else{ |
|
69 | 71 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
70 | 72 | } |
71 | - }else{ |
|
72 | - if(\is_callable($property)) |
|
73 | - $value=$property($this->instance); |
|
74 | - elseif(\is_array($property)){ |
|
73 | + } else{ |
|
74 | + if(\is_callable($property)) { |
|
75 | + $value=$property($this->instance); |
|
76 | + } elseif(\is_array($property)){ |
|
75 | 77 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
76 | 78 | $value=\implode("", $values); |
77 | - }else{ |
|
79 | + } else{ |
|
78 | 80 | if(isset($this->values[$index])){ |
79 | 81 | $value= $this->values[$index]($property,$this->instance,$index); |
80 | - }else{ |
|
82 | + } else{ |
|
81 | 83 | $value=$property; |
82 | 84 | } |
83 | 85 | } |
@@ -100,10 +102,10 @@ discard block |
||
100 | 102 | if(isset($vb[$index])){ |
101 | 103 | if(\is_array($vb[$index])){ |
102 | 104 | $this->visibleProperties[$index][]=$field; |
103 | - }else{ |
|
105 | + } else{ |
|
104 | 106 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
105 | 107 | } |
106 | - }else{ |
|
108 | + } else{ |
|
107 | 109 | return $this->insertField($index, $field); |
108 | 110 | } |
109 | 111 | return $this; |
@@ -130,9 +132,9 @@ discard block |
||
130 | 132 | $property=$this->getProperty($index); |
131 | 133 | if($property instanceof \ReflectionProperty){ |
132 | 134 | $result=$property->getName(); |
133 | - }elseif(\is_callable($property)){ |
|
135 | + } elseif(\is_callable($property)){ |
|
134 | 136 | $result=$this->visibleProperties[$index]; |
135 | - }else{ |
|
137 | + } else{ |
|
136 | 138 | $result=$property; |
137 | 139 | } |
138 | 140 | return $result; |
@@ -152,7 +154,7 @@ discard block |
||
152 | 154 | $this->reflect=new \ReflectionClass($instance); |
153 | 155 | if(\sizeof($this->visibleProperties)===0){ |
154 | 156 | $this->properties=$this->getDefaultProperties(); |
155 | - }else{ |
|
157 | + } else{ |
|
156 | 158 | foreach ($this->visibleProperties as $property){ |
157 | 159 | $this->setInstanceProperty($property); |
158 | 160 | } |
@@ -163,22 +165,23 @@ discard block |
||
163 | 165 | private function setInstanceProperty($property){ |
164 | 166 | if(\is_callable($property)){ |
165 | 167 | $this->properties[]=$property; |
166 | - }elseif(\is_string($property)){ |
|
168 | + } elseif(\is_string($property)){ |
|
167 | 169 | try{ |
168 | 170 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
169 | 171 | $rProperty=$this->reflect->getProperty($property); |
170 | 172 | $this->properties[]=$rProperty; |
171 | - }catch(\Exception $e){ |
|
173 | + } catch(\Exception $e){ |
|
172 | 174 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
173 | 175 | $this->properties[]=$property; |
174 | 176 | } |
175 | - }elseif(\is_int($property)){ |
|
177 | + } elseif(\is_int($property)){ |
|
176 | 178 | $props=$this->getDefaultProperties(); |
177 | - if(isset($props[$property])) |
|
178 | - $this->properties[]=$props[$property]; |
|
179 | - else |
|
180 | - $this->properties[]=$property; |
|
181 | - }else{ |
|
179 | + if(isset($props[$property])) { |
|
180 | + $this->properties[]=$props[$property]; |
|
181 | + } else { |
|
182 | + $this->properties[]=$property; |
|
183 | + } |
|
184 | + } else{ |
|
182 | 185 | $this->properties[]=$property; |
183 | 186 | } |
184 | 187 | } |
@@ -222,12 +225,13 @@ discard block |
||
222 | 225 | if(isset($this->captions[$index])){ |
223 | 226 | return $this->captions[$index]; |
224 | 227 | } |
225 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
226 | - return $this->properties[$index]->getName(); |
|
227 | - elseif(\is_callable($this->properties[$index])) |
|
228 | - return ""; |
|
229 | - else |
|
230 | - return $this->properties[$index]; |
|
228 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
229 | + return $this->properties[$index]->getName(); |
|
230 | + } elseif(\is_callable($this->properties[$index])) { |
|
231 | + return ""; |
|
232 | + } else { |
|
233 | + return $this->properties[$index]; |
|
234 | + } |
|
231 | 235 | } |
232 | 236 | |
233 | 237 | public function getCaptions(){ |
@@ -236,7 +240,7 @@ discard block |
||
236 | 240 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
237 | 241 | $captions[]=""; |
238 | 242 | } |
239 | - }else{ |
|
243 | + } else{ |
|
240 | 244 | $captions=[]; |
241 | 245 | $index=0; |
242 | 246 | $count=$this->count(); |
@@ -252,8 +256,9 @@ discard block |
||
252 | 256 | } |
253 | 257 | |
254 | 258 | public function setCaption($index,$caption){ |
255 | - if(isset($this->captions)===false) |
|
256 | - $this->captions=[]; |
|
259 | + if(isset($this->captions)===false) { |
|
260 | + $this->captions=[]; |
|
261 | + } |
|
257 | 262 | $this->captions[$index]=$caption; |
258 | 263 | return $this; |
259 | 264 | } |
@@ -33,8 +33,9 @@ |
||
33 | 33 | |
34 | 34 | |
35 | 35 | public function addSeparatorAfter($fieldNum){ |
36 | - if(\array_search($fieldNum, $this->separators)===false) |
|
37 | - $this->separators[]=$fieldNum; |
|
36 | + if(\array_search($fieldNum, $this->separators)===false) { |
|
37 | + $this->separators[]=$fieldNum; |
|
38 | + } |
|
38 | 39 | return $this; |
39 | 40 | } |
40 | 41 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->setTagName("div"); |
58 | 58 | $this->removeProperty("href"); |
59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
60 | - }else{ |
|
60 | + } else{ |
|
61 | 61 | $this->removePropertyValue("class", "active"); |
62 | 62 | } |
63 | 63 | return $this; |
@@ -65,8 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | public function asLink($href=NULL,$part=NULL){ |
67 | 67 | $this->setTagName("a"); |
68 | - if(isset($href)) |
|
69 | - $this->setProperty("href", $href); |
|
68 | + if(isset($href)) { |
|
69 | + $this->setProperty("href", $href); |
|
70 | + } |
|
70 | 71 | return $this; |
71 | 72 | } |
72 | 73 | |
@@ -77,8 +78,9 @@ discard block |
||
77 | 78 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
78 | 79 | */ |
79 | 80 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
80 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
81 | + if(\is_array($this->content) && JArray::isAssociative($this->content)) { |
|
82 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
83 | + } |
|
82 | 84 | return parent::compile($js, $view); |
83 | 85 | } |
84 | 86 | } |
85 | 87 | \ No newline at end of file |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | // } |
33 | 33 | $this->setWide($numCols); |
34 | 34 | } |
35 | - if($createCols) |
|
36 | - $this->setRowsCount($numRows, $numCols); |
|
35 | + if($createCols) { |
|
36 | + $this->setRowsCount($numRows, $numCols); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | public function asSegment() { |
@@ -85,8 +86,9 @@ discard block |
||
85 | 86 | public function addCol($width=NULL) { |
86 | 87 | $colCount=$this->colCount() + 1; |
87 | 88 | $this->setColsCount($colCount, true, $width); |
88 | - if ($this->hasOnlyCols($this->count())) |
|
89 | - return $this->content[$colCount - 1]; |
|
89 | + if ($this->hasOnlyCols($this->count())) { |
|
90 | + return $this->content[$colCount - 1]; |
|
91 | + } |
|
90 | 92 | return $this; |
91 | 93 | } |
92 | 94 | |
@@ -174,8 +176,9 @@ discard block |
||
174 | 176 | */ |
175 | 177 | public function rowCount() { |
176 | 178 | $count=$this->count(); |
177 | - if ($this->hasOnlyCols($count)) |
|
178 | - return 0; |
|
179 | + if ($this->hasOnlyCols($count)) { |
|
180 | + return 0; |
|
181 | + } |
|
179 | 182 | return $count; |
180 | 183 | } |
181 | 184 | |
@@ -185,10 +188,12 @@ discard block |
||
185 | 188 | */ |
186 | 189 | public function colCount() { |
187 | 190 | $count=$this->count(); |
188 | - if ($this->hasOnlyCols($count)) |
|
189 | - return $count; |
|
190 | - if ($count > 0) |
|
191 | - return $this->getItem(0)->count(); |
|
191 | + if ($this->hasOnlyCols($count)) { |
|
192 | + return $count; |
|
193 | + } |
|
194 | + if ($count > 0) { |
|
195 | + return $this->getItem(0)->count(); |
|
196 | + } |
|
192 | 197 | return 0; |
193 | 198 | } |
194 | 199 | |
@@ -199,8 +204,9 @@ discard block |
||
199 | 204 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
200 | 205 | */ |
201 | 206 | public function getCell($row, $col) { |
202 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
203 | - return $this->getItem($col); |
|
207 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
208 | + return $this->getItem($col); |
|
209 | + } |
|
204 | 210 | $row=$this->getItem($row); |
205 | 211 | if (isset($row)) { |
206 | 212 | $col=$row->getItem($col); |
@@ -249,8 +255,9 @@ discard block |
||
249 | 255 | * @return \Ajax\semantic\html\collections\HtmlGrid |
250 | 256 | */ |
251 | 257 | public function setPadded($value=NULL) { |
252 | - if (isset($value)) |
|
253 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
258 | + if (isset($value)) { |
|
259 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
260 | + } |
|
254 | 261 | return $this->addToProperty("class", "padded"); |
255 | 262 | } |
256 | 263 | |
@@ -275,8 +282,9 @@ discard block |
||
275 | 282 | * @see \Ajax\common\html\HtmlCollection::createItem() |
276 | 283 | */ |
277 | 284 | protected function createItem($value) { |
278 | - if ($this->_createCols === false) |
|
279 | - $value=null; |
|
285 | + if ($this->_createCols === false) { |
|
286 | + $value=null; |
|
287 | + } |
|
280 | 288 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
281 | 289 | return $item; |
282 | 290 | } |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function addHeader($title, $niveau=1, $dividing=true) { |
52 | 52 | $header=new HtmlHeader("", $niveau, $title); |
53 | - if ($dividing) |
|
54 | - $header->setDividing(); |
|
53 | + if ($dividing) { |
|
54 | + $header->setDividing(); |
|
55 | + } |
|
55 | 56 | return $this->addItem($header); |
56 | 57 | } |
57 | 58 | |
@@ -72,14 +73,16 @@ discard block |
||
72 | 73 | if (\is_string($end)) { |
73 | 74 | $label=$end; |
74 | 75 | \array_pop($fields); |
75 | - } else |
|
76 | - $label=NULL; |
|
76 | + } else { |
|
77 | + $label=NULL; |
|
78 | + } |
|
77 | 79 | } |
78 | 80 | $this->_fields=\array_merge($this->_fields, $fields); |
79 | 81 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
80 | 82 | } |
81 | - if (isset($label)) |
|
82 | - $fields=new HtmlFormField("", $fields, $label); |
|
83 | + if (isset($label)) { |
|
84 | + $fields=new HtmlFormField("", $fields, $label); |
|
85 | + } |
|
83 | 86 | } else { |
84 | 87 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
85 | 88 | } |
@@ -132,35 +135,41 @@ discard block |
||
132 | 135 | */ |
133 | 136 | public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
134 | 137 | $message=new HtmlMessage($identifier, $content); |
135 | - if (isset($header)) |
|
136 | - $message->addHeader($header); |
|
137 | - if (isset($icon)) |
|
138 | - $message->setIcon($icon); |
|
139 | - if (isset($type)) |
|
140 | - $message->setStyle($type); |
|
138 | + if (isset($header)) { |
|
139 | + $message->addHeader($header); |
|
140 | + } |
|
141 | + if (isset($icon)) { |
|
142 | + $message->setIcon($icon); |
|
143 | + } |
|
144 | + if (isset($type)) { |
|
145 | + $message->setStyle($type); |
|
146 | + } |
|
141 | 147 | return $this->addItem($message); |
142 | 148 | } |
143 | 149 | |
144 | 150 | |
145 | 151 | |
146 | 152 | public function compile(JsUtils $js=NULL,&$view=NULL){ |
147 | - if(\sizeof($this->_validationParams)>0) |
|
148 | - $this->setProperty("novalidate", ""); |
|
153 | + if(\sizeof($this->_validationParams)>0) { |
|
154 | + $this->setProperty("novalidate", ""); |
|
155 | + } |
|
149 | 156 | return parent::compile($js,$view); |
150 | 157 | } |
151 | 158 | |
152 | 159 | public function run(JsUtils $js) { |
153 | 160 | $compo=NULL; |
154 | 161 | foreach ($this->_fields as $field){ |
155 | - if($field instanceof HtmlFormField) |
|
156 | - $compo=$this->addCompoValidation($js, $compo, $field); |
|
162 | + if($field instanceof HtmlFormField) { |
|
163 | + $compo=$this->addCompoValidation($js, $compo, $field); |
|
164 | + } |
|
157 | 165 | } |
158 | 166 | foreach ($this->content as $field){ |
159 | 167 | if($field instanceof HtmlFormFields){ |
160 | 168 | $items=$field->getItems(); |
161 | 169 | foreach ($items as $_field){ |
162 | - if($_field instanceof HtmlFormField) |
|
163 | - $compo=$this->addCompoValidation($js, $compo, $_field); |
|
170 | + if($_field instanceof HtmlFormField) { |
|
171 | + $compo=$this->addCompoValidation($js, $compo, $_field); |
|
172 | + } |
|
164 | 173 | } |
165 | 174 | } |
166 | 175 | } |