ILIAS  release_8 Revision v8.24
class.ilDefaultPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 private array $placeholder;
29
30 public function __construct(
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 'USER_LOGIN' => $language->txt('certificate_ph_login'),
44 'USER_FULLNAME' => $language->txt('certificate_ph_fullname'),
45 'USER_FIRSTNAME' => $language->txt('certificate_ph_firstname'),
46 'USER_LASTNAME' => $language->txt('certificate_ph_lastname'),
47 'USER_TITLE' => $language->txt('certificate_ph_title'),
48 'USER_SALUTATION' => $language->txt('certificate_ph_salutation'),
49 'USER_BIRTHDAY' => $language->txt('certificate_ph_birthday'),
50 'USER_INSTITUTION' => $language->txt('certificate_ph_institution'),
51 'USER_DEPARTMENT' => $language->txt('certificate_ph_department'),
52 'USER_STREET' => $language->txt('certificate_ph_street'),
53 'USER_CITY' => $language->txt('certificate_ph_city'),
54 'USER_ZIPCODE' => $language->txt('certificate_ph_zipcode'),
55 'USER_COUNTRY' => $language->txt('certificate_ph_country'),
56 'USER_MATRICULATION' => $language->txt('certificate_ph_matriculation'),
57 'DATE' => $language->txt("certificate_ph_date"),
58 'DATETIME' => $language->txt("certificate_ph_datetime"),
59 ];
60
61 $this->placeholder = array_merge($this->placeholder, $userDefinedPlaceholderHtmlDescription);
62 }
63
71 public function createPlaceholderHtmlDescription(?ilTemplate $template = null): string
72 {
73 if (null === $template) {
74 $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
75 }
76
77 $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
78
79 $template->setCurrentBlock('items');
80 foreach ($this->placeholder as $id => $caption) {
81 $template->setVariable('ID', $id);
82 $template->setVariable('TXT', $caption);
83 $template->parseCurrentBlock();
84 }
85
86 return $template->get();
87 }
88
94 public function getPlaceholderDescriptions(): array
95 {
96 return $this->placeholder;
97 }
98}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Collection of basic placeholder values that can be used.
createPlaceholderHtmlDescription(?ilTemplate $template=null)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
__construct(ilLanguage $language, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value.
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...
special template class to simplify handling of ITX/PEAR