Passed
Push — master ( 695c9a...8412f6 )
by Jean-Christophe
02:29
created
Ajax/common/traits/JsUtilsInternalTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
5 5
 
6 6
 trait JsUtilsInternalTrait {
7 7
 
8
-	protected $jquery_code_for_compile = array();
8
+	protected $jquery_code_for_compile=array();
9 9
 
10
-	protected $jquery_code_for_compile_at_last = array();
10
+	protected $jquery_code_for_compile_at_last=array();
11 11
 
12 12
 	protected function _addToCompile($jsScript) {
13
-		$this->jquery_code_for_compile[] = $jsScript;
13
+		$this->jquery_code_for_compile[]=$jsScript;
14 14
 	}
15 15
 
16 16
 	/**
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param BaseGui $library
19 19
 	 * @param mixed $view
20 20
 	 */
21
-	protected function _compileLibrary(BaseGui $library, &$view = NULL) {
21
+	protected function _compileLibrary(BaseGui $library, &$view=NULL) {
22 22
 		if (isset($view))
23 23
 			$library->compileHtml($this, $view);
24 24
 		if ($library->isAutoCompile()) {
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 	}
28 28
 
29 29
 	protected function defer($script) {
30
-		$result = "(function(){window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { window.defer(method); }, 50);};";
31
-		$result .= "window.defer(function(){" . $script . "})})()";
30
+		$result="(function(){window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { window.defer(method); }, 50);};";
31
+		$result.="window.defer(function(){".$script."})})()";
32 32
 		return $result;
33 33
 	}
34 34
 
35 35
 	protected function ready($script) {
36
-		$result = '$(function() {' . "\n";
37
-		$result .= $script . '});';
36
+		$result='$(function() {'."\n";
37
+		$result.=$script.'});';
38 38
 		return $result;
39 39
 	}
40 40
 
41 41
 	protected function minify($input) {
42
-		if (trim($input) === "")
42
+		if (trim($input)==="")
43 43
 			return $input;
44
-		$input = preg_replace(array(
44
+		$input=preg_replace(array(
45 45
 			// Remove comment(s)
46 46
 			'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
47 47
 			// Remove white-space(s) outside the string and regex
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			'$1$3',
60 60
 			'$1.$3'
61 61
 		), $input);
62
-		$input = str_replace("}$", "};$", $input);
62
+		$input=str_replace("}$", "};$", $input);
63 63
 		return $input;
64 64
 	}
65 65
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @param string $src
70 70
 	 * @return string
71 71
 	 */
72
-	protected function _open_script($src = '') {
73
-		$str = '<script ';
74
-		$str .= ($src == '') ? '>' : ' src="' . $src . '">';
72
+	protected function _open_script($src='') {
73
+		$str='<script ';
74
+		$str.=($src=='') ? '>' : ' src="'.$src.'">';
75 75
 		return $str;
76 76
 	}
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @param string $extra
82 82
 	 * @return string
83 83
 	 */
84
-	protected function _close_script($extra = "\n") {
84
+	protected function _close_script($extra="\n") {
85 85
 		return "</script>$extra";
86 86
 	}
87 87
 
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
  * @version 1.3.3
16 16
  */
17 17
 abstract class BaseHtml extends BaseWidget {
18
-	use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait;
18
+	use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait;
19 19
 
20 20
 	protected $_template;
21 21
 
22 22
 	protected $tagName;
23 23
 
24
-	protected $_wrapBefore = array();
24
+	protected $_wrapBefore=array();
25 25
 
26
-	protected $_wrapAfter = array();
26
+	protected $_wrapAfter=array();
27 27
 
28 28
 	protected $_bsComponent;
29 29
 
30
-	protected $_compiled = false;
30
+	protected $_compiled=false;
31 31
 
32
-	protected $_runned = false;
32
+	protected $_runned=false;
33 33
 
34 34
 	protected $_postCompile;
35 35
 
@@ -43,31 +43,31 @@  discard block
 block discarded – undo
43 43
 	abstract public function run(JsUtils $js);
44 44
 
45 45
 	private function _callSetter($setter, $key, $value, &$array) {
46
-		$result = false;
47
-		if (method_exists($this, $setter) && substr($setter, 0, 1) !== "_") {
46
+		$result=false;
47
+		if (method_exists($this, $setter) && substr($setter, 0, 1)!=="_") {
48 48
 			try {
49 49
 				$this->$setter($value);
50 50
 				unset($array[$key]);
51
-				$result = true;
52
-			} catch (\Exception $e) {
53
-				$result = false;
51
+				$result=true;
52
+			}catch (\Exception $e) {
53
+				$result=false;
54 54
 			}
55 55
 		}
56 56
 		return $result;
57 57
 	}
58 58
 
59
-	protected function getTemplate(JsUtils $js = NULL, $view = null) {
60
-		return PropertyWrapper::wrap($this->_wrapBefore, $js, $view) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js, $view);
59
+	protected function getTemplate(JsUtils $js=NULL, $view=null) {
60
+		return PropertyWrapper::wrap($this->_wrapBefore, $js, $view).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js, $view);
61 61
 	}
62 62
 
63 63
 	protected function ctrl($name, $value, $typeCtrl) {
64 64
 		if (\is_array($typeCtrl)) {
65
-			if (array_search($value, $typeCtrl) === false) {
66
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
65
+			if (array_search($value, $typeCtrl)===false) {
66
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
67 67
 			}
68 68
 		} else {
69
-			if (! $typeCtrl($value)) {
70
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
69
+			if (!$typeCtrl($value)) {
70
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
71 71
 			}
72 72
 		}
73 73
 		return true;
@@ -75,49 +75,49 @@  discard block
 block discarded – undo
75 75
 
76 76
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
77 77
 		$this->ctrl($name, $value, $typeCtrl);
78
-		$name = $value;
78
+		$name=$value;
79 79
 		return $this;
80 80
 	}
81 81
 
82
-	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator = " ") {
82
+	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
83 83
 		if (\is_array($typeCtrl)) {
84 84
 			$this->removeOldValues($name, $typeCtrl);
85
-			$name .= $separator . $value;
85
+			$name.=$separator.$value;
86 86
 		}
87 87
 		return $this;
88 88
 	}
89 89
 
90
-	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator = " ") {
90
+	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
91 91
 		$this->ctrl($name, $value, $typeCtrl);
92 92
 		if (\is_array($typeCtrl)) {
93 93
 			$this->removeOldValues($name, $typeCtrl);
94 94
 		}
95
-		$name .= $separator . $value;
95
+		$name.=$separator.$value;
96 96
 		return $this;
97 97
 	}
98 98
 
99
-	protected function addToMember(&$name, $value, $separator = ' ') {
100
-		$name = \str_ireplace($value, '', $name??'') . $separator . $value;
99
+	protected function addToMember(&$name, $value, $separator=' ') {
100
+		$name=\str_ireplace($value, '', $name ?? '').$separator.$value;
101 101
 		return $this;
102 102
 	}
103 103
 
104 104
 	protected function removeOldValues(&$oldValue, $allValues) {
105
-		$oldValue = \str_ireplace($allValues, '', $oldValue??'');
106
-		$oldValue = \trim($oldValue);
105
+		$oldValue=\str_ireplace($allValues, '', $oldValue ?? '');
106
+		$oldValue=\trim($oldValue);
107 107
 	}
108 108
 
109 109
 	protected function _getElementBy($callback, $elements) {
110 110
 		if (\is_array($elements)) {
111
-			$elements = \array_values($elements);
112
-			$flag = false;
113
-			$index = 0;
114
-			while (! $flag && $index < sizeof($elements)) {
111
+			$elements=\array_values($elements);
112
+			$flag=false;
113
+			$index=0;
114
+			while (!$flag && $index<sizeof($elements)) {
115 115
 				if ($elements[$index] instanceof BaseHtml)
116
-					$flag = ($callback($elements[$index]));
117
-				$index ++;
116
+					$flag=($callback($elements[$index]));
117
+				$index++;
118 118
 			}
119
-			if ($flag === true)
120
-				return $elements[$index - 1];
119
+			if ($flag===true)
120
+				return $elements[$index-1];
121 121
 		} elseif ($elements instanceof BaseHtml) {
122 122
 			if ($callback($elements))
123 123
 				return $elements;
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	protected function setWrapBefore($wrapBefore) {
129
-		$this->_wrapBefore = $wrapBefore;
129
+		$this->_wrapBefore=$wrapBefore;
130 130
 		return $this;
131 131
 	}
132 132
 
133 133
 	protected function setWrapAfter($wrapAfter) {
134
-		$this->_wrapAfter = $wrapAfter;
134
+		$this->_wrapAfter=$wrapAfter;
135 135
 		return $this;
136 136
 	}
137 137
 
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 	public function setTagName($tagName) {
143
-		$this->tagName = $tagName;
143
+		$this->tagName=$tagName;
144 144
 		return $this;
145 145
 	}
146 146
 
147 147
 	public function fromArray($array) {
148 148
 		foreach ($this as $key => $value) {
149
-			if (array_key_exists($key, $array) === true)
150
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
149
+			if (array_key_exists($key, $array)===true)
150
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
151 151
 		}
152 152
 		foreach ($array as $key => $value) {
153
-			if ($this->_callSetter($key, $key, $value, $array) === false) {
154
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
153
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
154
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
155 155
 			}
156 156
 		}
157 157
 		return $array;
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 
169 169
 	public function fromDatabaseObject($object, $function) {}
170 170
 
171
-	public function wrap($before, $after = "") {
171
+	public function wrap($before, $after="") {
172 172
 		if (isset($before)) {
173 173
 			array_unshift($this->_wrapBefore, $before);
174 174
 		}
175
-		$this->_wrapAfter[] = $after;
175
+		$this->_wrapAfter[]=$after;
176 176
 		return $this;
177 177
 	}
178 178
 
179 179
 	public function getElementById($identifier, $elements) {
180
-		return $this->_getElementBy(function (BaseWidget $element) use ($identifier) {
181
-			return $element->getIdentifier() === $identifier;
180
+		return $this->_getElementBy(function(BaseWidget $element) use ($identifier) {
181
+			return $element->getIdentifier()===$identifier;
182 182
 		}, $elements);
183 183
 	}
184 184
 
@@ -187,50 +187,50 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	public function setBsComponent($bsComponent) {
190
-		$this->_bsComponent = $bsComponent;
190
+		$this->_bsComponent=$bsComponent;
191 191
 		return $this;
192 192
 	}
193 193
 
194
-	protected function compile_once(JsUtils $js = NULL, &$view = NULL) {
195
-		if (! $this->_compiled) {
194
+	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
195
+		if (!$this->_compiled) {
196 196
 			if (isset($js)) {
197
-				$beforeCompile = $js->getParam("beforeCompileHtml");
197
+				$beforeCompile=$js->getParam("beforeCompileHtml");
198 198
 				if (\is_callable($beforeCompile)) {
199 199
 					$beforeCompile($this, $js, $view);
200 200
 				}
201 201
 			}
202 202
 			$this->callCallback($this->_preCompile);
203 203
 			unset($this->properties["jsCallback"]);
204
-			$this->_compiled = true;
204
+			$this->_compiled=true;
205 205
 		}
206 206
 	}
207 207
 
208
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
208
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
209 209
 		$this->compile_once($js, $view);
210
-		$result = $this->getTemplate($js, $view);
210
+		$result=$this->getTemplate($js, $view);
211 211
 		foreach ($this as $key => $value) {
212
-			if (\strstr($result, "%{$key}%") !== false) {
212
+			if (\strstr($result, "%{$key}%")!==false) {
213 213
 				if (\is_array($value)) {
214
-					$v = PropertyWrapper::wrap($value, $js, $view);
214
+					$v=PropertyWrapper::wrap($value, $js, $view);
215 215
 				} elseif ($value instanceof \stdClass) {
216
-					$v = \print_r($value, true);
216
+					$v=\print_r($value, true);
217 217
 				} elseif ($value instanceof BaseHtml) {
218
-					$v = $value->compile($js, $view);
218
+					$v=$value->compile($js, $view);
219 219
 				} else {
220
-					$v = $value;
220
+					$v=$value;
221 221
 				}
222
-				$result = \str_replace("%{$key}%", $v ?? '', $result);
222
+				$result=\str_replace("%{$key}%", $v ?? '', $result);
223 223
 			}
224 224
 		}
225
-		if (isset($js) === true) {
225
+		if (isset($js)===true) {
226 226
 			$this->run($js);
227
-			if (isset($view) === true) {
227
+			if (isset($view)===true) {
228 228
 				$js->addViewElement($this->getLibraryId(), $result, $view);
229 229
 			}
230 230
 		}
231 231
 
232 232
 		if (\is_callable($this->_postCompile)) {
233
-			$pc = $this->_postCompile;
233
+			$pc=$this->_postCompile;
234 234
 			$pc($this);
235 235
 		}
236 236
 		return $result;
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
 	 *        	default: ["jsCallback"=>"","jqueryDone"=>"append"]
248 248
 	 * @return \Ajax\common\html\BaseHtml
249 249
 	 */
250
-	public function setDraggable($attr = "id", $dropZone = null, $parameters = []) {
250
+	public function setDraggable($attr="id", $dropZone=null, $parameters=[]) {
251 251
 		$this->setProperty("draggable", "true");
252 252
 		$this->addEvent("dragstart", Javascript::draggable($attr));
253 253
 		if (isset($dropZone) && $dropZone instanceof BaseHtml) {
254
-			$jqueryDone = "append";
255
-			$jsCallback = "";
254
+			$jqueryDone="append";
255
+			$jsCallback="";
256 256
 			extract($parameters);
257 257
 			$dropZone->asDropZone($jsCallback, $jqueryDone, $parameters);
258 258
 		}
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 	 * @param array $parameters
268 268
 	 * @return \Ajax\common\html\BaseHtml
269 269
 	 */
270
-	public function asDropZone($jsCallback = "", $jqueryDone = "append", $parameters = []) {
271
-		$stopPropagation = false;
270
+	public function asDropZone($jsCallback="", $jqueryDone="append", $parameters=[]) {
271
+		$stopPropagation=false;
272 272
 		$this->addEvent("dragover", '', $stopPropagation, true);
273 273
 		extract($parameters);
274 274
 		$this->addEvent("drop", Javascript::dropZone($jqueryDone, $jsCallback), $stopPropagation, true);
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 * @param array $parameters
286 286
 	 * @return \Ajax\common\html\BaseHtml
287 287
 	 */
288
-	public function asFileDropZone($responseElement = null, $url = null, $progress = null, $jsCallback = "", $parameters = []) {
289
-		$stopPropagation = false;
290
-		$defaultAjaxAttributes = [
288
+	public function asFileDropZone($responseElement=null, $url=null, $progress=null, $jsCallback="", $parameters=[]) {
289
+		$stopPropagation=false;
290
+		$defaultAjaxAttributes=[
291 291
 			'contentType' => 'false',
292 292
 			'processData' => 'false'
293 293
 		];
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
 		extract($parameters);
296 296
 		$this->addEvent("drop", Javascript::fileDropZone($jsCallback), $stopPropagation, true);
297 297
 		if (isset($ajaxAttributes)) {
298
-			$ajaxAttributes += $defaultAjaxAttributes;
298
+			$ajaxAttributes+=$defaultAjaxAttributes;
299 299
 		} else {
300
-			$ajaxAttributes = $defaultAjaxAttributes;
300
+			$ajaxAttributes=$defaultAjaxAttributes;
301 301
 		}
302 302
 		if (isset($progress)) {
303
-			$progress = new HtmlProgress($this->_identifier . '-pg', 0, $progress);
303
+			$progress=new HtmlProgress($this->_identifier.'-pg', 0, $progress);
304 304
 			$progress->setTotal(100);
305 305
 			$this->wrap('', $progress);
306
-			$ajaxAttributes['upload'] = "$('#" . $this->_identifier . "-pg').progress('set percent', Math.ceil(event.loaded/event.total)*100);";
306
+			$ajaxAttributes['upload']="$('#".$this->_identifier."-pg').progress('set percent', Math.ceil(event.loaded/event.total)*100);";
307 307
 		}
308 308
 		if (isset($url)) {
309 309
 			$this->postOn('upload', $url, 'event.target.upload', $responseElement, $ajaxAttributes);
@@ -316,21 +316,21 @@  discard block
 block discarded – undo
316 316
 	}
317 317
 
318 318
 	public function onPostCompile($callback) {
319
-		$this->_postCompile = $callback;
319
+		$this->_postCompile=$callback;
320 320
 	}
321 321
 
322 322
 	public function onPreCompile($callback) {
323
-		$this->_preCompile = $this->addCallback($this->_preCompile, $callback);
323
+		$this->_preCompile=$this->addCallback($this->_preCompile, $callback);
324 324
 	}
325 325
 
326 326
 	private function addCallback($originalValue, $callback) {
327 327
 		if (isset($originalValue)) {
328
-			if (! is_array($originalValue)) {
329
-				$result = [
328
+			if (!is_array($originalValue)) {
329
+				$result=[
330 330
 					$originalValue
331 331
 				];
332 332
 			}
333
-			$result[] = $callback;
333
+			$result[]=$callback;
334 334
 			return $result;
335 335
 		}
336 336
 		return $callback;
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/Pagination.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	private $row_count;
13 13
 	private $menu;
14 14
 
15
-	public function __construct($items_per_page=10,$pages_visibles=null,$page=1,$row_count=null){
15
+	public function __construct($items_per_page=10, $pages_visibles=null, $page=1, $row_count=null) {
16 16
 		$this->items_per_page=$items_per_page;
17 17
 		$this->row_count=$row_count;
18 18
 		$this->page=$page;
@@ -20,30 +20,30 @@  discard block
 block discarded – undo
20 20
 		$this->visible=true;
21 21
 	}
22 22
 
23
-	public function getObjects($objects){
23
+	public function getObjects($objects) {
24 24
 		$auto=(!isset($this->row_count));
25 25
 		$os=$objects;
26
-		if(!\is_array($os)){
26
+		if (!\is_array($os)) {
27 27
 			$os=[];
28
-			foreach ($objects as $o){
28
+			foreach ($objects as $o) {
29 29
 				$os[]=$o;
30 30
 			}
31 31
 		}
32
-		$this->page_count = 0;
33
-		$row_count=($auto)?\sizeof($os):$this->row_count;
34
-		if (0 === $row_count) {
32
+		$this->page_count=0;
33
+		$row_count=($auto) ? \sizeof($os) : $this->row_count;
34
+		if (0===$row_count) {
35 35
 			$this->visible=false;
36 36
 		} else {
37 37
 
38
-			$this->page_count = (int)ceil($row_count / $this->items_per_page);
38
+			$this->page_count=(int)ceil($row_count/$this->items_per_page);
39 39
 			$this->visible=$this->page_count>1;
40
-			if($this->page > $this->page_count+1) {
41
-				$this->page = 1;
40
+			if ($this->page>$this->page_count+1) {
41
+				$this->page=1;
42 42
 			}
43 43
 		}
44
-		if($auto){
45
-			$offset = ($this->page - 1) * $this->items_per_page;
46
-			return array_slice($os, $offset,$this->items_per_page);
44
+		if ($auto) {
45
+			$offset=($this->page-1)*$this->items_per_page;
46
+			return array_slice($os, $offset, $this->items_per_page);
47 47
 		}
48 48
 		return $os;
49 49
 	}
@@ -79,28 +79,28 @@  discard block
 block discarded – undo
79 79
 		return $this->page_count;
80 80
 	}
81 81
 
82
-	public function getPagesNumbers(){
83
-		$middle= (int)ceil(($this->pages_visibles-1)/ 2);
82
+	public function getPagesNumbers() {
83
+		$middle=(int)ceil(($this->pages_visibles-1)/2);
84 84
 		$first=$this->page-$middle;
85
-		if($first<1){
85
+		if ($first<1) {
86 86
 			$first=1;
87 87
 		}
88 88
 		$last=$first+$this->pages_visibles-1;
89
-		if($last>$this->page_count){
89
+		if ($last>$this->page_count) {
90 90
 			$last=$this->page_count;
91 91
 		}
92 92
 		return \range($first, $last);
93 93
 	}
94 94
 
95 95
 	public function setPagesVisibles($pages_visibles) {
96
-		if(!isset($pages_visibles))
97
-			$pages_visibles=(int)ceil($this->row_count / $this->items_per_page)+1;
96
+		if (!isset($pages_visibles))
97
+			$pages_visibles=(int)ceil($this->row_count/$this->items_per_page)+1;
98 98
 		$this->pages_visibles=$pages_visibles;
99 99
 		return $this;
100 100
 	}
101 101
 	
102
-	public function generateMenu($identifier){
103
-		$menu=new HtmlPaginationMenu("pagination-".$identifier,$this->getPagesNumbers());
102
+	public function generateMenu($identifier) {
103
+		$menu=new HtmlPaginationMenu("pagination-".$identifier, $this->getPagesNumbers());
104 104
 		$menu->setMax($this->page_count);
105 105
 		$menu->floatRight();
106 106
 		$menu->setActivePage($this->getPage());
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 		return $this->menu;
115 115
 	}
116 116
 	
117
-	public static function getPageOfRow($rownum,$itemsPerPage=10){
118
-		$pageNum=0;$activeRow=0;
119
-		while($activeRow<$rownum){
117
+	public static function getPageOfRow($rownum, $itemsPerPage=10) {
118
+		$pageNum=0; $activeRow=0;
119
+		while ($activeRow<$rownum) {
120 120
 			$activeRow+=$itemsPerPage;
121 121
 			$pageNum++;
122 122
 		}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  */
38 38
 trait FieldAsTrait {
39 39
 
40
-	abstract protected function _getFieldIdentifier($prefix, $name = "");
40
+	abstract protected function _getFieldIdentifier($prefix, $name="");
41 41
 
42 42
 	abstract public function setValueFunction($index, $callback);
43 43
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 	abstract protected function _getFieldCaption($index);
47 47
 
48
-	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement = NULL, $parameters = NULL);
48
+	abstract protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL);
49 49
 
50 50
 	private $_speProperties;
51 51
 
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @param HtmlFormField $element
55 55
 	 * @param array $attributes
56 56
 	 */
57
-	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance = null) {
57
+	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) {
58 58
 		if (isset($attributes["jsCallback"])) {
59
-			$callback = $attributes["jsCallback"];
59
+			$callback=$attributes["jsCallback"];
60 60
 			if (\is_callable($callback)) {
61 61
 				$callback($element, $instance, $index, InstanceViewer::$index);
62 62
 			}
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 		$element->fromArray($attributes);
68 68
 	}
69 69
 
70
-	private function _getLabelField($caption, $icon = NULL) {
71
-		$label = new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
70
+	private function _getLabelField($caption, $icon=NULL) {
71
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
72 72
 		return $label;
73 73
 	}
74 74
 
75 75
 	protected function _addRules(HtmlFormField $element, &$attributes) {
76 76
 		if (isset($attributes["rules"])) {
77
-			$this->_hasRules = true;
78
-			$rules = $attributes["rules"];
77
+			$this->_hasRules=true;
78
+			$rules=$attributes["rules"];
79 79
 			if (\is_array($rules)) {
80 80
 				$element->addRules($rules);
81 81
 			} else {
@@ -85,30 +85,30 @@  discard block
 block discarded – undo
85 85
 		}
86 86
 	}
87 87
 
88
-	protected function _prepareFormFields(HtmlFormField &$field, $name, &$attributes) {
88
+	protected function _prepareFormFields(HtmlFormField&$field, $name, &$attributes) {
89 89
 		$field->setName($name);
90 90
 		$this->_addRules($field, $attributes);
91 91
 		return $field;
92 92
 	}
93 93
 
94
-	protected function _fieldAs($elementCallback, &$index, $attributes = NULL, $prefix = null) {
95
-		$this->setValueFunction($index, function ($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) {
96
-			$caption = $this->_getFieldCaption($index);
97
-			$name = $this->_getFieldName($index);
98
-			$id = $this->_getFieldIdentifier($prefix, $name);
94
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
95
+		$this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) {
96
+			$caption=$this->_getFieldCaption($index);
97
+			$name=$this->_getFieldName($index);
98
+			$id=$this->_getFieldIdentifier($prefix, $name);
99 99
 			if (isset($attributes["name"])) {
100
-				$name = $attributes["name"];
100
+				$name=$attributes["name"];
101 101
 				unset($attributes["name"]);
102 102
 			}
103
-			$element = $elementCallback($id, $name, $value, $caption);
103
+			$element=$elementCallback($id, $name, $value, $caption);
104 104
 			if (isset($this->_speProperties[$index])) {
105
-				$attributes ??= [];
106
-				$attributes += $this->_speProperties[$index];
105
+				$attributes??=[];
106
+				$attributes+=$this->_speProperties[$index];
107 107
 			}
108 108
 			if (\is_array($attributes)) {
109 109
 				$this->_applyAttributes($element, $attributes, $index, $instance);
110 110
 			}
111
-			$element->setDisabled(! $this->_edition);
111
+			$element->setDisabled(!$this->_edition);
112 112
 			return $element;
113 113
 		});
114 114
 		return $this;
@@ -124,48 +124,48 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function setPropertyValues($property, $indexValues) {
126 126
 		foreach ($indexValues as $index => $value) {
127
-			$ind = $this->_getIndex($index);
128
-			$this->_speProperties[$ind][$property] = $value;
127
+			$ind=$this->_getIndex($index);
128
+			$this->_speProperties[$ind][$property]=$value;
129 129
 		}
130 130
 	}
131 131
 
132
-	public function fieldAsProgress($index, $label = NULL, $attributes = array()) {
133
-		$this->setValueFunction($index, function ($value) use ($label, $attributes) {
134
-			$pb = new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
132
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
133
+		$this->setValueFunction($index, function($value) use ($label, $attributes) {
134
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
135 135
 			return $pb;
136 136
 		});
137 137
 		return $this;
138 138
 	}
139 139
 
140
-	public function fieldAsRating($index, $max = 5, $icon = "") {
141
-		$this->setValueFunction($index, function ($value) use ($max, $icon) {
142
-			$rating = new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
140
+	public function fieldAsRating($index, $max=5, $icon="") {
141
+		$this->setValueFunction($index, function($value) use ($max, $icon) {
142
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
143 143
 			return $rating;
144 144
 		});
145 145
 		return $this;
146 146
 	}
147 147
 
148
-	public function fieldAsLabel($index, $icon = NULL, $attributes = NULL) {
149
-		return $this->_fieldAs(function ($id, $name, $value) use ($icon) {
150
-			$lbl = new HtmlLabel($id, $value);
148
+	public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) {
149
+		return $this->_fieldAs(function($id, $name, $value) use ($icon) {
150
+			$lbl=new HtmlLabel($id, $value);
151 151
 			if (isset($icon))
152 152
 				$lbl->addIcon($icon);
153 153
 			return $lbl;
154 154
 		}, $index, $attributes, "label");
155 155
 	}
156 156
 
157
-	public function fieldAsHeader($index, $niveau = 1, $icon = NULL, $attributes = NULL) {
158
-		return $this->_fieldAs(function ($id, $name, $value) use ($niveau, $icon) {
159
-			$header = new HtmlHeader($id, $niveau, $value);
157
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
158
+		return $this->_fieldAs(function($id, $name, $value) use ($niveau, $icon) {
159
+			$header=new HtmlHeader($id, $niveau, $value);
160 160
 			if (isset($icon))
161 161
 				$header->asIcon($icon, $value);
162 162
 			return $header;
163 163
 		}, $index, $attributes, "header");
164 164
 	}
165 165
 
166
-	public function fieldAsImage($index, $size = Size::MINI, $circular = false) {
167
-		$this->setValueFunction($index, function ($img) use ($size, $circular) {
168
-			$image = new HtmlImage($this->_getFieldIdentifier("image"), $img);
166
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
167
+		$this->setValueFunction($index, function($img) use ($size, $circular) {
168
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img);
169 169
 			$image->setSize($size);
170 170
 			if ($circular)
171 171
 				$image->setCircular();
@@ -175,65 +175,65 @@  discard block
 block discarded – undo
175 175
 	}
176 176
 
177 177
 	public function fieldAsFlag($index) {
178
-		$this->setValueFunction($index, function ($flag) {
179
-			$flag = new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
178
+		$this->setValueFunction($index, function($flag) {
179
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
180 180
 			return $flag;
181 181
 		});
182 182
 		return $this;
183 183
 	}
184 184
 
185 185
 	public function fieldAsIcon($index) {
186
-		$this->setValueFunction($index, function ($icon) {
187
-			$icon = new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
186
+		$this->setValueFunction($index, function($icon) {
187
+			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
188 188
 			return $icon;
189 189
 		});
190 190
 		return $this;
191 191
 	}
192 192
 
193
-	public function fieldAsAvatar($index, $attributes = NULL) {
194
-		return $this->_fieldAs(function ($id, $name, $value) {
195
-			$img = new HtmlImage($id, $value);
193
+	public function fieldAsAvatar($index, $attributes=NULL) {
194
+		return $this->_fieldAs(function($id, $name, $value) {
195
+			$img=new HtmlImage($id, $value);
196 196
 			$img->asAvatar();
197 197
 			return $img;
198 198
 		}, $index, $attributes, "avatar");
199 199
 	}
200 200
 
201
-	public function fieldAsRadio($index, $attributes = NULL) {
202
-		return $this->_fieldAs(function ($id, $name, $value) use ($attributes) {
203
-			$input = new HtmlFormRadio($id, $name, $value, $value);
201
+	public function fieldAsRadio($index, $attributes=NULL) {
202
+		return $this->_fieldAs(function($id, $name, $value) use ($attributes) {
203
+			$input=new HtmlFormRadio($id, $name, $value, $value);
204 204
 			return $this->_prepareFormFields($input, $name, $attributes);
205 205
 		}, $index, $attributes, "radio");
206 206
 	}
207 207
 
208
-	public function fieldAsRadios($index, $elements = [], $attributes = NULL) {
209
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements) {
208
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
209
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements) {
210 210
 			return HtmlFormFields::radios($name, $elements, $caption, $value);
211 211
 		}, $index, $attributes, "radios");
212 212
 	}
213 213
 
214
-	public function fieldAsList($index, $classNames = "", $attributes = NULL) {
215
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($classNames) {
216
-			$result = new HtmlList($name, $value);
214
+	public function fieldAsList($index, $classNames="", $attributes=NULL) {
215
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($classNames) {
216
+			$result=new HtmlList($name, $value);
217 217
 			$result->addClass($classNames);
218 218
 			return $result;
219 219
 		}, $index, $attributes, "list");
220 220
 	}
221 221
 
222
-	public function fieldAsInput($index, $attributes = NULL) {
223
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
224
-			$input = new HtmlFormInput($id, $caption, "text", $value);
222
+	public function fieldAsInput($index, $attributes=NULL) {
223
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
224
+			$input=new HtmlFormInput($id, $caption, "text", $value);
225 225
 			return $this->_prepareFormFields($input, $name, $attributes);
226 226
 		}, $index, $attributes, "input");
227 227
 	}
228 228
 
229
-	public function fieldAsLabeledInput($index, $attributes = NULL) {
230
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
231
-			$input = new HtmlFormInput($id, '', 'text', $value, $caption);
232
-			$required = '';
229
+	public function fieldAsLabeledInput($index, $attributes=NULL) {
230
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
231
+			$input=new HtmlFormInput($id, '', 'text', $value, $caption);
232
+			$required='';
233 233
 			if (isset($attributes['rules'])) {
234
-				$rules = json_encode($attributes['rules']);
235
-				if (strpos($rules, 'empty') !== false) {
236
-					$required = 'required';
234
+				$rules=json_encode($attributes['rules']);
235
+				if (strpos($rules, 'empty')!==false) {
236
+					$required='required';
237 237
 				}
238 238
 			}
239 239
 			$input->getField()
@@ -244,80 +244,80 @@  discard block
 block discarded – undo
244 244
 		}, $index, $attributes, 'input');
245 245
 	}
246 246
 
247
-	public function fieldAsDataList($index, ?array $items = [], $attributes = NULL) {
248
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $items) {
249
-			$input = new HtmlFormInput($id, $caption, "text", $value);
247
+	public function fieldAsDataList($index, ?array $items=[], $attributes=NULL) {
248
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $items) {
249
+			$input=new HtmlFormInput($id, $caption, "text", $value);
250 250
 			$input->getField()
251 251
 				->addDataList($items);
252 252
 			return $this->_prepareFormFields($input, $name, $attributes);
253 253
 		}, $index, $attributes, "input");
254 254
 	}
255 255
 
256
-	public function fieldAsFile($index, $attributes = NULL) {
256
+	public function fieldAsFile($index, $attributes=NULL) {
257 257
 		if (isset($this->_form)) {
258 258
 			$this->_form->setProperty('enctype', 'multipart/form-data');
259 259
 		}
260
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
261
-			$input = new HtmlFormInput($id, $caption);
260
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
261
+			$input=new HtmlFormInput($id, $caption);
262 262
 			$input->asFile();
263 263
 			return $this->_prepareFormFields($input, $name, $attributes);
264 264
 		}, $index, $attributes, "input");
265 265
 	}
266 266
 
267
-	public function fieldAsTextarea($index, $attributes = NULL) {
268
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
269
-			$textarea = new HtmlFormTextarea($id, $caption, $value);
267
+	public function fieldAsTextarea($index, $attributes=NULL) {
268
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
269
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
270 270
 			return $this->_prepareFormFields($textarea, $name, $attributes);
271 271
 		}, $index, $attributes, "textarea");
272 272
 	}
273 273
 
274
-	public function fieldAsElement($index, $tagName = "div", $baseClass = "", $attributes = NULL) {
275
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) {
276
-			$div = new HtmlSemDoubleElement($id, $tagName, $baseClass);
274
+	public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) {
275
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) {
276
+			$div=new HtmlSemDoubleElement($id, $tagName, $baseClass);
277 277
 			$div->setContent(\htmlentities($value));
278
-			$textarea = new HtmlFormField("field-" . $id, $div, $caption);
278
+			$textarea=new HtmlFormField("field-".$id, $div, $caption);
279 279
 			return $this->_prepareFormFields($textarea, $name, $attributes);
280 280
 		}, $index, $attributes, "element");
281 281
 	}
282 282
 
283
-	public function fieldAsHidden($index, $attributes = NULL) {
284
-		if (! \is_array($attributes)) {
285
-			$attributes = [];
283
+	public function fieldAsHidden($index, $attributes=NULL) {
284
+		if (!\is_array($attributes)) {
285
+			$attributes=[];
286 286
 		}
287
-		$attributes["inputType"] = "hidden";
288
-		$attributes["style"] = "display:none;";
287
+		$attributes["inputType"]="hidden";
288
+		$attributes["style"]="display:none;";
289 289
 		return $this->fieldAsInput($index, $attributes);
290 290
 	}
291 291
 
292
-	public function fieldAsCheckbox($index, $attributes = NULL) {
293
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
294
-			if ($caption === null || $caption === "")
295
-				$caption = "";
296
-			$input = new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
292
+	public function fieldAsCheckbox($index, $attributes=NULL) {
293
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
294
+			if ($caption===null || $caption==="")
295
+				$caption="";
296
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
297 297
 			$input->setChecked(JString::isBooleanTrue($value));
298 298
 			return $this->_prepareFormFields($input, $name, $attributes);
299 299
 		}, $index, $attributes, "ck");
300 300
 	}
301 301
 
302
-	public function fieldAsDropDown($index, $elements = [], $multiple = false, $attributes = NULL) {
303
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements, $multiple, $attributes) {
304
-			$dd = new HtmlFormDropdown($id, $elements, $caption, $value ?? '');
302
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
303
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements, $multiple, $attributes) {
304
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value ?? '');
305 305
 			$dd->asSelect($name, $multiple);
306 306
 			return $this->_prepareFormFields($dd, $name, $attributes);
307 307
 		}, $index, $attributes, "dd");
308 308
 	}
309 309
 
310
-	public function fieldAsMessage($index, $attributes = NULL) {
311
-		return $this->_fieldAs(function ($id, $name, $value, $caption) {
312
-			$mess = new HtmlMessage("message-" . $id, $caption);
310
+	public function fieldAsMessage($index, $attributes=NULL) {
311
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
312
+			$mess=new HtmlMessage("message-".$id, $caption);
313 313
 			$mess->addHeader($value);
314 314
 			return $mess;
315 315
 		}, $index, $attributes, "message");
316 316
 	}
317 317
 
318
-	public function fieldAsLink($index, $attributes = NULL) {
319
-		return $this->_fieldAs(function ($id, $name, $value, $caption) {
320
-			$lnk = new HtmlLink("message-" . $id, "#", $caption);
318
+	public function fieldAsLink($index, $attributes=NULL) {
319
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
320
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
321 321
 			return $lnk;
322 322
 		}, $index, $attributes, "link");
323 323
 	}
@@ -329,28 +329,28 @@  discard block
 block discarded – undo
329 329
 	 *        	an array or associative array $type=>$attributes
330 330
 	 */
331 331
 	public function fieldsAs(array $types) {
332
-		$i = 0;
332
+		$i=0;
333 333
 		if (JArray::isAssociative($types)) {
334 334
 			foreach ($types as $type => $attributes) {
335 335
 				if (\is_int($type))
336
-					$this->fieldAs($i ++, $attributes, []);
336
+					$this->fieldAs($i++, $attributes, []);
337 337
 				else {
338
-					$type = preg_replace('/\d/', '', $type);
339
-					$this->fieldAs($i ++, $type, $attributes);
338
+					$type=preg_replace('/\d/', '', $type);
339
+					$this->fieldAs($i++, $type, $attributes);
340 340
 				}
341 341
 			}
342 342
 		} else {
343 343
 			foreach ($types as $type) {
344
-				$this->fieldAs($i ++, $type);
344
+				$this->fieldAs($i++, $type);
345 345
 			}
346 346
 		}
347 347
 	}
348 348
 
349
-	public function fieldAs($index, $type, $attributes = NULL) {
350
-		$method = "fieldAs" . \ucfirst($type);
349
+	public function fieldAs($index, $type, $attributes=NULL) {
350
+		$method="fieldAs".\ucfirst($type);
351 351
 		if (\method_exists($this, $method)) {
352
-			if (! \is_array($attributes)) {
353
-				$attributes = [
352
+			if (!\is_array($attributes)) {
353
+				$attributes=[
354 354
 					$index
355 355
 				];
356 356
 			} else {
@@ -363,39 +363,39 @@  discard block
 block discarded – undo
363 363
 		}
364 364
 	}
365 365
 
366
-	public function fieldAsSubmit($index, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $attributes = NULL) {
367
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) {
368
-			$button = new HtmlButton($id, $caption, $cssStyle);
366
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
367
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) {
368
+			$button=new HtmlButton($id, $caption, $cssStyle);
369 369
 			$this->_buttonAsSubmit($button, "click", $url, $responseElement, $attributes["ajax"] ?? []);
370 370
 			return $button;
371 371
 		}, $index, $attributes, "submit");
372 372
 	}
373 373
 
374
-	public function fieldAsButton($index, $cssStyle = NULL, $attributes = NULL) {
375
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($cssStyle) {
376
-			$button = new HtmlButton($id, $value, $cssStyle);
374
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
375
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle) {
376
+			$button=new HtmlButton($id, $value, $cssStyle);
377 377
 			return $button;
378 378
 		}, $index, $attributes, "button");
379 379
 	}
380 380
 
381
-	public function fieldAsDataTable($index, $model, $instances = null, $fields = [], $attributes = NULL) {
382
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($model, $instances, $fields, $index) {
383
-			$dt = new DataTable($id, $model, $instances);
381
+	public function fieldAsDataTable($index, $model, $instances=null, $fields=[], $attributes=NULL) {
382
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($model, $instances, $fields, $index) {
383
+			$dt=new DataTable($id, $model, $instances);
384 384
 			$dt->setNamePrefix($index);
385 385
 			$dt->setFields($fields);
386 386
 			$dt->setEdition(true);
387
-			$dt->addDeleteButton(false, [], function ($bt) use ($index) {
387
+			$dt->addDeleteButton(false, [], function($bt) use ($index) {
388 388
 				$bt->addClass('mini circular')
389
-					->wrap('<input value="" class="_status" type="hidden" name="' . $index . '._status[]">');
389
+					->wrap('<input value="" class="_status" type="hidden" name="'.$index.'._status[]">');
390 390
 			});
391
-			if ($caption != null) {
391
+			if ($caption!=null) {
392 392
 				$dt->setFormCaption($caption);
393 393
 			}
394
-			$dt->onPreCompile(function () use (&$dt) {
394
+			$dt->onPreCompile(function() use (&$dt) {
395 395
 				$dt->getHtmlComponent()
396 396
 					->colRightFromRight(0);
397 397
 			});
398
-			$dt->wrap('<input type="hidden" name="' . $index . '">');
398
+			$dt->wrap('<input type="hidden" name="'.$index.'">');
399 399
 			return $dt;
400 400
 		}, $index, $attributes, "dataTable");
401 401
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function __construct($identifier) {
24 24
 		parent::__construct($identifier, "tr", "");
25
-		$this->_states = [
25
+		$this->_states=[
26 26
 			State::ACTIVE,
27 27
 			State::POSITIVE,
28 28
 			State::NEGATIVE,
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	public function setColCount($colCount) {
36
-		$count = $this->count();
37
-		for ($i = $count; $i < $colCount; $i ++) {
38
-			$item = $this->addItem(NULL);
36
+		$count=$this->count();
37
+		for ($i=$count; $i<$colCount; $i++) {
38
+			$item=$this->addItem(NULL);
39 39
 			$item->setTagName($this->_tdTagName);
40 40
 		}
41 41
 		return $this;
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
53 53
 	 */
54 54
 	protected function createItem($value) {
55
-		$count = $this->count();
56
-		$td = new HtmlTD("", $value, $this->_tdTagName);
55
+		$count=$this->count();
56
+		$td=new HtmlTD("", $value, $this->_tdTagName);
57 57
 		$td->setContainer($this->_container, $this->_row, $count);
58 58
 		return $td;
59 59
 	}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 		return parent::getItem($index);
67 67
 	}
68 68
 
69
-	public function setTdTagName($tagName = "td") {
70
-		$this->_tdTagName = $tagName;
69
+	public function setTdTagName($tagName="td") {
70
+		$this->_tdTagName=$tagName;
71 71
 	}
72 72
 
73 73
 	/**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param int $row
78 78
 	 */
79 79
 	public function setContainer($container, $row) {
80
-		$this->_container = $container;
81
-		$this->_row = $row;
80
+		$this->_container=$container;
81
+		$this->_row=$row;
82 82
 	}
83 83
 
84 84
 	/**
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param mixed $values
88 88
 	 */
89
-	public function setValues($values = array()) {
90
-		return $this->_addOrSetValues($values, function (HtmlTD &$cell, $value) {
89
+	public function setValues($values=array()) {
90
+		return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {
91 91
 			$cell->setValue($value);
92 92
 		});
93 93
 	}
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @param mixed $values
99 99
 	 */
100
-	public function addValues($values = array()) {
101
-		return $this->_addOrSetValues($values, function (HtmlTD &$cell, $value) {
100
+	public function addValues($values=array()) {
101
+		return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {
102 102
 			$cell->addValue($value);
103 103
 		});
104 104
 	}
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 	 * @param mixed $values
110 110
 	 */
111 111
 	protected function _addOrSetValues($values, $callback) {
112
-		$count = $this->count();
113
-		if (! \is_array($values)) {
114
-			$values = \array_fill(0, $count, $values);
112
+		$count=$this->count();
113
+		if (!\is_array($values)) {
114
+			$values=\array_fill(0, $count, $values);
115 115
 		} else {
116
-			if (JArray::isAssociative($values) === true) {
117
-				$values = \array_values($values);
116
+			if (JArray::isAssociative($values)===true) {
117
+				$values=\array_values($values);
118 118
 			}
119 119
 		}
120
-		$count = \min(\sizeof($values), $count);
120
+		$count=\min(\sizeof($values), $count);
121 121
 
122
-		for ($i = 0; $i < $count; $i ++) {
123
-			$cell = $this->content[$i];
122
+		for ($i=0; $i<$count; $i++) {
123
+			$cell=$this->content[$i];
124 124
 			$callback($cell, $values[$i]);
125 125
 		}
126 126
 		return $this;
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 		return $this;
139 139
 	}
140 140
 
141
-	public function mergeCol($colIndex = 0) {
141
+	public function mergeCol($colIndex=0) {
142 142
 		return $this->getItem($colIndex)->mergeCol();
143 143
 	}
144 144
 
145
-	public function mergeRow($colIndex = 0) {
146
-		$row = $this->getItem($colIndex);
145
+	public function mergeRow($colIndex=0) {
146
+		$row=$this->getItem($colIndex);
147 147
 		if (isset($row)) {
148 148
 			$this->getItem($colIndex)->mergeRow();
149 149
 		}
@@ -151,31 +151,31 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	public function getColPosition($colIndex) {
154
-		if ($this->_container->_isMerged() !== true)
154
+		if ($this->_container->_isMerged()!==true)
155 155
 			return $colIndex;
156
-		$pos = 0;
157
-		$rows = $this->_container->getContent();
158
-		for ($i = 0; $i < $this->_row; $i ++) {
159
-			$max = \min($colIndex, $rows[$i]->count());
160
-			for ($j = 0; $j < $max; $j ++) {
161
-				$rowspan = $rows[$i]->getItem($j)->getRowspan();
162
-				if ($rowspan + $i > $this->_row)
163
-					$pos ++;
156
+		$pos=0;
157
+		$rows=$this->_container->getContent();
158
+		for ($i=0; $i<$this->_row; $i++) {
159
+			$max=\min($colIndex, $rows[$i]->count());
160
+			for ($j=0; $j<$max; $j++) {
161
+				$rowspan=$rows[$i]->getItem($j)->getRowspan();
162
+				if ($rowspan+$i>$this->_row)
163
+					$pos++;
164 164
 			}
165 165
 		}
166
-		if ($pos > $colIndex)
166
+		if ($pos>$colIndex)
167 167
 			return NULL;
168
-		$count = $this->count();
169
-		for ($i = 0; $i < $count; $i ++) {
170
-			$pos += $this->content[$i]->getColspan();
171
-			if ($pos >= $colIndex + 1)
168
+		$count=$this->count();
169
+		for ($i=0; $i<$count; $i++) {
170
+			$pos+=$this->content[$i]->getColspan();
171
+			if ($pos>=$colIndex+1)
172 172
 				return $i;
173 173
 		}
174 174
 		return null;
175 175
 	}
176 176
 
177 177
 	public function conditionalCellFormat($callback, $format) {
178
-		$cells = $this->content;
178
+		$cells=$this->content;
179 179
 		foreach ($cells as $cell) {
180 180
 			$cell->conditionalCellFormat($callback, $format);
181 181
 		}
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	}
191 191
 
192 192
 	public function containsStr($needle) {
193
-		$cells = $this->content;
193
+		$cells=$this->content;
194 194
 		foreach ($cells as $cell) {
195
-			if (\strpos($cell->getContent(), $needle) !== false)
195
+			if (\strpos($cell->getContent(), $needle)!==false)
196 196
 				return true;
197 197
 		}
198 198
 		return false;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	}
205 205
 
206 206
 	public function applyCells($callback) {
207
-		$cells = $this->content;
207
+		$cells=$this->content;
208 208
 		foreach ($cells as $cell) {
209 209
 			$cell->apply($callback);
210 210
 		}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	public function toRowspanned($colIndex) {
220
-		$cell = $this->getItem($colIndex);
220
+		$cell=$this->getItem($colIndex);
221 221
 		$cell->addClass('rowspanned');
222 222
 		$cell->setContent('');
223 223
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @author jc
16 16
  *
17 17
  */
18
-trait FormTrait{
18
+trait FormTrait {
19 19
 
20 20
 	/**
21 21
 	 * @return HtmlForm
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
 	abstract protected function getForm();
24 24
 	
25 25
 
26
-	protected function addCompoValidation(Form $compo,HtmlFormField $field){
26
+	protected function addCompoValidation(Form $compo, HtmlFormField $field) {
27 27
 		$validation=$field->getValidation();
28
-		if(isset($validation)){
28
+		if (isset($validation)) {
29 29
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
30 30
 			$compo->addFieldValidation($validation);
31 31
 		}
32 32
 	}
33 33
 	
34
-	protected function addExtraCompoValidation(Form $compo,FieldValidation $validation){
34
+	protected function addExtraCompoValidation(Form $compo, FieldValidation $validation) {
35 35
 		$compo->addFieldValidation($validation);
36 36
 	}
37 37
 
38
-	protected function _runValidationParams(Form &$compo,JsUtils $js=NULL){
38
+	protected function _runValidationParams(Form&$compo, JsUtils $js=NULL) {
39 39
 		$form=$this->getForm();
40 40
 		$params=$form->getValidationParams();
41
-		if(isset($params["_ajaxSubmit"])){
42
-			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js);
41
+		if (isset($params["_ajaxSubmit"])) {
42
+			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js);
43 43
 			$this->onSuccess($compilation);
44 44
 			$form->removeValidationParam("_ajaxSubmit");
45 45
 		}
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 		$form->addEventsOnRun($js);
49 49
 	}
50 50
 
51
-	protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){
51
+	protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) {
52 52
 		$compilation="";
53
-		if(\is_array($ajaxSubmit)){
54
-			foreach ($ajaxSubmit as $ajaxSubmitItem){
53
+		if (\is_array($ajaxSubmit)) {
54
+			foreach ($ajaxSubmit as $ajaxSubmitItem) {
55 55
 				$compilation.=$ajaxSubmitItem->compile($js);
56 56
 			}
57
-		}elseif($ajaxSubmit instanceof AjaxCall){
57
+		}elseif ($ajaxSubmit instanceof AjaxCall) {
58 58
 			$compilation=$ajaxSubmit->compile($js);
59 59
 		}
60
-		$compilation=str_ireplace("\"","%quote%", $compilation);
60
+		$compilation=str_ireplace("\"", "%quote%", $compilation);
61 61
 		return $compilation;
62 62
 	}
63 63
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 		return $this;
71 71
 	}
72 72
 
73
-	public function setAttached($value=true){
73
+	public function setAttached($value=true) {
74 74
 		$form=$this->getForm();
75
-		if($value)
76
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
75
+		if ($value)
76
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
77 77
 		return $form;
78 78
 	}
79 79
 
80
-	public function addErrorMessage(){
80
+	public function addErrorMessage() {
81 81
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
82 82
 	}
83 83
 
@@ -93,48 +93,48 @@  discard block
 block discarded – undo
93 93
 	 * @param array $parameters
94 94
 	 * @return HtmlForm
95 95
 	 */
96
-	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
96
+	public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) {
97 97
 		$form=$this->getForm();
98
-		if($identifierOrElement  instanceof BaseHtml)
98
+		if ($identifierOrElement  instanceof BaseHtml)
99 99
 			$elem=$identifierOrElement;
100 100
 		else
101 101
 			$elem=$form->getElementById($identifierOrElement, $form->getContent());
102
-		if(isset($elem)){
103
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
102
+		if (isset($elem)) {
103
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters);
104 104
 		}
105 105
 		return $form;
106 106
 	}
107 107
 
108
-	public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
109
-		return $this->submitOn("click", $identifier, $url, $responseElement,$parameters);
108
+	public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) {
109
+		return $this->submitOn("click", $identifier, $url, $responseElement, $parameters);
110 110
 	}
111 111
 
112
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
113
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
114
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters);
112
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
113
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
114
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters);
115 115
 	}
116 116
 
117
-	protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){
117
+	protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
118 118
 		$form=$this->getForm();
119
-		if(isset($url) && isset($responseElement)){
120
-			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
121
-			$this->setSubmitParams($url,$responseElement,$parameters);
119
+		if (isset($url) && isset($responseElement)) {
120
+			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true);
121
+			$this->setSubmitParams($url, $responseElement, $parameters);
122 122
 		}
123 123
 		return $button;
124 124
 	}
125 125
 
126
-	public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){
126
+	public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) {
127 127
 		$form=$this->getForm();
128
-		$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
129
-		if(\is_array($parameters)){
130
-			$params=\array_merge($params,$parameters);
128
+		$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true];
129
+		if (\is_array($parameters)) {
130
+			$params=\array_merge($params, $parameters);
131 131
 		}
132 132
 		$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
133 133
 		return $this;
134 134
 	}
135 135
 
136
-	public function addReset($identifier,$value,$cssStyle=NULL){
137
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
136
+	public function addReset($identifier, $value, $cssStyle=NULL) {
137
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
138 138
 		$bt->setProperty("type", "reset");
139 139
 		return $bt;
140 140
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param string $jsCode
145 145
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
146 146
 	 */
147
-	public function onValid($jsCode){
147
+	public function onValid($jsCode) {
148 148
 		$form=$this->getForm();
149 149
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
150 150
 		return $form;
@@ -155,35 +155,35 @@  discard block
 block discarded – undo
155 155
 	 * @param string $jsCode can use event and fields parameters
156 156
 	 * @return HtmlForm
157 157
 	 */
158
-	public function onSuccess($jsCode){
158
+	public function onSuccess($jsCode) {
159 159
 		$form=$this->getForm();
160
-		$form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%");
160
+		$form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%");
161 161
 		return $form;
162 162
 	}
163 163
 	
164
-	public function addExtraFieldRules($fieldname,$rules){
164
+	public function addExtraFieldRules($fieldname, $rules) {
165 165
 		$form=$this->getForm();
166 166
 		$fv=$form->getExtraFieldValidation($fieldname);
167
-		foreach ($rules as $rule){
167
+		foreach ($rules as $rule) {
168 168
 			$fv->addRule($rule);
169 169
 		}
170 170
 	}
171 171
 	
172
-	public function addExtraFieldRule($fieldname,$type,$prompt=NULL,$value=NULL){
172
+	public function addExtraFieldRule($fieldname, $type, $prompt=NULL, $value=NULL) {
173 173
 		$form=$this->getForm();
174 174
 		$fv=$form->getExtraFieldValidation($fieldname);
175
-		$fv->addRule($type,$prompt,$value);
175
+		$fv->addRule($type, $prompt, $value);
176 176
 	}
177 177
 	
178
-	public function setOptional($fieldname,$optional=true){
178
+	public function setOptional($fieldname, $optional=true) {
179 179
 		$form=$this->getForm();
180 180
 		$fv=$form->getExtraFieldValidation($fieldname);
181 181
 		$fv->setOptional($optional);
182 182
 	}
183 183
 
184
-	public function setActionTarget(string $action, string $target){
184
+	public function setActionTarget(string $action, string $target) {
185 185
 		$form=$this->getForm();
186
-		$form->setProperty('data-target',$target);
187
-		$form->setProperty('action',$action);
186
+		$form->setProperty('data-target', $target);
187
+		$form->setProperty('action', $action);
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @return HtmlMenu
42 42
 	 */
43 43
 	public function setType($type="") {
44
-		return $this->addToPropertyCtrl("class", $type, array ("","item","text" ));
44
+		return $this->addToPropertyCtrl("class", $type, array("", "item", "text"));
45 45
 	}
46 46
 
47 47
 	public function setActiveItem($index) {
48 48
 		$item=$this->getItem($index);
49
-		if ($item !== null) {
49
+		if ($item!==null) {
50 50
 			$item->addToProperty("class", "active");
51 51
 		}
52 52
 		return $this;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	private function getItemToInsert($item) {
56 56
 		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) {
57
-			$itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item);
57
+			$itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item);
58 58
 			$itemO->addClass("no-active");
59 59
 			$item=$itemO;
60 60
 		}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 	private function afterInsert($item) {
65 65
 		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
66
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
66
+			$item->addToPropertyCtrl("class", "item", array("item"));
67 67
 		else {
68 68
 			$this->setSecondary();
69 69
 		}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function addItem($item) {
80 80
 		$number=$item;
81 81
 		$item=parent::addItem($this->getItemToInsert($item));
82
-		if(\is_int($number))
82
+		if (\is_int($number))
83 83
 			$item->setProperty("data-page", $number);
84 84
 		return $this->afterInsert($item);
85 85
 	}
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 
98 98
 	public function generateMenuAsItem($menu, $header=null) {
99 99
 		$count=$this->count();
100
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
100
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
101 101
 		if (isset($header)) {
102
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
102
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
103 103
 			$headerItem->setContent($header);
104 104
 			$item->addContent($headerItem);
105 105
 			$this->_itemHeader=$headerItem;
106 106
 		}
107
-		if(\is_array($menu)){
108
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
107
+		if (\is_array($menu)) {
108
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
109 109
 		}
110 110
 		$menu->setClass("menu");
111 111
 		$item->addContent($menu);
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	 * @param String|HtmlDoubleElement $caption
118 118
 	 * @return \Ajax\common\html\HtmlDoubleElement
119 119
 	 */
120
-	public function addHeader($caption){
121
-		if(!($caption instanceof HtmlDoubleElement)){
122
-			$header=new HtmlDoubleElement('','div');
120
+	public function addHeader($caption) {
121
+		if (!($caption instanceof HtmlDoubleElement)) {
122
+			$header=new HtmlDoubleElement('', 'div');
123 123
 			$header->setContent($caption);
124
-		}else{
124
+		} else {
125 125
 			$header=$caption;
126 126
 		}
127 127
 		$header->addClass('item header');
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
138 138
 		$value->addContent(new HtmlIcon("", "dropdown"));
139 139
 		$value=$this->addItem($value);
140
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
140
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
141 141
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
142 142
 		$this->wrap("", $popup);
143 143
 		return $popup;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	public function addDropdownAsItem($value, $items=NULL) {
147 147
 		$dd=$value;
148 148
 		if (\is_string($value)) {
149
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
149
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
150 150
 		}
151 151
 		$this->addItem($dd);
152 152
 		return $dd;
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
 	 * @see HtmlCollection::createItem()
160 160
 	 */
161 161
 	protected function createItem($value) {
162
-		$itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),"");
162
+		$itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), "");
163 163
 		$itemO->setTagName("a");
164 164
 		$itemO->setContent($value);
165 165
 		return $itemO;
166 166
 	}
167 167
 
168 168
 	public function setSecondary($value=true) {
169
-		if($value)
169
+		if ($value)
170 170
 			$this->addToProperty("class", "secondary");
171 171
 		else
172 172
 			$this->removePropertyValue("class", "secondary");
@@ -174,28 +174,28 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 
176 176
 	public function setVertical() {
177
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
177
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
178 178
 	}
179 179
 
180 180
 	public function setPosition($value="right") {
181
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
181
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
182 182
 	}
183 183
 
184 184
 	public function setPointing($value=Direction::NONE) {
185
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
185
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
186 186
 	}
187 187
 
188 188
 	public function asTab($vertical=false) {
189
-		$this->apply(function (HtmlDoubleElement &$item) {
189
+		$this->apply(function(HtmlDoubleElement&$item) {
190 190
 			$item->setTagName("a");
191 191
 		});
192
-		if ($vertical === true)
192
+		if ($vertical===true)
193 193
 			$this->setVertical();
194 194
 		return $this->addToProperty("class", "tabular");
195 195
 	}
196 196
 
197 197
 	public function asPagination() {
198
-		$this->apply(function (HtmlDoubleElement &$item) {
198
+		$this->apply(function(HtmlDoubleElement&$item) {
199 199
 			$item->setTagName("a");
200 200
 		});
201 201
 		return $this->addToProperty("class", "pagination");
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public function setWidth($width) {
234 234
 		if (\is_int($width)) {
235
-			$width=Wide::getConstants()["W" . $width];
235
+			$width=Wide::getConstants()["W".$width];
236 236
 		}
237 237
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
238
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
238
+		return $this->addToPropertyCtrl("class", "item", array("item"));
239 239
 	}
240 240
 
241 241
 	public function addImage($identifier, $src="", $alt="") {
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 		return $this->_itemHeader;
251 251
 	}
252 252
 
253
-	public function setHasContainer(){
254
-		return $this->wrapContent("<div class='ui container'>","</div>");
253
+	public function setHasContainer() {
254
+		return $this->wrapContent("<div class='ui container'>", "</div>");
255 255
 	}
256 256
 
257
-	public function run(JsUtils $js){
258
-		if($this->identifier!=="" && !isset($this->_bsComponent))
259
-			$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false);
260
-		$result= parent::run($js);
257
+	public function run(JsUtils $js) {
258
+		if ($this->identifier!=="" && !isset($this->_bsComponent))
259
+			$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}', false, false);
260
+		$result=parent::run($js);
261 261
 		return $result->setItemSelector(">.item:not(.header)");
262 262
 	}
263 263
 }
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/Rule.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version 1.001
9 9
  * Generates a JSON Rule for the validation of a field
10 10
  */
11
-class Rule implements \JsonSerializable{
11
+class Rule implements \JsonSerializable {
12 12
 	/**
13 13
 	 * @var string
14 14
 	 */
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	private $value;
25 25
 
26
-	public function __construct($type,$prompt=NULL,$value=NULL){
26
+	public function __construct($type, $prompt=NULL, $value=NULL) {
27 27
 		$this->type=$type;
28 28
 		$this->prompt=$prompt;
29 29
 		$this->value=$value;
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 
59 59
 	#[\ReturnTypeWillChange]
60 60
 	public function jsonSerialize() {
61
-		$result= ["type"=>$this->type];
62
-		if(isset($this->prompt))
61
+		$result=["type"=>$this->type];
62
+		if (isset($this->prompt))
63 63
 			$result["prompt"]=$this->prompt;
64
-		if(isset($this->value))
64
+		if (isset($this->value))
65 65
 			$result["value"]=$this->value;
66 66
 		return $result;
67 67
 	}
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param string $prompt
73 73
 	 * @return \Ajax\semantic\components\validation\Rule
74 74
 	 */
75
-	public static function match($name,$prompt=NULL){
76
-		return new Rule("match[".$name."]",$prompt);
75
+	public static function match($name, $prompt=NULL){
76
+		return new Rule("match[".$name."]", $prompt);
77 77
 	}
78 78
 
79 79
 	/**
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @param string $prompt
83 83
 	 * @return \Ajax\semantic\components\validation\Rule
84 84
 	 */
85
-	public static function different($name,$prompt=NULL){
86
-		return new Rule("different[".$name."]",$prompt);
85
+	public static function different($name, $prompt=NULL) {
86
+		return new Rule("different[".$name."]", $prompt);
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,82 +93,82 @@  discard block
 block discarded – undo
93 93
 	 * @param string $prompt
94 94
 	 * @return \Ajax\semantic\components\validation\Rule
95 95
 	 */
96
-	public static function integer($min=NULL,$max=NULL,$prompt=NULL){
97
-		if(\is_int($min) && \is_int($max))
98
-			return new Rule("integer[{$min}..{$max}]",$prompt);
99
-		return new Rule("integer",$prompt);
96
+	public static function integer($min=NULL, $max=NULL, $prompt=NULL) {
97
+		if (\is_int($min) && \is_int($max))
98
+			return new Rule("integer[{$min}..{$max}]", $prompt);
99
+		return new Rule("integer", $prompt);
100 100
 	}
101 101
 
102
-	public static function decimal($prompt=NULL){
103
-		return new Rule("decimal",$prompt);
102
+	public static function decimal($prompt=NULL) {
103
+		return new Rule("decimal", $prompt);
104 104
 	}
105 105
 
106
-	public static function number($prompt=NULL){
107
-		return new Rule("number",$prompt);
106
+	public static function number($prompt=NULL) {
107
+		return new Rule("number", $prompt);
108 108
 	}
109 109
 
110
-	public static function is($value,$prompt=NULL){
111
-		return new Rule("is[".$value."]",$prompt);
110
+	public static function is($value, $prompt=NULL) {
111
+		return new Rule("is[".$value."]", $prompt);
112 112
 	}
113 113
 
114
-	public static function isExactly($value,$prompt=NULL){
115
-		return new Rule("isExactly[".$value."]",$prompt);
114
+	public static function isExactly($value, $prompt=NULL) {
115
+		return new Rule("isExactly[".$value."]", $prompt);
116 116
 	}
117 117
 
118
-	public static function not($value,$prompt=NULL){
119
-		return new Rule("not[".$value."]",$prompt);
118
+	public static function not($value, $prompt=NULL) {
119
+		return new Rule("not[".$value."]", $prompt);
120 120
 	}
121 121
 
122
-	public static function notExactly($value,$prompt=NULL){
123
-		return new Rule("notExactly[".$value."]",$prompt);
122
+	public static function notExactly($value, $prompt=NULL) {
123
+		return new Rule("notExactly[".$value."]", $prompt);
124 124
 	}
125 125
 
126
-	public static function contains($value,$prompt=NULL){
127
-		return new Rule("contains[".$value."]",$prompt);
126
+	public static function contains($value, $prompt=NULL) {
127
+		return new Rule("contains[".$value."]", $prompt);
128 128
 	}
129 129
 
130
-	public static function containsExactly($value,$prompt=NULL){
131
-		return new Rule("containsExactly[".$value."]",$prompt);
130
+	public static function containsExactly($value, $prompt=NULL) {
131
+		return new Rule("containsExactly[".$value."]", $prompt);
132 132
 	}
133 133
 
134
-	public static function doesntContain($value,$prompt=NULL){
135
-		return new Rule("doesntContain[".$value."]",$prompt);
134
+	public static function doesntContain($value, $prompt=NULL) {
135
+		return new Rule("doesntContain[".$value."]", $prompt);
136 136
 	}
137 137
 
138
-	public static function doesntContainExactly($value,$prompt=NULL){
139
-		return new Rule("doesntContainExactly[".$value."]",$prompt);
138
+	public static function doesntContainExactly($value, $prompt=NULL) {
139
+		return new Rule("doesntContainExactly[".$value."]", $prompt);
140 140
 	}
141 141
 
142
-	public static function minCount($value,$prompt=NULL){
143
-		return new Rule("minCount[".$value."]",$prompt);
142
+	public static function minCount($value, $prompt=NULL) {
143
+		return new Rule("minCount[".$value."]", $prompt);
144 144
 	}
145 145
 
146
-	public static function maxCount($value,$prompt=NULL){
147
-		return new Rule("maxCount[".$value."]",$prompt);
146
+	public static function maxCount($value, $prompt=NULL) {
147
+		return new Rule("maxCount[".$value."]", $prompt);
148 148
 	}
149 149
 
150
-	public static function exactCount($value,$prompt=NULL){
151
-		return new Rule("exactCount[".$value."]",$prompt);
150
+	public static function exactCount($value, $prompt=NULL) {
151
+		return new Rule("exactCount[".$value."]", $prompt);
152 152
 	}
153 153
 
154
-	public static function email($prompt=NULL){
155
-		return new Rule("email",$prompt);
154
+	public static function email($prompt=NULL) {
155
+		return new Rule("email", $prompt);
156 156
 	}
157 157
 
158
-	public static function url($prompt=NULL){
159
-		return new Rule("url",$prompt);
158
+	public static function url($prompt=NULL) {
159
+		return new Rule("url", $prompt);
160 160
 	}
161 161
 
162
-	public static function regExp($value,$prompt=NULL){
163
-		return new Rule("regExp",$prompt,$value);
162
+	public static function regExp($value, $prompt=NULL) {
163
+		return new Rule("regExp", $prompt, $value);
164 164
 	}
165 165
 
166
-	public static function custom($name,$jsFunction){
167
-		return "$.fn.form.settings.rules.".$name." =".$jsFunction ;
166
+	public static function custom($name, $jsFunction) {
167
+		return "$.fn.form.settings.rules.".$name." =".$jsFunction;
168 168
 	}
169 169
 
170
-	public static function ajax(JsUtils $js,$name,$url,$params,$jsCallback,$method="post",$parameters=[]){
171
-		$parameters=\array_merge(["async"=>false,"url"=>$url,"params"=>$params,"hasLoader"=>false,"jsCallback"=>$jsCallback,"dataType"=>"json","stopPropagation"=>false,"preventDefault"=>false,"responseElement"=>null],$parameters);
170
+	public static function ajax(JsUtils $js, $name, $url, $params, $jsCallback, $method="post", $parameters=[]) {
171
+		$parameters=\array_merge(["async"=>false, "url"=>$url, "params"=>$params, "hasLoader"=>false, "jsCallback"=>$jsCallback, "dataType"=>"json", "stopPropagation"=>false, "preventDefault"=>false, "responseElement"=>null], $parameters);
172 172
 		$ajax=new AjaxCall($method, $parameters);
173 173
 		return self::custom($name, "function(value,ruleValue){var result=true;".$ajax->compile($js)."return result;}");
174 174
 	}
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\common\html\traits\BaseHooksTrait;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait,BaseHooksTrait;
23
+	use FieldAsTrait, FormTrait, BaseHooksTrait;
24 24
 
25 25
 	/**
26 26
 	 *
@@ -66,25 +66,25 @@  discard block
 block discarded – undo
66 66
 
67 67
 	protected $_hasRules;
68 68
 	
69
-	public function __construct($identifier, $model, $modelInstance = NULL) {
69
+	public function __construct($identifier, $model, $modelInstance=NULL) {
70 70
 		parent::__construct($identifier);
71
-		$this->_template = "%wrapContentBefore%%content%%wrapContentAfter%";
71
+		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
72 72
 		$this->setModel($model);
73 73
 		if (isset($modelInstance)) {
74 74
 			$this->_model=get_class($modelInstance);
75 75
 			$this->show($modelInstance);
76 76
 		}
77
-		$this->_generated = false;
77
+		$this->_generated=false;
78 78
 	}
79 79
 
80 80
 	protected function _init($instanceViewer, $contentKey, $content, $edition) {
81
-		$this->_instanceViewer = $instanceViewer;
82
-		$this->content = [
81
+		$this->_instanceViewer=$instanceViewer;
82
+		$this->content=[
83 83
 			$contentKey => $content
84 84
 		];
85
-		$this->_self = $content;
86
-		$this->_toolbarPosition = PositionInTable::BEFORETABLE;
87
-		$this->_edition = $edition;
85
+		$this->_self=$content;
86
+		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
87
+		$this->_edition=$edition;
88 88
 	}
89 89
 
90 90
 	/**
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
 	 * @return int|string|boolean
94 94
 	 */
95 95
 	protected function _getIndex($fieldName) {
96
-		$index = $fieldName;
96
+		$index=$fieldName;
97 97
 		if (\is_string($fieldName)) {
98
-			$fields = $this->_instanceViewer->getVisibleProperties();
99
-			$index = \array_search($fieldName, $fields);
98
+			$fields=$this->_instanceViewer->getVisibleProperties();
99
+			$index=\array_search($fieldName, $fields);
100 100
 		}
101 101
 		return $index;
102 102
 	}
103 103
 
104
-	protected function _getFieldIdentifier($prefix, $name = "") {
105
-		return $this->identifier . "-{$prefix}-" . $this->_instanceViewer->getIdentifier();
104
+	protected function _getFieldIdentifier($prefix, $name="") {
105
+		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
106 106
 	}
107 107
 
108 108
 	protected function _getFieldName($index) {
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 		return $this->_instanceViewer->getCaption($index);
114 114
 	}
115 115
 
116
-	abstract protected function _setToolbarPosition($table, $captions = NULL);
116
+	abstract protected function _setToolbarPosition($table, $captions=NULL);
117 117
 
118 118
 	public function show($modelInstance) {
119 119
 		if (\is_array($modelInstance)) {
120
-			$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
120
+			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
121 121
 		}
122
-		$this->_modelInstance = $modelInstance;
122
+		$this->_modelInstance=$modelInstance;
123 123
 	}
124 124
 
125 125
 	public function getModel() {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	public function setModel($_model) {
130
-		$this->_model = $_model;
130
+		$this->_model=$_model;
131 131
 		return $this;
132 132
 	}
133 133
 
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 	}
137 137
 
138 138
 	public function setInstanceViewer($_instanceViewer) {
139
-		$this->_instanceViewer = $_instanceViewer;
139
+		$this->_instanceViewer=$_instanceViewer;
140 140
 		return $this;
141 141
 	}
142 142
 
143 143
 	abstract public function getHtmlComponent();
144 144
 
145
-	public function setAttached($value = true) {
145
+	public function setAttached($value=true) {
146 146
 		return $this->getHtmlComponent()->setAttached($value);
147 147
 	}
148 148
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * @return Widget
158 158
 	 */
159 159
 	public function afterCompile($index, $callback) {
160
-		$index = $this->_getIndex($index);
161
-		if ($index !== false) {
160
+		$index=$this->_getIndex($index);
161
+		if ($index!==false) {
162 162
 			$this->_instanceViewer->afterCompile($index, $callback);
163 163
 		}
164 164
 		return $this;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		return $this;
184 184
 	}
185 185
 
186
-	public function addField($field, $key = null) {
186
+	public function addField($field, $key=null) {
187 187
 		$this->_instanceViewer->addField($field, $key);
188 188
 		return $this;
189 189
 	}
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 		return $this->_instanceViewer->visiblePropertiesCount();
198 198
 	}
199 199
 
200
-	public function addMessage($attributes = NULL, $fieldName = "message") {
200
+	public function addMessage($attributes=NULL, $fieldName="message") {
201 201
 		$this->_instanceViewer->addField($fieldName);
202
-		$count = $this->_instanceViewer->visiblePropertiesCount();
203
-		return $this->fieldAsMessage($count - 1, $attributes);
202
+		$count=$this->_instanceViewer->visiblePropertiesCount();
203
+		return $this->fieldAsMessage($count-1, $attributes);
204 204
 	}
205 205
 
206 206
 	public function addErrorMessage() {
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 		], "message");
210 210
 	}
211 211
 
212
-	public function insertField($index, $field, $key = null) {
213
-		$index = $this->_getIndex($index);
212
+	public function insertField($index, $field, $key=null) {
213
+		$index=$this->_getIndex($index);
214 214
 		$this->_instanceViewer->insertField($index, $field, $key);
215 215
 		return $this;
216 216
 	}
217 217
 
218
-	public function insertInField($index, $field, $key = null) {
219
-		$index = $this->_getIndex($index);
220
-		if ($index !== false) {
218
+	public function insertInField($index, $field, $key=null) {
219
+		$index=$this->_getIndex($index);
220
+		if ($index!==false) {
221 221
 			$this->_instanceViewer->insertInField($index, $field, $key);
222 222
 		}
223 223
 		return $this;
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @return Widget
234 234
 	 */
235 235
 	public function setValueFunction($index, $callback) {
236
-		$index = $this->_getIndex($index);
237
-		if ($index !== false) {
236
+		$index=$this->_getIndex($index);
237
+		if ($index!==false) {
238 238
 			$this->_instanceViewer->setValueFunction($index, $callback);
239 239
 		}
240 240
 		return $this;
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
251 251
 	 */
252 252
 	public function getToolbar() {
253
-		if (isset($this->_toolbar) === false) {
254
-			$this->_toolbar = new HtmlMenu("toolbar-" . $this->identifier);
253
+		if (isset($this->_toolbar)===false) {
254
+			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
255 255
 		}
256 256
 		return $this->_toolbar;
257 257
 	}
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 	 *        	function to call on $element
265 265
 	 * @return \Ajax\common\html\HtmlDoubleElement
266 266
 	 */
267
-	public function addInToolbar($element, $callback = NULL) {
268
-		$tb = $this->getToolbar();
267
+	public function addInToolbar($element, $callback=NULL) {
268
+		$tb=$this->getToolbar();
269 269
 		if ($element instanceof BaseWidget) {
270
-			if ($element->getIdentifier() === "") {
271
-				$element->setIdentifier("tb-item-" . $this->identifier . "-" . $tb->count());
270
+			if ($element->getIdentifier()==="") {
271
+				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
272 272
 			}
273 273
 		}
274 274
 		if (isset($callback)) {
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 *        	function($element)
288 288
 	 * @return \Ajax\common\html\HtmlDoubleElement
289 289
 	 */
290
-	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
291
-		$result = $this->addInToolbar($caption, $callback);
290
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
291
+		$result=$this->addInToolbar($caption, $callback);
292 292
 		if (isset($icon) && method_exists($result, "addIcon"))
293 293
 			$result->addIcon($icon);
294 294
 		return $result;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 *        	function($element)
302 302
 	 * @return \Ajax\common\Widget
303 303
 	 */
304
-	public function addItemsInToolbar(array $items, $callback = NULL) {
304
+	public function addItemsInToolbar(array $items, $callback=NULL) {
305 305
 		if (JArray::isAssociative($items)) {
306 306
 			foreach ($items as $icon => $item) {
307 307
 				$this->addItemInToolbar($item, $icon, $callback);
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 	 *        	function($element)
323 323
 	 * @return \Ajax\common\html\HtmlDoubleElement
324 324
 	 */
325
-	public function addDropdownInToolbar($value, $items, $callback = NULL) {
326
-		$dd = $value;
325
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
326
+		$dd=$value;
327 327
 		if (\is_string($value)) {
328
-			$dd = new HtmlDropdown("dropdown-" . $this->identifier . "-" . $value, $value, $items);
328
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
329 329
 		}
330 330
 		return $this->addInToolbar($dd, $callback);
331 331
 	}
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 	 *        	function($element)
339 339
 	 * @return \Ajax\common\html\HtmlDoubleElement
340 340
 	 */
341
-	public function addButtonInToolbar($caption, $cssStyle = null, $callback = NULL) {
342
-		$bt = new HtmlButton("bt-" . $caption, $caption, $cssStyle);
341
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
342
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
343 343
 		return $this->addInToolbar($bt, $callback);
344 344
 	}
345 345
 
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 	 *        	function($element)
352 352
 	 * @return \Ajax\common\html\HtmlDoubleElement
353 353
 	 */
354
-	public function addButtonsInToolbar(array $captions, $asIcon = false, $callback = NULL) {
355
-		$bts = new HtmlButtonGroups("", $captions, $asIcon);
354
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
355
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
356 356
 		return $this->addInToolbar($bts, $callback);
357 357
 	}
358 358
 
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
 	 * @param boolean $labeled
365 365
 	 * @return \Ajax\common\html\HtmlDoubleElement
366 366
 	 */
367
-	public function addLabelledIconButtonInToolbar($caption, $icon, $before = true, $labeled = false) {
368
-		$bt = new HtmlButton("", $caption);
367
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
368
+		$bt=new HtmlButton("", $caption);
369 369
 		$bt->addIcon($icon, $before, $labeled);
370 370
 		return $this->addInToolbar($bt);
371 371
 	}
372 372
 
373
-	public function addSubmitInToolbar($identifier, $value, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $parameters = NULL) {
374
-		$button = new HtmlButton($identifier, $value, $cssStyle);
373
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
374
+		$button=new HtmlButton($identifier, $value, $cssStyle);
375 375
 		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
376 376
 		return $this->addInToolbar($button);
377 377
 	}
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param boolean $_edition
395 395
 	 * @return \Ajax\common\Widget
396 396
 	 */
397
-	public function setEdition($_edition = true) {
398
-		$this->_edition = $_edition;
397
+	public function setEdition($_edition=true) {
398
+		$this->_edition=$_edition;
399 399
 		return $this;
400 400
 	}
401 401
 
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	 * @param string|boolean $disable
425 425
 	 * @return string
426 426
 	 */
427
-	public function jsDisabled($disable = true) {
428
-		return "$('#" . $this->identifier . " .ui.input,#" . $this->identifier . " .ui.dropdown,#" . $this->identifier . " .ui.checkbox').toggleClass('disabled'," . $disable . ");";
427
+	public function jsDisabled($disable=true) {
428
+		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
429 429
 	}
430 430
 
431 431
 	/**
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 	 *        	function($element)
436 436
 	 * @return \Ajax\common\html\HtmlDoubleElement
437 437
 	 */
438
-	public function addEditButtonInToolbar($caption, $callback = NULL) {
439
-		$bt = new HtmlButton($this->identifier . "-editBtn", $caption);
438
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
439
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
440 440
 		$bt->setToggle();
441 441
 		$bt->setActive($this->_edition);
442 442
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
@@ -444,18 +444,18 @@  discard block
 block discarded – undo
444 444
 	}
445 445
 
446 446
 	public function setToolbar(HtmlMenu $_toolbar) {
447
-		$this->_toolbar = $_toolbar;
447
+		$this->_toolbar=$_toolbar;
448 448
 		return $this;
449 449
 	}
450 450
 
451 451
 	public function setToolbarPosition($_toolbarPosition) {
452
-		$this->_toolbarPosition = $_toolbarPosition;
452
+		$this->_toolbarPosition=$_toolbarPosition;
453 453
 		return $this;
454 454
 	}
455 455
 
456 456
 	public function getForm() {
457
-		if (! isset($this->_form)) {
458
-			$this->_form = new HtmlForm("frm-" . $this->identifier);
457
+		if (!isset($this->_form)) {
458
+			$this->_form=new HtmlForm("frm-".$this->identifier);
459 459
 			$this->setEdition(true);
460 460
 		}
461 461
 		return $this->_form;
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	}
470 470
 
471 471
 	protected function runForm(JsUtils $js) {
472
-		$fields = $this->getContentInstances(HtmlFormField::class);
472
+		$fields=$this->getContentInstances(HtmlFormField::class);
473 473
 		foreach ($fields as $field) {
474 474
 			$this->_form->addField($field);
475 475
 		}
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 
479 479
 	protected function _compileForm() {
480 480
 		if (isset($this->_form)) {
481
-			$noValidate = "";
482
-			if (\sizeof($this->_form->getValidationParams()) > 0)
483
-				$noValidate = "novalidate";
484
-				$this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
481
+			$noValidate="";
482
+			if (\sizeof($this->_form->getValidationParams())>0)
483
+				$noValidate="novalidate";
484
+				$this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
485 485
 		}
486 486
 	}
487 487
 
@@ -503,21 +503,21 @@  discard block
 block discarded – undo
503 503
 	}
504 504
 
505 505
 	public function swapFields($index1, $index2) {
506
-		$index1 = $this->_getIndex($index1);
507
-		$index2 = $this->_getIndex($index2);
506
+		$index1=$this->_getIndex($index1);
507
+		$index2=$this->_getIndex($index2);
508 508
 		return $this->_instanceViewer->swapFields($index1, $index2);
509 509
 	}
510 510
 
511 511
 	public function removeField($index) {
512
-		$index = $this->_getIndex($index);
513
-		if ($index !== false) {
512
+		$index=$this->_getIndex($index);
513
+		if ($index!==false) {
514 514
 			$this->_instanceViewer->removeField($index);
515 515
 		}
516 516
 		return $this;
517 517
 	}
518 518
 
519
-	public function asModal($header = null) {
520
-		$modal = new HtmlModal("modal-" . $this->identifier, $header);
519
+	public function asModal($header=null) {
520
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
521 521
 		$modal->setContent($this);
522 522
 		if (isset($this->_form)) {
523 523
 			$this->_form->onSuccess($modal->jsHide());
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		return $modal;
526 526
 	}
527 527
 
528
-	public function addToProperty($name, $value, $separator = " ") {
528
+	public function addToProperty($name, $value, $separator=" ") {
529 529
 		return $this->getHtmlComponent()->addToProperty($name, $value, $separator);
530 530
 	}
531 531
 
Please login to merge, or discard this patch.