ILIAS  release_8 Revision v8.23
ilTermsOfServiceTableDatabaseDataProvider Class Reference

Class ilTermsOfServiceTableDatabaseDataProvider. More...

+ Inheritance diagram for ilTermsOfServiceTableDatabaseDataProvider:
+ Collaboration diagram for ilTermsOfServiceTableDatabaseDataProvider:

Public Member Functions

 __construct (ilDBInterface $db)
 
 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

ilDBInterface $db
 

Detailed Description

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 83 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

References $data, $query, $res, getFromPart(), getGroupByPart(), getHavingPart(), getOrderByPart(), getSelectPart(), getWherePart(), and ILIAS\Repository\int().

83  : array
84  {
85  $data = [
86  'items' => [],
87  'cnt' => 0
88  ];
89 
90  $select = $this->getSelectPart($params, $filter);
91  $where = $this->getWherePart($params, $filter);
92  $from = $this->getFromPart($params, $filter);
93  $order = $this->getOrderByPart($params, $filter);
94  $group = $this->getGroupByPart($params, $filter);
95  $having = $this->getHavingPart($params, $filter);
96 
97  if (isset($params['limit'])) {
98  if (!is_numeric($params['limit'])) {
99  throw new InvalidArgumentException('Please provide a valid numerical limit.');
100  }
101 
102  if (!isset($params['offset'])) {
103  $params['offset'] = 0;
104  } elseif (!is_numeric($params['offset'])) {
105  throw new InvalidArgumentException('Please provide a valid numerical offset.');
106  }
107 
108  $this->db->setLimit($params['limit'], $params['offset']);
109  }
110 
111  $where = $where !== '' ? 'WHERE ' . $where : '';
112  $query = "SELECT $select FROM $from $where";
113 
114  if ($group !== '') {
115  $query .= " GROUP BY $group";
116  }
117 
118  if ($having !== '') {
119  $query .= " HAVING $having";
120  }
121 
122  if ($order !== '') {
123  $query .= " ORDER BY $order";
124  }
125 
126  $res = $this->db->query($query);
127  while ($row = $this->db->fetchAssoc($res)) {
128  $data['items'][] = $row;
129  }
130 
131  if (isset($params['limit'])) {
132  $cnt_sql = "SELECT COUNT(*) cnt FROM ($query) subquery";
133  $row_cnt = $this->db->fetchAssoc($this->db->query($cnt_sql));
134  $data['cnt'] = (int) $row_cnt['cnt'];
135  }
136 
137  return $data;
138  }
$res
Definition: ltiservices.php:69
getSelectPart(array $params, array $filter)
getOrderByPart(array $params, array $filter)
getGroupByPart(array $params, array $filter)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
getHavingPart(array $params, array $filter)
getFromPart(array $params, array $filter)
getWherePart(array $params, array $filter)
$query
+ 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

ilDBInterface ilTermsOfServiceTableDatabaseDataProvider::$db
protected

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

Referenced by __construct().


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