ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  }
39  $this->language = $language;
40 
41  if (null === $defaultPlaceholderDescriptionObject) {
42  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
43  }
44  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
45 
46  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
47 
48  $this->placeholder['RESULT_PASSED'] = ilUtil::prepareFormOutput($language->txt('certificate_var_result_passed'));
49  $this->placeholder['RESULT_MARK'] = ilUtil::prepareFormOutput($language->txt('certificate_var_result_mark_short'));
50  $this->placeholder['EXERCISE_TITLE'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_exercisetitle'));
51  $this->placeholder['DATE_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
52  $this->placeholder['DATETIME_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
53  }
54 
55 
63  public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
64  {
65  if (null === $template) {
66  $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
67  }
68 
69  $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
70 
71  $template->setCurrentBlock('items');
72  foreach ($this->placeholder as $id => $caption) {
73  $template->setVariable('ID', $id);
74  $template->setVariable('TXT', $caption);
75  $template->parseCurrentBlock();
76  }
77 
78  return $template->get();
79  }
80 
87  public function getPlaceholderDescriptions() : array
88  {
89  return $this->placeholder;
90  }
91 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
__construct(ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ilLanguage $language=null, ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
$template
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value...
special template class to simplify handling of ITX/PEAR
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 handling