ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilDefaultPlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
13  private $placeholder;
14 
18  private $language;
19 
24  public function __construct(ilLanguage $language, ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null)
25  {
26  if (null === $userDefinedFieldPlaceHolderDescriptionObject) {
27  $userDefinedFieldPlaceHolderDescriptionObject = new ilUserDefinedFieldsPlaceholderDescription();
28  }
29  $userDefinedPlaceholderHtmlDescription = $userDefinedFieldPlaceHolderDescriptionObject->getPlaceholderDescriptions();
30 
31  $language->loadLanguageModule('certificate');
32  $this->language = $language;
33 
34  $this->placeholder = array(
35  'USER_LOGIN' => $language->txt('certificate_ph_login'),
36  'USER_FULLNAME' => $language->txt('certificate_ph_fullname'),
37  'USER_FIRSTNAME' => $language->txt('certificate_ph_firstname'),
38  'USER_LASTNAME' => $language->txt('certificate_ph_lastname'),
39  'USER_TITLE' => $language->txt('certificate_ph_title'),
40  'USER_SALUTATION' => $language->txt('certificate_ph_salutation'),
41  'USER_BIRTHDAY' => $language->txt('certificate_ph_birthday'),
42  'USER_INSTITUTION' => $language->txt('certificate_ph_institution'),
43  'USER_DEPARTMENT' => $language->txt('certificate_ph_department'),
44  'USER_STREET' => $language->txt('certificate_ph_street'),
45  'USER_CITY' => $language->txt('certificate_ph_city'),
46  'USER_ZIPCODE' => $language->txt('certificate_ph_zipcode'),
47  'USER_COUNTRY' => $language->txt('certificate_ph_country'),
48  'USER_MATRICULATION' => $language->txt('certificate_ph_matriculation'),
49  'DATE' => $language->txt("certificate_ph_date"),
50  'DATETIME' => $language->txt("certificate_ph_datetime"),
51  );
52 
53  $this->placeholder = array_merge($this->placeholder, $userDefinedPlaceholderHtmlDescription);
54  }
55 
56 
65  public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
66  {
67  if (null === $template) {
68  $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
69  }
70 
71  $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
72 
73  $template->setCurrentBlock('items');
74  foreach ($this->placeholder as $id => $caption) {
75  $template->setVariable('ID', $id);
76  $template->setVariable('TXT', $caption);
77  $template->parseCurrentBlock();
78  }
79 
80  return $template->get();
81  }
82 
89  public function getPlaceholderDescriptions() : array
90  {
91  return $this->placeholder;
92  }
93 }
__construct(ilLanguage $language, ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
createPlaceholderHtmlDescription(ilTemplate $template=null)
This method is different then the &#39;getPlaceholderValues&#39; method, this method is used to create a plac...
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value...
loadLanguageModule($a_module)
Collection of basic placeholder values that can be used.
language handling
language()
Definition: language.php:2
txt($a_topic, $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...