Passed
Push — master ( 1a87e3...34d65d )
by Jean-Christophe
03:35
created
Ajax/semantic/widgets/datatable/DataTable.php 2 patches
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  */
27 27
 class DataTable extends Widget {
28
-	use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait;
28
+	use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait;
29 29
 
30 30
 	protected $_searchField;
31 31
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	protected $_displayBehavior;
43 43
 
44
-	protected $_visibleHover = false;
44
+	protected $_visibleHover=false;
45 45
 
46 46
 	protected $_targetSelector;
47 47
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 	protected $_json;
53 53
 
54
-	protected $_rowClass = "_element";
54
+	protected $_rowClass="_element";
55 55
 
56 56
 	protected $_sortable;
57 57
 
@@ -65,26 +65,26 @@  discard block
 block discarded – undo
65 65
 
66 66
 	protected $_namePrefix;
67 67
 
68
-	public function __construct($identifier, $model, $modelInstance = NULL) {
68
+	public function __construct($identifier, $model, $modelInstance=NULL) {
69 69
 		parent::__construct($identifier, $model, $modelInstance);
70 70
 		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
71
-		$this->_urls = [];
72
-		$this->_emptyMessage = new HtmlMessage("", "nothing to display");
71
+		$this->_urls=[];
72
+		$this->_emptyMessage=new HtmlMessage("", "nothing to display");
73 73
 		$this->_emptyMessage->setIcon("info circle");
74 74
 	}
75 75
 
76 76
 	public function run(JsUtils $js) {
77
-		if ($this->_runned !== true) {
78
-			$offset = $js->scriptCount();
77
+		if ($this->_runned!==true) {
78
+			$offset=$js->scriptCount();
79 79
 			if ($this->_hasCheckboxes && isset($js)) {
80 80
 				$this->_runCheckboxes($js);
81 81
 			}
82 82
 			if ($this->_visibleHover) {
83
-				$js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
83
+				$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
84 84
 					"preventDefault" => false,
85 85
 					"stopPropagation" => true
86 86
 				]);
87
-				$js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
87
+				$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
88 88
 					"preventDefault" => false,
89 89
 					"stopPropagation" => true
90 90
 				]);
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 				$this->_associatePaginationBehavior($js, $offset);
102 102
 			}
103 103
 			$this->_associateSearchFieldBehavior($js, $offset);
104
-			$this->_runned = true;
104
+			$this->_runned=true;
105 105
 		}
106 106
 	}
107 107
 
108 108
 	protected function _generateBehavior($op, $params, JsUtils $js) {
109 109
 		if (isset($this->_urls[$op])) {
110
-			$params = \array_merge($params, [
110
+			$params=\array_merge($params, [
111 111
 				"attr" => "data-ajax"
112 112
 			]);
113
-			$js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params);
113
+			$js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params);
114 114
 		}
115 115
 	}
116 116
 
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	public function refreshTD($fieldName, $jquery, $view) {
132
-		$index = $this->_getIndex($fieldName);
132
+		$index=$this->_getIndex($fieldName);
133 133
 		$this->compile($jquery, $view);
134 134
 		return $this->refreshTR()
135 135
 			->getTable()
136 136
 			->getCell(0, $index);
137 137
 	}
138 138
 
139
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
140
-		if (! $this->_generated) {
139
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
140
+		if (!$this->_generated) {
141 141
 			if (isset($this->_buttonsColumn)) {
142 142
 				$this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons);
143 143
 			}
144 144
 			$this->_instanceViewer->setInstance($this->_model);
145
-			$captions = $this->_instanceViewer->getCaptions();
146
-			$table = $this->content["table"];
145
+			$captions=$this->_instanceViewer->getCaptions();
146
+			$table=$this->content["table"];
147 147
 			if ($this->_hasCheckboxes) {
148 148
 				$this->_generateMainCheckbox($captions);
149 149
 			}
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 			$this->compileExtraElements($table, $captions);
159 159
 			$this->_compileSearchFieldBehavior($js);
160 160
 
161
-			$this->content = JArray::sortAssociative($this->content, [
161
+			$this->content=JArray::sortAssociative($this->content, [
162 162
 				PositionInTable::BEFORETABLE,
163 163
 				"table",
164 164
 				PositionInTable::AFTERTABLE
165 165
 			]);
166
-			if ($this->_caption != null) {
166
+			if ($this->_caption!=null) {
167 167
 				$this->wrap("<div class='field'><label>{$this->_caption}</label>", "</div>");
168 168
 			}
169 169
 			$this->_compileForm();
170 170
 			$this->_applyStyleAttributes($table);
171
-			$this->_generated = true;
171
+			$this->_generated=true;
172 172
 		}
173 173
 		return parent::compile($js, $view);
174 174
 	}
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	}
207 207
 
208 208
 	protected function _generateHeader(HtmlTable $table, $captions) {
209
-		$gbFields = $this->_instanceViewer->getGroupByFields();
209
+		$gbFields=$this->_instanceViewer->getGroupByFields();
210 210
 		if (\is_array($gbFields)) {
211
-			$captions = \array_values(JArray::removeByKeys($captions, $gbFields));
211
+			$captions=\array_values(JArray::removeByKeys($captions, $gbFields));
212 212
 		}
213 213
 		$table->setHeaderValues($captions);
214 214
 		if (isset($this->_sortable)) {
@@ -217,22 +217,22 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	protected function _generateContent($table) {
220
-		$objects = $this->_modelInstance;
220
+		$objects=$this->_modelInstance;
221 221
 		if (isset($this->_pagination)) {
222
-			$objects = $this->_pagination->getObjects($this->_modelInstance);
222
+			$objects=$this->_pagination->getObjects($this->_modelInstance);
223 223
 		}
224 224
 		InstanceViewer::setIndex(0);
225
-		$fields = $this->_instanceViewer->getSimpleProperties();
226
-		$groupByFields = $this->_instanceViewer->getGroupByFields();
227
-		if (! is_array($groupByFields)) {
228
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) {
225
+		$fields=$this->_instanceViewer->getSimpleProperties();
226
+		$groupByFields=$this->_instanceViewer->getGroupByFields();
227
+		if (!is_array($groupByFields)) {
228
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) {
229 229
 				return $this->_generateRow($instance, $fields, $table);
230 230
 			});
231 231
 		} else {
232
-			$diffFields = \array_values(JArray::removeByKeys($fields, $groupByFields));
233
-			$activeValues = \array_combine($groupByFields, \array_fill(0, \count($groupByFields), null));
234
-			$uuids = [];
235
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) {
232
+			$diffFields=\array_values(JArray::removeByKeys($fields, $groupByFields));
233
+			$activeValues=\array_combine($groupByFields, \array_fill(0, \count($groupByFields), null));
234
+			$uuids=[];
235
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) {
236 236
 				$this->_instanceViewer->setInstance($instance);
237 237
 				foreach ($groupByFields as $index => $gbField) {
238 238
 					$this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids);
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 				return $this->_generateRow($instance, $diffFields, $table, null, $uuids);
241 241
 			});
242 242
 		}
243
-		if ($table->getRowCount() == 0) {
244
-			$result = $table->addRow();
243
+		if ($table->getRowCount()==0) {
244
+			$result=$table->addRow();
245 245
 			$result->mergeRow();
246 246
 			$result->setValues([
247 247
 				$this->_emptyMessage
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) {
253
-		$newValue = $this->_instanceViewer->getValue($gbField);
254
-		if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) {
255
-			if ($index == 0) {
256
-				$uuids = [];
253
+		$newValue=$this->_instanceViewer->getValue($gbField);
254
+		if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) {
255
+			if ($index==0) {
256
+				$uuids=[];
257 257
 			}
258
-			$uuid = uniqid("grp");
259
-			$uuids[$gbField] = $uuid;
260
-			$id = $this->_instanceViewer->getIdentifier();
261
-			$result = $table->addMergeRow(sizeof($fields) + 1, $newValue);
262
-			$result->setIdentifier($this->identifier . "-tr-gb-" . $id);
258
+			$uuid=uniqid("grp");
259
+			$uuids[$gbField]=$uuid;
260
+			$id=$this->_instanceViewer->getIdentifier();
261
+			$result=$table->addMergeRow(sizeof($fields)+1, $newValue);
262
+			$result->setIdentifier($this->identifier."-tr-gb-".$id);
263 263
 			$result->setProperty("data-ajax", $id);
264 264
 			$result->setProperty("data-group", $uuid);
265 265
 			$result->addToProperty("class", $this->_rowClass);
266
-			$activeValues[$gbField] = $newValue;
266
+			$activeValues[$gbField]=$newValue;
267 267
 		}
268 268
 	}
269 269
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	}
276 276
 
277 277
 	public function getFieldValue($index) {
278
-		$index = $this->_getIndex($index);
278
+		$index=$this->_getIndex($index);
279 279
 		if (is_numeric($index)) {
280
-			$values = $this->_instanceViewer->getValues();
280
+			$values=$this->_instanceViewer->getValues();
281 281
 			if (isset($values[$index])) {
282 282
 				return $values[$index];
283 283
 			}
@@ -285,30 +285,30 @@  discard block
 block discarded – undo
285 285
 		return null;
286 286
 	}
287 287
 
288
-	protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) {
288
+	protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) {
289 289
 		$this->_instanceViewer->setInstance($instance);
290
-		InstanceViewer::$index ++;
291
-		$values = $this->_instanceViewer->getValues();
292
-		$id = $this->_instanceViewer->getIdentifier();
293
-		$dataAjax = $id;
294
-		$id = $this->cleanIdentifier($id);
290
+		InstanceViewer::$index++;
291
+		$values=$this->_instanceViewer->getValues();
292
+		$id=$this->_instanceViewer->getIdentifier();
293
+		$dataAjax=$id;
294
+		$id=$this->cleanIdentifier($id);
295 295
 		if ($this->_hasCheckboxes) {
296
-			$ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, "");
297
-			$checked = false;
296
+			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, "");
297
+			$checked=false;
298 298
 			if (isset($this->_checkedCallback)) {
299
-				$func = $this->_checkedCallback;
300
-				$checked = $func($instance);
299
+				$func=$this->_checkedCallback;
300
+				$checked=$func($instance);
301 301
 			}
302 302
 			$ck->setChecked($checked);
303
-			$field = $ck->getField();
303
+			$field=$ck->getField();
304 304
 			$field->setProperty("value", $dataAjax);
305 305
 			$field->setProperty("name", "selection[]");
306 306
 			if (isset($checkedClass))
307 307
 				$field->setClass($checkedClass);
308 308
 			\array_unshift($values, $ck);
309 309
 		}
310
-		$result = $table->newRow();
311
-		$result->setIdentifier($this->identifier . "-tr-" . $id);
310
+		$result=$table->newRow();
311
+		$result->setIdentifier($this->identifier."-tr-".$id);
312 312
 		$result->setProperty("data-ajax", $dataAjax);
313 313
 		$result->setValues($values);
314 314
 		$result->addToProperty("class", $this->_rowClass);
@@ -321,67 +321,67 @@  discard block
 block discarded – undo
321 321
 
322 322
 	protected function _generatePagination($table) {
323 323
 		if (isset($this->_toolbar)) {
324
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
324
+			if ($this->_toolbarPosition==PositionInTable::FOOTER)
325 325
 				$this->_toolbar->setFloated("left");
326 326
 		}
327
-		$footer = $table->getFooter();
327
+		$footer=$table->getFooter();
328 328
 		$footer->mergeCol();
329
-		$this->_paginationToolbar = $this->_pagination->generateMenu($this->identifier);
329
+		$this->_paginationToolbar=$this->_pagination->generateMenu($this->identifier);
330 330
 		$footer->addValues($this->_paginationToolbar);
331 331
 	}
332 332
 
333
-	protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) {
333
+	protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) {
334 334
 		if (isset($this->_urls["refresh"])) {
335
-			$menu = $this->_pagination->getMenu();
335
+			$menu=$this->_pagination->getMenu();
336 336
 			if (isset($menu) && isset($js)) {
337
-				$js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [
337
+				$js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [
338 338
 					"preventDefault" => false,
339 339
 					"jqueryDone" => "replaceWith",
340 340
 					"hasLoader" => false,
341
-					"jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");'
341
+					"jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");'
342 342
 				]);
343
-				$page = $_POST["p"] ?? null;
343
+				$page=$_POST["p"] ?? null;
344 344
 				if (isset($page)) {
345
-					$activeClass = $this->getActiveRowClass();
346
-					$js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("' . $activeClass . '");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("' . $activeClass . '");');
345
+					$activeClass=$this->getActiveRowClass();
346
+					$js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("'.$activeClass.'");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("'.$activeClass.'");');
347 347
 				}
348 348
 			}
349 349
 		}
350 350
 	}
351 351
 
352
-	protected function _compileSearchFieldBehavior(JsUtils $js = NULL) {
352
+	protected function _compileSearchFieldBehavior(JsUtils $js=NULL) {
353 353
 		if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) {
354
-			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [
354
+			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [
355 355
 				"preventDefault" => false,
356 356
 				"jqueryDone" => "replaceWith",
357 357
 				"hasLoader" => "internal",
358
-				"jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);'
358
+				"jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);'
359 359
 			]);
360 360
 		}
361 361
 	}
362 362
 
363
-	protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {}
363
+	protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {}
364 364
 
365 365
 	protected function _getFieldName($index) {
366
-		$fieldName = parent::_getFieldName($index);
366
+		$fieldName=parent::_getFieldName($index);
367 367
 		if (\is_object($fieldName))
368
-			$fieldName = "field-" . $index;
369
-		if ($this->_namePrefix != null) {
370
-			$fieldName = $this->_namePrefix . '.' . $fieldName;
368
+			$fieldName="field-".$index;
369
+		if ($this->_namePrefix!=null) {
370
+			$fieldName=$this->_namePrefix.'.'.$fieldName;
371 371
 		}
372
-		return $fieldName . "[]";
372
+		return $fieldName."[]";
373 373
 	}
374 374
 
375 375
 	protected function _getFieldCaption($index) {
376 376
 		return null;
377 377
 	}
378 378
 
379
-	protected function applyToolbarPosition(string $position, $table, $captions = NULL) {
379
+	protected function applyToolbarPosition(string $position, $table, $captions=NULL) {
380 380
 		switch ($position) {
381 381
 			case PositionInTable::BEFORETABLE:
382 382
 			case PositionInTable::AFTERTABLE:
383
-				if (isset($this->_compileParts) === false) {
384
-					$this->content[$position] = $this->_toolbar;
383
+				if (isset($this->_compileParts)===false) {
384
+					$this->content[$position]=$this->_toolbar;
385 385
 				}
386 386
 				break;
387 387
 			case PositionInTable::HEADER:
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		}
393 393
 	}
394 394
 
395
-	protected function _setToolbarPosition($table, $captions = NULL) {
395
+	protected function _setToolbarPosition($table, $captions=NULL) {
396 396
 		if (\is_array($this->_toolbarPosition)) {
397 397
 			foreach ($this->_toolbarPosition as $tbp) {
398 398
 				$this->applyToolbarPosition($tbp, $table, $captions);
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
 	}
419 419
 
420 420
 	private function addToolbarRow($part, $table, $captions) {
421
-		$hasPart = $table->hasPart($part);
421
+		$hasPart=$table->hasPart($part);
422 422
 		if ($hasPart) {
423
-			$row = $table->getPart($part)->addRow(\sizeof($captions));
423
+			$row=$table->getPart($part)->addRow(\sizeof($captions));
424 424
 		} else {
425
-			$row = $table->getPart($part)->getRow(0);
425
+			$row=$table->getPart($part)->getRow(0);
426 426
 		}
427 427
 		$row->mergeCol();
428 428
 		$row->setValues([
@@ -454,12 +454,12 @@  discard block
 block discarded – undo
454 454
 	 */
455 455
 	public function setUrls($urls) {
456 456
 		if (\is_array($urls)) {
457
-			$this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0);
458
-			$this->_urls["edit"] = JArray::getValue($urls, "edit", 1);
459
-			$this->_urls["delete"] = JArray::getValue($urls, "delete", 2);
460
-			$this->_urls["display"] = JArray::getValue($urls, "display", 3);
457
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
458
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
459
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
460
+			$this->_urls["display"]=JArray::getValue($urls, "display", 3);
461 461
 		} else {
462
-			$this->_urls = [
462
+			$this->_urls=[
463 463
 				"refresh" => $urls,
464 464
 				"edit" => $urls,
465 465
 				"delete" => $urls,
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 *        	The number of visible pages in the Pagination component
483 483
 	 * @return DataTable
484 484
 	 */
485
-	public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) {
486
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
485
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
486
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
487 487
 		return $this;
488 488
 	}
489 489
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 *        	The number of visible pages in the Pagination component
499 499
 	 * @return DataTable
500 500
 	 */
501
-	public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) {
502
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page);
501
+	public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) {
502
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page);
503 503
 		return $this;
504 504
 	}
505 505
 
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 	 * @param array $compileParts
509 509
 	 * @return DataTable
510 510
 	 */
511
-	public function refresh($compileParts = [
511
+	public function refresh($compileParts=[
512 512
 		'tbody'
513 513
 	]) {
514
-		$this->_compileParts = $compileParts;
514
+		$this->_compileParts=$compileParts;
515 515
 		return $this;
516 516
 	}
517 517
 
@@ -521,14 +521,14 @@  discard block
 block discarded – undo
521 521
 	 * @param string $position
522 522
 	 * @return \Ajax\common\html\HtmlDoubleElement
523 523
 	 */
524
-	public function addSearchInToolbar($position = Direction::RIGHT) {
524
+	public function addSearchInToolbar($position=Direction::RIGHT) {
525 525
 		return $this->addInToolbar($this->getSearchField())
526 526
 			->setPosition($position);
527 527
 	}
528 528
 
529 529
 	public function getSearchField() {
530
-		if (isset($this->_searchField) === false) {
531
-			$this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search...");
530
+		if (isset($this->_searchField)===false) {
531
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
532 532
 			$this->_searchField->addIcon("search", Direction::RIGHT);
533 533
 		}
534 534
 		return $this->_searchField;
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
 	}
557 557
 
558 558
 	protected function getTargetSelector($op) {
559
-		$result = $this->_targetSelector;
560
-		if (! isset($result[$op]))
561
-			$result = "#" . $this->identifier;
559
+		$result=$this->_targetSelector;
560
+		if (!isset($result[$op]))
561
+			$result="#".$this->identifier;
562 562
 		return $result[$op];
563 563
 	}
564 564
 
@@ -570,20 +570,20 @@  discard block
 block discarded – undo
570 570
 	 * @return DataTable
571 571
 	 */
572 572
 	public function setTargetSelector($_targetSelector) {
573
-		if (! \is_array($_targetSelector)) {
574
-			$_targetSelector = [
573
+		if (!\is_array($_targetSelector)) {
574
+			$_targetSelector=[
575 575
 				"edit" => $_targetSelector,
576 576
 				"delete" => $_targetSelector
577 577
 			];
578 578
 		}
579
-		$this->_targetSelector = $_targetSelector;
579
+		$this->_targetSelector=$_targetSelector;
580 580
 		return $this;
581 581
 	}
582 582
 
583 583
 	public function getRefreshSelector() {
584 584
 		if (isset($this->_refreshSelector))
585 585
 			return $this->_refreshSelector;
586
-		return "#" . $this->identifier . " tbody";
586
+		return "#".$this->identifier." tbody";
587 587
 	}
588 588
 
589 589
 	/**
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	 * @return DataTable
593 593
 	 */
594 594
 	public function setRefreshSelector($_refreshSelector) {
595
-		$this->_refreshSelector = $_refreshSelector;
595
+		$this->_refreshSelector=$_refreshSelector;
596 596
 		return $this;
597 597
 	}
598 598
 
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 	public function show($modelInstance) {
605 605
 		if (\is_array($modelInstance)) {
606 606
 			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
607
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
607
+				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
608 608
 		}
609
-		$this->_modelInstance = $modelInstance;
609
+		$this->_modelInstance=$modelInstance;
610 610
 	}
611 611
 
612 612
 	public function getRowClass() {
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * @return DataTable
621 621
 	 */
622 622
 	public function setRowClass($_rowClass) {
623
-		$this->_rowClass = $_rowClass;
623
+		$this->_rowClass=$_rowClass;
624 624
 		return $this;
625 625
 	}
626 626
 
@@ -631,16 +631,16 @@  discard block
 block discarded – undo
631 631
 	 * @return DataTable
632 632
 	 */
633 633
 	public function setEmptyMessage($_emptyMessage) {
634
-		$this->_emptyMessage = $_emptyMessage;
634
+		$this->_emptyMessage=$_emptyMessage;
635 635
 		return $this;
636 636
 	}
637 637
 
638
-	public function setSortable($colIndex = NULL) {
639
-		$this->_sortable = $colIndex;
638
+	public function setSortable($colIndex=NULL) {
639
+		$this->_sortable=$colIndex;
640 640
 		return $this;
641 641
 	}
642 642
 
643
-	public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) {
643
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
644 644
 		$this->_self->setActiveRowSelector($class, $event, $multiple);
645 645
 		return $this;
646 646
 	}
@@ -654,19 +654,19 @@  discard block
 block discarded – undo
654 654
 	}
655 655
 
656 656
 	public function hideColumn($colIndex) {
657
-		if (! \is_array($this->_hiddenColumns))
658
-			$this->_hiddenColumns = [];
659
-		$this->_hiddenColumns[] = $colIndex;
657
+		if (!\is_array($this->_hiddenColumns))
658
+			$this->_hiddenColumns=[];
659
+		$this->_hiddenColumns[]=$colIndex;
660 660
 		return $this;
661 661
 	}
662 662
 
663 663
 	public function setColWidth($colIndex, $width) {
664
-		$this->_colWidths[$colIndex] = $width;
664
+		$this->_colWidths[$colIndex]=$width;
665 665
 		return $this;
666 666
 	}
667 667
 
668 668
 	public function setColWidths($_colWidths) {
669
-		$this->_colWidths = $_colWidths;
669
+		$this->_colWidths=$_colWidths;
670 670
 		return $this;
671 671
 	}
672 672
 
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		return $this;
676 676
 	}
677 677
 
678
-	public function trigger($event, $params = "[]") {
678
+	public function trigger($event, $params="[]") {
679 679
 		return $this->getHtmlComponent()->trigger($event, $params);
680 680
 	}
681 681
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	 * @param mixed $_displayBehavior
714 714
 	 */
715 715
 	public function setDisplayBehavior($_displayBehavior) {
716
-		$this->_displayBehavior = $_displayBehavior;
716
+		$this->_displayBehavior=$_displayBehavior;
717 717
 	}
718 718
 
719 719
 	/**
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	}
734 734
 
735 735
 	public function addGroupBy($index) {
736
-		$index = $this->_getIndex($index);
737
-		if ($index !== false) {
736
+		$index=$this->_getIndex($index);
737
+		if ($index!==false) {
738 738
 			$this->_instanceViewer->addGroupBy($index);
739 739
 		}
740 740
 	}
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 * @param boolean $_visibleHover
745 745
 	 */
746 746
 	public function setVisibleHover($_visibleHover) {
747
-		$this->_visibleHover = $_visibleHover;
747
+		$this->_visibleHover=$_visibleHover;
748 748
 	}
749 749
 
750 750
 	/**
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 		return $this->_paginationToolbar;
756 756
 	}
757 757
 
758
-	public function setInverted($recursive = true) {
758
+	public function setInverted($recursive=true) {
759 759
 		$this->getHtmlComponent()->setInverted($recursive);
760 760
 		if ($this->_emptyMessage instanceof HtmlSemDoubleElement) {
761 761
 			$this->_emptyMessage->setInverted($recursive);
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 	}
768 768
 
769 769
 	public function setFormCaption($caption) {
770
-		$this->_caption = $caption;
770
+		$this->_caption=$caption;
771 771
 	}
772 772
 
773 773
 	/**
@@ -783,6 +783,6 @@  discard block
 block discarded – undo
783 783
 	 * @param mixed $namePrefix
784 784
 	 */
785 785
 	public function setNamePrefix($namePrefix): void {
786
-		$this->_namePrefix = $namePrefix;
786
+		$this->_namePrefix=$namePrefix;
787 787
 	}
788 788
 }
Please login to merge, or discard this patch.
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -89,10 +89,12 @@  discard block
 block discarded – undo
89 89
 					"stopPropagation" => true
90 90
 				]);
91 91
 			}
92
-			if (\is_array($this->_deleteBehavior))
93
-				$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
94
-			if (\is_array($this->_editBehavior))
95
-				$this->_generateBehavior("edit", $this->_editBehavior, $js);
92
+			if (\is_array($this->_deleteBehavior)) {
93
+							$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
94
+			}
95
+			if (\is_array($this->_editBehavior)) {
96
+							$this->_generateBehavior("edit", $this->_editBehavior, $js);
97
+			}
96 98
 			if (\is_array($this->_displayBehavior)) {
97 99
 				$this->_generateBehavior("display", $this->_displayBehavior, $js);
98 100
 			}
@@ -150,8 +152,9 @@  discard block
 block discarded – undo
150 152
 			$table->setRowCount(0, \count($captions));
151 153
 			$this->_generateHeader($table, $captions);
152 154
 
153
-			if (isset($this->_compileParts))
154
-				$table->setCompileParts($this->_compileParts);
155
+			if (isset($this->_compileParts)) {
156
+							$table->setCompileParts($this->_compileParts);
157
+			}
155 158
 
156 159
 			$this->_generateContent($table);
157 160
 
@@ -189,8 +192,9 @@  discard block
 block discarded – undo
189 192
 	}
190 193
 
191 194
 	protected function _applyStyleAttributes($table) {
192
-		if (isset($this->_hiddenColumns))
193
-			$this->_hideColumns();
195
+		if (isset($this->_hiddenColumns)) {
196
+					$this->_hideColumns();
197
+		}
194 198
 		if (isset($this->_colWidths)) {
195 199
 			foreach ($this->_colWidths as $colIndex => $width) {
196 200
 				$table->setColWidth($colIndex, $width);
@@ -303,8 +307,9 @@  discard block
 block discarded – undo
303 307
 			$field = $ck->getField();
304 308
 			$field->setProperty("value", $dataAjax);
305 309
 			$field->setProperty("name", "selection[]");
306
-			if (isset($checkedClass))
307
-				$field->setClass($checkedClass);
310
+			if (isset($checkedClass)) {
311
+							$field->setClass($checkedClass);
312
+			}
308 313
 			\array_unshift($values, $ck);
309 314
 		}
310 315
 		$result = $table->newRow();
@@ -321,8 +326,9 @@  discard block
 block discarded – undo
321 326
 
322 327
 	protected function _generatePagination($table) {
323 328
 		if (isset($this->_toolbar)) {
324
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
325
-				$this->_toolbar->setFloated("left");
329
+			if ($this->_toolbarPosition == PositionInTable::FOOTER) {
330
+							$this->_toolbar->setFloated("left");
331
+			}
326 332
 		}
327 333
 		$footer = $table->getFooter();
328 334
 		$footer->mergeCol();
@@ -364,8 +370,9 @@  discard block
 block discarded – undo
364 370
 
365 371
 	protected function _getFieldName($index) {
366 372
 		$fieldName = parent::_getFieldName($index);
367
-		if (\is_object($fieldName))
368
-			$fieldName = "field-" . $index;
373
+		if (\is_object($fieldName)) {
374
+					$fieldName = "field-" . $index;
375
+		}
369 376
 		if ($this->_namePrefix != null) {
370 377
 			$fieldName = $this->_namePrefix . '.' . $fieldName;
371 378
 		}
@@ -557,8 +564,9 @@  discard block
 block discarded – undo
557 564
 
558 565
 	protected function getTargetSelector($op) {
559 566
 		$result = $this->_targetSelector;
560
-		if (! isset($result[$op]))
561
-			$result = "#" . $this->identifier;
567
+		if (! isset($result[$op])) {
568
+					$result = "#" . $this->identifier;
569
+		}
562 570
 		return $result[$op];
563 571
 	}
564 572
 
@@ -581,8 +589,9 @@  discard block
 block discarded – undo
581 589
 	}
582 590
 
583 591
 	public function getRefreshSelector() {
584
-		if (isset($this->_refreshSelector))
585
-			return $this->_refreshSelector;
592
+		if (isset($this->_refreshSelector)) {
593
+					return $this->_refreshSelector;
594
+		}
586 595
 		return "#" . $this->identifier . " tbody";
587 596
 	}
588 597
 
@@ -603,8 +612,9 @@  discard block
 block discarded – undo
603 612
 	 */
604 613
 	public function show($modelInstance) {
605 614
 		if (\is_array($modelInstance)) {
606
-			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
607
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
615
+			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
616
+							$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
617
+			}
608 618
 		}
609 619
 		$this->_modelInstance = $modelInstance;
610 620
 	}
@@ -654,8 +664,9 @@  discard block
 block discarded – undo
654 664
 	}
655 665
 
656 666
 	public function hideColumn($colIndex) {
657
-		if (! \is_array($this->_hiddenColumns))
658
-			$this->_hiddenColumns = [];
667
+		if (! \is_array($this->_hiddenColumns)) {
668
+					$this->_hiddenColumns = [];
669
+		}
659 670
 		$this->_hiddenColumns[] = $colIndex;
660 671
 		return $this;
661 672
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 trait TableTrait {
12 12
 
13
-	abstract public function addEvent($event, $jsCode, $stopPropagation = false, $preventDefault = false);
13
+	abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false);
14 14
 
15
-	abstract public function getOn($event, $url, $responseElement = "", $parameters = array());
15
+	abstract public function getOn($event, $url, $responseElement="", $parameters=array());
16 16
 
17 17
 	protected function addToPropertyTable($property, $value) {
18 18
 		return $this->_self->addToProperty($property, $value);
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 		return $this->addToPropertyTable("class", "celled");
23 23
 	}
24 24
 
25
-	public function setBasic($very = false) {
26
-		$table = $this->_self;
25
+	public function setBasic($very=false) {
26
+		$table=$this->_self;
27 27
 		if ($very)
28 28
 			$table->addToPropertyCtrl("class", "very", array(
29 29
 				"very"
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 		));
34 34
 	}
35 35
 
36
-	public function setCompact($very = false) {
37
-		$table = $this->_self;
36
+	public function setCompact($very=false) {
37
+		$table=$this->_self;
38 38
 		if ($very)
39 39
 			$table->addToPropertyCtrl("class", "very", array(
40 40
 				"very"
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 		return $this->addToPropertyTable("class", "structured");
57 57
 	}
58 58
 
59
-	public function setSortable($colIndex = NULL) {
60
-		$table = $this->_self;
59
+	public function setSortable($colIndex=NULL) {
60
+		$table=$this->_self;
61 61
 		if (isset($colIndex) && $table->hasPart("thead")) {
62 62
 			$table->getHeader()->sort($colIndex);
63 63
 		}
@@ -80,30 +80,30 @@  discard block
 block discarded – undo
80 80
 		return $this->addToPropertyTable("class", "striped");
81 81
 	}
82 82
 
83
-	public function onRowClick($jsCode, $stopPropagation = false, $preventDefault = false) {
83
+	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) {
84 84
 		return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault);
85 85
 	}
86 86
 
87
-	public function onRow($event, $jsCode, $stopPropagation = false, $preventDefault = false) {
88
-		return $this->_self->addEvent($event . "{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
87
+	public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
88
+		return $this->_self->addEvent($event."{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
89 89
 	}
90 90
 
91
-	public function getOnRow($event, $url, $responseElement = "", $parameters = array()) {
92
-		$activeClass = $this->_self->getActiveRowClass();
93
-		$jsCondition = '(!$(this).closest("tr").hasClass("' . $activeClass . '") || event.target.tagName === "TR")';
91
+	public function getOnRow($event, $url, $responseElement="", $parameters=array()) {
92
+		$activeClass=$this->_self->getActiveRowClass();
93
+		$jsCondition='(!$(this).closest("tr").hasClass("'.$activeClass.'") || event.target.tagName === "TR")';
94 94
 		if (isset($parameters['jsCondition'])) {
95
-			$jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')';
95
+			$jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')';
96 96
 		}
97
-		$parameters = \array_merge($parameters, [
97
+		$parameters=\array_merge($parameters, [
98 98
 			"stopPropagation" => false,
99 99
 			"preventDefault" => false,
100 100
 			"jsCondition" => $jsCondition
101 101
 		]);
102
-		$selector = "tbody tr";
102
+		$selector="tbody tr";
103 103
 		if (isset($parameters["selector"])) {
104
-			$selector = $parameters["selector"];
104
+			$selector=$parameters["selector"];
105 105
 		}
106
-		return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters);
106
+		return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters);
107 107
 	}
108 108
 
109 109
 	public function onPageChange($jsCode) {
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 		return $this->_self->getBsComponent()->getScript();
121 121
 	}
122 122
 
123
-	public function addEventsOnRun(JsUtils $js = NULL) {
124
-		$script = parent::addEventsOnRun($js);
125
-		$innerScript = $this->_self->getInnerScript();
126
-		if (! isset($innerScript)) {
123
+	public function addEventsOnRun(JsUtils $js=NULL) {
124
+		$script=parent::addEventsOnRun($js);
125
+		$innerScript=$this->_self->getInnerScript();
126
+		if (!isset($innerScript)) {
127 127
 			$this->_self->setInnerScript($script);
128 128
 		}
129 129
 		return $script;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 2 patches
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 	private $_activeRowSelector;
33 33
 
34
-	private $_focusable = false;
34
+	private $_focusable=false;
35 35
 
36 36
 	/**
37 37
 	 *
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
 
46 46
 	public function __construct($identifier, $rowCount, $colCount) {
47 47
 		parent::__construct($identifier, "table", "ui table");
48
-		$this->content = array();
48
+		$this->content=array();
49 49
 		$this->setRowCount($rowCount, $colCount);
50
-		$this->_variations = [
50
+		$this->_variations=[
51 51
 			Variation::CELLED,
52 52
 			Variation::PADDED,
53 53
 			Variation::COMPACT
54 54
 		];
55
-		$this->_compileParts = [
55
+		$this->_compileParts=[
56 56
 			"thead",
57 57
 			"tbody",
58 58
 			"tfoot"
59 59
 		];
60
-		$this->_afterCompileEvents = [];
60
+		$this->_afterCompileEvents=[];
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @return HtmlTableContent
68 68
 	 */
69 69
 	public function getPart($key) {
70
-		if (\array_key_exists($key, $this->content) === false) {
71
-			$this->content[$key] = new HtmlTableContent("", $key);
72
-			if ($key !== "tbody") {
70
+		if (\array_key_exists($key, $this->content)===false) {
71
+			$this->content[$key]=new HtmlTableContent("", $key);
72
+			if ($key!=="tbody") {
73 73
 				$this->content[$key]->setRowCount(1, $this->_colCount);
74 74
 			}
75 75
 		}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return boolean
127 127
 	 */
128 128
 	public function hasPart($key) {
129
-		return \array_key_exists($key, $this->content) === true;
129
+		return \array_key_exists($key, $this->content)===true;
130 130
 	}
131 131
 
132 132
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @return HtmlTableContent
137 137
 	 */
138 138
 	public function setRowCount($rowCount, $colCount) {
139
-		$this->_colCount = $colCount;
139
+		$this->_colCount=$colCount;
140 140
 		return $this->getBody()->setRowCount($rowCount, $colCount);
141 141
 	}
142 142
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param array $values
168 168
 	 * @return HtmlTR
169 169
 	 */
170
-	public function addRow($values = array()) {
171
-		$row = $this->getBody()->addRow($this->_colCount);
170
+	public function addRow($values=array()) {
171
+		$row=$this->getBody()->addRow($this->_colCount);
172 172
 		$row->setValues(\array_values($values));
173 173
 		return $row;
174 174
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 *        	values in an array of array
190 190
 	 * @return HtmlTable
191 191
 	 */
192
-	public function setValues($values = array()) {
192
+	public function setValues($values=array()) {
193 193
 		$this->getBody()->setValues($values);
194 194
 		return $this;
195 195
 	}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param array $values
201 201
 	 * @return HtmlTableContent
202 202
 	 */
203
-	public function setHeaderValues($values = array()) {
203
+	public function setHeaderValues($values=array()) {
204 204
 		return $this->getHeader()->setValues($values);
205 205
 	}
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param array $values
211 211
 	 * @return HtmlTableContent
212 212
 	 */
213
-	public function setFooterValues($values = array()) {
213
+	public function setFooterValues($values=array()) {
214 214
 		return $this->getFooter()->setValues($values);
215 215
 	}
216 216
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @param array $values
222 222
 	 * @return HtmlTable
223 223
 	 */
224
-	public function setColValues($colIndex, $values = array()) {
224
+	public function setColValues($colIndex, $values=array()) {
225 225
 		$this->getBody()->setColValues($colIndex, $values);
226 226
 		return $this;
227 227
 	}
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 	 * @param array $values
234 234
 	 * @return HtmlTable
235 235
 	 */
236
-	public function setRowValues($rowIndex, $values = array()) {
236
+	public function setRowValues($rowIndex, $values=array()) {
237 237
 		$this->getBody()->setRowValues($rowIndex, $values);
238 238
 		return $this;
239 239
 	}
240 240
 
241
-	public function addColVariations($colIndex, $variations = array()) {
241
+	public function addColVariations($colIndex, $variations=array()) {
242 242
 		return $this->getBody()->addColVariations($colIndex, $variations);
243 243
 	}
244 244
 
@@ -305,19 +305,19 @@  discard block
 block discarded – undo
305 305
 	public function setColAlignment($colIndex, $alignment) {
306 306
 		switch ($alignment) {
307 307
 			case TextAlignment::LEFT:
308
-				$function = "colLeft";
308
+				$function="colLeft";
309 309
 				break;
310 310
 
311 311
 			case TextAlignment::RIGHT:
312
-				$function = "colRight";
312
+				$function="colRight";
313 313
 				break;
314 314
 
315 315
 			case TextAlignment::CENTER:
316
-				$function = "colCenter";
316
+				$function="colCenter";
317 317
 				break;
318 318
 
319 319
 			default:
320
-				$function = "colLeft";
320
+				$function="colLeft";
321 321
 		}
322 322
 		$this->colAlign($colIndex, $function);
323 323
 		return $this;
@@ -326,19 +326,19 @@  discard block
 block discarded – undo
326 326
 	public function setColAlignmentFromRight($colIndex, $alignment) {
327 327
 		switch ($alignment) {
328 328
 			case TextAlignment::LEFT:
329
-				$function = "colLeftFromRight";
329
+				$function="colLeftFromRight";
330 330
 				break;
331 331
 
332 332
 			case TextAlignment::RIGHT:
333
-				$function = "colRightFromRight";
333
+				$function="colRightFromRight";
334 334
 				break;
335 335
 
336 336
 			case TextAlignment::CENTER:
337
-				$function = "colCenterFromRight";
337
+				$function="colCenterFromRight";
338 338
 				break;
339 339
 
340 340
 			default:
341
-				$function = "colLeftFromRight";
341
+				$function="colLeftFromRight";
342 342
 		}
343 343
 		$this->colAlign($colIndex, $function);
344 344
 		return $this;
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @see HtmlSemDoubleElement::compile()
416 416
 	 */
417
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
418
-		if (\sizeof($this->_compileParts) < 3) {
419
-			$this->_template = "%content%";
417
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
418
+		if (\sizeof($this->_compileParts)<3) {
419
+			$this->_template="%content%";
420 420
 			$this->refresh($js);
421 421
 		}
422
-		$this->content = JArray::sortAssociative($this->content, $this->_compileParts);
422
+		$this->content=JArray::sortAssociative($this->content, $this->_compileParts);
423 423
 		return parent::compile($js, $view);
424 424
 	}
425 425
 
426
-	protected function compile_once(JsUtils $js = NULL, &$view = NULL) {
426
+	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
427 427
 		parent::compile_once($js, $view);
428 428
 		if ($this->propertyContains("class", "sortable")) {
429
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
429
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
430 430
 		}
431 431
 	}
432 432
 
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 	 * @see BaseHtml::fromDatabaseObject()
438 438
 	 */
439 439
 	public function fromDatabaseObject($object, $function) {
440
-		$result = $function($object);
440
+		$result=$function($object);
441 441
 		if (\is_array($result)) {
442
-			$result = $this->addRow($function($object));
442
+			$result=$this->addRow($function($object));
443 443
 		} else {
444
-			$result = $this->getBody()->_addRow($result);
444
+			$result=$this->getBody()->_addRow($result);
445 445
 		}
446 446
 		if (isset($this->_afterCompileEvents["onNewRow"])) {
447 447
 			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
@@ -457,10 +457,10 @@  discard block
 block discarded – undo
457 457
 	 *        	array of thead,tbody,tfoot
458 458
 	 * @return HtmlTable
459 459
 	 */
460
-	public function setCompileParts($parts = [
460
+	public function setCompileParts($parts=[
461 461
 		"tbody"
462 462
 	]) {
463
-		$this->_compileParts = $parts;
463
+		$this->_compileParts=$parts;
464 464
 		return $this;
465 465
 	}
466 466
 
@@ -470,22 +470,22 @@  discard block
 block discarded – undo
470 470
 	}
471 471
 
472 472
 	public function refresh($js) {
473
-		$this->_footer = $this->getFooter();
473
+		$this->_footer=$this->getFooter();
474 474
 		if (isset($js)) {
475
-			$js->exec('$("#' . $this->identifier . ' tfoot").replaceWith("' . \addslashes($this->_footer) . '");', true);
475
+			$js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");', true);
476 476
 		}
477 477
 	}
478 478
 
479 479
 	public function run(JsUtils $js) {
480
-		if (! $this->_runned) {
480
+		if (!$this->_runned) {
481 481
 			if (isset($this->_activeRowSelector)) {
482 482
 				$this->_activeRowSelector->run();
483 483
 			}
484 484
 		}
485
-		$result = parent::run($js);
485
+		$result=parent::run($js);
486 486
 		if (isset($this->_footer))
487 487
 			$this->_footer->run($js);
488
-		$this->_runned = true;
488
+		$this->_runned=true;
489 489
 		return $result;
490 490
 	}
491 491
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 * @return HtmlTable
498 498
 	 */
499 499
 	public function onNewRow($callback) {
500
-		$this->_afterCompileEvents["onNewRow"] = $callback;
500
+		$this->_afterCompileEvents["onNewRow"]=$callback;
501 501
 		return $this;
502 502
 	}
503 503
 
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	 * @param boolean $multiple
510 510
 	 * @return HtmlTable
511 511
 	 */
512
-	public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) {
513
-		$this->_activeRowSelector = new ActiveRow($this, $class, $event, $multiple);
512
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
513
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
514 514
 		return $this;
515 515
 	}
516 516
 
@@ -537,29 +537,29 @@  discard block
 block discarded – undo
537 537
 	}
538 538
 
539 539
 	public function setColWidth($colIndex, $width) {
540
-		$part = $this->_getFirstPart();
541
-		if ($part !== null && $part->count() > 0)
540
+		$part=$this->_getFirstPart();
541
+		if ($part!==null && $part->count()>0)
542 542
 			$part->getCell(0, $colIndex)->setWidth($width);
543 543
 		return $this;
544 544
 	}
545 545
 
546 546
 	public function setColWidths($widths) {
547
-		$part = $this->_getFirstPart();
548
-		if ($part !== null && $part->count() > 0) {
549
-			$count = $part->getColCount();
550
-			if (! \is_array($widths)) {
551
-				$widths = \array_fill(0, $count, $widths);
547
+		$part=$this->_getFirstPart();
548
+		if ($part!==null && $part->count()>0) {
549
+			$count=$part->getColCount();
550
+			if (!\is_array($widths)) {
551
+				$widths=\array_fill(0, $count, $widths);
552 552
 			}
553
-			$max = \min(\sizeof($widths), $count);
554
-			for ($i = 0; $i < $max; $i ++) {
553
+			$max=\min(\sizeof($widths), $count);
554
+			for ($i=0; $i<$max; $i++) {
555 555
 				$part->getCell(0, $i)->setWidth($widths[$i]);
556 556
 			}
557 557
 		}
558 558
 		return $this;
559 559
 	}
560 560
 
561
-	public function mergeIdentiqualValues($colIndex, $function = "strip_tags") {
562
-		$body = $this->getBody();
561
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
562
+		$body=$this->getBody();
563 563
 		$body->mergeIdentiqualValues($colIndex, $function);
564 564
 		return $this;
565 565
 	}
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * @param mixed $_innerScript
578 578
 	 */
579 579
 	public function setInnerScript($_innerScript) {
580
-		$this->_innerScript = $_innerScript;
580
+		$this->_innerScript=$_innerScript;
581 581
 	}
582 582
 
583 583
 	public function onActiveRowChange($jsCode) {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 		return $this;
586 586
 	}
587 587
 
588
-	public function addMergeRow($colCount, $value = null) {
588
+	public function addMergeRow($colCount, $value=null) {
589 589
 		return $this->getBody()->addMergeRow($colCount, $value);
590 590
 	}
591 591
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -444,8 +444,9 @@  discard block
 block discarded – undo
444 444
 			$result = $this->getBody()->_addRow($result);
445 445
 		}
446 446
 		if (isset($this->_afterCompileEvents["onNewRow"])) {
447
-			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
448
-				$this->_afterCompileEvents["onNewRow"]($result, $object);
447
+			if (\is_callable($this->_afterCompileEvents["onNewRow"])) {
448
+							$this->_afterCompileEvents["onNewRow"]($result, $object);
449
+			}
449 450
 		}
450 451
 		return $result;
451 452
 	}
@@ -483,8 +484,9 @@  discard block
 block discarded – undo
483 484
 			}
484 485
 		}
485 486
 		$result = parent::run($js);
486
-		if (isset($this->_footer))
487
-			$this->_footer->run($js);
487
+		if (isset($this->_footer)) {
488
+					$this->_footer->run($js);
489
+		}
488 490
 		$this->_runned = true;
489 491
 		return $result;
490 492
 	}
@@ -538,8 +540,9 @@  discard block
 block discarded – undo
538 540
 
539 541
 	public function setColWidth($colIndex, $width) {
540 542
 		$part = $this->_getFirstPart();
541
-		if ($part !== null && $part->count() > 0)
542
-			$part->getCell(0, $colIndex)->setWidth($width);
543
+		if ($part !== null && $part->count() > 0) {
544
+					$part->getCell(0, $colIndex)->setWidth($width);
545
+		}
543 546
 		return $this;
544 547
 	}
545 548
 
Please login to merge, or discard this patch.