ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTermsOfServiceTableDatabaseDataProvider Class Reference
+ Inheritance diagram for ilTermsOfServiceTableDatabaseDataProvider:
+ Collaboration diagram for ilTermsOfServiceTableDatabaseDataProvider:

Public Member Functions

 __construct (ilDBInterface $db)
 ilTermsOfServiceTableDatabaseDataProvider constructor. More...
 
 getList (array $params, array $filter)
 

Protected Member Functions

 getSelectPart (array $params, array $filter)
 
 getFromPart (array $params, array $filter)
 
 getWherePart (array $params, array $filter)
 
 getGroupByPart (array $params, array $filter)
 
 getHavingPart (array $params, array $filter)
 
 getOrderByPart (array $params, array $filter)
 

Protected Attributes

 $db
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 11 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceTableDatabaseDataProvider::__construct ( ilDBInterface  $db)

Member Function Documentation

◆ getFromPart()

ilTermsOfServiceTableDatabaseDataProvider::getFromPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Referenced by __construct(), and getList().

+ Here is the caller graph for this function:

◆ getGroupByPart()

ilTermsOfServiceTableDatabaseDataProvider::getGroupByPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Referenced by __construct(), and getList().

+ Here is the caller graph for this function:

◆ getHavingPart()

ilTermsOfServiceTableDatabaseDataProvider::getHavingPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Referenced by __construct(), and getList().

+ Here is the caller graph for this function:

◆ getList()

ilTermsOfServiceTableDatabaseDataProvider::getList ( array  $params,
array  $filter 
)
Parameters
array$params
array$filter
Returns
array
Exceptions
InvalidArgumentException

Implements ilTermsOfServiceTableDataProvider.

Definition at line 81 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

References $data, $from, $query, $res, $row, array, getFromPart(), getGroupByPart(), getHavingPart(), getOrderByPart(), getSelectPart(), and getWherePart().

82  {
83  $data = array(
84  'items' => array(),
85  'cnt' => 0
86  );
87 
88  $select = $this->getSelectPart($params, $filter);
89  $where = $this->getWherePart($params, $filter);
90  $from = $this->getFromPart($params, $filter);
91  $order = $this->getOrderByPart($params, $filter);
92  $group = $this->getGroupByPart($params, $filter);
93  $having = $this->getHavingPart($params, $filter);
94 
95  if (isset($params['limit'])) {
96  if (!is_numeric($params['limit'])) {
97  throw new InvalidArgumentException('Please provide a valid numerical limit.');
98  }
99 
100  if (!isset($params['offset'])) {
101  $params['offset'] = 0;
102  } elseif (!is_numeric($params['offset'])) {
103  throw new InvalidArgumentException('Please provide a valid numerical offset.');
104  }
105 
106  $this->db->setLimit($params['limit'], $params['offset']);
107  }
108 
109  $where = strlen($where) ? 'WHERE ' . $where : '';
110  $query = "SELECT {$select} FROM {$from} {$where}";
111 
112  if (strlen($group)) {
113  $query .= " GROUP BY {$group}";
114  }
115 
116  if (strlen($having)) {
117  $query .= " HAVING {$having}";
118  }
119 
120  if (strlen($order)) {
121  $query .= " ORDER BY {$order}";
122  }
123 
124  $res = $this->db->query($query);
125  while ($row = $this->db->fetchAssoc($res)) {
126  $data['items'][] = $row;
127  }
128 
129  if (isset($params['limit'])) {
130  $cnt_sql = "SELECT COUNT(*) cnt FROM ({$query}) subquery";
131  $row_cnt = $this->db->fetchAssoc($this->db->query($cnt_sql));
132  $data['cnt'] = $row_cnt['cnt'];
133  }
134 
135  return $data;
136  }
$params
Definition: disable.php:11
getSelectPart(array $params, array $filter)
getOrderByPart(array $params, array $filter)
getGroupByPart(array $params, array $filter)
getHavingPart(array $params, array $filter)
$from
getFromPart(array $params, array $filter)
foreach($_POST as $key=> $value) $res
getWherePart(array $params, array $filter)
$query
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getOrderByPart()

ilTermsOfServiceTableDatabaseDataProvider::getOrderByPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Referenced by __construct(), and getList().

+ Here is the caller graph for this function:

◆ getSelectPart()

ilTermsOfServiceTableDatabaseDataProvider::getSelectPart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Referenced by __construct(), and getList().

+ Here is the caller graph for this function:

◆ getWherePart()

ilTermsOfServiceTableDatabaseDataProvider::getWherePart ( array  $params,
array  $filter 
)
abstractprotected
Parameters
array$params
array$filter
Returns
string

Referenced by __construct(), and getList().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTermsOfServiceTableDatabaseDataProvider::$db
protected

Definition at line 16 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

Referenced by __construct().


The documentation for this class was generated from the following file: