BidIncrements.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /**
  3. *
  4. * PHP Pro Bid $Id$ wh3ioOwTfp9APDQp0mi2fDRYyP72TXTlVQ+qS3exRHo=
  5. *
  6. * @link http://www.phpprobid.com
  7. * @copyright Copyright (c) 2014 Online Ventures Software LTD & CodeCube SRL
  8. * @license http://www.phpprobid.com/license Commercial License
  9. *
  10. * @version 7.0
  11. */
  12. /**
  13. * bid increments table service class
  14. */
  15. namespace Ppb\Service\Table;
  16. use Ppb\Db\Table\BidIncrements as BidIncrementsTable;
  17. class BidIncrements extends AbstractServiceTable
  18. {
  19. public function __construct()
  20. {
  21. parent::__construct();
  22. $this->setTable(
  23. new BidIncrementsTable());
  24. }
  25. /**
  26. *
  27. * get all table columns needed to generate the
  28. * bid increments management table in the admin area
  29. *
  30. * @return array
  31. */
  32. public function getColumns()
  33. {
  34. return array(
  35. array(
  36. 'label' => $this->_('From'),
  37. 'element_id' => 'tier_from',
  38. 'class' => 'size-small',
  39. ),
  40. array(
  41. 'label' => $this->_('To'),
  42. 'element_id' => 'tier_to',
  43. 'class' => 'size-small',
  44. ),
  45. array(
  46. 'label' => $this->_('Increment Amount'),
  47. 'element_id' => 'amount',
  48. ),
  49. array(
  50. 'label' => $this->_('Delete'),
  51. 'class' => 'size-mini',
  52. 'element_id' => array(
  53. 'id', 'delete'
  54. ),
  55. ),
  56. );
  57. }
  58. /**
  59. *
  60. * get all form elements that are needed to generate the
  61. * bid increments management table in the admin area
  62. *
  63. * @return array
  64. */
  65. public function getElements()
  66. {
  67. return array(
  68. array(
  69. 'id' => 'id',
  70. 'element' => 'hidden',
  71. ),
  72. array(
  73. 'id' => 'amount',
  74. 'element' => 'text',
  75. 'attributes' => array(
  76. 'class' => 'form-control input-mini',
  77. ),
  78. ),
  79. array(
  80. 'id' => 'tier_from',
  81. 'element' => 'text',
  82. 'attributes' => array(
  83. 'class' => 'form-control input-mini',
  84. ),
  85. ),
  86. array(
  87. 'id' => 'tier_to',
  88. 'element' => 'text',
  89. 'attributes' => array(
  90. 'class' => 'form-control input-mini',
  91. ),
  92. ),
  93. array(
  94. 'id' => 'delete',
  95. 'element' => 'checkbox',
  96. ),
  97. );
  98. }
  99. /**
  100. *
  101. * fetches all matched rows
  102. *
  103. * @param string|\Cube\Db\Select $where SQL where clause, or a select object
  104. * @param string|array $order
  105. * @param int $count
  106. * @param int $offset
  107. * @return array
  108. */
  109. public function fetchAll($where = null, $order = null, $count = null, $offset = null)
  110. {
  111. if ($order === null) {
  112. $order = 'tier_from ASC';
  113. }
  114. return parent::fetchAll($where, $order, $count, $offset);
  115. }
  116. }