ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestPlaceholderDescription.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
49 $this->placeholder['RESULT_PASSED'] = ilUtil::prepareFormOutput($this->language->txt('certificate_var_result_passed'));
50 $this->placeholder['RESULT_POINTS'] = ilUtil::prepareFormOutput($this->language->txt('certificate_var_result_points'));
51 $this->placeholder['RESULT_PERCENT'] = ilUtil::prepareFormOutput($this->language->txt('certificate_var_result_percent'));
52 $this->placeholder['MAX_POINTS'] = ilUtil::prepareFormOutput($this->language->txt('certificate_var_max_points'));
53 $this->placeholder['RESULT_MARK_SHORT'] = ilUtil::prepareFormOutput($this->language->txt('certificate_var_result_mark_short'));
54 $this->placeholder['RESULT_MARK_LONG'] = ilUtil::prepareFormOutput($this->language->txt('certificate_var_result_mark_long'));
55 $this->placeholder['TEST_TITLE'] = ilUtil::prepareFormOutput($this->language->txt('certificate_ph_testtitle'));
56 $this->placeholder['DATE_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_date_completed'));
57 $this->placeholder['DATETIME_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
58 }
59
60
68 public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
69 {
70 if (null === $template) {
71 $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
72 }
73
74 $template->setVariable('PLACEHOLDER_INTRODUCTION', $this->language->txt('certificate_ph_introduction'));
75
76 $template->setCurrentBlock('items');
77 foreach ($this->placeholder as $id => $caption) {
78 $template->setVariable('ID', $id);
79 $template->setVariable('TXT', $caption);
80 $template->parseCurrentBlock();
81 }
82
83 return $template->get();
84 }
85
92 public function getPlaceholderDescriptions() : array
93 {
94 return $this->placeholder;
95 }
96}
An exception for terminatinating execution or to throw for unit testing.
Collection of basic placeholder values that can be used.
language handling
special template class to simplify handling of ITX/PEAR
__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.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$template
if(!array_key_exists('StateId', $_REQUEST)) $id
global $DIC
Definition: saml.php:7