Completed
Push — master ( 5f7aee...f5f495 )
by Jean-Christophe
03:30
created
Ajax/semantic/widgets/datatable/JsonDataTable.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,24 +23,24 @@  discard block
 block discarded – undo
23 23
 		$this->_rowClass="_json";
24 24
 	}
25 25
 
26
-	protected function _generateContent($table){
26
+	protected function _generateContent($table) {
27 27
 		$this->_addRowModel($table);
28 28
 		parent::_generateContent($table);
29 29
 	}
30 30
 
31
-	protected function _addRowModel($table){
31
+	protected function _addRowModel($table) {
32 32
 		$row=$this->_createRow($table, $this->_modelClass);
33
-		$row->addToProperty("style","display:none;");
33
+		$row->addToProperty("style", "display:none;");
34 34
 		$table->getBody()->_addRow($row);
35 35
 	}
36 36
 
37
-	protected function _createRow($table,$rowClass){
37
+	protected function _createRow($table, $rowClass) {
38 38
 		$object=JReflection::jsonObject($this->_model);
39
-		if(isset($this->_rowModelCallback)){
39
+		if (isset($this->_rowModelCallback)) {
40 40
 			$callback=$this->_rowModelCallback;
41 41
 			$callback($object);
42 42
 		}
43
-		$row=$this->_generateRow($object, $table,"_jsonArrayChecked");
43
+		$row=$this->_generateRow($object, $table, "_jsonArrayChecked");
44 44
 		$row->setClass($rowClass);
45 45
 		return $row;
46 46
 	}
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
 	 * {@inheritDoc}
50 50
 	 * @see DataTable::_associatePaginationBehavior()
51 51
 	 */
52
-	protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){
52
+	protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) {
53 53
 		$callback=null;
54
-		if(isset($js)){
54
+		if (isset($js)) {
55 55
 			$id=$this->identifier;
56 56
 			$offset=$js->scriptCount();
57 57
 			$this->run($js);
58 58
 			$callback=$js->getScript($offset);
59
-			$callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js));
59
+			$callback.=$js->trigger("#".$id." [name='selection[]']", "change", false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js));
60 60
 			$callback.=";var page=parseInt($(self).attr('data-page'));
61 61
 			$('#pagination-{$id} .item').removeClass('active');
62 62
 			$('#pagination-{$id} [data-page='+page+']:not(.no-active)').addClass('active');
63 63
 			$('#pagination-{$id} ._firstPage').attr('data-page',Math.max(1,page-1));
64 64
 			var lastPage=$('#pagination-{$id} ._lastPage');lastPage.attr('data-page',Math.min(lastPage.attr('data-max'),page+1));";
65 65
 		}
66
-		if(isset($this->_urls["refresh"]))
67
-			$this->jsonArrayOnClick($menu, $this->_urls["refresh"],"post","{'p':$(this).attr('data-page')}",$callback);
66
+		if (isset($this->_urls["refresh"]))
67
+			$this->jsonArrayOnClick($menu, $this->_urls["refresh"], "post", "{'p':$(this).attr('data-page')}", $callback);
68 68
 	}
69 69
 
70 70
 	/**
@@ -75,29 +75,29 @@  discard block
 block discarded – undo
75 75
 	 * @param string $jsCallback
76 76
 	 * @return AjaxCall
77 77
 	 */
78
-	public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){
79
-		$parameters=\array_merge($parameters,["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass,"url"=>$url,"method"=>$method,"params"=>$params,"jsCallback"=>$jsCallback]);
78
+	public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) {
79
+		$parameters=\array_merge($parameters, ["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass, "url"=>$url, "method"=>$method, "params"=>$params, "jsCallback"=>$jsCallback]);
80 80
 		return new AjaxCall("jsonArray", $parameters);
81 81
 	}
82 82
 
83
-	public function jsClear(){
83
+	public function jsClear() {
84 84
 		return "$('#{$this->identifier} tbody').find('._json').remove();";
85 85
 	}
86 86
 
87
-	public function clearOn(BaseHtml $element,$event, $stopPropagation=false, $preventDefault=false){
88
-		return $element->addEvent($event, $this->jsClear(),$stopPropagation,$preventDefault);
87
+	public function clearOn(BaseHtml $element, $event, $stopPropagation=false, $preventDefault=false) {
88
+		return $element->addEvent($event, $this->jsClear(), $stopPropagation, $preventDefault);
89 89
 	}
90 90
 
91
-	public function clearOnClick(BaseHtml $element,$stopPropagation=false, $preventDefault=false){
92
-		return $this->clearOn($element, "click",$stopPropagation,$preventDefault);
91
+	public function clearOnClick(BaseHtml $element, $stopPropagation=false, $preventDefault=false) {
92
+		return $this->clearOn($element, "click", $stopPropagation, $preventDefault);
93 93
 	}
94 94
 
95
-	public function jsonArrayOn(BaseHtml $element,$event,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){
96
-		return $element->_addEvent($event, $this->jsJsonArray($url,$method,$params,$jsCallback,$parameters));
95
+	public function jsonArrayOn(BaseHtml $element, $event, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) {
96
+		return $element->_addEvent($event, $this->jsJsonArray($url, $method, $params, $jsCallback, $parameters));
97 97
 	}
98 98
 
99
-	public function jsonArrayOnClick(BaseHtml $element,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){
100
-		return $this->jsonArrayOn($element, "click", $url,$method,$params,$jsCallback,$parameters);
99
+	public function jsonArrayOnClick(BaseHtml $element, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) {
100
+		return $this->jsonArrayOn($element, "click", $url, $method, $params, $jsCallback, $parameters);
101 101
 	}
102 102
 
103 103
 	/**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
109 109
 	 * @return DataTable
110 110
 	 */
111
-	public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){
112
-		return parent::paginate($page, $total_rowcount,$items_per_page,null);
111
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
112
+		return parent::paginate($page, $total_rowcount, $items_per_page, null);
113 113
 	}
114 114
 
115 115
 	public function setRowModelCallback($_rowModelCallback) {
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\semantic\html\modules\HtmlModal;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait;
23
+	use FieldAsTrait, FormTrait;
24 24
 
25 25
 	/**
26 26
 	 * @var string classname
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	protected $_generated;
54 54
 
55 55
 
56
-	public function __construct($identifier,$model,$modelInstance=NULL) {
56
+	public function __construct($identifier, $model, $modelInstance=NULL) {
57 57
 		parent::__construct($identifier);
58 58
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
59 59
 		$this->setModel($model);
60
-		if(isset($modelInstance)){
60
+		if (isset($modelInstance)) {
61 61
 			$this->show($modelInstance);
62 62
 		}
63 63
 		$this->_generated=false;
64 64
 	}
65 65
 
66
-	protected function _init($instanceViewer,$contentKey,$content,$edition){
66
+	protected function _init($instanceViewer, $contentKey, $content, $edition) {
67 67
 		$this->_instanceViewer=$instanceViewer;
68 68
 		$this->content=[$contentKey=>$content];
69 69
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
@@ -74,31 +74,31 @@  discard block
 block discarded – undo
74 74
 	 * @param int|string $fieldName
75 75
 	 * @return int|string
76 76
 	 */
77
-	protected function _getIndex($fieldName){
77
+	protected function _getIndex($fieldName) {
78 78
 		$index=$fieldName;
79
-		if(\is_string($fieldName)){
79
+		if (\is_string($fieldName)) {
80 80
 			$fields=$this->_instanceViewer->getVisibleProperties();
81 81
 			$index=\array_search($fieldName, $fields);
82 82
 		}
83 83
 		return $index;
84 84
 	}
85 85
 
86
-	protected function _getFieldIdentifier($prefix,$name=""){
86
+	protected function _getFieldIdentifier($prefix, $name="") {
87 87
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
88 88
 	}
89 89
 
90
-	protected function _getFieldName($index){
90
+	protected function _getFieldName($index) {
91 91
 		return $this->_instanceViewer->getFieldName($index);
92 92
 	}
93 93
 
94
-	protected function _getFieldCaption($index){
94
+	protected function _getFieldCaption($index) {
95 95
 		return $this->_instanceViewer->getCaption($index);
96 96
 	}
97 97
 
98
-	abstract protected  function _setToolbarPosition($table,$captions=NULL);
98
+	abstract protected  function _setToolbarPosition($table, $captions=NULL);
99 99
 
100
-	public function show($modelInstance){
101
-		if(\is_array($modelInstance)){
100
+	public function show($modelInstance) {
101
+		if (\is_array($modelInstance)) {
102 102
 			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
103 103
 		}
104 104
 		$this->_modelInstance=$modelInstance;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 	abstract public function getHtmlComponent();
126 126
 
127
-	public function setAttached($value=true){
127
+	public function setAttached($value=true) {
128 128
 		return $this->getHtmlComponent()->setAttached($value);
129 129
 	}
130 130
 
@@ -135,66 +135,66 @@  discard block
 block discarded – undo
135 135
 	 * @param callable $callback function called after the field compilation
136 136
 	 * @return Widget
137 137
 	 */
138
-	public function afterCompile($index,$callback){
138
+	public function afterCompile($index, $callback) {
139 139
 		$index=$this->_getIndex($index);
140 140
 		$this->_instanceViewer->afterCompile($index, $callback);
141 141
 		return $this;
142 142
 	}
143 143
 
144
-	public function setColor($color){
144
+	public function setColor($color) {
145 145
 		return $this->getHtmlComponent()->setColor($color);
146 146
 	}
147 147
 
148 148
 
149
-	public function setCaptions($captions){
149
+	public function setCaptions($captions) {
150 150
 		$this->_instanceViewer->setCaptions($captions);
151 151
 		return $this;
152 152
 	}
153 153
 
154
-	public function setCaption($index,$caption){
154
+	public function setCaption($index, $caption) {
155 155
 		$this->_instanceViewer->setCaption($this->_getIndex($index), $caption);
156 156
 		return $this;
157 157
 	}
158 158
 
159
-	public function setFields($fields){
159
+	public function setFields($fields) {
160 160
 		$this->_instanceViewer->setVisibleProperties($fields);
161 161
 		return $this;
162 162
 	}
163 163
 
164
-	public function addField($field){
164
+	public function addField($field) {
165 165
 		$this->_instanceViewer->addField($field);
166 166
 		return $this;
167 167
 	}
168 168
 
169
-	public function addMessage($attributes=NULL,$fieldName="message"){
169
+	public function addMessage($attributes=NULL, $fieldName="message") {
170 170
 		$this->_instanceViewer->addField($fieldName);
171 171
 		$count=$this->_instanceViewer->visiblePropertiesCount();
172
-		return $this->fieldAsMessage($count-1,$attributes);
172
+		return $this->fieldAsMessage($count-1, $attributes);
173 173
 	}
174 174
 
175
-	public function addErrorMessage(){
176
-		return $this->addMessage(["error"=>true],"message");
175
+	public function addErrorMessage() {
176
+		return $this->addMessage(["error"=>true], "message");
177 177
 	}
178 178
 
179
-	public function insertField($index,$field){
179
+	public function insertField($index, $field) {
180 180
 		$index=$this->_getIndex($index);
181 181
 		$this->_instanceViewer->insertField($index, $field);
182 182
 		return $this;
183 183
 	}
184 184
 
185
-	public function insertInField($index,$field){
185
+	public function insertInField($index, $field) {
186 186
 		$index=$this->_getIndex($index);
187 187
 		$this->_instanceViewer->insertInField($index, $field);
188 188
 		return $this;
189 189
 	}
190 190
 
191
-	public function setValueFunction($index,$callback){
191
+	public function setValueFunction($index, $callback) {
192 192
 		$index=$this->_getIndex($index);
193 193
 		$this->_instanceViewer->setValueFunction($index, $callback);
194 194
 		return $this;
195 195
 	}
196 196
 
197
-	public function setIdentifierFunction($callback){
197
+	public function setIdentifierFunction($callback) {
198 198
 		$this->_instanceViewer->setIdentifierFunction($callback);
199 199
 		return $this;
200 200
 	}
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	/**
203 203
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
204 204
 	 */
205
-	public function getToolbar(){
206
-		if(isset($this->_toolbar)===false){
205
+	public function getToolbar() {
206
+		if (isset($this->_toolbar)===false) {
207 207
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
208 208
 		}
209 209
 		return $this->_toolbar;
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 	 * @param callable $callback function to call on $element
216 216
 	 * @return \Ajax\common\html\HtmlDoubleElement
217 217
 	 */
218
-	public function addInToolbar($element,$callback=NULL){
218
+	public function addInToolbar($element, $callback=NULL) {
219 219
 		$tb=$this->getToolbar();
220
-		if($element instanceof BaseWidget){
221
-			if($element->getIdentifier()===""){
220
+		if ($element instanceof BaseWidget) {
221
+			if ($element->getIdentifier()==="") {
222 222
 				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
223 223
 			}
224 224
 		}
225
-		if(isset($callback)){
226
-			if(\is_callable($callback)){
225
+		if (isset($callback)) {
226
+			if (\is_callable($callback)) {
227 227
 				$callback($element);
228 228
 			}
229 229
 		}
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @param callable $callback function($element)
237 237
 	 * @return \Ajax\common\html\HtmlDoubleElement
238 238
 	 */
239
-	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
240
-		$result=$this->addInToolbar($caption,$callback);
241
-		if(isset($icon))
239
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
240
+		$result=$this->addInToolbar($caption, $callback);
241
+		if (isset($icon))
242 242
 			$result->addIcon($icon);
243 243
 		return $result;
244 244
 	}
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 	 * @param callable $callback function($element)
249 249
 	 * @return \Ajax\common\Widget
250 250
 	 */
251
-	public function addItemsInToolbar(array $items,$callback=NULL){
252
-		if(JArray::isAssociative($items)){
253
-			foreach ($items as $icon=>$item){
254
-				$this->addItemInToolbar($item,$icon,$callback);
251
+	public function addItemsInToolbar(array $items, $callback=NULL) {
252
+		if (JArray::isAssociative($items)) {
253
+			foreach ($items as $icon=>$item) {
254
+				$this->addItemInToolbar($item, $icon, $callback);
255 255
 			}
256
-		}else{
257
-			foreach ($items as $item){
258
-				$this->addItemInToolbar($item,null,$callback);
256
+		} else {
257
+			foreach ($items as $item) {
258
+				$this->addItemInToolbar($item, null, $callback);
259 259
 			}
260 260
 		}
261 261
 		return $this;
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 	 * @param callable $callback function($element)
268 268
 	 * @return \Ajax\common\html\HtmlDoubleElement
269 269
 	 */
270
-	public function addDropdownInToolbar($value,$items,$callback=NULL){
270
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
271 271
 		$dd=$value;
272 272
 		if (\is_string($value)) {
273
-			$dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items);
273
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
274 274
 		}
275
-		return $this->addInToolbar($dd,$callback);
275
+		return $this->addInToolbar($dd, $callback);
276 276
 	}
277 277
 
278 278
 	/**
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 	 * @param callable $callback function($element)
282 282
 	 * @return \Ajax\common\html\HtmlDoubleElement
283 283
 	 */
284
-	public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){
285
-		$bt=new HtmlButton("bt-".$caption,$caption,$cssStyle);
286
-		return $this->addInToolbar($bt,$callback);
284
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
285
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
286
+		return $this->addInToolbar($bt, $callback);
287 287
 	}
288 288
 
289 289
 	/**
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 * @param callable $callback function($element)
293 293
 	 * @return \Ajax\common\html\HtmlDoubleElement
294 294
 	 */
295
-	public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){
296
-		$bts=new HtmlButtonGroups("",$captions,$asIcon);
297
-		return $this->addInToolbar($bts,$callback);
295
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
296
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
297
+		return $this->addInToolbar($bts, $callback);
298 298
 	}
299 299
 
300 300
 	/**
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
 	 * @param boolean $labeled
305 305
 	 * @return \Ajax\common\html\HtmlDoubleElement
306 306
 	 */
307
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
308
-		$bt=new HtmlButton("",$caption);
309
-		$bt->addIcon($icon,$before,$labeled);
307
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
308
+		$bt=new HtmlButton("", $caption);
309
+		$bt->addIcon($icon, $before, $labeled);
310 310
 		return $this->addInToolbar($bt);
311 311
 	}
312 312
 
313
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
314
-		$button=new HtmlButton($identifier,$value,$cssStyle);
315
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters);
313
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
314
+		$button=new HtmlButton($identifier, $value, $cssStyle);
315
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
316 316
 		return $this->addInToolbar($button);
317 317
 	}
318 318
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model
343 343
 	 * @return \Ajax\common\Widget
344 344
 	 */
345
-	public function setDefaultValueFunction($defaultValueFunction){
345
+	public function setDefaultValueFunction($defaultValueFunction) {
346 346
 		$this->_instanceViewer->setDefaultValueFunction($defaultValueFunction);
347 347
 		return $this;
348 348
 	}
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 * @param string|boolean $disable
352 352
 	 * @return string
353 353
 	 */
354
-	public function jsDisabled($disable=true){
354
+	public function jsDisabled($disable=true) {
355 355
 		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
356 356
 	}
357 357
 
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 	 * @param callable $callback function($element)
361 361
 	 * @return \Ajax\common\html\HtmlDoubleElement
362 362
 	 */
363
-	public function addEditButtonInToolbar($caption,$callback=NULL){
364
-		$bt=new HtmlButton($this->identifier."-editBtn",$caption);
363
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
364
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
365 365
 		$bt->setToggle();
366 366
 		$bt->setActive($this->_edition);
367 367
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
368
-		return $this->addInToolbar($bt,$callback);
368
+		return $this->addInToolbar($bt, $callback);
369 369
 	}
370 370
 
371 371
 	public function setToolbar(HtmlMenu $_toolbar) {
@@ -379,35 +379,35 @@  discard block
 block discarded – undo
379 379
 	}
380 380
 
381 381
 	public function getForm() {
382
-		if(!isset($this->_form)){
382
+		if (!isset($this->_form)) {
383 383
 			$this->_form=new HtmlForm("frm-".$this->identifier);
384 384
 			$this->setEdition(true);
385 385
 		}
386 386
 		return $this->_form;
387 387
 	}
388 388
 
389
-	public function run(JsUtils $js){
389
+	public function run(JsUtils $js) {
390 390
 		$result=parent::run($js);
391
-		if(isset($this->_form)){
391
+		if (isset($this->_form)) {
392 392
 			$result=$this->runForm($js);
393 393
 		}
394 394
 		return $result;
395 395
 	}
396 396
 
397
-	protected function runForm(JsUtils $js){
397
+	protected function runForm(JsUtils $js) {
398 398
 		$fields=$this->getContentInstances(HtmlFormField::class);
399
-		foreach ($fields as $field){
399
+		foreach ($fields as $field) {
400 400
 			$this->_form->addField($field);
401 401
 		}
402 402
 		return $this->_form->run($js);
403 403
 	}
404 404
 
405
-	protected function _compileForm(){
406
-		if(isset($this->_form)){
405
+	protected function _compileForm() {
406
+		if (isset($this->_form)) {
407 407
 			$noValidate="";
408
-			if(\sizeof($this->_form->getValidationParams())>0)
408
+			if (\sizeof($this->_form->getValidationParams())>0)
409 409
 				$noValidate="novalidate";
410
-			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
410
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
411 411
 		}
412 412
 	}
413 413
 
@@ -416,26 +416,26 @@  discard block
 block discarded – undo
416 416
 		return $this;
417 417
 	}
418 418
 
419
-	public function moveFieldTo($from,$to){
419
+	public function moveFieldTo($from, $to) {
420 420
 		return $this->_instanceViewer->moveFieldTo($from, $to);
421 421
 	}
422 422
 
423
-	public function swapFields($index1,$index2){
423
+	public function swapFields($index1, $index2) {
424 424
 		$index1=$this->_getIndex($index1);
425 425
 		$index2=$this->_getIndex($index2);
426 426
 		return $this->_instanceViewer->swapFields($index1, $index2);
427 427
 	}
428 428
 
429
-	public function removeField($index){
429
+	public function removeField($index) {
430 430
 		$index=$this->_getIndex($index);
431 431
 		$this->_instanceViewer->removeField($index);
432 432
 		return $this;
433 433
 	}
434 434
 
435
-	public function asModal($header=null){
436
-		$modal=new HtmlModal("modal-".$this->identifier,$header);
435
+	public function asModal($header=null) {
436
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
437 437
 		$modal->setContent($this);
438
-		if(isset($this->_form)){
438
+		if (isset($this->_form)) {
439 439
 			$this->_form->onSuccess($modal->jsHide());
440 440
 		}
441 441
 		return $modal;
Please login to merge, or discard this patch.
Ajax/common/html/HtmlCollection.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -14,44 +14,44 @@  discard block
 block discarded – undo
14 14
  */
15 15
 abstract class HtmlCollection extends HtmlDoubleElement {
16 16
 
17
-	public function __construct($identifier,$tagName="div"){
18
-		parent::__construct($identifier,$tagName);
17
+	public function __construct($identifier, $tagName="div") {
18
+		parent::__construct($identifier, $tagName);
19 19
 		$this->content=array();
20 20
 	}
21 21
 
22
-	public function addItems($items){
23
-		if(JArray::isAssociative($items)){
24
-			foreach ($items as $k=>$v){
25
-				$this->addItem([$k,$v]);
22
+	public function addItems($items) {
23
+		if (JArray::isAssociative($items)) {
24
+			foreach ($items as $k=>$v) {
25
+				$this->addItem([$k, $v]);
26 26
 			}
27
-		}else{
28
-			foreach ($items as $item){
27
+		} else {
28
+			foreach ($items as $item) {
29 29
 				$this->addItem($item);
30 30
 			}
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function setItems($items){
35
+	public function setItems($items) {
36 36
 		$this->content=$items;
37 37
 		return $this;
38 38
 	}
39 39
 
40
-	public function getItems(){
40
+	public function getItems() {
41 41
 		return $this->content;
42 42
 	}
43 43
 
44
-	protected function getItemToAdd($item){
44
+	protected function getItemToAdd($item) {
45 45
 		$itemO=$item;
46
-		if($this->createCondition($item)===true){
46
+		if ($this->createCondition($item)===true) {
47 47
 			$itemO=$this->createItem($item);
48 48
 		}
49 49
 		return $itemO;
50 50
 	}
51 51
 
52
-	protected function setItemIdentifier($item,$classname,$index){
53
-		if($item instanceof BaseWidget){
54
-			if($item->getIdentifier()===""){
52
+	protected function setItemIdentifier($item, $classname, $index) {
53
+		if ($item instanceof BaseWidget) {
54
+			if ($item->getIdentifier()==="") {
55 55
 				$item->setIdentifier($classname."-".$this->identifier."-".$index);
56 56
 			}
57 57
 		}
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param HtmlDoubleElement|string|array $item
63 63
 	 * @return \Ajax\common\html\HtmlDoubleElement
64 64
 	 */
65
-	public function addItem($item){
65
+	public function addItem($item) {
66 66
 		$itemO=$this->getItemToAdd($item);
67 67
 		$this->addContent($itemO);
68 68
 		return $itemO;
69 69
 	}
70 70
 
71
-	public function insertItem($item,$position=0){
71
+	public function insertItem($item, $position=0) {
72 72
 		$itemO=$this->getItemToAdd($item);
73
-		\array_splice( $this->content, $position, 0, array($itemO));
73
+		\array_splice($this->content, $position, 0, array($itemO));
74 74
 		return $itemO;
75 75
 	}
76 76
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 		return $this;
94 94
 	}
95 95
 
96
-	public function removeItem($index){
96
+	public function removeItem($index) {
97 97
 		return array_splice($this->content, $index, 1);
98 98
 	}
99 99
 
100
-	public function count(){
100
+	public function count() {
101 101
 		return \sizeof($this->content);
102 102
 	}
103 103
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 		return $this->addItem($function($object));
109 109
 	}
110 110
 
111
-	public function apply($callBack){
112
-		foreach ($this->content as $item){
111
+	public function apply($callBack) {
112
+		foreach ($this->content as $item) {
113 113
 			$callBack($item);
114 114
 		}
115 115
 		return $this;
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	abstract protected function createItem($value);
131 131
 
132
-	protected function createCondition($value){
132
+	protected function createCondition($value) {
133 133
 		return \is_object($value)===false;
134 134
 	}
135 135
 
136
-	protected function contentAs($tagName){
137
-		foreach ($this->content as $item){
136
+	protected function contentAs($tagName) {
137
+		foreach ($this->content as $item) {
138 138
 			$item->setTagName($tagName);
139 139
 		}
140 140
 		return $this;
141 141
 	}
142 142
 
143
-	public function setProperties($properties){
143
+	public function setProperties($properties) {
144 144
 		$i=0;
145
-		foreach ($properties as $k=>$v){
145
+		foreach ($properties as $k=>$v) {
146 146
 			$c=$this->content[$i++];
147
-			if(isset($c))
148
-				$c->setProperty($k,$v);
147
+			if (isset($c))
148
+				$c->setProperty($k, $v);
149 149
 			else
150 150
 				return $this;
151 151
 		}
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 	 * @param array $values
159 159
 	 * @return HtmlCollection
160 160
 	 */
161
-	public function setPropertyValues($property,$values){
161
+	public function setPropertyValues($property, $values) {
162 162
 		$i=0;
163
-		if(\is_array($values)===false){
164
-			$values=\array_fill(0, $this->count(),$values);
163
+		if (\is_array($values)===false) {
164
+			$values=\array_fill(0, $this->count(), $values);
165 165
 		}
166
-		foreach ($values as $value){
166
+		foreach ($values as $value) {
167 167
 			$c=$this->content[$i++];
168
-			if(isset($c)){
169
-				$c->setProperty($property,$value);
168
+			if (isset($c)) {
169
+				$c->setProperty($property, $value);
170 170
 			}
171
-			else{
171
+			else {
172 172
 				return $this;
173 173
 			}
174 174
 		}
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
179 179
 		$index=0;
180 180
 		$classname=\strtolower(JReflection::shortClassName($this));
181
-		foreach ($this->content as $item){
182
-			$this->setItemIdentifier($item,$classname,$index++);
181
+		foreach ($this->content as $item) {
182
+			$this->setItemIdentifier($item, $classname, $index++);
183 183
 		}
184
-		return parent::compile($js,$view);
184
+		return parent::compile($js, $view);
185 185
 	}
186 186
 
187
-	public function getItemById($identifier){
187
+	public function getItemById($identifier) {
188 188
 		return $this->getElementById($identifier, $this->content);
189 189
 	}
190 190
 }
191 191
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	protected $ajaxTransition;
18 18
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
19 19
 
20
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
20
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
21 21
 	protected function addLoading(&$retour, $responseElement) {
22 22
 		$loading_notifier='<div class="ajax-loader">';
23 23
 		if ($this->ajaxLoader=='') {
@@ -30,66 +30,66 @@  discard block
 block discarded – undo
30 30
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
31 31
 	}
32 32
 
33
-	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
34
-		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
33
+	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
34
+		return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
35 35
 	}
36
-	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
37
-		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
36
+	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
37
+		return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
38 38
 	}
39 39
 
40
-	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
41
-		if(JString::isNull($params)){$params="{}";}
40
+	protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
41
+		if (JString::isNull($params)) {$params="{}"; }
42 42
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
43 43
 		$retour=$this->_getAjaxUrl($url, $attr);
44 44
 		$responseElement=$this->_getResponseElement($responseElement);
45 45
 		$retour.="var self=this;\n";
46
-		if($hasLoader===true){
46
+		if ($hasLoader===true) {
47 47
 			$this->addLoading($retour, $responseElement);
48 48
 		}
49 49
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
50
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
50
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
51 51
 		if ($immediatly)
52 52
 			$this->jquery_code_for_compile[]=$retour;
53 53
 		return $retour;
54 54
 	}
55 55
 
56
-	protected function setAjaxDataCall($params){
56
+	protected function setAjaxDataCall($params) {
57 57
 		$result=null;
58
-		if(!\is_callable($params)){
59
-			$result=function ($responseElement,$jqueryDone="html") use($params){
60
-				return AjaxTransition::{$params}($responseElement,$jqueryDone);
58
+		if (!\is_callable($params)) {
59
+			$result=function($responseElement, $jqueryDone="html") use($params){
60
+				return AjaxTransition::{$params}($responseElement, $jqueryDone);
61 61
 			};
62 62
 		}
63 63
 		return $result;
64 64
 	}
65 65
 
66
-	protected function _getAjaxUrl($url,$attr){
66
+	protected function _getAjaxUrl($url, $attr) {
67 67
 		$url=$this->_correctAjaxUrl($url);
68 68
 		$retour="url='".$url."';";
69 69
 		$slash="/";
70
-		if(JString::endswith($url, "/")===true)
70
+		if (JString::endswith($url, "/")===true)
71 71
 			$slash="";
72
-		if(JString::isNotNull($attr)){
72
+		if (JString::isNotNull($attr)) {
73 73
 			if ($attr==="value")
74 74
 				$retour.="url=url+'".$slash."'+$(this).val();\n";
75 75
 			elseif ($attr==="html")
76 76
 			$retour.="url=url+'".$slash."'+$(this).html();\n";
77
-			elseif($attr!=null && $attr!=="")
77
+			elseif ($attr!=null && $attr!=="")
78 78
 					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
79 79
 		}
80 80
 		return $retour;
81 81
 	}
82 82
 
83
-	protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$jsCallback){
84
-		$retour="";$call=null;
83
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) {
84
+		$retour=""; $call=null;
85 85
 		if ($responseElement!=="") {
86
-			if(isset($ajaxTransition)){
86
+			if (isset($ajaxTransition)) {
87 87
 				$call=$this->setAjaxDataCall($ajaxTransition);
88
-			}elseif(isset($this->ajaxTransition)){
88
+			}elseif (isset($this->ajaxTransition)) {
89 89
 				$call=$this->ajaxTransition;
90 90
 			}
91
-			if(\is_callable($call))
92
-				$retour="\t".$call($responseElement,$jqueryDone).";\n";
91
+			if (\is_callable($call))
92
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
93 93
 			else
94 94
 				$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
95 95
 		}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		return $retour;
98 98
 	}
99 99
 
100
-	protected function _getResponseElement($responseElement){
100
+	protected function _getResponseElement($responseElement) {
101 101
 		if ($responseElement!=="") {
102 102
 			$responseElement=Javascript::prep_value($responseElement);
103 103
 		}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	protected function _correctAjaxUrl($url) {
108 108
 		if ($url!=="/" && JString::endsWith($url, "/")===true)
109 109
 			$url=substr($url, 0, strlen($url)-1);
110
-		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
110
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
111 111
 			$url=$this->jsUtils->getUrl($url);
112 112
 		}
113 113
 		return $url;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @param string $jsCallback javascript code to execute after the request
122 122
 	 * @param boolean $immediatly
123 123
 	 */
124
-	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
124
+	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
125 125
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
126 126
 		$retour=$this->_getAjaxUrl($url, $attr);
127 127
 		$retour.="$.{$method}(url,".$params.").done(function( data ) {\n";
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param string $url the request address
143 143
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
144 144
 	 */
145
-	public function _jsonOn($event,$element, $url,$parameters=array()) {
145
+	public function _jsonOn($event, $element, $url, $parameters=array()) {
146 146
 		$preventDefault=true;
147 147
 		$stopPropagation=true;
148 148
 		$jsCallback=null;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		$params="{}";
153 153
 		$immediatly=true;
154 154
 		extract($parameters);
155
-		return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly);
155
+		return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
156 156
 	}
157 157
 
158 158
 	/**
@@ -165,22 +165,22 @@  discard block
 block discarded – undo
165 165
 	 * @param string $rowClass the css class for the new element
166 166
 	 * @param boolean $immediatly
167 167
 	 */
168
-	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$rowClass="_json",$immediatly=false) {
168
+	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $rowClass="_json", $immediatly=false) {
169 169
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
170 170
 		$retour=$this->_getAjaxUrl($url, $attr);
171
-		if($context===null){
171
+		if ($context===null) {
172 172
 			$parent="$('".$maskSelector."').parent()";
173
-			$newElm = "$('#'+newId)";
174
-		}else{
173
+			$newElm="$('#'+newId)";
174
+		} else {
175 175
 			$parent=$context;
176
-			$newElm = $context.".find('#'+newId)";
176
+			$newElm=$context.".find('#'+newId)";
177 177
 		}
178 178
 		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
179 179
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
180 180
 		$retour.=$parent.".find('._json').remove();";
181 181
 		$retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();
182 182
 				newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ var newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n";
183
-		$retour.= $appendTo;
183
+		$retour.=$appendTo;
184 184
 		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('__'+key+'__')>-1){\n"."\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
185 185
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
186 186
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -195,30 +195,30 @@  discard block
 block discarded – undo
195 195
 	 * @param string $url the request address
196 196
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null)
197 197
 	 */
198
-	public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) {
198
+	public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
199 199
 		$preventDefault=true;
200 200
 		$stopPropagation=true;
201 201
 		$jsCallback=null;
202 202
 		$attr="id";
203 203
 		$method="get";
204
-		$context = null;
204
+		$context=null;
205 205
 		$params="{}";
206 206
 		$immediatly=true;
207 207
 		extract($parameters);
208
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
208
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
209 209
 	}
210 210
 
211
-	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
211
+	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
212 212
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
213 213
 		$retour=$this->_getAjaxUrl($url, $attr);
214 214
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
215 215
 		$responseElement=$this->_getResponseElement($responseElement);
216 216
 		$retour.="var self=this;\n";
217
-		if($hasLoader===true){
217
+		if ($hasLoader===true) {
218 218
 			$this->addLoading($retour, $responseElement);
219 219
 		}
220 220
 		$retour.="$.post(url,params).done(function( data ) {\n";
221
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
221
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
222 222
 
223 223
 		if ($validation) {
224 224
 			$retour="$('#".$form."').validate({submitHandler: function(form) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @param string $responseElement
242 242
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"jqueryDone"=>"html")
243 243
 	 */
244
-	public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
244
+	public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
245 245
 		$preventDefault=true;
246 246
 		$stopPropagation=true;
247 247
 		$jsCallback=null;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		$jqueryDone="html";
252 252
 		$ajaxTransition=null;
253 253
 		extract($parameters);
254
-		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
254
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @param string $responseElement
265 265
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null)
266 266
 	 */
267
-	public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
267
+	public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
268 268
 		$preventDefault=true;
269 269
 		$stopPropagation=true;
270 270
 		$jsCallback=null;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		$jqueryDone="html";
275 275
 		$ajaxTransition=null;
276 276
 		extract($parameters);
277
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
277
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
278 278
 	}
279 279
 
280 280
 	/**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * @param string $responseElement
288 288
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"immediatly"=>true)
289 289
 	 */
290
-	public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) {
290
+	public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
291 291
 		$preventDefault=true;
292 292
 		$stopPropagation=true;
293 293
 		$validation=false;
@@ -298,6 +298,6 @@  discard block
 block discarded – undo
298 298
 		$jqueryDone="html";
299 299
 		$ajaxTransition=null;
300 300
 		extract($parameters);
301
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
301
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
302 302
 	}
303 303
 }
304 304
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
26 26
 	 * @param string|callable $ajaxTransition
27 27
 	 */
28
-	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
29
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
28
+	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
29
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
30 30
 	}
31 31
 
32 32
 	/**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param string $jsCallback javascript code to execute after the request
38 38
 	 * @param boolean $immediatly
39 39
 	 */
40
-	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
41
-		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly);
40
+	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
41
+		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly);
42 42
 	}
43 43
 
44 44
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @param string $url the request address
49 49
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
50 50
 	 */
51
-	public function jsonOn($event,$element, $url,$parameters=array()) {
52
-		return $this->js->_jsonOn($event, $element, $url,$parameters);
51
+	public function jsonOn($event, $element, $url, $parameters=array()) {
52
+		return $this->js->_jsonOn($event, $element, $url, $parameters);
53 53
 	}
54 54
 
55 55
 	/**
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param string $jsCallback javascript code to execute after the request
72 72
 	 * @param string $rowClass the css class for the new element
73 73
 	 */
74
-	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") {
75
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL,$rowClass,true);
74
+	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") {
75
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, true);
76 76
 	}
77 77
 
78 78
 	/**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @param string $jsCallback javascript code to execute after the request
85 85
 	 * @param string $rowClass the css class for the new element
86 86
 	 */
87
-	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") {
88
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL, $rowClass,false);
87
+	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") {
88
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, false);
89 89
 	}
90 90
 
91 91
 	/**
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	 * @param string $url the request url
96 96
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true)
97 97
 	 */
98
-	public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) {
99
-		return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters);
98
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
99
+		return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters);
100 100
 	}
101 101
 
102 102
 	/**
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
111 111
 	 * @param string|callable $ajaxTransition
112 112
 	 */
113
-	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) {
114
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false,$jqueryDone,$ajaxTransition);
113
+	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) {
114
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition);
115 115
 	}
116 116
 
117 117
 	/**
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
151 151
 	 * @param string|callable $ajaxTransition
152 152
 	 */
153
-	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
154
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
153
+	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
154
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
155 155
 	}
156 156
 
157 157
 	/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
167 167
 	 * @param string|callable $ajaxTransition
168 168
 	 */
169
-	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
170
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
169
+	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
170
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
171 171
 	}
172 172
 
173 173
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
182 182
 	 */
183 183
 	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
184
-		return $this->js->_postOn($event, $element,  $url, $params, $responseElement, $parameters);
184
+		return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters);
185 185
 	}
186 186
 
187 187
 	/**
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
208 208
 	 * @param string|callable $ajaxTransition
209 209
 	 */
210
-	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
211
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
210
+	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
211
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
212 212
 	}
213 213
 
214 214
 	/**
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
224 224
 	 * @param string|callable $ajaxTransition
225 225
 	 */
226
-	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
227
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
226
+	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
227
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
228 228
 	}
229 229
 
230 230
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
239 239
 	 */
240 240
 	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
241
-		return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters);
241
+		return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters);
242 242
 	}
243 243
 
244 244
 	/**
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,27 +29,27 @@
 block discarded – undo
29 29
 		$rowClass="_json";
30 30
 		extract($this->parameters);
31 31
 		$result=$this->_eventPreparing($preventDefault, $stopPropagation);
32
-		switch($this->method) {
32
+		switch ($this->method) {
33 33
 			case "get":
34
-				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr,$jqueryDone,$ajaxTransition);
34
+				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr, $jqueryDone, $ajaxTransition);
35 35
 				break;
36 36
 			case "post":
37
-				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
37
+				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
38 38
 				break;
39 39
 			case "postForm":
40
-				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
40
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
41 41
 				break;
42 42
 			case "json":
43
-				$result.=$js->jsonDeferred($url,$method,$params,$jsCallback);
43
+				$result.=$js->jsonDeferred($url, $method, $params, $jsCallback);
44 44
 				break;
45 45
 			case "jsonArray":
46
-				$result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$params,$jsCallback,$rowClass);
46
+				$result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $params, $jsCallback, $rowClass);
47 47
 				break;
48 48
 		}
49 49
 		return $result;
50 50
 	}
51 51
 
52
-	protected function _eventPreparing($preventDefault,$stopPropagation){
52
+	protected function _eventPreparing($preventDefault, $stopPropagation) {
53 53
 		$result="";
54 54
 		if ($preventDefault===true) {
55 55
 			$result.=Javascript::$preventDefault;
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct($identifier) {
22 22
 		parent::__construct($identifier, "tr", "");
23
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
23
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
24 24
 	}
25 25
 
26 26
 	public function setColCount($colCount) {
27 27
 		$count=$this->count();
28
-		for($i=$count; $i < $colCount; $i++) {
28
+		for ($i=$count; $i<$colCount; $i++) {
29 29
 			$item=$this->addItem(NULL);
30 30
 			$item->setTagName($this->_tdTagName);
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function getColCount(){
35
+	public function getColCount() {
36 36
 		return $this->count();
37 37
 	}
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param mixed $values
69 69
 	 */
70 70
 	public function setValues($values=array()) {
71
-		return $this->_addOrSetValues($values, function(&$cell,$value){$cell->setValue($value);});
71
+		return $this->_addOrSetValues($values, function(&$cell, $value) {$cell->setValue($value); });
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,27 +76,27 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $values
77 77
 	 */
78 78
 	public function addValues($values=array()) {
79
-		return $this->_addOrSetValues($values, function(&$cell,$value){$cell->addValue($value);});
79
+		return $this->_addOrSetValues($values, function(&$cell, $value) {$cell->addValue($value); });
80 80
 	}
81 81
 
82 82
 	/**
83 83
 	 * Sets or adds values to the row cols
84 84
 	 * @param mixed $values
85 85
 	 */
86
-	protected function _addOrSetValues($values,$callback) {
86
+	protected function _addOrSetValues($values, $callback) {
87 87
 		$count=$this->count();
88 88
 		if (!\is_array($values)) {
89 89
 			$values=\array_fill(0, $count, $values);
90 90
 		} else {
91
-			if (JArray::isAssociative($values) === true) {
91
+			if (JArray::isAssociative($values)===true) {
92 92
 				$values=\array_values($values);
93 93
 			}
94 94
 		}
95 95
 		$count=\min(\sizeof($values), $count);
96 96
 
97
-		for($i=0; $i < $count; $i++) {
97
+		for ($i=0; $i<$count; $i++) {
98 98
 			$cell=$this->content[$i];
99
-			$callback($cell,$values[$i]);
99
+			$callback($cell, $values[$i]);
100 100
 		}
101 101
 		return $this;
102 102
 	}
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 	public function getColPosition($colIndex) {
123 123
 		$pos=0;
124 124
 		$rows=$this->_container->getContent();
125
-		for($i=0; $i < $this->_row; $i++) {
125
+		for ($i=0; $i<$this->_row; $i++) {
126 126
 			$max=\min($colIndex, $rows[$i]->count());
127
-			for($j=0; $j < $max; $j++) {
127
+			for ($j=0; $j<$max; $j++) {
128 128
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
129
-				if ($rowspan + $i > $this->_row)
129
+				if ($rowspan+$i>$this->_row)
130 130
 					$pos++;
131 131
 			}
132 132
 		}
133
-		if ($pos > $colIndex)
133
+		if ($pos>$colIndex)
134 134
 			return NULL;
135 135
 		$count=$this->count();
136
-		for($i=0; $i < $count; $i++) {
136
+		for ($i=0; $i<$count; $i++) {
137 137
 			$pos+=$this->content[$i]->getColspan();
138
-			if ($pos >= $colIndex + 1)
138
+			if ($pos>=$colIndex+1)
139 139
 				return $i;
140 140
 		}
141 141
 		return null;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 	public function conditionalCellFormat($callback, $format) {
145 145
 		$cells=$this->content;
146
-		foreach ( $cells as $cell ) {
146
+		foreach ($cells as $cell) {
147 147
 			$cell->conditionalCellFormat($callback, $format);
148 148
 		}
149 149
 		return $this;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 
159 159
 	public function containsStr($needle) {
160 160
 		$cells=$this->content;
161
-		foreach ( $cells as $cell ) {
162
-			if (\strpos($cell->getContent(), $needle) !== false)
161
+		foreach ($cells as $cell) {
162
+			if (\strpos($cell->getContent(), $needle)!==false)
163 163
 				return true;
164 164
 		}
165 165
 		return false;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 	public function applyCells($callback) {
174 174
 		$cells=$this->content;
175
-		foreach ( $cells as $cell ) {
175
+		foreach ($cells as $cell) {
176 176
 			$cell->apply($callback);
177 177
 		}
178 178
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlList.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function createItem($value) {
20 20
 		$count=$this->count();
21
-		$item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value);
21
+		$item=new HtmlListItem("item-".$this->identifier."-".$count, $value);
22 22
 		return $item;
23 23
 	}
24 24
 
25 25
 	public function addHeader($niveau, $content) {
26
-		$header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page");
26
+		$header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page");
27 27
 		$this->wrap($header);
28 28
 		return $header;
29 29
 	}
30 30
 
31
-	public function getItemPart($index,$partName="header"){
31
+	public function getItemPart($index, $partName="header") {
32 32
 		return $this->getItem($index)->getPart($partName);
33 33
 	}
34 34
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 
39 39
 	public function asLink() {
40
-		$this->addToPropertyCtrl("class", "link", array ("link" ));
40
+		$this->addToPropertyCtrl("class", "link", array("link"));
41 41
 		return $this->contentAs("a");
42 42
 	}
43 43
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	public function run(JsUtils $js) {
63
-		if ($this->_hasCheckedList === true) {
64
-			$jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php';
65
-			$jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode);
63
+		if ($this->_hasCheckedList===true) {
64
+			$jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php';
65
+			$jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode);
66 66
 			$this->executeOnRun($jsCode);
67 67
 		}
68 68
 		return parent::run($js);
@@ -86,24 +86,24 @@  discard block
 block discarded – undo
86 86
 
87 87
 	public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) {
88 88
 		$count=$this->count();
89
-		$identifier=$this->identifier . "-" . $count;
89
+		$identifier=$this->identifier."-".$count;
90 90
 		if (isset($masterItem)) {
91
-			$masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem);
91
+			$masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem);
92 92
 			$masterO->getHtmlCk()->addToProperty("class", "master");
93 93
 			$masterO->setClass("item");
94 94
 			$this->addItem($masterO);
95 95
 		}
96
-		$fields=array ();
96
+		$fields=array();
97 97
 		$i=0;
98
-		foreach ( $items as $val => $caption ) {
99
-			$itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child");
100
-			if (\array_search($val, $values) !== false) {
98
+		foreach ($items as $val => $caption) {
99
+			$itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child");
100
+			if (\array_search($val, $values)!==false) {
101 101
 				$itemO->getField()->setProperty("checked", "");
102 102
 			}
103 103
 			$itemO->setClass("item");
104 104
 			$fields[]=$itemO;
105 105
 		}
106
-		if (isset($masterO) === true) {
106
+		if (isset($masterO)===true) {
107 107
 			$list=new HtmlList("", $fields);
108 108
 			$list->setClass("list");
109 109
 			$masterO->addContent($list);
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 		return $this;
115 115
 	}
116 116
 
117
-	public function setIcons($icons){
118
-		if(!\is_array($icons)){
117
+	public function setIcons($icons) {
118
+		if (!\is_array($icons)) {
119 119
 			$icons=\array_fill(0, \sizeof($this->content), $icons);
120 120
 		}
121
-		$max=\min(\sizeof($icons),\sizeof($this->content));
122
-		for($i=0;$i<$max;$i++){
121
+		$max=\min(\sizeof($icons), \sizeof($this->content));
122
+		for ($i=0; $i<$max; $i++) {
123 123
 			$this->content[$i]->addIcon($icons[$i]);
124 124
 		}
125 125
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct($identifier, $rowCount, $colCount) {
29 29
 		parent::__construct($identifier, "table", "ui table");
30
-		$this->content=array ();
30
+		$this->content=array();
31 31
 		$this->setRowCount($rowCount, $colCount);
32
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
33
-		$this->_compileParts=["thead","tbody","tfoot"];
32
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
33
+		$this->_compileParts=["thead", "tbody", "tfoot"];
34 34
 		$this->_afterCompileEvents=[];
35 35
 	}
36 36
 
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
 	 * @return HtmlTableContent
49 49
 	 */
50 50
 	public function getPart($key) {
51
-		if (\array_key_exists($key, $this->content) === false) {
51
+		if (\array_key_exists($key, $this->content)===false) {
52 52
 			$this->content[$key]=new HtmlTableContent("", $key);
53
-			if ($key !== "tbody") {
53
+			if ($key!=="tbody") {
54 54
 				$this->content[$key]->setRowCount(1, $this->_colCount);
55 55
 			}
56 56
 		}
57 57
 		return $this->content[$key];
58 58
 	}
59 59
 
60
-	protected function _getFirstPart(){
61
-		if(isset($this->content["thead"])){
60
+	protected function _getFirstPart() {
61
+		if (isset($this->content["thead"])) {
62 62
 			return $this->content["thead"];
63 63
 		}
64 64
 		return $this->content["tbody"];
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @return boolean
104 104
 	 */
105 105
 	public function hasPart($key) {
106
-		return \array_key_exists($key, $this->content) === true;
106
+		return \array_key_exists($key, $this->content)===true;
107 107
 	}
108 108
 
109 109
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 	private function colAlign($colIndex, $function) {
240 240
 		if (\is_array($colIndex)) {
241
-			foreach ( $colIndex as $cIndex ) {
241
+			foreach ($colIndex as $cIndex) {
242 242
 				$this->colAlign($cIndex, $function);
243 243
 			}
244 244
 		} else {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @see HtmlSemDoubleElement::compile()
300 300
 	 */
301 301
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
302
-		if(\sizeof($this->_compileParts)<3){
302
+		if (\sizeof($this->_compileParts)<3) {
303 303
 			$this->_template="%content%";
304 304
 			$this->refresh();
305 305
 		}
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 
310 310
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
311 311
 		if ($this->propertyContains("class", "sortable")) {
312
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
312
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
313 313
 		}
314
-		if(isset($this->_activeRowSelector)){
314
+		if (isset($this->_activeRowSelector)) {
315 315
 			$this->_activeRowSelector->compile();
316 316
 		}
317 317
 	}
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
 	public function fromDatabaseObject($object, $function) {
326 326
 		$result=$function($object);
327 327
 		if (\is_array($result)) {
328
-			$result= $this->addRow($function($object));
328
+			$result=$this->addRow($function($object));
329 329
 		} else {
330
-			$result= $this->getBody()->_addRow($result);
330
+			$result=$this->getBody()->_addRow($result);
331 331
 		}
332
-		if(isset($this->_afterCompileEvents["onNewRow"])){
333
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
334
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
332
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
333
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
334
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
335 335
 		}
336 336
 		return $result;
337 337
 	}
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 		return $this;
347 347
 	}
348 348
 
349
-	public function refresh(){
349
+	public function refresh() {
350 350
 		$this->_footer=$this->getFooter();
351 351
 		$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");');
352 352
 	}
353 353
 
354
-	public function run(JsUtils $js){
355
-		$result= parent::run($js);
356
-		if(isset($this->_footer))
354
+	public function run(JsUtils $js) {
355
+		$result=parent::run($js);
356
+		if (isset($this->_footer))
357 357
 			$this->_footer->run($js);
358 358
 		return $result;
359 359
 	}
@@ -376,38 +376,38 @@  discard block
 block discarded – undo
376 376
 	 * @param boolean $multiple
377 377
 	 * @return HtmlTable
378 378
 	 */
379
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
380
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
379
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
380
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
381 381
 		return $this;
382 382
 	}
383 383
 
384
-	public function hideColumn($colIndex){
385
-		if(isset($this->content["thead"])){
384
+	public function hideColumn($colIndex) {
385
+		if (isset($this->content["thead"])) {
386 386
 			$this->content["thead"]->hideColumn($colIndex);
387 387
 		}
388 388
 		$this->content["tbody"]->hideColumn($colIndex);
389
-		if(isset($this->content["tfoot"])){
389
+		if (isset($this->content["tfoot"])) {
390 390
 			$this->content["tfoot"]->hideColumn($colIndex);
391 391
 		}
392 392
 		return $this;
393 393
 	}
394 394
 
395
-	public function setColWidth($colIndex,$width){
395
+	public function setColWidth($colIndex, $width) {
396 396
 		$part=$this->_getFirstPart();
397
-		if($part!==null && $part->count()>0)
397
+		if ($part!==null && $part->count()>0)
398 398
 			$part->getCell(0, $colIndex)->setWidth($width);
399 399
 		return $this;
400 400
 	}
401 401
 
402
-	public function setColWidths($widths){
402
+	public function setColWidths($widths) {
403 403
 		$part=$this->_getFirstPart();
404
-		if($part!==null && $part->col()>0){
404
+		if ($part!==null && $part->col()>0) {
405 405
 			$count=$part->getColCount();
406
-			if(!\is_array($widths)){
406
+			if (!\is_array($widths)) {
407 407
 				$widths=\array_fill(0, $count, $widths);
408 408
 			}
409
-			$max=\min(\sizeof($widths),$count);
410
-			for($i=0;$i<$max;$i++){
409
+			$max=\min(\sizeof($widths), $count);
410
+			for ($i=0; $i<$max; $i++) {
411 411
 				$part->getCell(0, $i)->setWidth($widths[$i]);
412 412
 			}
413 413
 		}
Please login to merge, or discard this patch.