ILIAS  release_8 Revision v8.24
class.ilCoursePlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
29 private array $placeholder;
30
31 public function __construct(
32 int $objectId,
33 ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
34 ?ilLanguage $language = null,
35 ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null,
37 ) {
38 global $DIC;
39
40 if (null === $language) {
41 $language = $DIC->language();
42 $language->loadLanguageModule('certificate');
43 }
44 $this->language = $language;
45
46 if (null === $defaultPlaceholderDescriptionObject) {
47 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription(
49 $userDefinedFieldPlaceHolderDescriptionObject
50 );
51 }
52 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
53
56 }
57 $this->customUserFieldsPlaceholderDescriptionObject = $customUserFieldsPlaceholderDescriptionObject;
58
59 $customUserFieldsPlaceholderHtmlDescription = $this->customUserFieldsPlaceholderDescriptionObject->getPlaceholderDescriptions();
60 $defaultPlaceholderDescription = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
61
62 $this->placeholder = array_merge($defaultPlaceholderDescription, $customUserFieldsPlaceholderHtmlDescription);
63 $this->placeholder['COURSE_TITLE'] = $this->language->txt('crs_title');
64 $this->placeholder['DATE_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
65 $language->txt('certificate_ph_date_completed')
66 );
67 $this->placeholder['DATETIME_COMPLETED'] = ilLegacyFormElementsUtil::prepareFormOutput(
68 $language->txt('certificate_ph_datetime_completed')
69 );
70 }
71
72 public function createPlaceholderHtmlDescription(?ilTemplate $template = null): string
73 {
74 if (null === $template) {
75 $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
76 }
77
78 $template->setVariable("PLACEHOLDER_INTRODUCTION", $this->language->txt('certificate_ph_introduction'));
79
80 $template->setCurrentBlock("items");
81 foreach ($this->placeholder as $id => $caption) {
82 $template->setVariable("ID", $id);
83 $template->setVariable("TXT", $caption);
84 $template->parseCurrentBlock();
85 }
86
87 return $template->get();
88 }
89
95 public function getPlaceholderDescriptions(): array
96 {
97 return $this->placeholder;
98 }
99}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ilDefaultPlaceholderDescription $defaultPlaceHolderDescriptionObject
ilObjectCustomUserFieldsPlaceholderDescription $customUserFieldsPlaceholderDescriptionObject
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value.
createPlaceholderHtmlDescription(?ilTemplate $template=null)
__construct(int $objectId, ?ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ?ilLanguage $language=null, ?ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null, ?ilObjectCustomUserFieldsPlaceholderDescription $customUserFieldsPlaceholderDescriptionObject=null)
Collection of basic placeholder values that can be used.
language handling
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
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
global $DIC
Definition: feed.php:28