ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilDefaultPlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
27  private array $placeholder;
28  private readonly ilLanguage $language;
29 
30  public function __construct(
31  ilLanguage $language,
32  ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
33  ) {
34  if (null === $userDefinedFieldPlaceHolderDescriptionObject) {
35  $userDefinedFieldPlaceHolderDescriptionObject = new ilUserDefinedFieldsPlaceholderDescription();
36  }
37  $userDefinedPlaceholderHtmlDescription = $userDefinedFieldPlaceHolderDescriptionObject->getPlaceholderDescriptions();
38 
39  $language->loadLanguageModule('certificate');
40  $this->language = $language;
41 
42  $this->placeholder = [
43  'CERTIFICATE_ID' => $language->txt('certificate_ph_cert_id'),
44  'USER_LOGIN' => $language->txt('certificate_ph_login'),
45  'USER_FULLNAME' => $language->txt('certificate_ph_fullname'),
46  'USER_FIRSTNAME' => $language->txt('certificate_ph_firstname'),
47  'USER_LASTNAME' => $language->txt('certificate_ph_lastname'),
48  'USER_TITLE' => $language->txt('certificate_ph_title'),
49  'USER_SALUTATION' => $language->txt('certificate_ph_salutation'),
50  'USER_BIRTHDAY' => $language->txt('certificate_ph_birthday'),
51  'USER_INSTITUTION' => $language->txt('certificate_ph_institution'),
52  'USER_DEPARTMENT' => $language->txt('certificate_ph_department'),
53  'USER_STREET' => $language->txt('certificate_ph_street'),
54  'USER_CITY' => $language->txt('certificate_ph_city'),
55  'USER_ZIPCODE' => $language->txt('certificate_ph_zipcode'),
56  'USER_COUNTRY' => $language->txt('certificate_ph_country'),
57  'USER_MATRICULATION' => $language->txt('certificate_ph_matriculation'),
58  'DATE' => $language->txt("certificate_ph_date"),
59  'DATETIME' => $language->txt("certificate_ph_datetime"),
60  ];
61 
62  $this->placeholder = array_merge($this->placeholder, $userDefinedPlaceholderHtmlDescription);
63  }
64 
70  public function createPlaceholderHtmlDescription(?ilTemplate $template = null): string
71  {
72  if (null === $template) {
73  $template = new ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/Certificate');
74  }
75 
76  $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
77 
78  $template->setCurrentBlock('items');
79  foreach ($this->placeholder as $id => $caption) {
80  $template->setVariable('ID', $id);
81  $template->setVariable('TXT', $caption);
82  $template->parseCurrentBlock();
83  }
84 
85  return $template->get();
86  }
87 
93  public function getPlaceholderDescriptions(): array
94  {
95  return $this->placeholder;
96  }
97 }
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...
createPlaceholderHtmlDescription(?ilTemplate $template=null)
This method is different then the &#39;getPlaceholderValues&#39; method, this method is used to create a plac...
__construct(ilLanguage $language, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
loadLanguageModule(string $a_module)
Load language module.
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
language()
description: > Example for rendring a language glyph.
Definition: language.php:41