Completed
Push — master ( d9189f...847185 )
by Jean-Christophe
03:54
created
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -19,49 +19,49 @@  discard block
 block discarded – undo
19 19
 class DataForm extends Widget {
20 20
 
21 21
 	public function __construct($identifier, $modelInstance=NULL) {
22
-		parent::__construct($identifier, null,$modelInstance);
22
+		parent::__construct($identifier, null, $modelInstance);
23 23
 		$this->_form=new HtmlForm($identifier);
24 24
 		$this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true);
25 25
 	}
26 26
 
27
-	protected function _getFieldIdentifier($prefix,$name=""){
27
+	protected function _getFieldIdentifier($prefix, $name="") {
28 28
 		return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier();
29 29
 	}
30 30
 
31
-	public function compile(JsUtils $js=NULL,&$view=NULL){
31
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
32 32
 		$this->_instanceViewer->setInstance($this->_modelInstance);
33 33
 
34 34
 		$form=$this->content["form"];
35 35
 		$this->_generateContent($form);
36 36
 
37
-		if(isset($this->_toolbar)){
37
+		if (isset($this->_toolbar)) {
38 38
 			$this->_setToolbarPosition($form);
39 39
 		}
40
-		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]);
41
-		return parent::compile($js,$view);
40
+		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]);
41
+		return parent::compile($js, $view);
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * @param HtmlForm $form
46 46
 	 */
47
-	protected function _generateContent($form){
48
-		$values= $this->_instanceViewer->getValues();
47
+	protected function _generateContent($form) {
48
+		$values=$this->_instanceViewer->getValues();
49 49
 		$count=$this->_instanceViewer->count();
50 50
 
51 51
 		$separators=$this->_instanceViewer->getSeparators();
52 52
 		$size=\sizeof($separators);
53
-		if($size===1){
54
-			foreach ($values as $v){
53
+		if ($size===1) {
54
+			foreach ($values as $v) {
55 55
 				$form->addField($v);
56 56
 			}
57
-		}else{
57
+		} else {
58 58
 			$separators[]=$count;
59
-			for($i=0;$i<$size;$i++){
60
-				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
59
+			for ($i=0; $i<$size; $i++) {
60
+				$fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]);
61 61
 				//TODO check why $fields is empty
62
-				if(\sizeof($fields)===1){
62
+				if (\sizeof($fields)===1) {
63 63
 					$form->addField($fields[0]);
64
-				}elseif(\sizeof($fields)>1){
64
+				}elseif (\sizeof($fields)>1) {
65 65
 					$form->addFields($fields);
66 66
 				}
67 67
 			}
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 	 * {@inheritDoc}
73 73
 	 * @see \Ajax\common\Widget::getForm()
74 74
 	 */
75
-	public function getForm(){
75
+	public function getForm() {
76 76
 		return $this->content["form"];
77 77
 	}
78 78
 
79
-	public function addSeparatorAfter($fieldNum){
79
+	public function addSeparatorAfter($fieldNum) {
80 80
 		$this->_instanceViewer->addSeparatorAfter($fieldNum);
81 81
 		return $this;
82 82
 	}
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 		return $this;
91 91
 	}
92 92
 
93
-	public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){
94
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
95
-			$button=new HtmlButton($id,$value,$cssStyle);
93
+	public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) {
94
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
95
+			$button=new HtmlButton($id, $value, $cssStyle);
96 96
 			$button->setProperty("type", "reset");
97 97
 			return $button;
98
-		}, $index,$attributes);
98
+		}, $index, $attributes);
99 99
 	}
100 100
 
101 101
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		$this->content[$this->_toolbarPosition]=$this->_toolbar;
115 115
 	}
116 116
 
117
-	public function run(JsUtils $js){
117
+	public function run(JsUtils $js) {
118 118
 		return parent::run($js);
119 119
 	}
120 120
 }
121 121
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@
 block discarded – undo
33 33
 		if ($stopPropagation===true) {
34 34
 			$result.=Javascript::$stopPropagation;
35 35
 		}
36
-		switch($this->method) {
36
+		switch ($this->method) {
37 37
 			case "get":
38
-				$result.=$js->getDeferred($url, $responseElement, $params, $callback, $attr,$jqueryDone,$ajaxTransition);
38
+				$result.=$js->getDeferred($url, $responseElement, $params, $callback, $attr, $jqueryDone, $ajaxTransition);
39 39
 				break;
40 40
 			case "post":
41
-				$result.=$js->postDeferred($url, $responseElement, $params, $callback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
41
+				$result.=$js->postDeferred($url, $responseElement, $params, $callback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
42 42
 				break;
43 43
 			case "postForm":
44
-				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $callback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
44
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $callback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
45 45
 				break;
46 46
 		}
47 47
 		return $result;
Please login to merge, or discard this patch.
Ajax/Jquery.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
  * @license Apache 2 http://www.apache.org/licenses/
16 16
  **/
17 17
 class Jquery {
18
-	use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait;
18
+	use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait;
19 19
 	protected $_ui;
20 20
 	protected $_bootstrap;
21 21
 	protected $_semantic;
22
-	protected $jquery_code_for_compile=array ();
22
+	protected $jquery_code_for_compile=array();
23 23
 	protected $jsUtils;
24 24
 	protected $params;
25 25
 
26
-	protected $jquery_events=array (
27
-			"bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload"
26
+	protected $jquery_events=array(
27
+			"bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload"
28 28
 	);
29 29
 
30 30
 	public function ui($ui=NULL) {
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 		return $this->_semantic;
49 49
 	}
50 50
 
51
-	public function __construct($params,$jsUtils) {
51
+	public function __construct($params, $jsUtils) {
52 52
 		$this->params=array();
53
-		foreach ( $params as $key => $val ) {
53
+		foreach ($params as $key => $val) {
54 54
 				$this->params[$key]=$params[$key];
55 55
 		}
56 56
 		$this->jsUtils=$jsUtils;
57
-		if(isset($params["ajaxTransition"]))
57
+		if (isset($params["ajaxTransition"]))
58 58
 			$this->ajaxTransition=$this->setAjaxDataCall($params["ajaxTransition"]);
59 59
 	}
60 60
 
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function _output($array_js='') {
118 118
 		if (!is_array($array_js)) {
119
-			$array_js=array (
119
+			$array_js=array(
120 120
 					$array_js
121 121
 			);
122 122
 		}
123 123
 
124
-		foreach ( $array_js as $js ) {
124
+		foreach ($array_js as $js) {
125 125
 			$this->jquery_code_for_compile[]="\t$js\n";
126 126
 		}
127 127
 	}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param string $param
134 134
 	 * @param boolean $immediatly delayed if false
135 135
 	 */
136
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
136
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
137 137
 		$element=Javascript::prep_element($element);
138 138
 		if (isset($param)) {
139 139
 			$param=Javascript::prep_value($param);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param boolean $immediatly delayed if false
153 153
 	 * @return string
154 154
 	 */
155
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
155
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
156 156
 		$to=Javascript::prep_element($to);
157 157
 		$element=Javascript::prep_element($element);
158 158
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function sortable($element, $options=array()) {
172 172
 		if (count($options)>0) {
173
-			$sort_options=array ();
174
-			foreach ( $options as $k => $v ) {
173
+			$sort_options=array();
174
+			foreach ($options as $k => $v) {
175 175
 				$sort_options[]="\n\t\t".$k.': '.$v."";
176 176
 			}
177 177
 			$sort_options=implode(",", $sort_options);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
204 204
 	 * @return string
205 205
 	 */
206
-	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
206
+	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
207 207
 		if (\is_array($js)) {
208 208
 			$js=implode("\n\t\t", $js);
209 209
 		}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
218 218
 		else
219 219
 			$event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
220
-		if($immediatly)
220
+		if ($immediatly)
221 221
 			$this->jquery_code_for_compile[]=$event;
222 222
 		return $event;
223 223
 	}
@@ -243,29 +243,29 @@  discard block
 block discarded – undo
243 243
 		$script='$(document).ready(function() {'."\n";
244 244
 		$script.=implode('', $this->jquery_code_for_compile);
245 245
 		$script.='})';
246
-		if($this->params["defer"]){
246
+		if ($this->params["defer"]) {
247 247
 			$script=$this->defer($script);
248 248
 		}
249 249
 		$script.=";";
250 250
 		$this->jquery_code_for_compile=array();
251
-		if($this->params["debug"]===false){
251
+		if ($this->params["debug"]===false) {
252 252
 			$script=$this->minify($script);
253 253
 		}
254 254
 		$output=($script_tags===FALSE) ? $script : $this->inline($script);
255 255
 
256
-		if ($view!==NULL){
257
-			$this->jsUtils->createScriptVariable($view,$view_var, $output);
256
+		if ($view!==NULL) {
257
+			$this->jsUtils->createScriptVariable($view, $view_var, $output);
258 258
 		}
259 259
 		return $output;
260 260
 	}
261 261
 
262
-	private function defer($script){
262
+	private function defer($script) {
263 263
 		$result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};";
264 264
 		$result.="window.defer(function(){".$script."})";
265 265
 		return $result;
266 266
 	}
267 267
 
268
-	private function _compileLibrary($library){
268
+	private function _compileLibrary($library) {
269 269
 		if ($library!=NULL) {
270 270
 			if ($library->isAutoCompile()) {
271 271
 				$library->compile(true);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @return void
284 284
 	 */
285 285
 	public function _clear_compile() {
286
-		$this->jquery_code_for_compile=array ();
286
+		$this->jquery_code_for_compile=array();
287 287
 	}
288 288
 
289 289
 	/**
@@ -292,18 +292,18 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public function _document_ready($js) {
294 294
 		if (!is_array($js)) {
295
-			$js=array (
295
+			$js=array(
296 296
 					$js
297 297
 			);
298 298
 		}
299 299
 
300
-		foreach ( $js as $script ) {
300
+		foreach ($js as $script) {
301 301
 			$this->jquery_code_for_compile[]=$script;
302 302
 		}
303 303
 	}
304 304
 
305 305
 	private function minify($input) {
306
-	if(trim($input) === "") return $input;
306
+	if (trim($input)==="") return $input;
307 307
 	return preg_replace(
308 308
 			array(
309 309
 					// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *
23 23
  */
24 24
 class DataTable extends Widget {
25
-	use TableTrait,DataTableFieldAsTrait;
25
+	use TableTrait, DataTableFieldAsTrait;
26 26
 	protected $_searchField;
27 27
 	protected $_urls;
28 28
 	protected $_pagination;
@@ -35,30 +35,30 @@  discard block
 block discarded – undo
35 35
 	protected $_targetSelector;
36 36
 	protected $_checkedMessage;
37 37
 
38
-	public function __construct($identifier,$model,$modelInstance=NULL) {
39
-		parent::__construct($identifier, $model,$modelInstance);
40
-		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false);
38
+	public function __construct($identifier, $model, $modelInstance=NULL) {
39
+		parent::__construct($identifier, $model, $modelInstance);
40
+		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
41 41
 		$this->_urls=[];
42 42
 	}
43 43
 
44
-	public function run(JsUtils $js){
45
-		if($this->_hasCheckboxes && isset($js)){
44
+	public function run(JsUtils $js) {
45
+		if ($this->_hasCheckboxes && isset($js)) {
46 46
 			$this->_runCheckboxes($js);
47 47
 		}
48
-		if($this->_visibleHover){
49
-			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
50
-			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
48
+		if ($this->_visibleHover) {
49
+			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]);
50
+			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]);
51 51
 		}
52
-		if(\is_array($this->_deleteBehavior))
53
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
54
-		if(\is_array($this->_editBehavior))
55
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
52
+		if (\is_array($this->_deleteBehavior))
53
+			$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
54
+		if (\is_array($this->_editBehavior))
55
+			$this->_generateBehavior("edit", $this->_editBehavior, $js);
56 56
 		return parent::run($js);
57 57
 	}
58 58
 
59
-	protected function _runCheckboxes(JsUtils $js){
59
+	protected function _runCheckboxes(JsUtils $js) {
60 60
 		$checkedMessageCall="";
61
-		if($this->_hasCheckedMessage){
61
+		if ($this->_hasCheckedMessage) {
62 62
 			$msg=$this->getCheckedMessage();
63 63
 			$checkedMessageFunction="function updateChecked(){var msg='".$msg[0]."',count=\$('#{$this->identifier} [name=\"selection[]\"]:checked').length,all=\$('#{$this->identifier} [name=\"selection[]\"]').length;
64 64
 			if(count==1) msg='".$msg[1]."';
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 						\$('#checked-count-".$this->identifier."').contents().filter(function() {return this.nodeType == 3;}).each(function(){this.textContent = msg.replace('{count}',count);});
67 67
 								\$('#toolbar-{$this->identifier} .visibleOnChecked').toggle(count>0);}\$('#toolbar-".$this->identifier." .visibleOnChecked').hide();";
68 68
 			$checkedMessageCall="updateChecked();";
69
-			$js->exec($checkedMessageFunction,true);
69
+			$js->exec($checkedMessageFunction, true);
70 70
 		}
71 71
 		$js->execOn("change", "#".$this->identifier." [name='selection[]']", "
72 72
 				var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true;
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 				if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');};".$checkedMessageCall);
75 75
 	}
76 76
 
77
-	protected function _generateBehavior($op,$params,JsUtils $js){
78
-		if(isset($this->_urls[$op])){
79
-			$params=\array_merge($params,["attr"=>"data-ajax"]);
80
-			$js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector(),$params);
77
+	protected function _generateBehavior($op, $params, JsUtils $js) {
78
+		if (isset($this->_urls[$op])) {
79
+			$params=\array_merge($params, ["attr"=>"data-ajax"]);
80
+			$js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector(), $params);
81 81
 		}
82 82
 	}
83 83
 
@@ -90,70 +90,70 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 
93
-	public function compile(JsUtils $js=NULL,&$view=NULL){
94
-		if(!$this->_generated){
93
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
94
+		if (!$this->_generated) {
95 95
 			$this->_instanceViewer->setInstance($this->_model);
96 96
 			$captions=$this->_instanceViewer->getCaptions();
97 97
 
98 98
 			$table=$this->content["table"];
99 99
 
100
-			if($this->_hasCheckboxes){
100
+			if ($this->_hasCheckboxes) {
101 101
 				$this->_generateMainCheckbox($captions);
102 102
 			}
103 103
 
104 104
 			$table->setRowCount(0, \sizeof($captions));
105 105
 			$table->setHeaderValues($captions);
106
-			if(isset($this->_compileParts))
106
+			if (isset($this->_compileParts))
107 107
 				$table->setCompileParts($this->_compileParts);
108 108
 
109
-			if(isset($this->_searchField) && isset($js)){
110
-				if(isset($this->_urls["refresh"]))
111
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
109
+			if (isset($this->_searchField) && isset($js)) {
110
+				if (isset($this->_urls["refresh"]))
111
+					$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
112 112
 			}
113 113
 
114 114
 			$this->_generateContent($table);
115 115
 
116
-			if($this->_hasCheckboxes && $table->hasPart("thead")){
116
+			if ($this->_hasCheckboxes && $table->hasPart("thead")) {
117 117
 					$table->getHeader()->getCell(0, 0)->addClass("no-sort");
118 118
 			}
119 119
 
120
-			if(isset($this->_pagination) && $this->_pagination->getVisible()){
120
+			if (isset($this->_pagination) && $this->_pagination->getVisible()) {
121 121
 				$this->_generatePagination($table);
122 122
 			}
123
-			if(isset($this->_toolbar)){
123
+			if (isset($this->_toolbar)) {
124 124
 				$this->_setToolbarPosition($table, $captions);
125 125
 			}
126
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
126
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
127 127
 			$this->_compileForm();
128 128
 			$this->_generated=true;
129 129
 		}
130
-		return parent::compile($js,$view);
130
+		return parent::compile($js, $view);
131 131
 	}
132 132
 
133
-	private function _generateMainCheckbox(&$captions){
134
-		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
133
+	private function _generateMainCheckbox(&$captions) {
134
+		$ck=new HtmlCheckbox("main-ck-".$this->identifier, "");
135 135
 		$checkedMessageCall="";
136
-		if($this->_hasCheckedMessage)
136
+		if ($this->_hasCheckedMessage)
137 137
 			$checkedMessageCall="updateChecked();";
138 138
 		$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);".$checkedMessageCall);
139 139
 		$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);".$checkedMessageCall);
140 140
 		\array_unshift($captions, $ck);
141 141
 	}
142 142
 
143
-	protected function _generateContent($table){
143
+	protected function _generateContent($table) {
144 144
 		$objects=$this->_modelInstance;
145
-		if(isset($this->_pagination)){
145
+		if (isset($this->_pagination)) {
146 146
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
147 147
 		}
148 148
 		InstanceViewer::setIndex(0);
149 149
 		$table->fromDatabaseObjects($objects, function($instance) use($table){
150 150
 			$this->_instanceViewer->setInstance($instance);
151 151
 			InstanceViewer::$index++;
152
-			$values= $this->_instanceViewer->getValues();
153
-			if($this->_hasCheckboxes){
154
-				$ck=new HtmlCheckbox("ck-".$this->identifier,"");
152
+			$values=$this->_instanceViewer->getValues();
153
+			if ($this->_hasCheckboxes) {
154
+				$ck=new HtmlCheckbox("ck-".$this->identifier, "");
155 155
 				$field=$ck->getField();
156
-				$field->setProperty("value",$this->_instanceViewer->getIdentifier());
156
+				$field->setProperty("value", $this->_instanceViewer->getIdentifier());
157 157
 				$field->setProperty("name", "selection[]");
158 158
 				\array_unshift($values, $ck);
159 159
 			}
@@ -164,37 +164,37 @@  discard block
 block discarded – undo
164 164
 		});
165 165
 	}
166 166
 
167
-	private function _generatePagination($table){
167
+	private function _generatePagination($table) {
168 168
 		$footer=$table->getFooter();
169 169
 		$footer->mergeCol();
170
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
170
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
171 171
 		$menu->floatRight();
172 172
 		$menu->setActiveItem($this->_pagination->getPage()-1);
173 173
 		$footer->setValues($menu);
174
-		if(isset($this->_urls["refresh"]))
175
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
174
+		if (isset($this->_urls["refresh"]))
175
+			$menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
176 176
 	}
177 177
 
178
-	protected function _getFieldName($index){
178
+	protected function _getFieldName($index) {
179 179
 		return parent::_getFieldName($index)."[]";
180 180
 	}
181 181
 
182
-	protected function _getFieldCaption($index){
182
+	protected function _getFieldCaption($index) {
183 183
 		return null;
184 184
 	}
185 185
 
186
-	protected function _setToolbarPosition($table,$captions=NULL){
187
-		switch ($this->_toolbarPosition){
186
+	protected function _setToolbarPosition($table, $captions=NULL) {
187
+		switch ($this->_toolbarPosition) {
188 188
 			case PositionInTable::BEFORETABLE:
189 189
 			case PositionInTable::AFTERTABLE:
190
-				if(isset($this->_compileParts)===false){
190
+				if (isset($this->_compileParts)===false) {
191 191
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
192 192
 				}
193 193
 				break;
194 194
 			case PositionInTable::HEADER:
195 195
 			case PositionInTable::FOOTER:
196 196
 			case PositionInTable::BODY:
197
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
197
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
198 198
 				break;
199 199
 		}
200 200
 	}
@@ -206,23 +206,23 @@  discard block
 block discarded – undo
206 206
 	 * @param callable $callback function called after the field compilation
207 207
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
208 208
 	 */
209
-	public function afterCompile($index,$callback){
210
-		$this->_instanceViewer->afterCompile($index,$callback);
209
+	public function afterCompile($index, $callback) {
210
+		$this->_instanceViewer->afterCompile($index, $callback);
211 211
 		return $this;
212 212
 	}
213 213
 
214
-	private function addToolbarRow($part,$table,$captions){
214
+	private function addToolbarRow($part, $table, $captions) {
215 215
 		$hasPart=$table->hasPart($part);
216
-		if($hasPart){
216
+		if ($hasPart) {
217 217
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
218
-		}else{
218
+		} else {
219 219
 			$row=$table->getPart($part)->getRow(0);
220 220
 		}
221 221
 		$row->mergeCol();
222 222
 		$row->setValues([$this->_toolbar]);
223 223
 	}
224 224
 
225
-	public function getHtmlComponent(){
225
+	public function getHtmlComponent() {
226 226
 		return $this->content["table"];
227 227
 	}
228 228
 
@@ -236,18 +236,18 @@  discard block
 block discarded – undo
236 236
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
237 237
 	 */
238 238
 	public function setUrls($urls) {
239
-		if(\is_array($urls)){
240
-			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
241
-			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
242
-			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
243
-		}else{
244
-			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
239
+		if (\is_array($urls)) {
240
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
241
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
242
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
243
+		} else {
244
+			$this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls];
245 245
 		}
246 246
 		return $this;
247 247
 	}
248 248
 
249
-	public function paginate($items_per_page=10,$page=1){
250
-		$this->_pagination=new Pagination($items_per_page,4,$page);
249
+	public function paginate($items_per_page=10, $page=1) {
250
+		$this->_pagination=new Pagination($items_per_page, 4, $page);
251 251
 	}
252 252
 
253 253
 	public function getHasCheckboxes() {
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
 		return $this;
260 260
 	}
261 261
 
262
-	public function refresh($compileParts=["tbody"]){
262
+	public function refresh($compileParts=["tbody"]) {
263 263
 		$this->_compileParts=$compileParts;
264 264
 		return $this;
265 265
 	}
266 266
 
267 267
 
268
-	public function addSearchInToolbar($position=Direction::RIGHT){
268
+	public function addSearchInToolbar($position=Direction::RIGHT) {
269 269
 		return $this->addInToolbar($this->getSearchField())->setPosition($position);
270 270
 	}
271 271
 
272
-	public function getSearchField(){
273
-		if(isset($this->_searchField)===false){
274
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
275
-			$this->_searchField->addIcon("search",Direction::RIGHT);
272
+	public function getSearchField() {
273
+		if (isset($this->_searchField)===false) {
274
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
275
+			$this->_searchField->addIcon("search", Direction::RIGHT);
276 276
 		}
277 277
 		return $this->_searchField;
278 278
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		return $this;
289 289
 	}
290 290
 
291
-	public function asForm(){
291
+	public function asForm() {
292 292
 		return $this->getForm();
293 293
 	}
294 294
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
 	protected function getTargetSelector() {
298 298
 		$result=$this->_targetSelector;
299
-		if(!isset($result))
299
+		if (!isset($result))
300 300
 			$result="#".$this->identifier;
301 301
 		return $result;
302 302
 	}
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
 	}
313 313
 
314 314
 	protected function getCheckedMessage() {
315
-		$result= $this->_checkedMessage;
316
-		if(!isset($result)){
317
-			$result=[0=>"none selected",1=>"one item selected","other"=>"{count} items selected"];
315
+		$result=$this->_checkedMessage;
316
+		if (!isset($result)) {
317
+			$result=[0=>"none selected", 1=>"one item selected", "other"=>"{count} items selected"];
318 318
 		}
319 319
 		return $result;
320 320
 	}
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 	 * @param array $checkedMessage
335 335
 	 * @param callable $callback
336 336
 	 */
337
-	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
338
-		if(isset($checkedMessage))
337
+	public function addCountCheckedInToolbar(array $checkedMessage=null, $callback=null) {
338
+		if (isset($checkedMessage))
339 339
 			$this->_checkedMessage=$checkedMessage;
340 340
 		$checkedMessage=$this->getCheckedMessage();
341 341
 		$this->_hasCheckboxes=true;
342 342
 		$this->_hasCheckedMessage=true;
343
-		$element=new HtmlLabel("checked-count-".$this->identifier,$checkedMessage[0]);
344
-		$this->addInToolbar($element,$callback);
343
+		$element=new HtmlLabel("checked-count-".$this->identifier, $checkedMessage[0]);
344
+		$this->addInToolbar($element, $callback);
345 345
 	}
346 346
 
347 347
 
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @param string $jsCallback javascript code to execute after the request
72 72
 	 */
73 73
 	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL) {
74
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, NULL,true);
74
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, NULL, true);
75 75
 	}
76 76
 
77 77
 	/**
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 * @param string $url the request url
94 94
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
95 95
 	 */
96
-	public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) {
97
-		return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters);
96
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
97
+		return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters);
98 98
 	}
99 99
 
100 100
 	/**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
109 109
 	 * @param string|callable $ajaxTransition
110 110
 	 */
111
-	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) {
112
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false,$jqueryDone,$ajaxTransition);
111
+	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) {
112
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition);
113 113
 	}
114 114
 
115 115
 	/**
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
149 149
 	 * @param string|callable $ajaxTransition
150 150
 	 */
151
-	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
152
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
151
+	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
152
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
153 153
 	}
154 154
 
155 155
 	/**
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
165 165
 	 * @param string|callable $ajaxTransition
166 166
 	 */
167
-	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
168
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
167
+	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
168
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
169 169
 	}
170 170
 
171 171
 	/**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
180 180
 	 */
181 181
 	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
182
-		return $this->js->_postOn($event, $element,  $url, $params, $responseElement, $parameters);
182
+		return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters);
183 183
 	}
184 184
 
185 185
 	/**
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
206 206
 	 * @param string|callable $ajaxTransition
207 207
 	 */
208
-	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
209
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
208
+	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
209
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
210 210
 	}
211 211
 
212 212
 	/**
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
222 222
 	 * @param string|callable $ajaxTransition
223 223
 	 */
224
-	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
225
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
224
+	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
225
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
226 226
 	}
227 227
 
228 228
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
237 237
 	 */
238 238
 	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
239
-		return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters);
239
+		return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters);
240 240
 	}
241 241
 
242 242
 	/**
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
 	 * @param string $context jquery DOM element, array container.
165 165
 	 * @param boolean $immediatly
166 166
 	 */
167
-	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) {
167
+	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) {
168 168
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
169 169
 		$retour=$this->_getAjaxUrl($url, $attr);
170
-		if($context===null){
170
+		if ($context===null) {
171 171
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
172
-			$newElm = "$('#'+newId)";
173
-		}else{
172
+			$newElm="$('#'+newId)";
173
+		} else {
174 174
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
175
-			$newElm = $context.".find('#'+newId)";
175
+			$newElm=$context.".find('#'+newId)";
176 176
 		}
177 177
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
178 178
 		$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();newElm.attr('id',newId);\n";
179
-		$retour.= $appendTo;
179
+		$retour.=$appendTo;
180 180
 		$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";
181 181
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
182 182
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -191,30 +191,30 @@  discard block
 block discarded – undo
191 191
 	 * @param string $url the request address
192 192
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null)
193 193
 	 */
194
-	public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) {
194
+	public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
195 195
 		$preventDefault=true;
196 196
 		$stopPropagation=true;
197 197
 		$jsCallback=null;
198 198
 		$attr="id";
199 199
 		$method="get";
200
-		$context = null;
200
+		$context=null;
201 201
 		$params="{}";
202 202
 		$immediatly=true;
203 203
 		extract($parameters);
204
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
204
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
205 205
 	}
206 206
 
207
-	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
207
+	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
208 208
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
209 209
 		$retour=$this->_getAjaxUrl($url, $attr);
210 210
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
211 211
 		$responseElement=$this->_getResponseElement($responseElement);
212 212
 		$retour.="var self=this;\n";
213
-		if($hasLoader===true){
213
+		if ($hasLoader===true) {
214 214
 			$this->addLoading($retour, $responseElement);
215 215
 		}
216 216
 		$retour.="$.post(url,params).done(function( data ) {\n";
217
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
217
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
218 218
 
219 219
 		if ($validation) {
220 220
 			$retour="$('#".$form."').validate({submitHandler: function(form) {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @param string $responseElement
238 238
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"jqueryDone"=>"html")
239 239
 	 */
240
-	public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
240
+	public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
241 241
 		$preventDefault=true;
242 242
 		$stopPropagation=true;
243 243
 		$jsCallback=null;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		$jqueryDone="html";
248 248
 		$ajaxTransition=null;
249 249
 		extract($parameters);
250
-		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
250
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
251 251
 	}
252 252
 
253 253
 	/**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @param string $responseElement
261 261
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null)
262 262
 	 */
263
-	public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
263
+	public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
264 264
 		$preventDefault=true;
265 265
 		$stopPropagation=true;
266 266
 		$jsCallback=null;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		$jqueryDone="html";
271 271
 		$ajaxTransition=null;
272 272
 		extract($parameters);
273
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
273
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
274 274
 	}
275 275
 
276 276
 	/**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @param string $responseElement
284 284
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"immediatly"=>true)
285 285
 	 */
286
-	public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) {
286
+	public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
287 287
 		$preventDefault=true;
288 288
 		$stopPropagation=true;
289 289
 		$validation=false;
@@ -294,6 +294,6 @@  discard block
 block discarded – undo
294 294
 		$jqueryDone="html";
295 295
 		$ajaxTransition=null;
296 296
 		extract($parameters);
297
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
297
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
298 298
 	}
299 299
 }
300 300
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/service/JString.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,37 +2,37 @@
 block discarded – undo
2 2
 namespace Ajax\service;
3 3
 class JString {
4 4
 
5
-	public static function contains($hay,$needle){
6
-		return strpos($hay, $needle) !== false;
5
+	public static function contains($hay, $needle) {
6
+		return strpos($hay, $needle)!==false;
7 7
 	}
8 8
 	public static function startswith($hay, $needle) {
9
-		return substr($hay, 0, strlen($needle)) === $needle;
9
+		return substr($hay, 0, strlen($needle))===$needle;
10 10
 	}
11 11
 
12 12
 	public static function endswith($hay, $needle) {
13
-		return substr($hay, -strlen($needle)) === $needle;
13
+		return substr($hay, -strlen($needle))===$needle;
14 14
 	}
15 15
 
16
-	public static function isNull($s){
16
+	public static function isNull($s) {
17 17
 		return (!isset($s) || NULL===$s || ""===$s);
18 18
 	}
19
-	public static function isNotNull($s){
19
+	public static function isNotNull($s) {
20 20
 		return (isset($s) && NULL!==$s && ""!==$s);
21 21
 	}
22 22
 
23
-	public static function isBoolean($value){
23
+	public static function isBoolean($value) {
24 24
 		return \is_bool($value) || $value==1 || $value==0;
25 25
 	}
26 26
 
27
-	public static function isBooleanTrue($value){
27
+	public static function isBooleanTrue($value) {
28 28
 		return $value==1 || $value;
29 29
 	}
30 30
 
31
-	public static function isBooleanFalse($value){
31
+	public static function isBooleanFalse($value) {
32 32
 		return $value==0 || !$value;
33 33
 	}
34 34
 
35
-	public static function camelCaseToSeparated($input,$separator=" "){
35
+	public static function camelCaseToSeparated($input, $separator=" ") {
36 36
 		return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input));
37 37
 	}
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/service/AjaxTransition.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,26 +3,26 @@
 block discarded – undo
3 3
 use Ajax\semantic\html\base\constants\Transition;
4 4
 
5 5
 class AjaxTransition {
6
-	public static function none($responseElement,$jqueryDone="html"){
6
+	public static function none($responseElement, $jqueryDone="html") {
7 7
 		return "$({$responseElement}).{$jqueryDone}( data )";
8 8
 	}
9 9
 
10
-	public static function jqFade($responseElement,$jqueryDone="html"){
10
+	public static function jqFade($responseElement, $jqueryDone="html") {
11 11
 		return "$({$responseElement}).hide().{$jqueryDone}( data ).fadeIn()";
12 12
 	}
13 13
 
14
-	public static function jqSlide($responseElement,$jqueryDone="html"){
14
+	public static function jqSlide($responseElement, $jqueryDone="html") {
15 15
 		return "$({$responseElement}).hide().{$jqueryDone}( data ).slideDown()";
16 16
 	}
17 17
 
18
-	public static function random($responseElement,$jqueryDone="html"){
18
+	public static function random($responseElement, $jqueryDone="html") {
19 19
 		$transitions=Transition::getConstantValues();
20
-		$transition=$transitions[\rand(0,\sizeof($transitions)-1)];
21
-		return self::__callStatic($transition, [$responseElement,$jqueryDone]);
20
+		$transition=$transitions[\rand(0, \sizeof($transitions)-1)];
21
+		return self::__callStatic($transition, [$responseElement, $jqueryDone]);
22 22
 	}
23 23
 
24
-	public static function __callStatic($name, $arguments){
25
-		if(\sizeof($arguments)==2){
24
+	public static function __callStatic($name, $arguments) {
25
+		if (\sizeof($arguments)==2) {
26 26
 			$responseElement=$arguments[0];
27 27
 			$jqueryDone=$arguments[1];
28 28
 			$name=JString::camelCaseToSeparated($name);
Please login to merge, or discard this patch.
Ajax/semantic/html/base/constants/Transition.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 block discarded – undo
3 3
 use Ajax\common\BaseEnum;
4 4
 abstract class Transition extends BaseEnum {
5 5
 	const SCALE="scale",
6
-	FADE="fade",FADE_UP="fadeUp",FADE_DOWN="fadeDown",FADE_LEFT="fadeLeft",FADE_RIGHT="fadeRight",
7
-	HORIZONTAL_FLIP="horizontalFlip",VERTICAL_FLIP="verticalFlip",
6
+	FADE="fade", FADE_UP="fadeUp", FADE_DOWN="fadeDown", FADE_LEFT="fadeLeft", FADE_RIGHT="fadeRight",
7
+	HORIZONTAL_FLIP="horizontalFlip", VERTICAL_FLIP="verticalFlip",
8 8
 	DROP="drop",
9
-	FLY_LEFT="flyLeft",FLY_RIGHT="flyRight",FLY_UP="flyUp",FLY_DOWN="flyDown",
10
-	SWING_LEFT="swingLeft",SWING_RIGHT="swingRight",SWING_UP="swingUp",SWING_DOWN="swingDown",
11
-	BROWSE="browse",BROWSE_RIGHT="browseRight",
12
-	SLIDE_LEFT="slideLeft",SLIDE_RIGHT="slideRight",SLIDE_UP="slideUp",SLIDE_DOWN="slideDown",
13
-	JIGGLE="jiggle",FLASH="flash",SHAKE="shake",PULSE="pulse",TADA="tada",BOUNCE="bounce";
9
+	FLY_LEFT="flyLeft", FLY_RIGHT="flyRight", FLY_UP="flyUp", FLY_DOWN="flyDown",
10
+	SWING_LEFT="swingLeft", SWING_RIGHT="swingRight", SWING_UP="swingUp", SWING_DOWN="swingDown",
11
+	BROWSE="browse", BROWSE_RIGHT="browseRight",
12
+	SLIDE_LEFT="slideLeft", SLIDE_RIGHT="slideRight", SLIDE_UP="slideUp", SLIDE_DOWN="slideDown",
13
+	JIGGLE="jiggle", FLASH="flash", SHAKE="shake", PULSE="pulse", TADA="tada", BOUNCE="bounce";
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.