@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | protected $attr; |
22 | 22 | |
23 | 23 | |
24 | - public function __construct($identifier,$tagName){ |
|
25 | - parent::__construct($identifier,$tagName); |
|
24 | + public function __construct($identifier, $tagName) { |
|
25 | + parent::__construct($identifier, $tagName); |
|
26 | 26 | $this->root=""; |
27 | 27 | $this->attr="data-ajax"; |
28 | 28 | } |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | * @param string $targetSelector the target of the get |
34 | 34 | * @return HtmlNavElement |
35 | 35 | */ |
36 | - public function autoGetOnClick($targetSelector){ |
|
37 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
36 | + public function autoGetOnClick($targetSelector) { |
|
37 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
38 | 38 | } |
39 | 39 | |
40 | - public function contentAsString(){ |
|
40 | + public function contentAsString() { |
|
41 | 41 | return implode("", $this->content); |
42 | 42 | } |
43 | 43 | } |
@@ -23,19 +23,19 @@ |
||
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | - public function addGlyph($glyphicon,$before=true){ |
|
26 | + public function addGlyph($glyphicon, $before=true) { |
|
27 | 27 | $glyph=new HtmlGlyphicon(""); |
28 | 28 | $glyph->setGlyphicon($glyphicon); |
29 | - $this->addContent($glyph,$before); |
|
29 | + $this->addContent($glyph, $before); |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
33 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
34 | 34 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
35 | 35 | $after=""; |
36 | - if($glyphAfter!==""){ |
|
36 | + if ($glyphAfter!=="") { |
|
37 | 37 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
38 | 38 | } |
39 | - return $this->wrapContent($before,$after); |
|
39 | + return $this->wrapContent($before, $after); |
|
40 | 40 | } |
41 | 41 | } |
@@ -69,7 +69,8 @@ |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | public function getPanel($index) { |
72 | - if ($index<sizeof($this->content)) |
|
73 | - return $this->content [$index]; |
|
72 | + if ($index<sizeof($this->content)) { |
|
73 | + return $this->content [$index]; |
|
74 | + } |
|
74 | 75 | } |
75 | 76 | } |
@@ -50,14 +50,14 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * render the content of $controller::$action and set the response to a new panel |
|
54 | - * @param JsUtils $js |
|
55 | - * @param string $title The panel title |
|
56 | - * @param object $initialController |
|
57 | - * @param string $controller a Phalcon controller |
|
58 | - * @param string $action a Phalcon action |
|
59 | - * @param array $params |
|
60 | - */ |
|
53 | + * render the content of $controller::$action and set the response to a new panel |
|
54 | + * @param JsUtils $js |
|
55 | + * @param string $title The panel title |
|
56 | + * @param object $initialController |
|
57 | + * @param string $controller a Phalcon controller |
|
58 | + * @param string $action a Phalcon action |
|
59 | + * @param array $params |
|
60 | + */ |
|
61 | 61 | public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
62 | 62 | return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
63 | 63 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->setClass("panel-group"); |
20 | 20 | $this->setRole("tablist"); |
21 | 21 | $this->setProperty("aria-multiselectable", "true"); |
22 | - $this->content=array (); |
|
22 | + $this->content=array(); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addPanel($title, $content) { |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param string $viewName |
46 | 46 | * @param array $params The parameters to pass to the view |
47 | 47 | */ |
48 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
49 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
48 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
49 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * @param string $action a Phalcon action |
59 | 59 | * @param array $params |
60 | 60 | */ |
61 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
62 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
61 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
62 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function run(JsUtils $js) { |
66 | - foreach ( $this->content as $content ) { |
|
66 | + foreach ($this->content as $content) { |
|
67 | 67 | $content->run($js); |
68 | 68 | } |
69 | 69 | } |
@@ -62,15 +62,15 @@ |
||
62 | 62 | */ |
63 | 63 | public function setIdentifier($identifier) { |
64 | 64 | parent::setIdentifier($identifier); |
65 | - if($this->content instanceof HtmlLink){ |
|
65 | + if ($this->content instanceof HtmlLink) { |
|
66 | 66 | $this->content->setIdentifier("link-".$identifier); |
67 | 67 | } |
68 | 68 | } |
69 | - public function setActive($value=true){ |
|
70 | - $this->setProperty("class", ($value)?"active":""); |
|
69 | + public function setActive($value=true) { |
|
70 | + $this->setProperty("class", ($value) ? "active" : ""); |
|
71 | 71 | } |
72 | 72 | |
73 | - public function disable(){ |
|
73 | + public function disable() { |
|
74 | 74 | $this->setProperty("class", "disabled"); |
75 | 75 | } |
76 | 76 | } |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\service; |
3 | 3 | class JQueryAjaxEffect { |
4 | - public static function none($responseElement,$jqueryDone="html"){ |
|
4 | + public static function none($responseElement, $jqueryDone="html") { |
|
5 | 5 | return "\t$({$responseElement}).{$jqueryDone}( data );\n"; |
6 | 6 | } |
7 | 7 | |
8 | - public static function fade($responseElement,$jqueryDone="html"){ |
|
8 | + public static function fade($responseElement, $jqueryDone="html") { |
|
9 | 9 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).fadeIn();\n"; |
10 | 10 | } |
11 | 11 | |
12 | - public static function slide($responseElement,$jqueryDone="html"){ |
|
12 | + public static function slide($responseElement, $jqueryDone="html") { |
|
13 | 13 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).slideDown();\n"; |
14 | 14 | } |
15 | 15 | } |
@@ -8,22 +8,22 @@ discard block |
||
8 | 8 | * @property string $root |
9 | 9 | * @property string $attr |
10 | 10 | */ |
11 | -trait NavElementTrait{ |
|
11 | +trait NavElementTrait { |
|
12 | 12 | |
13 | 13 | abstract public function contentAsString(); |
14 | 14 | /** |
15 | 15 | * Generate the jquery script to set the elements to the HtmlNavElement |
16 | 16 | * @param JsUtils $jsUtils |
17 | 17 | */ |
18 | - public function jsSetContent(JsUtils $jsUtils){ |
|
19 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
18 | + public function jsSetContent(JsUtils $jsUtils) { |
|
19 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function getRoot() { |
23 | 23 | return $this->root; |
24 | 24 | } |
25 | 25 | public function setRoot($root) { |
26 | - $this->root = $root; |
|
26 | + $this->root=$root; |
|
27 | 27 | return $this; |
28 | 28 | } |
29 | 29 | public function getAttr() { |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @return HtmlNavElement |
37 | 37 | */ |
38 | 38 | public function setAttr($attr) { |
39 | - $this->attr = $attr; |
|
39 | + $this->attr=$attr; |
|
40 | 40 | return $this; |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function __call($method, $args) { |
44 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
44 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
45 | 45 | return call_user_func_array( |
46 | 46 | $this->$method, |
47 | 47 | $args |
@@ -49,5 +49,5 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0); |
|
52 | + abstract public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
53 | 53 | } |
@@ -28,8 +28,9 @@ discard block |
||
28 | 28 | $callback=", function(){\n{$callback}\n}"; |
29 | 29 | } |
30 | 30 | $str="$({$element}).{$action}({$speed}{$callback});"; |
31 | - if ($immediatly) |
|
32 | - $this->jquery_code_for_compile[]=$str; |
|
31 | + if ($immediatly) { |
|
32 | + $this->jquery_code_for_compile[]=$str; |
|
33 | + } |
|
33 | 34 | return $str; |
34 | 35 | } |
35 | 36 | /** |
@@ -61,10 +62,12 @@ discard block |
||
61 | 62 | if (isset($param)) { |
62 | 63 | $param=Javascript::prep_value($param); |
63 | 64 | $str="$({$element}).{$jQueryCall}({$param});"; |
64 | - } else |
|
65 | - $str="$({$element}).{$jQueryCall}();"; |
|
66 | - if ($immediatly) |
|
67 | - $this->jquery_code_for_compile[]=$str; |
|
65 | + } else { |
|
66 | + $str="$({$element}).{$jQueryCall}();"; |
|
67 | + } |
|
68 | + if ($immediatly) { |
|
69 | + $this->jquery_code_for_compile[]=$str; |
|
70 | + } |
|
68 | 71 | return $str; |
69 | 72 | } |
70 | 73 | |
@@ -80,8 +83,9 @@ discard block |
||
80 | 83 | $to=Javascript::prep_element($to); |
81 | 84 | $element=Javascript::prep_element($element); |
82 | 85 | $str="$({$to}).{$jQueryCall}({$element});"; |
83 | - if ($immediatly) |
|
84 | - $this->jquery_code_for_compile[]=$str; |
|
86 | + if ($immediatly) { |
|
87 | + $this->jquery_code_for_compile[]=$str; |
|
88 | + } |
|
85 | 89 | return $str; |
86 | 90 | } |
87 | 91 | /** |
@@ -130,10 +134,12 @@ discard block |
||
130 | 134 | if (isset($value)) { |
131 | 135 | $value=Javascript::prep_value($value); |
132 | 136 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
133 | - } else |
|
134 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
135 | - if ($immediatly) |
|
136 | - $this->jquery_code_for_compile[]=$str; |
|
137 | + } else { |
|
138 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
139 | + } |
|
140 | + if ($immediatly) { |
|
141 | + $this->jquery_code_for_compile[]=$str; |
|
142 | + } |
|
137 | 143 | return $str; |
138 | 144 | } |
139 | 145 | |
@@ -189,8 +195,9 @@ discard block |
||
189 | 195 | |
190 | 196 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
191 | 197 | |
192 | - if ($immediatly) |
|
193 | - $this->jquery_code_for_compile[]=$str; |
|
198 | + if ($immediatly) { |
|
199 | + $this->jquery_code_for_compile[]=$str; |
|
200 | + } |
|
194 | 201 | return $str; |
195 | 202 | } |
196 | 203 | |
@@ -340,8 +347,9 @@ discard block |
||
340 | 347 | $element=Javascript::prep_element($element); |
341 | 348 | $str="$({$element}).trigger(\"$event\");"; |
342 | 349 | |
343 | - if ($immediatly) |
|
344 | - $this->jquery_code_for_compile[]=$str; |
|
350 | + if ($immediatly) { |
|
351 | + $this->jquery_code_for_compile[]=$str; |
|
352 | + } |
|
345 | 353 | return $str; |
346 | 354 | } |
347 | 355 | |
@@ -403,8 +411,9 @@ discard block |
||
403 | 411 | $str.="else{".$jsCodeIfFalse."}"; |
404 | 412 | } |
405 | 413 | |
406 | - if ($immediatly) |
|
407 | - $this->jquery_code_for_compile[]=$str; |
|
414 | + if ($immediatly) { |
|
415 | + $this->jquery_code_for_compile[]=$str; |
|
416 | + } |
|
408 | 417 | return $str; |
409 | 418 | } |
410 | 419 | |
@@ -420,11 +429,13 @@ discard block |
||
420 | 429 | private function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
421 | 430 | $param=Javascript::prep_value($param); |
422 | 431 | $callback=""; |
423 | - if ($jsCallback!="") |
|
424 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
432 | + if ($jsCallback!="") { |
|
433 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
434 | + } |
|
425 | 435 | $script="$(".Javascript::prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
426 | - if ($immediatly) |
|
427 | - $this->jquery_code_for_compile[]=$script; |
|
436 | + if ($immediatly) { |
|
437 | + $this->jquery_code_for_compile[]=$script; |
|
438 | + } |
|
428 | 439 | return $script; |
429 | 440 | } |
430 | 441 | |
@@ -495,8 +506,9 @@ discard block |
||
495 | 506 | */ |
496 | 507 | public function exec($js, $immediatly=false) { |
497 | 508 | $script=$js."\n"; |
498 | - if ($immediatly) |
|
499 | - $this->jquery_code_for_compile[]=$script; |
|
509 | + if ($immediatly) { |
|
510 | + $this->jquery_code_for_compile[]=$script; |
|
511 | + } |
|
500 | 512 | return $script; |
501 | 513 | } |
502 | 514 |
@@ -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 | } |
@@ -18,27 +18,27 @@ discard block |
||
18 | 18 | |
19 | 19 | public function __construct(JsUtils $js=NULL) { |
20 | 20 | parent::__construct($js); |
21 | - $this->events=array (); |
|
21 | + $this->events=array(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | protected function compileEvents() { |
25 | - foreach ( $this->events as $event => $jsCode ) { |
|
25 | + foreach ($this->events as $event => $jsCode) { |
|
26 | 26 | $itemSelector=JString::getValueBetween($event); |
27 | - if($event=="execute"){ |
|
27 | + if ($event=="execute") { |
|
28 | 28 | $this->jquery_code_for_compile []=$jsCode; |
29 | - }else if($event=="beforeExecute"){ |
|
29 | + } else if ($event=="beforeExecute") { |
|
30 | 30 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
31 | - }else{ |
|
31 | + } else { |
|
32 | 32 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
33 | 33 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
34 | 34 | } |
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | - protected function _createSelector($itemSelector,$selector){ |
|
39 | - if(!isset($itemSelector)) |
|
38 | + protected function _createSelector($itemSelector, $selector) { |
|
39 | + if (!isset($itemSelector)) |
|
40 | 40 | $itemSelector=$this->itemSelector; |
41 | - if(isset($itemSelector) && $itemSelector!=="") |
|
41 | + if (isset($itemSelector) && $itemSelector!=="") |
|
42 | 42 | $selector.=" ".$itemSelector; |
43 | 43 | return $selector; |
44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $result=implode("\n", $this->jquery_code_for_compile); |
48 | 48 | $result=str_ireplace("\"%", "", $result); |
49 | 49 | $result=str_ireplace("%\"", "", $result); |
50 | - $result=str_replace(array ( |
|
50 | + $result=str_replace(array( |
|
51 | 51 | "\\n", |
52 | 52 | "\\r", |
53 | 53 | "\\t" |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function getScript() { |
59 | 59 | $allParams=$this->params; |
60 | - $this->jquery_code_for_compile=array (); |
|
60 | + $this->jquery_code_for_compile=array(); |
|
61 | 61 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");"; |
62 | 62 | $this->compileEvents(); |
63 | 63 | return $this->compileJQueryCode(); |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | $itemSelector=JString::getValueBetween($event); |
27 | 27 | if($event=="execute"){ |
28 | 28 | $this->jquery_code_for_compile []=$jsCode; |
29 | - }else if($event=="beforeExecute"){ |
|
29 | + } else if($event=="beforeExecute"){ |
|
30 | 30 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
31 | - }else{ |
|
31 | + } else{ |
|
32 | 32 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
33 | 33 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
34 | 34 | } |
@@ -36,10 +36,12 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function _createSelector($itemSelector,$selector){ |
39 | - if(!isset($itemSelector)) |
|
40 | - $itemSelector=$this->itemSelector; |
|
41 | - if(isset($itemSelector) && $itemSelector!=="") |
|
42 | - $selector.=" ".$itemSelector; |
|
39 | + if(!isset($itemSelector)) { |
|
40 | + $itemSelector=$this->itemSelector; |
|
41 | + } |
|
42 | + if(isset($itemSelector) && $itemSelector!=="") { |
|
43 | + $selector.=" ".$itemSelector; |
|
44 | + } |
|
43 | 45 | return $selector; |
44 | 46 | } |
45 | 47 | |
@@ -82,8 +84,9 @@ discard block |
||
82 | 84 | |
83 | 85 | protected function setParamCtrl($key, $value, $typeCtrl) { |
84 | 86 | if (\is_array($typeCtrl)) { |
85 | - if (array_search($value, $typeCtrl)===false) |
|
86 | - throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
87 | + if (array_search($value, $typeCtrl)===false) { |
|
88 | + throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
89 | + } |
|
87 | 90 | } else { |
88 | 91 | if (!$typeCtrl($value)) { |
89 | 92 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | return $this->setParam("context", $value); |
22 | 22 | } |
23 | 23 | |
24 | - public function setOffset($offset=0){ |
|
24 | + public function setOffset($offset=0) { |
|
25 | 25 | return $this->setParam("offset", $offset); |
26 | 26 | } |
27 | 27 | } |