@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | */ |
26 | 26 | class DataTable extends Widget { |
27 | - use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait; |
|
27 | + use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait; |
|
28 | 28 | |
29 | 29 | protected $_searchField; |
30 | 30 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | protected $_displayBehavior; |
42 | 42 | |
43 | - protected $_visibleHover = false; |
|
43 | + protected $_visibleHover=false; |
|
44 | 44 | |
45 | 45 | protected $_targetSelector; |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | protected $_json; |
52 | 52 | |
53 | - protected $_rowClass = "_element"; |
|
53 | + protected $_rowClass="_element"; |
|
54 | 54 | |
55 | 55 | protected $_sortable; |
56 | 56 | |
@@ -60,26 +60,26 @@ discard block |
||
60 | 60 | |
61 | 61 | protected $_paginationToolbar; |
62 | 62 | |
63 | - public function __construct($identifier, $model, $modelInstance = NULL) { |
|
63 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
64 | 64 | parent::__construct($identifier, $model, $modelInstance); |
65 | 65 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
66 | - $this->_urls = []; |
|
67 | - $this->_emptyMessage = new HtmlMessage("", "nothing to display"); |
|
66 | + $this->_urls=[]; |
|
67 | + $this->_emptyMessage=new HtmlMessage("", "nothing to display"); |
|
68 | 68 | $this->_emptyMessage->setIcon("info circle"); |
69 | 69 | } |
70 | 70 | |
71 | 71 | public function run(JsUtils $js) { |
72 | - if ($this->_runned !== true) { |
|
73 | - $offset = $js->scriptCount(); |
|
72 | + if ($this->_runned!==true) { |
|
73 | + $offset=$js->scriptCount(); |
|
74 | 74 | if ($this->_hasCheckboxes && isset($js)) { |
75 | 75 | $this->_runCheckboxes($js); |
76 | 76 | } |
77 | 77 | if ($this->_visibleHover) { |
78 | - $js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
78 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
79 | 79 | "preventDefault" => false, |
80 | 80 | "stopPropagation" => true |
81 | 81 | ]); |
82 | - $js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [ |
|
82 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [ |
|
83 | 83 | "preventDefault" => false, |
84 | 84 | "stopPropagation" => true |
85 | 85 | ]); |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | if (isset($this->_pagination)) |
96 | 96 | $this->_associatePaginationBehavior($js, $offset); |
97 | 97 | $this->_associateSearchFieldBehavior($js, $offset); |
98 | - $this->_runned = true; |
|
98 | + $this->_runned=true; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | 102 | protected function _generateBehavior($op, $params, JsUtils $js) { |
103 | 103 | if (isset($this->_urls[$op])) { |
104 | - $params = \array_merge($params, [ |
|
104 | + $params=\array_merge($params, [ |
|
105 | 105 | "attr" => "data-ajax" |
106 | 106 | ]); |
107 | - $js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
107 | + $js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -123,21 +123,21 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | public function refreshTD($fieldName, $jquery, $view) { |
126 | - $index = $this->_getIndex($fieldName); |
|
126 | + $index=$this->_getIndex($fieldName); |
|
127 | 127 | $this->compile($jquery, $view); |
128 | 128 | return $this->refreshTR() |
129 | 129 | ->getTable() |
130 | 130 | ->getCell(0, $index); |
131 | 131 | } |
132 | 132 | |
133 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
134 | - if (! $this->_generated) { |
|
133 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
134 | + if (!$this->_generated) { |
|
135 | 135 | if (isset($this->_buttonsColumn)) { |
136 | 136 | $this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons); |
137 | 137 | } |
138 | 138 | $this->_instanceViewer->setInstance($this->_model); |
139 | - $captions = $this->_instanceViewer->getCaptions(); |
|
140 | - $table = $this->content["table"]; |
|
139 | + $captions=$this->_instanceViewer->getCaptions(); |
|
140 | + $table=$this->content["table"]; |
|
141 | 141 | if ($this->_hasCheckboxes) { |
142 | 142 | $this->_generateMainCheckbox($captions); |
143 | 143 | } |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | $this->compileExtraElements($table, $captions); |
153 | 153 | $this->_compileSearchFieldBehavior($js); |
154 | 154 | |
155 | - $this->content = JArray::sortAssociative($this->content, [ |
|
155 | + $this->content=JArray::sortAssociative($this->content, [ |
|
156 | 156 | PositionInTable::BEFORETABLE, |
157 | 157 | "table", |
158 | 158 | PositionInTable::AFTERTABLE |
159 | 159 | ]); |
160 | 160 | $this->_compileForm(); |
161 | 161 | $this->_applyStyleAttributes($table); |
162 | - $this->_generated = true; |
|
162 | + $this->_generated=true; |
|
163 | 163 | } |
164 | 164 | return parent::compile($js, $view); |
165 | 165 | } |
@@ -204,21 +204,21 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | protected function _generateContent($table) { |
207 | - $objects = $this->_modelInstance; |
|
207 | + $objects=$this->_modelInstance; |
|
208 | 208 | if (isset($this->_pagination)) { |
209 | - $objects = $this->_pagination->getObjects($this->_modelInstance); |
|
209 | + $objects=$this->_pagination->getObjects($this->_modelInstance); |
|
210 | 210 | } |
211 | 211 | InstanceViewer::setIndex(0); |
212 | - $fields = $this->_instanceViewer->getSimpleProperties(); |
|
213 | - $groupByFields = $this->_instanceViewer->getGroupByFields(); |
|
214 | - if (! is_array($groupByFields)) { |
|
215 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) { |
|
212 | + $fields=$this->_instanceViewer->getSimpleProperties(); |
|
213 | + $groupByFields=$this->_instanceViewer->getGroupByFields(); |
|
214 | + if (!is_array($groupByFields)) { |
|
215 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) { |
|
216 | 216 | return $this->_generateRow($instance, $fields, $table); |
217 | 217 | }); |
218 | 218 | } else { |
219 | - $activeValues = array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null)); |
|
220 | - $uuids = []; |
|
221 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) { |
|
219 | + $activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null)); |
|
220 | + $uuids=[]; |
|
221 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) { |
|
222 | 222 | $this->_instanceViewer->setInstance($instance); |
223 | 223 | foreach ($groupByFields as $index => $gbField) { |
224 | 224 | $this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids); |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | return $this->_generateRow($instance, $fields, $table, null, $uuids); |
227 | 227 | }); |
228 | 228 | } |
229 | - if ($table->getRowCount() == 0) { |
|
230 | - $result = $table->addRow(); |
|
229 | + if ($table->getRowCount()==0) { |
|
230 | + $result=$table->addRow(); |
|
231 | 231 | $result->mergeRow(); |
232 | 232 | $result->setValues([ |
233 | 233 | $this->_emptyMessage |
@@ -236,20 +236,20 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) { |
239 | - $newValue = $this->_instanceViewer->getValue($gbField); |
|
240 | - if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) { |
|
241 | - if ($index == 0) { |
|
242 | - $uuids = []; |
|
239 | + $newValue=$this->_instanceViewer->getValue($gbField); |
|
240 | + if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) { |
|
241 | + if ($index==0) { |
|
242 | + $uuids=[]; |
|
243 | 243 | } |
244 | - $uuid = uniqid("grp"); |
|
245 | - $uuids[$gbField] = $uuid; |
|
246 | - $id = $this->_instanceViewer->getIdentifier(); |
|
247 | - $result = $table->addMergeRow(sizeof($fields) + 1, $newValue); |
|
248 | - $result->setIdentifier($this->identifier . "-tr-gb-" . $id); |
|
244 | + $uuid=uniqid("grp"); |
|
245 | + $uuids[$gbField]=$uuid; |
|
246 | + $id=$this->_instanceViewer->getIdentifier(); |
|
247 | + $result=$table->addMergeRow(sizeof($fields)+1, $newValue); |
|
248 | + $result->setIdentifier($this->identifier."-tr-gb-".$id); |
|
249 | 249 | $result->setProperty("data-ajax", $id); |
250 | 250 | $result->setProperty("data-group", $uuid); |
251 | 251 | $result->addToProperty("class", $this->_rowClass); |
252 | - $activeValues[$gbField] = $newValue; |
|
252 | + $activeValues[$gbField]=$newValue; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | public function getFieldValue($index) { |
264 | - $index = $this->_getIndex($index); |
|
264 | + $index=$this->_getIndex($index); |
|
265 | 265 | if (is_numeric($index)) { |
266 | - $values = $this->_instanceViewer->getValues(); |
|
266 | + $values=$this->_instanceViewer->getValues(); |
|
267 | 267 | if (isset($values[$index])) { |
268 | 268 | return $values[$index]; |
269 | 269 | } |
@@ -271,31 +271,31 @@ discard block |
||
271 | 271 | return null; |
272 | 272 | } |
273 | 273 | |
274 | - protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) { |
|
274 | + protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) { |
|
275 | 275 | $this->_instanceViewer->setInstance($instance); |
276 | - InstanceViewer::$index ++; |
|
277 | - $values = $this->_instanceViewer->getValues(); |
|
278 | - $id = $this->_instanceViewer->getIdentifier(); |
|
279 | - $dataAjax = $id; |
|
280 | - $id = $this->cleanIdentifier($id); |
|
276 | + InstanceViewer::$index++; |
|
277 | + $values=$this->_instanceViewer->getValues(); |
|
278 | + $id=$this->_instanceViewer->getIdentifier(); |
|
279 | + $dataAjax=$id; |
|
280 | + $id=$this->cleanIdentifier($id); |
|
281 | 281 | if ($this->_hasCheckboxes) { |
282 | - $ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, ""); |
|
283 | - $checked = false; |
|
282 | + $ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, ""); |
|
283 | + $checked=false; |
|
284 | 284 | if (isset($this->_checkedCallback)) { |
285 | - $func = $this->_checkedCallback; |
|
286 | - $checked = $func($instance); |
|
285 | + $func=$this->_checkedCallback; |
|
286 | + $checked=$func($instance); |
|
287 | 287 | } |
288 | 288 | $ck->setChecked($checked); |
289 | 289 | // $ck->setOnChange("event.stopPropagation();"); |
290 | - $field = $ck->getField(); |
|
290 | + $field=$ck->getField(); |
|
291 | 291 | $field->setProperty("value", $dataAjax); |
292 | 292 | $field->setProperty("name", "selection[]"); |
293 | 293 | if (isset($checkedClass)) |
294 | 294 | $field->setClass($checkedClass); |
295 | 295 | \array_unshift($values, $ck); |
296 | 296 | } |
297 | - $result = $table->newRow(); |
|
298 | - $result->setIdentifier($this->identifier . "-tr-" . $id); |
|
297 | + $result=$table->newRow(); |
|
298 | + $result->setIdentifier($this->identifier."-tr-".$id); |
|
299 | 299 | $result->setProperty("data-ajax", $dataAjax); |
300 | 300 | $result->setValues($values); |
301 | 301 | $result->addToProperty("class", $this->_rowClass); |
@@ -308,63 +308,63 @@ discard block |
||
308 | 308 | |
309 | 309 | protected function _generatePagination($table) { |
310 | 310 | if (isset($this->_toolbar)) { |
311 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
311 | + if ($this->_toolbarPosition==PositionInTable::FOOTER) |
|
312 | 312 | $this->_toolbar->setFloated("left"); |
313 | 313 | } |
314 | - $footer = $table->getFooter(); |
|
314 | + $footer=$table->getFooter(); |
|
315 | 315 | $footer->mergeCol(); |
316 | 316 | $this->_paginationToolbar=$this->_pagination->generateMenu($this->identifier); |
317 | 317 | $footer->addValues($this->_paginationToolbar); |
318 | 318 | } |
319 | 319 | |
320 | - protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) { |
|
320 | + protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) { |
|
321 | 321 | if (isset($this->_urls["refresh"])) { |
322 | - $menu = $this->_pagination->getMenu(); |
|
322 | + $menu=$this->_pagination->getMenu(); |
|
323 | 323 | if (isset($menu) && isset($js)) { |
324 | - $js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [ |
|
324 | + $js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [ |
|
325 | 325 | "preventDefault" => false, |
326 | 326 | "jqueryDone" => "replaceWith", |
327 | 327 | "hasLoader" => false, |
328 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");' |
|
328 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");' |
|
329 | 329 | ]); |
330 | - $page = $_POST["p"] ?? null; |
|
330 | + $page=$_POST["p"] ?? null; |
|
331 | 331 | if (isset($page)) { |
332 | - $js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("active");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("active");'); |
|
332 | + $js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("active");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("active");'); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | - protected function _compileSearchFieldBehavior(JsUtils $js = NULL) { |
|
338 | + protected function _compileSearchFieldBehavior(JsUtils $js=NULL) { |
|
339 | 339 | if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) { |
340 | - $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [ |
|
340 | + $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [ |
|
341 | 341 | "preventDefault" => false, |
342 | 342 | "jqueryDone" => "replaceWith", |
343 | 343 | "hasLoader" => "internal", |
344 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);' |
|
344 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);' |
|
345 | 345 | ]); |
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
349 | - protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {} |
|
349 | + protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {} |
|
350 | 350 | |
351 | 351 | protected function _getFieldName($index) { |
352 | - $fieldName = parent::_getFieldName($index); |
|
352 | + $fieldName=parent::_getFieldName($index); |
|
353 | 353 | if (\is_object($fieldName)) |
354 | - $fieldName = "field-" . $index; |
|
355 | - return $fieldName . "[]"; |
|
354 | + $fieldName="field-".$index; |
|
355 | + return $fieldName."[]"; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | protected function _getFieldCaption($index) { |
359 | 359 | return null; |
360 | 360 | } |
361 | 361 | |
362 | - protected function _setToolbarPosition($table, $captions = NULL) { |
|
362 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
363 | 363 | switch ($this->_toolbarPosition) { |
364 | 364 | case PositionInTable::BEFORETABLE: |
365 | 365 | case PositionInTable::AFTERTABLE: |
366 | - if (isset($this->_compileParts) === false) { |
|
367 | - $this->content[$this->_toolbarPosition] = $this->_toolbar; |
|
366 | + if (isset($this->_compileParts)===false) { |
|
367 | + $this->content[$this->_toolbarPosition]=$this->_toolbar; |
|
368 | 368 | } |
369 | 369 | break; |
370 | 370 | case PositionInTable::HEADER: |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | } |
392 | 392 | |
393 | 393 | private function addToolbarRow($part, $table, $captions) { |
394 | - $hasPart = $table->hasPart($part); |
|
394 | + $hasPart=$table->hasPart($part); |
|
395 | 395 | if ($hasPart) { |
396 | - $row = $table->getPart($part)->addRow(\sizeof($captions)); |
|
396 | + $row=$table->getPart($part)->addRow(\sizeof($captions)); |
|
397 | 397 | } else { |
398 | - $row = $table->getPart($part)->getRow(0); |
|
398 | + $row=$table->getPart($part)->getRow(0); |
|
399 | 399 | } |
400 | 400 | $row->mergeCol(); |
401 | 401 | $row->setValues([ |
@@ -427,12 +427,12 @@ discard block |
||
427 | 427 | */ |
428 | 428 | public function setUrls($urls) { |
429 | 429 | if (\is_array($urls)) { |
430 | - $this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0); |
|
431 | - $this->_urls["edit"] = JArray::getValue($urls, "edit", 1); |
|
432 | - $this->_urls["delete"] = JArray::getValue($urls, "delete", 2); |
|
433 | - $this->_urls["display"] = JArray::getValue($urls, "display", 3); |
|
430 | + $this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0); |
|
431 | + $this->_urls["edit"]=JArray::getValue($urls, "edit", 1); |
|
432 | + $this->_urls["delete"]=JArray::getValue($urls, "delete", 2); |
|
433 | + $this->_urls["display"]=JArray::getValue($urls, "display", 3); |
|
434 | 434 | } else { |
435 | - $this->_urls = [ |
|
435 | + $this->_urls=[ |
|
436 | 436 | "refresh" => $urls, |
437 | 437 | "edit" => $urls, |
438 | 438 | "delete" => $urls, |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | * The number of visible pages in the Pagination component |
456 | 456 | * @return DataTable |
457 | 457 | */ |
458 | - public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) { |
|
459 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
458 | + public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
459 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
460 | 460 | return $this; |
461 | 461 | } |
462 | 462 | |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | * The number of visible pages in the Pagination component |
472 | 472 | * @return DataTable |
473 | 473 | */ |
474 | - public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) { |
|
475 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page); |
|
474 | + public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) { |
|
475 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page); |
|
476 | 476 | return $this; |
477 | 477 | } |
478 | 478 | |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | * @param array $compileParts |
482 | 482 | * @return DataTable |
483 | 483 | */ |
484 | - public function refresh($compileParts = [ |
|
484 | + public function refresh($compileParts=[ |
|
485 | 485 | "tbody" |
486 | 486 | ]) { |
487 | - $this->_compileParts = $compileParts; |
|
487 | + $this->_compileParts=$compileParts; |
|
488 | 488 | return $this; |
489 | 489 | } |
490 | 490 | |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | * @param string $position |
495 | 495 | * @return \Ajax\common\html\HtmlDoubleElement |
496 | 496 | */ |
497 | - public function addSearchInToolbar($position = Direction::RIGHT) { |
|
497 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
498 | 498 | return $this->addInToolbar($this->getSearchField()) |
499 | 499 | ->setPosition($position); |
500 | 500 | } |
501 | 501 | |
502 | 502 | public function getSearchField() { |
503 | - if (isset($this->_searchField) === false) { |
|
504 | - $this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search..."); |
|
503 | + if (isset($this->_searchField)===false) { |
|
504 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
505 | 505 | $this->_searchField->addIcon("search", Direction::RIGHT); |
506 | 506 | } |
507 | 507 | return $this->_searchField; |
@@ -529,9 +529,9 @@ discard block |
||
529 | 529 | } |
530 | 530 | |
531 | 531 | protected function getTargetSelector($op) { |
532 | - $result = $this->_targetSelector; |
|
533 | - if (! isset($result[$op])) |
|
534 | - $result = "#" . $this->identifier; |
|
532 | + $result=$this->_targetSelector; |
|
533 | + if (!isset($result[$op])) |
|
534 | + $result="#".$this->identifier; |
|
535 | 535 | return $result[$op]; |
536 | 536 | } |
537 | 537 | |
@@ -543,20 +543,20 @@ discard block |
||
543 | 543 | * @return DataTable |
544 | 544 | */ |
545 | 545 | public function setTargetSelector($_targetSelector) { |
546 | - if (! \is_array($_targetSelector)) { |
|
547 | - $_targetSelector = [ |
|
546 | + if (!\is_array($_targetSelector)) { |
|
547 | + $_targetSelector=[ |
|
548 | 548 | "edit" => $_targetSelector, |
549 | 549 | "delete" => $_targetSelector |
550 | 550 | ]; |
551 | 551 | } |
552 | - $this->_targetSelector = $_targetSelector; |
|
552 | + $this->_targetSelector=$_targetSelector; |
|
553 | 553 | return $this; |
554 | 554 | } |
555 | 555 | |
556 | 556 | public function getRefreshSelector() { |
557 | 557 | if (isset($this->_refreshSelector)) |
558 | 558 | return $this->_refreshSelector; |
559 | - return "#" . $this->identifier . " tbody"; |
|
559 | + return "#".$this->identifier." tbody"; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | /** |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @return DataTable |
566 | 566 | */ |
567 | 567 | public function setRefreshSelector($_refreshSelector) { |
568 | - $this->_refreshSelector = $_refreshSelector; |
|
568 | + $this->_refreshSelector=$_refreshSelector; |
|
569 | 569 | return $this; |
570 | 570 | } |
571 | 571 | |
@@ -577,9 +577,9 @@ discard block |
||
577 | 577 | public function show($modelInstance) { |
578 | 578 | if (\is_array($modelInstance)) { |
579 | 579 | if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
580 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
580 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
581 | 581 | } |
582 | - $this->_modelInstance = $modelInstance; |
|
582 | + $this->_modelInstance=$modelInstance; |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | public function getRowClass() { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | * @return DataTable |
594 | 594 | */ |
595 | 595 | public function setRowClass($_rowClass) { |
596 | - $this->_rowClass = $_rowClass; |
|
596 | + $this->_rowClass=$_rowClass; |
|
597 | 597 | return $this; |
598 | 598 | } |
599 | 599 | |
@@ -604,34 +604,34 @@ discard block |
||
604 | 604 | * @return DataTable |
605 | 605 | */ |
606 | 606 | public function setEmptyMessage($_emptyMessage) { |
607 | - $this->_emptyMessage = $_emptyMessage; |
|
607 | + $this->_emptyMessage=$_emptyMessage; |
|
608 | 608 | return $this; |
609 | 609 | } |
610 | 610 | |
611 | - public function setSortable($colIndex = NULL) { |
|
612 | - $this->_sortable = $colIndex; |
|
611 | + public function setSortable($colIndex=NULL) { |
|
612 | + $this->_sortable=$colIndex; |
|
613 | 613 | return $this; |
614 | 614 | } |
615 | 615 | |
616 | - public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) { |
|
616 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
617 | 617 | $this->_self->setActiveRowSelector($class, $event, $multiple); |
618 | 618 | return $this; |
619 | 619 | } |
620 | 620 | |
621 | 621 | public function hideColumn($colIndex) { |
622 | - if (! \is_array($this->_hiddenColumns)) |
|
623 | - $this->_hiddenColumns = []; |
|
624 | - $this->_hiddenColumns[] = $colIndex; |
|
622 | + if (!\is_array($this->_hiddenColumns)) |
|
623 | + $this->_hiddenColumns=[]; |
|
624 | + $this->_hiddenColumns[]=$colIndex; |
|
625 | 625 | return $this; |
626 | 626 | } |
627 | 627 | |
628 | 628 | public function setColWidth($colIndex, $width) { |
629 | - $this->_colWidths[$colIndex] = $width; |
|
629 | + $this->_colWidths[$colIndex]=$width; |
|
630 | 630 | return $this; |
631 | 631 | } |
632 | 632 | |
633 | 633 | public function setColWidths($_colWidths) { |
634 | - $this->_colWidths = $_colWidths; |
|
634 | + $this->_colWidths=$_colWidths; |
|
635 | 635 | return $this; |
636 | 636 | } |
637 | 637 | |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | return $this; |
641 | 641 | } |
642 | 642 | |
643 | - public function trigger($event, $params = "[]") { |
|
643 | + public function trigger($event, $params="[]") { |
|
644 | 644 | return $this->getHtmlComponent()->trigger($event, $params); |
645 | 645 | } |
646 | 646 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @param mixed $_displayBehavior |
679 | 679 | */ |
680 | 680 | public function setDisplayBehavior($_displayBehavior) { |
681 | - $this->_displayBehavior = $_displayBehavior; |
|
681 | + $this->_displayBehavior=$_displayBehavior; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | /** |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | * @param boolean $_visibleHover |
703 | 703 | */ |
704 | 704 | public function setVisibleHover($_visibleHover) { |
705 | - $this->_visibleHover = $_visibleHover; |
|
705 | + $this->_visibleHover=$_visibleHover; |
|
706 | 706 | } |
707 | 707 | /** |
708 | 708 | * @return \Ajax\semantic\html\collections\menus\HtmlPaginationMenu |