ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilExercisePlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
13 
17  private $language;
18 
22  private $placeholder;
23 
29  public function __construct(
30  ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
31  ilLanguage $language = null,
32  ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
33  ) {
34  global $DIC;
35 
36  if (null === $language) {
37  $language = $DIC->language();
38  $language->loadLanguageModule('certificate');
39  }
40  $this->language = $language;
41 
42  if (null === $defaultPlaceholderDescriptionObject) {
43  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
44  }
45  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
46 
47  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
48 
49  $this->placeholder['RESULT_PASSED'] = ilUtil::prepareFormOutput($language->txt('certificate_var_result_passed'));
50  $this->placeholder['RESULT_MARK'] = ilUtil::prepareFormOutput($language->txt('certificate_var_result_mark_short'));
51  $this->placeholder['EXERCISE_TITLE'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_exercisetitle'));
52  $this->placeholder['DATE_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
53  $this->placeholder['DATETIME_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
54  }
55 
56 
64  public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
65  {
66  if (null === $template) {
67  $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
68  }
69 
70  $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
71 
72  $template->setCurrentBlock('items');
73  foreach ($this->placeholder as $id => $caption) {
74  $template->setVariable('ID', $id);
75  $template->setVariable('TXT', $caption);
76  $template->parseCurrentBlock();
77  }
78 
79  return $template->get();
80  }
81 
88  public function getPlaceholderDescriptions() : array
89  {
90  return $this->placeholder;
91  }
92 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
__construct(ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ilLanguage $language=null, ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value...
global $DIC
Definition: goto.php:24
createPlaceholderHtmlDescription(ilTemplate $template=null)
This methods MUST return an array containing an array with the the description as array value...
Collection of basic placeholder values that can be used.
language()
Definition: language.php:2