ILIAS  release_8 Revision v8.24
class.ilCmiXapiPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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
50 if (null === $language) {
51 $language = $DIC->language();
52 $language->loadLanguageModule('certificate');
53 }
54 $this->language = $language;
55
56 if (null === $defaultPlaceholderDescriptionObject) {
57 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
58 }
59 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
60
61 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
62
63 $this->placeholder['OBJECT_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput(
64 $this->language->txt('cmix_cert_ph_object_title')
65 );
66 $this->placeholder['OBJECT_DESCRIPTION'] = ilLegacyFormElementsUtil::prepareFormOutput(
67 $this->language->txt('cmix_cert_ph_object_description')
68 );
69 $this->placeholder['REACHED_SCORE'] = ilLegacyFormElementsUtil::prepareFormOutput(
70 $this->language->txt('cmix_cert_ph_reached_score')
71 );
72 }
73
77 public function getPlaceholderDescriptions(): array
78 {
79 return $this->placeholder;
80 }
81
82 public function createPlaceholderHtmlDescription(ilTemplate $template = null): string
83 {
84 if (null === $template) {
85 $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
86 }
87
88 $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
89
90 $template->setCurrentBlock('items');
91 foreach ($this->placeholder as $id => $caption) {
92 $template->setVariable('ID', $id);
93 $template->setVariable('TXT', $caption);
94 $template->parseCurrentBlock();
95 }
96
97 return $template->get();
98 }
99}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
__construct(ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ilLanguage $language=null, ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
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: feed.php:28