ILIAS  release_8 Revision v8.24
InterestedUserFieldAttribute.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21namespace ILIAS\Services\User;
22
23use ilLanguage;
25
31{
32 public static ?ilLanguage $lng = null;
33 private string $attributeName;
34 private string $name;
38 private array $components = [];
39
40 public function __construct(string $attributeName, string $fieldName)
41 {
42 $this->attributeName = $attributeName;
43 if (!self::$lng) {
44 global $DIC;
45 self::$lng = $DIC->language();
46 }
47 $this->name = $this->getNameTranslation($fieldName, $attributeName);
48 }
49
50 public function getName(): string
51 {
52 return $this->name;
53 }
54
55 public function getAttributeName(): string
56 {
58 }
59
63 public function getComponents(): array
64 {
65 return $this->components;
66 }
67
68 private function getNameTranslation(string $fieldName, string $attributeName): string
69 {
70 $translationKey = str_replace("_$fieldName", "", $attributeName);
71 if (isset(ilObjUserFolderGUI::USER_FIELD_TRANSLATION_MAPPING[$translationKey])) {
73 }
74
75 return "INVALID TRANSLATION KEY";
76 }
77
78 public function addComponent(string $componentName, string $description): InterestedUserFieldComponent
79 {
80 foreach ($this->components as $component) {
81 if ($component->getComponentName() === $componentName) {
82 return $component;
83 }
84 }
85
86 $component = new InterestedUserFieldComponent(
87 $componentName,
88 $description
89 );
90 $this->components[] = $component;
91
92 return $component;
93 }
94}
getNameTranslation(string $fieldName, string $attributeName)
addComponent(string $componentName, string $description)
__construct(string $attributeName, string $fieldName)
language handling
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$lng