19declare(strict_types=1);
35 private readonly FieldsConfigurationRepository $profile_fields_repository,
38 $this->user_fields = $this->profile_fields_repository->get();
45 array $groups_to_skip = [],
46 array $fields_to_skip = []
50 function (array
$c, ProfileField $v) use ($groups_to_skip, $fields_to_skip): array {
51 if (!in_array($v->getSection(), $groups_to_skip)
52 && !in_array(get_class($v->getDefinition()), $fields_to_skip)) {
53 $c[$v->getIdentifier()] = $v;
67 array $groups_to_skip = [],
68 array $fields_to_skip = []
72 fn(ProfileField $v) => !in_array($v->getSection(), $groups_to_skip)
73 && !in_array(get_class($v->getDefinition()), $fields_to_skip)
74 &&
$context->isFieldVisibleInType($v, $user)
81 return $this->profile_fields_repository->getByIdentifier($identifier);
89 array $fields_to_skip = []
92 $this->getVisibleFieldsBySection(
$context, $user, $fields_to_skip),
95 $section_header->
setTitle($this->
lng->txt($v[0]->getSection()->value));
96 $c->addItem($section_header);
97 return $this->addSectionFieldsToForm(
$c,
$context, $do_require, $user, $v);
109 $this->getVisibleFields(
$context, $user),
111 if ($form->getItemByPostVar($v->getIdentifier())->getDisabled()) {
114 return $v->addValueToUserObject(
117 $form->
getInput($v->getIdentifier()),
127 return $this->profile_data_repository->getSingle($usr_id);
133 return $this->profile_data_repository->getMultiple($usr_ids);
138 foreach ($this->user_fields as $field) {
139 if (!$field->isVisibleToUser()) {
143 if ($field->isRequired() && empty($field->retrieveValueFromUser($user))) {
152 string $setting_identifier
154 $field = $this->profile_fields_repository->getByIdentifier($setting_identifier);
155 if ($field ===
null) {
159 return $field->isVisibleToUser();
164 $field = $this->profile_fields_repository->getByIdentifier($setting);
165 if ($field ===
null) {
168 return $field->isVisibleToUser() && $field->isChangeableByUser();
175 static function (array
$c, ProfileField $v): array {
176 if ($v->getIdentifier() ===
'username'
177 || $v->getIdentifier() ===
'password'
179 || !$v->isChangeableByUser()) {
197 function (array
$c, ProfileField $v): array {
198 if ($v->isCustom()) {
199 $c[$v->getIdentifier()] = $v;
216 function (array
$c, ProfileField $v): array {
217 if ($v->isCustom()) {
218 $c[$v->getIdentifier()] = $v;
232 return $this->profile_fields_repository->getByClass(Fields\Standard\
Avatar::class)
233 ->getDefinition()->tempStorePicture($form);
239 array $fields_to_skip = []
243 $this->getVisibleFields(
$context, $user, [], $fields_to_skip),
244 function (array
$c, ProfileField $v): array {
245 $c[$v->getSection()->value][] = $v;
249 AvailableProfileSections::cases(),
250 static function (array
$c, AvailableProfileSections $v): array {
270 $input = $v->getLegacyInput($this->
lng,
$context, $user);
271 $input->setDisabled(!
$context->isFieldChangeableInType($v, $user));
272 $input->setRequired($do_require && $v->isRequired());
getFields(array $groups_to_skip=[], array $fields_to_skip=[])
getFieldByIdentifier(string $identifier)
tempStorePicture(\ilPropertyFormGUI $form)
userFieldEditableByUser(string $setting)
isProfileIncomplete(\ilObjUser $user)
getVisibleFields(Context $context, ?\ilObjUser $user=null, array $groups_to_skip=[], array $fields_to_skip=[])
__construct(private readonly Language $lng, private readonly FieldsConfigurationRepository $profile_fields_repository, private readonly DataRepository $profile_data_repository)
getIgnorableRequiredFields()
getVisibleFieldsBySection(Context $context, ?\ilObjUser $user, array $fields_to_skip=[])
addFormValuesToUser(\ilPropertyFormGUI $form, Context $context, \ilObjUser $user)
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'))