ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilCmiXapiPlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
31 {
32  private \ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject;
33 
35 
36  private array $placeholder;
37 
43  public function __construct(
44  ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
45  ?ilLanguage $language = null,
46  ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
47  ) {
48  global $DIC;
49 
50  if (null === $language) {
51  $language = $DIC->language();
52  $language->loadLanguageModule('certificate');
53  }
54  $this->language = $language;
55 
56  if (null === $defaultPlaceholderDescriptionObject) {
57  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
58  }
59  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
60 
61  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
62 
63  $this->placeholder['OBJECT_TITLE'] = ilLegacyFormElementsUtil::prepareFormOutput(
64  $this->language->txt('cmix_cert_ph_object_title')
65  );
66  $this->placeholder['OBJECT_DESCRIPTION'] = ilLegacyFormElementsUtil::prepareFormOutput(
67  $this->language->txt('cmix_cert_ph_object_description')
68  );
69  $this->placeholder['REACHED_SCORE'] = ilLegacyFormElementsUtil::prepareFormOutput(
70  $this->language->txt('cmix_cert_ph_reached_score')
71  );
72  }
73 
77  public function getPlaceholderDescriptions(): array
78  {
79  return $this->placeholder;
80  }
81 
82  public function createPlaceholderHtmlDescription(?ilTemplate $template = null): string
83  {
84  if (null === $template) {
85  $template = new ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/Certificate');
86  }
87 
88  $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
89 
90  $template->setCurrentBlock('items');
91  foreach ($this->placeholder as $id => $caption) {
92  $template->setVariable('ID', $id);
93  $template->setVariable('TXT', $caption);
94  $template->parseCurrentBlock();
95  }
96 
97  return $template->get();
98  }
99 }
ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
createPlaceholderHtmlDescription(?ilTemplate $template=null)
static prepareFormOutput($a_str, bool $a_strip=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?ilLanguage $language=null, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
language handling
language()
description: > Example for rendring a language glyph.
Definition: language.php:41