Completed
Push — master ( 238349...a91c54 )
by Jean-Christophe
03:22
created
Ajax/semantic/widgets/datatable/DataTableFieldAsTrait.php 3 patches
Doc Comments   +34 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,15 +15,28 @@  discard block
 block discarded – undo
15 15
  * @property InstanceViewer $_instanceViewer
16 16
  */
17 17
 trait DataTableFieldAsTrait{
18
+
19
+	/**
20
+	 * @param \Closure $field
21
+	 */
18 22
 	abstract public function addField($field);
23
+
24
+	/**
25
+	 * @param integer $index
26
+	 * @param \Closure $field
27
+	 */
19 28
 	abstract public function insertField($index,$field);
29
+
30
+	/**
31
+	 * @param \Closure $field
32
+	 */
20 33
 	abstract public function insertInField($index,$field);
21 34
 	abstract public function fieldAs($index,$type,$attributes=NULL);
22 35
 	/**
23 36
 	 * @param string $caption
24 37
 	 * @param callable $callback
25 38
 	 * @param boolean $visibleHover
26
-	 * @return callable
39
+	 * @return \Closure
27 40
 	 */
28 41
 	private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){
29 42
 		return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback);
@@ -33,7 +46,7 @@  discard block
 block discarded – undo
33 46
 	 * @param callable $thisCallback
34 47
 	 * @param array $parameters
35 48
 	 * @param callable $callback
36
-	 * @return callable
49
+	 * @return \Closure
37 50
 	 */
38 51
 	private function getCallable($thisCallback,$parameters,$callback=null){
39 52
 		$result=function($instance) use($thisCallback,$parameters,$callback){
@@ -103,7 +116,7 @@  discard block
 block discarded – undo
103 116
 	 * @param string $caption
104 117
 	 * @param callable $callback
105 118
 	 * @param boolean $visibleHover
106
-	 * @return DataTable
119
+	 * @return DataTableFieldAsTrait
107 120
 	 */
108 121
 	public function addFieldButton($caption,$visibleHover=true,$callback=null){
109 122
 		$this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback));
@@ -115,7 +128,7 @@  discard block
 block discarded – undo
115 128
 	 * @param array $buttons
116 129
 	 * @param callable $callback
117 130
 	 * @param boolean $visibleHover
118
-	 * @return DataTable
131
+	 * @return DataTableFieldAsTrait
119 132
 	 */
120 133
 	public function addFieldButtons($buttons,$visibleHover=true,$callback=null){
121 134
 		$this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback));
@@ -127,7 +140,7 @@  discard block
 block discarded – undo
127 140
 	 * @param int $index
128 141
 	 * @param string $caption
129 142
 	 * @param callable $callback
130
-	 * @return DataTable
143
+	 * @return DataTableFieldAsTrait
131 144
 	 */
132 145
 	public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){
133 146
 		$this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
@@ -139,18 +152,27 @@  discard block
 block discarded – undo
139 152
 	 * @param int $index
140 153
 	 * @param string $caption
141 154
 	 * @param callable $callback
142
-	 * @return DataTable
155
+	 * @return DataTableFieldAsTrait
143 156
 	 */
144 157
 	public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){
145 158
 		$this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
146 159
 		return $this;
147 160
 	}
148 161
 
162
+	/**
163
+	 * @param string $icon
164
+	 * @param string $class
165
+	 * @param callable $callback
166
+	 */
149 167
 	private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){
150 168
 		$this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
151 169
 		return $this;
152 170
 	}
153 171
 
172
+	/**
173
+	 * @param string $icon
174
+	 * @param string $class
175
+	 */
154 176
 	private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){
155 177
 		$this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
156 178
 		return $this;
@@ -169,7 +191,7 @@  discard block
 block discarded – undo
169 191
 	 * @param boolean $visibleHover
170 192
 	 * @param array $deleteBehavior default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"data-ajax","params"=>"{}","method"=>"get")
171 193
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
172
-	 * @return DataTable
194
+	 * @return DataTableFieldAsTrait
173 195
 	 */
174 196
 	public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){
175 197
 		$this->_deleteBehavior=$deleteBehavior;
@@ -181,7 +203,7 @@  discard block
 block discarded – undo
181 203
 	 * @param string $visibleHover
182 204
 	 * @param array $editBehavior default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"data-ajax","params"=>"{}","method"=>"get")
183 205
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
184
-	 * @return DataTable
206
+	 * @return DataTableFieldAsTrait
185 207
 	 */
186 208
 	public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){
187 209
 		$this->_editBehavior=$editBehavior;
@@ -194,7 +216,7 @@  discard block
 block discarded – undo
194 216
 	 * @param array $behavior default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"data-ajax","params"=>"{}","method"=>"get")
195 217
 	 * @param callable $callbackEdit this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
196 218
 	 * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
197
-	 * @return DataTable
219
+	 * @return DataTableFieldAsTrait
198 220
 	 */
199 221
 	public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){
200 222
 		$this->addEditButton($visibleHover,$behavior,$callbackEdit);
@@ -203,6 +225,9 @@  discard block
 block discarded – undo
203 225
 		return $this;
204 226
 	}
205 227
 
228
+	/**
229
+	 * @param callable $callback
230
+	 */
206 231
 	public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){
207 232
 		$this->_deleteBehavior=$deleteBehavior;
208 233
 		return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback);
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
  * @property boolean $_visibleHover
15 15
  * @property InstanceViewer $_instanceViewer
16 16
  */
17
-trait DataTableFieldAsTrait{
17
+trait DataTableFieldAsTrait {
18 18
 	abstract public function addField($field);
19
-	abstract public function insertField($index,$field);
20
-	abstract public function insertInField($index,$field);
21
-	abstract public function fieldAs($index,$type,$attributes=NULL);
19
+	abstract public function insertField($index, $field);
20
+	abstract public function insertInField($index, $field);
21
+	abstract public function fieldAs($index, $type, $attributes=NULL);
22 22
 	/**
23 23
 	 * @param string $caption
24 24
 	 * @param callable $callback
25 25
 	 * @param boolean $visibleHover
26 26
 	 * @return callable
27 27
 	 */
28
-	private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){
29
-		return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback);
28
+	private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) {
29
+		return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback);
30 30
 	}
31 31
 
32 32
 	/**
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
 	 * @param callable $callback
36 36
 	 * @return callable
37 37
 	 */
38
-	private function getCallable($thisCallback,$parameters,$callback=null){
39
-		$result=function($instance) use($thisCallback,$parameters,$callback){
40
-			$object=call_user_func_array(array($this,$thisCallback), $parameters);
41
-			if(isset($callback)){
42
-				if(\is_callable($callback)){
43
-					$callback($object,$instance,$this->_instanceViewer->count()+1);
38
+	private function getCallable($thisCallback, $parameters, $callback=null) {
39
+		$result=function($instance) use($thisCallback, $parameters, $callback){
40
+			$object=call_user_func_array(array($this, $thisCallback), $parameters);
41
+			if (isset($callback)) {
42
+				if (\is_callable($callback)) {
43
+					$callback($object, $instance, $this->_instanceViewer->count()+1);
44 44
 				}
45 45
 			}
46
-			if($object instanceof HtmlSemDoubleElement){
46
+			if ($object instanceof HtmlSemDoubleElement) {
47 47
 				$id=$this->_instanceViewer->getIdentifier();
48
-				$object->setProperty("data-ajax",$id);
49
-				if($object->propertyContains("class","visibleover")){
48
+				$object->setProperty("data-ajax", $id);
49
+				if ($object->propertyContains("class", "visibleover")) {
50 50
 					$this->_visibleHover=true;
51
-					$object->setProperty("style","visibility:hidden;");
51
+					$object->setProperty("style", "visibility:hidden;");
52 52
 				}
53 53
 			}
54 54
 			return $object;
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	 * @param string $caption
61 61
 	 * @return HtmlButton
62 62
 	 */
63
-	private function getFieldButton($caption,$visibleHover=true){
64
-		$bt= new HtmlButton("",$caption);
65
-		if($visibleHover)
63
+	private function getFieldButton($caption, $visibleHover=true) {
64
+		$bt=new HtmlButton("", $caption);
65
+		if ($visibleHover)
66 66
 			$this->_visibleOver($bt);
67 67
 		return $bt;
68 68
 	}
69 69
 
70
-	private function getFieldButtons($buttons,$visibleHover=true){
71
-		$bts=new HtmlButtonGroups("",$buttons);
72
-		if($visibleHover)
70
+	private function getFieldButtons($buttons, $visibleHover=true) {
71
+		$bts=new HtmlButtonGroups("", $buttons);
72
+		if ($visibleHover)
73 73
 			$this->_visibleOver($bts);
74 74
 		return $bts;
75 75
 	}
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
 	 * @param array $attributes associative array (<b>ajax</b> key is for ajax post)
84 84
 	 * @return DataTable
85 85
 	 */
86
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
87
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
88
-			$button=new HtmlButton($id,$value,$cssStyle);
89
-			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
90
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
86
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
87
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){
88
+			$button=new HtmlButton($id, $value, $cssStyle);
89
+			$button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]);
90
+			if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
91 91
 				$this->_visibleOver($button);
92 92
 				return $button;
93
-		}, $index,$attributes);
93
+		}, $index, $attributes);
94 94
 	}
95 95
 
96
-	protected function _visibleOver(BaseHtml $element){
96
+	protected function _visibleOver(BaseHtml $element) {
97 97
 		$this->_visibleHover=true;
98
-		return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;");
98
+		return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;");
99 99
 	}
100 100
 
101 101
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param boolean $visibleHover
106 106
 	 * @return DataTable
107 107
 	 */
108
-	public function addFieldButton($caption,$visibleHover=true,$callback=null){
109
-		$this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback));
108
+	public function addFieldButton($caption, $visibleHover=true, $callback=null) {
109
+		$this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback));
110 110
 		return $this;
111 111
 	}
112 112
 
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 * @param boolean $visibleHover
118 118
 	 * @return DataTable
119 119
 	 */
120
-	public function addFieldButtons($buttons,$visibleHover=true,$callback=null){
121
-		$this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback));
120
+	public function addFieldButtons($buttons, $visibleHover=true, $callback=null) {
121
+		$this->addField($this->getCallable("getFieldButtons", [$buttons, $visibleHover], $callback));
122 122
 		return $this;
123 123
 	}
124 124
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * @param callable $callback
130 130
 	 * @return DataTable
131 131
 	 */
132
-	public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){
133
-		$this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
132
+	public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) {
133
+		$this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
134 134
 		return $this;
135 135
 	}
136 136
 
@@ -141,25 +141,25 @@  discard block
 block discarded – undo
141 141
 	 * @param callable $callback
142 142
 	 * @return DataTable
143 143
 	 */
144
-	public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){
145
-		$this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
144
+	public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) {
145
+		$this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
146 146
 		return $this;
147 147
 	}
148 148
 
149
-	private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){
150
-		$this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
149
+	private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) {
150
+		$this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
151 151
 		return $this;
152 152
 	}
153 153
 
154
-	private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){
155
-		$this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
154
+	private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) {
155
+		$this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
156 156
 		return $this;
157 157
 	}
158 158
 
159
-	private function getDefaultButton($icon,$class=null,$visibleHover=true){
160
-		$bt=$this->getFieldButton("",$visibleHover);
159
+	private function getDefaultButton($icon, $class=null, $visibleHover=true) {
160
+		$bt=$this->getFieldButton("", $visibleHover);
161 161
 		$bt->asIcon($icon);
162
-		if(isset($class))
162
+		if (isset($class))
163 163
 			$bt->addClass($class);
164 164
 		return $bt;
165 165
 	}
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
172 172
 	 * @return DataTable
173 173
 	 */
174
-	public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){
174
+	public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) {
175 175
 		$this->_deleteBehavior=$deleteBehavior;
176
-		return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback);
176
+		return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback);
177 177
 	}
178 178
 
179 179
 	/**
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
184 184
 	 * @return DataTable
185 185
 	 */
186
-	public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){
186
+	public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) {
187 187
 		$this->_editBehavior=$editBehavior;
188
-		return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback);
188
+		return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback);
189 189
 	}
190 190
 
191 191
 	/**
@@ -196,20 +196,20 @@  discard block
 block discarded – undo
196 196
 	 * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
197 197
 	 * @return DataTable
198 198
 	 */
199
-	public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){
200
-		$this->addEditButton($visibleHover,$behavior,$callbackEdit);
199
+	public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) {
200
+		$this->addEditButton($visibleHover, $behavior, $callbackEdit);
201 201
 		$index=$this->_instanceViewer->visiblePropertiesCount()-1;
202
-		$this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete);
202
+		$this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete);
203 203
 		return $this;
204 204
 	}
205 205
 
206
-	public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){
206
+	public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) {
207 207
 		$this->_deleteBehavior=$deleteBehavior;
208
-		return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback);
208
+		return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback);
209 209
 	}
210 210
 
211
-	public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){
211
+	public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) {
212 212
 		$this->_editBehavior=$editBehavior;
213
-		return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback);
213
+		return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback);
214 214
 	}
215 215
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,15 +62,17 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	private function getFieldButton($caption,$visibleHover=true){
64 64
 		$bt= new HtmlButton("",$caption);
65
-		if($visibleHover)
66
-			$this->_visibleOver($bt);
65
+		if($visibleHover) {
66
+					$this->_visibleOver($bt);
67
+		}
67 68
 		return $bt;
68 69
 	}
69 70
 
70 71
 	private function getFieldButtons($buttons,$visibleHover=true){
71 72
 		$bts=new HtmlButtonGroups("",$buttons);
72
-		if($visibleHover)
73
-			$this->_visibleOver($bts);
73
+		if($visibleHover) {
74
+					$this->_visibleOver($bts);
75
+		}
74 76
 		return $bts;
75 77
 	}
76 78
 
@@ -87,8 +89,9 @@  discard block
 block discarded – undo
87 89
 		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){
88 90
 			$button=new HtmlButton($id,$value,$cssStyle);
89 91
 			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
90
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
91
-				$this->_visibleOver($button);
92
+			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) {
93
+							$this->_visibleOver($button);
94
+			}
92 95
 				return $button;
93 96
 		}, $index,$attributes);
94 97
 	}
@@ -159,8 +162,9 @@  discard block
 block discarded – undo
159 162
 	private function getDefaultButton($icon,$class=null,$visibleHover=true){
160 163
 		$bt=$this->getFieldButton("",$visibleHover);
161 164
 		$bt->asIcon($icon);
162
-		if(isset($class))
163
-			$bt->addClass($class);
165
+		if(isset($class)) {
166
+					$bt->addClass($class);
167
+		}
164 168
 		return $bt;
165 169
 	}
166 170
 
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButton.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
 	/**
49 49
 	 * define the button style
50
-	 * @param string|int $cssStyle
50
+	 * @param string $cssStyle
51 51
 	 * @return HtmlButton default : ""
52 52
 	 */
53 53
 	public function setStyle($cssStyle) {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public function setFocusable($value=true) {
58
-		if ($value === true)
58
+		if ($value===true)
59 59
 			$this->setProperty("tabindex", "0");
60 60
 		else {
61 61
 			$this->removeProperty("tabindex");
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 
66 66
 	public function setAnimated($content, $animation="") {
67 67
 		$this->setTagName("div");
68
-		$this->addToProperty("class", "animated " . $animation);
69
-		$visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div");
68
+		$this->addToProperty("class", "animated ".$animation);
69
+		$visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div");
70 70
 		$visible->setClass("visible content");
71 71
 		$visible->setContent($this->content);
72
-		$hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div");
72
+		$hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div");
73 73
 		$hidden->setClass("hidden content");
74 74
 		$hidden->setContent($content);
75
-		$this->content=array ($visible,$hidden );
75
+		$this->content=array($visible, $hidden);
76 76
 		return $hidden;
77 77
 	}
78 78
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	public function asIcon($icon) {
85 85
 		$iconO=$icon;
86 86
 		if (\is_string($icon)) {
87
-			$iconO=new HtmlIcon("icon-" . $this->identifier, $icon);
87
+			$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
88 88
 		}
89 89
 		$this->addToProperty("class", "icon");
90 90
 		$this->content=$iconO;
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 	 * @return HtmlLabel
105 105
 	 */
106 106
 	public function addLabel($label, $before=false, $icon=NULL) {
107
-		$this->tagName="div";$prefix="";
108
-		if($before)
107
+		$this->tagName="div"; $prefix="";
108
+		if ($before)
109 109
 			$prefix="left ";
110 110
 		$this->addToProperty("class", $prefix."labeled");
111 111
 		$isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon);
112
-		$this->content=new HtmlButton("button-" . $this->identifier, $this->content);
113
-		if($isIcon){
112
+		$this->content=new HtmlButton("button-".$this->identifier, $this->content);
113
+		if ($isIcon) {
114 114
 			$this->content->addClass("icon");
115 115
 		}
116 116
 		$this->content->setTagName("div");
117
-		$label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a");
117
+		$label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a");
118 118
 		$label->setBasic();
119 119
 		$this->addContent($label, $before);
120 120
 		return $label;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function fromArray($array) {
128 128
 		$array=parent::fromArray($array);
129
-		foreach ( $array as $key => $value ) {
129
+		foreach ($array as $key => $value) {
130 130
 			$this->setProperty($key, $value);
131 131
 		}
132 132
 		return $array;
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 		return $this->addToProperty("class", "positive");
141 141
 	}
142 142
 
143
-	public function setColor($color){
144
-		if(\is_array($this->content)){
145
-			foreach ($this->content as $content){
146
-				if($content instanceof HtmlButton)
143
+	public function setColor($color) {
144
+		if (\is_array($this->content)) {
145
+			foreach ($this->content as $content) {
146
+				if ($content instanceof HtmlButton)
147 147
 					$content->setColor($color);
148 148
 			}
149 149
 		}
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @return HtmlButton
202 202
 	 */
203 203
 	public static function social($identifier, $social, $value=NULL) {
204
-		if ($value === NULL)
204
+		if ($value===NULL)
205 205
 			$value=\ucfirst($social);
206 206
 		$return=new HtmlButton($identifier, $value);
207 207
 		$return->addIcon($social);
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * {@inheritDoc}
239 239
 	 * @see HtmlSemDoubleElement::asLink()
240 240
 	 */
241
-	public function asLink($href=NULL,$target=NULL) {
242
-		parent::asLink($href,$target);
241
+	public function asLink($href=NULL, $target=NULL) {
242
+		parent::asLink($href, $target);
243 243
 		return $this;
244 244
 	}
245 245
 
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 	 * @param string $icon
253 253
 	 * @return HtmlButtonGroups
254 254
 	 */
255
-	public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){
256
-		$result=new HtmlButtonGroups($identifier,[$value]);
257
-		$result->addDropdown($items,$asCombo);
258
-		if(isset($icon))
255
+	public static function dropdown($identifier, $value, $items=[], $asCombo=false, $icon=null) {
256
+		$result=new HtmlButtonGroups($identifier, [$value]);
257
+		$result->addDropdown($items, $asCombo);
258
+		if (isset($icon))
259 259
 			$result->setIcon($icon);
260 260
 		return $result;
261 261
 	}
Please login to merge, or discard this patch.
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public function setFocusable($value=true) {
58
-		if ($value === true)
59
-			$this->setProperty("tabindex", "0");
60
-		else {
58
+		if ($value === true) {
59
+					$this->setProperty("tabindex", "0");
60
+		} else {
61 61
 			$this->removeProperty("tabindex");
62 62
 		}
63 63
 		return $this;
@@ -105,8 +105,9 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function addLabel($label, $before=false, $icon=NULL) {
107 107
 		$this->tagName="div";$prefix="";
108
-		if($before)
109
-			$prefix="left ";
108
+		if($before) {
109
+					$prefix="left ";
110
+		}
110 111
 		$this->addToProperty("class", $prefix."labeled");
111 112
 		$isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon);
112 113
 		$this->content=new HtmlButton("button-" . $this->identifier, $this->content);
@@ -143,12 +144,13 @@  discard block
 block discarded – undo
143 144
 	public function setColor($color){
144 145
 		if(\is_array($this->content)){
145 146
 			foreach ($this->content as $content){
146
-				if($content instanceof HtmlButton)
147
-					$content->setColor($color);
147
+				if($content instanceof HtmlButton) {
148
+									$content->setColor($color);
149
+				}
148 150
 			}
151
+		} else {
152
+					parent::setColor($color);
149 153
 		}
150
-		else
151
-			parent::setColor($color);
152 154
 		return $this;
153 155
 	}
154 156
 
@@ -201,8 +203,9 @@  discard block
 block discarded – undo
201 203
 	 * @return HtmlButton
202 204
 	 */
203 205
 	public static function social($identifier, $social, $value=NULL) {
204
-		if ($value === NULL)
205
-			$value=\ucfirst($social);
206
+		if ($value === NULL) {
207
+					$value=\ucfirst($social);
208
+		}
206 209
 		$return=new HtmlButton($identifier, $value);
207 210
 		$return->addIcon($social);
208 211
 		return $return->addToPropertyCtrl("class", $social, Social::getConstants());
@@ -255,8 +258,9 @@  discard block
 block discarded – undo
255 258
 	public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){
256 259
 		$result=new HtmlButtonGroups($identifier,[$value]);
257 260
 		$result->addDropdown($items,$asCombo);
258
-		if(isset($icon))
259
-			$result->setIcon($icon);
261
+		if(isset($icon)) {
262
+					$result->setIcon($icon);
263
+		}
260 264
 		return $result;
261 265
 	}
262 266
 }
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsEventsTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 trait JsUtilsEventsTrait {
12 12
 
13 13
 
14
-	protected $jquery_events=array (
15
-			"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"
14
+	protected $jquery_events=array(
15
+			"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"
16 16
 	);
17 17
 
18
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
18
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
19 19
 
20 20
 	/**
21 21
 	 * Outputs a javascript library blur event
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param boolean $stopPropagation
50 50
 	 * @return string
51 51
 	 */
52
-	public function click($element='this', $js='', $ret_false=TRUE,$preventDefault=false,$stopPropagation=false) {
52
+	public function click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false) {
53 53
 		if (!is_array($js)) {
54
-			$js=array (
54
+			$js=array(
55 55
 					$js
56 56
 			);
57 57
 		}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			$js[]="return false;";
61 61
 		}
62 62
 
63
-		return $this->_add_event($element, $js, 'click',$preventDefault,$stopPropagation);
63
+		return $this->_add_event($element, $js, 'click', $preventDefault, $stopPropagation);
64 64
 	}
65 65
 
66 66
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlStep.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
 use Ajax\common\html\HtmlDoubleElement;
10 10
 use Ajax\semantic\html\base\constants\Side;
11 11
 
12
-class HtmlStep extends HtmlSemCollection{
12
+class HtmlStep extends HtmlSemCollection {
13 13
 	protected $_activeStep;
14 14
 	protected $_startStep;
15 15
 
16
-	public function __construct( $identifier,$steps=array()){
17
-		parent::__construct( $identifier,"div", "ui steps");
16
+	public function __construct($identifier, $steps=array()) {
17
+		parent::__construct($identifier, "div", "ui steps");
18 18
 		$this->addItems($steps);
19 19
 	}
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @see \Ajax\common\html\html5\HtmlCollection::createItem()
25 25
 	 */
26 26
 	protected function createItem($value) {
27
-		$itemO=new HtmlStepItem("item-".\sizeof($this->content),$value);
27
+		$itemO=new HtmlStepItem("item-".\sizeof($this->content), $value);
28 28
 		return $itemO;
29 29
 	}
30 30
 
@@ -32,50 +32,50 @@  discard block
 block discarded – undo
32 32
 	 * @param string|array $step
33 33
 	 * @return HtmlStepItem
34 34
 	 */
35
-	public function addStep($step){
35
+	public function addStep($step) {
36 36
 		return $this->addItem($step);
37 37
 	}
38 38
 
39
-	public function setOrdered(){
39
+	public function setOrdered() {
40 40
 		return $this->addToProperty("class", "ordered");
41 41
 	}
42 42
 
43
-	public function isOrdered(){
43
+	public function isOrdered() {
44 44
 		return $this->propertyContains("class", "ordered");
45 45
 	}
46 46
 
47
-	public function setVertical(){
47
+	public function setVertical() {
48 48
 		return $this->addToProperty("class", "vertical");
49 49
 	}
50 50
 
51
-	protected function defineActiveStep(){
51
+	protected function defineActiveStep() {
52 52
 		$activestep=$this->_activeStep;
53 53
 		$count=$this->count();
54
-		if(!$this->isOrdered()){
55
-			for($i=$this->_startStep;$i<$count;$i++){
54
+		if (!$this->isOrdered()) {
55
+			for ($i=$this->_startStep; $i<$count; $i++) {
56 56
 				$step=$this->content[$i];
57 57
 				$step->removeStatus();
58
-				if($i<$activestep)
58
+				if ($i<$activestep)
59 59
 					$step->setCompleted();
60 60
 				elseif ($i===$activestep)
61 61
 					$step->setActive();
62 62
 				else
63 63
 					$step->setDisabled();
64 64
 			}
65
-		}else{
66
-			foreach ($this->content as $step){
65
+		} else {
66
+			foreach ($this->content as $step) {
67 67
 				$step->removeStatus();
68 68
 			}
69
-			if($activestep<$count)
69
+			if ($activestep<$count)
70 70
 				$this->content[$activestep]->setActive();
71 71
 		}
72 72
 		return $this;
73 73
 	}
74 74
 
75 75
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
76
-		if(isset($this->_activeStep) && \is_numeric($this->_activeStep))
76
+		if (isset($this->_activeStep) && \is_numeric($this->_activeStep))
77 77
 			$this->defineActiveStep();
78
-		return parent::compile($js,$view);
78
+		return parent::compile($js, $view);
79 79
 	}
80 80
 
81 81
 	public function setActiveStep($_activeStep) {
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 		return $this;
84 84
 	}
85 85
 
86
-	public function setAttached($side="",HtmlDoubleElement $toElement=NULL){
87
-		if(isset($toElement)){
88
-			$toElement->addToPropertyCtrl("class", "attached",array("attached"));
86
+	public function setAttached($side="", HtmlDoubleElement $toElement=NULL) {
87
+		if (isset($toElement)) {
88
+			$toElement->addToPropertyCtrl("class", "attached", array("attached"));
89 89
 		}
90
-		return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
90
+		return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
91 91
 	}
92 92
 
93
-	public function asLink(){
94
-		foreach ($this->content as $step){
93
+	public function asLink() {
94
+		foreach ($this->content as $step) {
95 95
 			$step->asLink();
96 96
 		}
97 97
 		return $this;
Please login to merge, or discard this patch.
Braces   +14 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,26 +55,29 @@
 block discarded – undo
55 55
 			for($i=$this->_startStep;$i<$count;$i++){
56 56
 				$step=$this->content[$i];
57 57
 				$step->removeStatus();
58
-				if($i<$activestep)
59
-					$step->setCompleted();
60
-				elseif ($i===$activestep)
61
-					$step->setActive();
62
-				else
63
-					$step->setDisabled();
58
+				if($i<$activestep) {
59
+									$step->setCompleted();
60
+				} elseif ($i===$activestep) {
61
+									$step->setActive();
62
+				} else {
63
+									$step->setDisabled();
64
+				}
64 65
 			}
65
-		}else{
66
+		} else{
66 67
 			foreach ($this->content as $step){
67 68
 				$step->removeStatus();
68 69
 			}
69
-			if($activestep<$count)
70
-				$this->content[$activestep]->setActive();
70
+			if($activestep<$count) {
71
+							$this->content[$activestep]->setActive();
72
+			}
71 73
 		}
72 74
 		return $this;
73 75
 	}
74 76
 
75 77
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
76
-		if(isset($this->_activeStep) && \is_numeric($this->_activeStep))
77
-			$this->defineActiveStep();
78
+		if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) {
79
+					$this->defineActiveStep();
80
+		}
78 81
 		return parent::compile($js,$view);
79 82
 	}
80 83
 
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlListItem.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 	protected $image;
10 10
 
11 11
 	public function __construct($identifier, $content=NULL) {
12
-		parent::__construct($identifier,"item",$content);
12
+		parent::__construct($identifier, "item", $content);
13 13
 	}
14
-	protected function initContent($content){
15
-		if(\is_array($content)){
16
-			if(JArray::isAssociative($content)===false){
14
+	protected function initContent($content) {
15
+		if (\is_array($content)) {
16
+			if (JArray::isAssociative($content)===false) {
17 17
 				$icon=@$content[0];
18 18
 				$title=@$content[1];
19 19
 				$desc=@$content[2];
20
-			}else{
20
+			} else {
21 21
 				$icon=@$content["icon"];
22 22
 				$image=@$content["image"];
23 23
 				$title=@$content["title"];
@@ -25,38 +25,38 @@  discard block
 block discarded – undo
25 25
 				$desc=@$content["description"];
26 26
 				$items=@$content["items"];
27 27
 			}
28
-			if(isset($icon)){
28
+			if (isset($icon)) {
29 29
 				$this->setIcon($icon);
30 30
 			}
31
-			if(isset($image)){
31
+			if (isset($image)) {
32 32
 				$this->setImage($image);
33 33
 			}
34
-			if(isset($title)){
35
-				$this->setTitle($title,$desc);
36
-			}elseif (isset($header)){
37
-				$this->setTitle($header,$desc,"header");
34
+			if (isset($title)) {
35
+				$this->setTitle($title, $desc);
36
+			}elseif (isset($header)) {
37
+				$this->setTitle($header, $desc, "header");
38 38
 			}
39
-			if(isset($items)){
39
+			if (isset($items)) {
40 40
 				$this->addList($items);
41 41
 			}
42
-		}else{
42
+		} else {
43 43
 			$this->setContent($content);
44 44
 		}
45 45
 	}
46
-	public function addList($items=array(),$ordered=false) {
46
+	public function addList($items=array(), $ordered=false) {
47 47
 		$list=new HtmlList("", $items);
48
-		if($ordered)
48
+		if ($ordered)
49 49
 			$list->setOrdered();
50 50
 		$list->setClass("list");
51 51
 		$this->content["list"]=$list;
52 52
 		return $list;
53 53
 	}
54 54
 
55
-	public function getList(){
55
+	public function getList() {
56 56
 		return $this->content["list"];
57 57
 	}
58 58
 
59
-	public function getItem($index){
59
+	public function getItem($index) {
60 60
 		return $this->getList()->getItem($index);
61 61
 	}
62 62
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 				$icon=@$content[0];
18 18
 				$title=@$content[1];
19 19
 				$desc=@$content[2];
20
-			}else{
20
+			} else{
21 21
 				$icon=@$content["icon"];
22 22
 				$image=@$content["image"];
23 23
 				$title=@$content["title"];
@@ -33,20 +33,21 @@  discard block
 block discarded – undo
33 33
 			}
34 34
 			if(isset($title)){
35 35
 				$this->setTitle($title,$desc);
36
-			}elseif (isset($header)){
36
+			} elseif (isset($header)){
37 37
 				$this->setTitle($header,$desc,"header");
38 38
 			}
39 39
 			if(isset($items)){
40 40
 				$this->addList($items);
41 41
 			}
42
-		}else{
42
+		} else{
43 43
 			$this->setContent($content);
44 44
 		}
45 45
 	}
46 46
 	public function addList($items=array(),$ordered=false) {
47 47
 		$list=new HtmlList("", $items);
48
-		if($ordered)
49
-			$list->setOrdered();
48
+		if($ordered) {
49
+					$list->setOrdered();
50
+		}
50 51
 		$list->setClass("list");
51 52
 		$this->content["list"]=$list;
52 53
 		return $list;
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlPopup.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 class HtmlPopup extends HtmlSemDoubleElement {
13 13
 	private $_container;
14
-	public function __construct(BaseHtml $container,$identifier, $content="") {
14
+	public function __construct(BaseHtml $container, $identifier, $content="") {
15 15
 		parent::__construct($identifier, "div");
16 16
 		$this->_container=$container;
17 17
 		$this->setClass("ui popup");
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	 * {@inheritDoc}
24 24
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::addList()
25 25
 	 */
26
-	public function addList($items=array(),$header=NULL){
27
-		if(!$this->content instanceof HtmlGrid){
28
-			$this->content=new HtmlGrid("Grid-".$this->identifier,0);
26
+	public function addList($items=array(), $header=NULL) {
27
+		if (!$this->content instanceof HtmlGrid) {
28
+			$this->content=new HtmlGrid("Grid-".$this->identifier, 0);
29 29
 		}
30 30
 		$grid=$this->content;
31 31
 
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 		$colCount++;
34 34
 		$grid->setColsCount($colCount);
35 35
 
36
-		$list=new HtmlList("",$items);
36
+		$list=new HtmlList("", $items);
37 37
 		$list->asLink();
38
-		if(isset($header)){
39
-			$list->addHeader(4,$header);
38
+		if (isset($header)) {
39
+			$list->addHeader(4, $header);
40 40
 		}
41
-		$grid->getCell(0,$colCount-1)->setContent($list);
41
+		$grid->getCell(0, $colCount-1)->setContent($list);
42 42
 		$grid->setDivided()->setRelaxed(true);
43 43
 		return $list;
44 44
 	}
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * A popup can have no maximum width and continue to flow to fit its content
48 48
 	 */
49
-	public function setFlowing(){
49
+	public function setFlowing() {
50 50
 		return $this->addToProperty("class", "flowing");
51 51
 	}
52 52
 
53 53
 	/**
54 54
 	 * A popup can provide more basic formatting
55 55
 	 */
56
-	public function setBasic(){
56
+	public function setBasic() {
57 57
 		return $this->addToProperty("class", "basic");
58 58
 	}
59 59
 
@@ -61,23 +61,23 @@  discard block
 block discarded – undo
61 61
 	 * {@inheritDoc}
62 62
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
63 63
 	 */
64
-	public function run(JsUtils $js){
64
+	public function run(JsUtils $js) {
65 65
 		parent::run($js);
66 66
 		$this->_params["popup"]="#".$this->identifier;
67
-		$js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params);
67
+		$js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params);
68 68
 	}
69 69
 
70
-	public function setOn($event="click"){
70
+	public function setOn($event="click") {
71 71
 		$this->_params["on"]=$event;
72 72
 		return $this;
73 73
 	}
74 74
 
75
-	public function setInline($value=true){
75
+	public function setInline($value=true) {
76 76
 		$this->_params["inline"]=$value;
77 77
 		return $this;
78 78
 	}
79 79
 
80
-	public function setPosition($position){
80
+	public function setPosition($position) {
81 81
 		$this->_params["position"]=$position;
82 82
 		return $this;
83 83
 	}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 2 patches
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -16,18 +16,18 @@  discard block
 block discarded – undo
16 16
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
17 17
 
18 18
 	abstract public function getUrl($url);
19
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
19
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
20 20
 
21
-	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
21
+	protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
22 22
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
23 23
 		$retour=$this->_getAjaxUrl($url, $attr);
24 24
 		$responseElement=$this->_getResponseElement($responseElement);
25 25
 		$retour.="var self=this;\n";
26
-		if($hasLoader===true){
26
+		if ($hasLoader===true) {
27 27
 			$this->addLoading($retour, $responseElement);
28 28
 		}
29 29
 		$retour.="$.".$method."(url,".self::_correctParams($params).").done(function( data ) {\n";
30
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
30
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
31 31
 		if ($immediatly)
32 32
 			$this->jquery_code_for_compile[]=$retour;
33 33
 		return $retour;
@@ -35,33 +35,33 @@  discard block
 block discarded – undo
35 35
 
36 36
 
37 37
 
38
-	protected function _getAjaxUrl($url,$attr){
38
+	protected function _getAjaxUrl($url, $attr) {
39 39
 		$url=$this->_correctAjaxUrl($url);
40 40
 		$retour="url='".$url."';";
41 41
 		$slash="/";
42
-		if(JString::endswith($url, "/")===true)
42
+		if (JString::endswith($url, "/")===true)
43 43
 			$slash="";
44
-			if(JString::isNotNull($attr)){
44
+			if (JString::isNotNull($attr)) {
45 45
 				if ($attr==="value")
46 46
 					$retour.="url=url+'".$slash."'+$(this).val();\n";
47 47
 				elseif ($attr==="html")
48 48
 					$retour.="url=url+'".$slash."'+$(this).html();\n";
49
-				elseif($attr!==null && $attr!=="")
49
+				elseif ($attr!==null && $attr!=="")
50 50
 					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
51 51
 			}
52 52
 			return $retour;
53 53
 	}
54 54
 
55
-	protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$jsCallback){
56
-		$retour="";$call=null;
55
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) {
56
+		$retour=""; $call=null;
57 57
 		if ($responseElement!=="") {
58
-			if(isset($ajaxTransition)){
58
+			if (isset($ajaxTransition)) {
59 59
 				$call=$this->setAjaxDataCall($ajaxTransition);
60
-			}elseif(isset($this->ajaxTransition)){
60
+			}elseif (isset($this->ajaxTransition)) {
61 61
 				$call=$this->ajaxTransition;
62 62
 			}
63
-			if(\is_callable($call))
64
-				$retour="\t".$call($responseElement,$jqueryDone).";\n";
63
+			if (\is_callable($call))
64
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
65 65
 				else
66 66
 					$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
67 67
 		}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		return $retour;
70 70
 	}
71 71
 
72
-	protected function _getResponseElement($responseElement){
72
+	protected function _getResponseElement($responseElement) {
73 73
 		if ($responseElement!=="") {
74 74
 			$responseElement=Javascript::prep_value($responseElement);
75 75
 		}
@@ -79,26 +79,26 @@  discard block
 block discarded – undo
79 79
 	protected function _correctAjaxUrl($url) {
80 80
 		if ($url!=="/" && JString::endsWith($url, "/")===true)
81 81
 			$url=substr($url, 0, strlen($url)-1);
82
-			if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
82
+			if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
83 83
 				$url=$this->getUrl($url);
84 84
 			}
85 85
 			return $url;
86 86
 	}
87 87
 
88
-	public static function _correctParams($params){
89
-		if(JString::isNull($params)){
88
+	public static function _correctParams($params) {
89
+		if (JString::isNull($params)) {
90 90
 			return "";
91 91
 		}
92
-		if(\preg_match("@^\{.*?\}$@", $params)){
92
+		if (\preg_match("@^\{.*?\}$@", $params)) {
93 93
 			return '$.param('.$params.')';
94 94
 		}
95 95
 		return $params;
96 96
 	}
97 97
 
98
-	public static function _implodeParams($parameters){
98
+	public static function _implodeParams($parameters) {
99 99
 		$allParameters=[];
100
-		foreach ($parameters as $params){
101
-			if(isset($params))
100
+		foreach ($parameters as $params) {
101
+			if (isset($params))
102 102
 				$allParameters[]=self::_correctParams($params);
103 103
 		}
104 104
 		return \implode("+'&'+", $allParameters);
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
117 117
 	}
118 118
 
119
-	protected function setAjaxDataCall($params){
119
+	protected function setAjaxDataCall($params) {
120 120
 		$result=null;
121
-		if(!\is_callable($params)){
122
-			$result=function ($responseElement,$jqueryDone="html") use($params){
123
-				return AjaxTransition::{$params}($responseElement,$jqueryDone);
121
+		if (!\is_callable($params)) {
122
+			$result=function($responseElement, $jqueryDone="html") use($params){
123
+				return AjaxTransition::{$params}($responseElement, $jqueryDone);
124 124
 			};
125 125
 		}
126 126
 		return $result;
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
141 141
 	 * @param string|callable $ajaxTransition
142 142
 	 */
143
-	private function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
144
-		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
143
+	private function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
144
+		return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
145 145
 	}
146 146
 
147 147
 	/**
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
155 155
 	 * @param string|callable $ajaxTransition
156 156
 	 */
157
-	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
158
-		return $this->_get($url,$params,$responseElement,$jsCallback,null,$hasLoader,$jqueryDone,$ajaxTransition,true);
157
+	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
158
+		return $this->_get($url, $params, $responseElement, $jsCallback, null, $hasLoader, $jqueryDone, $ajaxTransition, true);
159 159
 	}
160 160
 
161 161
 	/**
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
170 170
 	 * @param string|callable $ajaxTransition
171 171
 	 */
172
-	public function ajax($method,$url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
172
+	public function ajax($method, $url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
173 173
 		$method=\strtolower($method);
174
-		return $this->_ajax($method,$url,$params,$responseElement,$jsCallback,null,$hasLoader,$jqueryDone,$ajaxTransition,true);
174
+		return $this->_ajax($method, $url, $params, $responseElement, $jsCallback, null, $hasLoader, $jqueryDone, $ajaxTransition, true);
175 175
 	}
176 176
 
177 177
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 * @param string $context
185 185
 	 * @param boolean $immediatly
186 186
 	 */
187
-	private function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
187
+	private function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
188 188
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
189 189
 		$retour=$this->_getAjaxUrl($url, $attr);
190 190
 		$retour.="$.{$method}(url,".$params.").done(function( data ) {\n";
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $context
208 208
 	 * @param boolean $immediatly
209 209
 	 */
210
-	public function json($url, $method="get", $params="{}", $jsCallback=NULL,$context="document",$immediatly=false) {
211
-		return $this->_json($url,$method,$params,$jsCallback,NULL,$context,$immediatly);
210
+	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $context="document", $immediatly=false) {
211
+		return $this->_json($url, $method, $params, $jsCallback, NULL, $context, $immediatly);
212 212
 	}
213 213
 
214 214
 	/**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @param string $url the request address
219 219
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
220 220
 	 */
221
-	public function jsonOn($event,$element, $url,$parameters=array()) {
221
+	public function jsonOn($event, $element, $url, $parameters=array()) {
222 222
 		$preventDefault=true;
223 223
 		$stopPropagation=true;
224 224
 		$jsCallback=null;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		$params="{}";
229 229
 		$immediatly=true;
230 230
 		extract($parameters);
231
-		return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly);
231
+		return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
232 232
 	}
233 233
 
234 234
 	/**
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @param string $jsCallback javascript code to execute after the request
240 240
 	 * @param string $context jquery DOM element, array container.
241 241
 	 */
242
-	public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL,$context=NULL) {
243
-		return $this->json($url, $method, $params, $jsCallback, $context,false);
242
+	public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL, $context=NULL) {
243
+		return $this->json($url, $method, $params, $jsCallback, $context, false);
244 244
 	}
245 245
 
246 246
 	/**
@@ -253,22 +253,22 @@  discard block
 block discarded – undo
253 253
 	 * @param string $rowClass the css class for the new element
254 254
 	 * @param boolean $immediatly
255 255
 	 */
256
-	private function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL,$attr="id",$immediatly=false) {
256
+	private function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL, $attr="id", $immediatly=false) {
257 257
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
258 258
 		$retour=$this->_getAjaxUrl($url, $attr);
259
-		if($context===null){
259
+		if ($context===null) {
260 260
 			$parent="$('".$maskSelector."').parent()";
261
-			$newElm = "$('#'+newId)";
262
-		}else{
261
+			$newElm="$('#'+newId)";
262
+		} else {
263 263
 			$parent=$context;
264
-			$newElm = $context.".find('#'+newId)";
264
+			$newElm=$context.".find('#'+newId)";
265 265
 		}
266 266
 		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
267 267
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
268 268
 		$retour.=$parent.".find('._json').remove();";
269 269
 		$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();
270 270
 		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";
271
-		$retour.= $appendTo;
271
+		$retour.=$appendTo;
272 272
 		$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";
273 273
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
274 274
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param string $context jquery DOM element, array container.
288 288
 	 * @param boolean $immediatly
289 289
 	 */
290
-	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL,$immediatly=false) {
291
-		return $this->_jsonArray($maskSelector, $url,$method,$params,$jsCallback,$rowClass,$context,NULL,$immediatly);
290
+	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL, $immediatly=false) {
291
+		return $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, NULL, $immediatly);
292 292
 	}
293 293
 
294 294
 	/**
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 	 * @param string $rowClass the css class for the new element
302 302
 	 * @param string $context jquery DOM element, array container.
303 303
 	 */
304
-	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL) {
305
-		return $this->jsonArray($maskSelector, $url, $method, $params, $jsCallback,$rowClass,$context,false);
304
+	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL) {
305
+		return $this->jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, false);
306 306
 	}
307 307
 
308 308
 	/**
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
 	 * @param string $url the request url
313 313
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true)
314 314
 	 */
315
-	public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) {
315
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
316 316
 		$preventDefault=true;
317 317
 		$stopPropagation=true;
318 318
 		$jsCallback=null;
319 319
 		$attr="id";
320 320
 		$method="get";
321
-		$context = null;
321
+		$context=null;
322 322
 		$params="{}";
323 323
 		$immediatly=true;
324 324
 		$rowClass="_json";
325 325
 		extract($parameters);
326
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $rowClass, $context,$attr), $event, $preventDefault, $stopPropagation,$immediatly);
326
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, $attr), $event, $preventDefault, $stopPropagation, $immediatly);
327 327
 	}
328 328
 
329 329
 	/**
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
338 338
 	 * @param string|callable $ajaxTransition
339 339
 	 */
340
-	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) {
341
-		return $this->_get($url, $params,$responseElement,$jsCallback,$attr,false,$jqueryDone,$ajaxTransition);
340
+	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) {
341
+		return $this->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition);
342 342
 	}
343 343
 
344 344
 	/**
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		$ajaxTransition=null;
362 362
 		$params="{}";
363 363
 		extract($parameters);
364
-		return $this->_add_event($element, $this->_get($url, $params,$responseElement,$jsCallback,$attr, $hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
364
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
365 365
 	}
366 366
 
367 367
 	/**
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 		$ajaxTransition=null;
386 386
 		$params="{}";
387 387
 		extract($parameters);
388
-		return $this->_add_event($element, $this->_ajax($method,$url, $params,$responseElement,$jsCallback,$attr, $hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
388
+		return $this->_add_event($element, $this->_ajax($method, $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
389 389
 	}
390 390
 
391 391
 	/**
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 		return $this->getOn("click", $element, $url, $responseElement, $parameters);
413 413
 	}
414 414
 
415
-	private function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
416
-		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
415
+	private function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
416
+		return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
417 417
 	}
418 418
 
419 419
 	/**
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
427 427
 	 * @param string|callable $ajaxTransition
428 428
 	 */
429
-	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
430
-		return $this->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
429
+	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
430
+		return $this->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
431 431
 	}
432 432
 
433 433
 	/**
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
443 443
 	 * @param string|callable $ajaxTransition
444 444
 	 */
445
-	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
446
-		return $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
445
+	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
446
+		return $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
447 447
 	}
448 448
 
449 449
 	/**
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		$jqueryDone="html";
467 467
 		$ajaxTransition=null;
468 468
 		extract($parameters);
469
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
469
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
470 470
 	}
471 471
 
472 472
 	/**
@@ -482,20 +482,20 @@  discard block
 block discarded – undo
482 482
 		return $this->postOn("click", $element, $url, $params, $responseElement, $parameters);
483 483
 	}
484 484
 
485
-	private function _postForm($url, $form, $responseElement, $params=null,$validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
485
+	private function _postForm($url, $form, $responseElement, $params=null, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
486 486
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
487 487
 		$retour=$this->_getAjaxUrl($url, $attr);
488 488
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
489
-		if(isset($params)){
489
+		if (isset($params)) {
490 490
 			$retour.="params+='&'+".self::_correctParams($params).";\n";
491 491
 		}
492 492
 		$responseElement=$this->_getResponseElement($responseElement);
493 493
 		$retour.="var self=this;\n";
494
-		if($hasLoader===true){
494
+		if ($hasLoader===true) {
495 495
 			$this->addLoading($retour, $responseElement);
496 496
 		}
497 497
 		$retour.="$.post(url,params).done(function( data ) {\n";
498
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
498
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
499 499
 
500 500
 		if ($validation) {
501 501
 			$retour="$('#".$form."').validate({submitHandler: function(form) {
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
520 520
 	 * @param string|callable $ajaxTransition
521 521
 	 */
522
-	public function postForm($url, $form, $responseElement, $params=NULL,$validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
523
-		return $this->_postForm($url, $form, $responseElement, $params,$validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
522
+	public function postForm($url, $form, $responseElement, $params=NULL, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
523
+		return $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
524 524
 	}
525 525
 
526 526
 	/**
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
538 538
 	 * @param string|callable $ajaxTransition
539 539
 	 */
540
-	public function postFormDeferred($url, $form, $responseElement, $params=NULL,$validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
541
-		return $this->_postForm($url, $form, $responseElement, $params,$validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
540
+	public function postFormDeferred($url, $form, $responseElement, $params=NULL, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
541
+		return $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
542 542
 	}
543 543
 
544 544
 	/**
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 		$jqueryDone="html";
564 564
 		$ajaxTransition=null;
565 565
 		extract($parameters);
566
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement,$params, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
566
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
567 567
 	}
568 568
 
569 569
 	/**
Please login to merge, or discard this patch.
Braces   +35 added lines, -26 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 		}
29 29
 		$retour.="$.".$method."(url,".self::_correctParams($params).").done(function( data ) {\n";
30 30
 		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
31
-		if ($immediatly)
32
-			$this->jquery_code_for_compile[]=$retour;
31
+		if ($immediatly) {
32
+					$this->jquery_code_for_compile[]=$retour;
33
+		}
33 34
 		return $retour;
34 35
 	}
35 36
 
@@ -39,15 +40,17 @@  discard block
 block discarded – undo
39 40
 		$url=$this->_correctAjaxUrl($url);
40 41
 		$retour="url='".$url."';";
41 42
 		$slash="/";
42
-		if(JString::endswith($url, "/")===true)
43
-			$slash="";
43
+		if(JString::endswith($url, "/")===true) {
44
+					$slash="";
45
+		}
44 46
 			if(JString::isNotNull($attr)){
45
-				if ($attr==="value")
46
-					$retour.="url=url+'".$slash."'+$(this).val();\n";
47
-				elseif ($attr==="html")
48
-					$retour.="url=url+'".$slash."'+$(this).html();\n";
49
-				elseif($attr!==null && $attr!=="")
50
-					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
47
+				if ($attr==="value") {
48
+									$retour.="url=url+'".$slash."'+$(this).val();\n";
49
+				} elseif ($attr==="html") {
50
+									$retour.="url=url+'".$slash."'+$(this).html();\n";
51
+				} elseif($attr!==null && $attr!=="") {
52
+									$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
53
+				}
51 54
 			}
52 55
 			return $retour;
53 56
 	}
@@ -57,13 +60,14 @@  discard block
 block discarded – undo
57 60
 		if ($responseElement!=="") {
58 61
 			if(isset($ajaxTransition)){
59 62
 				$call=$this->setAjaxDataCall($ajaxTransition);
60
-			}elseif(isset($this->ajaxTransition)){
63
+			} elseif(isset($this->ajaxTransition)){
61 64
 				$call=$this->ajaxTransition;
62 65
 			}
63
-			if(\is_callable($call))
64
-				$retour="\t".$call($responseElement,$jqueryDone).";\n";
65
-				else
66
-					$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
66
+			if(\is_callable($call)) {
67
+							$retour="\t".$call($responseElement,$jqueryDone).";\n";
68
+			} else {
69
+									$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
70
+				}
67 71
 		}
68 72
 		$retour.="\t".$jsCallback."\n";
69 73
 		return $retour;
@@ -77,8 +81,9 @@  discard block
 block discarded – undo
77 81
 	}
78 82
 
79 83
 	protected function _correctAjaxUrl($url) {
80
-		if ($url!=="/" && JString::endsWith($url, "/")===true)
81
-			$url=substr($url, 0, strlen($url)-1);
84
+		if ($url!=="/" && JString::endsWith($url, "/")===true) {
85
+					$url=substr($url, 0, strlen($url)-1);
86
+		}
82 87
 			if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
83 88
 				$url=$this->getUrl($url);
84 89
 			}
@@ -98,8 +103,9 @@  discard block
 block discarded – undo
98 103
 	public static function _implodeParams($parameters){
99 104
 		$allParameters=[];
100 105
 		foreach ($parameters as $params){
101
-			if(isset($params))
102
-				$allParameters[]=self::_correctParams($params);
106
+			if(isset($params)) {
107
+							$allParameters[]=self::_correctParams($params);
108
+			}
103 109
 		}
104 110
 		return \implode("+'&'+", $allParameters);
105 111
 	}
@@ -193,8 +199,9 @@  discard block
 block discarded – undo
193 199
 				$retour.="\t".$jsCallback."\n".
194 200
 						"\t$(document).trigger('jsonReady',[data]);\n".
195 201
 						"});\n";
196
-				if ($immediatly)
197
-					$this->jquery_code_for_compile[]=$retour;
202
+				if ($immediatly) {
203
+									$this->jquery_code_for_compile[]=$retour;
204
+				}
198 205
 		return $retour;
199 206
 	}
200 207
 
@@ -259,7 +266,7 @@  discard block
 block discarded – undo
259 266
 		if($context===null){
260 267
 			$parent="$('".$maskSelector."').parent()";
261 268
 			$newElm = "$('#'+newId)";
262
-		}else{
269
+		} else{
263 270
 			$parent=$context;
264 271
 			$newElm = $context.".find('#'+newId)";
265 272
 		}
@@ -272,8 +279,9 @@  discard block
 block discarded – undo
272 279
 		$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";
273 280
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
274 281
 		$retour.="\t".$jsCallback."\n"."});\n";
275
-		if ($immediatly)
276
-			$this->jquery_code_for_compile[]=$retour;
282
+		if ($immediatly) {
283
+					$this->jquery_code_for_compile[]=$retour;
284
+		}
277 285
 		return $retour;
278 286
 	}
279 287
 
@@ -503,8 +511,9 @@  discard block
 block discarded – undo
503 511
 			}});\n";
504 512
 			$retour.="$('#".$form."').submit();\n";
505 513
 		}
506
-		if ($immediatly)
507
-			$this->jquery_code_for_compile[]=$retour;
514
+		if ($immediatly) {
515
+					$this->jquery_code_for_compile[]=$retour;
516
+		}
508 517
 		return $retour;
509 518
 	}
510 519
 
Please login to merge, or discard this patch.