ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilTermsOfServiceTableDatabaseDataProvider.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
require_once
'Services/TermsOfService/interfaces/interface.ilTermsOfServiceTableDataProvider.php'
;
5
11
abstract
class
ilTermsOfServiceTableDatabaseDataProvider
implements
ilTermsOfServiceTableDataProvider
12
{
16
protected
$db
;
17
22
public
function
__construct
(
ilDBInterface
$db
)
23
{
24
$this->db =
$db
;
25
}
26
33
abstract
protected
function
getSelectPart
(
array
$params
,
array
$filter);
34
41
abstract
protected
function
getFromPart
(
array
$params,
array
$filter);
42
49
abstract
protected
function
getWherePart
(
array
$params,
array
$filter);
50
57
abstract
protected
function
getGroupByPart
(
array
$params,
array
$filter);
58
65
abstract
protected
function
getHavingPart
(
array
$params,
array
$filter);
66
73
abstract
protected
function
getOrderByPart
(
array
$params,
array
$filter);
74
81
public
function
getList
(
array
$params,
array
$filter)
82
{
83
$data
=
array
(
84
'items'
=>
array
(),
85
'cnt'
=> 0
86
);
87
88
$select = $this->
getSelectPart
($params, $filter);
89
$where = $this->
getWherePart
($params, $filter);
90
$from
= $this->
getFromPart
($params, $filter);
91
$order = $this->
getOrderByPart
($params, $filter);
92
$group = $this->
getGroupByPart
($params, $filter);
93
$having = $this->
getHavingPart
($params, $filter);
94
95
if
(isset($params[
'limit'
])) {
96
if
(!is_numeric($params[
'limit'
])) {
97
throw
new
InvalidArgumentException
(
'Please provide a valid numerical limit.'
);
98
}
99
100
if
(!isset($params[
'offset'
])) {
101
$params[
'offset'
] = 0;
102
} elseif (!is_numeric($params[
'offset'
])) {
103
throw
new
InvalidArgumentException
(
'Please provide a valid numerical offset.'
);
104
}
105
106
$this->db->setLimit($params[
'limit'
], $params[
'offset'
]);
107
}
108
109
$where = strlen($where) ?
'WHERE '
. $where :
''
;
110
$query
=
"SELECT {$select} FROM {$from} {$where}"
;
111
112
if
(strlen($group)) {
113
$query
.=
" GROUP BY {$group}"
;
114
}
115
116
if
(strlen($having)) {
117
$query
.=
" HAVING {$having}"
;
118
}
119
120
if
(strlen($order)) {
121
$query
.=
" ORDER BY {$order}"
;
122
}
123
124
$res
= $this->db->query(
$query
);
125
while
(
$row
= $this->db->fetchAssoc(
$res
)) {
126
$data
[
'items'
][] =
$row
;
127
}
128
129
if
(isset($params[
'limit'
])) {
130
$cnt_sql =
"SELECT COUNT(*) cnt FROM ({$query}) subquery"
;
131
$row_cnt = $this->db->fetchAssoc($this->db->query($cnt_sql));
132
$data
[
'cnt'
] = $row_cnt[
'cnt'
];
133
}
134
135
return
$data
;
136
}
137
}
$params
$params
Definition:
disable.php:11
ilTermsOfServiceTableDatabaseDataProvider\getSelectPart
getSelectPart(array $params, array $filter)
ilTermsOfServiceTableDatabaseDataProvider\getOrderByPart
getOrderByPart(array $params, array $filter)
ilTermsOfServiceTableDatabaseDataProvider\getList
getList(array $params, array $filter)
Definition:
class.ilTermsOfServiceTableDatabaseDataProvider.php:81
ilTermsOfServiceTableDatabaseDataProvider\getGroupByPart
getGroupByPart(array $params, array $filter)
ilTermsOfServiceTableDatabaseDataProvider\__construct
__construct(ilDBInterface $db)
ilTermsOfServiceTableDatabaseDataProvider constructor.
Definition:
class.ilTermsOfServiceTableDatabaseDataProvider.php:22
ilTermsOfServiceTableDatabaseDataProvider\getHavingPart
getHavingPart(array $params, array $filter)
$from
$from
Definition:
logout-iframe.php:5
ilTermsOfServiceTableDataProvider
Definition:
interface.ilTermsOfServiceTableDataProvider.php:8
ilDBInterface
Interface ilDBInterface.
Definition:
interface.ilDBInterface.php:9
ilTermsOfServiceTableDatabaseDataProvider\getFromPart
getFromPart(array $params, array $filter)
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilTermsOfServiceTableDatabaseDataProvider\getWherePart
getWherePart(array $params, array $filter)
$data
$data
Definition:
test-settings.sample.php:14
$query
$query
Definition:
proxy_ylocal.php:13
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
ilTermsOfServiceTableDatabaseDataProvider\$db
$db
Definition:
class.ilTermsOfServiceTableDatabaseDataProvider.php:16
ilTermsOfServiceTableDatabaseDataProvider
Definition:
class.ilTermsOfServiceTableDatabaseDataProvider.php:11
InvalidArgumentException
$row
$row
Definition:
10autofilter-selection-1.php:74
Services
TermsOfService
classes
class.ilTermsOfServiceTableDatabaseDataProvider.php
Generated on Sat Jan 18 2025 19:01:38 for ILIAS by
1.8.13 (using
Doxyfile
)