@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | $this->parameters["immediatly"]=false; |
24 | 24 | extract($this->parameters); |
25 | 25 | $result=$this->_eventPreparing($preventDefault, $stopPropagation); |
26 | - switch($this->method) { |
|
26 | + switch ($this->method) { |
|
27 | 27 | case "get": |
28 | 28 | $result.=$js->getDeferred($url, $responseElement, $this->parameters); |
29 | 29 | break; |
30 | 30 | case "post": |
31 | - $result.=$js->postDeferred($url, $params,$responseElement, $this->parameters); |
|
31 | + $result.=$js->postDeferred($url, $params, $responseElement, $this->parameters); |
|
32 | 32 | break; |
33 | 33 | case "postForm": |
34 | 34 | $result.=$js->postFormDeferred($url, $form, $responseElement, $this->parameters); |
35 | 35 | break; |
36 | 36 | case "json": |
37 | - $result.=$js->jsonDeferred($url,$method,$this->parameters); |
|
37 | + $result.=$js->jsonDeferred($url, $method, $this->parameters); |
|
38 | 38 | break; |
39 | 39 | case "jsonArray": |
40 | - $result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$this->parameters); |
|
40 | + $result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters); |
|
41 | 41 | break; |
42 | 42 | default: |
43 | 43 | break; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $result; |
46 | 46 | } |
47 | 47 | |
48 | - protected function _eventPreparing($preventDefault,$stopPropagation){ |
|
48 | + protected function _eventPreparing($preventDefault, $stopPropagation) { |
|
49 | 49 | $result=""; |
50 | 50 | if ($preventDefault===true) { |
51 | 51 | $result.=Javascript::$preventDefault; |
@@ -3,11 +3,11 @@ |
||
3 | 3 | namespace Ajax\common\html\html5; |
4 | 4 | |
5 | 5 | class HtmlUtils { |
6 | - public static function javascriptInclude($url){ |
|
6 | + public static function javascriptInclude($url) { |
|
7 | 7 | return '<script src="'.$url.'"></script>'; |
8 | 8 | } |
9 | 9 | |
10 | - public static function stylesheetInclude($url){ |
|
10 | + public static function stylesheetInclude($url) { |
|
11 | 11 | return '<link rel="stylesheet" type="text/css" href="'.$url.'">'; |
12 | 12 | } |
13 | 13 | } |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | * @author jc |
9 | 9 | * @property BaseWidget $_self |
10 | 10 | */ |
11 | -trait BaseHtmlPropertiesTrait{ |
|
11 | +trait BaseHtmlPropertiesTrait { |
|
12 | 12 | |
13 | - protected $properties=array (); |
|
13 | + protected $properties=array(); |
|
14 | 14 | abstract protected function ctrl($name, $value, $typeCtrl); |
15 | 15 | abstract protected function removeOldValues(&$oldValue, $allValues); |
16 | - abstract protected function _getElementBy($callback,$elements); |
|
16 | + abstract protected function _getElementBy($callback, $elements); |
|
17 | 17 | public function getProperties() { |
18 | 18 | return $this->_self->properties; |
19 | 19 | } |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function addToProperty($name, $value, $separator=" ") { |
47 | 47 | if (\is_array($value)) { |
48 | - foreach ( $value as $v ) { |
|
48 | + foreach ($value as $v) { |
|
49 | 49 | $this->_self->addToProperty($name, $v, $separator); |
50 | 50 | } |
51 | - } else if ($value !== "" && $this->_self->propertyContains($name, $value) === false) { |
|
52 | - if(isset($this->_self->properties[$name])){ |
|
51 | + } else if ($value!=="" && $this->_self->propertyContains($name, $value)===false) { |
|
52 | + if (isset($this->_self->properties[$name])) { |
|
53 | 53 | $v=$this->_self->properties[$name]; |
54 | - if (isset($v) && $v !== "") |
|
55 | - $v=$v . $separator . $value; |
|
54 | + if (isset($v) && $v!=="") |
|
55 | + $v=$v.$separator.$value; |
|
56 | 56 | else |
57 | 57 | $v=$value; |
58 | 58 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
94 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) { |
|
94 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) { |
|
95 | 95 | return $this->_self->addToProperty($name, $value); |
96 | 96 | } |
97 | 97 | return $this; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
115 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) |
|
115 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) |
|
116 | 116 | return $this->_self->setProperty($name, $value); |
117 | 117 | return $this; |
118 | 118 | } |
119 | 119 | |
120 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
121 | - return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements); |
|
120 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
121 | + return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements); |
|
122 | 122 | } |
123 | 123 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function __construct($identifier, $brand="Brand", $brandHref="#") { |
33 | 33 | parent::__construct($identifier); |
34 | 34 | $this->_template=include 'templates/tplNavbar.php'; |
35 | - $this->navZones=array (); |
|
35 | + $this->navZones=array(); |
|
36 | 36 | $this->class="navbar-default"; |
37 | 37 | $this->brand=$brand; |
38 | 38 | $this->brandHref=$brandHref; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | public function setBrandImage($imageSrc) { |
63 | - $this->brandImage=new HtmlImg("brand-img-".$this->_identifier,$imageSrc,$this->brand); |
|
63 | + $this->brandImage=new HtmlImg("brand-img-".$this->_identifier, $imageSrc, $this->brand); |
|
64 | 64 | $this->brand=""; |
65 | 65 | return $this; |
66 | 66 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | public function setNavZones($navZones) { |
106 | 106 | if (\is_array($navZones)) { |
107 | - foreach ( $navZones as $zoneType => $zoneArray ) { |
|
107 | + foreach ($navZones as $zoneType => $zoneArray) { |
|
108 | 108 | if (is_string($zoneType)) { |
109 | 109 | $zone=$this->addZone($zoneType); |
110 | 110 | $zone->fromArray($zoneArray); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | if ($index<$nb) |
145 | 145 | $zone=$this->navZones [$index]; |
146 | 146 | } else { |
147 | - for($i=0; $i<$nb; $i++) { |
|
147 | + for ($i=0; $i<$nb; $i++) { |
|
148 | 148 | if ($this->navZones [$i]->getIdentifier()===$index) { |
149 | 149 | $zone=$this->navZones [$i]; |
150 | 150 | break; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function run(JsUtils $js) { |
158 | - foreach ( $this->navZones as $zone ) { |
|
158 | + foreach ($this->navZones as $zone) { |
|
159 | 159 | $zone->run($js); |
160 | 160 | } |
161 | 161 | if ($this->hasScrollspy) { |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | public function setFluid($fluid) { |
180 | - if($fluid===true){ |
|
180 | + if ($fluid===true) { |
|
181 | 181 | $this->fluid="container-fluid"; |
182 | - }else{ |
|
182 | + } else { |
|
183 | 183 | $this->fluid="container"; |
184 | 184 | } |
185 | 185 | return $this; |
@@ -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->_genericCallValue('removeClass',$element, $class, $immediatly); |
|
268 | + return $this->_genericCallValue('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 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return string |
330 | 330 | */ |
331 | 331 | public function toggleClass($element='this', $class='', $immediatly=false) { |
332 | - return $this->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
332 | + return $this->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * @return string |
358 | 358 | */ |
359 | 359 | public function show($element='this', $speed='', $callback='', $immediatly=false) { |
360 | - return $this->_showHideWithEffect("show",$element,$speed,$callback,$immediatly); |
|
360 | + return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | */ |
370 | 370 | public function sortable($element, $options=array()) { |
371 | 371 | if (count($options)>0) { |
372 | - $sort_options=array (); |
|
373 | - foreach ( $options as $k => $v ) { |
|
372 | + $sort_options=array(); |
|
373 | + foreach ($options as $k => $v) { |
|
374 | 374 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
375 | 375 | } |
376 | 376 | $sort_options=implode(",", $sort_options); |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | * @param boolean $immediatly |
468 | 468 | * @return string |
469 | 469 | */ |
470 | - private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
471 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
470 | + private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
471 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $preventDefault=false; |
487 | 487 | $immediatly=true; |
488 | 488 | extract($parameters); |
489 | - return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
489 | + return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $preventDefault=false; |
528 | 528 | $immediatly=true; |
529 | 529 | extract($parameters); |
530 | - $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
530 | + $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
531 | 531 | return $script; |
532 | 532 | } |
533 | 533 | |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | * @param string $element The element selector |
537 | 537 | * @param array $parameters default : array("attr"=>"id","preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true) |
538 | 538 | */ |
539 | - public function setDraggable($element,$parameters=[]){ |
|
539 | + public function setDraggable($element, $parameters=[]) { |
|
540 | 540 | $attr="id"; |
541 | 541 | extract($parameters); |
542 | - $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart",$parameters); |
|
542 | + $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart", $parameters); |
|
543 | 543 | return $script; |
544 | 544 | } |
545 | 545 | |
@@ -549,13 +549,13 @@ discard block |
||
549 | 549 | * @param array $parameters default : array("attr"=>"id","stopPropagation"=>false,"immediatly"=>true,"jqueryDone"=>"append") |
550 | 550 | * @param string $jsCallback the js script to call when element is dropped |
551 | 551 | */ |
552 | - public function asDropZone($element,$jsCallback="",$parameters=[]){ |
|
552 | + public function asDropZone($element, $jsCallback="", $parameters=[]) { |
|
553 | 553 | $stopPropagation=false; |
554 | 554 | $immediatly=true; |
555 | 555 | $jqueryDone="append"; |
556 | - $script=$this->_add_event($element, '', "dragover",true,$stopPropagation,$immediatly); |
|
556 | + $script=$this->_add_event($element, '', "dragover", true, $stopPropagation, $immediatly); |
|
557 | 557 | extract($parameters); |
558 | - $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone,$jsCallback), "drop",true,$stopPropagation,$immediatly); |
|
558 | + $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone, $jsCallback), "drop", true, $stopPropagation, $immediatly); |
|
559 | 559 | return $script; |
560 | 560 | } |
561 | 561 | } |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct($identifier) { |
22 | 22 | parent::__construct($identifier, "tr", ""); |
23 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
23 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function setColCount($colCount) { |
27 | 27 | $count=$this->count(); |
28 | - for($i=$count; $i < $colCount; $i++) { |
|
28 | + for ($i=$count; $i<$colCount; $i++) { |
|
29 | 29 | $item=$this->addItem(NULL); |
30 | 30 | $item->setTagName($this->_tdTagName); |
31 | 31 | } |
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | - public function getColCount(){ |
|
35 | + public function getColCount() { |
|
36 | 36 | return $this->count(); |
37 | 37 | } |
38 | 38 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return HtmlTD |
54 | 54 | */ |
55 | - public function getItem($index){ |
|
55 | + public function getItem($index) { |
|
56 | 56 | return parent::getItem($index); |
57 | 57 | } |
58 | 58 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param mixed $values |
76 | 76 | */ |
77 | 77 | public function setValues($values=array()) { |
78 | - return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);}); |
|
78 | + return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->setValue($value); }); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -83,27 +83,27 @@ discard block |
||
83 | 83 | * @param mixed $values |
84 | 84 | */ |
85 | 85 | public function addValues($values=array()) { |
86 | - return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->addValue($value);}); |
|
86 | + return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->addValue($value); }); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Sets or adds values to the row cols |
91 | 91 | * @param mixed $values |
92 | 92 | */ |
93 | - protected function _addOrSetValues($values,$callback) { |
|
93 | + protected function _addOrSetValues($values, $callback) { |
|
94 | 94 | $count=$this->count(); |
95 | 95 | if (!\is_array($values)) { |
96 | 96 | $values=\array_fill(0, $count, $values); |
97 | 97 | } else { |
98 | - if (JArray::isAssociative($values) === true) { |
|
98 | + if (JArray::isAssociative($values)===true) { |
|
99 | 99 | $values=\array_values($values); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | $count=\min(\sizeof($values), $count); |
103 | 103 | |
104 | - for($i=0; $i < $count; $i++) { |
|
104 | + for ($i=0; $i<$count; $i++) { |
|
105 | 105 | $cell=$this->content[$i]; |
106 | - $callback($cell,$values[$i]); |
|
106 | + $callback($cell, $values[$i]); |
|
107 | 107 | } |
108 | 108 | return $this; |
109 | 109 | } |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | public function getColPosition($colIndex) { |
130 | - if($this->_container->_isMerged()!==true) |
|
130 | + if ($this->_container->_isMerged()!==true) |
|
131 | 131 | return $colIndex; |
132 | 132 | $pos=0; |
133 | 133 | $rows=$this->_container->getContent(); |
134 | - for($i=0; $i < $this->_row; $i++) { |
|
134 | + for ($i=0; $i<$this->_row; $i++) { |
|
135 | 135 | $max=\min($colIndex, $rows[$i]->count()); |
136 | - for($j=0; $j < $max; $j++) { |
|
136 | + for ($j=0; $j<$max; $j++) { |
|
137 | 137 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
138 | - if ($rowspan + $i > $this->_row) |
|
138 | + if ($rowspan+$i>$this->_row) |
|
139 | 139 | $pos++; |
140 | 140 | } |
141 | 141 | } |
142 | - if ($pos > $colIndex) |
|
142 | + if ($pos>$colIndex) |
|
143 | 143 | return NULL; |
144 | 144 | $count=$this->count(); |
145 | - for($i=0; $i < $count; $i++) { |
|
145 | + for ($i=0; $i<$count; $i++) { |
|
146 | 146 | $pos+=$this->content[$i]->getColspan(); |
147 | - if ($pos >= $colIndex + 1) |
|
147 | + if ($pos>=$colIndex+1) |
|
148 | 148 | return $i; |
149 | 149 | } |
150 | 150 | return null; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | public function conditionalCellFormat($callback, $format) { |
154 | 154 | $cells=$this->content; |
155 | - foreach ( $cells as $cell ) { |
|
155 | + foreach ($cells as $cell) { |
|
156 | 156 | $cell->conditionalCellFormat($callback, $format); |
157 | 157 | } |
158 | 158 | return $this; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | |
168 | 168 | public function containsStr($needle) { |
169 | 169 | $cells=$this->content; |
170 | - foreach ( $cells as $cell ) { |
|
171 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
170 | + foreach ($cells as $cell) { |
|
171 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
172 | 172 | return true; |
173 | 173 | } |
174 | 174 | return false; |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | |
182 | 182 | public function applyCells($callback) { |
183 | 183 | $cells=$this->content; |
184 | - foreach ( $cells as $cell ) { |
|
184 | + foreach ($cells as $cell) { |
|
185 | 185 | $cell->apply($callback); |
186 | 186 | } |
187 | 187 | return $this; |
188 | 188 | } |
189 | 189 | |
190 | - public function toDelete($colIndex){ |
|
190 | + public function toDelete($colIndex) { |
|
191 | 191 | $this->getItem($colIndex)->toDelete(); |
192 | 192 | return $this; |
193 | 193 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | */ |
15 | 15 | class HtmlTableContent extends HtmlSemCollection { |
16 | - protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ]; |
|
16 | + protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"]; |
|
17 | 17 | protected $_merged=false; |
18 | 18 | |
19 | 19 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function setRowCount($rowCount, $colCount) { |
39 | 39 | $count=$this->count(); |
40 | - for($i=$count; $i < $rowCount; $i++) { |
|
40 | + for ($i=$count; $i<$rowCount; $i++) { |
|
41 | 41 | $this->addItem($colCount); |
42 | 42 | } |
43 | 43 | return $this; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $tr=new HtmlTR(""); |
60 | 60 | $tr->setContainer($this, $count); |
61 | 61 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
62 | - if (isset($value) === true) { |
|
62 | + if (isset($value)===true) { |
|
63 | 63 | $tr->setColCount($value); |
64 | 64 | } |
65 | 65 | return $tr; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @return HtmlTR |
90 | 90 | */ |
91 | - public function getItem($index){ |
|
91 | + public function getItem($index) { |
|
92 | 92 | return parent::getItem($index); |
93 | 93 | } |
94 | 94 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $row=$this->getItem($row); |
103 | 103 | if (isset($row) && $row instanceof HtmlCollection) { |
104 | 104 | $col=$row->getItem($col); |
105 | - }else{ |
|
105 | + } else { |
|
106 | 106 | $col=$row; |
107 | 107 | } |
108 | 108 | return $col; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function setCellValue($row, $col, $value="") { |
128 | 128 | $cell=$this->getCell($row, $col); |
129 | - if (isset($cell) === true) { |
|
129 | + if (isset($cell)===true) { |
|
130 | 130 | $cell->setValue($value); |
131 | 131 | } |
132 | 132 | return $this; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param mixed $values |
138 | 138 | */ |
139 | 139 | public function setValues($values=array()) { |
140 | - return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);}); |
|
140 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->setValues($_values); }); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param mixed $values |
146 | 146 | */ |
147 | 147 | public function addValues($values=array()) { |
148 | - return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);}); |
|
148 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->addValues($_values); }); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -153,21 +153,21 @@ discard block |
||
153 | 153 | * @param mixed $values |
154 | 154 | * @param callable $callback |
155 | 155 | */ |
156 | - protected function _addOrSetValues($values,$callback) { |
|
156 | + protected function _addOrSetValues($values, $callback) { |
|
157 | 157 | $count=$this->count(); |
158 | 158 | $isArray=true; |
159 | 159 | if (!\is_array($values)) { |
160 | 160 | $values=\array_fill(0, $count, $values); |
161 | 161 | $isArray=false; |
162 | 162 | } |
163 | - if (JArray::dimension($values) == 1 && $isArray) |
|
164 | - $values=[ $values ]; |
|
163 | + if (JArray::dimension($values)==1 && $isArray) |
|
164 | + $values=[$values]; |
|
165 | 165 | |
166 | 166 | $count=\min(\sizeof($values), $count); |
167 | 167 | |
168 | - for($i=0; $i < $count; $i++) { |
|
168 | + for ($i=0; $i<$count; $i++) { |
|
169 | 169 | $row=$this->content[$i]; |
170 | - $callback($row,$values[$i]); |
|
170 | + $callback($row, $values[$i]); |
|
171 | 171 | } |
172 | 172 | return $this; |
173 | 173 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $values=\array_fill(0, $count, $values); |
179 | 179 | } |
180 | 180 | $count=\min(\sizeof($values), $count); |
181 | - for($i=0; $i < $count; $i++) { |
|
181 | + for ($i=0; $i<$count; $i++) { |
|
182 | 182 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
183 | 183 | } |
184 | 184 | return $this; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | public function addColVariations($colIndex, $variations=array()) { |
188 | 188 | $count=$this->count(); |
189 | - for($i=0; $i < $count; $i++) { |
|
189 | + for ($i=0; $i<$count; $i++) { |
|
190 | 190 | $this->getCell($i, $colIndex)->addVariations($variations); |
191 | 191 | } |
192 | 192 | return $this; |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | |
204 | 204 | private function colAlign($colIndex, $function) { |
205 | 205 | $count=$this->count(); |
206 | - for($i=0; $i < $count; $i++) { |
|
206 | + for ($i=0; $i<$count; $i++) { |
|
207 | 207 | $index=$this->content[$i]->getColPosition($colIndex); |
208 | - if ($index !== NULL) |
|
208 | + if ($index!==NULL) |
|
209 | 209 | $this->getCell($i, $index)->$function(); |
210 | 210 | } |
211 | 211 | return $this; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function getColCount() { |
239 | 239 | $result=0; |
240 | - if ($this->count() > 0) |
|
240 | + if ($this->count()>0) |
|
241 | 241 | $result=$this->getItem(0)->count(); |
242 | 242 | return $result; |
243 | 243 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | public function delete($rowIndex, $colIndex=NULL) { |
252 | 252 | if (isset($colIndex)) { |
253 | 253 | $row=$this->getItem($rowIndex); |
254 | - if (isset($row) === true) { |
|
254 | + if (isset($row)===true) { |
|
255 | 255 | $row->delete($colIndex); |
256 | 256 | } |
257 | 257 | } else { |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | return $this; |
261 | 261 | } |
262 | 262 | |
263 | - public function toDelete($rowIndex, $colIndex){ |
|
263 | + public function toDelete($rowIndex, $colIndex) { |
|
264 | 264 | $row=$this->getItem($rowIndex); |
265 | - if (isset($row) === true) |
|
265 | + if (isset($row)===true) |
|
266 | 266 | $row->toDelete($colIndex); |
267 | 267 | return $this; |
268 | 268 | } |
@@ -291,17 +291,17 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function conditionalCellFormat($callback, $format) { |
293 | 293 | $rows=$this->content; |
294 | - foreach ( $rows as $row ) { |
|
294 | + foreach ($rows as $row) { |
|
295 | 295 | $row->conditionalCellFormat($callback, $format); |
296 | 296 | } |
297 | 297 | return $this; |
298 | 298 | } |
299 | 299 | |
300 | - public function conditionalColFormat($colIndex,$callback,$format){ |
|
300 | + public function conditionalColFormat($colIndex, $callback, $format) { |
|
301 | 301 | $rows=$this->content; |
302 | - foreach ( $rows as $row ) { |
|
302 | + foreach ($rows as $row) { |
|
303 | 303 | $cell=$row->getItem($colIndex); |
304 | - $cell->conditionnalCellFormat($callback,$format); |
|
304 | + $cell->conditionnalCellFormat($callback, $format); |
|
305 | 305 | } |
306 | 306 | return $this; |
307 | 307 | } |
@@ -313,17 +313,17 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function conditionalRowFormat($callback, $format) { |
315 | 315 | $rows=$this->content; |
316 | - foreach ( $rows as $row ) { |
|
316 | + foreach ($rows as $row) { |
|
317 | 317 | $row->conditionalRowFormat($callback, $format); |
318 | 318 | } |
319 | 319 | return $this; |
320 | 320 | } |
321 | 321 | |
322 | - public function hideColumn($colIndex){ |
|
322 | + public function hideColumn($colIndex) { |
|
323 | 323 | $rows=$this->content; |
324 | - foreach ( $rows as $row ) { |
|
324 | + foreach ($rows as $row) { |
|
325 | 325 | $cell=$row->getItem($colIndex); |
326 | - $cell->addToProperty("style","display:none;"); |
|
326 | + $cell->addToProperty("style", "display:none;"); |
|
327 | 327 | } |
328 | 328 | return $this; |
329 | 329 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function applyCells($callback) { |
336 | 336 | $rows=$this->content; |
337 | - foreach ( $rows as $row ) { |
|
337 | + foreach ($rows as $row) { |
|
338 | 338 | $row->applyCells($callback); |
339 | 339 | } |
340 | 340 | return $this; |
@@ -346,25 +346,25 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function applyRows($callback) { |
348 | 348 | $rows=$this->content; |
349 | - foreach ( $rows as $row ) { |
|
349 | + foreach ($rows as $row) { |
|
350 | 350 | $row->apply($callback); |
351 | 351 | } |
352 | 352 | return $this; |
353 | 353 | } |
354 | 354 | |
355 | - public function mergeIdentiqualValues($colIndex,$function="strip_tags"){ |
|
355 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
356 | 356 | $rows=$this->content; |
357 | 357 | $identiqual=null; |
358 | 358 | $counter=0; |
359 | 359 | $cellToMerge=null; |
360 | 360 | $functionExists=\function_exists($function); |
361 | - foreach ( $rows as $row ) { |
|
361 | + foreach ($rows as $row) { |
|
362 | 362 | $cell=$row->getItem($colIndex); |
363 | 363 | $value=$cell->getContent(); |
364 | - if($functionExists) |
|
365 | - $value=\call_user_func($function,$value); |
|
366 | - if($value!==$identiqual){ |
|
367 | - if($counter>0 && isset($cellToMerge)){ |
|
364 | + if ($functionExists) |
|
365 | + $value=\call_user_func($function, $value); |
|
366 | + if ($value!==$identiqual) { |
|
367 | + if ($counter>0 && isset($cellToMerge)) { |
|
368 | 368 | $cellToMerge->setRowspan($counter); |
369 | 369 | } |
370 | 370 | $counter=0; |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | } |
374 | 374 | $counter++; |
375 | 375 | } |
376 | - if($counter>0 && isset($cellToMerge)){ |
|
376 | + if ($counter>0 && isset($cellToMerge)) { |
|
377 | 377 | $cellToMerge->setRowspan($counter); |
378 | 378 | } |
379 | 379 | return $this; |
380 | 380 | } |
381 | 381 | |
382 | - public function _isMerged(){ |
|
382 | + public function _isMerged() { |
|
383 | 383 | return $this->_merged; |
384 | 384 | } |
385 | 385 | |
386 | - public function _setMerged($value){ |
|
386 | + public function _setMerged($value) { |
|
387 | 387 | $this->_merged=$value; |
388 | 388 | return $this; |
389 | 389 | } |
@@ -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 HtmlBreadcrumb |
98 | 98 | */ |
99 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
99 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
100 | 100 | $this->startIndex=$startIndex; |
101 | 101 | return $this->addItems($js->fromDispatcher($dispatcher)); |
102 | 102 | } |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | if (!isset($index)) { |
112 | 112 | $index=sizeof($this->content); |
113 | 113 | } |
114 | - if ($this->absolutePaths === true) { |
|
114 | + if ($this->absolutePaths===true) { |
|
115 | 115 | return $this->_hrefFunction($this->content[$index]); |
116 | 116 | } else { |
117 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
117 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
118 | 118 | return $this->_hrefFunction($e); |
119 | - }, $this->content), $this->startIndex, $index + 1)); |
|
119 | + }, $this->content), $this->startIndex, $index+1)); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | $this->setActive(); |
151 | 151 | } |
152 | 152 | $count=$this->count(); |
153 | - for($i=1; $i < $count; $i++) { |
|
154 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
153 | + for ($i=1; $i<$count; $i++) { |
|
154 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
155 | 155 | } |
156 | 156 | return parent::compile($js, $view); |
157 | 157 | } |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
162 | 162 | */ |
163 | 163 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
164 | - foreach ( $this->content as $element ) { |
|
164 | + foreach ($this->content as $element) { |
|
165 | 165 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
166 | 166 | } |
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
170 | 170 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
171 | - foreach ( $this->content as $element ) { |
|
172 | - if ($element->getProperty($this->attr) != NULL){ |
|
171 | + foreach ($this->content as $element) { |
|
172 | + if ($element->getProperty($this->attr)!=NULL) { |
|
173 | 173 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
174 | 174 | } |
175 | 175 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function createItem($value) { |
186 | 186 | $count=$this->count(); |
187 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
187 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
188 | 188 | if (\is_array($value)) |
189 | 189 | $itemO->fromArray($value); |
190 | 190 | else { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function addIconAt($icon, $index) { |
197 | 197 | $item=$this->getItem($index); |
198 | 198 | if (isset($item)) { |
199 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
199 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
200 | 200 | $item->wrapContent($icon); |
201 | 201 | } |
202 | 202 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | public function addItem($item) { |
205 | 205 | $count=$this->count(); |
206 | 206 | $itemO=parent::addItem($item); |
207 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
207 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
208 | 208 | $itemO->setProperty($this->attr, $this->getHref($count)); |
209 | 209 | return $itemO; |
210 | 210 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | public function setAbsolutePaths($absolutePaths) { |
221 | 221 | $this->absolutePaths=$absolutePaths; |
222 | 222 | $size=\sizeof($this->content); |
223 | - for($i=0;$i<$size;$i++){ |
|
223 | + for ($i=0; $i<$size; $i++) { |
|
224 | 224 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
225 | 225 | } |
226 | 226 | return $this; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | use Ajax\semantic\html\modules\HtmlModal; |
21 | 21 | |
22 | 22 | abstract class Widget extends HtmlDoubleElement { |
23 | - use FieldAsTrait,FormTrait; |
|
23 | + use FieldAsTrait, FormTrait; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @var string classname |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | protected $_generated; |
54 | 54 | |
55 | 55 | |
56 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
56 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
57 | 57 | parent::__construct($identifier); |
58 | 58 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
59 | 59 | $this->setModel($model); |
60 | - if(isset($modelInstance)){ |
|
60 | + if (isset($modelInstance)) { |
|
61 | 61 | $this->show($modelInstance); |
62 | 62 | } |
63 | 63 | $this->_generated=false; |
64 | 64 | } |
65 | 65 | |
66 | - protected function _init($instanceViewer,$contentKey,$content,$edition){ |
|
66 | + protected function _init($instanceViewer, $contentKey, $content, $edition) { |
|
67 | 67 | $this->_instanceViewer=$instanceViewer; |
68 | 68 | $this->content=[$contentKey=>$content]; |
69 | 69 | $this->_self=$content; |
@@ -75,31 +75,31 @@ discard block |
||
75 | 75 | * @param int|string $fieldName |
76 | 76 | * @return int|string|boolean |
77 | 77 | */ |
78 | - protected function _getIndex($fieldName){ |
|
78 | + protected function _getIndex($fieldName) { |
|
79 | 79 | $index=$fieldName; |
80 | - if(\is_string($fieldName)){ |
|
80 | + if (\is_string($fieldName)) { |
|
81 | 81 | $fields=$this->_instanceViewer->getVisibleProperties(); |
82 | 82 | $index=\array_search($fieldName, $fields); |
83 | 83 | } |
84 | 84 | return $index; |
85 | 85 | } |
86 | 86 | |
87 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
87 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
88 | 88 | return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
89 | 89 | } |
90 | 90 | |
91 | - protected function _getFieldName($index){ |
|
91 | + protected function _getFieldName($index) { |
|
92 | 92 | return $this->_instanceViewer->getFieldName($index); |
93 | 93 | } |
94 | 94 | |
95 | - protected function _getFieldCaption($index){ |
|
95 | + protected function _getFieldCaption($index) { |
|
96 | 96 | return $this->_instanceViewer->getCaption($index); |
97 | 97 | } |
98 | 98 | |
99 | - abstract protected function _setToolbarPosition($table,$captions=NULL); |
|
99 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
100 | 100 | |
101 | - public function show($modelInstance){ |
|
102 | - if(\is_array($modelInstance)){ |
|
101 | + public function show($modelInstance) { |
|
102 | + if (\is_array($modelInstance)) { |
|
103 | 103 | $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
104 | 104 | } |
105 | 105 | $this->_modelInstance=$modelInstance; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | abstract public function getHtmlComponent(); |
127 | 127 | |
128 | - public function setAttached($value=true){ |
|
128 | + public function setAttached($value=true) { |
|
129 | 129 | return $this->getHtmlComponent()->setAttached($value); |
130 | 130 | } |
131 | 131 | |
@@ -136,59 +136,59 @@ discard block |
||
136 | 136 | * @param callable $callback function called after the field compilation |
137 | 137 | * @return Widget |
138 | 138 | */ |
139 | - public function afterCompile($index,$callback){ |
|
139 | + public function afterCompile($index, $callback) { |
|
140 | 140 | $index=$this->_getIndex($index); |
141 | 141 | $this->_instanceViewer->afterCompile($index, $callback); |
142 | 142 | return $this; |
143 | 143 | } |
144 | 144 | |
145 | - public function setColor($color){ |
|
145 | + public function setColor($color) { |
|
146 | 146 | return $this->getHtmlComponent()->setColor($color); |
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | - public function setCaptions($captions){ |
|
150 | + public function setCaptions($captions) { |
|
151 | 151 | $this->_instanceViewer->setCaptions($captions); |
152 | 152 | return $this; |
153 | 153 | } |
154 | 154 | |
155 | - public function setCaption($index,$caption){ |
|
155 | + public function setCaption($index, $caption) { |
|
156 | 156 | $this->_instanceViewer->setCaption($this->_getIndex($index), $caption); |
157 | 157 | return $this; |
158 | 158 | } |
159 | 159 | |
160 | - public function setFields($fields){ |
|
160 | + public function setFields($fields) { |
|
161 | 161 | $this->_instanceViewer->setVisibleProperties($fields); |
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 | |
165 | - public function addField($field){ |
|
165 | + public function addField($field) { |
|
166 | 166 | $this->_instanceViewer->addField($field); |
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
170 | - public function addFields($fields){ |
|
170 | + public function addFields($fields) { |
|
171 | 171 | $this->_instanceViewer->addFields($fields); |
172 | 172 | return $this; |
173 | 173 | } |
174 | 174 | |
175 | - public function addMessage($attributes=NULL,$fieldName="message"){ |
|
175 | + public function addMessage($attributes=NULL, $fieldName="message") { |
|
176 | 176 | $this->_instanceViewer->addField($fieldName); |
177 | 177 | $count=$this->_instanceViewer->visiblePropertiesCount(); |
178 | - return $this->fieldAsMessage($count-1,$attributes); |
|
178 | + return $this->fieldAsMessage($count-1, $attributes); |
|
179 | 179 | } |
180 | 180 | |
181 | - public function addErrorMessage(){ |
|
182 | - return $this->addMessage(["error"=>true],"message"); |
|
181 | + public function addErrorMessage() { |
|
182 | + return $this->addMessage(["error"=>true], "message"); |
|
183 | 183 | } |
184 | 184 | |
185 | - public function insertField($index,$field){ |
|
185 | + public function insertField($index, $field) { |
|
186 | 186 | $index=$this->_getIndex($index); |
187 | 187 | $this->_instanceViewer->insertField($index, $field); |
188 | 188 | return $this; |
189 | 189 | } |
190 | 190 | |
191 | - public function insertInField($index,$field){ |
|
191 | + public function insertInField($index, $field) { |
|
192 | 192 | $index=$this->_getIndex($index); |
193 | 193 | $this->_instanceViewer->insertInField($index, $field); |
194 | 194 | return $this; |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | * @param callable $callback function parameters are : $value : the field value, $instance : the active instance of model, $fieldIndex : the field index, $rowIndex : the row index |
201 | 201 | * @return Widget |
202 | 202 | */ |
203 | - public function setValueFunction($index,$callback){ |
|
203 | + public function setValueFunction($index, $callback) { |
|
204 | 204 | $index=$this->_getIndex($index); |
205 | 205 | $this->_instanceViewer->setValueFunction($index, $callback); |
206 | 206 | return $this; |
207 | 207 | } |
208 | 208 | |
209 | - public function setIdentifierFunction($callback){ |
|
209 | + public function setIdentifierFunction($callback) { |
|
210 | 210 | $this->_instanceViewer->setIdentifierFunction($callback); |
211 | 211 | return $this; |
212 | 212 | } |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | /** |
215 | 215 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
216 | 216 | */ |
217 | - public function getToolbar(){ |
|
218 | - if(isset($this->_toolbar)===false){ |
|
217 | + public function getToolbar() { |
|
218 | + if (isset($this->_toolbar)===false) { |
|
219 | 219 | $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
220 | 220 | } |
221 | 221 | return $this->_toolbar; |
@@ -227,15 +227,15 @@ discard block |
||
227 | 227 | * @param callable $callback function to call on $element |
228 | 228 | * @return \Ajax\common\html\HtmlDoubleElement |
229 | 229 | */ |
230 | - public function addInToolbar($element,$callback=NULL){ |
|
230 | + public function addInToolbar($element, $callback=NULL) { |
|
231 | 231 | $tb=$this->getToolbar(); |
232 | - if($element instanceof BaseWidget){ |
|
233 | - if($element->getIdentifier()===""){ |
|
232 | + if ($element instanceof BaseWidget) { |
|
233 | + if ($element->getIdentifier()==="") { |
|
234 | 234 | $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); |
235 | 235 | } |
236 | 236 | } |
237 | - if(isset($callback)){ |
|
238 | - if(\is_callable($callback)){ |
|
237 | + if (isset($callback)) { |
|
238 | + if (\is_callable($callback)) { |
|
239 | 239 | $callback($element); |
240 | 240 | } |
241 | 241 | } |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | * @param callable $callback function($element) |
249 | 249 | * @return \Ajax\common\html\HtmlDoubleElement |
250 | 250 | */ |
251 | - public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
|
252 | - $result=$this->addInToolbar($caption,$callback); |
|
253 | - if(isset($icon) && method_exists($result, "addIcon")) |
|
251 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
252 | + $result=$this->addInToolbar($caption, $callback); |
|
253 | + if (isset($icon) && method_exists($result, "addIcon")) |
|
254 | 254 | $result->addIcon($icon); |
255 | 255 | return $result; |
256 | 256 | } |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | * @param callable $callback function($element) |
261 | 261 | * @return \Ajax\common\Widget |
262 | 262 | */ |
263 | - public function addItemsInToolbar(array $items,$callback=NULL){ |
|
264 | - if(JArray::isAssociative($items)){ |
|
265 | - foreach ($items as $icon=>$item){ |
|
266 | - $this->addItemInToolbar($item,$icon,$callback); |
|
263 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
264 | + if (JArray::isAssociative($items)) { |
|
265 | + foreach ($items as $icon=>$item) { |
|
266 | + $this->addItemInToolbar($item, $icon, $callback); |
|
267 | 267 | } |
268 | - }else{ |
|
269 | - foreach ($items as $item){ |
|
270 | - $this->addItemInToolbar($item,null,$callback); |
|
268 | + } else { |
|
269 | + foreach ($items as $item) { |
|
270 | + $this->addItemInToolbar($item, null, $callback); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | return $this; |
@@ -279,12 +279,12 @@ discard block |
||
279 | 279 | * @param callable $callback function($element) |
280 | 280 | * @return \Ajax\common\html\HtmlDoubleElement |
281 | 281 | */ |
282 | - public function addDropdownInToolbar($value,$items,$callback=NULL){ |
|
282 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
283 | 283 | $dd=$value; |
284 | 284 | if (\is_string($value)) { |
285 | - $dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items); |
|
285 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
286 | 286 | } |
287 | - return $this->addInToolbar($dd,$callback); |
|
287 | + return $this->addInToolbar($dd, $callback); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | * @param callable $callback function($element) |
294 | 294 | * @return \Ajax\common\html\HtmlDoubleElement |
295 | 295 | */ |
296 | - public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){ |
|
297 | - $bt=new HtmlButton("bt-".$caption,$caption,$cssStyle); |
|
298 | - return $this->addInToolbar($bt,$callback); |
|
296 | + public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) { |
|
297 | + $bt=new HtmlButton("bt-".$caption, $caption, $cssStyle); |
|
298 | + return $this->addInToolbar($bt, $callback); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | * @param callable $callback function($element) |
305 | 305 | * @return \Ajax\common\html\HtmlDoubleElement |
306 | 306 | */ |
307 | - public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){ |
|
308 | - $bts=new HtmlButtonGroups("",$captions,$asIcon); |
|
309 | - return $this->addInToolbar($bts,$callback); |
|
307 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
308 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
309 | + return $this->addInToolbar($bts, $callback); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -316,15 +316,15 @@ discard block |
||
316 | 316 | * @param boolean $labeled |
317 | 317 | * @return \Ajax\common\html\HtmlDoubleElement |
318 | 318 | */ |
319 | - public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){ |
|
320 | - $bt=new HtmlButton("",$caption); |
|
321 | - $bt->addIcon($icon,$before,$labeled); |
|
319 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
320 | + $bt=new HtmlButton("", $caption); |
|
321 | + $bt->addIcon($icon, $before, $labeled); |
|
322 | 322 | return $this->addInToolbar($bt); |
323 | 323 | } |
324 | 324 | |
325 | - public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
326 | - $button=new HtmlButton($identifier,$value,$cssStyle); |
|
327 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters); |
|
325 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
326 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
327 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters); |
|
328 | 328 | return $this->addInToolbar($button); |
329 | 329 | } |
330 | 330 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model |
355 | 355 | * @return \Ajax\common\Widget |
356 | 356 | */ |
357 | - public function setDefaultValueFunction($defaultValueFunction){ |
|
357 | + public function setDefaultValueFunction($defaultValueFunction) { |
|
358 | 358 | $this->_instanceViewer->setDefaultValueFunction($defaultValueFunction); |
359 | 359 | return $this; |
360 | 360 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @param string|boolean $disable |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - public function jsDisabled($disable=true){ |
|
366 | + public function jsDisabled($disable=true) { |
|
367 | 367 | return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");"; |
368 | 368 | } |
369 | 369 | |
@@ -372,12 +372,12 @@ discard block |
||
372 | 372 | * @param callable $callback function($element) |
373 | 373 | * @return \Ajax\common\html\HtmlDoubleElement |
374 | 374 | */ |
375 | - public function addEditButtonInToolbar($caption,$callback=NULL){ |
|
376 | - $bt=new HtmlButton($this->identifier."-editBtn",$caption); |
|
375 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
376 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
377 | 377 | $bt->setToggle(); |
378 | 378 | $bt->setActive($this->_edition); |
379 | 379 | $bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')"))); |
380 | - return $this->addInToolbar($bt,$callback); |
|
380 | + return $this->addInToolbar($bt, $callback); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | public function setToolbar(HtmlMenu $_toolbar) { |
@@ -391,34 +391,34 @@ discard block |
||
391 | 391 | } |
392 | 392 | |
393 | 393 | public function getForm() { |
394 | - if(!isset($this->_form)){ |
|
394 | + if (!isset($this->_form)) { |
|
395 | 395 | $this->_form=new HtmlForm("frm-".$this->identifier); |
396 | 396 | $this->setEdition(true); |
397 | 397 | } |
398 | 398 | return $this->_form; |
399 | 399 | } |
400 | 400 | |
401 | - public function run(JsUtils $js){ |
|
401 | + public function run(JsUtils $js) { |
|
402 | 402 | parent::run($js); |
403 | - if(isset($this->_form)){ |
|
403 | + if (isset($this->_form)) { |
|
404 | 404 | $this->runForm($js); |
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | - protected function runForm(JsUtils $js){ |
|
408 | + protected function runForm(JsUtils $js) { |
|
409 | 409 | $fields=$this->getContentInstances(HtmlFormField::class); |
410 | - foreach ($fields as $field){ |
|
410 | + foreach ($fields as $field) { |
|
411 | 411 | $this->_form->addField($field); |
412 | 412 | } |
413 | 413 | return $this->_form->run($js); |
414 | 414 | } |
415 | 415 | |
416 | - protected function _compileForm(){ |
|
417 | - if(isset($this->_form)){ |
|
416 | + protected function _compileForm() { |
|
417 | + if (isset($this->_form)) { |
|
418 | 418 | $noValidate=""; |
419 | - if(\sizeof($this->_form->getValidationParams())>0) |
|
419 | + if (\sizeof($this->_form->getValidationParams())>0) |
|
420 | 420 | $noValidate="novalidate"; |
421 | - $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>"); |
|
421 | + $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>"); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
@@ -433,32 +433,32 @@ discard block |
||
433 | 433 | return $this; |
434 | 434 | } |
435 | 435 | |
436 | - public function moveFieldTo($from,$to){ |
|
436 | + public function moveFieldTo($from, $to) { |
|
437 | 437 | return $this->_instanceViewer->moveFieldTo($from, $to); |
438 | 438 | } |
439 | 439 | |
440 | - public function swapFields($index1,$index2){ |
|
440 | + public function swapFields($index1, $index2) { |
|
441 | 441 | $index1=$this->_getIndex($index1); |
442 | 442 | $index2=$this->_getIndex($index2); |
443 | 443 | return $this->_instanceViewer->swapFields($index1, $index2); |
444 | 444 | } |
445 | 445 | |
446 | - public function removeField($index){ |
|
446 | + public function removeField($index) { |
|
447 | 447 | $index=$this->_getIndex($index); |
448 | 448 | $this->_instanceViewer->removeField($index); |
449 | 449 | return $this; |
450 | 450 | } |
451 | 451 | |
452 | - public function asModal($header=null){ |
|
453 | - $modal=new HtmlModal("modal-".$this->identifier,$header); |
|
452 | + public function asModal($header=null) { |
|
453 | + $modal=new HtmlModal("modal-".$this->identifier, $header); |
|
454 | 454 | $modal->setContent($this); |
455 | - if(isset($this->_form)){ |
|
455 | + if (isset($this->_form)) { |
|
456 | 456 | $this->_form->onSuccess($modal->jsHide()); |
457 | 457 | } |
458 | 458 | return $modal; |
459 | 459 | } |
460 | 460 | |
461 | 461 | public function addToProperty($name, $value, $separator=" ") { |
462 | - return $this->getHtmlComponent()->addToProperty($name,$value,$separator); |
|
462 | + return $this->getHtmlComponent()->addToProperty($name, $value, $separator); |
|
463 | 463 | } |
464 | 464 | } |