@@ -49,16 +49,18 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function getProperty($name) { |
52 | - if (array_key_exists($name, $this->properties)) |
|
53 | - return $this->properties [$name]; |
|
52 | + if (array_key_exists($name, $this->properties)) { |
|
53 | + return $this->properties [$name]; |
|
54 | + } |
|
54 | 55 | } |
55 | 56 | |
56 | 57 | public function addToProperty($name, $value, $separator=" ") { |
57 | 58 | $v=$this->properties [$name]; |
58 | - if (isset($v)&&$v!=="") |
|
59 | - $v=$v.$separator.$value; |
|
60 | - else |
|
61 | - $v=$value; |
|
59 | + if (isset($v)&&$v!=="") { |
|
60 | + $v=$v.$separator.$value; |
|
61 | + } else { |
|
62 | + $v=$value; |
|
63 | + } |
|
62 | 64 | |
63 | 65 | return $this->setProperty($name, $v); |
64 | 66 | } |
@@ -108,8 +110,9 @@ discard block |
||
108 | 110 | } |
109 | 111 | |
110 | 112 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
111 | - if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
112 | - return $this->setProperty($name, $value); |
|
113 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
114 | + return $this->setProperty($name, $value); |
|
115 | + } |
|
113 | 116 | return $this; |
114 | 117 | } |
115 | 118 | |
@@ -144,8 +147,9 @@ discard block |
||
144 | 147 | } |
145 | 148 | |
146 | 149 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
147 | - if (@class_exists($typeCtrl, true)) |
|
148 | - $typeCtrl=$typeCtrl::getConstants(); |
|
150 | + if (@class_exists($typeCtrl, true)) { |
|
151 | + $typeCtrl=$typeCtrl::getConstants(); |
|
152 | + } |
|
149 | 153 | if (is_array($typeCtrl)) { |
150 | 154 | $this->removeOldValues($this->properties [$name], $typeCtrl); |
151 | 155 | } |
@@ -326,15 +330,18 @@ discard block |
||
326 | 330 | $flag=false; |
327 | 331 | $index=0; |
328 | 332 | while ( !$flag&&$index<sizeof($elements) ) { |
329 | - if ($elements [$index] instanceof BaseHtml) |
|
330 | - $flag=($elements [$index]->getIdentifier()===$identifier); |
|
333 | + if ($elements [$index] instanceof BaseHtml) { |
|
334 | + $flag=($elements [$index]->getIdentifier()===$identifier); |
|
335 | + } |
|
331 | 336 | $index++; |
332 | 337 | } |
333 | - if ($flag===true) |
|
334 | - return $elements [$index-1]; |
|
338 | + if ($flag===true) { |
|
339 | + return $elements [$index-1]; |
|
340 | + } |
|
335 | 341 | } elseif ($elements instanceof BaseHtml) { |
336 | - if ($elements->getIdentifier()===$identifier) |
|
337 | - return $elements; |
|
342 | + if ($elements->getIdentifier()===$identifier) { |
|
343 | + return $elements; |
|
344 | + } |
|
338 | 345 | } |
339 | 346 | return null; |
340 | 347 | } |
@@ -108,6 +108,10 @@ discard block |
||
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | |
111 | + /** |
|
112 | + * @param string $propertyName |
|
113 | + * @param string $value |
|
114 | + */ |
|
111 | 115 | protected function propertyContains($propertyName,$value){ |
112 | 116 | $values=$this->getProperty($propertyName); |
113 | 117 | if(isset($values)){ |
@@ -137,6 +141,10 @@ discard block |
||
137 | 141 | return $this; |
138 | 142 | } |
139 | 143 | |
144 | + /** |
|
145 | + * @param string $name |
|
146 | + * @param string[] $typeCtrl |
|
147 | + */ |
|
140 | 148 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
141 | 149 | if ($this->ctrl($name, $value, $typeCtrl)===true) { |
142 | 150 | if (is_array($typeCtrl)) { |
@@ -161,6 +169,9 @@ discard block |
||
161 | 169 | return $this->addToProperty($name, $value); |
162 | 170 | } |
163 | 171 | |
172 | + /** |
|
173 | + * @param string $name |
|
174 | + */ |
|
164 | 175 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
165 | 176 | // if($this->ctrl($name, $value, $typeCtrl)===true){ |
166 | 177 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
@@ -228,6 +239,9 @@ discard block |
||
228 | 239 | |
229 | 240 | } |
230 | 241 | |
242 | + /** |
|
243 | + * @param string $before |
|
244 | + */ |
|
231 | 245 | public function wrap($before, $after="") { |
232 | 246 | if(isset($before)){ |
233 | 247 | $this->wrapBefore.=$before; |
@@ -296,6 +310,9 @@ discard block |
||
296 | 310 | } |
297 | 311 | } |
298 | 312 | |
313 | + /** |
|
314 | + * @param string $operation |
|
315 | + */ |
|
299 | 316 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
300 | 317 | $params=array ( |
301 | 318 | "url" => $url, |
@@ -306,14 +323,23 @@ discard block |
||
306 | 323 | return $this; |
307 | 324 | } |
308 | 325 | |
326 | + /** |
|
327 | + * @param string $event |
|
328 | + */ |
|
309 | 329 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
310 | 330 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
311 | 331 | } |
312 | 332 | |
333 | + /** |
|
334 | + * @param string $url |
|
335 | + */ |
|
313 | 336 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
314 | 337 | return $this->getOn("click", $url, $responseElement, $parameters); |
315 | 338 | } |
316 | 339 | |
340 | + /** |
|
341 | + * @param string $event |
|
342 | + */ |
|
317 | 343 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
318 | 344 | $parameters ["params"]=$params; |
319 | 345 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -323,6 +349,9 @@ discard block |
||
323 | 349 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
324 | 350 | } |
325 | 351 | |
352 | + /** |
|
353 | + * @param string $event |
|
354 | + */ |
|
326 | 355 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
327 | 356 | $parameters ["form"]=$form; |
328 | 357 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -372,6 +401,9 @@ discard block |
||
372 | 401 | return $value; |
373 | 402 | } |
374 | 403 | |
404 | + /** |
|
405 | + * @param string $jqueryCall |
|
406 | + */ |
|
375 | 407 | public function jsDoJquery($jqueryCall, $param=""){ |
376 | 408 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
377 | 409 | } |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | abstract class BaseHtml extends BaseWidget { |
17 | 17 | protected $_template; |
18 | 18 | protected $tagName; |
19 | - protected $properties=array (); |
|
20 | - protected $events=array (); |
|
19 | + protected $properties=array(); |
|
20 | + protected $events=array(); |
|
21 | 21 | protected $wrapBefore=""; |
22 | 22 | protected $wrapAfter=""; |
23 | 23 | protected $_bsComponent; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
58 | 58 | $v=@$this->properties[$name]; |
59 | - if (isset($v)&&$v!=="") |
|
59 | + if (isset($v) && $v!=="") |
|
60 | 60 | $v=$v.$separator.$value; |
61 | 61 | else |
62 | 62 | $v=$value; |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | |
72 | 72 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
73 | 73 | $result=$this->getTemplate(); |
74 | - foreach ( $this as $key => $value ) { |
|
75 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
74 | + foreach ($this as $key => $value) { |
|
75 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
76 | 76 | if (is_array($value)) { |
77 | 77 | $v=PropertyWrapper::wrap($value, $js); |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $v=$value; |
80 | 80 | } |
81 | 81 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if (isset($view)===true) { |
88 | 88 | $controls=$view->getVar("q"); |
89 | 89 | if (isset($controls)===false) { |
90 | - $controls=array (); |
|
90 | + $controls=array(); |
|
91 | 91 | } |
92 | 92 | $controls [$this->identifier]=$result; |
93 | 93 | $view->setVar("q", $controls); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if (array_search($value, $typeCtrl)===false) { |
101 | 101 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
102 | 102 | } |
103 | - } else { |
|
103 | + }else { |
|
104 | 104 | if (!$typeCtrl($value)) { |
105 | 105 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
106 | 106 | } |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | |
111 | - protected function propertyContains($propertyName,$value){ |
|
111 | + protected function propertyContains($propertyName, $value) { |
|
112 | 112 | $values=$this->getProperty($propertyName); |
113 | - if(isset($values)){ |
|
113 | + if (isset($values)) { |
|
114 | 114 | return JString::contains($values, $value); |
115 | 115 | } |
116 | 116 | return false; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | return $this; |
138 | 138 | } |
139 | 139 | |
140 | - protected function removePropertyValue($name,$value){ |
|
140 | + protected function removePropertyValue($name, $value) { |
|
141 | 141 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
142 | 142 | } |
143 | 143 | |
@@ -189,28 +189,28 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | public function fromArray($array) { |
192 | - foreach ( $this as $key => $value ) { |
|
192 | + foreach ($this as $key => $value) { |
|
193 | 193 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
194 | 194 | $setter="set".ucfirst($key); |
195 | 195 | $this->$setter($array [$key]); |
196 | 196 | unset($array [$key]); |
197 | 197 | } |
198 | 198 | } |
199 | - foreach ( $array as $key => $value ) { |
|
199 | + foreach ($array as $key => $value) { |
|
200 | 200 | if (method_exists($this, $key)) { |
201 | 201 | try { |
202 | 202 | $this->$key($value); |
203 | 203 | unset($array [$key]); |
204 | - } catch ( \Exception $e ) { |
|
204 | + } catch (\Exception $e) { |
|
205 | 205 | // Nothing to do |
206 | 206 | } |
207 | - } else { |
|
207 | + }else { |
|
208 | 208 | $setter="set".ucfirst($key); |
209 | 209 | if (method_exists($this, $setter)) { |
210 | 210 | try { |
211 | 211 | $this->$setter($value); |
212 | 212 | unset($array [$key]); |
213 | - } catch ( \Exception $e ) { |
|
213 | + } catch (\Exception $e) { |
|
214 | 214 | // Nothing to do |
215 | 215 | } |
216 | 216 | } |
@@ -219,21 +219,21 @@ discard block |
||
219 | 219 | return $array; |
220 | 220 | } |
221 | 221 | |
222 | - public function fromDatabaseObjects($objects,$function) { |
|
223 | - if(isset($objects)){ |
|
224 | - foreach ($objects as $object){ |
|
225 | - $this->fromDatabaseObject($object,$function); |
|
222 | + public function fromDatabaseObjects($objects, $function) { |
|
223 | + if (isset($objects)) { |
|
224 | + foreach ($objects as $object) { |
|
225 | + $this->fromDatabaseObject($object, $function); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | return $this; |
229 | 229 | } |
230 | 230 | |
231 | - public function fromDatabaseObject($object,$function){ |
|
231 | + public function fromDatabaseObject($object, $function) { |
|
232 | 232 | |
233 | 233 | } |
234 | 234 | |
235 | 235 | public function wrap($before, $after="") { |
236 | - if(isset($before)){ |
|
236 | + if (isset($before)) { |
|
237 | 237 | $this->wrapBefore.=$before; |
238 | 238 | } |
239 | 239 | $this->wrapAfter=$after.$this->wrapAfter; |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | if (array_key_exists($event, $this->events)) { |
256 | 256 | if (is_array($this->events [$event])) { |
257 | 257 | $this->events [$event] []=$jsCode; |
258 | - } else { |
|
259 | - $this->events [$event]=array ( |
|
258 | + }else { |
|
259 | + $this->events [$event]=array( |
|
260 | 260 | $this->events [$event], |
261 | 261 | $jsCode |
262 | 262 | ); |
263 | 263 | } |
264 | - } else { |
|
264 | + }else { |
|
265 | 265 | $this->events [$event]=$jsCode; |
266 | 266 | } |
267 | 267 | } |
@@ -280,14 +280,14 @@ discard block |
||
280 | 280 | |
281 | 281 | public function addEventsOnRun(JsUtils $js) { |
282 | 282 | if (isset($this->_bsComponent)) { |
283 | - foreach ( $this->events as $event => $jsCode ) { |
|
283 | + foreach ($this->events as $event => $jsCode) { |
|
284 | 284 | $code=$jsCode; |
285 | 285 | if (is_array($jsCode)) { |
286 | 286 | $code=""; |
287 | - foreach ( $jsCode as $jsC ) { |
|
287 | + foreach ($jsCode as $jsC) { |
|
288 | 288 | if ($jsC instanceof AjaxCall) { |
289 | 289 | $code.="\n".$jsC->compile($js); |
290 | - } else { |
|
290 | + }else { |
|
291 | 291 | $code.="\n".$jsC; |
292 | 292 | } |
293 | 293 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | |
303 | 303 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
304 | - $params=array ( |
|
304 | + $params=array( |
|
305 | 305 | "url" => $url, |
306 | 306 | "responseElement" => $responseElement |
307 | 307 | ); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if (is_array($elements)) { |
341 | 341 | $flag=false; |
342 | 342 | $index=0; |
343 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
343 | + while (!$flag && $index<sizeof($elements)) { |
|
344 | 344 | if ($elements [$index] instanceof BaseHtml) |
345 | 345 | $flag=($elements [$index]->getIdentifier()===$identifier); |
346 | 346 | $index++; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | return null; |
355 | 355 | } |
356 | 356 | |
357 | - public function __toString(){ |
|
357 | + public function __toString() { |
|
358 | 358 | return $this->compile(); |
359 | 359 | } |
360 | 360 | |
@@ -370,25 +370,25 @@ discard block |
||
370 | 370 | if (is_array($value)) { |
371 | 371 | $value=implode(",", $value); |
372 | 372 | } |
373 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
373 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
374 | 374 | $value='"'.$value.'"'; |
375 | 375 | } |
376 | 376 | return $value; |
377 | 377 | } |
378 | 378 | |
379 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
379 | + public function jsDoJquery($jqueryCall, $param="") { |
|
380 | 380 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
381 | 381 | } |
382 | 382 | |
383 | - public function jsHtml($content=""){ |
|
384 | - return $this->jsDoJquery("html",$content); |
|
383 | + public function jsHtml($content="") { |
|
384 | + return $this->jsDoJquery("html", $content); |
|
385 | 385 | } |
386 | 386 | |
387 | - public function jsShow(){ |
|
387 | + public function jsShow() { |
|
388 | 388 | return $this->jsDoJquery("show"); |
389 | 389 | } |
390 | 390 | |
391 | - public function jsHide(){ |
|
391 | + public function jsHide() { |
|
392 | 392 | return $this->jsDoJquery("hide"); |
393 | 393 | } |
394 | 394 | } |
395 | 395 | \ No newline at end of file |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | return $this->content; |
28 | 28 | } |
29 | 29 | |
30 | - public function addContent($content,$before=false) { |
|
30 | + public function addContent($content, $before=false) { |
|
31 | 31 | if (is_array($this->content)===false) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
32 | + if (isset($this->content)) |
|
33 | + $this->content=array($this->content); |
|
34 | 34 | else |
35 | 35 | $this->content=array(); |
36 | 36 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
37 | + if ($before) |
|
38 | + array_unshift($this->content, $content); |
|
39 | 39 | else |
40 | 40 | $this->content []=$content; |
41 | 41 | return $this; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | parent::run($js); |
50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
51 | 51 | $this->content->run($js); |
52 | - } else if (is_array($this->content)) { |
|
53 | - foreach ( $this->content as $itemContent ) { |
|
52 | + }else if (is_array($this->content)) { |
|
53 | + foreach ($this->content as $itemContent) { |
|
54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
55 | 55 | $itemContent->run($js); |
56 | 56 | } |
@@ -29,15 +29,17 @@ |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (is_array($this->content)===false) { |
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 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function setClass($classNames) { |
16 | - if(is_array($classNames)){ |
|
16 | + if (is_array($classNames)) { |
|
17 | 17 | $classNames=implode(" ", $classNames); |
18 | 18 | } |
19 | 19 | $this->setProperty("class", $classNames); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function fromArray($array) { |
42 | 42 | $array=parent::fromArray($array); |
43 | - foreach ( $array as $key => $value ) { |
|
43 | + foreach ($array as $key => $value) { |
|
44 | 44 | $this->setProperty($key, $value); |
45 | 45 | } |
46 | 46 | return $array; |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\bootstrap\html\html5; |
3 | 3 | /** |
4 | - * HTML Select |
|
5 | - * @author jc |
|
6 | - * @version 1.002 |
|
7 | - */ |
|
4 | + * HTML Select |
|
5 | + * @author jc |
|
6 | + * @version 1.002 |
|
7 | + */ |
|
8 | 8 | use Ajax\bootstrap\html\base\HtmlDoubleElement; |
9 | 9 | |
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
11 | 11 | protected $value; |
12 | 12 | protected $selected; |
13 | - public function __construct($identifier,$caption,$value="") { |
|
13 | + public function __construct($identifier, $caption, $value="") { |
|
14 | 14 | parent::__construct($identifier, "option"); |
15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->selected=""; |
19 | 19 | } |
20 | 20 | |
21 | - public function select(){ |
|
21 | + public function select() { |
|
22 | 22 | $this->selected="selected"; |
23 | 23 | return $this; |
24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return $this->value; |
28 | 28 | } |
29 | 29 | public function setValue($value) { |
30 | - $this->value = $value; |
|
30 | + $this->value=$value; |
|
31 | 31 | return $this; |
32 | 32 | } |
33 | 33 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | private $default; |
17 | 17 | private $options; |
18 | 18 | |
19 | - public function __construct($identifier, $caption,$default=NULL) { |
|
19 | + public function __construct($identifier, $caption, $default=NULL) { |
|
20 | 20 | parent::__construct($identifier, "select"); |
21 | 21 | $this->setProperty("name", $identifier); |
22 | 22 | $this->setProperty("class", "form-control"); |
@@ -25,21 +25,21 @@ discard block |
||
25 | 25 | $this->options=array(); |
26 | 26 | } |
27 | 27 | |
28 | - public function addOption($element,$value="",$selected=false){ |
|
29 | - if($element instanceof HtmlOption){ |
|
28 | + public function addOption($element, $value="", $selected=false) { |
|
29 | + if ($element instanceof HtmlOption) { |
|
30 | 30 | $option=$element; |
31 | - }else{ |
|
32 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
31 | + }else { |
|
32 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
33 | 33 | } |
34 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
34 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
35 | 35 | $option->select(); |
36 | 36 | } |
37 | 37 | $this->options[]=$option; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setValue($value) { |
41 | - foreach ( $this->options as $option ) { |
|
42 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
41 | + foreach ($this->options as $option) { |
|
42 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
43 | 43 | $option->setProperty("selected", ""); |
44 | 44 | } |
45 | 45 | } |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
54 | 54 | $this->content=array(); |
55 | - if(isset($this->default)){ |
|
55 | + if (isset($this->default)) { |
|
56 | 56 | $default=new HtmlOption("", $this->default); |
57 | 57 | $this->content[]=$default; |
58 | 58 | } |
59 | - foreach ($this->options as $option){ |
|
59 | + foreach ($this->options as $option) { |
|
60 | 60 | $this->content[]=$option; |
61 | 61 | } |
62 | 62 | return parent::compile($js, $view); |
63 | 63 | } |
64 | 64 | |
65 | - public function fromArray($array){ |
|
66 | - if(JArray::isAssociative($array)){ |
|
67 | - foreach ($array as $k=>$v){ |
|
65 | + public function fromArray($array) { |
|
66 | + if (JArray::isAssociative($array)) { |
|
67 | + foreach ($array as $k=>$v) { |
|
68 | 68 | $this->addOption($v, $k); |
69 | 69 | } |
70 | - }else{ |
|
71 | - foreach ($array as $v){ |
|
70 | + }else { |
|
71 | + foreach ($array as $v) { |
|
72 | 72 | $this->addOption($v, $v); |
73 | 73 | } |
74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->addOption($function($object)); |
102 | 102 | } |
103 | 103 | |
104 | - public function setSize($size){ |
|
104 | + public function setSize($size) { |
|
105 | 105 | return $this->setProperty("size", $size); |
106 | 106 | } |
107 | 107 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function addOption($element,$value="",$selected=false){ |
29 | 29 | if($element instanceof HtmlOption){ |
30 | 30 | $option=$element; |
31 | - }else{ |
|
31 | + } else{ |
|
32 | 32 | $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
33 | 33 | } |
34 | 34 | if($selected || $option->getValue()==$this->getProperty("value")){ |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach ($array as $k=>$v){ |
68 | 68 | $this->addOption($v, $k); |
69 | 69 | } |
70 | - }else{ |
|
70 | + } else{ |
|
71 | 71 | foreach ($array as $v){ |
72 | 72 | $this->addOption($v, $v); |
73 | 73 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * Set the button value |
36 | 36 | * @param string $value |
37 | - * @return \Ajax\semantic\html\HtmlButton |
|
37 | + * @return HtmlButton |
|
38 | 38 | */ |
39 | 39 | public function setValue($value) { |
40 | 40 | $this->content=$value; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | /** |
45 | 45 | * define the button style |
46 | - * @param string|int $cssStyle |
|
47 | - * @return \Ajax\semantic\html\HtmlButton default : "" |
|
46 | + * @param string $cssStyle |
|
47 | + * @return HtmlButton default : "" |
|
48 | 48 | */ |
49 | 49 | public function setStyle($cssStyle) { |
50 | 50 | return $this->addToProperty("class",$cssStyle); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * @param string|HtmlIcon $icon |
|
90 | + * @param string $icon |
|
91 | 91 | * @return \Ajax\semantic\html\elements\HtmlButton |
92 | 92 | */ |
93 | 93 | public function asIcon($icon){ |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param string $onClick JS Code for click event |
21 | 21 | */ |
22 | 22 | public function __construct($identifier, $value="", $cssStyle=null, $onClick=null) { |
23 | - parent::__construct($identifier, "button","ui button"); |
|
23 | + parent::__construct($identifier, "button", "ui button"); |
|
24 | 24 | $this->content=$value; |
25 | 25 | if (isset($cssStyle)) { |
26 | 26 | $this->setStyle($cssStyle); |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | * @return \Ajax\semantic\html\HtmlButton default : "" |
47 | 47 | */ |
48 | 48 | public function setStyle($cssStyle) { |
49 | - return $this->addToProperty("class",$cssStyle); |
|
49 | + return $this->addToProperty("class", $cssStyle); |
|
50 | 50 | } |
51 | 51 | |
52 | - public function setFocusable(){ |
|
52 | + public function setFocusable() { |
|
53 | 53 | $this->setProperty("tabindex", "0"); |
54 | 54 | } |
55 | 55 | |
56 | - public function setAnimated($content,$animation=""){ |
|
56 | + public function setAnimated($content, $animation="") { |
|
57 | 57 | $this->setTagName("div"); |
58 | 58 | $this->addToProperty("class", "animated ".$animation); |
59 | - $visible=new HtmlSemDoubleElement("visible-".$this->identifier,"div"); |
|
59 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
60 | 60 | $visible->setClass("visible content"); |
61 | 61 | $visible->setContent($this->content); |
62 | - $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier,"div"); |
|
62 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
63 | 63 | $hidden->setClass("hidden content"); |
64 | 64 | $hidden->setContent($content); |
65 | 65 | $this->content=$visible.$hidden; |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param string|HtmlIcon $icon |
70 | 70 | * @return \Ajax\semantic\html\elements\HtmlButton |
71 | 71 | */ |
72 | - public function asIcon($icon){ |
|
72 | + public function asIcon($icon) { |
|
73 | 73 | $iconO=$icon; |
74 | - if(\is_string($icon)){ |
|
74 | + if (\is_string($icon)) { |
|
75 | 75 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
76 | 76 | } |
77 | 77 | $this->addToProperty("class", "icon"); |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | * @param string $before |
86 | 86 | * @return \Ajax\semantic\html\elements\HtmlLabel |
87 | 87 | */ |
88 | - public function addLabel($caption,$before=false){ |
|
88 | + public function addLabel($caption, $before=false) { |
|
89 | 89 | $this->tagName="div"; |
90 | 90 | $this->addToProperty("class", "labeled"); |
91 | - $this->content=new HtmlButton("button-".$this->identifier,$this->content); |
|
91 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
92 | 92 | $this->content->setTagName("div"); |
93 | - $label=new HtmlLabel("label-".$this->identifier,$caption,"a"); |
|
93 | + $label=new HtmlLabel("label-".$this->identifier, $caption, "a"); |
|
94 | 94 | $label->setBasic(); |
95 | - $this->addContent($label,$before); |
|
95 | + $this->addContent($label, $before); |
|
96 | 96 | return $label; |
97 | 97 | } |
98 | 98 | /* |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function fromArray($array) { |
103 | 103 | $array=parent::fromArray($array); |
104 | - foreach ( $array as $key => $value ) { |
|
104 | + foreach ($array as $key => $value) { |
|
105 | 105 | $this->setProperty($key, $value); |
106 | 106 | } |
107 | 107 | return $array; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * show it is currently the active user selection |
112 | 112 | * @return \Ajax\semantic\html\elements\HtmlButton |
113 | 113 | */ |
114 | - public function setActive(){ |
|
114 | + public function setActive() { |
|
115 | 115 | return $this->addToProperty("class", "active"); |
116 | 116 | } |
117 | 117 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * hint towards a positive consequence |
120 | 120 | * @return \Ajax\semantic\html\elements\HtmlButton |
121 | 121 | */ |
122 | - public function setPositive(){ |
|
122 | + public function setPositive() { |
|
123 | 123 | return $this->addToProperty("class", "positive"); |
124 | 124 | } |
125 | 125 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * hint towards a negative consequence |
128 | 128 | * @return \Ajax\semantic\html\elements\HtmlButton |
129 | 129 | */ |
130 | - public function setNegative(){ |
|
130 | + public function setNegative() { |
|
131 | 131 | return $this->addToProperty("class", "negative"); |
132 | 132 | } |
133 | 133 | |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | * formatted to toggle on/off |
136 | 136 | * @return \Ajax\semantic\html\elements\HtmlButton |
137 | 137 | */ |
138 | - public function setToggle(){ |
|
138 | + public function setToggle() { |
|
139 | 139 | return $this->addToProperty("class", "toggle"); |
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | 143 | * @return \Ajax\semantic\html\elements\HtmlButton |
144 | 144 | */ |
145 | - public function setCircular(){ |
|
145 | + public function setCircular() { |
|
146 | 146 | return $this->addToProperty("class", "circular"); |
147 | 147 | } |
148 | 148 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * button is less pronounced |
151 | 151 | * @return \Ajax\semantic\html\elements\HtmlButton |
152 | 152 | */ |
153 | - public function setBasic(){ |
|
153 | + public function setBasic() { |
|
154 | 154 | return $this->addToProperty("class", "basic"); |
155 | 155 | } |
156 | 156 | } |
157 | 157 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class HtmlImg extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$src="",$alt="") { |
|
10 | + public function __construct($identifier, $src="", $alt="") { |
|
11 | 11 | parent::__construct($identifier, "img"); |
12 | 12 | $this->setSrc($src); |
13 | 13 | $this->setAlt($alt); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $attributes; |
18 | 18 | protected $color; |
19 | 19 | |
20 | - public function __construct($identifier,$icon) { |
|
20 | + public function __construct($identifier, $icon) { |
|
21 | 21 | parent::__construct($identifier, "i"); |
22 | 22 | $this->icon=$icon; |
23 | 23 | $this->_template='<i class="%icon% icon %size% %attributes% %color%"></i>'; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
43 | 43 | */ |
44 | 44 | public function setSize($size) { |
45 | - $this->setMemberCtrl($this->size, $size,Size::getConstants()); |
|
45 | + $this->setMemberCtrl($this->size, $size, Size::getConstants()); |
|
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
49 | - public function setDisabled(){ |
|
49 | + public function setDisabled() { |
|
50 | 50 | return $this->addToMember($this->attributes, "disabled"); |
51 | 51 | } |
52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * Icon used as a simple loader |
55 | 55 | * @return \Ajax\semantic\html\HtmlIcon |
56 | 56 | */ |
57 | - public function asLoader(){ |
|
57 | + public function asLoader() { |
|
58 | 58 | return $this->addToMember($this->attributes, "loading"); |
59 | 59 | } |
60 | 60 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * An icon can be fitted, without any space to the left or right of it. |
63 | 63 | * @return \Ajax\semantic\html\HtmlIcon |
64 | 64 | */ |
65 | - public function setFitted(){ |
|
65 | + public function setFitted() { |
|
66 | 66 | return $this->addToMember($this->attributes, "fitted"); |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $sens horizontally or vertically |
71 | 71 | * @return \Ajax\semantic\html\HtmlIcon |
72 | 72 | */ |
73 | - public function setFlipped($sens="horizontally"){ |
|
73 | + public function setFlipped($sens="horizontally") { |
|
74 | 74 | return $this->addToMember($this->attributes, "flipped ".$sens); |
75 | 75 | } |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param string $sens clockwise or counterclockwise |
79 | 79 | * @return \Ajax\semantic\html\HtmlIcon |
80 | 80 | */ |
81 | - public function setRotated($sens="clockwise"){ |
|
81 | + public function setRotated($sens="clockwise") { |
|
82 | 82 | return $this->addToMember($this->attributes, "rotated ".$sens); |
83 | 83 | } |
84 | 84 | |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * icon formatted as a link |
87 | 87 | * @return \Ajax\semantic\html\HtmlIcon |
88 | 88 | */ |
89 | - public function asLink(){ |
|
89 | + public function asLink() { |
|
90 | 90 | return $this->addToMember($this->attributes, "link"); |
91 | 91 | } |
92 | 92 | |
93 | - public function setCircular($inverted=false){ |
|
93 | + public function setCircular($inverted=false) { |
|
94 | 94 | $invertedStr=""; |
95 | - if($inverted!==false) |
|
95 | + if ($inverted!==false) |
|
96 | 96 | $invertedStr=" inverted"; |
97 | 97 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
98 | 98 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * @return \Ajax\semantic\html\HtmlIcon |
102 | 102 | */ |
103 | - public function setInverted(){ |
|
103 | + public function setInverted() { |
|
104 | 104 | return $this->addToMember($this->attributes, "inverted"); |
105 | 105 | } |
106 | 106 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * @param string $inverted |
109 | 109 | * @return \Ajax\semantic\html\HtmlIcon |
110 | 110 | */ |
111 | - public function setBordered($inverted=false){ |
|
111 | + public function setBordered($inverted=false) { |
|
112 | 112 | $invertedStr=""; |
113 | - if($inverted!==false) |
|
113 | + if ($inverted!==false) |
|
114 | 114 | $invertedStr=" inverted"; |
115 | 115 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
116 | 116 | } |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | * @param string $color |
120 | 120 | * @return \Ajax\semantic\html\HtmlIcon |
121 | 121 | */ |
122 | - public function setColor($color){ |
|
122 | + public function setColor($color) { |
|
123 | 123 | return $this->setMemberCtrl($this->color, $color, Color::getConstants()); |
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @return \Ajax\semantic\html\HtmlIcon |
128 | 128 | */ |
129 | - public function toCorner(){ |
|
129 | + public function toCorner() { |
|
130 | 130 | return $this->addToMember($this->attributes, "corner"); |
131 | 131 | } |
132 | 132 | } |
133 | 133 | \ No newline at end of file |
@@ -92,8 +92,9 @@ discard block |
||
92 | 92 | |
93 | 93 | public function setCircular($inverted=false){ |
94 | 94 | $invertedStr=""; |
95 | - if($inverted!==false) |
|
96 | - $invertedStr=" inverted"; |
|
95 | + if($inverted!==false) { |
|
96 | + $invertedStr=" inverted"; |
|
97 | + } |
|
97 | 98 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
98 | 99 | } |
99 | 100 | |
@@ -110,8 +111,9 @@ discard block |
||
110 | 111 | */ |
111 | 112 | public function setBordered($inverted=false){ |
112 | 113 | $invertedStr=""; |
113 | - if($inverted!==false) |
|
114 | - $invertedStr=" inverted"; |
|
114 | + if($inverted!==false) { |
|
115 | + $invertedStr=" inverted"; |
|
116 | + } |
|
115 | 117 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
116 | 118 | } |
117 | 119 |
@@ -22,8 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | public function setAlignement($value="justified"){ |
25 | - if($value!=="justified") |
|
26 | - $value.=" aligned"; |
|
25 | + if($value!=="justified") { |
|
26 | + $value.=" aligned"; |
|
27 | + } |
|
27 | 28 | return $this->addToProperty("class", $value); |
28 | 29 | } |
29 | 30 |
@@ -12,17 +12,17 @@ |
||
12 | 12 | class HtmlContainer extends HtmlSemDoubleElement { |
13 | 13 | |
14 | 14 | public function __construct($identifier, $content="") { |
15 | - parent::__construct($identifier, "div","ui container"); |
|
15 | + parent::__construct($identifier, "div", "ui container"); |
|
16 | 16 | $this->content=$content; |
17 | 17 | } |
18 | 18 | |
19 | - public function setAlignement($value="justified"){ |
|
20 | - if($value!=="justified") |
|
19 | + public function setAlignement($value="justified") { |
|
20 | + if ($value!=="justified") |
|
21 | 21 | $value.=" aligned"; |
22 | 22 | return $this->addToProperty("class", $value); |
23 | 23 | } |
24 | 24 | |
25 | - public function setTextContainer(){ |
|
25 | + public function setTextContainer() { |
|
26 | 26 | return $this->addToProperty("class", "text"); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | \ No newline at end of file |