ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCoursePlaceholderDescription.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
13
17 private $language;
18
22 private $placeholder;
23
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($language, $userDefinedFieldPlaceHolderDescriptionObject);
44 }
45 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
46
47 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
48 $this->placeholder['COURSE_TITLE'] = $this->language->txt('crs_title');
49 $this->placeholder['DATE_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_date_completed'));
50 $this->placeholder['DATETIME_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
51 }
52
59 public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
60 {
61 if (null === $template) {
62 $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
63 }
64
65 $template->setVariable("PLACEHOLDER_INTRODUCTION", $this->language->txt('certificate_ph_introduction'));
66
67 $template->setCurrentBlock("items");
68 foreach ($this->placeholder as $id => $caption) {
69 $template->setVariable("ID", $id);
70 $template->setVariable("TXT", $caption);
71 $template->parseCurrentBlock();
72 }
73
74 return $template->get();
75 }
76
82 public function getPlaceholderDescriptions() : array
83 {
84 return $this->placeholder;
85 }
86}
An exception for terminatinating execution or to throw for unit testing.
__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.
Collection of basic placeholder values that can be used.
language handling
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
language()
Definition: language.php:2
$DIC
Definition: xapitoken.php:46