Passed
Push — master ( d47765...23a6cb )
by Jean-Christophe
01:55
created
Ajax/semantic/widgets/base/FieldAsTrait.php 2 patches
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
64 64
 			$rules=$attributes["rules"];
65 65
 			if(\is_array($rules)){
66 66
 				$element->addRules($rules);
67
-			}
68
-			else{
67
+			} else{
69 68
 				$element->addRule($rules);
70 69
 			}
71 70
 			unset($attributes["rules"]);
@@ -117,8 +116,9 @@  discard block
 block discarded – undo
117 116
 	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
118 117
 		return $this->_fieldAs(function($id,$name,$value) use($icon){
119 118
 			$lbl=new HtmlLabel($id,$value);
120
-			if(isset($icon))
121
-				$lbl->addIcon($icon);
119
+			if(isset($icon)) {
120
+							$lbl->addIcon($icon);
121
+			}
122 122
 				return $lbl;
123 123
 		}, $index,$attributes,"label");
124 124
 	}
@@ -126,8 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
127 127
 		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
128 128
 			$header=new HtmlHeader($id,$niveau,$value);
129
-			if(isset($icon))
130
-				$header->asIcon($icon, $value);
129
+			if(isset($icon)) {
130
+							$header->asIcon($icon, $value);
131
+			}
131 132
 			return $header;
132 133
 		}, $index,$attributes,"header");
133 134
 	}
@@ -135,7 +136,9 @@  discard block
 block discarded – undo
135 136
 
136 137
 	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
137 138
 		$this->setValueFunction($index,function($img) use($size,$circular){
138
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
139
+			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) {
140
+				$image->setCircular();
141
+			}
139 142
 			return $image;
140 143
 		});
141 144
 			return $this;
@@ -194,8 +197,9 @@  discard block
 block discarded – undo
194 197
 
195 198
 	public function fieldAsCheckbox($index,$attributes=NULL){
196 199
 		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
197
-			if($caption===null || $caption==="")
198
-				$caption="";
200
+			if($caption===null || $caption==="") {
201
+							$caption="";
202
+			}
199 203
 			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
200 204
 			$input->setChecked(JString::isBooleanTrue($value));
201 205
 			return $this->_prepareFormFields($input, $name, $attributes);
@@ -232,14 +236,14 @@  discard block
 block discarded – undo
232 236
 		$i=0;
233 237
 		if(JArray::isAssociative($types)){
234 238
 			foreach ($types as $type=>$attributes){
235
-				if(\is_int($type))
236
-					$this->fieldAs($i++,$attributes,[]);
237
-				else{
239
+				if(\is_int($type)) {
240
+									$this->fieldAs($i++,$attributes,[]);
241
+				} else{
238 242
 					$type=preg_replace('/\d/', '', $type );
239 243
 					$this->fieldAs($i++,$type,$attributes);
240 244
 				}
241 245
 			}
242
-		}else{
246
+		} else{
243 247
 			foreach ($types as $type){
244 248
 				$this->fieldAs($i++,$type);
245 249
 			}
@@ -251,7 +255,7 @@  discard block
 block discarded – undo
251 255
 		if(\method_exists($this, $method)){
252 256
 			if(!\is_array($attributes)){
253 257
 				$attributes=[$index];
254
-			}else{
258
+			} else{
255 259
 				\array_unshift($attributes, $index);
256 260
 			}
257 261
 			\call_user_func_array([$this,$method], $attributes);
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@  discard block
 block discarded – undo
32 32
  * @property mixed $_modelInstance
33 33
  * @property boolean $_hasRules
34 34
  */
35
-trait FieldAsTrait{
35
+trait FieldAsTrait {
36 36
 
37
-	abstract protected function _getFieldIdentifier($prefix,$name="");
38
-	abstract public function setValueFunction($index,$callback);
37
+	abstract protected function _getFieldIdentifier($prefix, $name="");
38
+	abstract public function setValueFunction($index, $callback);
39 39
 	abstract protected function _getFieldName($index);
40 40
 	abstract protected function _getFieldCaption($index);
41
-	abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
41
+	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL);
42 42
 
43 43
 	/**
44 44
 	 * @param HtmlFormField $element
45 45
 	 * @param array $attributes
46 46
 	 */
47
-	protected function _applyAttributes(BaseHtml $element,&$attributes,$index,$instance=null){
48
-		if(isset($attributes["jsCallback"])){
47
+	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) {
48
+		if (isset($attributes["jsCallback"])) {
49 49
 			$callback=$attributes["jsCallback"];
50
-			if(\is_callable($callback)){
51
-				$callback($element,$instance,$index,InstanceViewer::$index);
50
+			if (\is_callable($callback)) {
51
+				$callback($element, $instance, $index, InstanceViewer::$index);
52 52
 			}
53 53
 		}
54 54
 		unset($attributes["rules"]);
@@ -57,44 +57,44 @@  discard block
 block discarded – undo
57 57
 		$element->fromArray($attributes);
58 58
 	}
59 59
 
60
-	private function _getLabelField($caption,$icon=NULL){
61
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
60
+	private function _getLabelField($caption, $icon=NULL) {
61
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
62 62
 		return $label;
63 63
 	}
64 64
 
65 65
 
66
-	protected function _addRules(HtmlFormField $element,&$attributes){
67
-		if(isset($attributes["rules"])){
66
+	protected function _addRules(HtmlFormField $element, &$attributes) {
67
+		if (isset($attributes["rules"])) {
68 68
 			$this->_hasRules=true;
69 69
 			$rules=$attributes["rules"];
70
-			if(\is_array($rules)){
70
+			if (\is_array($rules)) {
71 71
 				$element->addRules($rules);
72 72
 			}
73
-			else{
73
+			else {
74 74
 				$element->addRule($rules);
75 75
 			}
76 76
 			unset($attributes["rules"]);
77 77
 		}
78 78
 	}
79 79
 
80
-	protected function _prepareFormFields(HtmlFormField &$field,$name,&$attributes){
80
+	protected function _prepareFormFields(HtmlFormField &$field, $name, &$attributes) {
81 81
 		$field->setName($name);
82 82
 		$this->_addRules($field, $attributes);
83 83
 		return $field;
84 84
 	}
85 85
 
86
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
87
-		$this->setValueFunction($index,function($value,$instance,$index,$rowIndex) use (&$attributes,$elementCallback,$prefix){
86
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
87
+		$this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix){
88 88
 			$caption=$this->_getFieldCaption($index);
89 89
 			$name=$this->_getFieldName($index);
90
-			$id=$this->_getFieldIdentifier($prefix,$name);
91
-			if(isset($attributes["name"])){
90
+			$id=$this->_getFieldIdentifier($prefix, $name);
91
+			if (isset($attributes["name"])) {
92 92
 				$name=$attributes["name"];
93 93
 				unset($attributes["name"]);
94 94
 			}
95
-			$element=$elementCallback($id,$name,$value,$caption);
96
-			if(\is_array($attributes)){
97
-				$this->_applyAttributes($element, $attributes,$index,$instance);
95
+			$element=$elementCallback($id, $name, $value, $caption);
96
+			if (\is_array($attributes)) {
97
+				$this->_applyAttributes($element, $attributes, $index, $instance);
98 98
 			}
99 99
 			$element->setDisabled(!$this->_edition);
100 100
 			return $element;
@@ -103,205 +103,205 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 
105 105
 
106
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
107
-		$this->setValueFunction($index,function($value) use($label,$attributes){
108
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
106
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
107
+		$this->setValueFunction($index, function($value) use($label, $attributes){
108
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
109 109
 			return $pb;
110 110
 		});
111 111
 			return $this;
112 112
 	}
113 113
 
114
-	public function fieldAsRating($index,$max=5, $icon=""){
115
-		$this->setValueFunction($index,function($value) use($max,$icon){
116
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
114
+	public function fieldAsRating($index, $max=5, $icon="") {
115
+		$this->setValueFunction($index, function($value) use($max, $icon){
116
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
117 117
 			return $rating;
118 118
 		});
119 119
 			return $this;
120 120
 	}
121 121
 
122
-	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
123
-		return $this->_fieldAs(function($id,$name,$value) use($icon){
124
-			$lbl=new HtmlLabel($id,$value);
125
-			if(isset($icon))
122
+	public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) {
123
+		return $this->_fieldAs(function($id, $name, $value) use($icon){
124
+			$lbl=new HtmlLabel($id, $value);
125
+			if (isset($icon))
126 126
 				$lbl->addIcon($icon);
127 127
 				return $lbl;
128
-		}, $index,$attributes,"label");
128
+		}, $index, $attributes, "label");
129 129
 	}
130 130
 
131
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
132
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
133
-			$header=new HtmlHeader($id,$niveau,$value);
134
-			if(isset($icon))
131
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
132
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
133
+			$header=new HtmlHeader($id, $niveau, $value);
134
+			if (isset($icon))
135 135
 				$header->asIcon($icon, $value);
136 136
 			return $header;
137
-		}, $index,$attributes,"header");
137
+		}, $index, $attributes, "header");
138 138
 	}
139 139
 
140 140
 
141
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
142
-		$this->setValueFunction($index,function($img) use($size,$circular){
143
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
141
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
142
+		$this->setValueFunction($index, function($img) use($size, $circular){
143
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
144 144
 			return $image;
145 145
 		});
146 146
 			return $this;
147 147
 	}
148 148
 
149
-	public function fieldAsFlag($index){
150
-		$this->setValueFunction($index,function($flag){
151
-			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"),$flag);
149
+	public function fieldAsFlag($index) {
150
+		$this->setValueFunction($index, function($flag) {
151
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
152 152
 			return $flag;
153 153
 		});
154 154
 			return $this;
155 155
 	}
156 156
 
157
-	public function fieldAsIcon($index){
158
-		$this->setValueFunction($index,function($icon){
159
-			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"),$icon);
157
+	public function fieldAsIcon($index) {
158
+		$this->setValueFunction($index, function($icon) {
159
+			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
160 160
 			return $icon;
161 161
 		});
162 162
 			return $this;
163 163
 	}
164 164
 
165
-	public function fieldAsAvatar($index,$attributes=NULL){
166
-		return $this->_fieldAs(function($id,$name,$value){
167
-			$img=new HtmlImage($id,$value);
165
+	public function fieldAsAvatar($index, $attributes=NULL) {
166
+		return $this->_fieldAs(function($id, $name, $value) {
167
+			$img=new HtmlImage($id, $value);
168 168
 			$img->asAvatar();
169 169
 			return $img;
170
-		}, $index,$attributes,"avatar");
170
+		}, $index, $attributes, "avatar");
171 171
 	}
172 172
 
173
-	public function fieldAsRadio($index,$attributes=NULL){
174
-		return $this->_fieldAs(function($id,$name,$value) use($attributes){
175
-			$input= new HtmlFormRadio($id,$name,$value,$value);
173
+	public function fieldAsRadio($index, $attributes=NULL) {
174
+		return $this->_fieldAs(function($id, $name, $value) use($attributes){
175
+			$input=new HtmlFormRadio($id, $name, $value, $value);
176 176
 			return $this->_prepareFormFields($input, $name, $attributes);
177
-		}, $index,$attributes,"radio");
177
+		}, $index, $attributes, "radio");
178 178
 	}
179 179
 
180
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
181
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
182
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
183
-		}, $index,$attributes,"radios");
180
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
181
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
182
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
183
+		}, $index, $attributes, "radios");
184 184
 	}
185 185
 	
186
-	public function fieldAsList($index,$classNames="",$attributes=NULL){
187
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($classNames){
188
-			$result= new HtmlList($name,$value);
186
+	public function fieldAsList($index, $classNames="", $attributes=NULL) {
187
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($classNames){
188
+			$result=new HtmlList($name, $value);
189 189
 			$result->addClass($classNames);
190 190
 			return $result;
191
-		}, $index,$attributes,"list");
191
+		}, $index, $attributes, "list");
192 192
 	}
193 193
 
194
-	public function fieldAsInput($index,$attributes=NULL){
195
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
196
-			$input= new HtmlFormInput($id,$caption,"text",$value);
194
+	public function fieldAsInput($index, $attributes=NULL) {
195
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
196
+			$input=new HtmlFormInput($id, $caption, "text", $value);
197 197
 			return $this->_prepareFormFields($input, $name, $attributes);
198
-		}, $index,$attributes,"input");
198
+		}, $index, $attributes, "input");
199 199
 	}
200 200
 
201
-	public function fieldAsTextarea($index,$attributes=NULL){
202
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
203
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
201
+	public function fieldAsTextarea($index, $attributes=NULL) {
202
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
203
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
204 204
 			return $this->_prepareFormFields($textarea, $name, $attributes);
205
-		}, $index,$attributes,"textarea");
205
+		}, $index, $attributes, "textarea");
206 206
 	}
207 207
 
208
-	public function fieldAsElement($index,$tagName="div",$baseClass="",$attributes=NULL){
209
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes,$tagName,$baseClass){
210
-			$div=new HtmlSemDoubleElement($id,$tagName,$baseClass);
208
+	public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) {
209
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass){
210
+			$div=new HtmlSemDoubleElement($id, $tagName, $baseClass);
211 211
 			$div->setContent(\htmlentities($value));
212
-			$textarea=new HtmlFormField("field-".$id, $div,$caption);
212
+			$textarea=new HtmlFormField("field-".$id, $div, $caption);
213 213
 			return $this->_prepareFormFields($textarea, $name, $attributes);
214
-		}, $index,$attributes,"element");
214
+		}, $index, $attributes, "element");
215 215
 	}
216 216
 
217 217
 
218
-	public function fieldAsHidden($index,$attributes=NULL){
219
-		if(!\is_array($attributes)){
218
+	public function fieldAsHidden($index, $attributes=NULL) {
219
+		if (!\is_array($attributes)) {
220 220
 			$attributes=[];
221 221
 		}
222 222
 		$attributes["inputType"]="hidden";
223 223
 		$attributes["style"]="display:none;";
224
-		return $this->fieldAsInput($index,$attributes);
224
+		return $this->fieldAsInput($index, $attributes);
225 225
 	}
226 226
 
227
-	public function fieldAsCheckbox($index,$attributes=NULL){
228
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
229
-			if($caption===null || $caption==="")
227
+	public function fieldAsCheckbox($index, $attributes=NULL) {
228
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($attributes){
229
+			if ($caption===null || $caption==="")
230 230
 				$caption="";
231
-			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
231
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
232 232
 			$input->setChecked(JString::isBooleanTrue($value));
233 233
 			return $this->_prepareFormFields($input, $name, $attributes);
234
-		}, $index,$attributes,"ck");
234
+		}, $index, $attributes, "ck");
235 235
 	}
236 236
 
237
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
238
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple,$attributes){
239
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value);
240
-			$dd->asSelect($name,$multiple);
237
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
238
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple, $attributes){
239
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value);
240
+			$dd->asSelect($name, $multiple);
241 241
 			return $this->_prepareFormFields($dd, $name, $attributes);
242
-		}, $index,$attributes,"dd");
242
+		}, $index, $attributes, "dd");
243 243
 	}
244 244
 
245
-	public function fieldAsMessage($index,$attributes=NULL){
246
-		return $this->_fieldAs(function($id,$name,$value,$caption){
247
-			$mess= new HtmlMessage("message-".$id,$caption);
245
+	public function fieldAsMessage($index, $attributes=NULL) {
246
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
247
+			$mess=new HtmlMessage("message-".$id, $caption);
248 248
 			$mess->addHeader($value);
249 249
 			return $mess;
250
-		}, $index,$attributes,"message");
250
+		}, $index, $attributes, "message");
251 251
 	}
252 252
 
253
-	public function fieldAsLink($index,$attributes=NULL){
254
-		return $this->_fieldAs(function($id,$name,$value,$caption){
255
-			$lnk= new HtmlLink("message-".$id,"#",$caption);
253
+	public function fieldAsLink($index, $attributes=NULL) {
254
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
255
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
256 256
 			return $lnk;
257
-		}, $index,$attributes,"link");
257
+		}, $index, $attributes, "link");
258 258
 	}
259 259
 
260 260
 	/**Change fields type
261 261
 	 * @param array $types an array or associative array $type=>$attributes
262 262
 	 */
263
-	public function fieldsAs(array $types){
263
+	public function fieldsAs(array $types) {
264 264
 		$i=0;
265
-		if(JArray::isAssociative($types)){
266
-			foreach ($types as $type=>$attributes){
267
-				if(\is_int($type))
268
-					$this->fieldAs($i++,$attributes,[]);
269
-				else{
270
-					$type=preg_replace('/\d/', '', $type );
271
-					$this->fieldAs($i++,$type,$attributes);
265
+		if (JArray::isAssociative($types)) {
266
+			foreach ($types as $type=>$attributes) {
267
+				if (\is_int($type))
268
+					$this->fieldAs($i++, $attributes, []);
269
+				else {
270
+					$type=preg_replace('/\d/', '', $type);
271
+					$this->fieldAs($i++, $type, $attributes);
272 272
 				}
273 273
 			}
274
-		}else{
275
-			foreach ($types as $type){
276
-				$this->fieldAs($i++,$type);
274
+		} else {
275
+			foreach ($types as $type) {
276
+				$this->fieldAs($i++, $type);
277 277
 			}
278 278
 		}
279 279
 	}
280 280
 
281
-	public function fieldAs($index,$type,$attributes=NULL){
281
+	public function fieldAs($index, $type, $attributes=NULL) {
282 282
 		$method="fieldAs".\ucfirst($type);
283
-		if(\method_exists($this, $method)){
284
-			if(!\is_array($attributes)){
283
+		if (\method_exists($this, $method)) {
284
+			if (!\is_array($attributes)) {
285 285
 				$attributes=[$index];
286
-			}else{
286
+			} else {
287 287
 				\array_unshift($attributes, $index);
288 288
 			}
289
-			\call_user_func_array([$this,$method], $attributes);
289
+			\call_user_func_array([$this, $method], $attributes);
290 290
 		}
291 291
 	}
292 292
 
293
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
294
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
295
-			$button=new HtmlButton($id,$caption,$cssStyle);
296
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]);
293
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
294
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
295
+			$button=new HtmlButton($id, $caption, $cssStyle);
296
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
297 297
 			return $button;
298
-		}, $index,$attributes,"submit");
298
+		}, $index, $attributes, "submit");
299 299
 	}
300 300
 
301
-	public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){
302
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
303
-			$button=new HtmlButton($id,$value,$cssStyle);
301
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
302
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
303
+			$button=new HtmlButton($id, $value, $cssStyle);
304 304
 			return $button;
305
-		}, $index,$attributes,"button");
305
+		}, $index, $attributes, "button");
306 306
 	}
307 307
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlLabel.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -99,12 +99,12 @@
 block discarded – undo
99 99
 	}
100 100
 
101 101
 	/**
102
-	*  Adds an image
103
-	* @param string $src
104
-	* @param string $alt
105
-	* @param boolean $before
106
-	* @return HtmlImg
107
-	*/
102
+	 *  Adds an image
103
+	 * @param string $src
104
+	 * @param string $alt
105
+	 * @param boolean $before
106
+	 * @return HtmlImg
107
+	 */
108 108
 	public function addImage($src, $alt="", $before=true) {
109 109
 		$img=new HtmlImg("image-" . $this->identifier, $src, $alt);
110 110
 		$img->setClass("");
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @version 1.001
19 19
  */
20 20
 class HtmlLabel extends HtmlSemDoubleElement {
21
-	use LabeledIconTrait,HasTimeoutTrait;
21
+	use LabeledIconTrait, HasTimeoutTrait;
22 22
 
23 23
 	public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") {
24 24
 		parent::__construct($identifier, $tagName, "ui label");
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	 * @return HtmlLabel
34 34
 	 */
35 35
 	public function setPointing($value=Direction::NONE) {
36
-		if($value==="left" || $value==="right")
36
+		if ($value==="left" || $value==="right")
37 37
 			return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
38 38
 		else
39
-			return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
39
+			return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing", true));
40 40
 	}
41 41
 
42 42
 	/**
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 	 * @return HtmlLabel
46 46
 	 */
47 47
 	public function toCorner($side="left") {
48
-		return $this->addToPropertyCtrl("class", $side . " corner", array ("right corner","left corner" ));
48
+		return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner"));
49 49
 	}
50 50
 
51
-	public function setHorizontal(){
52
-		return $this->addToPropertyCtrl("class", "hozizontal",array("horizontal"));
51
+	public function setHorizontal() {
52
+		return $this->addToPropertyCtrl("class", "hozizontal", array("horizontal"));
53 53
 	}
54 54
 
55
-	public function setFloating(){
56
-		return $this->addToPropertyCtrl("class", "floating",array("floating"));
55
+	public function setFloating() {
56
+		return $this->addToPropertyCtrl("class", "floating", array("floating"));
57 57
 	}
58 58
 
59 59
 	/**
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 		return $this->addToProperty("class", "tag");
65 65
 	}
66 66
 
67
-	public function setEmpty(){
67
+	public function setEmpty() {
68 68
 		$this->content=NULL;
69
-		return $this->addToPropertyCtrl("class", "empty",array("empty"));
69
+		return $this->addToPropertyCtrl("class", "empty", array("empty"));
70 70
 	}
71 71
 
72 72
 	public function setBasic() {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function addEmphasisImage($src, $alt="", $before=true) {
84 84
 		$this->addToProperty("class", "image");
85
-		return $this->addImage($src,$alt,$before);
85
+		return $this->addImage($src, $alt, $before);
86 86
 	}
87 87
 
88 88
 	/**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return HtmlImg
94 94
 	 */
95 95
 	public function addAvatarImage($src, $alt="", $before=true) {
96
-		$img=$this->addImage($src,$alt,$before);
96
+		$img=$this->addImage($src, $alt, $before);
97 97
 		$img->setClass("ui image");
98 98
 		$img->asAvatar();
99 99
 		return $img;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	* @return HtmlImg
108 108
 	*/
109 109
 	public function addImage($src, $alt="", $before=true) {
110
-		$img=new HtmlImg("image-" . $this->identifier, $src, $alt);
110
+		$img=new HtmlImg("image-".$this->identifier, $src, $alt);
111 111
 		$img->setClass("");
112 112
 		$this->addContent($img, $before);
113 113
 		return $img;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @return HtmlDoubleElement
120 120
 	 */
121 121
 	public function addDetail($detail) {
122
-		$div=new HtmlSemDoubleElement("detail-" . $this->identifier, $this->tagName,"detail");
122
+		$div=new HtmlSemDoubleElement("detail-".$this->identifier, $this->tagName, "detail");
123 123
 		$div->setContent($detail);
124 124
 		$this->addContent($div);
125 125
 		return $div;
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
 	 * @return HtmlLabel
131 131
 	 */
132 132
 	public function asRibbon($direction=Direction::NONE) {
133
-		return $this->addToPropertyCtrl("class", $direction." ribbon", array ("ribbon","right ribbon","left ribbon" ));
133
+		return $this->addToPropertyCtrl("class", $direction." ribbon", array("ribbon", "right ribbon", "left ribbon"));
134 134
 	}
135 135
 
136
-	public function setAttached($side=Side::TOP,$direction=Direction::NONE){
137
-		if($direction!==Direction::NONE)
138
-			return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
136
+	public function setAttached($side=Side::TOP, $direction=Direction::NONE) {
137
+		if ($direction!==Direction::NONE)
138
+			return $this->addToPropertyCtrl("class", $side." ".$direction." attached", Side::getConstantValues($direction." attached"));
139 139
 		else
140
-			return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
140
+			return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param string $direction one of RIGHT="right", LEFT="left",DOWN="down",UP="up",NONE="",BELOW="below"
147 147
 	 * @return HtmlLabel
148 148
 	 */
149
-	public static function ribbon($identifier, $caption,$direction=Direction::NONE) {
149
+	public static function ribbon($identifier, $caption, $direction=Direction::NONE) {
150 150
 		return (new HtmlLabel($identifier, $caption))->asRibbon($direction);
151 151
 	}
152 152
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 	public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") {
24 24
 		parent::__construct($identifier, $tagName, "ui label");
25 25
 		$this->content=$caption;
26
-		if (isset($icon))
27
-			$this->addIcon($icon);
26
+		if (isset($icon)) {
27
+					$this->addIcon($icon);
28
+		}
28 29
 	}
29 30
 
30 31
 	/**
@@ -33,10 +34,11 @@  discard block
 block discarded – undo
33 34
 	 * @return HtmlLabel
34 35
 	 */
35 36
 	public function setPointing($value=Direction::NONE) {
36
-		if($value==="left" || $value==="right")
37
-			return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
38
-		else
39
-			return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
37
+		if($value==="left" || $value==="right") {
38
+					return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
39
+		} else {
40
+					return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
41
+		}
40 42
 	}
41 43
 
42 44
 	/**
@@ -134,10 +136,11 @@  discard block
 block discarded – undo
134 136
 	}
135 137
 
136 138
 	public function setAttached($side=Side::TOP,$direction=Direction::NONE){
137
-		if($direction!==Direction::NONE)
138
-			return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
139
-		else
140
-			return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
139
+		if($direction!==Direction::NONE) {
140
+					return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
141
+		} else {
142
+					return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
143
+		}
141 144
 	}
142 145
 
143 146
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlLabelGroups.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class HtmlLabelGroups extends HtmlSemCollection {
17 17
 
18
-	public function __construct($identifier,$labels=array(), $attributes=array()) {
18
+	public function __construct($identifier, $labels=array(), $attributes=array()) {
19 19
 		parent::__construct($identifier, "div", "ui labels");
20
-		$this->_states=\array_merge(Size::getConstants(),Color::getConstants(),["tag","circular"]);
20
+		$this->_states=\array_merge(Size::getConstants(), Color::getConstants(), ["tag", "circular"]);
21 21
 		$this->addItems($labels);
22 22
 		$this->setStates($attributes);
23 23
 	}
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 			$icon=JArray::getValue($value, "icon", 1);
32 32
 			$tagName=JArray::getValue($value, "tagName", 2);
33 33
 		}
34
-		$labelO=new HtmlLabel("label-" . $this->identifier, $caption,$icon,$tagName);
34
+		$labelO=new HtmlLabel("label-".$this->identifier, $caption, $icon, $tagName);
35 35
 		return $labelO;
36 36
 	}
37 37
 
38 38
 	protected function createCondition($value) {
39
-		return ($value instanceof HtmlLabel) === false;
39
+		return ($value instanceof HtmlLabel)===false;
40 40
 	}
41 41
 
42 42
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@
 block discarded – undo
14 14
 class HtmlContainer extends HtmlSemDoubleElement {
15 15
 	use TextAlignmentTrait;
16 16
 	public function __construct($identifier, $content="") {
17
-		parent::__construct($identifier, "div","ui container");
17
+		parent::__construct($identifier, "div", "ui container");
18 18
 		$this->content=$content;
19 19
 	}
20 20
 
21
-	public function asText(){
21
+	public function asText() {
22 22
 		return $this->addToProperty("class", "text");
23 23
 	}
24 24
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlInput.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 use Ajax\JsUtils;
11 11
 
12 12
 class HtmlInput extends HtmlSemDoubleElement {
13
-	use IconTrait,TextFieldsTrait,FieldTrait;
13
+	use IconTrait, TextFieldsTrait, FieldTrait;
14 14
 
15 15
 	public function __construct($identifier, $type="text", $value="", $placeholder="") {
16
-		parent::__construct("div-" . $identifier, "div", "ui input");
16
+		parent::__construct("div-".$identifier, "div", "ui input");
17 17
 		$this->_identifier=$identifier;
18
-		$this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ];
19
-		$this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ];
20
-		$this->_variations=[ Variation::TRANSPARENT ];
18
+		$this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)];
19
+		$this->_states=[State::DISABLED, State::FOCUS, State::ERROR];
20
+		$this->_variations=[Variation::TRANSPARENT];
21 21
 	}
22 22
 
23 23
 	public function getField() {
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 
38 38
 	public function run(JsUtils $js) {
39 39
 		$result=parent::run($js);
40
-		$result->attach("#" . $this->getDataField()->getIdentifier());
40
+		$result->attach("#".$this->getDataField()->getIdentifier());
41 41
 		return $result;
42 42
 	}
43 43
 
44
-	public function setTransparent(){
44
+	public function setTransparent() {
45 45
 		return $this->addToProperty("class", "transparent");
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlDivider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @return HtmlDivider
24 24
 	 */
25 25
 	public function setVertical() {
26
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical","horizontal" ));
26
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical", "horizontal"));
27 27
 	}
28 28
 
29 29
 	/**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return HtmlDivider
32 32
 	 */
33 33
 	public function setHorizontal() {
34
-		return $this->addToPropertyCtrl("class", "horizontal", array ("vertical","horizontal" ));
34
+		return $this->addToPropertyCtrl("class", "horizontal", array("vertical", "horizontal"));
35 35
 	}
36 36
 
37 37
 	/**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	/**
62 62
 	 * @return HtmlDivider
63 63
 	 */
64
-	public function setIgnored(){
64
+	public function setIgnored() {
65 65
 		return $this->addToProperty("class", "ignored");
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlTab.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,8 +67,9 @@  discard block
 block discarded – undo
67 67
 		if($index<$menu->count()){
68 68
 			if(isset($this->content[$index])===false){
69 69
 				$this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier());
70
-			}else
71
-				$this->content[$index]->setContent($content);
70
+			} else {
71
+							$this->content[$index]->setContent($content);
72
+			}
72 73
 		}
73 74
 		return $this;
74 75
 	}
@@ -231,15 +232,17 @@  discard block
 block discarded – undo
231 232
 	 * @see BaseHtml::run()
232 233
 	 */
233 234
 	public function run(JsUtils $js) {
234
-		if(isset($this->_bsComponent)===false)
235
-			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
235
+		if(isset($this->_bsComponent)===false) {
236
+					$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
237
+		}
236 238
 			$this->addEventsOnRun($js);
237 239
 			return $this->_bsComponent;
238 240
 	}
239 241
 
240 242
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
241
-		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
242
-			$this->activate(0);
243
+		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) {
244
+					$this->activate(0);
245
+		}
243 246
 		return parent::compile($js,$view);
244 247
 	}
245 248
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
  * @author jc
16 16
  * @version 1.001
17 17
  */
18
-class HtmlTab extends HtmlSemCollection{
18
+class HtmlTab extends HtmlSemCollection {
19 19
 
20 20
 	protected $params=[];
21 21
 
22
-	public function __construct( $identifier, $tabs=array()){
23
-		parent::__construct( $identifier, "div", "");
22
+	public function __construct($identifier, $tabs=array()) {
23
+		parent::__construct($identifier, "div", "");
24 24
 		$menu=new HtmlMenu("menu".$this->identifier);
25
-		$menu->asTab(false)->setAttachment(NULL,Side::TOP);
25
+		$menu->asTab(false)->setAttachment(NULL, Side::TOP);
26 26
 		$this->content["menu"]=$menu;
27 27
 		$this->addItems($tabs);
28 28
 	}
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
33 33
 	 * @return HtmlSegment
34 34
 	 */
35
-	protected function createItem($value){
35
+	protected function createItem($value) {
36 36
 		$count=$this->count();
37 37
 		$title=$value;
38 38
 		$content=NULL;
39
-		if(\is_array($value)){
40
-			$title=@$value[0];$content=@$value[1];
39
+		if (\is_array($value)) {
40
+			$title=@$value[0]; $content=@$value[1];
41 41
 		}
42 42
 		$menuItem=$this->content["menu"]->addItem($title);
43 43
 		$menuItem->addToProperty("data-tab", $menuItem->getIdentifier());
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @param string $datatab
54 54
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
55 55
 	 */
56
-	private function createSegment($count,$content,$datatab){
56
+	private function createSegment($count, $content, $datatab) {
57 57
 		$segment=new HtmlSegment("item-".$this->identifier."-".$count, $content);
58
-		$segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab);
58
+		$segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab);
59 59
 		return $segment;
60 60
 	}
61 61
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 * @param String $content new content
66 66
 	 * @return \Ajax\semantic\html\modules\HtmlTab
67 67
 	 */
68
-	public function setTabContent($index,$content){
68
+	public function setTabContent($index, $content) {
69 69
 		$menu=$this->content["menu"];
70
-		if($index<$menu->count()){
71
-			if(isset($this->content[$index])===false){
70
+		if ($index<$menu->count()) {
71
+			if (isset($this->content[$index])===false) {
72 72
 				$this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier());
73
-			}else
73
+			} else
74 74
 				$this->content[$index]->setContent($content);
75 75
 		}
76 76
 		return $this;
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	 * @param array $contents
82 82
 	 * @return \Ajax\semantic\html\modules\HtmlTab
83 83
 	 */
84
-	public function setTabsContent($contents){
84
+	public function setTabsContent($contents) {
85 85
 		$size=\sizeof($contents);
86
-		for($i=0;$i<$size;$i++){
86
+		for ($i=0; $i<$size; $i++) {
87 87
 			$this->setTabContent($i, $contents[$i]);
88 88
 		}
89 89
 		return $this;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @param int $index
95 95
 	 * @return \Ajax\semantic\html\modules\HtmlTab
96 96
 	 */
97
-	public function activate($index){
97
+	public function activate($index) {
98 98
 		$this->content["menu"]->getItem($index)->setActive(true);
99 99
 		$this->content[$index]->setActive(true);
100 100
 		return $this;
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @param string $content
107 107
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
108 108
 	 */
109
-	public function addTab($title,$content){
110
-		return $this->addItem([$title,$content]);
109
+	public function addTab($title, $content) {
110
+		return $this->addItem([$title, $content]);
111 111
 	}
112 112
 
113 113
 	/**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 * @param array $params
122 122
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
123 123
 	 */
124
-	public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
125
-		if(\array_key_exists($index, $this->content)){
126
-			$this->content[$index]=$js->forward($initialController, $controller, $action,$params);
124
+	public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
125
+		if (\array_key_exists($index, $this->content)) {
126
+			$this->content[$index]=$js->forward($initialController, $controller, $action, $params);
127 127
 			return $this->content[$index];
128 128
 		}
129 129
 
130
-		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params);
130
+		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params);
131 131
 	}
132 132
 
133 133
 	/**
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 	 * @param array $params The parameters to pass to the view
141 141
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
142 142
 	 */
143
-	public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) {
144
-		if(\array_key_exists($index, $this->content)){
145
-			$this->content[$index]=$js->renderContent($initialController, $viewName,$params);
143
+	public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) {
144
+		if (\array_key_exists($index, $this->content)) {
145
+			$this->content[$index]=$js->renderContent($initialController, $viewName, $params);
146 146
 			return $this->content[$index];
147 147
 		}
148
-		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params);
148
+		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params);
149 149
 	}
150 150
 
151 151
 
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 * @param array $params
160 160
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
161 161
 	 */
162
-	public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
162
+	public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
163 163
 		\ob_start();
164
-		$js->forward($initialController, $controller, $action,$params);
164
+		$js->forward($initialController, $controller, $action, $params);
165 165
 		$content=\ob_get_clean();
166
-		return $this->addTab($title,$content);
166
+		return $this->addTab($title, $content);
167 167
 	}
168 168
 
169 169
 	/**
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @param array $params The parameters to pass to the view
176 176
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
177 177
 	 */
178
-	public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) {
179
-		return $this->addTab($title, $js->renderContent($initialController, $viewName,$params));
178
+	public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) {
179
+		return $this->addTab($title, $js->renderContent($initialController, $viewName, $params));
180 180
 	}
181 181
 
182 182
 	public function setPointing($value=Direction::NONE) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param int $index
193 193
 	 * @return HtmlMenuItem
194 194
 	 */
195
-	public function getMenuTab($index){
195
+	public function getMenuTab($index) {
196 196
 		return $this->content["menu"]->getItem($index);
197 197
 	}
198 198
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param int $index
202 202
 	 * @return HtmlSegment
203 203
 	 */
204
-	public function getTab($index){
204
+	public function getTab($index) {
205 205
 		return $this->content[$index];
206 206
 	}
207 207
 
@@ -210,22 +210,22 @@  discard block
 block discarded – undo
210 210
 	 * @param HtmlMenu $menu
211 211
 	 * @return \Ajax\semantic\html\modules\HtmlTab
212 212
 	 */
213
-	public function setMenu($menu){
213
+	public function setMenu($menu) {
214 214
 		$contentSize=\sizeof($this->content);
215
-		for($i=0;$i<$contentSize;$i++){
216
-			if($menu->getItem($i)!==NULL){
217
-				if(isset($this->content[$i])){
218
-					$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
215
+		for ($i=0; $i<$contentSize; $i++) {
216
+			if ($menu->getItem($i)!==NULL) {
217
+				if (isset($this->content[$i])) {
218
+					$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
219 219
 				}
220 220
 			}
221 221
 		}
222 222
 		$menuSize=$menu->count();
223
-		for($i=0;$i<$menuSize;$i++){
223
+		for ($i=0; $i<$menuSize; $i++) {
224 224
 			$menu->getItem($i)->removeProperty("href");
225
-			if(isset($this->content[$i])===false){
225
+			if (isset($this->content[$i])===false) {
226 226
 				$this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier());
227 227
 			}
228
-			$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
228
+			$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
229 229
 		}
230 230
 
231 231
 		$this->content["menu"]=$menu;
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 	 * @see BaseHtml::run()
238 238
 	 */
239 239
 	public function run(JsUtils $js) {
240
-		if(isset($this->_bsComponent)===false)
241
-			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
240
+		if (isset($this->_bsComponent)===false)
241
+			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params);
242 242
 			$this->addEventsOnRun($js);
243 243
 			return $this->_bsComponent;
244 244
 	}
245 245
 
246 246
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
247
-		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
247
+		if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
248 248
 			$this->activate(0);
249
-		return parent::compile($js,$view);
249
+		return parent::compile($js, $view);
250 250
 	}
251 251
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlRating.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	 * @param int $max
14 14
 	 * @param string $icon star or heart
15 15
 	 */
16
-	public function __construct($identifier, $value,$max=5,$icon="") {
16
+	public function __construct($identifier, $value, $max=5, $icon="") {
17 17
 		parent::__construct($identifier, "div", "ui {$icon} rating");
18 18
 		$this->setValue($value);
19 19
 		$this->setMax($max);
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 	 * {@inheritDoc}
24 24
 	 * @see \Ajax\common\html\HtmlDoubleElement::setValue()
25 25
 	 */
26
-	public function setValue($value){
26
+	public function setValue($value) {
27 27
 		$this->setProperty("data-rating", $value);
28 28
 	}
29 29
 
30
-	public function setMax($max){
30
+	public function setMax($max) {
31 31
 		$this->setProperty("data-max-rating", $max);
32 32
 	}
33 33
 
@@ -35,21 +35,21 @@  discard block
 block discarded – undo
35 35
 	 * {@inheritDoc}
36 36
 	 * @see HtmlSemDoubleElement::run()
37 37
 	 */
38
-	public function run(JsUtils $js){
38
+	public function run(JsUtils $js) {
39 39
 		parent::run($js);
40
-		return $js->semantic()->rating("#".$this->identifier,$this->_params);
40
+		return $js->semantic()->rating("#".$this->identifier, $this->_params);
41 41
 	}
42 42
 
43
-	public function asStar(){
43
+	public function asStar() {
44 44
 		return $this->setIcon();
45 45
 	}
46 46
 
47
-	public function asHeart(){
47
+	public function asHeart() {
48 48
 		return $this->setIcon("heart");
49 49
 	}
50 50
 
51
-	public function setIcon($icon="star"){
52
-		return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]);
51
+	public function setIcon($icon="star") {
52
+		return $this->addToPropertyCtrl("class", $icon, ["star", "heart", ""]);
53 53
 	}
54 54
 
55 55
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlShape.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function getSideContent($index){
54 54
 		$item= $this->getItem($index);
55
-		if(isset($item))
56
-			return $item->getContent();
55
+		if(isset($item)) {
56
+					return $item->getContent();
57
+		}
57 58
 		return null;
58 59
 	}
59 60
 
@@ -147,15 +148,17 @@  discard block
 block discarded – undo
147 148
 	 * @see BaseHtml::run()
148 149
 	 */
149 150
 	public function run(JsUtils $js) {
150
-		if (isset($this->_bsComponent) === false)
151
-			$this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params);
151
+		if (isset($this->_bsComponent) === false) {
152
+					$this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params);
153
+		}
152 154
 		$this->addEventsOnRun($js);
153 155
 		return $this->_bsComponent;
154 156
 	}
155 157
 
156 158
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
157
-		if($this->_autoActive)
158
-			$this->setActiveSide(0);
159
+		if($this->_autoActive) {
160
+					$this->setActiveSide(0);
161
+		}
159 162
 		return parent::compile($js,$view);
160 163
 	}
161 164
 }
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 use Ajax\common\html\BaseHtml;
9 9
 
10 10
 
11
-class HtmlShape extends HtmlSemCollection{
11
+class HtmlShape extends HtmlSemCollection {
12 12
 
13 13
 	protected $_params=array();
14 14
 	protected $_autoActive=true;
15 15
 
16
-	public function __construct( $identifier, $sides){
17
-		parent::__construct( $identifier, "div", "ui shape");
16
+	public function __construct($identifier, $sides) {
17
+		parent::__construct($identifier, "div", "ui shape");
18 18
 		$this->_template='<%tagName% id="%identifier%" %properties%><div class="sides">%wrapContentBefore%%content%%wrapContentAfter%</div></%tagName%>';
19 19
 		$this->addItems($sides);
20 20
 	}
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	 * {@inheritDoc}
24 24
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
25 25
 	 */
26
-	protected function createItem($value){
27
-		if(\is_object($value)===false){
28
-			$value=new HtmlSemDoubleElement("","div","content",$value);
26
+	protected function createItem($value) {
27
+		if (\is_object($value)===false) {
28
+			$value=new HtmlSemDoubleElement("", "div", "content", $value);
29 29
 		}
30 30
 		return new HtmlShapeItem("side-".$this->identifier."-".$this->count(), $value);
31 31
 	}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * {@inheritDoc}
35 35
 	 * @see \Ajax\common\html\HtmlCollection::createCondition()
36 36
 	 */
37
-	protected function createCondition($value){
37
+	protected function createCondition($value) {
38 38
 		return ($value instanceof HtmlShapeItem)===false;
39 39
 	}
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @param int $index
43 43
 	 * @return \Ajax\semantic\html\content\HtmlShapeItem
44 44
 	 */
45
-	public function getSide($index){
45
+	public function getSide($index) {
46 46
 		return $this->getItem($index);
47 47
 	}
48 48
 
@@ -50,96 +50,96 @@  discard block
 block discarded – undo
50 50
 	 * @param int $index
51 51
 	 * @return mixed|NULL
52 52
 	 */
53
-	public function getSideContent($index){
54
-		$item= $this->getItem($index);
55
-		if(isset($item))
53
+	public function getSideContent($index) {
54
+		$item=$this->getItem($index);
55
+		if (isset($item))
56 56
 			return $item->getContent();
57 57
 		return null;
58 58
 	}
59 59
 
60
-	public function jsDo($action){
60
+	public function jsDo($action) {
61 61
 		return "$('#".$this->identifier."').shape('".$action."');";
62 62
 	}
63 63
 
64
-	public function jsFlipLeft(){
64
+	public function jsFlipLeft() {
65 65
 		return $this->jsDo("flip left");
66 66
 	}
67 67
 
68
-	public function jsFlipRight(){
68
+	public function jsFlipRight() {
69 69
 		return $this->jsDo("flip right");
70 70
 	}
71 71
 
72
-	public function jsFlipUp(){
72
+	public function jsFlipUp() {
73 73
 		return $this->jsDo("flip up");
74 74
 	}
75 75
 
76
-	public function jsFlipDown(){
76
+	public function jsFlipDown() {
77 77
 		return $this->jsDo("flip down");
78 78
 	}
79 79
 
80
-	public function jsFlipOver(){
80
+	public function jsFlipOver() {
81 81
 		return $this->jsDo("flip over");
82 82
 	}
83 83
 
84
-	public function jsFlipBack(){
84
+	public function jsFlipBack() {
85 85
 		return $this->jsDo("flip back");
86 86
 	}
87 87
 
88
-	private function doActionOn($element,$event,$what){
89
-		if($element instanceof BaseHtml){
90
-			return $element->on($event, $what,true,true);
88
+	private function doActionOn($element, $event, $what) {
89
+		if ($element instanceof BaseHtml) {
90
+			return $element->on($event, $what, true, true);
91 91
 		}
92 92
 	}
93 93
 
94
-	public function flipLeftOn($element,$event){
94
+	public function flipLeftOn($element, $event) {
95 95
 		return $this->doActionOn($element, $event, $this->jsFlipLeft());
96 96
 	}
97 97
 
98
-	public function flipRightOn($element,$event){
98
+	public function flipRightOn($element, $event) {
99 99
 		return $this->doActionOn($element, $event, $this->jsFlipRight());
100 100
 	}
101 101
 
102
-	public function flipUpOn($element,$event){
102
+	public function flipUpOn($element, $event) {
103 103
 		return $this->doActionOn($element, $event, $this->jsFlipUp());
104 104
 	}
105 105
 
106
-	public function flipDownOn($element,$event){
106
+	public function flipDownOn($element, $event) {
107 107
 		return $this->doActionOn($element, $event, $this->jsFlipDown());
108 108
 	}
109 109
 
110
-	public function flipBackOn($element,$event){
110
+	public function flipBackOn($element, $event) {
111 111
 		return $this->doActionOn($element, $event, $this->jsFlipBack());
112 112
 	}
113 113
 
114
-	public function flipOverOn($element,$event){
114
+	public function flipOverOn($element, $event) {
115 115
 		return $this->doActionOn($element, $event, $this->jsFlipOver());
116 116
 	}
117 117
 
118
-	public function setActiveSide($index){
118
+	public function setActiveSide($index) {
119 119
 		$side=$this->getSide($index);
120
-		if(isset($side)){
120
+		if (isset($side)) {
121 121
 			$side->setActive(true);
122 122
 		}
123 123
 		return $this;
124 124
 	}
125 125
 
126
-	public function asCube(){
126
+	public function asCube() {
127 127
 		return $this->addToPropertyCtrl("class", "cube", ["cube"]);
128 128
 	}
129 129
 
130
-	public function asText(){
130
+	public function asText() {
131 131
 		return $this->addToPropertyCtrl("class", "text", ["text"]);
132 132
 	}
133 133
 
134
-	public function setWidth($width="initial"){
134
+	public function setWidth($width="initial") {
135 135
 		$this->_params["width"]=$width;
136 136
 	}
137
-	public function onChange($jsCode){
138
-		return $this->_params["onChange"]="%function(){" . $jsCode . "}%";
137
+	public function onChange($jsCode) {
138
+		return $this->_params["onChange"]="%function(){".$jsCode."}%";
139 139
 	}
140 140
 
141
-	public function beforeChange($jsCode){
142
-		return $this->_params["beforeChange"]="%function(){" . $jsCode . "}%";
141
+	public function beforeChange($jsCode) {
142
+		return $this->_params["beforeChange"]="%function(){".$jsCode."}%";
143 143
 	}
144 144
 
145 145
 	/*
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 	 * @see BaseHtml::run()
148 148
 	 */
149 149
 	public function run(JsUtils $js) {
150
-		if (isset($this->_bsComponent) === false)
151
-			$this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params);
150
+		if (isset($this->_bsComponent)===false)
151
+			$this->_bsComponent=$js->semantic()->shape("#".$this->identifier, $this->_params);
152 152
 		$this->addEventsOnRun($js);
153 153
 		return $this->_bsComponent;
154 154
 	}
155 155
 
156 156
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
157
-		if($this->_autoActive)
157
+		if ($this->_autoActive)
158 158
 			$this->setActiveSide(0);
159
-		return parent::compile($js,$view);
159
+		return parent::compile($js, $view);
160 160
 	}
161 161
 }
Please login to merge, or discard this patch.