ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLTIConsumerPlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
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, 'Services/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 }
static prepareFormOutput($a_str, bool $a_strip=false)
global $DIC
Definition: feed.php:28
ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Collection of basic placeholder values that can be used.
language handling
__construct(?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?ilLanguage $language=null, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)