ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLTIConsumerPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
30{
31 private \ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject;
32
34
35 private array $placeholder;
36
37 public function __construct(
38 ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
39 ?ilLanguage $language = null,
40 ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
41 ) {
42 global $DIC;
43
44 if (null === $language) {
45 $language = $DIC->language();
46 $language->loadLanguageModule('certificate');
47 }
48 $this->language = $language;
49
50 if (null === $defaultPlaceholderDescriptionObject) {
51 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
52 }
53 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
54
55 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
56 $this->placeholder['OBJECT_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput(
57 $this->language->txt('lti_cert_ph_object_title')
58 );
59 $this->placeholder['OBJECT_DESCRIPTION'] = ilLegacyFormElementsUtil::prepareFormOutput(
60 $this->language->txt('lti_cert_ph_object_description')
61 );
62 $this->placeholder['MASTERY_SCORE'] = ilLegacyFormElementsUtil::prepareFormOutput(
63 $this->language->txt('lti_cert_ph_mastery_score')
64 );
65 $this->placeholder['REACHED_SCORE'] = ilLegacyFormElementsUtil::prepareFormOutput(
66 $this->language->txt('lti_cert_ph_reached_score')
67 );
68 $this->placeholder['DATE_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
69 $language->txt('certificate_ph_date_completed')
70 );
71 $this->placeholder['DATETIME_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
72 $language->txt('certificate_ph_datetime_completed')
73 );
74 }
75
79 public function getPlaceholderDescriptions(): array
80 {
81 return $this->placeholder;
82 }
83
84 public function createPlaceholderHtmlDescription(ilTemplate $template = null): string
85 {
86 if (null === $template) {
87 $template = new ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/Certificate');
88 }
89
90 $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
91
92 $template->setCurrentBlock('items');
93 foreach ($this->placeholder as $id => $caption) {
94 $template->setVariable('ID', $id);
95 $template->setVariable('TXT', $caption);
96 $template->parseCurrentBlock();
97 }
98
99 return $template->get();
100 }
101}
$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)
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