ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAccessibilityTableDatabaseDataProvider Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

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

ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilAccessibilityTableDatabaseDataProvider

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

Constructor & Destructor Documentation

◆ __construct()

ilAccessibilityTableDatabaseDataProvider::__construct ( ilDBInterface  $db)

Member Function Documentation

◆ getFromPart()

ilAccessibilityTableDatabaseDataProvider::getFromPart ( array  $params,
array  $filter 
)
abstractprotected

Referenced by getList().

+ Here is the caller graph for this function:

◆ getGroupByPart()

ilAccessibilityTableDatabaseDataProvider::getGroupByPart ( array  $params,
array  $filter 
)
abstractprotected

Referenced by getList().

+ Here is the caller graph for this function:

◆ getHavingPart()

ilAccessibilityTableDatabaseDataProvider::getHavingPart ( array  $params,
array  $filter 
)
abstractprotected

Referenced by getList().

+ Here is the caller graph for this function:

◆ getList()

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

Implements ilAccessibilityTableDataProvider.

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

46 : array
47 {
48 $data = [
49 'items' => [],
50 'cnt' => 0
51 ];
52
53 $select = $this->getSelectPart($params, $filter);
54 $where = $this->getWherePart($params, $filter);
55 $from = $this->getFromPart($params, $filter);
56 $order = $this->getOrderByPart($params, $filter);
57 $group = $this->getGroupByPart($params, $filter);
58 $having = $this->getHavingPart($params, $filter);
59
60 if (isset($params['limit'])) {
61 if (!is_numeric($params['limit'])) {
62 throw new InvalidArgumentException('Please provide a valid numerical limit.');
63 }
64
65 if (!isset($params['offset'])) {
66 $params['offset'] = 0;
67 } else {
68 if (!is_numeric($params['offset'])) {
69 throw new InvalidArgumentException('Please provide a valid numerical offset.');
70 }
71 }
72
73 $this->db->setLimit($params['limit'], $params['offset']);
74 }
75
76 $where = strlen($where) ? 'WHERE ' . $where : '';
77 $query = "SELECT {$select} FROM {$from} {$where}";
78
79 if (strlen($group)) {
80 $query .= " GROUP BY {$group}";
81 }
82
83 if (strlen($having)) {
84 $query .= " HAVING {$having}";
85 }
86
87 if (strlen($order)) {
88 $query .= " ORDER BY {$order}";
89 }
90
91 $res = $this->db->query($query);
92 while ($row = $this->db->fetchAssoc($res)) {
93 $data['items'][] = $row;
94 }
95
96 if (isset($params['limit'])) {
97 $cnt_sql = "SELECT COUNT(*) cnt FROM ({$query}) subquery";
98 $row_cnt = $this->db->fetchAssoc($this->db->query($cnt_sql));
99 $data['cnt'] = $row_cnt['cnt'];
100 }
101
102 return $data;
103 }
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)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
$res
Definition: ltiservices.php:69

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

+ Here is the call graph for this function:

◆ getOrderByPart()

ilAccessibilityTableDatabaseDataProvider::getOrderByPart ( array  $params,
array  $filter 
)
abstractprotected

Referenced by getList().

+ Here is the caller graph for this function:

◆ getSelectPart()

ilAccessibilityTableDatabaseDataProvider::getSelectPart ( array  $params,
array  $filter 
)
abstractprotected

Referenced by getList().

+ Here is the caller graph for this function:

◆ getWherePart()

ilAccessibilityTableDatabaseDataProvider::getWherePart ( array  $params,
array  $filter 
)
abstractprotected

Referenced by getList().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilAccessibilityTableDatabaseDataProvider::$db
protected

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

Referenced by __construct().


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