ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilUserDefinedFieldsPlaceholderDescription.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  private array $placeholder;
27 
28  public function __construct(?ilUserDefinedFields $userDefinedFieldsObject = null)
29  {
30  $this->placeholder = [];
31 
32  if (null === $userDefinedFieldsObject) {
33  $userDefinedFieldsObject = ilUserDefinedFields::_getInstance();
34  }
35  $userDefinedFields = $userDefinedFieldsObject->getDefinitions();
36 
37  foreach ($userDefinedFields as $field) {
38  if ($field['certificate']) {
39  $placeholderText = '#' . str_replace(' ', '_', ilStr::strToUpper($field['field_name']));
40 
41  $this->placeholder[$placeholderText] = $field['field_name'];
42  }
43  }
44  }
45 
51  public function getPlaceholderDescriptions(): array
52  {
53  return $this->placeholder;
54  }
55 
59  public function createPlaceholderHtmlDescription(): string
60  {
61  $template = new ilTemplate(
62  'tpl.common_desc.html',
63  true,
64  true,
65  'Services/Certificate'
66  );
67 
68  foreach ($this->getPlaceholderDescriptions() as $key => $field) {
69  $template->setCurrentBlock('cert_field');
70  $template->setVariable('PH', $key);
71  $template->setVariable('PH_TXT', $field);
72  $template->parseCurrentBlock();
73  }
74 
75  return $template->get();
76  }
77 }
Additional user data fields definition.
static strToUpper(string $a_string)
Definition: class.ilStr.php:81
__construct(?ilUserDefinedFields $userDefinedFieldsObject=null)
string $key
Consumer key/client ID value.
Definition: System.php:193
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value...