@@ -25,7 +25,7 @@ discard block |
||
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 |
||
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 |
||
51 | 51 | |
52 | 52 | protected $_json; |
53 | 53 | |
54 | - protected $_rowClass = "_element"; |
|
54 | + protected $_rowClass="_element"; |
|
55 | 55 | |
56 | 56 | protected $_sortable; |
57 | 57 | |
@@ -61,26 +61,26 @@ discard block |
||
61 | 61 | |
62 | 62 | protected $_paginationToolbar; |
63 | 63 | |
64 | - public function __construct($identifier, $model, $modelInstance = NULL) { |
|
64 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
65 | 65 | parent::__construct($identifier, $model, $modelInstance); |
66 | 66 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
67 | - $this->_urls = []; |
|
68 | - $this->_emptyMessage = new HtmlMessage("", "nothing to display"); |
|
67 | + $this->_urls=[]; |
|
68 | + $this->_emptyMessage=new HtmlMessage("", "nothing to display"); |
|
69 | 69 | $this->_emptyMessage->setIcon("info circle"); |
70 | 70 | } |
71 | 71 | |
72 | 72 | public function run(JsUtils $js) { |
73 | - if ($this->_runned !== true) { |
|
74 | - $offset = $js->scriptCount(); |
|
73 | + if ($this->_runned!==true) { |
|
74 | + $offset=$js->scriptCount(); |
|
75 | 75 | if ($this->_hasCheckboxes && isset($js)) { |
76 | 76 | $this->_runCheckboxes($js); |
77 | 77 | } |
78 | 78 | if ($this->_visibleHover) { |
79 | - $js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
79 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
80 | 80 | "preventDefault" => false, |
81 | 81 | "stopPropagation" => true |
82 | 82 | ]); |
83 | - $js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [ |
|
83 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [ |
|
84 | 84 | "preventDefault" => false, |
85 | 85 | "stopPropagation" => true |
86 | 86 | ]); |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | if (isset($this->_pagination)) |
97 | 97 | $this->_associatePaginationBehavior($js, $offset); |
98 | 98 | $this->_associateSearchFieldBehavior($js, $offset); |
99 | - $this->_runned = true; |
|
99 | + $this->_runned=true; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | protected function _generateBehavior($op, $params, JsUtils $js) { |
104 | 104 | if (isset($this->_urls[$op])) { |
105 | - $params = \array_merge($params, [ |
|
105 | + $params=\array_merge($params, [ |
|
106 | 106 | "attr" => "data-ajax" |
107 | 107 | ]); |
108 | - $js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
108 | + $js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -124,21 +124,21 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | public function refreshTD($fieldName, $jquery, $view) { |
127 | - $index = $this->_getIndex($fieldName); |
|
127 | + $index=$this->_getIndex($fieldName); |
|
128 | 128 | $this->compile($jquery, $view); |
129 | 129 | return $this->refreshTR() |
130 | 130 | ->getTable() |
131 | 131 | ->getCell(0, $index); |
132 | 132 | } |
133 | 133 | |
134 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
135 | - if (! $this->_generated) { |
|
134 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
135 | + if (!$this->_generated) { |
|
136 | 136 | if (isset($this->_buttonsColumn)) { |
137 | 137 | $this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons); |
138 | 138 | } |
139 | 139 | $this->_instanceViewer->setInstance($this->_model); |
140 | - $captions = $this->_instanceViewer->getCaptions(); |
|
141 | - $table = $this->content["table"]; |
|
140 | + $captions=$this->_instanceViewer->getCaptions(); |
|
141 | + $table=$this->content["table"]; |
|
142 | 142 | if ($this->_hasCheckboxes) { |
143 | 143 | $this->_generateMainCheckbox($captions); |
144 | 144 | } |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | $this->compileExtraElements($table, $captions); |
154 | 154 | $this->_compileSearchFieldBehavior($js); |
155 | 155 | |
156 | - $this->content = JArray::sortAssociative($this->content, [ |
|
156 | + $this->content=JArray::sortAssociative($this->content, [ |
|
157 | 157 | PositionInTable::BEFORETABLE, |
158 | 158 | "table", |
159 | 159 | PositionInTable::AFTERTABLE |
160 | 160 | ]); |
161 | 161 | $this->_compileForm(); |
162 | 162 | $this->_applyStyleAttributes($table); |
163 | - $this->_generated = true; |
|
163 | + $this->_generated=true; |
|
164 | 164 | } |
165 | 165 | return parent::compile($js, $view); |
166 | 166 | } |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | protected function _generateHeader(HtmlTable $table, $captions) { |
201 | - $gbFields = $this->_instanceViewer->getGroupByFields(); |
|
201 | + $gbFields=$this->_instanceViewer->getGroupByFields(); |
|
202 | 202 | if (\is_array($gbFields)) { |
203 | - $captions = \array_values(JArray::removeByKeys($captions, $gbFields)); |
|
203 | + $captions=\array_values(JArray::removeByKeys($captions, $gbFields)); |
|
204 | 204 | } |
205 | 205 | $table->setHeaderValues($captions); |
206 | 206 | if (isset($this->_sortable)) { |
@@ -209,22 +209,22 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | protected function _generateContent($table) { |
212 | - $objects = $this->_modelInstance; |
|
212 | + $objects=$this->_modelInstance; |
|
213 | 213 | if (isset($this->_pagination)) { |
214 | - $objects = $this->_pagination->getObjects($this->_modelInstance); |
|
214 | + $objects=$this->_pagination->getObjects($this->_modelInstance); |
|
215 | 215 | } |
216 | 216 | InstanceViewer::setIndex(0); |
217 | - $fields = $this->_instanceViewer->getSimpleProperties(); |
|
218 | - $groupByFields = $this->_instanceViewer->getGroupByFields(); |
|
219 | - if (! is_array($groupByFields)) { |
|
220 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) { |
|
217 | + $fields=$this->_instanceViewer->getSimpleProperties(); |
|
218 | + $groupByFields=$this->_instanceViewer->getGroupByFields(); |
|
219 | + if (!is_array($groupByFields)) { |
|
220 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) { |
|
221 | 221 | return $this->_generateRow($instance, $fields, $table); |
222 | 222 | }); |
223 | 223 | } else { |
224 | - $diffFields = \array_values(JArray::removeByKeys($fields, $groupByFields)); |
|
225 | - $activeValues = \array_combine($groupByFields, \array_fill(0, \count($groupByFields), null)); |
|
226 | - $uuids = []; |
|
227 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) { |
|
224 | + $diffFields=\array_values(JArray::removeByKeys($fields, $groupByFields)); |
|
225 | + $activeValues=\array_combine($groupByFields, \array_fill(0, \count($groupByFields), null)); |
|
226 | + $uuids=[]; |
|
227 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) { |
|
228 | 228 | $this->_instanceViewer->setInstance($instance); |
229 | 229 | foreach ($groupByFields as $index => $gbField) { |
230 | 230 | $this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids); |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | return $this->_generateRow($instance, $diffFields, $table, null, $uuids); |
233 | 233 | }); |
234 | 234 | } |
235 | - if ($table->getRowCount() == 0) { |
|
236 | - $result = $table->addRow(); |
|
235 | + if ($table->getRowCount()==0) { |
|
236 | + $result=$table->addRow(); |
|
237 | 237 | $result->mergeRow(); |
238 | 238 | $result->setValues([ |
239 | 239 | $this->_emptyMessage |
@@ -242,20 +242,20 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) { |
245 | - $newValue = $this->_instanceViewer->getValue($gbField); |
|
246 | - if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) { |
|
247 | - if ($index == 0) { |
|
248 | - $uuids = []; |
|
245 | + $newValue=$this->_instanceViewer->getValue($gbField); |
|
246 | + if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) { |
|
247 | + if ($index==0) { |
|
248 | + $uuids=[]; |
|
249 | 249 | } |
250 | - $uuid = uniqid("grp"); |
|
251 | - $uuids[$gbField] = $uuid; |
|
252 | - $id = $this->_instanceViewer->getIdentifier(); |
|
253 | - $result = $table->addMergeRow(sizeof($fields) + 1, $newValue); |
|
254 | - $result->setIdentifier($this->identifier . "-tr-gb-" . $id); |
|
250 | + $uuid=uniqid("grp"); |
|
251 | + $uuids[$gbField]=$uuid; |
|
252 | + $id=$this->_instanceViewer->getIdentifier(); |
|
253 | + $result=$table->addMergeRow(sizeof($fields)+1, $newValue); |
|
254 | + $result->setIdentifier($this->identifier."-tr-gb-".$id); |
|
255 | 255 | $result->setProperty("data-ajax", $id); |
256 | 256 | $result->setProperty("data-group", $uuid); |
257 | 257 | $result->addToProperty("class", $this->_rowClass); |
258 | - $activeValues[$gbField] = $newValue; |
|
258 | + $activeValues[$gbField]=$newValue; |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | public function getFieldValue($index) { |
270 | - $index = $this->_getIndex($index); |
|
270 | + $index=$this->_getIndex($index); |
|
271 | 271 | if (is_numeric($index)) { |
272 | - $values = $this->_instanceViewer->getValues(); |
|
272 | + $values=$this->_instanceViewer->getValues(); |
|
273 | 273 | if (isset($values[$index])) { |
274 | 274 | return $values[$index]; |
275 | 275 | } |
@@ -277,30 +277,30 @@ discard block |
||
277 | 277 | return null; |
278 | 278 | } |
279 | 279 | |
280 | - protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) { |
|
280 | + protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) { |
|
281 | 281 | $this->_instanceViewer->setInstance($instance); |
282 | - InstanceViewer::$index ++; |
|
283 | - $values = $this->_instanceViewer->getValues(); |
|
284 | - $id = $this->_instanceViewer->getIdentifier(); |
|
285 | - $dataAjax = $id; |
|
286 | - $id = $this->cleanIdentifier($id); |
|
282 | + InstanceViewer::$index++; |
|
283 | + $values=$this->_instanceViewer->getValues(); |
|
284 | + $id=$this->_instanceViewer->getIdentifier(); |
|
285 | + $dataAjax=$id; |
|
286 | + $id=$this->cleanIdentifier($id); |
|
287 | 287 | if ($this->_hasCheckboxes) { |
288 | - $ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, ""); |
|
289 | - $checked = false; |
|
288 | + $ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, ""); |
|
289 | + $checked=false; |
|
290 | 290 | if (isset($this->_checkedCallback)) { |
291 | - $func = $this->_checkedCallback; |
|
292 | - $checked = $func($instance); |
|
291 | + $func=$this->_checkedCallback; |
|
292 | + $checked=$func($instance); |
|
293 | 293 | } |
294 | 294 | $ck->setChecked($checked); |
295 | - $field = $ck->getField(); |
|
295 | + $field=$ck->getField(); |
|
296 | 296 | $field->setProperty("value", $dataAjax); |
297 | 297 | $field->setProperty("name", "selection[]"); |
298 | 298 | if (isset($checkedClass)) |
299 | 299 | $field->setClass($checkedClass); |
300 | 300 | \array_unshift($values, $ck); |
301 | 301 | } |
302 | - $result = $table->newRow(); |
|
303 | - $result->setIdentifier($this->identifier . "-tr-" . $id); |
|
302 | + $result=$table->newRow(); |
|
303 | + $result->setIdentifier($this->identifier."-tr-".$id); |
|
304 | 304 | $result->setProperty("data-ajax", $dataAjax); |
305 | 305 | $result->setValues($values); |
306 | 306 | $result->addToProperty("class", $this->_rowClass); |
@@ -313,63 +313,63 @@ discard block |
||
313 | 313 | |
314 | 314 | protected function _generatePagination($table) { |
315 | 315 | if (isset($this->_toolbar)) { |
316 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
316 | + if ($this->_toolbarPosition==PositionInTable::FOOTER) |
|
317 | 317 | $this->_toolbar->setFloated("left"); |
318 | 318 | } |
319 | - $footer = $table->getFooter(); |
|
319 | + $footer=$table->getFooter(); |
|
320 | 320 | $footer->mergeCol(); |
321 | - $this->_paginationToolbar = $this->_pagination->generateMenu($this->identifier); |
|
321 | + $this->_paginationToolbar=$this->_pagination->generateMenu($this->identifier); |
|
322 | 322 | $footer->addValues($this->_paginationToolbar); |
323 | 323 | } |
324 | 324 | |
325 | - protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) { |
|
325 | + protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) { |
|
326 | 326 | if (isset($this->_urls["refresh"])) { |
327 | - $menu = $this->_pagination->getMenu(); |
|
327 | + $menu=$this->_pagination->getMenu(); |
|
328 | 328 | if (isset($menu) && isset($js)) { |
329 | - $js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [ |
|
329 | + $js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [ |
|
330 | 330 | "preventDefault" => false, |
331 | 331 | "jqueryDone" => "replaceWith", |
332 | 332 | "hasLoader" => false, |
333 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");' |
|
333 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");' |
|
334 | 334 | ]); |
335 | - $page = $_POST["p"] ?? null; |
|
335 | + $page=$_POST["p"] ?? null; |
|
336 | 336 | if (isset($page)) { |
337 | - $js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("active");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("active");'); |
|
337 | + $js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("active");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("active");'); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | - protected function _compileSearchFieldBehavior(JsUtils $js = NULL) { |
|
343 | + protected function _compileSearchFieldBehavior(JsUtils $js=NULL) { |
|
344 | 344 | if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) { |
345 | - $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [ |
|
345 | + $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [ |
|
346 | 346 | "preventDefault" => false, |
347 | 347 | "jqueryDone" => "replaceWith", |
348 | 348 | "hasLoader" => "internal", |
349 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);' |
|
349 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);' |
|
350 | 350 | ]); |
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | - protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {} |
|
354 | + protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {} |
|
355 | 355 | |
356 | 356 | protected function _getFieldName($index) { |
357 | - $fieldName = parent::_getFieldName($index); |
|
357 | + $fieldName=parent::_getFieldName($index); |
|
358 | 358 | if (\is_object($fieldName)) |
359 | - $fieldName = "field-" . $index; |
|
360 | - return $fieldName . "[]"; |
|
359 | + $fieldName="field-".$index; |
|
360 | + return $fieldName."[]"; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | protected function _getFieldCaption($index) { |
364 | 364 | return null; |
365 | 365 | } |
366 | 366 | |
367 | - protected function applyToolbarPosition(string $position, $table, $captions = NULL) { |
|
367 | + protected function applyToolbarPosition(string $position, $table, $captions=NULL) { |
|
368 | 368 | switch ($position) { |
369 | 369 | case PositionInTable::BEFORETABLE: |
370 | 370 | case PositionInTable::AFTERTABLE: |
371 | - if (isset($this->_compileParts) === false) { |
|
372 | - $this->content[$position] = $this->_toolbar; |
|
371 | + if (isset($this->_compileParts)===false) { |
|
372 | + $this->content[$position]=$this->_toolbar; |
|
373 | 373 | } |
374 | 374 | break; |
375 | 375 | case PositionInTable::HEADER: |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - protected function _setToolbarPosition($table, $captions = NULL) { |
|
383 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
384 | 384 | if (\is_array($this->_toolbarPosition)) { |
385 | 385 | foreach ($this->_toolbarPosition as $tbp) { |
386 | 386 | $this->applyToolbarPosition($tbp, $table, $captions); |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | } |
407 | 407 | |
408 | 408 | private function addToolbarRow($part, $table, $captions) { |
409 | - $hasPart = $table->hasPart($part); |
|
409 | + $hasPart=$table->hasPart($part); |
|
410 | 410 | if ($hasPart) { |
411 | - $row = $table->getPart($part)->addRow(\sizeof($captions)); |
|
411 | + $row=$table->getPart($part)->addRow(\sizeof($captions)); |
|
412 | 412 | } else { |
413 | - $row = $table->getPart($part)->getRow(0); |
|
413 | + $row=$table->getPart($part)->getRow(0); |
|
414 | 414 | } |
415 | 415 | $row->mergeCol(); |
416 | 416 | $row->setValues([ |
@@ -442,12 +442,12 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function setUrls($urls) { |
444 | 444 | if (\is_array($urls)) { |
445 | - $this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0); |
|
446 | - $this->_urls["edit"] = JArray::getValue($urls, "edit", 1); |
|
447 | - $this->_urls["delete"] = JArray::getValue($urls, "delete", 2); |
|
448 | - $this->_urls["display"] = JArray::getValue($urls, "display", 3); |
|
445 | + $this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0); |
|
446 | + $this->_urls["edit"]=JArray::getValue($urls, "edit", 1); |
|
447 | + $this->_urls["delete"]=JArray::getValue($urls, "delete", 2); |
|
448 | + $this->_urls["display"]=JArray::getValue($urls, "display", 3); |
|
449 | 449 | } else { |
450 | - $this->_urls = [ |
|
450 | + $this->_urls=[ |
|
451 | 451 | "refresh" => $urls, |
452 | 452 | "edit" => $urls, |
453 | 453 | "delete" => $urls, |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | * The number of visible pages in the Pagination component |
471 | 471 | * @return DataTable |
472 | 472 | */ |
473 | - public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) { |
|
474 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
473 | + public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
474 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
475 | 475 | return $this; |
476 | 476 | } |
477 | 477 | |
@@ -486,8 +486,8 @@ discard block |
||
486 | 486 | * The number of visible pages in the Pagination component |
487 | 487 | * @return DataTable |
488 | 488 | */ |
489 | - public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) { |
|
490 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page); |
|
489 | + public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) { |
|
490 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page); |
|
491 | 491 | return $this; |
492 | 492 | } |
493 | 493 | |
@@ -496,10 +496,10 @@ discard block |
||
496 | 496 | * @param array $compileParts |
497 | 497 | * @return DataTable |
498 | 498 | */ |
499 | - public function refresh($compileParts = [ |
|
499 | + public function refresh($compileParts=[ |
|
500 | 500 | 'tbody' |
501 | 501 | ]) { |
502 | - $this->_compileParts = $compileParts; |
|
502 | + $this->_compileParts=$compileParts; |
|
503 | 503 | return $this; |
504 | 504 | } |
505 | 505 | |
@@ -509,14 +509,14 @@ discard block |
||
509 | 509 | * @param string $position |
510 | 510 | * @return \Ajax\common\html\HtmlDoubleElement |
511 | 511 | */ |
512 | - public function addSearchInToolbar($position = Direction::RIGHT) { |
|
512 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
513 | 513 | return $this->addInToolbar($this->getSearchField()) |
514 | 514 | ->setPosition($position); |
515 | 515 | } |
516 | 516 | |
517 | 517 | public function getSearchField() { |
518 | - if (isset($this->_searchField) === false) { |
|
519 | - $this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search..."); |
|
518 | + if (isset($this->_searchField)===false) { |
|
519 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
520 | 520 | $this->_searchField->addIcon("search", Direction::RIGHT); |
521 | 521 | } |
522 | 522 | return $this->_searchField; |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | protected function getTargetSelector($op) { |
547 | - $result = $this->_targetSelector; |
|
548 | - if (! isset($result[$op])) |
|
549 | - $result = "#" . $this->identifier; |
|
547 | + $result=$this->_targetSelector; |
|
548 | + if (!isset($result[$op])) |
|
549 | + $result="#".$this->identifier; |
|
550 | 550 | return $result[$op]; |
551 | 551 | } |
552 | 552 | |
@@ -558,20 +558,20 @@ discard block |
||
558 | 558 | * @return DataTable |
559 | 559 | */ |
560 | 560 | public function setTargetSelector($_targetSelector) { |
561 | - if (! \is_array($_targetSelector)) { |
|
562 | - $_targetSelector = [ |
|
561 | + if (!\is_array($_targetSelector)) { |
|
562 | + $_targetSelector=[ |
|
563 | 563 | "edit" => $_targetSelector, |
564 | 564 | "delete" => $_targetSelector |
565 | 565 | ]; |
566 | 566 | } |
567 | - $this->_targetSelector = $_targetSelector; |
|
567 | + $this->_targetSelector=$_targetSelector; |
|
568 | 568 | return $this; |
569 | 569 | } |
570 | 570 | |
571 | 571 | public function getRefreshSelector() { |
572 | 572 | if (isset($this->_refreshSelector)) |
573 | 573 | return $this->_refreshSelector; |
574 | - return "#" . $this->identifier . " tbody"; |
|
574 | + return "#".$this->identifier." tbody"; |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * @return DataTable |
581 | 581 | */ |
582 | 582 | public function setRefreshSelector($_refreshSelector) { |
583 | - $this->_refreshSelector = $_refreshSelector; |
|
583 | + $this->_refreshSelector=$_refreshSelector; |
|
584 | 584 | return $this; |
585 | 585 | } |
586 | 586 | |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | public function show($modelInstance) { |
593 | 593 | if (\is_array($modelInstance)) { |
594 | 594 | if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
595 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
595 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
596 | 596 | } |
597 | - $this->_modelInstance = $modelInstance; |
|
597 | + $this->_modelInstance=$modelInstance; |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | public function getRowClass() { |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * @return DataTable |
609 | 609 | */ |
610 | 610 | public function setRowClass($_rowClass) { |
611 | - $this->_rowClass = $_rowClass; |
|
611 | + $this->_rowClass=$_rowClass; |
|
612 | 612 | return $this; |
613 | 613 | } |
614 | 614 | |
@@ -619,16 +619,16 @@ discard block |
||
619 | 619 | * @return DataTable |
620 | 620 | */ |
621 | 621 | public function setEmptyMessage($_emptyMessage) { |
622 | - $this->_emptyMessage = $_emptyMessage; |
|
622 | + $this->_emptyMessage=$_emptyMessage; |
|
623 | 623 | return $this; |
624 | 624 | } |
625 | 625 | |
626 | - public function setSortable($colIndex = NULL) { |
|
627 | - $this->_sortable = $colIndex; |
|
626 | + public function setSortable($colIndex=NULL) { |
|
627 | + $this->_sortable=$colIndex; |
|
628 | 628 | return $this; |
629 | 629 | } |
630 | 630 | |
631 | - public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) { |
|
631 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
632 | 632 | $this->_self->setActiveRowSelector($class, $event, $multiple); |
633 | 633 | return $this; |
634 | 634 | } |
@@ -638,19 +638,19 @@ discard block |
||
638 | 638 | } |
639 | 639 | |
640 | 640 | public function hideColumn($colIndex) { |
641 | - if (! \is_array($this->_hiddenColumns)) |
|
642 | - $this->_hiddenColumns = []; |
|
643 | - $this->_hiddenColumns[] = $colIndex; |
|
641 | + if (!\is_array($this->_hiddenColumns)) |
|
642 | + $this->_hiddenColumns=[]; |
|
643 | + $this->_hiddenColumns[]=$colIndex; |
|
644 | 644 | return $this; |
645 | 645 | } |
646 | 646 | |
647 | 647 | public function setColWidth($colIndex, $width) { |
648 | - $this->_colWidths[$colIndex] = $width; |
|
648 | + $this->_colWidths[$colIndex]=$width; |
|
649 | 649 | return $this; |
650 | 650 | } |
651 | 651 | |
652 | 652 | public function setColWidths($_colWidths) { |
653 | - $this->_colWidths = $_colWidths; |
|
653 | + $this->_colWidths=$_colWidths; |
|
654 | 654 | return $this; |
655 | 655 | } |
656 | 656 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | return $this; |
660 | 660 | } |
661 | 661 | |
662 | - public function trigger($event, $params = "[]") { |
|
662 | + public function trigger($event, $params="[]") { |
|
663 | 663 | return $this->getHtmlComponent()->trigger($event, $params); |
664 | 664 | } |
665 | 665 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | * @param mixed $_displayBehavior |
698 | 698 | */ |
699 | 699 | public function setDisplayBehavior($_displayBehavior) { |
700 | - $this->_displayBehavior = $_displayBehavior; |
|
700 | + $this->_displayBehavior=$_displayBehavior; |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | /** |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | } |
718 | 718 | |
719 | 719 | public function addGroupBy($index) { |
720 | - $index = $this->_getIndex($index); |
|
721 | - if ($index !== false) { |
|
720 | + $index=$this->_getIndex($index); |
|
721 | + if ($index!==false) { |
|
722 | 722 | $this->_instanceViewer->addGroupBy($index); |
723 | 723 | } |
724 | 724 | } |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | * @param boolean $_visibleHover |
729 | 729 | */ |
730 | 730 | public function setVisibleHover($_visibleHover) { |
731 | - $this->_visibleHover = $_visibleHover; |
|
731 | + $this->_visibleHover=$_visibleHover; |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | /** |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | return $this->_paginationToolbar; |
740 | 740 | } |
741 | 741 | |
742 | - public function setInverted($recursive = true) { |
|
742 | + public function setInverted($recursive=true) { |
|
743 | 743 | $this->getHtmlComponent()->setInverted($recursive); |
744 | 744 | if ($this->_emptyMessage instanceof HtmlSemDoubleElement) { |
745 | 745 | $this->_emptyMessage->setInverted($recursive); |