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);
81 while ($row = $this->database->fetchAssoc(
$query)) {
82 $id = (int) $row[
'id'];
85 $result[$id]->addRefId((
int) $row[
'ref_id']);
90 if ([] !== $ilCtrlStack) {
91 $ilCtrlStack[] = ilUserCertificateApiGUI::class;
92 $this->controller->setParameterByClass(ilUserCertificateApiGUI::class,
'certificate_id', $id);
94 $this->controller->clearParametersByClass(ilUserCertificateApiGUI::class);
99 $row[
'title'] ?? $this->defaultTitle,
100 (
int) $row[
'obj_id'],
101 (
int) $row[
'acquired_timestamp'],
102 (
int) $row[
'user_id'],
106 (
string) $row[
'email'],
107 (
string) $row[
'second_email'],
108 [(
int) $row[
'ref_id']],
135 $query = $this->database->query($sql);
137 $max_count = intval($this->database->fetchAssoc(
$query)[
"count"]);
153 il_cert_user_cert.pattern_certificate_id, 154 il_cert_user_cert.obj_id, 155 il_cert_user_cert.user_id, 156 il_cert_user_cert.user_name, 157 il_cert_user_cert.acquired_timestamp, 158 il_cert_user_cert.currently_active, 159 il_cert_user_cert.id, 161 object_reference.ref_id 162 FROM il_cert_user_cert 163 INNER JOIN object_data ON object_data.obj_id = il_cert_user_cert.obj_id 164 INNER JOIN object_reference ON object_reference.obj_id = il_cert_user_cert.obj_id';
170 il_cert_user_cert.pattern_certificate_id, 171 il_cert_user_cert.obj_id, 172 il_cert_user_cert.user_id, 173 il_cert_user_cert.user_name, 174 il_cert_user_cert.acquired_timestamp, 175 il_cert_user_cert.currently_active, 176 il_cert_user_cert.id, 177 object_data_del.title, 179 FROM il_cert_user_cert 180 INNER JOIN object_data_del ON object_data_del.obj_id = il_cert_user_cert.obj_id';
183 WHERE object_reference.deleted IS NULL';
188 INNER JOIN usr_data ON usr_data.usr_id = cert.user_id 191 if (!$max_count_only) {
213 foreach ($sorts as [$key, $direction]) {
218 $orders[] =
'usr_data.login' . $direction;
222 $orders[] =
'usr_data.firstname' . $direction;
226 $orders[] =
'usr_data.lastname' . $direction;
230 $orders[] =
'cert.title' . $direction;
234 $orders[] =
'cert.acquired_timestamp' . $direction;
242 $orderBy =
'ORDER BY ' . implode(
', ', $orders);
257 if (!empty($userIds)) {
262 if (!empty($objIds)) {
267 if (!empty($firstName)) {
268 $wheres[] = $this->database->like(
'usr_data.firstname',
ilDBConstants::T_TEXT,
'%' . $firstName .
'%');
272 if (!empty($lastName)) {
273 $wheres[] = $this->database->like(
'usr_data.lastname',
ilDBConstants::T_TEXT,
'%' . $lastName .
'%');
282 if (!empty($userEmail)) {
283 $wheres[] =
'(' . $this->database->like(
'usr_data.email',
ilDBConstants::T_TEXT,
'%' . $userEmail .
'%')
284 .
' OR ' . $this->database->like(
'usr_data.second_email',
ilDBConstants::T_TEXT,
'%' . $userEmail .
'%')
289 if ($issuedBeforeTimestamp !== null) {
290 $wheres[] =
'cert.acquired_timestamp < ' . $this->database->quote(
291 $issuedBeforeTimestamp,
297 if ($issuedAfterTimestamp !== null) {
298 $wheres[] =
'cert.acquired_timestamp > ' . $this->database->quote(
299 $issuedAfterTimestamp,
305 if (!empty($title)) {
310 if ($onlyCertActive ===
true) {
314 if (empty($wheres)) {
318 $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.
getUserCertificateDataMaxCount(UserDataFilter $filter)