1 <?php declare(strict_types=1);
48 $defaultTitle = $DIC->language()->txt(
'certificate_no_object_title');
61 cert.pattern_certificate_id, 65 cert.acquired_timestamp, 66 cert.currently_active, 78 $query = $this->database->query($sql);
80 if ([] !== $ilCtrlStack) {
81 $ilCtrlStack[] = ilUserCertificateApiGUI::class;
85 while ($row = $this->database->fetchAssoc(
$query)) {
86 $id = (int) $row[
'id'];
89 $result[$id]->addRefId((
int) $row[
'ref_id']);
94 if ([] !== $ilCtrlStack) {
95 $this->controller->setParameterByClass(ilUserCertificateApiGUI::class,
'certificate_id', $id);
97 $this->controller->clearParametersByClass(ilUserCertificateApiGUI::class);
102 $row[
'title'] ?? $this->defaultTitle,
103 (
int) $row[
'obj_id'],
104 (
int) $row[
'acquired_timestamp'],
105 (
int) $row[
'user_id'],
109 (
string) $row[
'email'],
110 (
string) $row[
'second_email'],
111 [(
int) $row[
'ref_id']],
138 $query = $this->database->query($sql);
140 $max_count = intval($this->database->fetchAssoc(
$query)[
"count"]);
156 il_cert_user_cert.pattern_certificate_id, 157 il_cert_user_cert.obj_id, 158 il_cert_user_cert.user_id, 159 il_cert_user_cert.user_name, 160 il_cert_user_cert.acquired_timestamp, 161 il_cert_user_cert.currently_active, 162 il_cert_user_cert.id, 164 object_reference.ref_id 165 FROM il_cert_user_cert 166 INNER JOIN object_data ON object_data.obj_id = il_cert_user_cert.obj_id 167 INNER JOIN object_reference ON object_reference.obj_id = il_cert_user_cert.obj_id';
173 il_cert_user_cert.pattern_certificate_id, 174 il_cert_user_cert.obj_id, 175 il_cert_user_cert.user_id, 176 il_cert_user_cert.user_name, 177 il_cert_user_cert.acquired_timestamp, 178 il_cert_user_cert.currently_active, 179 il_cert_user_cert.id, 180 object_data_del.title, 182 FROM il_cert_user_cert 183 INNER JOIN object_data_del ON object_data_del.obj_id = il_cert_user_cert.obj_id';
186 WHERE object_reference.deleted IS NULL';
191 INNER JOIN usr_data ON usr_data.usr_id = cert.user_id 192 INNER JOIN il_orgu_ua ON il_orgu_ua.user_id = cert.user_id 195 if (!$max_count_only) {
217 foreach ($sorts as [$key, $direction]) {
222 $orders[] =
'usr_data.login' . $direction;
226 $orders[] =
'usr_data.firstname' . $direction;
230 $orders[] =
'usr_data.lastname' . $direction;
234 $orders[] =
'cert.title' . $direction;
238 $orders[] =
'cert.acquired_timestamp' . $direction;
242 $orders[] =
'usr_data.email' . $direction;
250 $orderBy =
' ORDER BY ' . implode(
', ', $orders);
265 if (!empty($userIds)) {
270 if (!empty($objIds)) {
275 if (!empty($firstName)) {
276 $wheres[] = $this->database->like(
'usr_data.firstname',
ilDBConstants::T_TEXT,
'%' . $firstName .
'%');
280 if (!empty($lastName)) {
281 $wheres[] = $this->database->like(
'usr_data.lastname',
ilDBConstants::T_TEXT,
'%' . $lastName .
'%');
290 if (!empty($userEmail)) {
291 $wheres[] =
'(' . $this->database->like(
'usr_data.email',
ilDBConstants::T_TEXT,
'%' . $userEmail .
'%')
292 .
' OR ' . $this->database->like(
'usr_data.second_email',
ilDBConstants::T_TEXT,
'%' . $userEmail .
'%')
297 if (!empty($userIdentification)) {
298 $wheres[] =
'(' . $this->database->like(
'usr_data.login',
ilDBConstants::T_TEXT,
'%' . $userIdentification .
'%')
299 .
' OR ' . $this->database->like(
'usr_data.firstname',
ilDBConstants::T_TEXT,
'%' . $userIdentification .
'%')
300 .
' OR ' . $this->database->like(
'usr_data.lastname',
ilDBConstants::T_TEXT,
'%' . $userIdentification .
'%')
301 .
' OR ' . $this->database->like(
'usr_data.email',
ilDBConstants::T_TEXT,
'%' . $userIdentification .
'%')
302 .
' OR ' . $this->database->like(
'usr_data.second_email',
ilDBConstants::T_TEXT,
'%' . $userIdentification .
'%')
307 if ($issuedBeforeTimestamp !== null) {
308 $wheres[] =
'cert.acquired_timestamp < ' . $this->database->quote(
309 $issuedBeforeTimestamp,
315 if ($issuedAfterTimestamp !== null) {
316 $wheres[] =
'cert.acquired_timestamp > ' . $this->database->quote(
317 $issuedAfterTimestamp,
323 if (!empty($title)) {
328 if ($onlyCertActive ===
true) {
337 if (empty($wheres)) {
341 $sql =
'WHERE ' . implode(
' AND ', $wheres);
const SORT_FIELD_USR_LOGIN
getQuery(UserDataFilter $filter, bool $max_count_only=false)
__construct(\ilDBInterface $database, \ilLogger $logger, \ilCtrl $controller, string $defaultTitle=null)
This class provides processing control methods.
getIssuedBeforeTimestamp()
const SORT_DIRECTION_DESC
const SORT_FIELD_ISSUE_TIMESTAMP
const SORT_FIELD_OBJ_TITLE
const SORT_FIELD_USR_FIRSTNAME
createOrderByClause(UserDataFilter $filter)
const SORT_FIELD_USR_LASTNAME
shouldIncludeDeletedObjects()
createWhereCondition(UserDataFilter $filter)
Creating the additional where condition based on the filter object.
getUserData(UserDataFilter $filter, array $ilCtrlStack)
getIssuedAfterTimestamp()
Component logger with individual log levels by component id.
const SORT_FIELD_USR_EMAIL
getUserCertificateDataMaxCount(UserDataFilter $filter)