ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLTIConsumerPlaceholderDescription.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 
14 {
19 
23  private $language;
24 
28  private $placeholder;
29 
35  public function __construct(
36  ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
37  ilLanguage $language = null,
38  ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
39  ) {
40  global $DIC;
41 
42  if (null === $language) {
43  $language = $DIC->language();
44  $language->loadLanguageModule('certificate');
45  }
46  $this->language = $language;
47 
48  if (null === $defaultPlaceholderDescriptionObject) {
49  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
50  }
51  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
52 
53  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
54 
55  $this->placeholder['OBJECT_TITLE'] = ilUtil::prepareFormOutput($this->language->txt('lti_cert_ph_object_title'));
56  $this->placeholder['OBJECT_DESCRIPTION'] = ilUtil::prepareFormOutput($this->language->txt('lti_cert_ph_object_description'));
57  $this->placeholder['MASTERY_SCORE'] = ilUtil::prepareFormOutput($this->language->txt('lti_cert_ph_mastery_score'));
58  $this->placeholder['REACHED_SCORE'] = ilUtil::prepareFormOutput($this->language->txt('lti_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 }
__construct(ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ilLanguage $language=null, ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
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