Completed
Push — master ( 489615...9fed17 )
by Jean-Christophe
03:15
created
Ajax/semantic/html/collections/table/traits/TableTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Ajax\semantic\html\collections\table\traits;
3 3
 
4
-trait TableTrait{
4
+trait TableTrait {
5 5
 	/**
6 6
 	 * @return HtmlTable
7 7
 	 */
8 8
 	abstract protected function getTable();
9 9
 
10
-	protected function addToPropertyTable($property,$value){
10
+	protected function addToPropertyTable($property, $value) {
11 11
 		return $this->getTable()->addToProperty($property, $value);
12 12
 	}
13 13
 
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
 	public function setBasic($very=false) {
19 19
 		$table=$this->getTable();
20 20
 		if ($very)
21
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
22
-		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
21
+			$table->addToPropertyCtrl("class", "very", array("very"));
22
+		return $table->addToPropertyCtrl("class", "basic", array("basic"));
23 23
 	}
24 24
 
25 25
 	public function setCompact($very=false) {
26 26
 		$table=$this->getTable();
27 27
 		if ($very)
28
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
29
-		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
28
+			$table->addToPropertyCtrl("class", "very", array("very"));
29
+		return $table->addToPropertyCtrl("class", "compact", array("compact"));
30 30
 	}
31 31
 
32 32
 	public function setCollapsing() {
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  * @property boolean $_edition
24 24
  * @property mixed _modelInstance
25 25
  */
26
-trait FieldAsTrait{
26
+trait FieldAsTrait {
27 27
 
28
-	abstract protected function _getFieldIdentifier($prefix,$name="");
29
-	abstract public function setValueFunction($index,$callback);
28
+	abstract protected function _getFieldIdentifier($prefix, $name="");
29
+	abstract public function setValueFunction($index, $callback);
30 30
 	abstract protected function _getFieldName($index);
31 31
 	abstract protected function _getFieldCaption($index);
32
-	abstract protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL,$parameters=NULL);
32
+	abstract protected function _buttonAsSubmit(&$button, $event, $url, $responseElement=NULL, $parameters=NULL);
33 33
 
34 34
 	/**
35 35
 	 * @param HtmlFormField $element
36 36
 	 * @param array $attributes
37 37
 	 */
38
-	protected function _applyAttributes($element,&$attributes,$index){
39
-		if(isset($attributes["callback"])){
38
+	protected function _applyAttributes($element, &$attributes, $index) {
39
+		if (isset($attributes["callback"])) {
40 40
 			$callback=$attributes["callback"];
41
-			if(\is_callable($callback)){
42
-				$callback($element,$this->_modelInstance,$index);
41
+			if (\is_callable($callback)) {
42
+				$callback($element, $this->_modelInstance, $index);
43 43
 				unset($attributes["callback"]);
44 44
 			}
45 45
 		}
@@ -49,42 +49,42 @@  discard block
 block discarded – undo
49 49
 		$element->fromArray($attributes);
50 50
 	}
51 51
 
52
-	private function _getLabelField($caption,$icon=NULL){
53
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
52
+	private function _getLabelField($caption, $icon=NULL) {
53
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
54 54
 		return $label;
55 55
 	}
56 56
 
57
-	protected function _addRules($element,&$attributes){
58
-		if(isset($attributes["rules"])){
57
+	protected function _addRules($element, &$attributes) {
58
+		if (isset($attributes["rules"])) {
59 59
 			$rules=$attributes["rules"];
60
-			if(\is_array($rules)){
60
+			if (\is_array($rules)) {
61 61
 				$element->addRules($rules);
62 62
 			}
63
-			else{
63
+			else {
64 64
 				$element->addRule($rules);
65 65
 			}
66 66
 			unset($attributes["rules"]);
67 67
 		}
68 68
 	}
69 69
 
70
-	protected function _prepareFormFields(&$field,$name,&$attributes){
70
+	protected function _prepareFormFields(&$field, $name, &$attributes) {
71 71
 		$field->setName($name);
72 72
 		$this->_addRules($field, $attributes);
73 73
 		return $field;
74 74
 	}
75 75
 
76
-	protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){
77
-		$this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){
76
+	protected function _fieldAs($elementCallback, $index, $attributes=NULL, $prefix=null) {
77
+		$this->setValueFunction($index, function($value) use ($index, &$attributes, $elementCallback, $prefix){
78 78
 			$caption=$this->_getFieldCaption($index);
79 79
 			$name=$this->_getFieldName($index);
80
-			$id=$this->_getFieldIdentifier($prefix,$name);
81
-			if(isset($attributes["name"])){
80
+			$id=$this->_getFieldIdentifier($prefix, $name);
81
+			if (isset($attributes["name"])) {
82 82
 				$name=$attributes["name"];
83 83
 				unset($attributes["name"]);
84 84
 			}
85
-			$element=$elementCallback($id,$name,$value,$caption);
86
-			if(\is_array($attributes)){
87
-				$this->_applyAttributes($element, $attributes,$index);
85
+			$element=$elementCallback($id, $name, $value, $caption);
86
+			if (\is_array($attributes)) {
87
+				$this->_applyAttributes($element, $attributes, $index);
88 88
 			}
89 89
 			$element->setDisabled(!$this->_edition);
90 90
 			return $element;
@@ -93,153 +93,153 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 
96
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
97
-		$this->setValueFunction($index,function($value) use($label,$attributes){
98
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
96
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
97
+		$this->setValueFunction($index, function($value) use($label, $attributes){
98
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
99 99
 			return $pb;
100 100
 		});
101 101
 			return $this;
102 102
 	}
103 103
 
104
-	public function fieldAsRating($index,$max=5, $icon=""){
105
-		$this->setValueFunction($index,function($value) use($max,$icon){
106
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
104
+	public function fieldAsRating($index, $max=5, $icon="") {
105
+		$this->setValueFunction($index, function($value) use($max, $icon){
106
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
107 107
 			return $rating;
108 108
 		});
109 109
 			return $this;
110 110
 	}
111 111
 
112
-	public function fieldAsLabel($index,$icon=NULL){
113
-		$this->setValueFunction($index,function($caption) use($icon){
114
-			$lbl=$this->_getLabelField($caption,$icon);
112
+	public function fieldAsLabel($index, $icon=NULL) {
113
+		$this->setValueFunction($index, function($caption) use($icon){
114
+			$lbl=$this->_getLabelField($caption, $icon);
115 115
 			return $lbl;
116 116
 		});
117 117
 			return $this;
118 118
 	}
119 119
 
120
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
121
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
122
-			$header=new HtmlHeader($id,$niveau,$value);
123
-			if(isset($icon))
120
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
121
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
122
+			$header=new HtmlHeader($id, $niveau, $value);
123
+			if (isset($icon))
124 124
 				$header->asIcon($icon, $value);
125 125
 			return $header;
126
-		}, $index,$attributes,"header");
126
+		}, $index, $attributes, "header");
127 127
 	}
128 128
 
129 129
 
130
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
131
-		$this->setValueFunction($index,function($img) use($size,$circular){
132
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
130
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
131
+		$this->setValueFunction($index, function($img) use($size, $circular){
132
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
133 133
 			return $image;
134 134
 		});
135 135
 			return $this;
136 136
 	}
137 137
 
138
-	public function fieldAsAvatar($index,$attributes=NULL){
139
-		return $this->_fieldAs(function($id,$name,$value){
140
-			$img=new HtmlImage($id,$value);
138
+	public function fieldAsAvatar($index, $attributes=NULL) {
139
+		return $this->_fieldAs(function($id, $name, $value) {
140
+			$img=new HtmlImage($id, $value);
141 141
 			$img->asAvatar();
142 142
 			return $img;
143
-		}, $index,$attributes,"avatar");
143
+		}, $index, $attributes, "avatar");
144 144
 	}
145 145
 
146
-	public function fieldAsRadio($index,$attributes=NULL){
147
-		return $this->_fieldAs(function($id,$name,$value){
148
-			$input= new HtmlRadio($id,$name,$value,$value);
146
+	public function fieldAsRadio($index, $attributes=NULL) {
147
+		return $this->_fieldAs(function($id, $name, $value) {
148
+			$input=new HtmlRadio($id, $name, $value, $value);
149 149
 			return $input;
150
-		}, $index,$attributes,"radio");
150
+		}, $index, $attributes, "radio");
151 151
 	}
152 152
 
153
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
154
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
155
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
156
-		}, $index,$attributes,"radios");
153
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
154
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
155
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
156
+		}, $index, $attributes, "radios");
157 157
 	}
158 158
 
159
-	public function fieldAsInput($index,$attributes=NULL){
160
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
161
-			$input= new HtmlFormInput($id,$caption,"text",$value);
159
+	public function fieldAsInput($index, $attributes=NULL) {
160
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
161
+			$input=new HtmlFormInput($id, $caption, "text", $value);
162 162
 			return $this->_prepareFormFields($input, $name, $attributes);
163
-		}, $index,$attributes,"input");
163
+		}, $index, $attributes, "input");
164 164
 	}
165 165
 
166
-	public function fieldAsTextarea($index,$attributes=NULL){
167
-		return $this->_fieldAs(function($id,$name,$value){
168
-			$textarea=new HtmlFormTextarea($id,null,$value);
166
+	public function fieldAsTextarea($index, $attributes=NULL) {
167
+		return $this->_fieldAs(function($id, $name, $value) {
168
+			$textarea=new HtmlFormTextarea($id, null, $value);
169 169
 			$textarea->setName($name);
170 170
 			return $textarea;
171
-		}, $index,$attributes,"textarea");
171
+		}, $index, $attributes, "textarea");
172 172
 	}
173 173
 
174
-	public function fieldAsHidden($index,$attributes=NULL){
175
-		if(!\is_array($attributes)){
174
+	public function fieldAsHidden($index, $attributes=NULL) {
175
+		if (!\is_array($attributes)) {
176 176
 			$attributes=[];
177 177
 		}
178 178
 		$attributes["imputType"]="hidden";
179
-		return $this->fieldAsInput($index,$attributes);
179
+		return $this->fieldAsInput($index, $attributes);
180 180
 	}
181 181
 
182
-	public function fieldAsCheckbox($index,$attributes=NULL){
183
-		return $this->_fieldAs(function($id,$name,$value){
184
-			$input=new HtmlFormCheckbox($id,NULL,$this->_instanceViewer->getIdentifier());
182
+	public function fieldAsCheckbox($index, $attributes=NULL) {
183
+		return $this->_fieldAs(function($id, $name, $value) {
184
+			$input=new HtmlFormCheckbox($id, NULL, $this->_instanceViewer->getIdentifier());
185 185
 			$input->setChecked(JString::isBooleanTrue($value));
186 186
 			$input->setName($name);
187 187
 			return $input;
188
-		}, $index,$attributes,"ck");
188
+		}, $index, $attributes, "ck");
189 189
 	}
190 190
 
191
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
192
-		return $this->_fieldAs(function($id,$name,$value) use($elements,$multiple){
193
-			$dd=new HtmlFormDropdown($id,$elements,NULL,$value);
194
-			$dd->asSelect($name,$multiple);
191
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
192
+		return $this->_fieldAs(function($id, $name, $value) use($elements, $multiple){
193
+			$dd=new HtmlFormDropdown($id, $elements, NULL, $value);
194
+			$dd->asSelect($name, $multiple);
195 195
 			return $dd;
196
-		}, $index,$attributes,"dd");
196
+		}, $index, $attributes, "dd");
197 197
 	}
198 198
 
199
-	public function fieldAsMessage($index,$attributes=NULL){
200
-		return $this->_fieldAs(function($id,$name,$value,$caption){
201
-			$mess= new HtmlMessage("message-".$id,$value);
199
+	public function fieldAsMessage($index, $attributes=NULL) {
200
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
201
+			$mess=new HtmlMessage("message-".$id, $value);
202 202
 			$mess->addHeader($caption);
203 203
 			return $mess;
204
-		}, $index,$attributes,"message");
204
+		}, $index, $attributes, "message");
205 205
 	}
206 206
 
207 207
 	/**Change fields type
208 208
 	 * @param array $types an array or associative array $type=>$attribute
209 209
 	 */
210
-	public function fieldsAs(array $types){
210
+	public function fieldsAs(array $types) {
211 211
 		$i=0;
212
-		if(JArray::isAssociative($types)){
213
-			foreach ($types as $type=>$attributes){
214
-				if(\is_int($type))
215
-					$this->fieldAs($i++,$attributes,[]);
212
+		if (JArray::isAssociative($types)) {
213
+			foreach ($types as $type=>$attributes) {
214
+				if (\is_int($type))
215
+					$this->fieldAs($i++, $attributes, []);
216 216
 				else
217
-					$this->fieldAs($i++,$type,$attributes);
217
+					$this->fieldAs($i++, $type, $attributes);
218 218
 			}
219
-		}else{
220
-			foreach ($types as $type){
221
-				$this->fieldAs($i++,$type);
219
+		} else {
220
+			foreach ($types as $type) {
221
+				$this->fieldAs($i++, $type);
222 222
 			}
223 223
 		}
224 224
 	}
225 225
 
226
-	public function fieldAs($index,$type,$attributes=NULL){
226
+	public function fieldAs($index, $type, $attributes=NULL) {
227 227
 		$method="fieldAs".\ucfirst($type);
228
-		if(\method_exists($this, $method)){
229
-			if(!\is_array($attributes)){
228
+		if (\method_exists($this, $method)) {
229
+			if (!\is_array($attributes)) {
230 230
 				$attributes=[$index];
231
-			}else{
231
+			} else {
232 232
 				\array_unshift($attributes, $index);
233 233
 			}
234
-			\call_user_func_array([$this,$method], $attributes);
234
+			\call_user_func_array([$this, $method], $attributes);
235 235
 		}
236 236
 	}
237 237
 
238
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
239
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
240
-			$button=new HtmlButton($id,$value,$cssStyle);
241
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,$attributes["ajax"]);
238
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
239
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
240
+			$button=new HtmlButton($id, $value, $cssStyle);
241
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, $attributes["ajax"]);
242 242
 			return $button;
243
-		}, $index,$attributes,"submit");
243
+		}, $index, $attributes, "submit");
244 244
 	}
245 245
 }
246 246
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/html/traits/BaseHtmlEventsTrait.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
  * @property SimpleExtComponent $_bsComponent
12 12
  * @property string identifier
13 13
  */
14
-trait BaseHtmlEventsTrait{
14
+trait BaseHtmlEventsTrait {
15 15
 
16
-	protected $_events=array ();
16
+	protected $_events=array();
17 17
 
18 18
 	/**
19 19
 	 * @param string $event
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 	 * @return \Ajax\common\html\BaseHtml
24 24
 	 */
25 25
 	public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
26
-		if ($stopPropagation === true) {
27
-			$jsCode=Javascript::$stopPropagation . $jsCode;
26
+		if ($stopPropagation===true) {
27
+			$jsCode=Javascript::$stopPropagation.$jsCode;
28 28
 		}
29
-		if ($preventDefault === true) {
30
-			$jsCode=Javascript::$preventDefault . $jsCode;
29
+		if ($preventDefault===true) {
30
+			$jsCode=Javascript::$preventDefault.$jsCode;
31 31
 		}
32 32
 		return $this->_addEvent($event, $jsCode);
33 33
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			if (\is_array($this->_events[$event])) {
43 43
 				$this->_events[$event][]=$jsCode;
44 44
 			} else {
45
-				$this->_events[$event]=array ($this->_events[$event],$jsCode );
45
+				$this->_events[$event]=array($this->_events[$event], $jsCode);
46 46
 			}
47 47
 		} else {
48 48
 			$this->_events[$event]=$jsCode;
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 		return $this->onClick($jsCode);
70 70
 	}
71 71
 
72
-	public function onCreate($jsCode){
73
-		if(isset($this->_events["_create"])){
72
+	public function onCreate($jsCode) {
73
+		if (isset($this->_events["_create"])) {
74 74
 			$this->_events["_create"][]=$jsCode;
75
-		}else{
75
+		} else {
76 76
 			$this->_events["_create"]=[$jsCode];
77 77
 		}
78 78
 		return $this;
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 	public function addEventsOnRun(JsUtils $js=NULL) {
82 82
 		$this->_eventsOnCreate($js);
83 83
 		if (isset($this->_bsComponent)) {
84
-			foreach ( $this->_events as $event => $jsCode ) {
84
+			foreach ($this->_events as $event => $jsCode) {
85 85
 				$code=$jsCode;
86 86
 				if (\is_array($jsCode)) {
87 87
 					$code="";
88
-					foreach ( $jsCode as $jsC ) {
88
+					foreach ($jsCode as $jsC) {
89 89
 						if ($jsC instanceof AjaxCall) {
90
-							$code.="\n" . $jsC->compile($js);
90
+							$code.="\n".$jsC->compile($js);
91 91
 						} else {
92
-							$code.="\n" . $jsC;
92
+							$code.="\n".$jsC;
93 93
 						}
94 94
 					}
95 95
 				} elseif ($jsCode instanceof AjaxCall) {
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 				}
98 98
 				$this->_bsComponent->addEvent($event, $code);
99 99
 			}
100
-			$this->_events=array ();
100
+			$this->_events=array();
101 101
 		}
102 102
 	}
103 103
 
104
-	protected function _eventsOnCreate(JsUtils $js=NULL){
105
-		if(isset($this->_events["_create"])){
104
+	protected function _eventsOnCreate(JsUtils $js=NULL) {
105
+		if (isset($this->_events["_create"])) {
106 106
 			$create=$this->_events["_create"];
107
-			if(\is_array($create)){
107
+			if (\is_array($create)) {
108 108
 				$create=\implode("", $create);
109 109
 			}
110
-			if(isset($js) && $create!=="")
111
-				$js->exec($create,true);
110
+			if (isset($js) && $create!=="")
111
+				$js->exec($create, true);
112 112
 			unset($this->_events["_create"]);
113 113
 		}
114 114
 	}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * @return BaseHtml
123 123
 	 */
124 124
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
125
-		$params=array ("url" => $url,"responseElement" => $responseElement );
125
+		$params=array("url" => $url, "responseElement" => $responseElement);
126 126
 		$params=array_merge($params, $parameters);
127 127
 		$this->_addEvent($event, new AjaxCall($operation, $params));
128 128
 		return $this;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	}
156 156
 
157 157
 	public function jsDoJquery($jqueryCall, $param="") {
158
-		return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");";
158
+		return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");";
159 159
 	}
160 160
 
161 161
 	public function executeOnRun($jsCode) {
Please login to merge, or discard this patch.
Ajax/service/Javascript.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 	public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n";
7 7
 	public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n";
8 8
 
9
-	public static function containsCode($expression){
10
-		return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false;
9
+	public static function containsCode($expression) {
10
+		return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false;
11 11
 	}
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@
 block discarded – undo
32 32
 		if ($stopPropagation===true) {
33 33
 			$result.=Javascript::$stopPropagation;
34 34
 		}
35
-		switch($this->method) {
35
+		switch ($this->method) {
36 36
 			case "get":
37
-				$result.=$js->getDeferred($url, $responseElement, $params, $callback, $attr,$jqueryDone);
37
+				$result.=$js->getDeferred($url, $responseElement, $params, $callback, $attr, $jqueryDone);
38 38
 				break;
39 39
 			case "post":
40
-				$result.=$js->postDeferred($url, $responseElement, $params, $callback, $attr,$hasLoader,$jqueryDone);
40
+				$result.=$js->postDeferred($url, $responseElement, $params, $callback, $attr, $hasLoader, $jqueryDone);
41 41
 				break;
42 42
 			case "postForm":
43
-				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $callback, $attr,$hasLoader,$jqueryDone);
43
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $callback, $attr, $hasLoader, $jqueryDone);
44 44
 				break;
45 45
 		}
46 46
 		return $result;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
 use Ajax\service\AjaxCall;
7 7
 use Ajax\JsUtils;
8 8
 
9
-trait FormTrait{
9
+trait FormTrait {
10 10
 
11 11
 	/**
12 12
 	 * @return HtmlForm
13 13
 	 */
14 14
 	abstract protected function getForm();
15 15
 
16
-	protected function addCompoValidation($compo,$field){
16
+	protected function addCompoValidation($compo, $field) {
17 17
 		$validation=$field->getValidation();
18
-		if(isset($validation)){
18
+		if (isset($validation)) {
19 19
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
20 20
 			$compo->addFieldValidation($validation);
21 21
 		}
22 22
 		return $compo;
23 23
 	}
24 24
 
25
-	protected function _runValidationParams(&$compo,JsUtils $js=NULL){
25
+	protected function _runValidationParams(&$compo, JsUtils $js=NULL) {
26 26
 		$form=$this->getForm();
27 27
 		$params=$form->getValidationParams();
28
-		if(isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall){
28
+		if (isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall) {
29 29
 			$compilation=$params["_ajaxSubmit"]->compile($js);
30
-			$compilation=str_ireplace("\"","%quote%", $compilation);
30
+			$compilation=str_ireplace("\"", "%quote%", $compilation);
31 31
 			$this->onSuccess($compilation);
32 32
 			$form->removeValidationParam("_ajaxSubmit");
33 33
 		}
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 		return $this->getForm()->addToProperty("class", "loading");
41 41
 	}
42 42
 
43
-	public function setAttached($value=true){
43
+	public function setAttached($value=true) {
44 44
 		$form=$this->getForm();
45
-		if($value)
46
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
45
+		if ($value)
46
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
47 47
 		return $form;
48 48
 	}
49 49
 
50
-	public function addErrorMessage(){
50
+	public function addErrorMessage() {
51 51
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
52 52
 	}
53 53
 
@@ -62,38 +62,38 @@  discard block
 block discarded – undo
62 62
 	 * @param string $responseElement
63 63
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
64 64
 	 */
65
-	public function submitOn($event,$identifier,$url,$responseElement){
65
+	public function submitOn($event, $identifier, $url, $responseElement) {
66 66
 		$form=$this->getForm();
67 67
 		$elem=$form->getElementById($identifier, $form->getContent());
68
-		if(isset($elem)){
69
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement);
68
+		if (isset($elem)) {
69
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement);
70 70
 		}
71 71
 		return $form;
72 72
 	}
73 73
 
74
-	public function submitOnClick($identifier,$url,$responseElement){
74
+	public function submitOnClick($identifier, $url, $responseElement) {
75 75
 		return $this->submitOn("click", $identifier, $url, $responseElement);
76 76
 	}
77 77
 
78
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){
79
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
80
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement);
78
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) {
79
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
80
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement);
81 81
 	}
82 82
 
83
-	protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL,$parameters=NULL){
83
+	protected function _buttonAsSubmit(&$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
84 84
 		$form=$this->getForm();
85
-		if(isset($url) && isset($responseElement)){
85
+		if (isset($url) && isset($responseElement)) {
86 86
 			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');");
87
-			$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url];
88
-			if(\is_array($parameters))
89
-				$params=\array_merge($params,$parameters);
87
+			$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url];
88
+			if (\is_array($parameters))
89
+				$params=\array_merge($params, $parameters);
90 90
 			$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
91 91
 		}
92 92
 		return $button;
93 93
 	}
94 94
 
95
-	public function addReset($identifier,$value,$cssStyle=NULL){
96
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
95
+	public function addReset($identifier, $value, $cssStyle=NULL) {
96
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
97 97
 		$bt->setProperty("type", "reset");
98 98
 		return $bt;
99 99
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @param string $jsCode
104 104
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
105 105
 	 */
106
-	public function onValid($jsCode){
106
+	public function onValid($jsCode) {
107 107
 		$form=$this->getForm();
108 108
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
109 109
 		return $form;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @param string $jsCode can use event and fields parameters
115 115
 	 * @return HtmlForm
116 116
 	 */
117
-	public function onSuccess($jsCode){
117
+	public function onSuccess($jsCode) {
118 118
 		$form=$this->getForm();
119 119
 		$form->addValidationParam("onSuccess", "%function(event,fields){console.log(fields);".$jsCode."}%");
120 120
 		return $form;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 * @return \Ajax\semantic\html\collections\HtmlMenu
41 41
 	 */
42 42
 	public function setType($type="") {
43
-		return $this->addToPropertyCtrl("class", $type, array ("","item","text" ));
43
+		return $this->addToPropertyCtrl("class", $type, array("", "item", "text"));
44 44
 	}
45 45
 
46 46
 	public function setActiveItem($index) {
47 47
 		$item=$this->getItem($index);
48
-		if ($item !== null) {
48
+		if ($item!==null) {
49 49
 			$item->addToProperty("class", "active");
50 50
 		}
51 51
 		return $this;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 	private function getItemToInsert($item) {
55 55
 		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) {
56
-			$itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item);
56
+			$itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item);
57 57
 			$item=$itemO;
58 58
 		}
59 59
 		return $item;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 	private function afterInsert($item) {
63 63
 		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
64
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
64
+			$item->addToPropertyCtrl("class", "item", array("item"));
65 65
 		else {
66 66
 			$this->setSecondary();
67 67
 		}
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	public function addItem($item) {
78 78
 		$number=$item;
79 79
 		$item=parent::addItem($this->getItemToInsert($item));
80
-		if(\is_int($number))
80
+		if (\is_int($number))
81 81
 			$item->setProperty("data-page", $number);
82 82
 		return $this->afterInsert($item);
83 83
 	}
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 
96 96
 	public function generateMenuAsItem($menu, $header=null) {
97 97
 		$count=$this->count();
98
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
98
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
99 99
 		if (isset($header)) {
100
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
100
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
101 101
 			$headerItem->setContent($header);
102 102
 			$item->addContent($headerItem);
103 103
 			$this->_itemHeader=$headerItem;
104 104
 		}
105
-		if(\is_array($menu)){
106
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
105
+		if (\is_array($menu)) {
106
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
107 107
 		}
108 108
 		$menu->setClass("menu");
109 109
 		$item->addContent($menu);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
119 119
 		$value->addContent(new HtmlIcon("", "dropdown"));
120 120
 		$value=$this->addItem($value);
121
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
121
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
122 122
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
123 123
 		$this->wrap("", $popup);
124 124
 		return $popup;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	public function addDropdownAsItem($value, $items=NULL) {
128 128
 		$dd=$value;
129 129
 		if (\is_string($value)) {
130
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
130
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
131 131
 		}
132 132
 		$this->addItem($dd);
133 133
 		return $dd;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @see \Ajax\common\html\html5\HtmlCollection::createItem()
141 141
 	 */
142 142
 	protected function createItem($value) {
143
-		$itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),"");
143
+		$itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), "");
144 144
 		$itemO->setTagName("a");
145 145
 		$itemO->setContent($value);
146 146
 		return $itemO;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	public function setSecondary($value=true) {
154
-		if($value)
154
+		if ($value)
155 155
 			$this->addToProperty("class", "secondary");
156 156
 		else
157 157
 			$this->removePropertyValue("class", "secondary");
@@ -159,28 +159,28 @@  discard block
 block discarded – undo
159 159
 	}
160 160
 
161 161
 	public function setVertical() {
162
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
162
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
163 163
 	}
164 164
 
165 165
 	public function setPosition($value="right") {
166
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
166
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
167 167
 	}
168 168
 
169 169
 	public function setPointing($value=Direction::NONE) {
170
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
170
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
171 171
 	}
172 172
 
173 173
 	public function asTab($vertical=false) {
174
-		$this->apply(function (HtmlDoubleElement &$item) {
174
+		$this->apply(function(HtmlDoubleElement&$item) {
175 175
 			$item->setTagName("a");
176 176
 		});
177
-		if ($vertical === true)
177
+		if ($vertical===true)
178 178
 			$this->setVertical();
179 179
 		return $this->addToProperty("class", "tabular");
180 180
 	}
181 181
 
182 182
 	public function asPagination() {
183
-		$this->apply(function (HtmlDoubleElement &$item) {
183
+		$this->apply(function(HtmlDoubleElement&$item) {
184 184
 			$item->setTagName("a");
185 185
 		});
186 186
 		return $this->addToProperty("class", "pagination");
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function setWidth($width) {
219 219
 		if (\is_int($width)) {
220
-			$width=Wide::getConstants()["W" . $width];
220
+			$width=Wide::getConstants()["W".$width];
221 221
 		}
222 222
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
223
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
223
+		return $this->addToPropertyCtrl("class", "item", array("item"));
224 224
 	}
225 225
 
226 226
 	public function addImage($identifier, $src="", $alt="") {
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 		return $this->_itemHeader;
236 236
 	}
237 237
 
238
-	public function run(JsUtils $js){
239
-		$result= parent::run($js);
238
+	public function run(JsUtils $js) {
239
+		$result=parent::run($js);
240 240
 		return $result->setItemSelector(".item");
241 241
 	}
242 242
 }
243 243
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButtonGroups.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
 
17 17
 	public function __construct($identifier, $elements=array(), $asIcons=false) {
18 18
 		parent::__construct($identifier, "div", "ui buttons");
19
-		if ($asIcons === true)
19
+		if ($asIcons===true)
20 20
 			$this->asIcons();
21 21
 		$this->addElements($elements, $asIcons);
22 22
 	}
23
-	protected function createItem($value){
24
-		return new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $value);
23
+	protected function createItem($value) {
24
+		return new HtmlButton("button-".$this->identifier."-".\sizeof($this->content), $value);
25 25
 	}
26 26
 
27 27
 
28 28
 	public function addElement($element, $asIcon=false) {
29 29
 		$item=$this->addItem($element);
30
-		if($asIcon)
30
+		if ($asIcon)
31 31
 			$item->asIcon($element);
32 32
 		return $item;
33 33
 	}
34 34
 
35 35
 	public function addElements($elements, $asIcons=false) {
36
-		foreach ( $elements as $element ) {
36
+		foreach ($elements as $element) {
37 37
 			$this->addElement($element, $asIcons);
38 38
 		}
39 39
 		return $this;
40 40
 	}
41 41
 
42 42
 	public function insertOr($aferIndex=0, $or="or") {
43
-		$orElement=new HtmlSemDoubleElement("or-" . $this->identifier, "div", "or");
43
+		$orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or");
44 44
 		$orElement->setProperty("data-text", $or);
45
-		array_splice($this->content, $aferIndex + 1, 0, array ($orElement ));
45
+		array_splice($this->content, $aferIndex+1, 0, array($orElement));
46 46
 		return $this;
47 47
 	}
48 48
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public function asIcons() {
58
-		foreach ( $this->content as $item ) {
59
-			if($item instanceof HtmlButton)
58
+		foreach ($this->content as $item) {
59
+			if ($item instanceof HtmlButton)
60 60
 			$item->asIcon($item->getContent());
61 61
 		}
62 62
 		return $this->addToProperty("class", "icons");
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
90 90
 	 */
91 91
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
92
-		foreach ( $this->content as $element ) {
92
+		foreach ($this->content as $element) {
93 93
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
94 94
 		}
95 95
 		return $this;
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 
102 102
 	public function addClasses($classes=array()) {
103 103
 		$i=0;
104
-		if(!\is_array($classes)){
105
-			$classes=array_fill (0,$this->count(),$classes);
104
+		if (!\is_array($classes)) {
105
+			$classes=array_fill(0, $this->count(), $classes);
106 106
 		}
107
-		foreach ( $this->content as $button ) {
107
+		foreach ($this->content as $button) {
108 108
 			$button->addToProperty("class", $classes[$i++]);
109 109
 		}
110 110
 		return $this;
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 		$this->addElement($function($object));
119 119
 	}
120 120
 
121
-	public function run(JsUtils $js){
122
-		$result= parent::run($js);
121
+	public function run(JsUtils $js) {
122
+		$result=parent::run($js);
123 123
 		return $result->setItemSelector(".ui.button");
124 124
 	}
125 125
 }
126 126
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Ajax\semantic\html\collections\form\traits\FormTrait;
19 19
 
20 20
 abstract class Widget extends HtmlDoubleElement {
21
-	use FieldAsTrait,FormTrait;
21
+	use FieldAsTrait, FormTrait;
22 22
 
23 23
 	/**
24 24
 	 * @var string classname
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	protected $_generated;
52 52
 
53 53
 
54
-	public function __construct($identifier,$model,$modelInstance=NULL) {
54
+	public function __construct($identifier, $model, $modelInstance=NULL) {
55 55
 		parent::__construct($identifier);
56 56
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
57 57
 		$this->setModel($model);
58
-		if(isset($modelInstance)){
59
-			if(\is_array($modelInstance)){
58
+		if (isset($modelInstance)) {
59
+			if (\is_array($modelInstance)) {
60 60
 				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
61 61
 			}
62 62
 			$this->show($modelInstance);
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
 		$this->_generated=false;
65 65
 	}
66 66
 
67
-	protected function _init($instanceViewer,$contentKey,$content,$edition){
67
+	protected function _init($instanceViewer, $contentKey, $content, $edition) {
68 68
 		$this->_instanceViewer=$instanceViewer;
69 69
 		$this->content=[$contentKey=>$content];
70 70
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
71 71
 		$this->_edition=$edition;
72 72
 	}
73 73
 
74
-	protected function _getFieldIdentifier($prefix,$name=""){
74
+	protected function _getFieldIdentifier($prefix, $name="") {
75 75
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
76 76
 	}
77 77
 
78
-	protected function _getFieldName($index){
78
+	protected function _getFieldName($index) {
79 79
 		return $this->_instanceViewer->getFieldName($index);
80 80
 	}
81 81
 
82
-	protected function _getFieldCaption($index){
82
+	protected function _getFieldCaption($index) {
83 83
 		return $this->_instanceViewer->getCaption($index);
84 84
 	}
85 85
 
86
-	abstract protected  function _setToolbarPosition($table,$captions=NULL);
86
+	abstract protected  function _setToolbarPosition($table, $captions=NULL);
87 87
 
88
-	public function show($modelInstance){
88
+	public function show($modelInstance) {
89 89
 		$this->_modelInstance=$modelInstance;
90 90
 	}
91 91
 
@@ -109,56 +109,56 @@  discard block
 block discarded – undo
109 109
 
110 110
 	abstract public function getHtmlComponent();
111 111
 
112
-	public function setAttached($value=true){
112
+	public function setAttached($value=true) {
113 113
 		return $this->getHtmlComponent()->setAttached($value);
114 114
 	}
115 115
 
116
-	public function setColor($color){
116
+	public function setColor($color) {
117 117
 		return $this->getHtmlComponent()->setColor($color);
118 118
 	}
119 119
 
120 120
 
121
-	public function setCaptions($captions){
121
+	public function setCaptions($captions) {
122 122
 		$this->_instanceViewer->setCaptions($captions);
123 123
 		return $this;
124 124
 	}
125 125
 
126
-	public function setFields($fields){
126
+	public function setFields($fields) {
127 127
 		$this->_instanceViewer->setVisibleProperties($fields);
128 128
 		return $this;
129 129
 	}
130 130
 
131
-	public function addField($field){
131
+	public function addField($field) {
132 132
 		$this->_instanceViewer->addField($field);
133 133
 		return $this;
134 134
 	}
135 135
 
136
-	public function addMessage($attributes=NULL,$fieldName="message"){
136
+	public function addMessage($attributes=NULL, $fieldName="message") {
137 137
 		$this->_instanceViewer->addField($fieldName);
138 138
 		$count=$this->_instanceViewer->visiblePropertiesCount();
139
-		return $this->fieldAsMessage($count-1,$attributes);
139
+		return $this->fieldAsMessage($count-1, $attributes);
140 140
 	}
141 141
 
142
-	public function addErrorMessage(){
143
-		return $this->addMessage(["error"=>true],"message");
142
+	public function addErrorMessage() {
143
+		return $this->addMessage(["error"=>true], "message");
144 144
 	}
145 145
 
146
-	public function insertField($index,$field){
146
+	public function insertField($index, $field) {
147 147
 		$this->_instanceViewer->insertField($index, $field);
148 148
 		return $this;
149 149
 	}
150 150
 
151
-	public function insertInField($index,$field){
151
+	public function insertInField($index, $field) {
152 152
 		$this->_instanceViewer->insertInField($index, $field);
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function setValueFunction($index,$callback){
156
+	public function setValueFunction($index, $callback) {
157 157
 		$this->_instanceViewer->setValueFunction($index, $callback);
158 158
 		return $this;
159 159
 	}
160 160
 
161
-	public function setIdentifierFunction($callback){
161
+	public function setIdentifierFunction($callback) {
162 162
 		$this->_instanceViewer->setIdentifierFunction($callback);
163 163
 		return $this;
164 164
 	}
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	/**
167 167
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
168 168
 	 */
169
-	public function getToolbar(){
170
-		if(isset($this->_toolbar)===false){
169
+	public function getToolbar() {
170
+		if (isset($this->_toolbar)===false) {
171 171
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
172 172
 		}
173 173
 		return $this->_toolbar;
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * @param callable $callback function to call on $element
180 180
 	 * @return \Ajax\common\html\HtmlDoubleElement
181 181
 	 */
182
-	public function addInToolbar($element,$callback=NULL){
182
+	public function addInToolbar($element, $callback=NULL) {
183 183
 		$tb=$this->getToolbar();
184
-		if(isset($callback)){
185
-			if(\is_callable($callback)){
184
+		if (isset($callback)) {
185
+			if (\is_callable($callback)) {
186 186
 				$callback($element);
187 187
 			}
188 188
 		}
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 	 * @param callable $callback function($element)
196 196
 	 * @return \Ajax\common\html\HtmlDoubleElement
197 197
 	 */
198
-	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
199
-		$result=$this->addInToolbar($caption,$callback);
200
-		if(isset($icon))
198
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
199
+		$result=$this->addInToolbar($caption, $callback);
200
+		if (isset($icon))
201 201
 			$result->addIcon($icon);
202 202
 		return $result;
203 203
 	}
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 	 * @param callable $callback function($element)
208 208
 	 * @return \Ajax\common\Widget
209 209
 	 */
210
-	public function addItemsInToolbar(array $items,$callback=NULL){
211
-		if(JArray::isAssociative($items)){
212
-			foreach ($items as $icon=>$item){
213
-				$this->addItemInToolbar($item,$icon,$callback);
210
+	public function addItemsInToolbar(array $items, $callback=NULL) {
211
+		if (JArray::isAssociative($items)) {
212
+			foreach ($items as $icon=>$item) {
213
+				$this->addItemInToolbar($item, $icon, $callback);
214 214
 			}
215
-		}else{
216
-			foreach ($items as $item){
217
-				$this->addItemInToolbar($item,null,$callback);
215
+		} else {
216
+			foreach ($items as $item) {
217
+				$this->addItemInToolbar($item, null, $callback);
218 218
 			}
219 219
 		}
220 220
 		return $this;
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
 	 * @param callable $callback function($element)
227 227
 	 * @return \Ajax\common\html\HtmlDoubleElement
228 228
 	 */
229
-	public function addDropdownInToolbar($value,$items,$callback=NULL){
229
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
230 230
 		$dd=$value;
231 231
 		if (\is_string($value)) {
232
-			$dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items);
232
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
233 233
 		}
234
-		return $this->addInToolbar($dd,$callback);
234
+		return $this->addInToolbar($dd, $callback);
235 235
 	}
236 236
 
237 237
 	/**
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 	 * @param callable $callback function($element)
241 241
 	 * @return \Ajax\common\html\HtmlDoubleElement
242 242
 	 */
243
-	public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){
244
-		$bt=new HtmlButton("bt-".$caption,$caption,$cssStyle);
245
-		return $this->addInToolbar($bt,$callback);
243
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
244
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
245
+		return $this->addInToolbar($bt, $callback);
246 246
 	}
247 247
 
248 248
 	/**
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
 	 * @param callable $callback function($element)
252 252
 	 * @return \Ajax\common\html\HtmlDoubleElement
253 253
 	 */
254
-	public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){
255
-		$bts=new HtmlButtonGroups("",$captions,$asIcon);
256
-		return $this->addInToolbar($bts,$callback);
254
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
255
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
256
+		return $this->addInToolbar($bts, $callback);
257 257
 	}
258 258
 
259 259
 	/**
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
 	 * @param boolean $labeled
264 264
 	 * @return \Ajax\common\html\HtmlDoubleElement
265 265
 	 */
266
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
267
-		$bt=new HtmlButton("",$caption);
268
-		$bt->addIcon($icon,$before,$labeled);
266
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
267
+		$bt=new HtmlButton("", $caption);
268
+		$bt->addIcon($icon, $before, $labeled);
269 269
 		return $this->addInToolbar($bt);
270 270
 	}
271 271
 
272
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
273
-		$button=new HtmlButton($identifier,$value,$cssStyle);
274
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters);
272
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
273
+		$button=new HtmlButton($identifier, $value, $cssStyle);
274
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
275 275
 		return $this->addInToolbar($button);
276 276
 	}
277 277
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model
302 302
 	 * @return \Ajax\common\Widget
303 303
 	 */
304
-	public function setDefaultValueFunction($defaultValueFunction){
304
+	public function setDefaultValueFunction($defaultValueFunction) {
305 305
 		$this->_instanceViewer->setDefaultValueFunction($defaultValueFunction);
306 306
 		return $this;
307 307
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @param string|boolean $disable
311 311
 	 * @return string
312 312
 	 */
313
-	public function jsDisabled($disable=true){
313
+	public function jsDisabled($disable=true) {
314 314
 		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
315 315
 	}
316 316
 
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 319
 	 * @param callable $callback function($element)
320 320
 	 * @return \Ajax\common\html\HtmlDoubleElement
321 321
 	 */
322
-	public function addEditButtonInToolbar($caption,$callback=NULL){
323
-		$bt=new HtmlButton($this->identifier."-editBtn",$caption);
322
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
323
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
324 324
 		$bt->setToggle();
325 325
 		$bt->setActive($this->_edition);
326 326
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
327
-		return $this->addInToolbar($bt,$callback);
327
+		return $this->addInToolbar($bt, $callback);
328 328
 	}
329 329
 
330 330
 	public function setToolbar(HtmlMenu $_toolbar) {
@@ -338,35 +338,35 @@  discard block
 block discarded – undo
338 338
 	}
339 339
 
340 340
 	public function getForm() {
341
-		if(!isset($this->_form)){
341
+		if (!isset($this->_form)) {
342 342
 			$this->_form=new HtmlForm("frm-".$this->identifier);
343 343
 			$this->setEdition(true);
344 344
 		}
345 345
 		return $this->_form;
346 346
 	}
347 347
 
348
-	public function run(JsUtils $js){
348
+	public function run(JsUtils $js) {
349 349
 		$result=parent::run($js);
350
-		if(isset($this->_form)){
350
+		if (isset($this->_form)) {
351 351
 			$result=$this->runForm($js);
352 352
 		}
353 353
 		return $result;
354 354
 	}
355 355
 
356
-	protected function runForm(JsUtils $js){
356
+	protected function runForm(JsUtils $js) {
357 357
 		$fields=$this->getContentInstances(HtmlFormField::class);
358
-		foreach ($fields as $field){
358
+		foreach ($fields as $field) {
359 359
 			$this->_form->addField($field);
360 360
 		}
361 361
 		return $this->_form->run($js);
362 362
 	}
363 363
 
364
-	protected function _compileForm(){
365
-		if(isset($this->_form)){
364
+	protected function _compileForm() {
365
+		if (isset($this->_form)) {
366 366
 			$noValidate="";
367
-			if(\sizeof($this->_form->getValidationParams())>0)
367
+			if (\sizeof($this->_form->getValidationParams())>0)
368 368
 				$noValidate="novalidate";
369
-			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
369
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
370 370
 		}
371 371
 	}
372 372
 
Please login to merge, or discard this patch.