◆ __construct()
ilUserCertificateTableProvider::__construct |
( |
private readonly ilDBInterface |
$database, |
|
|
private readonly ilLogger |
$logger, |
|
|
private readonly string |
$defaultTitle |
|
) |
| |
◆ fetchDataSet()
ilUserCertificateTableProvider::fetchDataSet |
( |
int |
$userId, |
|
|
array |
$params, |
|
|
array |
$filter |
|
) |
| |
- Parameters
-
array<string,mixed> | $params |
array<string,mixed> | $filter |
- Returns
- array{cnt: int, items: array<int, array>}
Definition at line 40 of file class.ilUserCertificateTableProvider.php.
References $data, getOrderByPart(), ILIAS\Repository\int(), and ILIAS\Repository\logger().
42 $this->
logger->debug(sprintf(
'START - Fetching all active certificates for user: "%s"', $userId));
43 $additional_select =
'';
45 $this->database->tableColumnExists(
'il_cert_user_cert',
'background_image_path') &&
46 $this->database->tableColumnExists(
'il_cert_user_cert',
'tile_image_path')
49 self::TABLE_NAME .
'.tile_image_path, 50 ' . self::TABLE_NAME .
'.tile_image_ident,';
54 ' . self::TABLE_NAME .
'.id, 55 ' . self::TABLE_NAME .
'.obj_type, 56 ' . self::TABLE_NAME .
'.acquired_timestamp, 57 ' . self::TABLE_NAME .
'.tile_image_ident, 58 ' . $additional_select .
' usr_data.firstname, 60 ' . self::TABLE_NAME .
'.obj_id, 62 WHEN (trans.title IS NOT NULL AND LENGTH(trans.title) > 0) THEN trans.title 63 WHEN (object_data.title IS NOT NULL AND LENGTH(object_data.title) > 0) THEN object_data.title 64 WHEN (object_data_del.title IS NOT NULL AND LENGTH(object_data_del.title) > 0) THEN object_data_del.title 65 ELSE ' . $this->database->quote($this->defaultTitle,
'text') .
' 69 WHEN (trans.description IS NOT NULL AND LENGTH(trans.description) > 0) THEN trans.description 70 WHEN (object_data.description IS NOT NULL AND LENGTH(object_data.description) > 0) THEN object_data.description 71 WHEN (object_data_del.description IS NOT NULL AND LENGTH(object_data_del.description) > 0) THEN object_data_del.description 75 FROM ' . self::TABLE_NAME .
' 76 LEFT JOIN object_data ON object_data.obj_id = ' . self::TABLE_NAME .
'.obj_id 77 LEFT JOIN object_translation trans ON trans.obj_id = object_data.obj_id 78 AND trans.lang_code = ' . $this->database->quote(
$params[
'language'],
'text') .
' 79 LEFT JOIN object_data_del ON object_data_del.obj_id = ' . self::TABLE_NAME .
'.obj_id 80 LEFT JOIN usr_data ON usr_data.usr_id = ' . self::TABLE_NAME .
'.usr_id 81 WHERE ' . self::TABLE_NAME .
'.usr_id = ' . $this->database->quote($userId,
'integer') .
' AND currently_active = 1';
88 if (!is_numeric(
$params[
'limit'])) {
92 if (!isset(
$params[
'offset'])) {
94 } elseif (!is_numeric(
$params[
'offset'])) {
101 $query = $this->database->query($sql);
107 while ($row = $this->database->fetchAssoc($query)) {
108 $title = $row[
'title'];
111 'id' => (
int) $row[
'id'],
113 'obj_id' => (
int) $row[
'obj_id'],
114 'obj_type' => $row[
'obj_type'],
115 'date' => (
int) $row[
'acquired_timestamp'],
116 'tile_image_path' => $row[
'tile_image_path'] ??
'',
117 'tile_image_ident' => $row[
'tile_image_ident'],
118 'description' => $row[
'description'],
119 'firstname' => $row[
'firstname'],
120 'lastname' => $row[
'lastname'],
127 FROM ' . self::TABLE_NAME .
' 128 WHERE usr_id = ' . $this->database->quote($userId,
'integer') .
' AND currently_active = 1';
130 $row_cnt = $this->database->fetchAssoc($this->database->query($cnt_sql));
132 $data[
'cnt'] = (
int) $row_cnt[
'cnt'];
136 'All active certificates for user: "%s" total: "%s"',
145 $this->
logger->debug(sprintf(
'END - Actual results: "%s"', json_encode(
$data, JSON_THROW_ON_ERROR)));
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
getOrderByPart(array $params, array $filter)
◆ getOrderByPart()
ilUserCertificateTableProvider::getOrderByPart |
( |
array |
$params, |
|
|
array |
$filter |
|
) |
| |
|
protected |
Definition at line 150 of file class.ilUserCertificateTableProvider.php.
Referenced by fetchDataSet().
152 if (isset(
$params[
'order_field'])) {
153 if (!is_string(
$params[
'order_field'])) {
157 if (!in_array(
$params[
'order_field'], [
'date',
'id',
'title'])) {
161 if (
$params[
'order_field'] ===
'date') {
162 $params[
'order_field'] =
'acquired_timestamp';
165 if (!isset(
$params[
'order_direction'])) {
166 $params[
'order_direction'] =
'ASC';
167 } elseif (!in_array(strtolower(
$params[
'order_direction']), [
'asc',
'desc'])) {
171 return ' ORDER BY ' .
$params[
'order_field'] .
' ' .
$params[
'order_direction'];
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
◆ TABLE_NAME
const ilUserCertificateTableProvider::TABLE_NAME = 'il_cert_user_cert' |
The documentation for this class was generated from the following file: