ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilStudyProgrammePlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 {
25  private readonly \ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject;
26  private readonly \ilLanguage $language;
27  private array $placeholder;
28 
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(
44  $language,
45  $userDefinedFieldPlaceHolderDescriptionObject
46  );
47  }
48  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
49 
50  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
51  $this->placeholder['PRG_TITLE'] = $this->language->txt('sp_certificate_title');
52  $this->placeholder['PRG_DESCRIPTION'] = $this->language->txt('sp_certificate_description');
53  $this->placeholder['PRG_TYPE'] = $this->language->txt('sp_certificate_type');
54  $this->placeholder['PRG_POINTS'] = $this->language->txt('sp_certificate_points');
55  $this->placeholder['PRG_COMPLETION_DATE'] = $this->language->txt('sp_certificate_completion_date');
56  $this->placeholder['PRG_EXPIRES_AT'] = $this->language->txt('sp_certificate_progress_expires_at');
57  }
58 
63  public function createPlaceholderHtmlDescription(?\ilTemplate $template = null): string
64  {
65  if (null === $template) {
66  $template = new \ilTemplate('tpl.default_description.html', true, true, 'components/ILIAS/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 
86  public function getPlaceholderDescriptions(): array
87  {
88  return $this->placeholder;
89  }
90 }
__construct(?\ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?\ilLanguage $language=null, ?\ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
createPlaceholderHtmlDescription(?\ilTemplate $template=null)
This methods MUST return an array containing an array with the the description as array value...
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value...
global $DIC
Definition: shib_login.php:25
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
language()
description: > Example for rendring a language glyph.
Definition: language.php:25