ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjectCustomUserFieldsPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
6{
10 private $placeholder;
11
15 private $objectId;
16
20 public function __construct(int $objectId)
21 {
22 $this->placeholder = array();
23 $this->objectId = $objectId;
24
25 $this->initPlaceholders();
26 }
27
28 private function initPlaceholders()
29 {
30 $courseDefinedFields = ilCourseDefinedFieldDefinition::_getFields($this->objectId);
31
32 foreach ($courseDefinedFields as $field) {
33 $name = $field->getName();
34
35 $placeholderText = '+' . str_replace(' ', '_', ilStr::strToUpper($name));
36
37 $this->placeholder[$placeholderText] = $name;
38 }
39 }
40
47 public function getPlaceholderDescriptions() : array
48 {
49 return $this->placeholder;
50 }
51
55 public function createPlaceholderHtmlDescription() : string
56 {
57 $template = new ilTemplate(
58 'tpl.common_desc.html',
59 true,
60 true,
61 'Services/Certificate'
62 );
63
64 foreach ($this->getPlaceholderDescriptions() as $key => $field) {
65 $template->setCurrentBlock('cert_field');
66 $template->setVariable('PH', $key);
67 $template->setVariable('PH_TXT', $field);
68 $template->parseCurrentBlock();
69 }
70
71 return $template->get();
72 }
73}
An exception for terminatinating execution or to throw for unit testing.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value.
static strToUpper($a_string)
Definition: class.ilStr.php:96
special template class to simplify handling of ITX/PEAR
if($format !==null) $name
Definition: metadata.php:230