ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLTIConsumerPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
19
23 private $language;
24
28 private $placeholder;
29
35 public function __construct(
36 ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject = null,
37 ilLanguage $language = null,
38 ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject = null
39 ) {
40 global $DIC;
41
42 if (null === $language) {
43 $language = $DIC->language();
44 $language->loadLanguageModule('certificate');
45 }
46 $this->language = $language;
47
48 if (null === $defaultPlaceholderDescriptionObject) {
49 $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
50 }
51 $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
52
53 $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
54 $this->placeholder['OBJECT_TITLE'] = ilUtil::prepareFormOutput($this->language->txt('lti_cert_ph_object_title'));
55 $this->placeholder['OBJECT_DESCRIPTION'] = ilUtil::prepareFormOutput($this->language->txt('lti_cert_ph_object_description'));
56 $this->placeholder['MASTERY_SCORE'] = ilUtil::prepareFormOutput($this->language->txt('lti_cert_ph_mastery_score'));
57 $this->placeholder['REACHED_SCORE'] = ilUtil::prepareFormOutput($this->language->txt('lti_cert_ph_reached_score'));
58 $this->placeholder['DATE_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_date_completed'));
59 $this->placeholder['DATETIME_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
60 }
61
62 public function getPlaceholderDescriptions() : array
63 {
64 return $this->placeholder;
65 }
66
67 public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
68 {
69 if (null === $template) {
70 $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
71 }
72
73 $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
74
75 $template->setCurrentBlock('items');
76 foreach ($this->placeholder as $id => $caption) {
77 $template->setVariable('ID', $id);
78 $template->setVariable('TXT', $caption);
79 $template->parseCurrentBlock();
80 }
81
82 return $template->get();
83 }
84}
An exception for terminatinating execution or to throw for unit testing.
Collection of basic placeholder values that can be used.
__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.
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
global $DIC
Definition: goto.php:24
language()
Definition: language.php:2