19declare(strict_types=1);
35 private readonly FieldsConfigurationRepository $profile_fields_repository,
38 $this->user_fields = $this->profile_fields_repository->get();
45 array $sections_to_skip = [],
46 array $fields_to_skip = []
50 function (array
$c, ProfileField $v) use ($sections_to_skip, $fields_to_skip): array {
51 if (!in_array($v->getSection(), $sections_to_skip)
52 && !in_array(get_class($v->getDefinition()), $fields_to_skip)) {
53 $c[$v->getIdentifier()] = $v;
67 array $sections_to_skip = [],
68 array $fields_to_skip = []
72 fn(ProfileField $v) => !in_array($v->getSection(), $sections_to_skip)
73 && !in_array($v->getDefinition()::class, $fields_to_skip)
74 &&
$context->isFieldVisible($v, $user)
81 return $this->profile_fields_repository->getByIdentifier($identifier);
86 return $this->profile_fields_repository->getByClass($class);
94 array $fields_to_skip = []
97 $this->getVisibleFieldsBySection(
$context, $user, $fields_to_skip),
100 $section_header->
setTitle($this->
lng->txt($v[0]->getSection()->value));
101 $c->addItem($section_header);
102 return $this->addSectionFieldsToForm(
$c,
$context, $do_require, $user, $v);
112 array $skip_fields = []
115 $this->getVisibleFields(
$context, $user, [], $skip_fields),
117 if ($form->getItemByPostVar($v->getIdentifier())->getDisabled()) {
120 return $v->addValueToUserObject(
123 $form->
getInput($v->getIdentifier()),
133 return $this->profile_data_repository->getSingle($usr_id);
139 return $this->profile_data_repository->getMultiple($usr_ids);
144 foreach ($this->user_fields as $field) {
145 if (!$field->isVisibleToUser()) {
149 if ($field->isRequired() && empty($field->retrieveValueFromUser($user))) {
158 string $setting_identifier
160 $field = $this->profile_fields_repository->getByIdentifier($setting_identifier);
161 if ($field ===
null) {
165 return $field->isVisibleToUser();
170 $field = $this->profile_fields_repository->getByIdentifier($setting);
171 if ($field ===
null) {
174 return $field->isVisibleToUser() && $field->isChangeableByUser();
181 static function (array
$c, ProfileField $v): array {
182 if ($v->getIdentifier() ===
'username'
183 || $v->getIdentifier() ===
'password'
185 || !$v->isChangeableByUser()) {
203 function (array
$c, ProfileField $v): array {
204 if ($v->isCustom()) {
205 $c[$v->getIdentifier()] = $v;
222 function (array
$c, ProfileField $v): array {
223 if ($v->isCustom()) {
224 $c[$v->getIdentifier()] = $v;
238 return $this->profile_fields_repository->getByClass(Fields\Standard\
Avatar::class)
239 ->getDefinition()->tempStorePicture($form);
245 array $fields_to_skip = []
249 $this->getVisibleFields(
$context, $user, [], $fields_to_skip),
250 function (array
$c, ProfileField $v): array {
251 $c[$v->getSection()->value][] = $v;
255 AvailableProfileSections::cases(),
256 static function (array
$c, AvailableProfileSections $v): array {
276 $input = $v->getLegacyInput($this->
lng,
$context, $user);
277 $input->setDisabled(!
$context->isFieldChangeable($v, $user));
278 $input->setRequired($do_require && $input->getRequired());
getFieldByIdentifier(string $identifier)
tempStorePicture(\ilPropertyFormGUI $form)
getVisibleFields(Context $context, ?\ilObjUser $user=null, array $sections_to_skip=[], array $fields_to_skip=[])
userFieldEditableByUser(string $setting)
getFields(array $sections_to_skip=[], array $fields_to_skip=[])
isProfileIncomplete(\ilObjUser $user)
__construct(private readonly Language $lng, private readonly FieldsConfigurationRepository $profile_fields_repository, private readonly DataRepository $profile_data_repository)
getIgnorableRequiredFields()
getFieldByClass(string $class)
getVisibleFieldsBySection(Context $context, ?\ilObjUser $user, array $fields_to_skip=[])
addFormValuesToUser(\ilPropertyFormGUI $form, Context $context, \ilObjUser $user, array $skip_fields=[])
getDataForMultiple(array $usr_ids)
addFieldsToForm(\ilPropertyFormGUI $form, Context $context, bool $do_require, ?\ilObjUser $user, array $fields_to_skip=[])
getAllUserDefinedFields()
getVisibleUserDefinedFields(Context $context)
addSectionFieldsToForm(\ilPropertyFormGUI $form, Context $context, bool $do_require, ?\ilObjUser $user, array $fields)
userFieldVisibleToUser(string $setting_identifier)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))