ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTermsOfServiceTableDatabaseDataProvider Class Reference
+ Inheritance diagram for ilTermsOfServiceTableDatabaseDataProvider:
+ Collaboration diagram for ilTermsOfServiceTableDatabaseDataProvider:

Public Member Functions

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

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

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

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceTableDatabaseDataProvider::__construct ( ilDB  $db)

Member Function Documentation

◆ getFromPart()

ilTermsOfServiceTableDatabaseDataProvider::getFromPart ( 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:

◆ getGroupByPart()

ilTermsOfServiceTableDatabaseDataProvider::getGroupByPart ( 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:

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

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

References $data, $params, $query, $res, $row, 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 @abstract

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 @abstract

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 @abstract

Reimplemented in ilTermsOfServiceAcceptanceHistoryProvider.

Referenced by 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: