Completed
Push — master ( c6edab...f99fed )
by Jean-Christophe
03:30
created
Ajax/semantic/widgets/datatable/HasCheckboxesTrait.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
  * @author jc
11 11
  * @property string identifier
12 12
  */
13
-trait HasCheckboxesTrait{
13
+trait HasCheckboxesTrait {
14 14
 	protected $_hasCheckboxes;
15 15
 	protected $_hasCheckedMessage=false;
16 16
 	protected $_checkedMessage;
17 17
 	protected $_checkedClass;
18 18
 
19
-	abstract public function addInToolbar($element,$callback=NULL);
19
+	abstract public function addInToolbar($element, $callback=NULL);
20 20
 
21
-	protected function _runCheckboxes(JsUtils $js){
21
+	protected function _runCheckboxes(JsUtils $js) {
22 22
 		$checkedMessageCall="";
23
-		if($this->_hasCheckedMessage){
23
+		if ($this->_hasCheckedMessage) {
24 24
 			$msg=$this->getCheckedMessage();
25 25
 			$checkedMessageFunction="function updateChecked(){var msg='".$msg[0]."',count=\$('#{$this->identifier} [name=\"selection[]\"]:checked').length,all=\$('#{$this->identifier} [name=\"selection[]\"]').length;
26 26
 			if(count==1) msg='".$msg[1]."';
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 						\$('#checked-count-".$this->identifier."').contents().filter(function() {return this.nodeType == 3;}).each(function(){this.textContent = msg.replace('{count}',count);});
29 29
 							\$('#toolbar-{$this->identifier} .visibleOnChecked').toggle(count>0);}\$('#toolbar-".$this->identifier." .visibleOnChecked').hide();";
30 30
 			$checkedMessageCall="updateChecked();";
31
-			if(isset($this->_checkedClass)){
31
+			if (isset($this->_checkedClass)) {
32 32
 				$checkedMessageCall.="$(this).closest('tr').toggleClass('".$this->_checkedClass."',$(this).prop('checked'));";
33 33
 			}
34
-			$js->exec($checkedMessageFunction,true);
34
+			$js->exec($checkedMessageFunction, true);
35 35
 		}
36 36
 		$js->execOn("change", "#".$this->identifier." [name='selection[]']", "
37 37
 				var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true;
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 				if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');};".$checkedMessageCall);
40 40
 	}
41 41
 
42
-	protected function _generateMainCheckbox(&$captions){
43
-		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
42
+	protected function _generateMainCheckbox(&$captions) {
43
+		$ck=new HtmlCheckbox("main-ck-".$this->identifier, "");
44 44
 		$checkedMessageCall="";
45
-		if($this->_hasCheckedMessage)
45
+		if ($this->_hasCheckedMessage)
46 46
 			$checkedMessageCall="updateChecked();";
47 47
 
48 48
 			$ck->setOnChecked($this->_setAllChecked("true").$checkedMessageCall);
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 			\array_unshift($captions, $ck);
51 51
 	}
52 52
 
53
-	protected function _setAllChecked($checked){
53
+	protected function _setAllChecked($checked) {
54 54
 		$result="$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',".$checked.");";
55
-		if(isset($this->_checkedClass)){
55
+		if (isset($this->_checkedClass)) {
56 56
 			$result.="$('#".$this->identifier." tr').toggleClass('".$this->_checkedClass."',".$checked.");";
57 57
 		}
58 58
 		return $result;
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
 	protected function getCheckedMessage() {
71
-		$result= $this->_checkedMessage;
72
-		if(!isset($result)){
73
-			$result=[0=>"none selected",1=>"one item selected","other"=>"{count} items selected"];
71
+		$result=$this->_checkedMessage;
72
+		if (!isset($result)) {
73
+			$result=[0=>"none selected", 1=>"one item selected", "other"=>"{count} items selected"];
74 74
 		}
75 75
 		return $result;
76 76
 	}
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	 * @param array $checkedMessage
91 91
 	 * @param callable $callback
92 92
 	 */
93
-	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
94
-		if(isset($checkedMessage))
93
+	public function addCountCheckedInToolbar(array $checkedMessage=null, $callback=null) {
94
+		if (isset($checkedMessage))
95 95
 			$this->_checkedMessage=$checkedMessage;
96 96
 			$checkedMessage=$this->getCheckedMessage();
97 97
 			$this->_hasCheckboxes=true;
98 98
 			$this->_hasCheckedMessage=true;
99
-			$element=new HtmlLabel("checked-count-".$this->identifier,$checkedMessage[0]);
100
-			$this->addInToolbar($element,$callback);
99
+			$element=new HtmlLabel("checked-count-".$this->identifier, $checkedMessage[0]);
100
+			$this->addInToolbar($element, $callback);
101 101
 	}
102 102
 
103 103
 	public function setCheckedClass($_checkedClass) {
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -18,207 +18,207 @@  discard block
 block discarded – undo
18 18
 
19 19
 	public static $index=0;
20 20
 
21
-	public function __construct($identifier,$instance=NULL,$captions=NULL){
21
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
22 22
 		$this->widgetIdentifier=$identifier;
23 23
 		$this->values=[];
24 24
 		$this->afterCompile=[];
25
-		if(isset($instance))
25
+		if (isset($instance))
26 26
 			$this->setInstance($instance);
27 27
 		$this->setCaptions($captions);
28 28
 		$this->captionCallback=NULL;
29
-		$this->defaultValueFunction=function($name,$value){return $value;};
29
+		$this->defaultValueFunction=function($name, $value) {return $value; };
30 30
 	}
31 31
 
32
-	public function moveFieldTo($from,$to){
33
-		if(JArray::moveElementTo($this->visibleProperties, $from, $to)){
32
+	public function moveFieldTo($from, $to) {
33
+		if (JArray::moveElementTo($this->visibleProperties, $from, $to)) {
34 34
 			return JArray::moveElementTo($this->values, $from, $to);
35 35
 		}
36 36
 		return false;
37 37
 	}
38 38
 
39
-	public function swapFields($index1,$index2){
40
-		if(JArray::swapElements($this->visibleProperties, $index1, $index2)){
39
+	public function swapFields($index1, $index2) {
40
+		if (JArray::swapElements($this->visibleProperties, $index1, $index2)) {
41 41
 			return JArray::swapElements($this->values, $index1, $index2);
42 42
 		}
43 43
 		return false;
44 44
 	}
45 45
 
46
-	public function removeField($index){
47
-		\array_splice($this->visibleProperties,$index,1);
48
-		\array_splice($this->values,$index,1);
49
-		\array_splice($this->captions,$index,1);
46
+	public function removeField($index) {
47
+		\array_splice($this->visibleProperties, $index, 1);
48
+		\array_splice($this->values, $index, 1);
49
+		\array_splice($this->captions, $index, 1);
50 50
 		return $this;
51 51
 	}
52 52
 
53
-	public function getValues(){
53
+	public function getValues() {
54 54
 		$values=[];
55 55
 		$index=0;
56 56
 		$count=$this->count();
57
-		while($index<$count){
57
+		while ($index<$count) {
58 58
 			$values[]=$this->getValue($index++);
59 59
 		}
60 60
 		return $values;
61 61
 	}
62 62
 
63
-	public function getIdentifier($index=NULL){
64
-		if(!isset($index))
63
+	public function getIdentifier($index=NULL) {
64
+		if (!isset($index))
65 65
 			$index=self::$index;
66 66
 		$value=$index;
67
-		if(isset($this->values["identifier"]))
68
-			$value=$this->values["identifier"]($index,$this->instance);
67
+		if (isset($this->values["identifier"]))
68
+			$value=$this->values["identifier"]($index, $this->instance);
69 69
 		return $value;
70 70
 	}
71 71
 
72
-	public function getValue($index){
72
+	public function getValue($index) {
73 73
 		$property=$this->properties[$index];
74 74
 		return $this->_getValue($property, $index);
75 75
 	}
76 76
 
77
-	protected function _beforeAddProperty($index,&$field){
77
+	protected function _beforeAddProperty($index, &$field) {
78 78
 
79 79
 	}
80 80
 
81
-	protected function _getDefaultValue($name,$value,$index){
81
+	protected function _getDefaultValue($name, $value, $index) {
82 82
 		$func=$this->defaultValueFunction;
83
-		return $func($name,$value,$index,$this->instance);
83
+		return $func($name, $value, $index, $this->instance);
84 84
 	}
85 85
 
86
-	protected function _getPropertyValue(\ReflectionProperty $property,$index){
86
+	protected function _getPropertyValue(\ReflectionProperty $property, $index) {
87 87
 		$property->setAccessible(true);
88 88
 		$value=$property->getValue($this->instance);
89
-		if(isset($this->values[$index])){
90
-			$value= $this->values[$index]($value,$this->instance,$index);
91
-		}else{
92
-			$value=$this->_getDefaultValue($property->getName(),$value, $index);
89
+		if (isset($this->values[$index])) {
90
+			$value=$this->values[$index]($value, $this->instance, $index);
91
+		} else {
92
+			$value=$this->_getDefaultValue($property->getName(), $value, $index);
93 93
 		}
94 94
 		return $value;
95 95
 	}
96 96
 
97
-	protected function _getValue($property,$index){
97
+	protected function _getValue($property, $index) {
98 98
 		$value=null;
99
-		if($property instanceof \ReflectionProperty){
99
+		if ($property instanceof \ReflectionProperty) {
100 100
 			$value=$this->_getPropertyValue($property, $index);
101
-		}else{
102
-			if(\is_callable($property))
101
+		} else {
102
+			if (\is_callable($property))
103 103
 				$value=$property($this->instance);
104
-			elseif(\is_array($property)){
105
-				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
104
+			elseif (\is_array($property)) {
105
+				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property);
106 106
 				$value=\implode("", $values);
107
-			}else{
108
-				if(isset($this->values[$index])){
109
-					$value= $this->values[$index]($property,$this->instance,$index);
110
-				}elseif(isset($this->instance->{$property})){
107
+			} else {
108
+				if (isset($this->values[$index])) {
109
+					$value=$this->values[$index]($property, $this->instance, $index);
110
+				}elseif (isset($this->instance->{$property})) {
111 111
 					$value=$this->instance->{$property};
112 112
 				}
113 113
 			}
114 114
 		}
115
-		if(isset($this->afterCompile[$index])){
116
-			if(\is_callable($this->afterCompile[$index])){
117
-				$this->afterCompile[$index]($value,$this->instance,$index);
115
+		if (isset($this->afterCompile[$index])) {
116
+			if (\is_callable($this->afterCompile[$index])) {
117
+				$this->afterCompile[$index]($value, $this->instance, $index);
118 118
 			}
119 119
 		}
120 120
 		return $value;
121 121
 	}
122 122
 
123
-	public function insertField($index,$field){
124
-		array_splice( $this->visibleProperties, $index, 0, $field );
123
+	public function insertField($index, $field) {
124
+		array_splice($this->visibleProperties, $index, 0, $field);
125 125
 		return $this;
126 126
 	}
127 127
 
128
-	public function insertInField($index,$field){
128
+	public function insertInField($index, $field) {
129 129
 		$vb=$this->visibleProperties;
130
-		if(isset($vb[$index])){
131
-			if(\is_array($vb[$index])){
130
+		if (isset($vb[$index])) {
131
+			if (\is_array($vb[$index])) {
132 132
 				$this->visibleProperties[$index][]=$field;
133
-			}else{
134
-				$this->visibleProperties[$index]=[$vb[$index],$field];
133
+			} else {
134
+				$this->visibleProperties[$index]=[$vb[$index], $field];
135 135
 			}
136
-		}else{
136
+		} else {
137 137
 			return $this->insertField($index, $field);
138 138
 		}
139 139
 		return $this;
140 140
 	}
141 141
 
142
-	public function addField($field){
142
+	public function addField($field) {
143 143
 		$this->visibleProperties[]=$field;
144 144
 		return $this;
145 145
 	}
146 146
 
147
-	public function count(){
147
+	public function count() {
148 148
 		return \sizeof($this->properties);
149 149
 	}
150 150
 
151
-	public function visiblePropertiesCount(){
151
+	public function visiblePropertiesCount() {
152 152
 		return \sizeof($this->visibleProperties);
153 153
 	}
154 154
 
155
-	public function getProperty($index){
155
+	public function getProperty($index) {
156 156
 		return $this->properties[$index];
157 157
 	}
158 158
 
159
-	public function getFieldName($index){
159
+	public function getFieldName($index) {
160 160
 		$property=$this->getProperty($index);
161
-		if($property instanceof \ReflectionProperty){
161
+		if ($property instanceof \ReflectionProperty) {
162 162
 			$result=$property->getName();
163
-		}elseif(\is_callable($property)){
163
+		}elseif (\is_callable($property)) {
164 164
 			$result=$this->visibleProperties[$index];
165
-		}else{
165
+		} else {
166 166
 			$result=$property;
167 167
 		}
168 168
 		return $result;
169 169
 	}
170 170
 
171 171
 
172
-	protected function showableProperty(\ReflectionProperty $rProperty){
173
-		return JString::startswith($rProperty->getName(),"_")===false;
172
+	protected function showableProperty(\ReflectionProperty $rProperty) {
173
+		return JString::startswith($rProperty->getName(), "_")===false;
174 174
 	}
175 175
 
176 176
 	public function setInstance($instance) {
177
-		if(\is_string($instance)){
177
+		if (\is_string($instance)) {
178 178
 			$instance=new $instance();
179 179
 		}
180 180
 		$this->instance=$instance;
181 181
 		$this->properties=[];
182 182
 		$this->reflect=new \ReflectionClass($instance);
183
-		if(\sizeof($this->visibleProperties)===0){
183
+		if (\sizeof($this->visibleProperties)===0) {
184 184
 			$this->properties=$this->getDefaultProperties();
185
-		}else{
186
-			foreach ($this->visibleProperties as $property){
185
+		} else {
186
+			foreach ($this->visibleProperties as $property) {
187 187
 				$this->setInstanceProperty($property);
188 188
 			}
189 189
 		}
190 190
 		return $this;
191 191
 	}
192 192
 
193
-	private function setInstanceProperty($property){
194
-		if(\is_callable($property)){
193
+	private function setInstanceProperty($property) {
194
+		if (\is_callable($property)) {
195 195
 			$this->properties[]=$property;
196
-		}elseif(\is_string($property)){
197
-			try{
196
+		}elseif (\is_string($property)) {
197
+			try {
198 198
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
199 199
 				$rProperty=$this->reflect->getProperty($property);
200 200
 				$this->properties[]=$rProperty;
201
-			}catch(\Exception $e){
201
+			}catch (\Exception $e) {
202 202
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
203 203
 				$this->properties[]=$property;
204 204
 			}
205
-		}elseif(\is_int($property)){
205
+		}elseif (\is_int($property)) {
206 206
 			$props=$this->getDefaultProperties();
207
-			if(isset($props[$property]))
207
+			if (isset($props[$property]))
208 208
 				$this->properties[]=$props[$property];
209 209
 				else
210 210
 					$this->properties[]=$property;
211
-		}else{
211
+		} else {
212 212
 			$this->properties[]=$property;
213 213
 		}
214 214
 	}
215 215
 
216
-	protected function getDefaultProperties(){
216
+	protected function getDefaultProperties() {
217 217
 		$result=[];
218 218
 		$properties=$this->reflect->getProperties();
219
-		foreach ($properties as $property){
219
+		foreach ($properties as $property) {
220 220
 			$showable=$this->showableProperty($property);
221
-			if($showable!==false){
221
+			if ($showable!==false) {
222 222
 				$result[]=$property;
223 223
 			}
224 224
 		}
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
 		return $this;
231 231
 	}
232 232
 
233
-	public function setValueFunction($index,$callback){
233
+	public function setValueFunction($index, $callback) {
234 234
 		$this->values[$index]=$callback;
235 235
 		return $this;
236 236
 	}
237 237
 
238
-	public function setIdentifierFunction($callback){
238
+	public function setIdentifierFunction($callback) {
239 239
 		$this->values["identifier"]=$callback;
240 240
 		return $this;
241 241
 	}
@@ -248,41 +248,41 @@  discard block
 block discarded – undo
248 248
 		return $this->properties;
249 249
 	}
250 250
 
251
-	public function getCaption($index){
252
-		if(isset($this->captions[$index])){
251
+	public function getCaption($index) {
252
+		if (isset($this->captions[$index])) {
253 253
 			return $this->captions[$index];
254 254
 		}
255
-		if($this->properties[$index] instanceof \ReflectionProperty)
255
+		if ($this->properties[$index] instanceof \ReflectionProperty)
256 256
 			return $this->properties[$index]->getName();
257
-		elseif(\is_callable($this->properties[$index]))
257
+		elseif (\is_callable($this->properties[$index]))
258 258
 			return "";
259 259
 		else
260 260
 			return $this->properties[$index];
261 261
 	}
262 262
 
263
-	public function getCaptions(){
264
-		if(isset($this->captions)){
265
-			$captions= \array_values($this->captions);
266
-			for($i=\sizeof($captions);$i<$this->count();$i++){
263
+	public function getCaptions() {
264
+		if (isset($this->captions)) {
265
+			$captions=\array_values($this->captions);
266
+			for ($i=\sizeof($captions); $i<$this->count(); $i++) {
267 267
 				$captions[]="";
268 268
 			}
269
-		}else{
269
+		} else {
270 270
 			$captions=[];
271 271
 			$index=0;
272 272
 			$count=$this->count();
273
-			while($index<$count){
273
+			while ($index<$count) {
274 274
 				$captions[]=$this->getCaption($index++);
275 275
 			}
276 276
 		}
277
-		if(isset($this->captionCallback) && \is_callable($this->captionCallback)){
277
+		if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
278 278
 			$callback=$this->captionCallback;
279
-			$callback($captions,$this->instance);
279
+			$callback($captions, $this->instance);
280 280
 		}
281 281
 		return $captions;
282 282
 	}
283 283
 
284
-	public function setCaption($index,$caption){
285
-		if(isset($this->captions)===false)
284
+	public function setCaption($index, $caption) {
285
+		if (isset($this->captions)===false)
286 286
 			$this->captions=[];
287 287
 		$this->captions[$index]=$caption;
288 288
 		return $this;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param callable $callback function called after the field compilation
301 301
 	 * @return \Ajax\semantic\widgets\datatable\InstanceViewer
302 302
 	 */
303
-	public function afterCompile($index,$callback){
303
+	public function afterCompile($index, $callback) {
304 304
 		$this->afterCompile[$index]=$callback;
305 305
 		return $this;
306 306
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataelement/DeInstanceViewer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 		parent::__construct($identifier, $instance, $captions);
13 13
 	}
14 14
 
15
-	public function getValue($index){
15
+	public function getValue($index) {
16 16
 		$result=parent::getValue($index);
17
-		if($result instanceof HtmlFormField){
18
-			$lbl=new HtmlSemDoubleElement("lbl-".$this->widgetIdentifier."-".$index,"label","",$this->getCaption($index));
17
+		if ($result instanceof HtmlFormField) {
18
+			$lbl=new HtmlSemDoubleElement("lbl-".$this->widgetIdentifier."-".$index, "label", "", $this->getCaption($index));
19 19
 			$lbl->setProperty("for", $result->getDataField()->getIdentifier());
20 20
 			$this->captions[$index]=$lbl;
21 21
 		}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataelement/DataElement.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,49 +18,49 @@  discard block
 block discarded – undo
18 18
 class DataElement extends Widget {
19 19
 
20 20
 	public function __construct($identifier, $modelInstance=NULL) {
21
-		parent::__construct($identifier, null,$modelInstance);
22
-		$this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0,2), false);
21
+		parent::__construct($identifier, null, $modelInstance);
22
+		$this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 2), false);
23 23
 		$this->content["table"]->setDefinition();
24 24
 	}
25 25
 
26
-	public function compile(JsUtils $js=NULL,&$view=NULL){
27
-		if(!$this->_generated){
26
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
27
+		if (!$this->_generated) {
28 28
 			$this->_instanceViewer->setInstance($this->_modelInstance);
29 29
 
30 30
 			$table=$this->content["table"];
31 31
 			$this->_generateContent($table);
32 32
 
33
-			if(isset($this->_toolbar)){
33
+			if (isset($this->_toolbar)) {
34 34
 				$this->_setToolbarPosition($table);
35 35
 			}
36
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
36
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
37 37
 			$this->_compileForm();
38 38
 			$this->_generated=true;
39 39
 		}
40
-		return parent::compile($js,$view);
40
+		return parent::compile($js, $view);
41 41
 	}
42 42
 
43 43
 	/**
44 44
 	 * @param HtmlTable $table
45 45
 	 */
46
-	protected function _generateContent($table){
47
-		$values= $this->_instanceViewer->getValues();
46
+	protected function _generateContent($table) {
47
+		$values=$this->_instanceViewer->getValues();
48 48
 		$captions=$this->_instanceViewer->getCaptions();
49 49
 		$count=$this->_instanceViewer->count();
50
-		for($i=0;$i<$count;$i++){
51
-			$table->addRow([$captions[$i],$values[$i]]);
50
+		for ($i=0; $i<$count; $i++) {
51
+			$table->addRow([$captions[$i], $values[$i]]);
52 52
 		}
53 53
 	}
54 54
 
55
-	protected function _getFieldName($index){
55
+	protected function _getFieldName($index) {
56 56
 		return $this->_instanceViewer->getFieldName($index);
57 57
 	}
58 58
 
59
-	protected function _getFieldCaption($index){
59
+	protected function _getFieldCaption($index) {
60 60
 		return null;
61 61
 	}
62 62
 
63
-	protected function _getFieldIdentifier($prefix,$name=""){
63
+	protected function _getFieldIdentifier($prefix, $name="") {
64 64
 		return $this->identifier."-{$prefix}-".$name;
65 65
 	}
66 66
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return $this;
93 93
 	}
94 94
 
95
-	public function asForm(){
95
+	public function asForm() {
96 96
 		return $this->getForm();
97 97
 	}
98 98
 }
99 99
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/service/JArray.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 class JArray {
6 6
 
7 7
 	public static function isAssociative($array) {
8
-		return (array_values($array) !== $array);
8
+		return (array_values($array)!==$array);
9 9
 		// return (array_keys($array)!==range(0, count($array)-1));
10 10
 	}
11 11
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 			return $array[$key];
15 15
 		}
16 16
 		$values=array_values($array);
17
-		if ($pos < sizeof($values))
17
+		if ($pos<sizeof($values))
18 18
 			return $values[$pos];
19 19
 	}
20 20
 
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 		$result=NULL;
23 23
 		if (array_key_exists($key, $array)) {
24 24
 			$result=$array[$key];
25
-			if ($condition($result) === true)
25
+			if ($condition($result)===true)
26 26
 				return $result;
27 27
 		}
28 28
 		$values=array_values($array);
29
-		foreach ( $values as $val ) {
30
-			if ($condition($val) === true)
29
+		foreach ($values as $val) {
30
+			if ($condition($val)===true)
31 31
 				return $val;
32 32
 		}
33 33
 		return $result;
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 		$result="";
45 45
 		if (\is_array($glue)) {
46 46
 			$size=\sizeof($pieces);
47
-			if ($size > 0) {
48
-				for($i=0; $i < $size - 1; $i++) {
49
-					$result.=$pieces[$i] . @$glue[$i];
47
+			if ($size>0) {
48
+				for ($i=0; $i<$size-1; $i++) {
49
+					$result.=$pieces[$i].@$glue[$i];
50 50
 				}
51
-				$result.=$pieces[$size - 1];
51
+				$result.=$pieces[$size-1];
52 52
 			}
53 53
 		} else {
54 54
 			$result=\implode($glue, $pieces);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 	public static function dimension($array) {
60 60
 		if (\is_array(reset($array))) {
61
-			$return=self::dimension(reset($array)) + 1;
61
+			$return=self::dimension(reset($array))+1;
62 62
 		} else {
63 63
 			$return=1;
64 64
 		}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public static function sortAssociative($array, $sortedKeys=array()) {
69
-		$newArray=array ();
70
-		foreach ( $sortedKeys as $key ) {
69
+		$newArray=array();
70
+		foreach ($sortedKeys as $key) {
71 71
 			if (\array_key_exists($key, $array)) {
72 72
 				$newArray[$key]=$array[$key];
73 73
 			}
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 
78 78
 	public static function moveElementTo(&$array, $from, $to) {
79 79
 		$result=false;
80
-		if(isset($array)){
81
-			if(isset($array[$from])){
82
-				$out = array_splice($array, $from, 1);
80
+		if (isset($array)) {
81
+			if (isset($array[$from])) {
82
+				$out=array_splice($array, $from, 1);
83 83
 				array_splice($array, $to, 0, $out);
84 84
 				$result=true;
85 85
 			}
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 		return $result;
88 88
 	}
89 89
 
90
-	public static function swapElements(&$array,$index1,$index2){
90
+	public static function swapElements(&$array, $index1, $index2) {
91 91
 		$result=false;
92
-		if(isset($array)){
93
-			if(isset($array[$index1])&& isset($array[$index2])){
92
+		if (isset($array)) {
93
+			if (isset($array[$index1]) && isset($array[$index2])) {
94 94
 				$tmp=$array[$index1];
95 95
 				$array[$index1]=$array[$index2];
96 96
 				$array[$index2]=$tmp;
@@ -101,27 +101,27 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 
103 103
 
104
-	public static function modelArray($objects,$identifierFunction=NULL,$modelFunction=NULL){
104
+	public static function modelArray($objects, $identifierFunction=NULL, $modelFunction=NULL) {
105 105
 		$result=[];
106
-		if(isset($modelFunction)===false){
106
+		if (isset($modelFunction)===false) {
107 107
 			$modelFunction="__toString";
108 108
 		}
109
-		if(isset($identifierFunction)===false){
110
-			foreach ($objects as $object){
109
+		if (isset($identifierFunction)===false) {
110
+			foreach ($objects as $object) {
111 111
 				$result[]=self::callFunction($object, $modelFunction);
112 112
 			}
113
-		}else{
114
-			foreach ($objects as $object){
113
+		} else {
114
+			foreach ($objects as $object) {
115 115
 				$result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction);
116 116
 			}
117 117
 		}
118 118
 		return $result;
119 119
 	}
120 120
 
121
-	private static function callFunction($object,$callback){
122
-		if(\is_string($callback))
123
-			return \call_user_func(array($object, $callback),[]);
124
-		else if (\is_callable($callback)){
121
+	private static function callFunction($object, $callback) {
122
+		if (\is_string($callback))
123
+			return \call_user_func(array($object, $callback), []);
124
+		else if (\is_callable($callback)) {
125 125
 			return $callback($object);
126 126
 		}
127 127
 	}
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\semantic\html\modules\HtmlModal;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait;
23
+	use FieldAsTrait, FormTrait;
24 24
 
25 25
 	/**
26 26
 	 * @var string classname
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	protected $_generated;
54 54
 
55 55
 
56
-	public function __construct($identifier,$model,$modelInstance=NULL) {
56
+	public function __construct($identifier, $model, $modelInstance=NULL) {
57 57
 		parent::__construct($identifier);
58 58
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
59 59
 		$this->setModel($model);
60
-		if(isset($modelInstance)){
61
-			if(\is_array($modelInstance)){
60
+		if (isset($modelInstance)) {
61
+			if (\is_array($modelInstance)) {
62 62
 				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
63 63
 			}
64 64
 			$this->show($modelInstance);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_generated=false;
67 67
 	}
68 68
 
69
-	protected function _init($instanceViewer,$contentKey,$content,$edition){
69
+	protected function _init($instanceViewer, $contentKey, $content, $edition) {
70 70
 		$this->_instanceViewer=$instanceViewer;
71 71
 		$this->content=[$contentKey=>$content];
72 72
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
@@ -77,25 +77,25 @@  discard block
 block discarded – undo
77 77
 	 * @param int|string $fieldName
78 78
 	 * @return int|string
79 79
 	 */
80
-	protected function _getIndex($fieldName){
80
+	protected function _getIndex($fieldName) {
81 81
 		return $fieldName;
82 82
 	}
83 83
 
84
-	protected function _getFieldIdentifier($prefix,$name=""){
84
+	protected function _getFieldIdentifier($prefix, $name="") {
85 85
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
86 86
 	}
87 87
 
88
-	protected function _getFieldName($index){
88
+	protected function _getFieldName($index) {
89 89
 		return $this->_instanceViewer->getFieldName($index);
90 90
 	}
91 91
 
92
-	protected function _getFieldCaption($index){
92
+	protected function _getFieldCaption($index) {
93 93
 		return $this->_instanceViewer->getCaption($index);
94 94
 	}
95 95
 
96
-	abstract protected  function _setToolbarPosition($table,$captions=NULL);
96
+	abstract protected  function _setToolbarPosition($table, $captions=NULL);
97 97
 
98
-	public function show($modelInstance){
98
+	public function show($modelInstance) {
99 99
 		$this->_modelInstance=$modelInstance;
100 100
 	}
101 101
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	abstract public function getHtmlComponent();
121 121
 
122
-	public function setAttached($value=true){
122
+	public function setAttached($value=true) {
123 123
 		return $this->getHtmlComponent()->setAttached($value);
124 124
 	}
125 125
 
@@ -130,66 +130,66 @@  discard block
 block discarded – undo
130 130
 	 * @param callable $callback function called after the field compilation
131 131
 	 * @return Widget
132 132
 	 */
133
-	public function afterCompile($index,$callback){
133
+	public function afterCompile($index, $callback) {
134 134
 		$index=$this->_getIndex($index);
135 135
 		$this->_instanceViewer->afterCompile($index, $callback);
136 136
 		return $this;
137 137
 	}
138 138
 
139
-	public function setColor($color){
139
+	public function setColor($color) {
140 140
 		return $this->getHtmlComponent()->setColor($color);
141 141
 	}
142 142
 
143 143
 
144
-	public function setCaptions($captions){
144
+	public function setCaptions($captions) {
145 145
 		$this->_instanceViewer->setCaptions($captions);
146 146
 		return $this;
147 147
 	}
148 148
 
149
-	public function setCaption($index,$caption){
149
+	public function setCaption($index, $caption) {
150 150
 		$this->_instanceViewer->setCaption($this->_getIndex($index), $caption);
151 151
 		return $this;
152 152
 	}
153 153
 
154
-	public function setFields($fields){
154
+	public function setFields($fields) {
155 155
 		$this->_instanceViewer->setVisibleProperties($fields);
156 156
 		return $this;
157 157
 	}
158 158
 
159
-	public function addField($field){
159
+	public function addField($field) {
160 160
 		$this->_instanceViewer->addField($field);
161 161
 		return $this;
162 162
 	}
163 163
 
164
-	public function addMessage($attributes=NULL,$fieldName="message"){
164
+	public function addMessage($attributes=NULL, $fieldName="message") {
165 165
 		$this->_instanceViewer->addField($fieldName);
166 166
 		$count=$this->_instanceViewer->visiblePropertiesCount();
167
-		return $this->fieldAsMessage($count-1,$attributes);
167
+		return $this->fieldAsMessage($count-1, $attributes);
168 168
 	}
169 169
 
170
-	public function addErrorMessage(){
171
-		return $this->addMessage(["error"=>true],"message");
170
+	public function addErrorMessage() {
171
+		return $this->addMessage(["error"=>true], "message");
172 172
 	}
173 173
 
174
-	public function insertField($index,$field){
174
+	public function insertField($index, $field) {
175 175
 		$index=$this->_getIndex($index);
176 176
 		$this->_instanceViewer->insertField($index, $field);
177 177
 		return $this;
178 178
 	}
179 179
 
180
-	public function insertInField($index,$field){
180
+	public function insertInField($index, $field) {
181 181
 		$index=$this->_getIndex($index);
182 182
 		$this->_instanceViewer->insertInField($index, $field);
183 183
 		return $this;
184 184
 	}
185 185
 
186
-	public function setValueFunction($index,$callback){
186
+	public function setValueFunction($index, $callback) {
187 187
 		$index=$this->_getIndex($index);
188 188
 		$this->_instanceViewer->setValueFunction($index, $callback);
189 189
 		return $this;
190 190
 	}
191 191
 
192
-	public function setIdentifierFunction($callback){
192
+	public function setIdentifierFunction($callback) {
193 193
 		$this->_instanceViewer->setIdentifierFunction($callback);
194 194
 		return $this;
195 195
 	}
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	/**
198 198
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
199 199
 	 */
200
-	public function getToolbar(){
201
-		if(isset($this->_toolbar)===false){
200
+	public function getToolbar() {
201
+		if (isset($this->_toolbar)===false) {
202 202
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
203 203
 		}
204 204
 		return $this->_toolbar;
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 	 * @param callable $callback function to call on $element
211 211
 	 * @return \Ajax\common\html\HtmlDoubleElement
212 212
 	 */
213
-	public function addInToolbar($element,$callback=NULL){
213
+	public function addInToolbar($element, $callback=NULL) {
214 214
 		$tb=$this->getToolbar();
215
-		if($element instanceof BaseWidget){
216
-			if($element->getIdentifier()===""){
215
+		if ($element instanceof BaseWidget) {
216
+			if ($element->getIdentifier()==="") {
217 217
 				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
218 218
 			}
219 219
 		}
220
-		if(isset($callback)){
221
-			if(\is_callable($callback)){
220
+		if (isset($callback)) {
221
+			if (\is_callable($callback)) {
222 222
 				$callback($element);
223 223
 			}
224 224
 		}
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 	 * @param callable $callback function($element)
232 232
 	 * @return \Ajax\common\html\HtmlDoubleElement
233 233
 	 */
234
-	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
235
-		$result=$this->addInToolbar($caption,$callback);
236
-		if(isset($icon))
234
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
235
+		$result=$this->addInToolbar($caption, $callback);
236
+		if (isset($icon))
237 237
 			$result->addIcon($icon);
238 238
 		return $result;
239 239
 	}
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 	 * @param callable $callback function($element)
244 244
 	 * @return \Ajax\common\Widget
245 245
 	 */
246
-	public function addItemsInToolbar(array $items,$callback=NULL){
247
-		if(JArray::isAssociative($items)){
248
-			foreach ($items as $icon=>$item){
249
-				$this->addItemInToolbar($item,$icon,$callback);
246
+	public function addItemsInToolbar(array $items, $callback=NULL) {
247
+		if (JArray::isAssociative($items)) {
248
+			foreach ($items as $icon=>$item) {
249
+				$this->addItemInToolbar($item, $icon, $callback);
250 250
 			}
251
-		}else{
252
-			foreach ($items as $item){
253
-				$this->addItemInToolbar($item,null,$callback);
251
+		} else {
252
+			foreach ($items as $item) {
253
+				$this->addItemInToolbar($item, null, $callback);
254 254
 			}
255 255
 		}
256 256
 		return $this;
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 	 * @param callable $callback function($element)
263 263
 	 * @return \Ajax\common\html\HtmlDoubleElement
264 264
 	 */
265
-	public function addDropdownInToolbar($value,$items,$callback=NULL){
265
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
266 266
 		$dd=$value;
267 267
 		if (\is_string($value)) {
268
-			$dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items);
268
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
269 269
 		}
270
-		return $this->addInToolbar($dd,$callback);
270
+		return $this->addInToolbar($dd, $callback);
271 271
 	}
272 272
 
273 273
 	/**
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 	 * @param callable $callback function($element)
277 277
 	 * @return \Ajax\common\html\HtmlDoubleElement
278 278
 	 */
279
-	public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){
280
-		$bt=new HtmlButton("bt-".$caption,$caption,$cssStyle);
281
-		return $this->addInToolbar($bt,$callback);
279
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
280
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
281
+		return $this->addInToolbar($bt, $callback);
282 282
 	}
283 283
 
284 284
 	/**
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 	 * @param callable $callback function($element)
288 288
 	 * @return \Ajax\common\html\HtmlDoubleElement
289 289
 	 */
290
-	public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){
291
-		$bts=new HtmlButtonGroups("",$captions,$asIcon);
292
-		return $this->addInToolbar($bts,$callback);
290
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
291
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
292
+		return $this->addInToolbar($bts, $callback);
293 293
 	}
294 294
 
295 295
 	/**
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 	 * @param boolean $labeled
300 300
 	 * @return \Ajax\common\html\HtmlDoubleElement
301 301
 	 */
302
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
303
-		$bt=new HtmlButton("",$caption);
304
-		$bt->addIcon($icon,$before,$labeled);
302
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
303
+		$bt=new HtmlButton("", $caption);
304
+		$bt->addIcon($icon, $before, $labeled);
305 305
 		return $this->addInToolbar($bt);
306 306
 	}
307 307
 
308
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
309
-		$button=new HtmlButton($identifier,$value,$cssStyle);
310
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters);
308
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
309
+		$button=new HtmlButton($identifier, $value, $cssStyle);
310
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
311 311
 		return $this->addInToolbar($button);
312 312
 	}
313 313
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model
338 338
 	 * @return \Ajax\common\Widget
339 339
 	 */
340
-	public function setDefaultValueFunction($defaultValueFunction){
340
+	public function setDefaultValueFunction($defaultValueFunction) {
341 341
 		$this->_instanceViewer->setDefaultValueFunction($defaultValueFunction);
342 342
 		return $this;
343 343
 	}
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 * @param string|boolean $disable
347 347
 	 * @return string
348 348
 	 */
349
-	public function jsDisabled($disable=true){
349
+	public function jsDisabled($disable=true) {
350 350
 		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
351 351
 	}
352 352
 
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
 	 * @param callable $callback function($element)
356 356
 	 * @return \Ajax\common\html\HtmlDoubleElement
357 357
 	 */
358
-	public function addEditButtonInToolbar($caption,$callback=NULL){
359
-		$bt=new HtmlButton($this->identifier."-editBtn",$caption);
358
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
359
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
360 360
 		$bt->setToggle();
361 361
 		$bt->setActive($this->_edition);
362 362
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
363
-		return $this->addInToolbar($bt,$callback);
363
+		return $this->addInToolbar($bt, $callback);
364 364
 	}
365 365
 
366 366
 	public function setToolbar(HtmlMenu $_toolbar) {
@@ -374,35 +374,35 @@  discard block
 block discarded – undo
374 374
 	}
375 375
 
376 376
 	public function getForm() {
377
-		if(!isset($this->_form)){
377
+		if (!isset($this->_form)) {
378 378
 			$this->_form=new HtmlForm("frm-".$this->identifier);
379 379
 			$this->setEdition(true);
380 380
 		}
381 381
 		return $this->_form;
382 382
 	}
383 383
 
384
-	public function run(JsUtils $js){
384
+	public function run(JsUtils $js) {
385 385
 		$result=parent::run($js);
386
-		if(isset($this->_form)){
386
+		if (isset($this->_form)) {
387 387
 			$result=$this->runForm($js);
388 388
 		}
389 389
 		return $result;
390 390
 	}
391 391
 
392
-	protected function runForm(JsUtils $js){
392
+	protected function runForm(JsUtils $js) {
393 393
 		$fields=$this->getContentInstances(HtmlFormField::class);
394
-		foreach ($fields as $field){
394
+		foreach ($fields as $field) {
395 395
 			$this->_form->addField($field);
396 396
 		}
397 397
 		return $this->_form->run($js);
398 398
 	}
399 399
 
400
-	protected function _compileForm(){
401
-		if(isset($this->_form)){
400
+	protected function _compileForm() {
401
+		if (isset($this->_form)) {
402 402
 			$noValidate="";
403
-			if(\sizeof($this->_form->getValidationParams())>0)
403
+			if (\sizeof($this->_form->getValidationParams())>0)
404 404
 				$noValidate="novalidate";
405
-			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
405
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
406 406
 		}
407 407
 	}
408 408
 
@@ -411,26 +411,26 @@  discard block
 block discarded – undo
411 411
 		return $this;
412 412
 	}
413 413
 
414
-	public function moveFieldTo($from,$to){
414
+	public function moveFieldTo($from, $to) {
415 415
 		return $this->_instanceViewer->moveFieldTo($from, $to);
416 416
 	}
417 417
 
418
-	public function swapFields($index1,$index2){
418
+	public function swapFields($index1, $index2) {
419 419
 		$index1=$this->_getIndex($index1);
420 420
 		$index2=$this->_getIndex($index2);
421 421
 		return $this->_instanceViewer->swapFields($index1, $index2);
422 422
 	}
423 423
 
424
-	public function removeField($index){
424
+	public function removeField($index) {
425 425
 		$index=$this->_getIndex($index);
426 426
 		$this->_instanceViewer->removeField($index);
427 427
 		return $this;
428 428
 	}
429 429
 
430
-	public function asModal($header){
431
-		$modal=new HtmlModal("modal-".$this->identifier,$header);
430
+	public function asModal($header) {
431
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
432 432
 		$modal->setContent($this);
433
-		if(isset($this->_form)){
433
+		if (isset($this->_form)) {
434 434
 			$this->_form->onSuccess($modal->jsHide());
435 435
 		}
436 436
 		return $modal;
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   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,51 +2,51 @@
 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
-	public static function replaceAtFirst($subject,$from, $to){
40
-		$from = '/\A'.preg_quote($from, '/').'/';
39
+	public static function replaceAtFirst($subject, $from, $to) {
40
+		$from='/\A'.preg_quote($from, '/').'/';
41 41
 		return \preg_replace($from, $to, $subject, 1);
42 42
 	}
43 43
 
44
-	public static function replaceAtLast($subject,$from, $to){
45
-		$from = '/'.preg_quote($from, '/').'\z/';
44
+	public static function replaceAtLast($subject, $from, $to) {
45
+		$from='/'.preg_quote($from, '/').'\z/';
46 46
 		return \preg_replace($from, $to, $subject, 1);
47 47
 	}
48 48
 
49
-	public static function replaceAtFirstAndLast($subject,$fromFirst,$toFirst,$fromLast,$toLast){
49
+	public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) {
50 50
 		$s=self::replaceAtFirst($subject, $fromFirst, $toFirst);
51 51
 		return self::replaceAtLast($s, $fromLast, $toLast);
52 52
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/business/BusinessForm.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 	 *
17 17
 	 * @see \Ajax\semantic\widgets\dataform\DataForm::__construct()
18 18
 	 */
19
-	public function __construct($identifier,$modelInstance=null,$fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]) {
20
-		if(!isset($modelInstance)){
19
+	public function __construct($identifier, $modelInstance=null, $fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) {
20
+		if (!isset($modelInstance)) {
21 21
 			$modelInstance=$this->getDefaultModelInstance();
22 22
 		}
23
-		parent::__construct($identifier,$modelInstance);
24
-		$this->_initForm($fieldsOrder, $fieldsDefinition,$fields,$captions,$separators);
23
+		parent::__construct($identifier, $modelInstance);
24
+		$this->_initForm($fieldsOrder, $fieldsDefinition, $fields, $captions, $separators);
25 25
 	}
26 26
 
27 27
 	abstract protected function getDefaultModelInstance();
28 28
 
29
-	protected function _initForm($fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]){
29
+	protected function _initForm($fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) {
30 30
 		$this->_fieldsOrder=$fieldsOrder;
31 31
 		$this->setFields($fields);
32 32
 		$this->setSeparators($separators);
@@ -34,26 +34,26 @@  discard block
 block discarded – undo
34 34
 		$this->setCaptions($captions);
35 35
 	}
36 36
 
37
-	protected function _getIndex($fieldName){
37
+	protected function _getIndex($fieldName) {
38 38
 		$index=$fieldName;
39
-		if(\is_string($fieldName)){
39
+		if (\is_string($fieldName)) {
40 40
 			$index=\array_search($fieldName, $this->_fieldsOrder);
41 41
 		}
42 42
 		return $index;
43 43
 	}
44
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
44
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
45 45
 		$index=$this->_getIndex($index);
46
-		return parent::_fieldAs($elementCallback, $index,$attributes,$prefix);
46
+		return parent::_fieldAs($elementCallback, $index, $attributes, $prefix);
47 47
 	}
48 48
 
49 49
 
50
-	public function removeField($fieldName){
50
+	public function removeField($fieldName) {
51 51
 		parent::removeField($fieldName);
52
-		\array_splice($this->_fieldsOrder,$this->_getIndex($fieldName),1);
52
+		\array_splice($this->_fieldsOrder, $this->_getIndex($fieldName), 1);
53 53
 		return $this;
54 54
 	}
55 55
 
56
-	public function compile(JsUtils $js=NULL,&$view=NULL){
57
-		return parent::compile($js,$view);
56
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
57
+		return parent::compile($js, $view);
58 58
 	}
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.