TableLength.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\UI\Traits;
  3. // to do disable title
  4. /**
  5. * Title elements related functions
  6. *
  7. * @autor ThurData <info@thrudata.ch>
  8. */
  9. trait TableLength
  10. {
  11. protected $tableLength = 10;
  12. protected $tableLengthList = [10, 25];
  13. protected $isTableLengthInfinity = true;
  14. public function enabledTalbeLengthInfinity()
  15. {
  16. $this->isTableLengthInfinity = true;
  17. return $this;
  18. }
  19. public function disabledTalbeLengthInfinity()
  20. {
  21. $this->isTableLengthInfinity = false;
  22. return $this;
  23. }
  24. public function setTableLengthList(array $tableLengthList = [])
  25. {
  26. $this->tableLengthList = $tableLengthList;
  27. return $this;
  28. }
  29. public function getTableLengthList()
  30. {
  31. $returnList = $this->tableLengthList;
  32. if ($this->isTableLengthInfinity)
  33. {
  34. $returnList[] = "inf";
  35. }
  36. return $returnList;
  37. }
  38. public function setTableLength($tableLength = 10)
  39. {
  40. if (in_array($tableLength, $this->tableLengthList, true))
  41. {
  42. $this->tableLength = $tableLength;
  43. }
  44. return $this;
  45. }
  46. public function getTableLength()
  47. {
  48. return $this->tableLength;
  49. }
  50. }