ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilStudyProgrammePlaceholderDescription.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
5{
10
14 private $language;
15
19 private $placeholder;
20
26 public function __construct(
27 ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
28 ilLanguage $language = null,
29 ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
30 ) {
31 global $DIC;
32
33 if (null === $language) {
34 $language = $DIC->language();
35 $language->loadLanguageModule('certificate');
36 }
37 $this->language = $language;
38
39 if (null === $defaultPlaceholderDescriptionObject) {
40 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
41 }
42 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
43
44 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
45 $this->placeholder['PRG_TITLE'] = $this->language->txt('sp_certificate_title');
46 $this->placeholder['PRG_DESCRIPTION'] = $this->language->txt('sp_certificate_description');
47 $this->placeholder['PRG_TYPE'] = $this->language->txt('sp_certificate_type');
48 $this->placeholder['PRG_POINTS'] = $this->language->txt('sp_certificate_points');
49 $this->placeholder['PRG_COMPLETION_DATE'] = $this->language->txt('sp_certificate_completion_date');
50 $this->placeholder['PRG_EXPIRES_AT'] = $this->language->txt('sp_certificate_progress_expires_at');
51 }
52
53
61 public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
62 {
63 if (null === $template) {
64 $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
65 }
66
67 $template->setVariable("PLACEHOLDER_INTRODUCTION", $this->language->txt('certificate_ph_introduction'));
68
69 $template->setCurrentBlock("items");
70 foreach ($this->placeholder as $id => $caption) {
71 $template->setVariable("ID", $id);
72 $template->setVariable("TXT", $caption);
73 $template->parseCurrentBlock();
74 }
75
76 return $template->get();
77 }
78
85 public function getPlaceholderDescriptions() : array
86 {
87 return $this->placeholder;
88 }
89}
An exception for terminatinating execution or to throw for unit testing.
Collection of basic placeholder values that can be used.
language handling
__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.
createPlaceholderHtmlDescription(ilTemplate $template=null)
This methods 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: goto.php:24
language()
Definition: language.php:2