ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUserDefinedFieldsPlaceholderDescription.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25
30{
31 private array $placeholder;
32
33 public function __construct(
35 Profile $user_profile
36 ) {
37 $this->placeholder = array_reduce(
38 $user_profile->getVisibleUserDefinedFields(Context::Certificate),
39 static function (array $c, Field $v) use ($lng): array {
40 $placeholder_text = str_replace(' ', '_', strtoupper($v->getLabel($lng)));
41 $c["#{$placeholder_text}"] = $v->getLabel($lng);
42 return $c;
43 },
44 []
45 );
46 }
47
53 public function getPlaceholderDescriptions(): array
54 {
55 return $this->placeholder;
56 }
57
61 public function createPlaceholderHtmlDescription(): string
62 {
63 $template = new ilTemplate(
64 'tpl.common_desc.html',
65 true,
66 true,
67 'components/ILIAS/Certificate'
68 );
69
70 foreach ($this->getPlaceholderDescriptions() as $key => $field) {
71 $template->setCurrentBlock('cert_field');
72 $template->setVariable('PH', $key);
73 $template->setVariable('PH_TXT', $field);
74 $template->parseCurrentBlock();
75 }
76
77 return $template->get();
78 }
79}
getLabel(Language $lng)
Definition: Field.php:73
special template class to simplify handling of ITX/PEAR
getPlaceholderDescriptions()
This method MUST return an array containing an array with the the description as array value.
$c
Definition: deliver.php:25
getVisibleUserDefinedFields(Context $context)
global $lng
Definition: privfeed.php:31