ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ExercisePlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ilLanguage;
24 use ilTemplate;
29 
34 {
36  private readonly ilLanguage $language;
37  private array $placeholder;
38 
39  public function __construct(
40  ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
41  ?ilLanguage $language = null,
42  ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
43  ) {
44  global $DIC;
45 
46  if (null === $language) {
47  $language = $DIC->language();
48  $language->loadLanguageModule('certificate');
49  }
50  $this->language = $language;
51 
52  if (null === $defaultPlaceholderDescriptionObject) {
53  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription(
54  $language,
55  $userDefinedFieldPlaceHolderDescriptionObject
56  );
57  }
58  $this->placeholder = $defaultPlaceholderDescriptionObject->getPlaceholderDescriptions();
59 
60  $this->placeholder['RESULT_PASSED'] = ilLegacyFormElementsUtil::prepareFormOutput(
61  $language->txt('certificate_var_result_passed')
62  );
63  $this->placeholder['RESULT_MARK'] = ilLegacyFormElementsUtil::prepareFormOutput(
64  $language->txt('certificate_var_result_mark_short')
65  );
66  $this->placeholder['EXERCISE_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput(
67  $language->txt('certificate_ph_exercisetitle')
68  );
69  $this->placeholder['DATE_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
70  $language->txt('certificate_ph_datetime_completed')
71  );
72  $this->placeholder['DATETIME_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
73  $language->txt('certificate_ph_datetime_completed')
74  );
75  }
76 
82  public function createPlaceholderHtmlDescription(?ilTemplate $template = null): string
83  {
84  if (null === $template) {
85  $template = new ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/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 
105  public function getPlaceholderDescriptions(): array
106  {
107  return $this->placeholder;
108  }
109 }
getPlaceholderDescriptions()
This method MUST return an array containing an array with the description as array value...
__construct(?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?ilLanguage $language=null, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
readonly ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
static prepareFormOutput($a_str, bool $a_strip=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
createPlaceholderHtmlDescription(?ilTemplate $template=null)
This methods MUST return an array containing an array with the the description as array value...
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
language()
description: > Example for rendring a language glyph.
Definition: language.php:41