@@ -10,9 +10,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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,29 +80,29 @@ discard block |
||
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 | - $jsCondition = '!$(this).closest("tr").hasClass("active")'; |
|
91 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
92 | + $jsCondition='!$(this).closest("tr").hasClass("active")'; |
|
93 | 93 | if (isset($parameters['jsCondition'])) { |
94 | - $jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')'; |
|
94 | + $jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')'; |
|
95 | 95 | } |
96 | - $parameters = \array_merge($parameters, [ |
|
96 | + $parameters=\array_merge($parameters, [ |
|
97 | 97 | "stopPropagation" => false, |
98 | 98 | "preventDefault" => false, |
99 | 99 | "jsCondition" => $jsCondition |
100 | 100 | ]); |
101 | - $selector = "tbody tr"; |
|
101 | + $selector="tbody tr"; |
|
102 | 102 | if (isset($parameters["selector"])) { |
103 | - $selector = $parameters["selector"]; |
|
103 | + $selector=$parameters["selector"]; |
|
104 | 104 | } |
105 | - return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters); |
|
105 | + return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | public function onPageChange($jsCode) { |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | return $this->_self->getBsComponent()->getScript(); |
120 | 120 | } |
121 | 121 | |
122 | - public function addEventsOnRun(JsUtils $js = NULL) { |
|
123 | - $script = parent::addEventsOnRun($js); |
|
124 | - $innerScript = $this->_self->getInnerScript(); |
|
125 | - if (! isset($innerScript)) { |
|
122 | + public function addEventsOnRun(JsUtils $js=NULL) { |
|
123 | + $script=parent::addEventsOnRun($js); |
|
124 | + $innerScript=$this->_self->getInnerScript(); |
|
125 | + if (!isset($innerScript)) { |
|
126 | 126 | $this->_self->setInnerScript($script); |
127 | 127 | } |
128 | 128 | return $script; |
@@ -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 | |
@@ -58,25 +58,25 @@ discard block |
||
58 | 58 | |
59 | 59 | protected $_colWidths; |
60 | 60 | |
61 | - public function __construct($identifier, $model, $modelInstance = NULL) { |
|
61 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
62 | 62 | parent::__construct($identifier, $model, $modelInstance); |
63 | 63 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
64 | - $this->_urls = []; |
|
65 | - $this->_emptyMessage = new HtmlMessage("", "nothing to display"); |
|
64 | + $this->_urls=[]; |
|
65 | + $this->_emptyMessage=new HtmlMessage("", "nothing to display"); |
|
66 | 66 | $this->_emptyMessage->setIcon("info circle"); |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function run(JsUtils $js) { |
70 | - $offset = $js->scriptCount(); |
|
70 | + $offset=$js->scriptCount(); |
|
71 | 71 | if ($this->_hasCheckboxes && isset($js)) { |
72 | 72 | $this->_runCheckboxes($js); |
73 | 73 | } |
74 | 74 | if ($this->_visibleHover) { |
75 | - $js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
75 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
76 | 76 | "preventDefault" => false, |
77 | 77 | "stopPropagation" => true |
78 | 78 | ]); |
79 | - $js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", [ |
|
79 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", [ |
|
80 | 80 | "preventDefault" => false, |
81 | 81 | "stopPropagation" => true |
82 | 82 | ]); |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | |
97 | 97 | protected function _generateBehavior($op, $params, JsUtils $js) { |
98 | 98 | if (isset($this->_urls[$op])) { |
99 | - $params = \array_merge($params, [ |
|
99 | + $params=\array_merge($params, [ |
|
100 | 100 | "attr" => "data-ajax" |
101 | 101 | ]); |
102 | - $js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
102 | + $js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -118,21 +118,21 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | public function refreshTD($fieldName, $jquery, $view) { |
121 | - $index = $this->_getIndex($fieldName); |
|
121 | + $index=$this->_getIndex($fieldName); |
|
122 | 122 | $this->compile($jquery, $view); |
123 | 123 | return $this->refreshTR() |
124 | 124 | ->getTable() |
125 | 125 | ->getCell(0, $index); |
126 | 126 | } |
127 | 127 | |
128 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
129 | - if (! $this->_generated) { |
|
128 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
129 | + if (!$this->_generated) { |
|
130 | 130 | if (isset($this->_buttonsColumn)) { |
131 | 131 | $this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons); |
132 | 132 | } |
133 | 133 | $this->_instanceViewer->setInstance($this->_model); |
134 | - $captions = $this->_instanceViewer->getCaptions(); |
|
135 | - $table = $this->content["table"]; |
|
134 | + $captions=$this->_instanceViewer->getCaptions(); |
|
135 | + $table=$this->content["table"]; |
|
136 | 136 | if ($this->_hasCheckboxes) { |
137 | 137 | $this->_generateMainCheckbox($captions); |
138 | 138 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $this->compileExtraElements($table, $captions); |
148 | 148 | $this->_compileSearchFieldBehavior($js); |
149 | 149 | |
150 | - $this->content = JArray::sortAssociative($this->content, [ |
|
150 | + $this->content=JArray::sortAssociative($this->content, [ |
|
151 | 151 | PositionInTable::BEFORETABLE, |
152 | 152 | "table", |
153 | 153 | PositionInTable::AFTERTABLE |
154 | 154 | ]); |
155 | 155 | $this->_compileForm(); |
156 | 156 | $this->_applyStyleAttributes($table); |
157 | - $this->_generated = true; |
|
157 | + $this->_generated=true; |
|
158 | 158 | } |
159 | 159 | return parent::compile($js, $view); |
160 | 160 | } |
@@ -199,21 +199,21 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | protected function _generateContent($table) { |
202 | - $objects = $this->_modelInstance; |
|
202 | + $objects=$this->_modelInstance; |
|
203 | 203 | if (isset($this->_pagination)) { |
204 | - $objects = $this->_pagination->getObjects($this->_modelInstance); |
|
204 | + $objects=$this->_pagination->getObjects($this->_modelInstance); |
|
205 | 205 | } |
206 | 206 | InstanceViewer::setIndex(0); |
207 | - $fields = $this->_instanceViewer->getSimpleProperties(); |
|
208 | - $groupByFields = $this->_instanceViewer->getGroupByFields(); |
|
209 | - if (! is_array($groupByFields)) { |
|
210 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) { |
|
207 | + $fields=$this->_instanceViewer->getSimpleProperties(); |
|
208 | + $groupByFields=$this->_instanceViewer->getGroupByFields(); |
|
209 | + if (!is_array($groupByFields)) { |
|
210 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) { |
|
211 | 211 | return $this->_generateRow($instance, $fields, $table); |
212 | 212 | }); |
213 | 213 | } else { |
214 | - $activeValues = array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null)); |
|
215 | - $uuids = []; |
|
216 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) { |
|
214 | + $activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null)); |
|
215 | + $uuids=[]; |
|
216 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) { |
|
217 | 217 | $this->_instanceViewer->setInstance($instance); |
218 | 218 | foreach ($groupByFields as $index => $gbField) { |
219 | 219 | $this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids); |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | return $this->_generateRow($instance, $fields, $table, null, $uuids); |
222 | 222 | }); |
223 | 223 | } |
224 | - if ($table->getRowCount() == 0) { |
|
225 | - $result = $table->addRow(); |
|
224 | + if ($table->getRowCount()==0) { |
|
225 | + $result=$table->addRow(); |
|
226 | 226 | $result->mergeRow(); |
227 | 227 | $result->setValues([ |
228 | 228 | $this->_emptyMessage |
@@ -231,20 +231,20 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) { |
234 | - $newValue = $this->_instanceViewer->getValue($gbField); |
|
235 | - if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) { |
|
236 | - if ($index == 0) { |
|
237 | - $uuids = []; |
|
234 | + $newValue=$this->_instanceViewer->getValue($gbField); |
|
235 | + if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) { |
|
236 | + if ($index==0) { |
|
237 | + $uuids=[]; |
|
238 | 238 | } |
239 | - $uuid = uniqid("grp"); |
|
240 | - $uuids[$gbField] = $uuid; |
|
241 | - $id = $this->_instanceViewer->getIdentifier(); |
|
242 | - $result = $table->addMergeRow(sizeof($fields) + 1, $newValue); |
|
243 | - $result->setIdentifier($this->identifier . "-tr-gb-" . $id); |
|
239 | + $uuid=uniqid("grp"); |
|
240 | + $uuids[$gbField]=$uuid; |
|
241 | + $id=$this->_instanceViewer->getIdentifier(); |
|
242 | + $result=$table->addMergeRow(sizeof($fields)+1, $newValue); |
|
243 | + $result->setIdentifier($this->identifier."-tr-gb-".$id); |
|
244 | 244 | $result->setProperty("data-ajax", $id); |
245 | 245 | $result->setProperty("data-group", $uuid); |
246 | 246 | $result->addToProperty("class", $this->_rowClass); |
247 | - $activeValues[$gbField] = $newValue; |
|
247 | + $activeValues[$gbField]=$newValue; |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | public function getFieldValue($index) { |
259 | - $index = $this->_getIndex($index); |
|
259 | + $index=$this->_getIndex($index); |
|
260 | 260 | if (is_numeric($index)) { |
261 | - $values = $this->_instanceViewer->getValues(); |
|
261 | + $values=$this->_instanceViewer->getValues(); |
|
262 | 262 | if (isset($values[$index])) { |
263 | 263 | return $values[$index]; |
264 | 264 | } |
@@ -266,31 +266,31 @@ discard block |
||
266 | 266 | return null; |
267 | 267 | } |
268 | 268 | |
269 | - protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) { |
|
269 | + protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) { |
|
270 | 270 | $this->_instanceViewer->setInstance($instance); |
271 | - InstanceViewer::$index ++; |
|
272 | - $values = $this->_instanceViewer->getValues(); |
|
273 | - $id = $this->_instanceViewer->getIdentifier(); |
|
274 | - $dataAjax = $id; |
|
275 | - $id = $this->cleanIdentifier($id); |
|
271 | + InstanceViewer::$index++; |
|
272 | + $values=$this->_instanceViewer->getValues(); |
|
273 | + $id=$this->_instanceViewer->getIdentifier(); |
|
274 | + $dataAjax=$id; |
|
275 | + $id=$this->cleanIdentifier($id); |
|
276 | 276 | if ($this->_hasCheckboxes) { |
277 | - $ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, ""); |
|
278 | - $checked = false; |
|
277 | + $ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, ""); |
|
278 | + $checked=false; |
|
279 | 279 | if (isset($this->_checkedCallback)) { |
280 | - $func = $this->_checkedCallback; |
|
281 | - $checked = $func($instance); |
|
280 | + $func=$this->_checkedCallback; |
|
281 | + $checked=$func($instance); |
|
282 | 282 | } |
283 | 283 | $ck->setChecked($checked); |
284 | 284 | // $ck->setOnChange("event.stopPropagation();"); |
285 | - $field = $ck->getField(); |
|
285 | + $field=$ck->getField(); |
|
286 | 286 | $field->setProperty("value", $dataAjax); |
287 | 287 | $field->setProperty("name", "selection[]"); |
288 | 288 | if (isset($checkedClass)) |
289 | 289 | $field->setClass($checkedClass); |
290 | 290 | \array_unshift($values, $ck); |
291 | 291 | } |
292 | - $result = $table->newRow(); |
|
293 | - $result->setIdentifier($this->identifier . "-tr-" . $id); |
|
292 | + $result=$table->newRow(); |
|
293 | + $result->setIdentifier($this->identifier."-tr-".$id); |
|
294 | 294 | $result->setProperty("data-ajax", $dataAjax); |
295 | 295 | $result->setValues($values); |
296 | 296 | $result->addToProperty("class", $this->_rowClass); |
@@ -303,62 +303,62 @@ discard block |
||
303 | 303 | |
304 | 304 | protected function _generatePagination($table) { |
305 | 305 | if (isset($this->_toolbar)) { |
306 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
306 | + if ($this->_toolbarPosition==PositionInTable::FOOTER) |
|
307 | 307 | $this->_toolbar->setFloated("left"); |
308 | 308 | } |
309 | - $footer = $table->getFooter(); |
|
309 | + $footer=$table->getFooter(); |
|
310 | 310 | $footer->mergeCol(); |
311 | 311 | $footer->addValues($this->_pagination->generateMenu($this->identifier)); |
312 | 312 | } |
313 | 313 | |
314 | - protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) { |
|
314 | + protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) { |
|
315 | 315 | if (isset($this->_urls["refresh"])) { |
316 | - $menu = $this->_pagination->getMenu(); |
|
316 | + $menu=$this->_pagination->getMenu(); |
|
317 | 317 | if (isset($menu) && isset($js)) { |
318 | - $js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [ |
|
318 | + $js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [ |
|
319 | 319 | "preventDefault" => false, |
320 | 320 | "jqueryDone" => "replaceWith", |
321 | 321 | "hasLoader" => false, |
322 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");' |
|
322 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");' |
|
323 | 323 | ]); |
324 | - $page = $_POST["p"] ?? null; |
|
324 | + $page=$_POST["p"] ?? null; |
|
325 | 325 | if (isset($page)) { |
326 | - $js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("active");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("active");'); |
|
326 | + $js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("active");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("active");'); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | - protected function _compileSearchFieldBehavior(JsUtils $js = NULL) { |
|
332 | + protected function _compileSearchFieldBehavior(JsUtils $js=NULL) { |
|
333 | 333 | if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) { |
334 | - $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [ |
|
334 | + $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [ |
|
335 | 335 | "preventDefault" => false, |
336 | 336 | "jqueryDone" => "replaceWith", |
337 | 337 | "hasLoader" => "internal", |
338 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);' |
|
338 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);' |
|
339 | 339 | ]); |
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | - protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {} |
|
343 | + protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {} |
|
344 | 344 | |
345 | 345 | protected function _getFieldName($index) { |
346 | - $fieldName = parent::_getFieldName($index); |
|
346 | + $fieldName=parent::_getFieldName($index); |
|
347 | 347 | if (\is_object($fieldName)) |
348 | - $fieldName = "field-" . $index; |
|
349 | - return $fieldName . "[]"; |
|
348 | + $fieldName="field-".$index; |
|
349 | + return $fieldName."[]"; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | protected function _getFieldCaption($index) { |
353 | 353 | return null; |
354 | 354 | } |
355 | 355 | |
356 | - protected function _setToolbarPosition($table, $captions = NULL) { |
|
356 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
357 | 357 | switch ($this->_toolbarPosition) { |
358 | 358 | case PositionInTable::BEFORETABLE: |
359 | 359 | case PositionInTable::AFTERTABLE: |
360 | - if (isset($this->_compileParts) === false) { |
|
361 | - $this->content[$this->_toolbarPosition] = $this->_toolbar; |
|
360 | + if (isset($this->_compileParts)===false) { |
|
361 | + $this->content[$this->_toolbarPosition]=$this->_toolbar; |
|
362 | 362 | } |
363 | 363 | break; |
364 | 364 | case PositionInTable::HEADER: |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | private function addToolbarRow($part, $table, $captions) { |
388 | - $hasPart = $table->hasPart($part); |
|
388 | + $hasPart=$table->hasPart($part); |
|
389 | 389 | if ($hasPart) { |
390 | - $row = $table->getPart($part)->addRow(\sizeof($captions)); |
|
390 | + $row=$table->getPart($part)->addRow(\sizeof($captions)); |
|
391 | 391 | } else { |
392 | - $row = $table->getPart($part)->getRow(0); |
|
392 | + $row=$table->getPart($part)->getRow(0); |
|
393 | 393 | } |
394 | 394 | $row->mergeCol(); |
395 | 395 | $row->setValues([ |
@@ -421,12 +421,12 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function setUrls($urls) { |
423 | 423 | if (\is_array($urls)) { |
424 | - $this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0); |
|
425 | - $this->_urls["edit"] = JArray::getValue($urls, "edit", 1); |
|
426 | - $this->_urls["delete"] = JArray::getValue($urls, "delete", 2); |
|
427 | - $this->_urls["display"] = JArray::getValue($urls, "display", 3); |
|
424 | + $this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0); |
|
425 | + $this->_urls["edit"]=JArray::getValue($urls, "edit", 1); |
|
426 | + $this->_urls["delete"]=JArray::getValue($urls, "delete", 2); |
|
427 | + $this->_urls["display"]=JArray::getValue($urls, "display", 3); |
|
428 | 428 | } else { |
429 | - $this->_urls = [ |
|
429 | + $this->_urls=[ |
|
430 | 430 | "refresh" => $urls, |
431 | 431 | "edit" => $urls, |
432 | 432 | "delete" => $urls, |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * The number of visible pages in the Pagination component |
450 | 450 | * @return DataTable |
451 | 451 | */ |
452 | - public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) { |
|
453 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
452 | + public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
453 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
454 | 454 | return $this; |
455 | 455 | } |
456 | 456 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * The number of visible pages in the Pagination component |
466 | 466 | * @return DataTable |
467 | 467 | */ |
468 | - public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) { |
|
469 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page); |
|
468 | + public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) { |
|
469 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page); |
|
470 | 470 | return $this; |
471 | 471 | } |
472 | 472 | |
@@ -475,10 +475,10 @@ discard block |
||
475 | 475 | * @param array $compileParts |
476 | 476 | * @return DataTable |
477 | 477 | */ |
478 | - public function refresh($compileParts = [ |
|
478 | + public function refresh($compileParts=[ |
|
479 | 479 | "tbody" |
480 | 480 | ]) { |
481 | - $this->_compileParts = $compileParts; |
|
481 | + $this->_compileParts=$compileParts; |
|
482 | 482 | return $this; |
483 | 483 | } |
484 | 484 | |
@@ -488,14 +488,14 @@ discard block |
||
488 | 488 | * @param string $position |
489 | 489 | * @return \Ajax\common\html\HtmlDoubleElement |
490 | 490 | */ |
491 | - public function addSearchInToolbar($position = Direction::RIGHT) { |
|
491 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
492 | 492 | return $this->addInToolbar($this->getSearchField()) |
493 | 493 | ->setPosition($position); |
494 | 494 | } |
495 | 495 | |
496 | 496 | public function getSearchField() { |
497 | - if (isset($this->_searchField) === false) { |
|
498 | - $this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search..."); |
|
497 | + if (isset($this->_searchField)===false) { |
|
498 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
499 | 499 | $this->_searchField->addIcon("search", Direction::RIGHT); |
500 | 500 | } |
501 | 501 | return $this->_searchField; |
@@ -523,9 +523,9 @@ discard block |
||
523 | 523 | } |
524 | 524 | |
525 | 525 | protected function getTargetSelector($op) { |
526 | - $result = $this->_targetSelector; |
|
527 | - if (! isset($result[$op])) |
|
528 | - $result = "#" . $this->identifier; |
|
526 | + $result=$this->_targetSelector; |
|
527 | + if (!isset($result[$op])) |
|
528 | + $result="#".$this->identifier; |
|
529 | 529 | return $result[$op]; |
530 | 530 | } |
531 | 531 | |
@@ -537,20 +537,20 @@ discard block |
||
537 | 537 | * @return DataTable |
538 | 538 | */ |
539 | 539 | public function setTargetSelector($_targetSelector) { |
540 | - if (! \is_array($_targetSelector)) { |
|
541 | - $_targetSelector = [ |
|
540 | + if (!\is_array($_targetSelector)) { |
|
541 | + $_targetSelector=[ |
|
542 | 542 | "edit" => $_targetSelector, |
543 | 543 | "delete" => $_targetSelector |
544 | 544 | ]; |
545 | 545 | } |
546 | - $this->_targetSelector = $_targetSelector; |
|
546 | + $this->_targetSelector=$_targetSelector; |
|
547 | 547 | return $this; |
548 | 548 | } |
549 | 549 | |
550 | 550 | public function getRefreshSelector() { |
551 | 551 | if (isset($this->_refreshSelector)) |
552 | 552 | return $this->_refreshSelector; |
553 | - return "#" . $this->identifier . " tbody"; |
|
553 | + return "#".$this->identifier." tbody"; |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | * @return DataTable |
560 | 560 | */ |
561 | 561 | public function setRefreshSelector($_refreshSelector) { |
562 | - $this->_refreshSelector = $_refreshSelector; |
|
562 | + $this->_refreshSelector=$_refreshSelector; |
|
563 | 563 | return $this; |
564 | 564 | } |
565 | 565 | |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | public function show($modelInstance) { |
572 | 572 | if (\is_array($modelInstance)) { |
573 | 573 | if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
574 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
574 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
575 | 575 | } |
576 | - $this->_modelInstance = $modelInstance; |
|
576 | + $this->_modelInstance=$modelInstance; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | public function getRowClass() { |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | * @return DataTable |
588 | 588 | */ |
589 | 589 | public function setRowClass($_rowClass) { |
590 | - $this->_rowClass = $_rowClass; |
|
590 | + $this->_rowClass=$_rowClass; |
|
591 | 591 | return $this; |
592 | 592 | } |
593 | 593 | |
@@ -598,34 +598,34 @@ discard block |
||
598 | 598 | * @return DataTable |
599 | 599 | */ |
600 | 600 | public function setEmptyMessage($_emptyMessage) { |
601 | - $this->_emptyMessage = $_emptyMessage; |
|
601 | + $this->_emptyMessage=$_emptyMessage; |
|
602 | 602 | return $this; |
603 | 603 | } |
604 | 604 | |
605 | - public function setSortable($colIndex = NULL) { |
|
606 | - $this->_sortable = $colIndex; |
|
605 | + public function setSortable($colIndex=NULL) { |
|
606 | + $this->_sortable=$colIndex; |
|
607 | 607 | return $this; |
608 | 608 | } |
609 | 609 | |
610 | - public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) { |
|
610 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
611 | 611 | $this->_self->setActiveRowSelector($class, $event, $multiple); |
612 | 612 | return $this; |
613 | 613 | } |
614 | 614 | |
615 | 615 | public function hideColumn($colIndex) { |
616 | - if (! \is_array($this->_hiddenColumns)) |
|
617 | - $this->_hiddenColumns = []; |
|
618 | - $this->_hiddenColumns[] = $colIndex; |
|
616 | + if (!\is_array($this->_hiddenColumns)) |
|
617 | + $this->_hiddenColumns=[]; |
|
618 | + $this->_hiddenColumns[]=$colIndex; |
|
619 | 619 | return $this; |
620 | 620 | } |
621 | 621 | |
622 | 622 | public function setColWidth($colIndex, $width) { |
623 | - $this->_colWidths[$colIndex] = $width; |
|
623 | + $this->_colWidths[$colIndex]=$width; |
|
624 | 624 | return $this; |
625 | 625 | } |
626 | 626 | |
627 | 627 | public function setColWidths($_colWidths) { |
628 | - $this->_colWidths = $_colWidths; |
|
628 | + $this->_colWidths=$_colWidths; |
|
629 | 629 | return $this; |
630 | 630 | } |
631 | 631 | |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | return $this; |
635 | 635 | } |
636 | 636 | |
637 | - public function trigger($event, $params = "[]") { |
|
637 | + public function trigger($event, $params="[]") { |
|
638 | 638 | return $this->getHtmlComponent()->trigger($event, $params); |
639 | 639 | } |
640 | 640 | |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | * @param mixed $_displayBehavior |
673 | 673 | */ |
674 | 674 | public function setDisplayBehavior($_displayBehavior) { |
675 | - $this->_displayBehavior = $_displayBehavior; |
|
675 | + $this->_displayBehavior=$_displayBehavior; |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | /** |