ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilStudyProgrammePlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
26{
27 private readonly \ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject;
28 private readonly \ilLanguage $language;
29 private array $placeholder;
30
31 public function __construct(
32 ?\ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
33 ?\ilLanguage $language = null,
34 ?Profile $profile = null,
35 ?\ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
36 ) {
37 global $DIC;
38
39 if (null === $language) {
40 $language = $DIC->language();
41 $language->loadLanguageModule('certificate');
42 }
43 $this->language = $language;
44
45 $profile ??= $DIC['user']->getProfile();
46
47 if (null === $defaultPlaceholderDescriptionObject) {
48 $defaultPlaceholderDescriptionObject = new \ilDefaultPlaceholderDescription(
50 $profile,
51 $userDefinedFieldPlaceHolderDescriptionObject
52 );
53 }
54 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
55
56 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
57 $this->placeholder['PRG_TITLE'] = $this->language->txt('sp_certificate_title');
58 $this->placeholder['PRG_DESCRIPTION'] = $this->language->txt('sp_certificate_description');
59 $this->placeholder['PRG_TYPE'] = $this->language->txt('sp_certificate_type');
60 $this->placeholder['PRG_POINTS'] = $this->language->txt('sp_certificate_points');
61 $this->placeholder['PRG_COMPLETION_DATE'] = $this->language->txt('sp_certificate_completion_date');
62 $this->placeholder['PRG_EXPIRES_AT'] = $this->language->txt('sp_certificate_progress_expires_at');
63 }
64
69 public function createPlaceholderHtmlDescription(?\ilTemplate $template = null): string
70 {
71 if (null === $template) {
72 $template = new \ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/Certificate');
73 }
74
75 $template->setVariable("PLACEHOLDER_INTRODUCTION", $this->language->txt('certificate_ph_introduction'));
76
77 $template->setCurrentBlock("items");
78 foreach ($this->placeholder as $id => $caption) {
79 $template->setVariable("ID", $id);
80 $template->setVariable("TXT", $caption);
81 $template->parseCurrentBlock();
82 }
83
84 return $template->get();
85 }
86
92 public function getPlaceholderDescriptions(): array
93 {
94 return $this->placeholder;
95 }
96}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value.
__construct(?\ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?\ilLanguage $language=null, ?Profile $profile=null, ?\ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
createPlaceholderHtmlDescription(?\ilTemplate $template=null)
This methods MUST return an array containing an array with the the description as array value.
Collection of basic placeholder values that can be used.
language handling
loadLanguageModule(string $a_module)
Load language module.
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: shib_login.php:26