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

Class ilAccessibilityTableDatabaseDataProvider. More...

+ Inheritance diagram for ilAccessibilityTableDatabaseDataProvider:
+ Collaboration diagram for ilAccessibilityTableDatabaseDataProvider:

Public Member Functions

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

ilAccessibilityTableDatabaseDataProvider::__construct ( ilDBInterface  $db)

Member Function Documentation

◆ getFromPart()

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

Referenced by getList().

+ Here is the caller graph for this function:

◆ getGroupByPart()

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

Referenced by getList().

+ Here is the caller graph for this function:

◆ getHavingPart()

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

Referenced by getList().

+ Here is the caller graph for this function:

◆ getList()

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

Implements ilAccessibilityTableDataProvider.

Definition at line 70 of file class.ilAccessibilityTableDatabaseDataProvider.php.

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

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

Referenced by getList().

+ Here is the caller graph for this function:

◆ getSelectPart()

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

Referenced by getList().

+ Here is the caller graph for this function:

◆ getWherePart()

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

Referenced by getList().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilAccessibilityTableDatabaseDataProvider::$db
protected

Definition at line 10 of file class.ilAccessibilityTableDatabaseDataProvider.php.

Referenced by __construct().


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