ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCmiXapiPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
32 private \ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject;
33
35
36 private array $placeholder;
37
43 public function __construct(
44 ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
45 ?ilLanguage $language = null,
46 ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
47 ) {
48 global $DIC;
49 $profile = $DIC['user']->getProfile();
50
51 if (null === $language) {
52 $language = $DIC->language();
53 $language->loadLanguageModule('certificate');
54 }
55 $this->language = $language;
56
57 if (null === $defaultPlaceholderDescriptionObject) {
58 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $profile, $userDefinedFieldPlaceHolderDescriptionObject);
59 }
60 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
61
62 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
63
64 $this->placeholder['OBJECT_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput(
65 $this->language->txt('cmix_cert_ph_object_title')
66 );
67 $this->placeholder['OBJECT_DESCRIPTION'] = ilLegacyFormElementsUtil::prepareFormOutput(
68 $this->language->txt('cmix_cert_ph_object_description')
69 );
70 $this->placeholder['REACHED_SCORE'] = ilLegacyFormElementsUtil::prepareFormOutput(
71 $this->language->txt('cmix_cert_ph_reached_score')
72 );
73 }
74
78 public function getPlaceholderDescriptions(): array
79 {
80 return $this->placeholder;
81 }
82
83 public function createPlaceholderHtmlDescription(?ilTemplate $template = null): string
84 {
85 if (null === $template) {
86 $template = new ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/Certificate');
87 }
88
89 $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
90
91 $template->setCurrentBlock('items');
92 foreach ($this->placeholder as $id => $caption) {
93 $template->setVariable('ID', $id);
94 $template->setVariable('TXT', $caption);
95 $template->parseCurrentBlock();
96 }
97
98 return $template->get();
99 }
100}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
createPlaceholderHtmlDescription(?ilTemplate $template=null)
__construct(?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?ilLanguage $language=null, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
Collection of basic placeholder values that can be used.
language handling
loadLanguageModule(string $a_module)
Load language module.
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: shib_login.php:26