@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * @param string $tagName container tagName |
173 | 173 | * @return HtmlListgroup |
174 | 174 | */ |
175 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
176 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
175 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
176 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
177 | 177 | $listGroup->addItems($items); |
178 | 178 | return $this->addHtmlComponent($listGroup); |
179 | 179 | } |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | * @param string $onClick |
199 | 199 | * @return HtmlSplitbutton |
200 | 200 | */ |
201 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
202 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
201 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
202 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param string $identifier |
208 | 208 | * @return HtmlInputgroup |
209 | 209 | */ |
210 | - public function htmlInputgroup($identifier){ |
|
210 | + public function htmlInputgroup($identifier) { |
|
211 | 211 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
212 | 212 | } |
213 | 213 | |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | * @param callable $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
220 | 220 | * @return HtmlBreadcrumbs |
221 | 221 | */ |
222 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
223 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$startIndex,$hrefFunction)); |
|
222 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
223 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $startIndex, $hrefFunction)); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @param int $active The active page |
233 | 233 | * @return HtmlPagination |
234 | 234 | */ |
235 | - public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
236 | - return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
|
235 | + public function htmlPagination($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
236 | + return $this->addHtmlComponent(new HtmlPagination($identifier, $from, $to, $active, $countVisible)); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param int $numCols |
245 | 245 | * @return HtmlGridSystem |
246 | 246 | */ |
247 | - public function htmlGridSystem($identifier,$numRows=1,$numCols=NULL){ |
|
248 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows,$numCols)); |
|
247 | + public function htmlGridSystem($identifier, $numRows=1, $numCols=NULL) { |
|
248 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows, $numCols)); |
|
249 | 249 | } |
250 | 250 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | private function addFunction($jsCode) { |
17 | 17 | if (!JString::startsWith($jsCode, "function")) |
18 | - $jsCode="%function(){" . $jsCode . "}%"; |
|
18 | + $jsCode="%function(){".$jsCode."}%"; |
|
19 | 19 | return $jsCode; |
20 | 20 | } |
21 | 21 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param array $parameters default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null) |
51 | 51 | * @return DialogButton |
52 | 52 | */ |
53 | - public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay",$parameters=[]) { |
|
54 | - return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement,$parameters) . ";$( this ).dialog( 'close' );"); |
|
53 | + public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay", $parameters=[]) { |
|
54 | + return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement, $parameters).";$( this ).dialog( 'close' );"); |
|
55 | 55 | } |
56 | 56 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | trait JsUtilsActionsTrait { |
13 | 13 | |
14 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
14 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
15 | 15 | /** |
16 | 16 | * show or hide with effect |
17 | 17 | * |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param boolean $immediatly defers the execution if set to false |
23 | 23 | * @return string |
24 | 24 | */ |
25 | - protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) { |
|
25 | + protected function _showHideWithEffect($action, $element='this', $speed='', $callback='', $immediatly=false) { |
|
26 | 26 | $element=Javascript::prep_element($element); |
27 | 27 | $speed=$this->_validate_speed($speed); |
28 | 28 | if ($callback!='') { |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * @return string |
40 | 40 | */ |
41 | 41 | private function _validate_speed($speed) { |
42 | - if (in_array($speed, array ( |
|
43 | - 'slow','normal','fast' |
|
42 | + if (in_array($speed, array( |
|
43 | + 'slow', 'normal', 'fast' |
|
44 | 44 | ))) { |
45 | 45 | $speed='"'.$speed.'"'; |
46 | 46 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param string $param |
58 | 58 | * @param boolean $immediatly delayed if false |
59 | 59 | */ |
60 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
60 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
61 | 61 | $element=Javascript::prep_element($element); |
62 | 62 | if (isset($param)) { |
63 | 63 | $param=Javascript::prep_value($param); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param boolean $immediatly delayed if false |
78 | 78 | * @return string |
79 | 79 | */ |
80 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
80 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
81 | 81 | $to=Javascript::prep_element($to); |
82 | 82 | $element=Javascript::prep_element($element); |
83 | 83 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return string |
95 | 95 | */ |
96 | 96 | public function addClass($element='this', $class='', $immediatly=false) { |
97 | - return $this->_genericCallValue('addClass',$element, $class, $immediatly); |
|
97 | + return $this->_genericCallValue('addClass', $element, $class, $immediatly); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param boolean $immediatly defers the execution if set to false |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public function after($to, $element, $immediatly=false){ |
|
108 | - return $this->_genericCallElement('after',$to, $element, $immediatly); |
|
107 | + public function after($to, $element, $immediatly=false) { |
|
108 | + return $this->_genericCallElement('after', $to, $element, $immediatly); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * @param boolean $immediatly defers the execution if set to false |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public function before($to, $element, $immediatly=false){ |
|
119 | - return $this->_genericCallElement('before',$to, $element, $immediatly); |
|
118 | + public function before($to, $element, $immediatly=false) { |
|
119 | + return $this->_genericCallElement('before', $to, $element, $immediatly); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @param string $value |
145 | 145 | * @param boolean $immediatly defers the execution if set to false |
146 | 146 | */ |
147 | - public function val($element='this',$value='',$immediatly=false){ |
|
148 | - return $this->_genericCallValue('val',$element,$value,$immediatly); |
|
147 | + public function val($element='this', $value='', $immediatly=false) { |
|
148 | + return $this->_genericCallValue('val', $element, $value, $immediatly); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param boolean $immediatly defers the execution if set to false |
156 | 156 | */ |
157 | 157 | public function html($element='this', $value='', $immediatly=false) { |
158 | - return $this->_genericCallValue('html',$element, $value, $immediatly); |
|
158 | + return $this->_genericCallValue('html', $element, $value, $immediatly); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | $animations="\t\t\t"; |
176 | 176 | if (\is_array($params)) { |
177 | - foreach ( $params as $param => $value ) { |
|
177 | + foreach ($params as $param => $value) { |
|
178 | 178 | $animations.=$param.': \''.$value.'\', '; |
179 | 179 | } |
180 | 180 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string |
204 | 204 | */ |
205 | 205 | public function append($to, $element, $immediatly=false) { |
206 | - return $this->_genericCallElement('append',$to, $element, $immediatly); |
|
206 | + return $this->_genericCallElement('append', $to, $element, $immediatly); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return string |
215 | 215 | */ |
216 | 216 | public function prepend($to, $element, $immediatly=false) { |
217 | - return $this->_genericCallElement('prepend',$to, $element, $immediatly); |
|
217 | + return $this->_genericCallElement('prepend', $to, $element, $immediatly); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return string |
228 | 228 | */ |
229 | 229 | public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) { |
230 | - return $this->_showHideWithEffect("fadeIn",$element,$speed,$callback,$immediatly); |
|
230 | + return $this->_showHideWithEffect("fadeIn", $element, $speed, $callback, $immediatly); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @return string |
241 | 241 | */ |
242 | 242 | public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) { |
243 | - return $this->_showHideWithEffect("fadeOut",$element,$speed,$callback,$immediatly); |
|
243 | + return $this->_showHideWithEffect("fadeOut", $element, $speed, $callback, $immediatly); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @return string |
254 | 254 | */ |
255 | 255 | public function slideUp($element='this', $speed='', $callback='', $immediatly=false) { |
256 | - return $this->_showHideWithEffect("slideUp",$element,$speed,$callback,$immediatly); |
|
256 | + return $this->_showHideWithEffect("slideUp", $element, $speed, $callback, $immediatly); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @return string |
266 | 266 | */ |
267 | 267 | public function removeClass($element='this', $class='', $immediatly=false) { |
268 | - return $this->_genericCall('removeClass',$element, $class, $immediatly); |
|
268 | + return $this->_genericCall('removeClass', $element, $class, $immediatly); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return string |
279 | 279 | */ |
280 | 280 | public function slideDown($element='this', $speed='', $callback='', $immediatly=false) { |
281 | - return $this->_showHideWithEffect("slideDown",$element,$speed,$callback,$immediatly); |
|
281 | + return $this->_showHideWithEffect("slideDown", $element, $speed, $callback, $immediatly); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @return string |
292 | 292 | */ |
293 | 293 | public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) { |
294 | - return $this->_showHideWithEffect("slideToggle",$element,$speed,$callback,$immediatly); |
|
294 | + return $this->_showHideWithEffect("slideToggle", $element, $speed, $callback, $immediatly); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @return string |
305 | 305 | */ |
306 | 306 | public function hide($element='this', $speed='', $callback='', $immediatly=false) { |
307 | - return $this->_showHideWithEffect("hide",$element,$speed,$callback,$immediatly); |
|
307 | + return $this->_showHideWithEffect("hide", $element, $speed, $callback, $immediatly); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @return string |
318 | 318 | */ |
319 | 319 | public function toggle($element='this', $speed='', $callback='', $immediatly=false) { |
320 | - return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly); |
|
320 | + return $this->_showHideWithEffect("toggle", $element, $speed, $callback, $immediatly); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | public function toggleClass($element='this', $class='', $immediatly=false) { |
331 | - return $this->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
331 | + return $this->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @return string |
357 | 357 | */ |
358 | 358 | public function show($element='this', $speed='', $callback='', $immediatly=false) { |
359 | - return $this->_showHideWithEffect("show",$element,$speed,$callback,$immediatly); |
|
359 | + return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | */ |
369 | 369 | public function sortable($element, $options=array()) { |
370 | 370 | if (count($options)>0) { |
371 | - $sort_options=array (); |
|
372 | - foreach ( $options as $k => $v ) { |
|
371 | + $sort_options=array(); |
|
372 | + foreach ($options as $k => $v) { |
|
373 | 373 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
374 | 374 | } |
375 | 375 | $sort_options=implode(",", $sort_options); |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | * @param boolean $immediatly |
467 | 467 | * @return string |
468 | 468 | */ |
469 | - private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
470 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
469 | + private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
470 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $preventDefault=false; |
486 | 486 | $immediatly=true; |
487 | 487 | extract($parameters); |
488 | - return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
488 | + return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $preventDefault=false; |
527 | 527 | $immediatly=true; |
528 | 528 | extract($parameters); |
529 | - $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
529 | + $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
530 | 530 | return $script; |
531 | 531 | } |
532 | 532 | |
@@ -535,10 +535,10 @@ discard block |
||
535 | 535 | * @param string $element The element selector |
536 | 536 | * @param array $parameters default : array("attr"=>"id","preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true) |
537 | 537 | */ |
538 | - public function setDraggable($element,$parameters=[]){ |
|
538 | + public function setDraggable($element, $parameters=[]) { |
|
539 | 539 | $attr="id"; |
540 | 540 | extract($parameters); |
541 | - $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart",$parameters); |
|
541 | + $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart", $parameters); |
|
542 | 542 | return $script; |
543 | 543 | } |
544 | 544 | |
@@ -548,13 +548,13 @@ discard block |
||
548 | 548 | * @param array $parameters default : array("attr"=>"id","stopPropagation"=>false,"immediatly"=>true,"jqueryDone"=>"append") |
549 | 549 | * @param string $jsCallback the js script to call when element is dropped |
550 | 550 | */ |
551 | - public function asDropZone($element,$jsCallback="",$parameters=[]){ |
|
551 | + public function asDropZone($element, $jsCallback="", $parameters=[]) { |
|
552 | 552 | $stopPropagation=false; |
553 | 553 | $immediatly=true; |
554 | 554 | $jqueryDone="append"; |
555 | - $script=$this->_add_event($element, '', "dragover",true,$stopPropagation,$immediatly); |
|
555 | + $script=$this->_add_event($element, '', "dragover", true, $stopPropagation, $immediatly); |
|
556 | 556 | extract($parameters); |
557 | - $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone,$jsCallback), "drop",true,$stopPropagation,$immediatly); |
|
557 | + $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone, $jsCallback), "drop", true, $stopPropagation, $immediatly); |
|
558 | 558 | return $script; |
559 | 559 | } |
560 | 560 | } |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | * @version 1.3 |
16 | 16 | */ |
17 | 17 | abstract class BaseHtml extends BaseWidget { |
18 | - use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait; |
|
18 | + use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait; |
|
19 | 19 | protected $_template; |
20 | 20 | protected $tagName; |
21 | - protected $_wrapBefore=array (); |
|
22 | - protected $_wrapAfter=array (); |
|
21 | + protected $_wrapBefore=array(); |
|
22 | + protected $_wrapAfter=array(); |
|
23 | 23 | protected $_bsComponent; |
24 | 24 | protected $_compiled=false; |
25 | 25 | protected $_postCompile; |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | */ |
33 | 33 | abstract public function run(JsUtils $js); |
34 | 34 | |
35 | - private function _callSetter($setter,$key,$value,&$array){ |
|
35 | + private function _callSetter($setter, $key, $value, &$array) { |
|
36 | 36 | $result=false; |
37 | - if (method_exists($this, $setter) && substr($setter, 0, 1) !== "_") { |
|
37 | + if (method_exists($this, $setter) && substr($setter, 0, 1)!=="_") { |
|
38 | 38 | try { |
39 | 39 | $this->$setter($value); |
40 | 40 | unset($array[$key]); |
41 | 41 | $result=true; |
42 | - } catch ( \Exception $e ) { |
|
42 | + }catch (\Exception $e) { |
|
43 | 43 | $result=false; |
44 | 44 | } |
45 | 45 | } |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | protected function getTemplate(JsUtils $js=NULL) { |
50 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
50 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | protected function ctrl($name, $value, $typeCtrl) { |
54 | 54 | if (\is_array($typeCtrl)) { |
55 | - if (array_search($value, $typeCtrl) === false) { |
|
56 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
55 | + if (array_search($value, $typeCtrl)===false) { |
|
56 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
57 | 57 | } |
58 | 58 | } else { |
59 | 59 | if (!$typeCtrl($value)) { |
60 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
60 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | return true; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | |
68 | 68 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
69 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
69 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
70 | 70 | return $name=$value; |
71 | 71 | } |
72 | 72 | return $this; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
76 | 76 | if (\is_array($typeCtrl)) { |
77 | 77 | $this->removeOldValues($name, $typeCtrl); |
78 | - $name.=$separator . $value; |
|
78 | + $name.=$separator.$value; |
|
79 | 79 | } |
80 | 80 | return $this; |
81 | 81 | } |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | |
84 | 84 | |
85 | 85 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
86 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
86 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
87 | 87 | if (\is_array($typeCtrl)) { |
88 | 88 | $this->removeOldValues($name, $typeCtrl); |
89 | 89 | } |
90 | - $name.=$separator . $value; |
|
90 | + $name.=$separator.$value; |
|
91 | 91 | } |
92 | 92 | return $this; |
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function addToMember(&$name, $value, $separator=" ") { |
96 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
96 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
97 | 97 | return $this; |
98 | 98 | } |
99 | 99 | |
@@ -104,18 +104,18 @@ discard block |
||
104 | 104 | $oldValue=trim($oldValue); |
105 | 105 | } |
106 | 106 | |
107 | - protected function _getElementBy($callback,$elements){ |
|
107 | + protected function _getElementBy($callback, $elements) { |
|
108 | 108 | if (\is_array($elements)) { |
109 | 109 | $elements=\array_values($elements); |
110 | 110 | $flag=false; |
111 | 111 | $index=0; |
112 | - while ( !$flag && $index < sizeof($elements) ) { |
|
112 | + while (!$flag && $index<sizeof($elements)) { |
|
113 | 113 | if ($elements[$index] instanceof BaseHtml) |
114 | 114 | $flag=($callback($elements[$index])); |
115 | 115 | $index++; |
116 | 116 | } |
117 | - if ($flag === true) |
|
118 | - return $elements[$index - 1]; |
|
117 | + if ($flag===true) |
|
118 | + return $elements[$index-1]; |
|
119 | 119 | } elseif ($elements instanceof BaseHtml) { |
120 | 120 | if ($callback($elements)) |
121 | 121 | return $elements; |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | public function fromArray($array) { |
146 | - foreach ( $this as $key => $value ) { |
|
147 | - if(array_key_exists($key, $array)===true) |
|
148 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
146 | + foreach ($this as $key => $value) { |
|
147 | + if (array_key_exists($key, $array)===true) |
|
148 | + $this->_callSetter("set".ucfirst($key), $key, $array[$key], $array); |
|
149 | 149 | } |
150 | - foreach ( $array as $key => $value ) { |
|
151 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
152 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
150 | + foreach ($array as $key => $value) { |
|
151 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
152 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | return $array; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function fromDatabaseObjects($objects, $function) { |
159 | 159 | if (isset($objects)) { |
160 | - foreach ( $objects as $object ) { |
|
160 | + foreach ($objects as $object) { |
|
161 | 161 | $this->fromDatabaseObject($object, $function); |
162 | 162 | } |
163 | 163 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | |
180 | 180 | public function getElementById($identifier, $elements) { |
181 | - return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements); |
|
181 | + return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | public function getBsComponent() { |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
194 | - if(!$this->_compiled){ |
|
195 | - if(isset($js)){ |
|
194 | + if (!$this->_compiled) { |
|
195 | + if (isset($js)) { |
|
196 | 196 | $beforeCompile=$js->getParam("beforeCompileHtml"); |
197 | - if(\is_callable($beforeCompile)){ |
|
198 | - $beforeCompile($this,$js,$view); |
|
197 | + if (\is_callable($beforeCompile)) { |
|
198 | + $beforeCompile($this, $js, $view); |
|
199 | 199 | } |
200 | 200 | } |
201 | - if(\is_callable($this->_preCompile)){ |
|
201 | + if (\is_callable($this->_preCompile)) { |
|
202 | 202 | $pc=$this->_preCompile; |
203 | 203 | $pc($this); |
204 | 204 | } |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
211 | - $this->compile_once($js,$view); |
|
211 | + $this->compile_once($js, $view); |
|
212 | 212 | $result=$this->getTemplate($js); |
213 | - foreach ( $this as $key => $value ) { |
|
214 | - if(\strstr($result, "%{$key}%")!==false){ |
|
213 | + foreach ($this as $key => $value) { |
|
214 | + if (\strstr($result, "%{$key}%")!==false) { |
|
215 | 215 | if (\is_array($value)) { |
216 | 216 | $v=PropertyWrapper::wrap($value, $js); |
217 | - }elseif($value instanceof \stdClass){ |
|
218 | - $v=\print_r($value,true); |
|
219 | - }else{ |
|
217 | + }elseif ($value instanceof \stdClass) { |
|
218 | + $v=\print_r($value, true); |
|
219 | + } else { |
|
220 | 220 | $v=$value; |
221 | 221 | } |
222 | 222 | $result=str_replace("%{$key}%", $v, $result); |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | } |
225 | 225 | if (isset($js)===true) { |
226 | 226 | $this->run($js); |
227 | - if (isset($view) === true) { |
|
227 | + if (isset($view)===true) { |
|
228 | 228 | $js->addViewElement($this->_identifier, $result, $view); |
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | - if(\is_callable($this->_postCompile)){ |
|
232 | + if (\is_callable($this->_postCompile)) { |
|
233 | 233 | $pc=$this->_postCompile; |
234 | 234 | $pc($this); |
235 | 235 | } |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | * @param array $parameters default: ["jsCallback"=>"","jqueryDone"=>"append"] |
244 | 244 | * @return \Ajax\common\html\BaseHtml |
245 | 245 | */ |
246 | - public function setDraggable($attr="id",$dropZone=null,$parameters=[]){ |
|
246 | + public function setDraggable($attr="id", $dropZone=null, $parameters=[]) { |
|
247 | 247 | $this->setProperty("draggable", "true"); |
248 | - $this->addEvent("dragstart",Javascript::draggable($attr)); |
|
249 | - if(isset($dropZone)&& $dropZone instanceof BaseHtml){ |
|
250 | - $jqueryDone="append";$jsCallback=""; |
|
248 | + $this->addEvent("dragstart", Javascript::draggable($attr)); |
|
249 | + if (isset($dropZone) && $dropZone instanceof BaseHtml) { |
|
250 | + $jqueryDone="append"; $jsCallback=""; |
|
251 | 251 | extract($parameters); |
252 | - $dropZone->asDropZone($jsCallback,$jqueryDone,$parameters); |
|
252 | + $dropZone->asDropZone($jsCallback, $jqueryDone, $parameters); |
|
253 | 253 | } |
254 | 254 | return $this; |
255 | 255 | } |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | * @param array $parameters |
262 | 262 | * @return \Ajax\common\html\BaseHtml |
263 | 263 | */ |
264 | - public function asDropZone($jsCallback="",$jqueryDone="append",$parameters=[]){ |
|
264 | + public function asDropZone($jsCallback="", $jqueryDone="append", $parameters=[]) { |
|
265 | 265 | $stopPropagation=false; |
266 | - $this->addEvent("dragover", '', $stopPropagation,true); |
|
266 | + $this->addEvent("dragover", '', $stopPropagation, true); |
|
267 | 267 | extract($parameters); |
268 | - $this->addEvent("drop",Javascript::dropZone($jqueryDone,$jsCallback),$stopPropagation,true); |
|
268 | + $this->addEvent("drop", Javascript::dropZone($jqueryDone, $jsCallback), $stopPropagation, true); |
|
269 | 269 | return $this; |
270 | 270 | } |
271 | 271 | |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | return $this->compile(); |
274 | 274 | } |
275 | 275 | |
276 | - public function onPostCompile($callback){ |
|
276 | + public function onPostCompile($callback) { |
|
277 | 277 | $this->_postCompile=$callback; |
278 | 278 | } |
279 | 279 | |
280 | - public function onPreCompile($callback){ |
|
280 | + public function onPreCompile($callback) { |
|
281 | 281 | $this->_preCompile=$callback; |
282 | 282 | } |
283 | 283 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | } |
13 | 13 | $output=""; |
14 | 14 | if (\is_array($input)) { |
15 | - if (sizeof($input) > 0) { |
|
16 | - if (self::containsElement($input) === false) { |
|
15 | + if (sizeof($input)>0) { |
|
16 | + if (self::containsElement($input)===false) { |
|
17 | 17 | $output=self::wrapStrings($input, $separator=' ', $valueQuote='"'); |
18 | 18 | } else { |
19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | - foreach ( $input as $v ) { |
|
27 | + foreach ($input as $v) { |
|
28 | 28 | if (\is_object($v) || \is_array($v)) |
29 | 29 | return true; |
30 | 30 | } |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function wrapStrings($input, $separator=' ', $valueQuote='"') { |
35 | - if (JArray::isAssociative($input) === true) { |
|
36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
35 | + if (JArray::isAssociative($input)===true) { |
|
36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
38 | 38 | }, $input, array_keys($input))); |
39 | 39 | } else { |
40 | 40 | $result=implode($separator, $input); |
@@ -43,30 +43,30 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | - return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
|
47 | - if(\is_string($v)){ |
|
46 | + return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) { |
|
47 | + if (\is_string($v)) { |
|
48 | 48 | return $v; |
49 | 49 | } |
50 | - if ($v instanceof BaseHtml){ |
|
50 | + if ($v instanceof BaseHtml) { |
|
51 | 51 | return $v->compile($js); |
52 | 52 | } |
53 | 53 | if (\is_array($v)) { |
54 | 54 | return self::wrap($v, $js, $separator, $valueQuote); |
55 | 55 | } |
56 | - if(!\is_callable($v)){ |
|
56 | + if (!\is_callable($v)) { |
|
57 | 57 | return $v; |
58 | 58 | } |
59 | 59 | }, $input)); |
60 | 60 | } |
61 | 61 | |
62 | - protected static function wrapValue($value,$js=NULL, $separator=' ', $valueQuote='"'){ |
|
62 | + protected static function wrapValue($value, $js=NULL, $separator=' ', $valueQuote='"') { |
|
63 | 63 | if (\is_array($value)) { |
64 | 64 | return self::wrap($value, $js, $separator, $valueQuote); |
65 | 65 | } |
66 | - if ($value instanceof BaseHtml){ |
|
66 | + if ($value instanceof BaseHtml) { |
|
67 | 67 | return $value->compile($js); |
68 | 68 | } |
69 | - if(!\is_callable($value)){ |
|
69 | + if (!\is_callable($value)) { |
|
70 | 70 | return $value; |
71 | 71 | } |
72 | 72 | return ''; |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | * @author jc |
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
19 | +class HtmlGridRow extends HtmlSemCollection { |
|
20 | 20 | use TextAlignmentTrait; |
21 | 21 | |
22 | 22 | private $_colSize; |
23 | 23 | private $_implicite=false; |
24 | 24 | |
25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
26 | - parent::__construct( $identifier,"div","row"); |
|
25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
26 | + parent::__construct($identifier, "div", "row"); |
|
27 | 27 | $this->_implicite=$implicite; |
28 | 28 | $width=null; |
29 | - if(isset($numCols)){ |
|
30 | - $numCols=min(16,$numCols); |
|
31 | - $numCols=max(1,$numCols); |
|
32 | - if($colSizing) |
|
29 | + if (isset($numCols)) { |
|
30 | + $numCols=min(16, $numCols); |
|
31 | + $numCols=max(1, $numCols); |
|
32 | + if ($colSizing) |
|
33 | 33 | $width=(int)(16/$numCols); |
34 | 34 | else |
35 | 35 | $this->_colSize=16/$numCols; |
36 | - for ($i=0;$i<$numCols;$i++){ |
|
36 | + for ($i=0; $i<$numCols; $i++) { |
|
37 | 37 | $this->addItem($width); |
38 | 38 | } |
39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @param int $width |
45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
46 | 46 | */ |
47 | - public function setWidth($width){ |
|
48 | - if(\is_int($width)){ |
|
47 | + public function setWidth($width) { |
|
48 | + if (\is_int($width)) { |
|
49 | 49 | $width=Wide::getConstants()["W".$width]; |
50 | 50 | } |
51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param int $index |
58 | 58 | * @return HtmlGridCol |
59 | 59 | */ |
60 | - public function getCol($index){ |
|
60 | + public function getCol($index) { |
|
61 | 61 | return $this->getItem($index); |
62 | 62 | } |
63 | 63 | |
64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
65 | 65 | $this->setWidth($colsCount); |
66 | - if($toCreate===true){ |
|
66 | + if ($toCreate===true) { |
|
67 | 67 | $count=$this->count(); |
68 | - for($i=$count;$i<$colsCount;$i++){ |
|
68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
69 | 69 | $this->addItem(null); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function addCols($colCount){ |
|
76 | - for($i=0;$i<$colCount;$i++){ |
|
75 | + public function addCols($colCount) { |
|
76 | + for ($i=0; $i<$colCount; $i++) { |
|
77 | 77 | $this->addItem(null); |
78 | 78 | } |
79 | 79 | return $this; |
80 | 80 | } |
81 | 81 | |
82 | - public function addCol($width=NULL){ |
|
82 | + public function addCol($width=NULL) { |
|
83 | 83 | return $this->addItem($width); |
84 | 84 | } |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * stretch the row contents to take up the entire column height |
88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
89 | 89 | */ |
90 | - public function setStretched(){ |
|
90 | + public function setStretched() { |
|
91 | 91 | return $this->addToProperty("class", "stretched"); |
92 | 92 | } |
93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | * @param string $color |
96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
97 | 97 | */ |
98 | - public function setColor($color){ |
|
99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
98 | + public function setColor($color) { |
|
99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
100 | 100 | } |
101 | 101 | |
102 | - public function setValues($values,$force=false){ |
|
102 | + public function setValues($values, $force=false) { |
|
103 | 103 | $count=$this->count(); |
104 | 104 | $valuesSize=\sizeof($values); |
105 | - if($force===true){ |
|
106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
105 | + if ($force===true) { |
|
106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
108 | 108 | } |
109 | 109 | } |
110 | - $count=\min(array($this->count(),$valuesSize)); |
|
111 | - for($i=0;$i<$count;$i++){ |
|
110 | + $count=\min(array($this->count(), $valuesSize)); |
|
111 | + for ($i=0; $i<$count; $i++) { |
|
112 | 112 | $this->content[$i]->setValue($values[$i]); |
113 | 113 | } |
114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | * {@inheritDoc} |
119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
120 | 120 | */ |
121 | - protected function createItem($value){ |
|
122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
121 | + protected function createItem($value) { |
|
122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
123 | 123 | return $col; |
124 | 124 | } |
125 | 125 | |
126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
127 | - if($this->_implicite===true){ |
|
126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
127 | + if ($this->_implicite===true) { |
|
128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
129 | 129 | } |
130 | - return parent::compile($js,$view); |
|
130 | + return parent::compile($js, $view); |
|
131 | 131 | } |
132 | 132 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | use Ajax\semantic\html\base\constants\Side; |
11 | 11 | use Ajax\common\html\HtmlCollection; |
12 | 12 | |
13 | -class HtmlStep extends HtmlSemCollection{ |
|
13 | +class HtmlStep extends HtmlSemCollection { |
|
14 | 14 | protected $_activeStep; |
15 | 15 | protected $_startStep; |
16 | 16 | |
17 | - public function __construct( $identifier,$steps=array()){ |
|
18 | - parent::__construct( $identifier,"div", "ui steps"); |
|
17 | + public function __construct($identifier, $steps=array()) { |
|
18 | + parent::__construct($identifier, "div", "ui steps"); |
|
19 | 19 | $this->addItems($steps); |
20 | 20 | } |
21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @see HtmlCollection::createItem() |
26 | 26 | */ |
27 | 27 | protected function createItem($value) { |
28 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
28 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
29 | 29 | return $itemO; |
30 | 30 | } |
31 | 31 | |
@@ -33,50 +33,50 @@ discard block |
||
33 | 33 | * @param string|array $step |
34 | 34 | * @return HtmlStepItem |
35 | 35 | */ |
36 | - public function addStep($step){ |
|
36 | + public function addStep($step) { |
|
37 | 37 | return $this->addItem($step); |
38 | 38 | } |
39 | 39 | |
40 | - public function setOrdered(){ |
|
40 | + public function setOrdered() { |
|
41 | 41 | return $this->addToProperty("class", "ordered"); |
42 | 42 | } |
43 | 43 | |
44 | - public function isOrdered(){ |
|
44 | + public function isOrdered() { |
|
45 | 45 | return $this->propertyContains("class", "ordered"); |
46 | 46 | } |
47 | 47 | |
48 | - public function setVertical(){ |
|
48 | + public function setVertical() { |
|
49 | 49 | return $this->addToProperty("class", "vertical"); |
50 | 50 | } |
51 | 51 | |
52 | - protected function defineActiveStep(){ |
|
52 | + protected function defineActiveStep() { |
|
53 | 53 | $activestep=$this->_activeStep; |
54 | 54 | $count=$this->count(); |
55 | - if(!$this->isOrdered()){ |
|
56 | - for($i=$this->_startStep;$i<$count;$i++){ |
|
55 | + if (!$this->isOrdered()) { |
|
56 | + for ($i=$this->_startStep; $i<$count; $i++) { |
|
57 | 57 | $step=$this->content[$i]; |
58 | 58 | $step->removeStatus(); |
59 | - if($i<$activestep) |
|
59 | + if ($i<$activestep) |
|
60 | 60 | $step->setCompleted(); |
61 | 61 | elseif ($i===$activestep) |
62 | 62 | $step->setActive(); |
63 | 63 | else |
64 | 64 | $step->setDisabled(); |
65 | 65 | } |
66 | - }else{ |
|
67 | - foreach ($this->content as $step){ |
|
66 | + } else { |
|
67 | + foreach ($this->content as $step) { |
|
68 | 68 | $step->removeStatus(); |
69 | 69 | } |
70 | - if($activestep<$count) |
|
70 | + if ($activestep<$count) |
|
71 | 71 | $this->content[$activestep]->setActive(); |
72 | 72 | } |
73 | 73 | return $this; |
74 | 74 | } |
75 | 75 | |
76 | 76 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
77 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
77 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
78 | 78 | $this->defineActiveStep(); |
79 | - return parent::compile($js,$view); |
|
79 | + return parent::compile($js, $view); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function setActiveStep($_activeStep) { |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | return $this; |
85 | 85 | } |
86 | 86 | |
87 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
88 | - if(isset($toElement)){ |
|
89 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
87 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
88 | + if (isset($toElement)) { |
|
89 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
90 | 90 | } |
91 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
91 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | public function setStartStep($_startStep) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->startIndex=$startIndex; |
53 | 53 | $this->autoActive=$autoActive; |
54 | 54 | $this->_contentSeparator="<div class='divider'> / </div>"; |
55 | - $this->_hrefFunction=function (HtmlSemDoubleElement $e) { |
|
55 | + $this->_hrefFunction=function(HtmlSemDoubleElement $e) { |
|
56 | 56 | return $e->getContent(); |
57 | 57 | }; |
58 | 58 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumb |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function setActive($index=null) { |
85 | 85 | if (!isset($index)) { |
86 | - $index=sizeof($this->content) - 1; |
|
86 | + $index=sizeof($this->content)-1; |
|
87 | 87 | } |
88 | 88 | $activeItem=$this->content[$index]; |
89 | 89 | $activeItem->addToProperty("class", "active"); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param object $dispatcher the request dispatcher |
97 | 97 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
98 | 98 | */ |
99 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
99 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
100 | 100 | return $this->addItems($js->fromDispatcher($dispatcher)); |
101 | 101 | } |
102 | 102 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | if (!isset($index)) { |
111 | 111 | $index=sizeof($this->content); |
112 | 112 | } |
113 | - if ($this->absolutePaths === true) { |
|
113 | + if ($this->absolutePaths===true) { |
|
114 | 114 | return $this->_hrefFunction($this->content[$index]); |
115 | 115 | } else { |
116 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
116 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
117 | 117 | return $this->_hrefFunction($e); |
118 | - }, $this->content), $this->startIndex, $index + 1)); |
|
118 | + }, $this->content), $this->startIndex, $index+1)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | $this->setActive(); |
150 | 150 | } |
151 | 151 | $count=$this->count(); |
152 | - for($i=1; $i < $count; $i++) { |
|
153 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
152 | + for ($i=1; $i<$count; $i++) { |
|
153 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
154 | 154 | } |
155 | 155 | return parent::compile($js, $view); |
156 | 156 | } |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
161 | 161 | */ |
162 | 162 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
163 | - foreach ( $this->content as $element ) { |
|
163 | + foreach ($this->content as $element) { |
|
164 | 164 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
165 | 165 | } |
166 | 166 | return $this; |
167 | 167 | } |
168 | 168 | |
169 | 169 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
170 | - foreach ( $this->content as $element ) { |
|
171 | - if ($element->getProperty($this->attr) != NULL){ |
|
170 | + foreach ($this->content as $element) { |
|
171 | + if ($element->getProperty($this->attr)!=NULL) { |
|
172 | 172 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
173 | 173 | } |
174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | protected function createItem($value) { |
185 | 185 | $count=$this->count(); |
186 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
186 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
187 | 187 | if (\is_array($value)) |
188 | 188 | $itemO->fromArray($value); |
189 | 189 | else { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function addIconAt($icon, $index) { |
196 | 196 | $item=$this->getItem($index); |
197 | 197 | if (isset($item)) { |
198 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
198 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
199 | 199 | $item->wrapContent($icon); |
200 | 200 | } |
201 | 201 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | public function addItem($item) { |
204 | 204 | $count=$this->count(); |
205 | 205 | $itemO=parent::addItem($item); |
206 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
206 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
207 | 207 | $itemO->setProperty($this->attr, $this->getHref($count)); |
208 | 208 | return $itemO; |
209 | 209 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | public function setAbsolutePaths($absolutePaths) { |
220 | 220 | $this->absolutePaths=$absolutePaths; |
221 | 221 | $size=\sizeof($this->content); |
222 | - for($i=0;$i<$size;$i++){ |
|
222 | + for ($i=0; $i<$size; $i++) { |
|
223 | 223 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
224 | 224 | } |
225 | 225 | return $this; |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\common\html\HtmlCollection; |
8 | 8 | |
9 | -class HtmlAccordionMenu extends HtmlMenu{ |
|
9 | +class HtmlAccordionMenu extends HtmlMenu { |
|
10 | 10 | protected $params=array(); |
11 | 11 | |
12 | - public function __construct( $identifier, $items=array() ){ |
|
13 | - parent::__construct( $identifier, $items); |
|
12 | + public function __construct($identifier, $items=array()) { |
|
13 | + parent::__construct($identifier, $items); |
|
14 | 14 | $this->addToProperty("class", "accordion"); |
15 | 15 | $this->setVertical(); |
16 | 16 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | protected function createItem($value) { |
23 | 23 | $title=$value; |
24 | 24 | $content=""; |
25 | - if(\is_array($value)){ |
|
26 | - $title=@$value[0];$content=@$value[1]; |
|
25 | + if (\is_array($value)) { |
|
26 | + $title=@$value[0]; $content=@$value[1]; |
|
27 | 27 | } |
28 | 28 | $itemO=new HtmlAccordionMenuItem("item-".$this->identifier."-".$this->count(), $title, $content); |
29 | 29 | return $itemO->setClass("item"); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @see BaseHtml::run() |
35 | 35 | */ |
36 | 36 | public function run(JsUtils $js) { |
37 | - if(isset($this->_bsComponent)===false) |
|
38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
37 | + if (isset($this->_bsComponent)===false) |
|
38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
39 | 39 | $this->addEventsOnRun($js); |
40 | 40 | return $this->_bsComponent; |
41 | 41 | } |
42 | 42 | |
43 | - public function setExclusive($value){ |
|
43 | + public function setExclusive($value) { |
|
44 | 44 | $this->params["exclusive"]=$value; |
45 | 45 | } |
46 | 46 | } |