ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilLTIConsumerPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
32{
33 private \ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject;
34
36
37 private array $placeholder;
38
39 public function __construct(
40 ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
41 ?ilLanguage $language = null,
42 ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null,
43 ?Profile $profile = null
44 ) {
45 global $DIC;
46
47 if (null === $language) {
48 $language = $DIC->language();
49 $language->loadLanguageModule('certificate');
50 }
51 $this->language = $language;
52
53 if (null === $defaultPlaceholderDescriptionObject) {
54 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $profile ?? $DIC['user']->getProfile(), $userDefinedFieldPlaceHolderDescriptionObject);
55 }
56 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
57
58 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
59 $this->placeholder['OBJECT_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput(
60 $this->language->txt('lti_cert_ph_object_title')
61 );
62 $this->placeholder['OBJECT_DESCRIPTION'] = ilLegacyFormElementsUtil::prepareFormOutput(
63 $this->language->txt('lti_cert_ph_object_description')
64 );
65 $this->placeholder['MASTERY_SCORE'] = ilLegacyFormElementsUtil::prepareFormOutput(
66 $this->language->txt('lti_cert_ph_mastery_score')
67 );
68 $this->placeholder['REACHED_SCORE'] = ilLegacyFormElementsUtil::prepareFormOutput(
69 $this->language->txt('lti_cert_ph_reached_score')
70 );
71 $this->placeholder['DATE_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
72 $language->txt('certificate_ph_date_completed')
73 );
74 $this->placeholder['DATETIME_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
75 $language->txt('certificate_ph_datetime_completed')
76 );
77 }
78
82 public function getPlaceholderDescriptions(): array
83 {
84 return $this->placeholder;
85 }
86
87 public function createPlaceholderHtmlDescription(?ilTemplate $template = null): string
88 {
89 if (null === $template) {
90 $template = new ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/Certificate');
91 }
92
93 $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
94
95 $template->setCurrentBlock('items');
96 foreach ($this->placeholder as $id => $caption) {
97 $template->setVariable('ID', $id);
98 $template->setVariable('TXT', $caption);
99 $template->parseCurrentBlock();
100 }
101
102 return $template->get();
103 }
104}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Collection of basic placeholder values that can be used.
__construct(?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?ilLanguage $language=null, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null, ?Profile $profile=null)
ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
language handling
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: shib_login.php:26