Completed
Push — master ( 3ad5ef...acbd35 )
by Jean-Christophe
03:30
created
Ajax/semantic/widgets/base/FieldAsTrait.php 2 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -30,9 +30,17 @@  discard block
 block discarded – undo
30 30
 trait FieldAsTrait{
31 31
 
32 32
 	abstract protected function _getFieldIdentifier($prefix,$name="");
33
+
34
+	/**
35
+	 * @param \Closure $callback
36
+	 */
33 37
 	abstract public function setValueFunction($index,$callback);
34 38
 	abstract protected function _getFieldName($index);
35 39
 	abstract protected function _getFieldCaption($index);
40
+
41
+	/**
42
+	 * @param string $event
43
+	 */
36 44
 	abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
37 45
 
38 46
 	/**
@@ -243,6 +251,9 @@  discard block
 block discarded – undo
243 251
 		}
244 252
 	}
245 253
 
254
+	/**
255
+	 * @param integer $index
256
+	 */
246 257
 	public function fieldAs($index,$type,$attributes=NULL){
247 258
 		$method="fieldAs".\ucfirst($type);
248 259
 		if(\method_exists($this, $method)){
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
  * @property boolean $_edition
28 28
  * @property mixed _modelInstance
29 29
  */
30
-trait FieldAsTrait{
30
+trait FieldAsTrait {
31 31
 
32
-	abstract protected function _getFieldIdentifier($prefix,$name="");
33
-	abstract public function setValueFunction($index,$callback);
32
+	abstract protected function _getFieldIdentifier($prefix, $name="");
33
+	abstract public function setValueFunction($index, $callback);
34 34
 	abstract protected function _getFieldName($index);
35 35
 	abstract protected function _getFieldCaption($index);
36
-	abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
36
+	abstract protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL);
37 37
 
38 38
 	/**
39 39
 	 * @param HtmlFormField $element
40 40
 	 * @param array $attributes
41 41
 	 */
42
-	protected function _applyAttributes($element,&$attributes,$index){
43
-		if(isset($attributes["jsCallback"])){
42
+	protected function _applyAttributes($element, &$attributes, $index) {
43
+		if (isset($attributes["jsCallback"])) {
44 44
 			$callback=$attributes["jsCallback"];
45
-			if(\is_callable($callback)){
46
-				$callback($element,$this->_modelInstance,$index);
45
+			if (\is_callable($callback)) {
46
+				$callback($element, $this->_modelInstance, $index);
47 47
 				unset($attributes["jsCallback"]);
48 48
 			}
49 49
 		}
@@ -53,43 +53,43 @@  discard block
 block discarded – undo
53 53
 		$element->fromArray($attributes);
54 54
 	}
55 55
 
56
-	private function _getLabelField($caption,$icon=NULL){
57
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
56
+	private function _getLabelField($caption, $icon=NULL) {
57
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
58 58
 		return $label;
59 59
 	}
60 60
 
61 61
 
62
-	protected function _addRules($element,&$attributes){
63
-		if(isset($attributes["rules"])){
62
+	protected function _addRules($element, &$attributes) {
63
+		if (isset($attributes["rules"])) {
64 64
 			$rules=$attributes["rules"];
65
-			if(\is_array($rules)){
65
+			if (\is_array($rules)) {
66 66
 				$element->addRules($rules);
67 67
 			}
68
-			else{
68
+			else {
69 69
 				$element->addRule($rules);
70 70
 			}
71 71
 			unset($attributes["rules"]);
72 72
 		}
73 73
 	}
74 74
 
75
-	protected function _prepareFormFields(&$field,$name,&$attributes){
75
+	protected function _prepareFormFields(&$field, $name, &$attributes) {
76 76
 		$field->setName($name);
77 77
 		$this->_addRules($field, $attributes);
78 78
 		return $field;
79 79
 	}
80 80
 
81
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
82
-		$this->setValueFunction($index,function($value,$instance,$index) use (&$attributes,$elementCallback,$prefix){
81
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
82
+		$this->setValueFunction($index, function($value, $instance, $index) use (&$attributes, $elementCallback, $prefix){
83 83
 			$caption=$this->_getFieldCaption($index);
84 84
 			$name=$this->_getFieldName($index);
85
-			$id=$this->_getFieldIdentifier($prefix,$name);
86
-			if(isset($attributes["name"])){
85
+			$id=$this->_getFieldIdentifier($prefix, $name);
86
+			if (isset($attributes["name"])) {
87 87
 				$name=$attributes["name"];
88 88
 				unset($attributes["name"]);
89 89
 			}
90
-			$element=$elementCallback($id,$name,$value,$caption);
91
-			if(\is_array($attributes)){
92
-				$this->_applyAttributes($element, $attributes,$index);
90
+			$element=$elementCallback($id, $name, $value, $caption);
91
+			if (\is_array($attributes)) {
92
+				$this->_applyAttributes($element, $attributes, $index);
93 93
 			}
94 94
 			$element->setDisabled(!$this->_edition);
95 95
 			return $element;
@@ -98,175 +98,175 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 
101
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
102
-		$this->setValueFunction($index,function($value) use($label,$attributes){
103
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
101
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
102
+		$this->setValueFunction($index, function($value) use($label, $attributes){
103
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
104 104
 			return $pb;
105 105
 		});
106 106
 			return $this;
107 107
 	}
108 108
 
109
-	public function fieldAsRating($index,$max=5, $icon=""){
110
-		$this->setValueFunction($index,function($value) use($max,$icon){
111
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
109
+	public function fieldAsRating($index, $max=5, $icon="") {
110
+		$this->setValueFunction($index, function($value) use($max, $icon){
111
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
112 112
 			return $rating;
113 113
 		});
114 114
 			return $this;
115 115
 	}
116 116
 
117
-	public function fieldAsLabel($index,$icon=NULL){
118
-		$this->setValueFunction($index,function($caption) use($icon){
119
-			$lbl=$this->_getLabelField($caption,$icon);
117
+	public function fieldAsLabel($index, $icon=NULL) {
118
+		$this->setValueFunction($index, function($caption) use($icon){
119
+			$lbl=$this->_getLabelField($caption, $icon);
120 120
 			return $lbl;
121 121
 		});
122 122
 			return $this;
123 123
 	}
124 124
 
125
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
126
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
127
-			$header=new HtmlHeader($id,$niveau,$value);
128
-			if(isset($icon))
125
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
126
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
127
+			$header=new HtmlHeader($id, $niveau, $value);
128
+			if (isset($icon))
129 129
 				$header->asIcon($icon, $value);
130 130
 			return $header;
131
-		}, $index,$attributes,"header");
131
+		}, $index, $attributes, "header");
132 132
 	}
133 133
 
134 134
 
135
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
136
-		$this->setValueFunction($index,function($img) use($size,$circular){
137
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
135
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
136
+		$this->setValueFunction($index, function($img) use($size, $circular){
137
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
138 138
 			return $image;
139 139
 		});
140 140
 			return $this;
141 141
 	}
142 142
 
143
-	public function fieldAsFlag($index){
144
-		$this->setValueFunction($index,function($flag){
145
-			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"),$flag);
143
+	public function fieldAsFlag($index) {
144
+		$this->setValueFunction($index, function($flag) {
145
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
146 146
 			return $flag;
147 147
 		});
148 148
 			return $this;
149 149
 	}
150 150
 
151
-	public function fieldAsAvatar($index,$attributes=NULL){
152
-		return $this->_fieldAs(function($id,$name,$value){
153
-			$img=new HtmlImage($id,$value);
151
+	public function fieldAsAvatar($index, $attributes=NULL) {
152
+		return $this->_fieldAs(function($id, $name, $value) {
153
+			$img=new HtmlImage($id, $value);
154 154
 			$img->asAvatar();
155 155
 			return $img;
156
-		}, $index,$attributes,"avatar");
156
+		}, $index, $attributes, "avatar");
157 157
 	}
158 158
 
159
-	public function fieldAsRadio($index,$attributes=NULL){
160
-		return $this->_fieldAs(function($id,$name,$value) use($attributes){
161
-			$input= new HtmlRadio($id,$name,$value,$value);
159
+	public function fieldAsRadio($index, $attributes=NULL) {
160
+		return $this->_fieldAs(function($id, $name, $value) use($attributes){
161
+			$input=new HtmlRadio($id, $name, $value, $value);
162 162
 			return $this->_prepareFormFields($input, $name, $attributes);
163
-		}, $index,$attributes,"radio");
163
+		}, $index, $attributes, "radio");
164 164
 	}
165 165
 
166
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
167
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
168
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
169
-		}, $index,$attributes,"radios");
166
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
167
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
168
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
169
+		}, $index, $attributes, "radios");
170 170
 	}
171 171
 
172
-	public function fieldAsInput($index,$attributes=NULL){
173
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
174
-			$input= new HtmlFormInput($id,$caption,"text",$value);
172
+	public function fieldAsInput($index, $attributes=NULL) {
173
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
174
+			$input=new HtmlFormInput($id, $caption, "text", $value);
175 175
 			return $this->_prepareFormFields($input, $name, $attributes);
176
-		}, $index,$attributes,"input");
176
+		}, $index, $attributes, "input");
177 177
 	}
178 178
 
179
-	public function fieldAsTextarea($index,$attributes=NULL){
180
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
181
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
179
+	public function fieldAsTextarea($index, $attributes=NULL) {
180
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
181
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
182 182
 			return $this->_prepareFormFields($textarea, $name, $attributes);
183
-		}, $index,$attributes,"textarea");
183
+		}, $index, $attributes, "textarea");
184 184
 	}
185 185
 
186
-	public function fieldAsHidden($index,$attributes=NULL){
187
-		if(!\is_array($attributes)){
186
+	public function fieldAsHidden($index, $attributes=NULL) {
187
+		if (!\is_array($attributes)) {
188 188
 			$attributes=[];
189 189
 		}
190 190
 		$attributes["imputType"]="hidden";
191
-		return $this->fieldAsInput($index,$attributes);
191
+		return $this->fieldAsInput($index, $attributes);
192 192
 	}
193 193
 
194
-	public function fieldAsCheckbox($index,$attributes=NULL){
195
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
196
-			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
194
+	public function fieldAsCheckbox($index, $attributes=NULL) {
195
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($attributes){
196
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
197 197
 			$input->setChecked(JString::isBooleanTrue($value));
198 198
 			return $this->_prepareFormFields($input, $name, $attributes);
199
-		}, $index,$attributes,"ck");
199
+		}, $index, $attributes, "ck");
200 200
 	}
201 201
 
202
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
203
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple,$attributes){
204
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value);
205
-			$dd->asSelect($name,$multiple);
202
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
203
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple, $attributes){
204
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value);
205
+			$dd->asSelect($name, $multiple);
206 206
 			return $this->_prepareFormFields($dd, $name, $attributes);
207
-		}, $index,$attributes,"dd");
207
+		}, $index, $attributes, "dd");
208 208
 	}
209 209
 
210
-	public function fieldAsMessage($index,$attributes=NULL){
211
-		return $this->_fieldAs(function($id,$name,$value,$caption){
212
-			$mess= new HtmlMessage("message-".$id,$caption);
210
+	public function fieldAsMessage($index, $attributes=NULL) {
211
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
212
+			$mess=new HtmlMessage("message-".$id, $caption);
213 213
 			$mess->addHeader($value);
214 214
 			return $mess;
215
-		}, $index,$attributes,"message");
215
+		}, $index, $attributes, "message");
216 216
 	}
217 217
 
218
-	public function fieldAsLink($index,$attributes=NULL){
219
-		return $this->_fieldAs(function($id,$name,$value,$caption){
220
-			$lnk= new HtmlLink("message-".$id,"#",$caption);
218
+	public function fieldAsLink($index, $attributes=NULL) {
219
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
220
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
221 221
 			return $lnk;
222
-		}, $index,$attributes,"link");
222
+		}, $index, $attributes, "link");
223 223
 	}
224 224
 
225 225
 	/**Change fields type
226 226
 	 * @param array $types an array or associative array $type=>$attributes
227 227
 	 */
228
-	public function fieldsAs(array $types){
228
+	public function fieldsAs(array $types) {
229 229
 		$i=0;
230
-		if(JArray::isAssociative($types)){
231
-			foreach ($types as $type=>$attributes){
232
-				if(\is_int($type))
233
-					$this->fieldAs($i++,$attributes,[]);
234
-				else{
235
-					$type=preg_replace('/\d/', '', $type );
236
-					$this->fieldAs($i++,$type,$attributes);
230
+		if (JArray::isAssociative($types)) {
231
+			foreach ($types as $type=>$attributes) {
232
+				if (\is_int($type))
233
+					$this->fieldAs($i++, $attributes, []);
234
+				else {
235
+					$type=preg_replace('/\d/', '', $type);
236
+					$this->fieldAs($i++, $type, $attributes);
237 237
 				}
238 238
 			}
239
-		}else{
240
-			foreach ($types as $type){
241
-				$this->fieldAs($i++,$type);
239
+		} else {
240
+			foreach ($types as $type) {
241
+				$this->fieldAs($i++, $type);
242 242
 			}
243 243
 		}
244 244
 	}
245 245
 
246
-	public function fieldAs($index,$type,$attributes=NULL){
246
+	public function fieldAs($index, $type, $attributes=NULL) {
247 247
 		$method="fieldAs".\ucfirst($type);
248
-		if(\method_exists($this, $method)){
249
-			if(!\is_array($attributes)){
248
+		if (\method_exists($this, $method)) {
249
+			if (!\is_array($attributes)) {
250 250
 				$attributes=[$index];
251
-			}else{
251
+			} else {
252 252
 				\array_unshift($attributes, $index);
253 253
 			}
254
-			\call_user_func_array([$this,$method], $attributes);
254
+			\call_user_func_array([$this, $method], $attributes);
255 255
 		}
256 256
 	}
257 257
 
258
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
259
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
260
-			$button=new HtmlButton($id,$caption,$cssStyle);
261
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]);
258
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
259
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
260
+			$button=new HtmlButton($id, $caption, $cssStyle);
261
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
262 262
 			return $button;
263
-		}, $index,$attributes,"submit");
263
+		}, $index, $attributes, "submit");
264 264
 	}
265 265
 
266
-	public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){
267
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
268
-			$button=new HtmlButton($id,$value,$cssStyle);
266
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
267
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
268
+			$button=new HtmlButton($id, $value, $cssStyle);
269 269
 			return $button;
270
-		}, $index,$attributes,"button");
270
+		}, $index, $attributes, "button");
271 271
 	}
272 272
 }
273 273
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/components/Sticky.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 		return $this->setParam("context", $value);
22 22
 	}
23 23
 
24
-	public function setOffset($offset=0){
24
+	public function setOffset($offset=0) {
25 25
 		return $this->setParam("offset", $offset);
26 26
 	}
27 27
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class HtmlForm extends HtmlSemCollection {
22 22
 
23
-	use FieldsTrait,FormTrait;
23
+	use FieldsTrait, FormTrait;
24 24
 	/**
25 25
 	 * @var array
26 26
 	 */
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function __construct($identifier, $elements=array()) {
35 35
 		parent::__construct($identifier, "form", "ui form");
36
-		$this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ];
36
+		$this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED];
37 37
 		$this->setProperty("name", $this->identifier);
38
-		$this->_fields=array ();
38
+		$this->_fields=array();
39 39
 		$this->addItems($elements);
40 40
 		$this->_validationParams=[];
41 41
 	}
42 42
 
43
-	protected function getForm(){
43
+	protected function getForm() {
44 44
 		return $this;
45 45
 	}
46 46
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param string $caption
63 63
 	 * @return HtmlForm
64 64
 	 */
65
-	public function addDivider($caption=NULL){
66
-		return $this->addContent(new HtmlDivider("",$caption));
65
+	public function addDivider($caption=NULL) {
66
+		return $this->addContent(new HtmlDivider("", $caption));
67 67
 	}
68 68
 
69 69
 	/**
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 						$label=NULL;
86 86
 				}
87 87
 				$this->_fields=\array_merge($this->_fields, $fields);
88
-				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
88
+				$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
89 89
 			}
90 90
 			if (isset($label))
91 91
 				$fields=new HtmlFormField("", $fields, $label);
92 92
 		} else {
93
-			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
93
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count());
94 94
 		}
95 95
 		$this->addItem($fields);
96 96
 		return $fields;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 	public function addItem($item) {
100 100
 		$item=parent::addItem($item);
101
-		if (\is_subclass_of($item, HtmlFormField::class) === true) {
101
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
102 102
 			$this->_fields[]=$item;
103 103
 		}
104 104
 		return $item;
@@ -156,39 +156,39 @@  discard block
 block discarded – undo
156 156
 
157 157
 
158 158
 
159
-	public function compile(JsUtils $js=NULL,&$view=NULL){
160
-		if(\sizeof($this->_validationParams)>0)
159
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
160
+		if (\sizeof($this->_validationParams)>0)
161 161
 			$this->setProperty("novalidate", "");
162
-		return parent::compile($js,$view);
162
+		return parent::compile($js, $view);
163 163
 	}
164 164
 
165 165
 	public function run(JsUtils $js) {
166
-		if(isset($js)){
166
+		if (isset($js)) {
167 167
 			$compo=$js->semantic()->form("#".$this->identifier);
168
-		}else{
168
+		} else {
169 169
 			$compo=new Form();
170 170
 			$compo->attach("#".$this->identifier);
171 171
 		}
172
-		foreach ($this->_fields as $field){
173
-			if($field instanceof HtmlFormField){
172
+		foreach ($this->_fields as $field) {
173
+			if ($field instanceof HtmlFormField) {
174 174
 				$compo=$this->addCompoValidation($compo, $field);
175 175
 			}
176 176
 		}
177
-		foreach ($this->content as $field){
178
-			if($field instanceof HtmlFormFields){
177
+		foreach ($this->content as $field) {
178
+			if ($field instanceof HtmlFormFields) {
179 179
 				$items=$field->getItems();
180
-				foreach ($items as $_field){
181
-					if($_field instanceof HtmlFormField)
180
+				foreach ($items as $_field) {
181
+					if ($_field instanceof HtmlFormField)
182 182
 						$compo=$this->addCompoValidation($compo, $_field);
183 183
 				}
184 184
 			}
185 185
 		}
186
-		$this->_runValidationParams($compo,$js);
186
+		$this->_runValidationParams($compo, $js);
187 187
 		return $this->_bsComponent;
188 188
 	}
189 189
 
190
-	public function addValidationParam($paramName,$paramValue,$before="",$after=""){
191
-		$this->addBehavior($this->_validationParams, $paramName, $paramValue,$before,$after);
190
+	public function addValidationParam($paramName, $paramValue, $before="", $after="") {
191
+		$this->addBehavior($this->_validationParams, $paramName, $paramValue, $before, $after);
192 192
 		return $this;
193 193
 	}
194 194
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		return $this->_validationParams;
202 202
 	}
203 203
 
204
-	public function removeValidationParam($param){
204
+	public function removeValidationParam($param) {
205 205
 		unset($this->_validationParams[$param]);
206 206
 		return $this;
207 207
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -13,28 +13,28 @@  discard block
 block discarded – undo
13 13
  * @author jc
14 14
  *
15 15
  */
16
-trait FormTrait{
16
+trait FormTrait {
17 17
 
18 18
 	/**
19 19
 	 * @return HtmlForm
20 20
 	 */
21 21
 	abstract protected function getForm();
22 22
 
23
-	protected function addCompoValidation($compo,$field){
23
+	protected function addCompoValidation($compo, $field) {
24 24
 		$validation=$field->getValidation();
25
-		if(isset($validation)){
25
+		if (isset($validation)) {
26 26
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
27 27
 			$compo->addFieldValidation($validation);
28 28
 		}
29 29
 		return $compo;
30 30
 	}
31 31
 
32
-	protected function _runValidationParams(&$compo,JsUtils $js=NULL){
32
+	protected function _runValidationParams(&$compo, JsUtils $js=NULL) {
33 33
 		$form=$this->getForm();
34 34
 		$params=$form->getValidationParams();
35
-		if(isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall){
35
+		if (isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall) {
36 36
 			$compilation=$params["_ajaxSubmit"]->compile($js);
37
-			$compilation=str_ireplace("\"","%quote%", $compilation);
37
+			$compilation=str_ireplace("\"", "%quote%", $compilation);
38 38
 			$this->onSuccess($compilation);
39 39
 			$form->removeValidationParam("_ajaxSubmit");
40 40
 		}
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 		return $this;
53 53
 	}
54 54
 
55
-	public function setAttached($value=true){
55
+	public function setAttached($value=true) {
56 56
 		$form=$this->getForm();
57
-		if($value)
58
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
57
+		if ($value)
58
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
59 59
 		return $form;
60 60
 	}
61 61
 
62
-	public function addErrorMessage(){
62
+	public function addErrorMessage() {
63 63
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
64 64
 	}
65 65
 
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
 	 * @param array $parameters
76 76
 	 * @return HtmlForm
77 77
 	 */
78
-	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
78
+	public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) {
79 79
 		$form=$this->getForm();
80
-		if($identifierOrElement  instanceof BaseHtml)
80
+		if ($identifierOrElement  instanceof BaseHtml)
81 81
 			$elem=$identifierOrElement;
82 82
 		else
83 83
 			$elem=$form->getElementById($identifierOrElement, $form->getContent());
84
-		if(isset($elem)){
85
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
84
+		if (isset($elem)) {
85
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters);
86 86
 		}
87 87
 		return $form;
88 88
 	}
89 89
 
90
-	public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
91
-		return $this->submitOn("click", $identifier, $url, $responseElement,$parameters);
90
+	public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) {
91
+		return $this->submitOn("click", $identifier, $url, $responseElement, $parameters);
92 92
 	}
93 93
 
94
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
95
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
96
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters);
94
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
95
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
96
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters);
97 97
 	}
98 98
 
99
-	protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){
99
+	protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
100 100
 		$form=$this->getForm();
101
-		if(isset($url) && isset($responseElement)){
102
-			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
103
-			$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
104
-			if(\is_array($parameters))
105
-				$params=\array_merge($params,$parameters);
101
+		if (isset($url) && isset($responseElement)) {
102
+			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true);
103
+			$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true];
104
+			if (\is_array($parameters))
105
+				$params=\array_merge($params, $parameters);
106 106
 			$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
107 107
 		}
108 108
 		return $button;
109 109
 	}
110 110
 
111
-	public function addReset($identifier,$value,$cssStyle=NULL){
112
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
111
+	public function addReset($identifier, $value, $cssStyle=NULL) {
112
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
113 113
 		$bt->setProperty("type", "reset");
114 114
 		return $bt;
115 115
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param string $jsCode
120 120
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
121 121
 	 */
122
-	public function onValid($jsCode){
122
+	public function onValid($jsCode) {
123 123
 		$form=$this->getForm();
124 124
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
125 125
 		return $form;
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @param string $jsCode can use event and fields parameters
131 131
 	 * @return HtmlForm
132 132
 	 */
133
-	public function onSuccess($jsCode){
133
+	public function onSuccess($jsCode) {
134 134
 		$form=$this->getForm();
135
-		$form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%");
135
+		$form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%");
136 136
 		return $form;
137 137
 	}
138 138
 }
139 139
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
 	public function setAttached($value=true){
56 56
 		$form=$this->getForm();
57
-		if($value)
58
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
57
+		if($value) {
58
+					$form->addToPropertyCtrl("class", "attached", array ("attached" ));
59
+		}
59 60
 		return $form;
60 61
 	}
61 62
 
@@ -77,10 +78,11 @@  discard block
 block discarded – undo
77 78
 	 */
78 79
 	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
79 80
 		$form=$this->getForm();
80
-		if($identifierOrElement  instanceof BaseHtml)
81
-			$elem=$identifierOrElement;
82
-		else
83
-			$elem=$form->getElementById($identifierOrElement, $form->getContent());
81
+		if($identifierOrElement  instanceof BaseHtml) {
82
+					$elem=$identifierOrElement;
83
+		} else {
84
+					$elem=$form->getElementById($identifierOrElement, $form->getContent());
85
+		}
84 86
 		if(isset($elem)){
85 87
 			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
86 88
 		}
@@ -101,8 +103,9 @@  discard block
 block discarded – undo
101 103
 		if(isset($url) && isset($responseElement)){
102 104
 			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
103 105
 			$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
104
-			if(\is_array($parameters))
105
-				$params=\array_merge($params,$parameters);
106
+			if(\is_array($parameters)) {
107
+							$params=\array_merge($params,$parameters);
108
+			}
106 109
 			$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
107 110
 		}
108 111
 		return $button;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +26 added lines, -26 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,13 +235,13 @@  discard block
 block discarded – undo
235 235
 		return $this->_itemHeader;
236 236
 	}
237 237
 
238
-	public function setHasContainer(){
239
-		return $this->wrapContent("<div class='ui container'>","</div>");
238
+	public function setHasContainer() {
239
+		return $this->wrapContent("<div class='ui container'>", "</div>");
240 240
 	}
241 241
 
242
-	public function run(JsUtils $js){
243
-		$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false);
244
-		$result= parent::run($js);
242
+	public function run(JsUtils $js) {
243
+		$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}', false, false);
244
+		$result=parent::run($js);
245 245
 		return $result->setItemSelector(".item");
246 246
 	}
247 247
 }
248 248
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct($identifier, $rowCount, $colCount) {
29 29
 		parent::__construct($identifier, "table", "ui table");
30
-		$this->content=array ();
30
+		$this->content=array();
31 31
 		$this->setRowCount($rowCount, $colCount);
32
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
33
-		$this->_compileParts=["thead","tbody","tfoot"];
32
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
33
+		$this->_compileParts=["thead", "tbody", "tfoot"];
34 34
 		$this->_afterCompileEvents=[];
35 35
 	}
36 36
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 * @return HtmlTableContent
49 49
 	 */
50 50
 	public function getPart($key) {
51
-		if (\array_key_exists($key, $this->content) === false) {
51
+		if (\array_key_exists($key, $this->content)===false) {
52 52
 			$this->content[$key]=new HtmlTableContent("", $key);
53
-			if ($key !== "tbody") {
53
+			if ($key!=="tbody") {
54 54
 				$this->content[$key]->setRowCount(1, $this->_colCount);
55 55
 			}
56 56
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return boolean
96 96
 	 */
97 97
 	public function hasPart($key) {
98
-		return \array_key_exists($key, $this->content) === true;
98
+		return \array_key_exists($key, $this->content)===true;
99 99
 	}
100 100
 
101 101
 	/**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 	private function colAlign($colIndex, $function) {
232 232
 		if (\is_array($colIndex)) {
233
-			foreach ( $colIndex as $cIndex ) {
233
+			foreach ($colIndex as $cIndex) {
234 234
 				$this->colAlign($cIndex, $function);
235 235
 			}
236 236
 		} else {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @see HtmlSemDoubleElement::compile()
292 292
 	 */
293 293
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
294
-		if(\sizeof($this->_compileParts)<3){
294
+		if (\sizeof($this->_compileParts)<3) {
295 295
 			$this->_template="%content%";
296 296
 			$this->refresh();
297 297
 		}
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 
302 302
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
303 303
 		if ($this->propertyContains("class", "sortable")) {
304
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
304
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
305 305
 		}
306
-		if(isset($this->_activeRowSelector)){
306
+		if (isset($this->_activeRowSelector)) {
307 307
 			$this->_activeRowSelector->compile();
308 308
 		}
309 309
 	}
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 	public function fromDatabaseObject($object, $function) {
318 318
 		$result=$function($object);
319 319
 		if (\is_array($result)) {
320
-			$result= $this->addRow($function($object));
320
+			$result=$this->addRow($function($object));
321 321
 		} else {
322
-			$result= $this->getBody()->_addRow($result);
322
+			$result=$this->getBody()->_addRow($result);
323 323
 		}
324
-		if(isset($this->_afterCompileEvents["onNewRow"])){
325
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
326
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
324
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
325
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
326
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
327 327
 		}
328 328
 		return $result;
329 329
 	}
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 		return $this;
339 339
 	}
340 340
 
341
-	public function refresh(){
341
+	public function refresh() {
342 342
 		$this->_footer=$this->getFooter();
343 343
 		$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");');
344 344
 	}
345 345
 
346
-	public function run(JsUtils $js){
347
-		$result= parent::run($js);
348
-		if(isset($this->_footer))
346
+	public function run(JsUtils $js) {
347
+		$result=parent::run($js);
348
+		if (isset($this->_footer))
349 349
 			$this->_footer->run($js);
350 350
 		return $result;
351 351
 	}
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 	 * @param boolean $multiple
369 369
 	 * @return HtmlTable
370 370
 	 */
371
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
372
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
371
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
372
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
373 373
 		return $this;
374 374
 	}
375 375
 }
376 376
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlSticky.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@
 block discarded – undo
7 7
 
8 8
 class HtmlSticky extends HtmlSemDoubleElement {
9 9
 
10
-	public function __construct($identifier,$context=NULL,$content=NULL) {
10
+	public function __construct($identifier, $context=NULL, $content=NULL) {
11 11
 		parent::__construct($identifier, "div", "ui sticky", $content);
12
-		if(isset($content))
12
+		if (isset($content))
13 13
 			$this->setContext($context);
14 14
 	}
15 15
 
16
-	public function setContext($context){
16
+	public function setContext($context) {
17 17
 		$this->_params["context"]=$context;
18 18
 		return $this;
19 19
 	}
20 20
 
21
-	public function setFixed($value=NULL){
21
+	public function setFixed($value=NULL) {
22 22
 		$fixed="fixed";
23
-		if(isset($value))
23
+		if (isset($value))
24 24
 			$fixed.=" ".$value;
25
-		return $this->addToProperty("class",$fixed);
25
+		return $this->addToProperty("class", $fixed);
26 26
 	}
27 27
 
28
-	public function setBound($value=NULL){
28
+	public function setBound($value=NULL) {
29 29
 		$bound="bound";
30
-		if(isset($value))
30
+		if (isset($value))
31 31
 			$bound.=" ".$value;
32
-			return $this->addToProperty("class",$bound);
32
+			return $this->addToProperty("class", $bound);
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * {@inheritDoc}
37 37
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
38 38
 	 */
39
-	public function run(JsUtils $js){
39
+	public function run(JsUtils $js) {
40 40
 		parent::run($js);
41
-		return $js->semantic()->sticky("#".$this->identifier,$this->_params);
41
+		return $js->semantic()->sticky("#".$this->identifier, $this->_params);
42 42
 	}
43 43
 
44
-	public function setOffset($offset=0){
44
+	public function setOffset($offset=0) {
45 45
 		$this->_params["offset"]=$offset;
46 46
 		return $this;
47 47
 	}
48 48
 
49 49
 
50 50
 
51
-	public function setDebug($verbose=NULL){
51
+	public function setDebug($verbose=NULL) {
52 52
 		$this->_params["debug"]=true;
53
-		if(isset($verbose))
53
+		if (isset($verbose))
54 54
 			$this->_params["verbose"]=true;
55 55
 		return $this;
56 56
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 
10 10
 	public function __construct($identifier,$context=NULL,$content=NULL) {
11 11
 		parent::__construct($identifier, "div", "ui sticky", $content);
12
-		if(isset($content))
13
-			$this->setContext($context);
12
+		if(isset($content)) {
13
+					$this->setContext($context);
14
+		}
14 15
 	}
15 16
 
16 17
 	public function setContext($context){
@@ -20,15 +21,17 @@  discard block
 block discarded – undo
20 21
 
21 22
 	public function setFixed($value=NULL){
22 23
 		$fixed="fixed";
23
-		if(isset($value))
24
-			$fixed.=" ".$value;
24
+		if(isset($value)) {
25
+					$fixed.=" ".$value;
26
+		}
25 27
 		return $this->addToProperty("class",$fixed);
26 28
 	}
27 29
 
28 30
 	public function setBound($value=NULL){
29 31
 		$bound="bound";
30
-		if(isset($value))
31
-			$bound.=" ".$value;
32
+		if(isset($value)) {
33
+					$bound.=" ".$value;
34
+		}
32 35
 			return $this->addToProperty("class",$bound);
33 36
 	}
34 37
 
@@ -50,8 +53,9 @@  discard block
 block discarded – undo
50 53
 
51 54
 	public function setDebug($verbose=NULL){
52 55
 		$this->_params["debug"]=true;
53
-		if(isset($verbose))
54
-			$this->_params["verbose"]=true;
56
+		if(isset($verbose)) {
57
+					$this->_params["verbose"]=true;
58
+		}
55 59
 		return $this;
56 60
 	}
57 61
 }
58 62
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/checkbox/AbstractCheckbox.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 			$this->setLabel($label);
20 20
 	}
21 21
 
22
-	public function setChecked($value=true){
23
-		if($value===true){
22
+	public function setChecked($value=true) {
23
+		if ($value===true) {
24 24
 			$this->getField()->setProperty("checked", "checked");
25
-		}else{
25
+		} else {
26 26
 			$this->getField()->removeProperty("checked");
27 27
 		}
28 28
 		return $this;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox
85 85
 	 */
86 86
 	public function attachEvent($selector, $action=NULL) {
87
-		if (isset($action)||\is_numeric($action)===true) {
87
+		if (isset($action) || \is_numeric($action)===true) {
88 88
 			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");';
89 89
 		} else {
90 90
 			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'");';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function attachEvents($events=array()) {
102 102
 		if (\is_array($events)) {
103
-			foreach ( $events as $action => $selector ) {
103
+			foreach ($events as $action => $selector) {
104 104
 				$this->attachEvent($selector, $action);
105 105
 			}
106 106
 		}
@@ -111,24 +111,24 @@  discard block
 block discarded – undo
111 111
 		return $this->addToProperty("class", "fitted");
112 112
 	}
113 113
 
114
-	public function setOnChecked($jsCode){
114
+	public function setOnChecked($jsCode) {
115 115
 		$this->_params["onChecked"]=$jsCode;
116 116
 		return $this;
117 117
 	}
118 118
 
119
-	public function setOnUnchecked($jsCode){
119
+	public function setOnUnchecked($jsCode) {
120 120
 		$this->_params["onUnchecked"]=$jsCode;
121 121
 		return $this;
122 122
 	}
123 123
 
124
-	public function setOnChange($jsCode){
124
+	public function setOnChange($jsCode) {
125 125
 		$this->_params["onChange"]=$jsCode;
126 126
 		return $this;
127 127
 	}
128 128
 
129 129
 	public function run(JsUtils $js) {
130
-		if(!isset($this->_bsComponent))
131
-			$this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params);
130
+		if (!isset($this->_bsComponent))
131
+			$this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params);
132 132
 		return parent::run($js);
133 133
 	}
134 134
 }
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,14 +15,15 @@  discard block
 block discarded – undo
15 15
 		$field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value);
16 16
 		$field->setProperty("name", $name);
17 17
 		$this->setField($field);
18
-		if (isset($label))
19
-			$this->setLabel($label);
18
+		if (isset($label)) {
19
+					$this->setLabel($label);
20
+		}
20 21
 	}
21 22
 
22 23
 	public function setChecked($value=true){
23 24
 		if($value===true){
24 25
 			$this->getField()->setProperty("checked", "checked");
25
-		}else{
26
+		} else{
26 27
 			$this->getField()->removeProperty("checked");
27 28
 		}
28 29
 		return $this;
@@ -51,8 +52,9 @@  discard block
 block discarded – undo
51 52
 	 * @return mixed
52 53
 	 */
53 54
 	public function getLabel() {
54
-		if (\array_key_exists("label", $this->content))
55
-			return $this->content["label"];
55
+		if (\array_key_exists("label", $this->content)) {
56
+					return $this->content["label"];
57
+		}
56 58
 	}
57 59
 
58 60
 	/**
@@ -127,8 +129,9 @@  discard block
 block discarded – undo
127 129
 	}
128 130
 
129 131
 	public function run(JsUtils $js) {
130
-		if(!isset($this->_bsComponent))
131
-			$this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params);
132
+		if(!isset($this->_bsComponent)) {
133
+					$this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params);
134
+		}
132 135
 		return parent::run($js);
133 136
 	}
134 137
 }
135 138
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/components/BaseComponent.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
  * @version 1.001
11 11
  */
12 12
 abstract class BaseComponent {
13
-	public $jquery_code_for_compile=array ();
14
-	protected $params=array ();
13
+	public $jquery_code_for_compile=array();
14
+	protected $params=array();
15 15
 
16 16
 	/**
17 17
 	 *
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
 	public function setParams($params) {
71
-		foreach ( $params as $k => $v ) {
71
+		foreach ($params as $k => $v) {
72 72
 			$method="set".ucfirst($k);
73 73
 			if (method_exists($this, $method))
74 74
 				$this->$method($v);
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 		return $this;
82 82
 	}
83 83
 
84
-	public function addParams($params){
85
-		foreach ($params as $k=>$v){
84
+	public function addParams($params) {
85
+		foreach ($params as $k=>$v) {
86 86
 				$this->setParam($k, $v);
87 87
 		}
88 88
 		return $this;
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 
91 91
 	abstract public function getScript();
92 92
 
93
-	public function setDebug($value){
93
+	public function setDebug($value) {
94 94
 		return $this->setParam("debug", $value);
95 95
 	}
96 96
 
97
-	public function setVerbose($value){
97
+	public function setVerbose($value) {
98 98
 		return $this->setParam("verbose", $value);
99 99
 	}
100 100
 }
101 101
\ No newline at end of file
Please login to merge, or discard this patch.