ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  }
39  $this->language = $language;
40 
41  if (null === $defaultPlaceholderDescriptionObject) {
42  $defaultPlaceholderDescriptionObject = new ilDefaultPlaceholderDescription($language, $userDefinedFieldPlaceHolderDescriptionObject);
43  }
44  $this->defaultPlaceHolderDescriptionObject = $defaultPlaceholderDescriptionObject;
45 
46  $this->placeholder = $this->defaultPlaceHolderDescriptionObject->getPlaceholderDescriptions();
47  $this->placeholder['COURSE_TITLE'] = $this->language->txt('crs_title');
48  $this->placeholder['DATE_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_date_completed'));
49  $this->placeholder['DATETIME_COMPLETED'] = ilUtil::prepareFormOutput($language->txt('certificate_ph_datetime_completed'));
50  }
51 
52 
60  public function createPlaceholderHtmlDescription(ilTemplate $template = null) : string
61  {
62  if (null === $template) {
63  $template = new ilTemplate('tpl.default_description.html', true, true, 'Services/Certificate');
64  }
65 
66  $template->setVariable("PLACEHOLDER_INTRODUCTION", $this->language->txt('certificate_ph_introduction'));
67 
68  $template->setCurrentBlock("items");
69  foreach ($this->placeholder as $id => $caption) {
70  $template->setVariable("ID", $id);
71  $template->setVariable("TXT", $caption);
72  $template->parseCurrentBlock();
73  }
74 
75  return $template->get();
76  }
77 
84  public function getPlaceholderDescriptions() : array
85  {
86  return $this->placeholder;
87  }
88 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value...
$template
global $DIC
Definition: saml.php:7
__construct(ilDefaultPlaceholderDescription $defaultPlaceholderDescriptionObject=null, ilLanguage $language=null, ilUserDefinedFieldsPlaceholderDescription $userDefinedFieldPlaceHolderDescriptionObject=null)
if(!array_key_exists('StateId', $_REQUEST)) $id
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
Collection of basic placeholder values that can be used.
language handling