ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilUserProfile Class Reference

Class ilUserProfile. More...

+ Collaboration diagram for ilUserProfile:

Public Member Functions

 getStandardFields ()
 
 getLocalUserAdministrationFields ()
 
 skipGroup (string $group)
 
 skipField (string $field)
 
 addStandardFieldsToForm (ilPropertyFormGUI $form, ?ilObjUser $user=null, array $custom_fields=[])
 
 setAjaxCallback (string $href)
 
 userSettingVisible (string $setting)
 
 setMode (int $mode)
 
 isProfileIncomplete (ilObjUser $user, bool $include_udf=true, bool $personal_data_only=true)
 
 getIgnorableRequiredSettings ()
 

Data Fields

const MODE_DESKTOP = 1
 
const MODE_REGISTRATION = 2
 

Protected Member Functions

 isEditableByUser (string $setting)
 

Protected Attributes

string $ajax_href
 
array $skip_fields
 
array $skip_groups
 
ilUserSettingsConfig $user_settings_config
 

Private Member Functions

 addRegistrationFieldsToFieldArray ()
 
 handleSectionChange (ilPropertyFormGUI $form, string $current_group, string $next_group, array $custom_fields, bool $custom_fields_done)
 
 addFieldToForm (string $field_id, array $field_definition, ?ilObjUser $user, ilPropertyFormGUI $form, ?ilRegistrationSettings $registration_settings)
 
 getTextInput (string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
 
 getTextareaInput (string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
 
 getMultitextInput (string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
 
 getRadioInput (string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
 
 getLoginInput (array $field_definition, ?ilObjUser $user)
 
 getCountryInput (string $field_id, string $method, string $lang_var, ?ilObjUser $user)
 
 getBirthdayInput (string $field_id, string $method, string $lang_var, ?ilObjUser $user)
 
 getImageInput (array $file_upload, ?ilObjUser $user)
 
 getRolesInput (string $field_id, ?ilRegistrationSettings $registration_settings, ?ilObjUser $user)
 
 getEmailInput (string $field_id, string $method, string $lang_var, ?ilObjUser $user)
 
 getPasswordInput (string $field_id, string $lang_var, ilRegistrationSettings $registration_settings)
 
 getLanguageInput (string $field_id, string $method, string $lang_var, ?ilObjUser $user)
 
 getNonEditableInput (string $method, string $lang_var, ilObjUser $user)
 
 addCustomFieldsToForm (ilPropertyFormGUI $form, array $custom_fields, string $current_group)
 

Private Attributes

int $mode = self::MODE_DESKTOP
 
ilSetting $settings
 
ilLanguage $lng
 
ilRbacReview $rbac_review
 
array $user_fields
 

Detailed Description

Class ilUserProfile.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilUserProfile.php.

Member Function Documentation

◆ addCustomFieldsToForm()

ilUserProfile::addCustomFieldsToForm ( ilPropertyFormGUI  $form,
array  $custom_fields,
string  $current_group 
)
private

Definition at line 656 of file class.ilUserProfile.php.

References ilPropertyFormGUI\addItem(), and ILIAS\Repository\lng().

Referenced by addStandardFieldsToForm(), and handleSectionChange().

661  if ($current_group !== 'other') {
662  $section_header = new ilFormSectionHeaderGUI();
663  $section_header->setTitle($this->lng->txt('other'));
664  $form->addItem($section_header);
665  }
666  foreach ($custom_fields as $custom_field) {
667  $form->addItem($custom_field);
668  }
669  return $form;
670  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFieldToForm()

ilUserProfile::addFieldToForm ( string  $field_id,
array  $field_definition,
?ilObjUser  $user,
ilPropertyFormGUI  $form,
?ilRegistrationSettings  $registration_settings 
)
private

Definition at line 183 of file class.ilUserProfile.php.

References ilPropertyFormGUI\addItem(), getBirthdayInput(), getCountryInput(), getEmailInput(), ilPropertyFormGUI\getFileUpload(), getImageInput(), getLanguageInput(), getLoginInput(), getMultitextInput(), getNonEditableInput(), getPasswordInput(), getRadioInput(), getRolesInput(), getTextareaInput(), getTextInput(), and userSettingVisible().

Referenced by addStandardFieldsToForm().

190  $method = $field_definition['method'] ?? '';
191 
192  $lang_var = (isset($field_definition['lang_var']) && $field_definition['lang_var'] !== '')
193  ? $field_definition['lang_var']
194  : $field_id;
195 
196  switch ($field_definition['input']) {
197  case 'text':
198  if (!$this->userSettingVisible($field_id)) {
199  break;
200  }
201 
202  $form->addItem(
203  $this->getTextInput(
204  $field_id,
205  $field_definition,
206  $method,
207  $lang_var,
208  $user
209  )
210  );
211  break;
212 
213  case 'textarea':
214  if (!$this->userSettingVisible($field_id)) {
215  break;
216  }
217 
218  $form->addItem(
219  $this->getTextareaInput(
220  $field_id,
221  $field_definition,
222  $method,
223  $lang_var,
224  $user
225  )
226  );
227  break;
228 
229  case 'multitext':
230  if (!$this->userSettingVisible($field_id)) {
231  break;
232  }
233 
234  $form->addItem(
235  $this->getMultitextInput(
236  $field_id,
237  $field_definition,
238  $method,
239  $lang_var,
240  $user
241  )
242  );
243  break;
244 
245  case 'radio':
246  if (!$this->userSettingVisible($field_id)) {
247  break;
248  }
249 
250  $form->addItem(
251  $this->getRadioInput(
252  $field_id,
253  $field_definition,
254  $method,
255  $lang_var,
256  $user
257  )
258  );
259  break;
260 
261  case 'login':
262  $form->addItem(
263  $this->getLoginInput($field_definition, $user)
264  );
265  break;
266 
267  case 'sel_country':
268  if (!$this->userSettingVisible($field_id)) {
269  break;
270  }
271 
272  $form->addItem(
273  $this->getCountryInput($field_id, $method, $lang_var, $user)
274  );
275  break;
276 
277  case 'birthday':
278  if (!$this->userSettingVisible($field_id)) {
279  break;
280  }
281 
282  $form->addItem(
283  $this->getBirthdayInput($field_id, $method, $lang_var, $user)
284  );
285  break;
286 
287  case 'picture':
288  if (!$this->userSettingVisible($field_id) || $user === null) {
289  break;
290  }
291 
292  $form->addItem(
293  $this->getImageInput($form->getFileUpload('userfile'), $user)
294  );
295  break;
296 
297  case 'roles':
298  $roles_input = $this->getRolesInput($field_id, $registration_settings, $user);
299  if ($roles_input !== null) {
300  $form->addItem($roles_input);
301  }
302  break;
303 
304  case 'second_email':
305  case 'email':
306  if (!$this->userSettingVisible($field_id)) {
307  break;
308  }
309 
310  $form->addItem(
311  $this->getEmailInput($field_id, $method, $lang_var, $user)
312  );
313  break;
314 
315  case 'password':
316  if ($this->mode !== self::MODE_REGISTRATION) {
317  break;
318  }
319 
320  $form->addItem(
321  $this->getPasswordInput(
322  $field_id,
323  $lang_var,
324  $registration_settings
325  )
326  );
327  break;
328 
329  case 'language':
330  if (!$this->userSettingVisible($field_id)) {
331  break;
332  }
333 
334  $form->addItem(
335  $this->getLanguageInput(
336  $field_id,
337  $method,
338  $lang_var,
339  $user
340  )
341  );
342  break;
343 
344  case 'noneditable':
345  if ($this->mode !== self::MODE_DESKTOP || !$this->userSettingVisible($field_id)) {
346  break;
347  }
348 
349  $form->addItem(
350  $this->getNonEditableInput($method, $lang_var, $user)
351  );
352  break;
353  }
354 
355  return $form;
356  }
userSettingVisible(string $setting)
getRolesInput(string $field_id, ?ilRegistrationSettings $registration_settings, ?ilObjUser $user)
getTextareaInput(string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
getMultitextInput(string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
getBirthdayInput(string $field_id, string $method, string $lang_var, ?ilObjUser $user)
getLoginInput(array $field_definition, ?ilObjUser $user)
getTextInput(string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
getNonEditableInput(string $method, string $lang_var, ilObjUser $user)
getFileUpload(string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
Get file upload data.
getPasswordInput(string $field_id, string $lang_var, ilRegistrationSettings $registration_settings)
getRadioInput(string $field_id, array $field_definition, string $method, string $lang_var, ?ilObjUser $user)
getCountryInput(string $field_id, string $method, string $lang_var, ?ilObjUser $user)
getEmailInput(string $field_id, string $method, string $lang_var, ?ilObjUser $user)
getLanguageInput(string $field_id, string $method, string $lang_var, ?ilObjUser $user)
getImageInput(array $file_upload, ?ilObjUser $user)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRegistrationFieldsToFieldArray()

ilUserProfile::addRegistrationFieldsToFieldArray ( )
private

Definition at line 142 of file class.ilUserProfile.php.

References ILIAS\Repository\lng().

Referenced by addStandardFieldsToForm().

142  : void
143  {
144  $this->user_fields['username']['group'] = 'login_data';
145  $this->user_fields['password']['group'] = 'login_data';
146  $this->user_fields['language']['default'] = $this->lng->lang_key;
147 
148  // different position for role
149  $roles = $this->user_fields['roles'];
150  unset($this->user_fields['roles']);
151  $this->user_fields['roles'] = $roles;
152  $this->user_fields['roles']['group'] = 'settings';
153  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStandardFieldsToForm()

ilUserProfile::addStandardFieldsToForm ( ilPropertyFormGUI  $form,
?ilObjUser  $user = null,
array  $custom_fields = [] 
)

Definition at line 98 of file class.ilUserProfile.php.

References addCustomFieldsToForm(), addFieldToForm(), addRegistrationFieldsToFieldArray(), getStandardFields(), handleSectionChange(), and userSettingVisible().

102  : void {
103  $registration_settings = null;
104  if ($this->mode == self::MODE_REGISTRATION) {
105  $registration_settings = new ilRegistrationSettings();
107  }
108 
109  $current_group = '';
110  $custom_fields_done = false;
111  foreach ($this->getStandardFields() as $field_id => $field_definition) {
112  // next group? -> diplay subheader
113  if (($field_definition['group'] !== $current_group) &&
114  $this->userSettingVisible($field_id)) {
115  list($form, $current_group, $custom_fields_done) = $this->handleSectionChange(
116  $form,
117  $current_group,
118  $field_definition['group'],
119  $custom_fields,
120  $custom_fields_done
121  );
122  }
123  $form = $this->addFieldToForm(
124  $field_id,
125  $field_definition,
126  $user,
127  $form,
128  $registration_settings
129  );
130  }
131 
132  // append custom fields as 'other'
133  if ($custom_fields !== [] && !$custom_fields_done) {
134  $form = $this->addCustomFieldsToForm(
135  $form,
136  $custom_fields,
137  $current_group
138  );
139  }
140  }
addCustomFieldsToForm(ilPropertyFormGUI $form, array $custom_fields, string $current_group)
userSettingVisible(string $setting)
handleSectionChange(ilPropertyFormGUI $form, string $current_group, string $next_group, array $custom_fields, bool $custom_fields_done)
addFieldToForm(string $field_id, array $field_definition, ?ilObjUser $user, ilPropertyFormGUI $form, ?ilRegistrationSettings $registration_settings)
Class ilObjAuthSettingsGUI.
+ Here is the call graph for this function:

◆ getBirthdayInput()

ilUserProfile::getBirthdayInput ( string  $field_id,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 483 of file class.ilUserProfile.php.

References IL_CAL_DATE, ILIAS\Repository\lng(), and ILIAS\Repository\settings().

Referenced by addFieldToForm().

489  $birthday_input = new ilBirthdayInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
490  $date = null;
491  if ($user && $user->$method() && strlen($user->$method())) {
492  $date = new ilDateTime($user->$method(), IL_CAL_DATE);
493  $birthday_input->setDate($date);
494  }
495  $birthday_input->setRequired((bool) $this->settings->get('require_' . $field_id));
496  if (!$birthday_input->getRequired() || $date !== null) {
497  $birthday_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
498  }
499  return $birthday_input;
500  }
const IL_CAL_DATE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCountryInput()

ilUserProfile::getCountryInput ( string  $field_id,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 466 of file class.ilUserProfile.php.

References ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ilSelectInputGUI\setValue().

Referenced by addFieldToForm().

472  $country_input = new ilCountrySelectInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
473  if ($user) {
474  $country_input->setValue($user->$method());
475  }
476  $country_input->setRequired((bool) $this->settings->get('require_' . $field_id));
477  if (!$country_input->getRequired() || $country_input->getValue()) {
478  $country_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
479  }
480  return $country_input;
481  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEmailInput()

ilUserProfile::getEmailInput ( string  $field_id,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 579 of file class.ilUserProfile.php.

References ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ilEMailInputGUI\setValue().

Referenced by addFieldToForm().

585  $email_input = new ilEMailInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
586  if ($user) {
587  $email_input->setValue($user->$method());
588  }
589  $email_input->setRequired((bool) $this->settings->get('require_' . $field_id));
590  if (!$email_input->getRequired() || $email_input->getValue()) {
591  $email_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
592  }
593  if (self::MODE_REGISTRATION == $this->mode) {
594  $email_input->setRetype(true);
595  }
596  return $email_input;
597  }
setValue(string $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIgnorableRequiredSettings()

ilUserProfile::getIgnorableRequiredSettings ( )

Definition at line 746 of file class.ilUserProfile.php.

References isEditableByUser(), and ILIAS\Repository\settings().

746  : array // Missing array type.
747  {
748  $ignorableSettings = [];
749 
750  foreach (array_keys($this->user_fields) as $field) {
751  // !!!username and password must not be ignored!!!
752  if ('username' == $field ||
753  'password' == $field) {
754  continue;
755  }
756 
757  // Field is not required -> continue
758  if (!$this->settings->get('require_' . $field)) {
759  continue;
760  }
761 
762  if ($this->isEditableByUser($field)) {
763  $ignorableSettings[] = $field;
764  }
765  }
766 
767  return $ignorableSettings;
768  }
isEditableByUser(string $setting)
+ Here is the call graph for this function:

◆ getImageInput()

ilUserProfile::getImageInput ( array  $file_upload,
?ilObjUser  $user 
)
private

Definition at line 502 of file class.ilUserProfile.php.

References ilObjUser\_getPersonalPicturePath(), ilObject\getId(), ILIAS\Repository\lng(), ilImageFileInputGUI\setAllowCapture(), and ILIAS\Repository\settings().

Referenced by addFieldToForm().

506  $image_input = new ilImageFileInputGUI($this->lng->txt('personal_picture'), 'userfile');
507  $image_input->setAllowCapture(true);
508  $image_input->setDisabled((bool) $this->settings->get('usr_settings_disable_upload'));
509 
510  if ($file_upload['name'] ?? false) {
511  $image_input->setPending($file_upload['name']);
512  } else {
513  $picture_path = ilObjUser::_getPersonalPicturePath(
514  $user->getId(),
515  'small',
516  true,
517  true
518  );
519  if ($picture_path !== '') {
520  $image_input->setImage($picture_path);
521  $image_input->setAlt($this->lng->txt('personal_picture'));
522  }
523  }
524  return $image_input;
525  }
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
This class represents an image file property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLanguageInput()

ilUserProfile::getLanguageInput ( string  $field_id,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 617 of file class.ilUserProfile.php.

References ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ilSelectInputGUI\setValue().

Referenced by addFieldToForm().

623  $options = [];
624  $this->lng->loadLanguageModule('meta');
625  foreach ($this->lng->getInstalledLanguages() as $lang_key) {
626  $options[$lang_key] = $this->lng->txt('meta_l_' . $lang_key);
627  }
628 
629  asort($options);
630  $language_input = new ilSelectInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
631  if ($user !== null) {
632  $language_input->setValue($user->$method());
633  }
634 
635  $language_input->setOptions($options);
636  $language_input->setRequired((bool) $this->settings->get('require_' . $field_id));
637  if (!$language_input->getRequired() || $language_input->getValue()) {
638  $language_input->setDisabled(
639  $this->settings->get('usr_settings_disable_' . $field_id) === '1'
640  || count($options) <= 1
641  );
642  }
643  return $language_input;
644  }
This class represents a selection list property in a property form.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocalUserAdministrationFields()

ilUserProfile::getLocalUserAdministrationFields ( )

Definition at line 75 of file class.ilUserProfile.php.

References getStandardFields(), and ILIAS\Repository\settings().

75  : array // Missing array type.
76  {
77  $fields = [];
78  foreach ($this->getStandardFields() as $field => $info) {
79  if ($this->settings->get('usr_settings_visib_lua_' . $field, '1')) {
80  $fields[$field] = $info;
81  } elseif ($info['visib_lua_fix_value'] ?? false) {
82  $fields[$field] = $info;
83  }
84  }
85  return $fields;
86  }
+ Here is the call graph for this function:

◆ getLoginInput()

ilUserProfile::getLoginInput ( array  $field_definition,
?ilObjUser  $user 
)
private

Definition at line 447 of file class.ilUserProfile.php.

References ilObjUser\getLogin(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

Referenced by addFieldToForm().

451  $login_input = new ilNonEditableValueGUI($this->lng->txt('username'), 'ne_un');
452 
453  if ((int) $this->settings->get('allow_change_loginname') || $this->mode == self::MODE_REGISTRATION) {
454  $login_input = new ilTextInputGUI($this->lng->txt('username'), 'username');
455  $login_input->setMaxLength((int) $field_definition['maxlength']);
456  $login_input->setSize(255);
457  $login_input->setRequired(true);
458  }
459 
460  if ($user !== null) {
461  $login_input->setValue($user->getLogin());
462  }
463  return $login_input;
464  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMultitextInput()

ilUserProfile::getMultitextInput ( string  $field_id,
array  $field_definition,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 400 of file class.ilUserProfile.php.

References ILIAS\Repository\lng(), and ILIAS\Repository\settings().

Referenced by addFieldToForm().

407  $multi_text_input = new ilTextInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
408  $multi_text_input->setMulti(true);
409  if ($user !== null) {
410  $multi_text_input->setValue($user->$method());
411  }
412  $multi_text_input->setMaxLength($field_definition['maxlength']);
413  $multi_text_input->setSize($field_definition['size']);
414  $multi_text_input->setRequired((bool) $this->settings->get('require_' . $field_id));
415  if (!$multi_text_input->getRequired() || $multi_text_input->getValue()) {
416  $multi_text_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
417  }
418  if ($this->ajax_href) {
419  // add field to ajax call
420  $multi_text_input->setDataSource($this->ajax_href . '&f=' . $field_id);
421  }
422  return $multi_text_input;
423  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNonEditableInput()

ilUserProfile::getNonEditableInput ( string  $method,
string  $lang_var,
ilObjUser  $user 
)
private

Definition at line 646 of file class.ilUserProfile.php.

References ILIAS\Repository\lng().

Referenced by addFieldToForm().

651  $non_editable_input = new ilNonEditableValueGUI($this->lng->txt($lang_var));
652  $non_editable_input->setValue($user->$method());
653  return $non_editable_input;
654  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPasswordInput()

ilUserProfile::getPasswordInput ( string  $field_id,
string  $lang_var,
ilRegistrationSettings  $registration_settings 
)
private

Definition at line 599 of file class.ilUserProfile.php.

References ilSecuritySettingsChecker\getPasswordRequirementsInfo(), ILIAS\Repository\lng(), ilRegistrationSettings\passwordGenerationEnabled(), and ilPasswordInputGUI\setUseStripSlashes().

Referenced by addFieldToForm().

604  if ($registration_settings->passwordGenerationEnabled()) {
605  $password_input = new ilNonEditableValueGUI($this->lng->txt($lang_var));
606  $password_input->setValue($this->lng->txt('reg_passwd_via_mail'));
607  return $password_input;
608  }
609 
610  $password_input = new ilPasswordInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
611  $password_input->setUseStripSlashes(false);
612  $password_input->setRequired(true);
613  $password_input->setInfo(ilSecuritySettingsChecker::getPasswordRequirementsInfo());
614  return $password_input;
615  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setUseStripSlashes(bool $a_stat)
En/disable use of stripslashes.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRadioInput()

ilUserProfile::getRadioInput ( string  $field_id,
array  $field_definition,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 425 of file class.ilUserProfile.php.

References ILIAS\Repository\lng(), ilRadioOption\setDisabled(), ILIAS\Repository\settings(), and ilRadioGroupInputGUI\setValue().

Referenced by addFieldToForm().

432  $radio_group = new ilRadioGroupInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
433  if ($user) {
434  $radio_group->setValue($user->$method());
435  }
436  foreach ($field_definition['values'] as $k => $v) {
437  $op = new ilRadioOption($this->lng->txt($v), $k);
438  $radio_group->addOption($op);
439  }
440  $radio_group->setRequired((bool) $this->settings->get('require_' . $field_id));
441  if (!$radio_group->getRequired() || $radio_group->getValue()) {
442  $radio_group->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
443  }
444  return $radio_group;
445  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDisabled(bool $a_disabled)
This class represents a property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRolesInput()

ilUserProfile::getRolesInput ( string  $field_id,
?ilRegistrationSettings  $registration_settings,
?ilObjUser  $user 
)
private

Definition at line 527 of file class.ilUserProfile.php.

References ilObjRole\_lookupRegisterAllowed(), ilObject\getId(), ilObjectFactory\getInstanceByObjId(), ILIAS\Repository\lng(), ilRegistrationSettings\roleSelectionEnabled(), ilSelectInputGUI\setOptions(), ILIAS\Repository\settings(), and userSettingVisible().

Referenced by addFieldToForm().

531  : ?ilFormPropertyGUI {
532  $role_names = '';
533  if ($this->mode === self::MODE_DESKTOP
534  && $this->userSettingVisible('roles')) {
535  $global_roles = $this->rbac_review->getGlobalRoles();
536  foreach ($global_roles as $role_id) {
537  if (in_array($role_id, $this->rbac_review->assignedRoles($user->getId()))) {
538  $role_obj = ilObjectFactory::getInstanceByObjId($role_id);
539  $role_names .= $role_obj->getTitle() . ', ';
540  unset($role_obj);
541  }
542  }
543  $roles_input = new ilNonEditableValueGUI($this->lng->txt('default_roles'), 'ne_dr');
544  $roles_input->setValue(substr($role_names, 0, -2));
545  return $roles_input;
546  }
547 
548  if ($this->mode === self::MODE_REGISTRATION
549  && $registration_settings->roleSelectionEnabled()) {
550  $options = [];
551  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
552  $options[$role['id']] = $role['title'];
553  }
554 
555  if ($options === []) {
556  return null;
557  }
558 
559  if (count($options) === 1) {
560  $roles_input = new ilHiddenInputGUI('usr_' . $field_id);
561  $keys = array_keys($options);
562  $roles_input->setValue(array_shift($keys));
563  return $roles_input;
564  }
565 
566  $options_with_empty_value = ['' => $this->lng->txt('please_choose')] + $options;
567  $roles_input = new ilSelectInputGUI($this->lng->txt('default_role'), 'usr_' . $field_id);
568  $roles_input->setOptions($options_with_empty_value);
569  $roles_input->setRequired(true);
570  if (!$roles_input->getRequired()) {
571  $roles_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
572  }
573  return $roles_input;
574  }
575 
576  return null;
577  }
This class represents a selection list property in a property form.
static _lookupRegisterAllowed()
get all roles that are activated in user registration
userSettingVisible(string $setting)
setOptions(array $a_options)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStandardFields()

ilUserProfile::getStandardFields ( )

Definition at line 61 of file class.ilUserProfile.php.

References Vendor\Package\$f.

Referenced by addStandardFieldsToForm(), and getLocalUserAdministrationFields().

61  : array // Missing array type.
62  {
63  $fields = [];
64  foreach ($this->user_fields as $f => $p) {
65  // skip hidden groups
66  if (in_array($p['group'], $this->skip_groups) ||
67  in_array($f, $this->skip_fields)) {
68  continue;
69  }
70  $fields[$f] = $p;
71  }
72  return $fields;
73  }
+ Here is the caller graph for this function:

◆ getTextareaInput()

ilUserProfile::getTextareaInput ( string  $field_id,
array  $field_definition,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 380 of file class.ilUserProfile.php.

References ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ilTextAreaInputGUI\setValue().

Referenced by addFieldToForm().

387  $text_area = new ilTextAreaInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
388  if ($user !== null) {
389  $text_area->setValue($user->$method() ?? '');
390  }
391  $text_area->setRows($field_definition['rows']);
392  $text_area->setCols($field_definition['cols']);
393  $text_area->setRequired((bool) $this->settings->get('require_' . $field_id));
394  if (!$text_area->getRequired() || $text_area->getValue()) {
395  $text_area->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
396  }
397  return $text_area;
398  }
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextInput()

ilUserProfile::getTextInput ( string  $field_id,
array  $field_definition,
string  $method,
string  $lang_var,
?ilObjUser  $user 
)
private

Definition at line 358 of file class.ilUserProfile.php.

References ILIAS\Repository\lng(), and ILIAS\Repository\settings().

Referenced by addFieldToForm().

365  $text_input = new ilTextInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
366  $text_input->setValue('');
367  if ($user !== null) {
368  $text_input->setValue($user->$method() ?? '');
369  }
370  $text_input->setMaxLength($field_definition['maxlength']);
371  $text_input->setSize($field_definition['size']);
372  $text_input->setRequired((bool) $this->settings->get('require_' . $field_id));
373  if (!$text_input->getRequired() || $text_input->getValue()) {
374  $text_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
375  }
376 
377  return $text_input;
378  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleSectionChange()

ilUserProfile::handleSectionChange ( ilPropertyFormGUI  $form,
string  $current_group,
string  $next_group,
array  $custom_fields,
bool  $custom_fields_done 
)
private

Definition at line 155 of file class.ilUserProfile.php.

References addCustomFieldsToForm(), ilPropertyFormGUI\addItem(), and ILIAS\Repository\lng().

Referenced by addStandardFieldsToForm().

161  : array {
162  if ($custom_fields !== [] && !$custom_fields_done
163  && ($current_group === 'other' || $next_group === 'settings')) {
164  // add 'other' subheader
165  $form = $this->addCustomFieldsToForm(
166  $form,
167  $custom_fields,
168  $current_group
169  );
170  $custom_fields_done = true;
171  }
172 
173  $section_header = new ilFormSectionHeaderGUI();
174  $section_header->setTitle($this->lng->txt($next_group));
175  $form->addItem($section_header);
176  return [
177  $form,
178  $next_group,
179  $custom_fields_done
180  ];
181  }
addCustomFieldsToForm(ilPropertyFormGUI $form, array $custom_fields, string $current_group)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEditableByUser()

ilUserProfile::isEditableByUser ( string  $setting)
protected

Definition at line 741 of file class.ilUserProfile.php.

Referenced by getIgnorableRequiredSettings().

741  : bool
742  {
743  return $this->user_settings_config->isVisibleAndChangeable($setting);
744  }
+ Here is the caller graph for this function:

◆ isProfileIncomplete()

ilUserProfile::isProfileIncomplete ( ilObjUser  $user,
bool  $include_udf = true,
bool  $personal_data_only = true 
)

Definition at line 701 of file class.ilUserProfile.php.

References ilUserDefinedFields\_getInstance(), ilLoggerFactory\getLogger(), and ILIAS\Repository\settings().

705  : bool {
706  // standard fields
707  foreach ($this->user_fields as $field => $definition) {
708  // only if visible in personal data
709  if ($personal_data_only && !$this->user_settings_config->isVisible($field)) {
710  continue;
711  }
712 
713  if ($this->settings->get('require_' . $field) && $definition['method']
714  && empty($user->{$definition['method']}())) {
715  return true;
716  }
717  }
718 
719  // custom fields
720  if (!$include_udf) {
721  return false;
722  }
723 
724  $user_defined_data = $user->getUserDefinedData();
725  $user_defined_fields = ilUserDefinedFields::_getInstance();
726  foreach ($user_defined_fields->getRequiredDefinitions() as $field => $definition) {
727  // only if visible in personal data
728  if ($personal_data_only && !$definition['visible']) {
729  continue;
730  }
731 
732  if (!($user_defined_data['f_' . $field] ?? false)) {
733  ilLoggerFactory::getLogger('user')->info('Profile is incomplete due to missing required udf.');
734  return true;
735  }
736  }
737 
738  return false;
739  }
static getLogger(string $a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ setAjaxCallback()

ilUserProfile::setAjaxCallback ( string  $href)

Definition at line 672 of file class.ilUserProfile.php.

672  : void
673  {
674  $this->ajax_href = $href;
675  }

◆ setMode()

ilUserProfile::setMode ( int  $mode)

Definition at line 692 of file class.ilUserProfile.php.

References $mode.

692  : bool
693  {
694  if (in_array($mode, [self::MODE_DESKTOP, self::MODE_REGISTRATION])) {
695  $this->mode = $mode;
696  return true;
697  }
698  return false;
699  }

◆ skipField()

ilUserProfile::skipField ( string  $field)

Definition at line 93 of file class.ilUserProfile.php.

93  : void
94  {
95  $this->skip_fields[] = $field;
96  }

◆ skipGroup()

ilUserProfile::skipGroup ( string  $group)

Definition at line 88 of file class.ilUserProfile.php.

88  : void
89  {
90  $this->skip_groups[] = $group;
91  }

◆ userSettingVisible()

ilUserProfile::userSettingVisible ( string  $setting)

Definition at line 677 of file class.ilUserProfile.php.

References ILIAS\Repository\settings().

Referenced by addFieldToForm(), addStandardFieldsToForm(), and getRolesInput().

677  : bool
678  {
679  if ($this->mode === self::MODE_DESKTOP) {
680  return ($this->user_settings_config->isVisible($setting));
681  }
682 
683  if (isset($this->user_fields[$setting]['visib_reg_hide'])
684  && $this->user_fields[$setting]['visib_reg_hide'] === true) {
685  return true;
686  }
687 
688  return ($this->settings->get('usr_settings_visib_reg_' . $setting, '1')
689  || $this->settings->get('require_' . $setting, '0'));
690  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ajax_href

string ilUserProfile::$ajax_href
protected

Definition at line 37 of file class.ilUserProfile.php.

◆ $lng

ilLanguage ilUserProfile::$lng
private

Definition at line 33 of file class.ilUserProfile.php.

◆ $mode

int ilUserProfile::$mode = self::MODE_DESKTOP
private

Definition at line 30 of file class.ilUserProfile.php.

Referenced by setMode().

◆ $rbac_review

ilRbacReview ilUserProfile::$rbac_review
private

Definition at line 34 of file class.ilUserProfile.php.

◆ $settings

ilSetting ilUserProfile::$settings
private

Definition at line 32 of file class.ilUserProfile.php.

◆ $skip_fields

array ilUserProfile::$skip_fields
protected

Definition at line 38 of file class.ilUserProfile.php.

◆ $skip_groups

array ilUserProfile::$skip_groups
protected

Definition at line 39 of file class.ilUserProfile.php.

◆ $user_fields

array ilUserProfile::$user_fields
private

Definition at line 36 of file class.ilUserProfile.php.

◆ $user_settings_config

ilUserSettingsConfig ilUserProfile::$user_settings_config
protected

Definition at line 41 of file class.ilUserProfile.php.

◆ MODE_DESKTOP

const ilUserProfile::MODE_DESKTOP = 1

Definition at line 27 of file class.ilUserProfile.php.

◆ MODE_REGISTRATION

const ilUserProfile::MODE_REGISTRATION = 2

Definition at line 28 of file class.ilUserProfile.php.

Referenced by ilAccountRegistrationGUI\initForm().


The documentation for this class was generated from the following file: