ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTermsOfServiceTableDatabaseDataProvider Class Reference

Class ilTermsOfServiceTableDatabaseDataProvider. More...

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

Public Member Functions

 __construct (ilDBInterface $db)
 ilTermsOfServiceTableDatabaseDataProvider constructor. More...
 
 getList (array $params, array $filter)
 
 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

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

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

◆ getGroupByPart()

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

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

◆ getHavingPart()

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

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by 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 71 of file class.ilTermsOfServiceTableDatabaseDataProvider.php.

71 : array
72 {
73 $data = [
74 'items' => [],
75 'cnt' => 0
76 ];
77
78 $select = $this->getSelectPart($params, $filter);
79 $where = $this->getWherePart($params, $filter);
80 $from = $this->getFromPart($params, $filter);
81 $order = $this->getOrderByPart($params, $filter);
82 $group = $this->getGroupByPart($params, $filter);
83 $having = $this->getHavingPart($params, $filter);
84
85 if (isset($params['limit'])) {
86 if (!is_numeric($params['limit'])) {
87 throw new InvalidArgumentException('Please provide a valid numerical limit.');
88 }
89
90 if (!isset($params['offset'])) {
91 $params['offset'] = 0;
92 } else {
93 if (!is_numeric($params['offset'])) {
94 throw new InvalidArgumentException('Please provide a valid numerical offset.');
95 }
96 }
97
98 $this->db->setLimit($params['limit'], $params['offset']);
99 }
100
101 $where = strlen($where) ? 'WHERE ' . $where : '';
102 $query = "SELECT {$select} FROM {$from} {$where}";
103
104 if (strlen($group)) {
105 $query .= " GROUP BY {$group}";
106 }
107
108 if (strlen($having)) {
109 $query .= " HAVING {$having}";
110 }
111
112 if (strlen($order)) {
113 $query .= " ORDER BY {$order}";
114 }
115
116 $res = $this->db->query($query);
117 while ($row = $this->db->fetchAssoc($res)) {
118 $data['items'][] = $row;
119 }
120
121 if (isset($params['limit'])) {
122 $cnt_sql = "SELECT COUNT(*) cnt FROM ({$query}) subquery";
123 $row_cnt = $this->db->fetchAssoc($this->db->query($cnt_sql));
124 $data['cnt'] = $row_cnt['cnt'];
125 }
126
127 return $data;
128 }
getWherePart(array $params, array $filter)
getOrderByPart(array $params, array $filter)
getSelectPart(array $params, array $filter)
getGroupByPart(array $params, array $filter)
getFromPart(array $params, array $filter)
getHavingPart(array $params, array $filter)
$query
foreach($_POST as $key=> $value) $res
$data
Definition: storeScorm.php:23

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

+ Here is the call graph for this function:

◆ getOrderByPart()

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

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

◆ getSelectPart()

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

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

◆ getWherePart()

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

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by getList().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTermsOfServiceTableDatabaseDataProvider::$db
protected

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

Referenced by __construct().


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