XOOPS  2.6.0
CriteriaElement.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
12 namespace Xoops\Core\Kernel;
13 
15 
31 abstract class CriteriaElement
32 {
38  protected $order = 'ASC';
39 
43  protected $sort = '';
44 
50  protected $limit = 0;
51 
57  protected $start = 0;
58 
62  protected $groupby = '';
63 
64 
70  abstract public function render();
71 
77  abstract public function renderWhere();
78 
84  abstract public function renderLdap();
85 
95  abstract public function renderQb(QueryBuilder $qb = null, $whereMode = '');
96 
109  abstract public function buildExpressionQb(QueryBuilder $qb);
110 
118  public function setSort($sort)
119  {
120  $this->sort = $sort;
121  }
122 
128  public function getSort()
129  {
130  return $this->sort;
131  }
132 
140  public function setOrder($order)
141  {
142  if (is_string($order)) {
143  $order = strtoupper($order);
144  if (in_array($order, array('ASC','DESC'))) {
145  $this->order = $order;
146  }
147  }
148  }
149 
155  public function getOrder()
156  {
157  return $this->order;
158  }
159 
167  public function setLimit($limit = 0)
168  {
169  $this->limit = intval($limit);
170  }
171 
177  public function getLimit()
178  {
179  return $this->limit;
180  }
181 
189  public function setStart($start = 0)
190  {
191  $this->start = intval($start);
192  }
193 
199  public function getStart()
200  {
201  return $this->start;
202  }
203 
211  public function setGroupby($group)
212  {
213  $this->groupby = $group;
214  }
215 
221  public function getGroupby()
222  {
223  return isset($this->groupby) ? $this->groupby : "";
224  }
225 }
renderQb(QueryBuilder $qb=null, $whereMode= '')
buildExpressionQb(QueryBuilder $qb)