68 $this->logger->debug(sprintf(
'START - Fetching all active certificates for user: "%s"', $userId));
72 il_cert_user_cert.obj_type, 73 il_cert_user_cert.thumbnail_image_path, 74 il_cert_user_cert.acquired_timestamp, 77 il_cert_user_cert.obj_id, 79 WHEN (trans.title IS NOT NULL AND LENGTH(trans.title) > 0) THEN trans.title 80 WHEN (object_data.title IS NOT NULL AND LENGTH(object_data.title) > 0) THEN object_data.title 81 WHEN (object_data_del.title IS NOT NULL AND LENGTH(object_data_del.title) > 0) THEN object_data_del.title 82 ELSE ' . $this->database->quote($this->defaultTitle,
'text') .
' 86 WHEN (trans.description IS NOT NULL AND LENGTH(trans.description) > 0) THEN trans.description 87 WHEN (object_data.description IS NOT NULL AND LENGTH(object_data.description) > 0) THEN object_data.description 88 WHEN (object_data_del.description IS NOT NULL AND LENGTH(object_data_del.description) > 0) THEN object_data_del.description 92 FROM il_cert_user_cert 93 LEFT JOIN object_data ON object_data.obj_id = il_cert_user_cert.obj_id 94 LEFT JOIN object_translation trans ON trans.obj_id = object_data.obj_id 95 AND trans.lang_code = ' . $this->database->quote($params[
'language'],
'text') .
' 96 LEFT JOIN object_data_del ON object_data_del.obj_id = il_cert_user_cert.obj_id 97 LEFT JOIN usr_data ON usr_data.usr_id = il_cert_user_cert.user_id 98 WHERE user_id = ' . $this->database->quote($userId,
'integer') .
' AND currently_active = 1';
101 if (array() !== $params) {
105 if (isset($params[
'limit'])) {
106 if (!is_numeric($params[
'limit'])) {
110 if (!isset($params[
'offset'])) {
111 $params[
'offset'] = 0;
113 if (!is_numeric($params[
'offset'])) {
118 $this->database->setLimit($params[
'limit'], $params[
'offset']);
121 $query = $this->database->query($sql);
128 while ($row = $this->database->fetchAssoc(
$query)) {
129 $title = $row[
'title'];
131 $data[
'items'][] = array(
134 'obj_id' => $row[
'obj_id'],
135 'obj_type' => $row[
'obj_type'],
136 'date' => $row[
'acquired_timestamp'],
137 'thumbnail_image_path' => $row[
'thumbnail_image_path'],
138 'description' => $row[
'description'],
139 'firstname' => $row[
'firstname'],
140 'lastname' => $row[
'lastname'],
144 if (isset($params[
'limit'])) {
147 FROM il_cert_user_cert 148 WHERE user_id = ' . $this->database->quote($userId,
'integer') .
' AND currently_active = 1';
150 $row_cnt = $this->database->fetchAssoc($this->database->query($cnt_sql));
152 $data[
'cnt'] = $row_cnt[
'cnt'];
154 $this->logger->debug(sprintf(
155 'All active certificates for user: "%s" total: "%s"',
163 $this->logger->debug(sprintf(
'END - Actual results: "%s"', json_encode(
$data)));
175 if (isset($params[
'order_field'])) {
176 if (!is_string($params[
'order_field'])) {
180 if (!in_array($params[
'order_field'], array(
'date',
'id',
'title'))) {
184 if ($params[
'order_field'] ===
'date') {
185 $params[
'order_field'] =
'acquired_timestamp';
188 if (!isset($params[
'order_direction'])) {
189 $params[
'order_direction'] =
'ASC';
190 } elseif (!in_array(strtolower($params[
'order_direction']), array(
'asc',
'desc'))) {
194 return ' ORDER BY ' . $params[
'order_field'] .
' ' . $params[
'order_direction'];
This class provides processing control methods.
getOrderByPart(array $params, array $filter)
fetchDataSet($userId, $params, $filter)
__construct(ilDBInterface $database, ilLogger $logger, ilCtrl $controller, string $defaultTitle, ilCertificateObjectHelper $objectHelper=null)
Component logger with individual log levels by component id.