- Author
- Niels Theen nthee.nosp@m.n@da.nosp@m.tabay.nosp@m..de
Repository that allows interaction with the database in the context of certificate templates.
Definition at line 10 of file class.ilCertificateTemplateRepository.php.
◆ __construct()
◆ createCertificateTemplate()
ilCertificateTemplateRepository::createCertificateTemplate |
( |
array |
$row | ) |
|
|
private |
- Parameters
-
- Returns
- ilCertificateTemplate
Definition at line 373 of file class.ilCertificateTemplateRepository.php.
Referenced by fetchActiveTemplatesByType(), fetchCertificateTemplatesByObjId(), fetchCurrentlyActiveCertificate(), fetchCurrentlyUsedCertificate(), fetchFirstCreatedTemplate(), and fetchTemplate().
378 $row[
'certificate_content'],
379 $row[
'certificate_hash'],
380 $row[
'template_values'],
382 $row[
'ilias_version'],
383 $row[
'created_timestamp'],
384 (
boolean)
$row[
'currently_active'],
385 $row[
'background_image_path'],
386 $row[
'thumbnail_image_path'],
◆ deactivatePreviousTemplates()
ilCertificateTemplateRepository::deactivatePreviousTemplates |
( |
int |
$objId | ) |
|
|
private |
- Parameters
-
- Exceptions
-
Definition at line 355 of file class.ilCertificateTemplateRepository.php.
Referenced by save().
357 $this->logger->info(sprintf(
'START - Deactivate previous certificate template for object: "%s"', $objId));
360 UPDATE il_cert_template 361 SET currently_active = 0 362 WHERE obj_id = ' . $this->database->quote($objId,
'integer');
364 $this->database->manipulate($sql);
366 $this->logger->info(sprintf(
'END - Certificate template deactivated for object: "%s"', $objId));
◆ deleteTemplate()
ilCertificateTemplateRepository::deleteTemplate |
( |
int |
$templateId, |
|
|
int |
$objectId |
|
) |
| |
- Parameters
-
int | $templateId | |
int | $objectId | |
- Exceptions
-
Definition at line 256 of file class.ilCertificateTemplateRepository.php.
References $certificate, $certificates, and fetchCertificateTemplatesByObjId().
258 $this->logger->info(sprintf(
'START - Set deleted flag for certificate template("%s") for object: "%s"', $templateId, $objectId));
261 UPDATE il_cert_template 262 SET deleted = 1, currently_active = 0 263 WHERE id = ' . $this->database->quote($templateId,
'integer') .
' 264 AND obj_id = ' . $this->database->quote($objectId,
'integer');
266 $this->database->manipulate($sql);
268 $this->logger->info(sprintf(
'END - Deleted flag set fo certificate template("%s") for object: "%s"', $templateId, $objectId));
◆ fetchActiveTemplatesByType()
ilCertificateTemplateRepository::fetchActiveTemplatesByType |
( |
string |
$type | ) |
|
◆ fetchCertificateTemplatesByObjId()
ilCertificateTemplateRepository::fetchCertificateTemplatesByObjId |
( |
int |
$objId | ) |
|
◆ fetchCurrentlyActiveCertificate()
ilCertificateTemplateRepository::fetchCurrentlyActiveCertificate |
( |
int |
$objId | ) |
|
- Parameters
-
- Returns
- Exceptions
-
Definition at line 190 of file class.ilCertificateTemplateRepository.php.
References $query, $row, and createCertificateTemplate().
192 $this->logger->info(sprintf(
'START - Fetch currently active certificate template for object: "%s"', $objId));
195 SELECT * FROM il_cert_template 196 WHERE obj_id = ' . $this->database->quote($objId,
'integer') .
' 198 AND currently_active = 1 201 $query = $this->database->query($sql);
203 while (
$row = $this->database->fetchAssoc(
$query)) {
204 $this->logger->info(sprintf(
'END - Found active certificate for: "%s"', $objId));
209 throw new ilException((sprintf(
'NO active certificate template found for: "%s"', $objId)));
createCertificateTemplate(array $row)
◆ fetchCurrentlyUsedCertificate()
ilCertificateTemplateRepository::fetchCurrentlyUsedCertificate |
( |
int |
$objId | ) |
|
- Parameters
-
- Returns
Definition at line 147 of file class.ilCertificateTemplateRepository.php.
References $query, $row, and createCertificateTemplate().
149 $this->logger->info(sprintf(
'START - Fetch currently active certificate template for object: "%s"', $objId));
151 $this->database->setLimit(1);
154 SELECT * FROM il_cert_template 155 WHERE obj_id = ' . $this->database->quote($objId,
'integer') .
' 160 $query = $this->database->query($sql);
162 while (
$row = $this->database->fetchAssoc(
$query)) {
163 $this->logger->info(sprintf(
'END - Found active certificate for: "%s"', $objId));
168 $this->logger->info(sprintf(
'END - Found NO active certificate for: "%s"', $objId));
172 $this->objectDataCache->lookUpType($objId),
createCertificateTemplate(array $row)
◆ fetchFirstCreatedTemplate()
ilCertificateTemplateRepository::fetchFirstCreatedTemplate |
( |
int |
$objId | ) |
|
- Parameters
-
- Returns
- Exceptions
-
Definition at line 330 of file class.ilCertificateTemplateRepository.php.
References $query, $row, and createCertificateTemplate().
332 $this->logger->info(sprintf(
'START - Fetch first create certificate template for object: "%s"', $objId));
334 $this->database->setLimit(1, 0);
336 $sql =
'SELECT * FROM il_cert_template 337 WHERE obj_id = ' . $this->database->quote($objId,
'integer') .
' 340 $query = $this->database->query($sql);
342 while (
$row = $this->database->fetchAssoc(
$query)) {
343 $this->logger->info(sprintf(
'END - Found first create certificate template for object: "%s"', $objId));
348 throw new ilException(
'No matching template found. MAY missing DBUpdate. Please check if the correct version is installed.');
createCertificateTemplate(array $row)
◆ fetchPreviousCertificate()
ilCertificateTemplateRepository::fetchPreviousCertificate |
( |
int |
$objId | ) |
|
◆ fetchTemplate()
ilCertificateTemplateRepository::fetchTemplate |
( |
int |
$templateId | ) |
|
Definition at line 96 of file class.ilCertificateTemplateRepository.php.
References $query, $row, and createCertificateTemplate().
98 $this->logger->info(sprintf(
'START - Fetch certificate template with id: "%s"', $templateId));
103 WHERE id = ' . $this->database->quote($templateId,
'integer') .
' 104 ORDER BY version ASC';
106 $query = $this->database->query($sql);
108 while (
$row = $this->database->fetchAssoc(
$query)) {
112 throw new ilException(sprintf(
'No template with id "%s" found', $templateId));
createCertificateTemplate(array $row)
◆ save()
- Parameters
-
- Exceptions
-
Definition at line 56 of file class.ilCertificateTemplateRepository.php.
References $columns, $id, deactivatePreviousTemplates(), ilCertificateTemplate\getBackgroundImagePath(), ilCertificateTemplate\getCertificateContent(), ilCertificateTemplate\getCertificateHash(), ilCertificateTemplate\getCreatedTimestamp(), ilCertificateTemplate\getIliasVersion(), ilCertificateTemplate\getObjId(), ilCertificateTemplate\getObjType(), ilCertificateTemplate\getTemplateValues(), ilCertificateTemplate\getThumbnailImagePath(), ilCertificateTemplate\getVersion(), ilCertificateTemplate\isCurrentlyActive(), and ilCertificateTemplate\isDeleted().
58 $this->logger->info(
'START - Save new certificate template');
60 $objId = $certificateTemplate->
getObjId();
62 $id = $this->database->nextId(
'il_cert_template');
67 'id' => array(
'integer',
$id),
68 'obj_id' => array(
'integer', $objId),
69 'obj_type' => array(
'text', $certificateTemplate->
getObjType()),
73 'version' => array(
'integer', $certificateTemplate->
getVersion()),
74 'ilias_version' => array(
'text', $certificateTemplate->
getIliasVersion()),
76 'currently_active' => array(
'integer', (integer) $certificateTemplate->
isCurrentlyActive()),
78 'deleted' => array(
'integer', (integer) $certificateTemplate->
isDeleted()),
82 $this->database->insert(
'il_cert_template',
$columns);
84 $this->logger->info(
'END - certificate template saved with columns: ', json_encode(
$columns));
if(!array_key_exists('StateId', $_REQUEST)) $id
deactivatePreviousTemplates(int $objId)
◆ updateActivity()
ilCertificateTemplateRepository::updateActivity |
( |
ilCertificateTemplate |
$certificateTemplate, |
|
|
bool |
$currentlyActive |
|
) |
| |
◆ $database
ilCertificateTemplateRepository::$database |
|
private |
◆ $logger
ilCertificateTemplateRepository::$logger |
|
private |
◆ $objectDataCache
ilCertificateTemplateRepository::$objectDataCache |
|
private |
The documentation for this class was generated from the following file: