@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $ajaxTransition; |
18 | 18 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
19 | 19 | |
20 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
20 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
21 | 21 | protected function addLoading(&$retour, $responseElement) { |
22 | 22 | $loading_notifier='<div class="ajax-loader">'; |
23 | 23 | if ($this->ajaxLoader=='') { |
@@ -30,66 +30,66 @@ discard block |
||
30 | 30 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
31 | 31 | } |
32 | 32 | |
33 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
34 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly); |
|
33 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
34 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly); |
|
35 | 35 | } |
36 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
37 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly); |
|
36 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
37 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly); |
|
38 | 38 | } |
39 | 39 | |
40 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
41 | - if(JString::isNull($params)){$params="{}";} |
|
40 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
41 | + if (JString::isNull($params)) {$params="{}"; } |
|
42 | 42 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
43 | 43 | $retour=$this->_getAjaxUrl($url, $attr); |
44 | 44 | $responseElement=$this->_getResponseElement($responseElement); |
45 | 45 | $retour.="var self=this;\n"; |
46 | - if($hasLoader===true){ |
|
46 | + if ($hasLoader===true) { |
|
47 | 47 | $this->addLoading($retour, $responseElement); |
48 | 48 | } |
49 | 49 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
50 | - $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n"; |
|
50 | + $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n"; |
|
51 | 51 | if ($immediatly) |
52 | 52 | $this->jquery_code_for_compile[]=$retour; |
53 | 53 | return $retour; |
54 | 54 | } |
55 | 55 | |
56 | - protected function setAjaxDataCall($params){ |
|
56 | + protected function setAjaxDataCall($params) { |
|
57 | 57 | $result=null; |
58 | - if(!\is_callable($params)){ |
|
59 | - $result=function ($responseElement,$jqueryDone="html") use($params){ |
|
60 | - return AjaxTransition::{$params}($responseElement,$jqueryDone); |
|
58 | + if (!\is_callable($params)) { |
|
59 | + $result=function($responseElement, $jqueryDone="html") use($params){ |
|
60 | + return AjaxTransition::{$params}($responseElement, $jqueryDone); |
|
61 | 61 | }; |
62 | 62 | } |
63 | 63 | return $result; |
64 | 64 | } |
65 | 65 | |
66 | - protected function _getAjaxUrl($url,$attr){ |
|
66 | + protected function _getAjaxUrl($url, $attr) { |
|
67 | 67 | $url=$this->_correctAjaxUrl($url); |
68 | 68 | $retour="url='".$url."';"; |
69 | 69 | $slash="/"; |
70 | - if(JString::endswith($url, "/")===true) |
|
70 | + if (JString::endswith($url, "/")===true) |
|
71 | 71 | $slash=""; |
72 | - if(JString::isNotNull($attr)){ |
|
72 | + if (JString::isNotNull($attr)) { |
|
73 | 73 | if ($attr==="value") |
74 | 74 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
75 | 75 | elseif ($attr==="html") |
76 | 76 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
77 | - elseif($attr!=null && $attr!=="") |
|
77 | + elseif ($attr!=null && $attr!=="") |
|
78 | 78 | $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
79 | 79 | } |
80 | 80 | return $retour; |
81 | 81 | } |
82 | 82 | |
83 | - protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$jsCallback){ |
|
84 | - $retour="";$call=null; |
|
83 | + protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) { |
|
84 | + $retour=""; $call=null; |
|
85 | 85 | if ($responseElement!=="") { |
86 | - if(isset($ajaxTransition)){ |
|
86 | + if (isset($ajaxTransition)) { |
|
87 | 87 | $call=$this->setAjaxDataCall($ajaxTransition); |
88 | - }elseif(isset($this->ajaxTransition)){ |
|
88 | + }elseif (isset($this->ajaxTransition)) { |
|
89 | 89 | $call=$this->ajaxTransition; |
90 | 90 | } |
91 | - if(\is_callable($call)) |
|
92 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
91 | + if (\is_callable($call)) |
|
92 | + $retour="\t".$call($responseElement, $jqueryDone).";\n"; |
|
93 | 93 | else |
94 | 94 | $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
95 | 95 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return $retour; |
98 | 98 | } |
99 | 99 | |
100 | - protected function _getResponseElement($responseElement){ |
|
100 | + protected function _getResponseElement($responseElement) { |
|
101 | 101 | if ($responseElement!=="") { |
102 | 102 | $responseElement=Javascript::prep_value($responseElement); |
103 | 103 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | protected function _correctAjaxUrl($url) { |
108 | 108 | if ($url!=="/" && JString::endsWith($url, "/")===true) |
109 | 109 | $url=substr($url, 0, strlen($url)-1); |
110 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
110 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
111 | 111 | $url=$this->jsUtils->getUrl($url); |
112 | 112 | } |
113 | 113 | return $url; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param string $jsCallback javascript code to execute after the request |
122 | 122 | * @param boolean $immediatly |
123 | 123 | */ |
124 | - public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
124 | + public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
125 | 125 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
126 | 126 | $retour=$this->_getAjaxUrl($url, $attr); |
127 | 127 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param string $url the request address |
143 | 143 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
144 | 144 | */ |
145 | - public function _jsonOn($event,$element, $url,$parameters=array()) { |
|
145 | + public function _jsonOn($event, $element, $url, $parameters=array()) { |
|
146 | 146 | $preventDefault=true; |
147 | 147 | $stopPropagation=true; |
148 | 148 | $jsCallback=null; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $params="{}"; |
153 | 153 | $immediatly=true; |
154 | 154 | extract($parameters); |
155 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
155 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -165,22 +165,22 @@ discard block |
||
165 | 165 | * @param string $rowClass the css class for the new element |
166 | 166 | * @param boolean $immediatly |
167 | 167 | */ |
168 | - public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$rowClass="_json",$immediatly=false) { |
|
168 | + public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $rowClass="_json", $immediatly=false) { |
|
169 | 169 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
170 | 170 | $retour=$this->_getAjaxUrl($url, $attr); |
171 | - if($context===null){ |
|
171 | + if ($context===null) { |
|
172 | 172 | $parent="$('".$maskSelector."').parent()"; |
173 | - $newElm = "$('#'+newId)"; |
|
174 | - }else{ |
|
173 | + $newElm="$('#'+newId)"; |
|
174 | + } else { |
|
175 | 175 | $parent=$context; |
176 | - $newElm = $context.".find('#'+newId)"; |
|
176 | + $newElm=$context.".find('#'+newId)"; |
|
177 | 177 | } |
178 | 178 | $appendTo="\t\tnewElm.appendTo(".$parent.");\n"; |
179 | 179 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
180 | 180 | $retour.=$parent.".find('._json').remove();"; |
181 | 181 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone(); |
182 | 182 | newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ var newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n"; |
183 | - $retour.= $appendTo; |
|
183 | + $retour.=$appendTo; |
|
184 | 184 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('__'+key+'__')>-1){\n"."\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
185 | 185 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
186 | 186 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -195,30 +195,30 @@ discard block |
||
195 | 195 | * @param string $url the request address |
196 | 196 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null) |
197 | 197 | */ |
198 | - public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) { |
|
198 | + public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
199 | 199 | $preventDefault=true; |
200 | 200 | $stopPropagation=true; |
201 | 201 | $jsCallback=null; |
202 | 202 | $attr="id"; |
203 | 203 | $method="get"; |
204 | - $context = null; |
|
204 | + $context=null; |
|
205 | 205 | $params="{}"; |
206 | 206 | $immediatly=true; |
207 | 207 | extract($parameters); |
208 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
208 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
209 | 209 | } |
210 | 210 | |
211 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
211 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
212 | 212 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
213 | 213 | $retour=$this->_getAjaxUrl($url, $attr); |
214 | 214 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
215 | 215 | $responseElement=$this->_getResponseElement($responseElement); |
216 | 216 | $retour.="var self=this;\n"; |
217 | - if($hasLoader===true){ |
|
217 | + if ($hasLoader===true) { |
|
218 | 218 | $this->addLoading($retour, $responseElement); |
219 | 219 | } |
220 | 220 | $retour.="$.post(url,params).done(function( data ) {\n"; |
221 | - $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n"; |
|
221 | + $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n"; |
|
222 | 222 | |
223 | 223 | if ($validation) { |
224 | 224 | $retour="$('#".$form."').validate({submitHandler: function(form) { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param string $responseElement |
242 | 242 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"jqueryDone"=>"html") |
243 | 243 | */ |
244 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
244 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
245 | 245 | $preventDefault=true; |
246 | 246 | $stopPropagation=true; |
247 | 247 | $jsCallback=null; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $jqueryDone="html"; |
252 | 252 | $ajaxTransition=null; |
253 | 253 | extract($parameters); |
254 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly); |
|
254 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param string $responseElement |
265 | 265 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null) |
266 | 266 | */ |
267 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
267 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
268 | 268 | $preventDefault=true; |
269 | 269 | $stopPropagation=true; |
270 | 270 | $jsCallback=null; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $jqueryDone="html"; |
275 | 275 | $ajaxTransition=null; |
276 | 276 | extract($parameters); |
277 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly); |
|
277 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param string $responseElement |
288 | 288 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"immediatly"=>true) |
289 | 289 | */ |
290 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
290 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
291 | 291 | $preventDefault=true; |
292 | 292 | $stopPropagation=true; |
293 | 293 | $validation=false; |
@@ -298,6 +298,6 @@ discard block |
||
298 | 298 | $jqueryDone="html"; |
299 | 299 | $ajaxTransition=null; |
300 | 300 | extract($parameters); |
301 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly); |
|
301 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly); |
|
302 | 302 | } |
303 | 303 | } |
304 | 304 | \ No newline at end of file |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
26 | 26 | * @param string|callable $ajaxTransition |
27 | 27 | */ |
28 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
29 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
28 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
29 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @param string $jsCallback javascript code to execute after the request |
38 | 38 | * @param boolean $immediatly |
39 | 39 | */ |
40 | - public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
41 | - return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly); |
|
40 | + public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
41 | + return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param string $url the request address |
49 | 49 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
50 | 50 | */ |
51 | - public function jsonOn($event,$element, $url,$parameters=array()) { |
|
52 | - return $this->js->_jsonOn($event, $element, $url,$parameters); |
|
51 | + public function jsonOn($event, $element, $url, $parameters=array()) { |
|
52 | + return $this->js->_jsonOn($event, $element, $url, $parameters); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @param string $jsCallback javascript code to execute after the request |
72 | 72 | * @param string $rowClass the css class for the new element |
73 | 73 | */ |
74 | - public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") { |
|
75 | - return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL,$rowClass,true); |
|
74 | + public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") { |
|
75 | + return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, true); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @param string $jsCallback javascript code to execute after the request |
85 | 85 | * @param string $rowClass the css class for the new element |
86 | 86 | */ |
87 | - public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") { |
|
88 | - return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL, $rowClass,false); |
|
87 | + public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") { |
|
88 | + return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, false); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | * @param string $url the request url |
96 | 96 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true) |
97 | 97 | */ |
98 | - public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) { |
|
99 | - return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters); |
|
98 | + public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
99 | + return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
111 | 111 | * @param string|callable $ajaxTransition |
112 | 112 | */ |
113 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) { |
|
114 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false,$jqueryDone,$ajaxTransition); |
|
113 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) { |
|
114 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
151 | 151 | * @param string|callable $ajaxTransition |
152 | 152 | */ |
153 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
154 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
153 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
154 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
167 | 167 | * @param string|callable $ajaxTransition |
168 | 168 | */ |
169 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
170 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false); |
|
169 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
170 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null) |
182 | 182 | */ |
183 | 183 | public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
184 | - return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
184 | + return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
208 | 208 | * @param string|callable $ajaxTransition |
209 | 209 | */ |
210 | - public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
211 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
210 | + public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
211 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
224 | 224 | * @param string|callable $ajaxTransition |
225 | 225 | */ |
226 | - public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
227 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false); |
|
226 | + public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
227 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null) |
239 | 239 | */ |
240 | 240 | public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
241 | - return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters); |
|
241 | + return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -29,27 +29,27 @@ |
||
29 | 29 | $rowClass="_json"; |
30 | 30 | extract($this->parameters); |
31 | 31 | $result=$this->_eventPreparing($preventDefault, $stopPropagation); |
32 | - switch($this->method) { |
|
32 | + switch ($this->method) { |
|
33 | 33 | case "get": |
34 | - $result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr,$jqueryDone,$ajaxTransition); |
|
34 | + $result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr, $jqueryDone, $ajaxTransition); |
|
35 | 35 | break; |
36 | 36 | case "post": |
37 | - $result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition); |
|
37 | + $result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition); |
|
38 | 38 | break; |
39 | 39 | case "postForm": |
40 | - $result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition); |
|
40 | + $result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition); |
|
41 | 41 | break; |
42 | 42 | case "json": |
43 | - $result.=$js->jsonDeferred($url,$method,$params,$jsCallback); |
|
43 | + $result.=$js->jsonDeferred($url, $method, $params, $jsCallback); |
|
44 | 44 | break; |
45 | 45 | case "jsonArray": |
46 | - $result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$params,$jsCallback,$rowClass); |
|
46 | + $result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $params, $jsCallback, $rowClass); |
|
47 | 47 | break; |
48 | 48 | } |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - protected function _eventPreparing($preventDefault,$stopPropagation){ |
|
52 | + protected function _eventPreparing($preventDefault, $stopPropagation) { |
|
53 | 53 | $result=""; |
54 | 54 | if ($preventDefault===true) { |
55 | 55 | $result.=Javascript::$preventDefault; |