4 require_once
'Services/TermsOfService/interfaces/interface.ilTermsOfServiceTableDataProvider.php';
32 abstract protected function getSelectPart(array $params, array $filter);
40 abstract protected function getFromPart(array $params, array $filter);
48 abstract protected function getWherePart(array $params, array $filter);
56 abstract protected function getGroupByPart(array $params, array $filter);
64 abstract protected function getHavingPart(array $params, array $filter);
72 abstract protected function getOrderByPart(array $params, array $filter);
80 public function getList(array $params, array $filter)
94 if(isset($params[
'limit']))
96 if(!is_numeric($params[
'limit']))
98 throw new InvalidArgumentException(
'Please provide a valid numerical limit.');
101 if(!isset($params[
'offset']))
103 $params[
'offset'] = 0;
105 else if(!is_numeric($params[
'offset']))
107 throw new InvalidArgumentException(
'Please provide a valid numerical offset.');
110 $this->db->setLimit($params[
'limit'], $params[
'offset']);
113 $where = strlen($where) ?
'WHERE ' . $where :
'';
114 $query =
"SELECT {$select} FROM {$from} {$where}";
118 $query .=
" GROUP BY {$group}";
123 $query .=
" HAVING {$having}";
128 $query .=
" ORDER BY {$order}";
132 while(
$row = $this->db->fetchAssoc(
$res))
134 $data[
'items'][] =
$row;
137 if(isset($params[
'limit']))
139 $cnt_sql =
"SELECT COUNT(*) cnt FROM ({$query}) subquery";
140 $row_cnt = $this->db->fetchAssoc($this->db->query($cnt_sql));
141 $data[
'cnt'] = $row_cnt[
'cnt'];