@@ -31,7 +31,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |