ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilCmiXapiPlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
15 {
20 
24  private $language;
25 
29  private $placeholder;
30 
36  public function __construct(
37  ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
38  ilLanguage $language = null,
39  ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
40  ) {
41  global $DIC;
42 
43  if (null === $language) {
44  $language = $DIC->language();
45  $language->loadLanguageModule('certificate');
46  }
47  $this->language = $language;
48 
49  if (null === $defaultPlaceholderDescriptionObject) {
50  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
51  }
52  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
53 
54  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
55 
56  $this->placeholder['OBJECT_TITLE'] = ilUtil::prepareFormOutput($this->language->txt('cmix_cert_ph_object_title'));
57  $this->placeholder['OBJECT_DESCRIPTION'] = ilUtil::prepareFormOutput($this->language->txt('cmix_cert_ph_object_description'));
58  $this->placeholder['REACHED_SCORE'] = ilUtil::prepareFormOutput($this->language->txt('cmix_cert_ph_reached_score'));
59  }
60 
61  public function getPlaceholderDescriptions() : array
62  {
63  return $this->placeholder;
64  }
65 
66  public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
67  {
68  if (null === $template) {
69  $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
70  }
71 
72  $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
73 
74  $template->setCurrentBlock('items');
75  foreach ($this->placeholder as $id => $caption) {
76  $template->setVariable('ID', $id);
77  $template->setVariable('TXT', $caption);
78  $template->parseCurrentBlock();
79  }
80 
81  return $template->get();
82  }
83 }
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...
$DIC
Definition: xapitoken.php:46
Collection of basic placeholder values that can be used.
language handling
language()
Definition: language.php:2