ILIAS  trunk Revision v11.0_alpha-2406-g7062992332c
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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, bool $email_mandatory, ?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
 
Language $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 28 of file class.ilUserProfile.php.

Member Function Documentation

◆ addCustomFieldsToForm()

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

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

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

Referenced by addStandardFieldsToForm(), and handleSectionChange().

676  if ($current_group !== 'other') {
677  $section_header = new ilFormSectionHeaderGUI();
678  $section_header->setTitle($this->lng->txt('other'));
679  $form->addItem($section_header);
680  }
681  foreach ($custom_fields as $custom_field) {
682  $form->addItem($custom_field);
683  }
684  return $form;
685  }
+ 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 186 of file class.ilUserProfile.php.

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

Referenced by addStandardFieldsToForm().

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

References ILIAS\Repository\lng().

Referenced by addStandardFieldsToForm().

145  : void
146  {
147  $this->user_fields['username']['group'] = 'login_data';
148  $this->user_fields['password']['group'] = 'login_data';
149  $this->user_fields['language']['default'] = $this->lng->lang_key;
150 
151  // different position for role
152  $roles = $this->user_fields['roles'];
153  unset($this->user_fields['roles']);
154  $this->user_fields['roles'] = $roles;
155  $this->user_fields['roles']['group'] = 'settings';
156  }
+ 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 101 of file class.ilUserProfile.php.

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

105  : void {
106  $registration_settings = null;
107  if ($this->mode === self::MODE_REGISTRATION) {
108  $registration_settings = new ilRegistrationSettings();
110  }
111 
112  $current_group = '';
113  $custom_fields_done = false;
114  foreach ($this->getStandardFields() as $field_id => $field_definition) {
115  // next group? -> diplay subheader
116  if (($field_definition['group'] !== $current_group) &&
117  $this->userSettingVisible($field_id)) {
118  list($form, $current_group, $custom_fields_done) = $this->handleSectionChange(
119  $form,
120  $current_group,
121  $field_definition['group'],
122  $custom_fields,
123  $custom_fields_done
124  );
125  }
126  $form = $this->addFieldToForm(
127  $field_id,
128  $field_definition,
129  $user,
130  $form,
131  $registration_settings
132  );
133  }
134 
135  // append custom fields as 'other'
136  if ($custom_fields !== [] && !$custom_fields_done) {
137  $form = $this->addCustomFieldsToForm(
138  $form,
139  $custom_fields,
140  $current_group
141  );
142  }
143  }
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 497 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

503  $birthday_input = new ilBirthdayInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
504  $date = null;
505  if ($user && $user->$method() && strlen($user->$method())) {
506  $date = new ilDateTime($user->$method(), IL_CAL_DATE);
507  $birthday_input->setDate($date);
508  }
509  $birthday_input->setRequired((bool) $this->settings->get('require_' . $field_id));
510  if (!$birthday_input->getRequired() || $date !== null) {
511  $birthday_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
512  }
513  return $birthday_input;
514  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const IL_CAL_DATE
This class represents a text property in a property form.
+ 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 480 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

486  $country_input = new ilCountrySelectInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
487  if ($user) {
488  $country_input->setValue($user->$method());
489  }
490  $country_input->setRequired((bool) $this->settings->get('require_' . $field_id));
491  if (!$country_input->getRequired() || $country_input->getValue()) {
492  $country_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
493  }
494  return $country_input;
495  }
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:

◆ getEmailInput()

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

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

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

Referenced by addFieldToForm().

600  $email_input = new ilEMailInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
601  if ($user) {
602  $email_input->setValue($user->$method());
603  }
604  $email_input->setRequired($email_mandatory || $this->settings->get('require_' . $field_id));
605  if (!$email_input->getRequired() || $email_input->getValue()) {
606  $email_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
607  }
608  if (self::MODE_REGISTRATION === $this->mode) {
609  $email_input->setRetype(true);
610  }
611  return $email_input;
612  }
setValue(string $a_value)
This class represents a email property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIgnorableRequiredSettings()

ilUserProfile::getIgnorableRequiredSettings ( )

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

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

761  : array // Missing array type.
762  {
763  $ignorableSettings = [];
764 
765  foreach (array_keys($this->user_fields) as $field) {
766  // !!!username and password must not be ignored!!!
767  if ('username' == $field ||
768  'password' == $field) {
769  continue;
770  }
771 
772  // Field is not required -> continue
773  if (!$this->settings->get('require_' . $field)) {
774  continue;
775  }
776 
777  if ($this->isEditableByUser($field)) {
778  $ignorableSettings[] = $field;
779  }
780  }
781 
782  return $ignorableSettings;
783  }
isEditableByUser(string $setting)
+ Here is the call graph for this function:

◆ getImageInput()

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

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

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

Referenced by addFieldToForm().

520  $image_input = new ilImageFileInputGUI($this->lng->txt('personal_picture'), 'userfile');
521  $image_input->setAllowCapture(true);
522  $image_input->setDisabled((bool) $this->settings->get('usr_settings_disable_upload'));
523 
524  if ($file_upload['name'] ?? false) {
525  $image_input->setPending($file_upload['name']);
526  } else {
527  $picture_path = ilObjUser::_getPersonalPicturePath(
528  $user->getId(),
529  'small',
530  true,
531  true
532  );
533  if ($picture_path !== '') {
534  $image_input->setImage($picture_path);
535  $image_input->setAlt($this->lng->txt('personal_picture'));
536  }
537  }
538  return $image_input;
539  }
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 632 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

638  $options = [];
639  $this->lng->loadLanguageModule('meta');
640  foreach ($this->lng->getInstalledLanguages() as $lang_key) {
641  $options[$lang_key] = $this->lng->txt('meta_l_' . $lang_key);
642  }
643 
644  asort($options);
645  $language_input = new ilSelectInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
646  if ($user !== null) {
647  $language_input->setValue($user->$method());
648  }
649 
650  $language_input->setOptions($options);
651  $language_input->setRequired((bool) $this->settings->get('require_' . $field_id));
652  if (!$language_input->getRequired() || $language_input->getValue()) {
653  $language_input->setDisabled(
654  $this->settings->get('usr_settings_disable_' . $field_id) === '1'
655  || count($options) <= 1
656  );
657  }
658  return $language_input;
659  }
This class represents a selection list property in a property form.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 78 of file class.ilUserProfile.php.

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

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

◆ getLoginInput()

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

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

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

Referenced by addFieldToForm().

465  $login_input = new ilNonEditableValueGUI($this->lng->txt('username'), 'ne_un');
466 
467  if ((int) $this->settings->get('allow_change_loginname') || $this->mode == self::MODE_REGISTRATION) {
468  $login_input = new ilTextInputGUI($this->lng->txt('username'), 'username');
469  $login_input->setMaxLength((int) $field_definition['maxlength']);
470  $login_input->setSize(255);
471  $login_input->setRequired(true);
472  }
473 
474  if ($user !== null) {
475  $login_input->setValue($user->getLogin());
476  }
477  return $login_input;
478  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 414 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

421  $multi_text_input = new ilTextInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
422  $multi_text_input->setMulti(true);
423  if ($user !== null) {
424  $multi_text_input->setValue($user->$method());
425  }
426  $multi_text_input->setMaxLength($field_definition['maxlength']);
427  $multi_text_input->setSize($field_definition['size']);
428  $multi_text_input->setRequired((bool) $this->settings->get('require_' . $field_id));
429  if (!$multi_text_input->getRequired() || $multi_text_input->getValue()) {
430  $multi_text_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
431  }
432  if ($this->ajax_href) {
433  // add field to ajax call
434  $multi_text_input->setDataSource($this->ajax_href . '&f=' . $field_id);
435  }
436  return $multi_text_input;
437  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 661 of file class.ilUserProfile.php.

References ILIAS\Repository\lng().

Referenced by addFieldToForm().

666  $non_editable_input = new ilNonEditableValueGUI($this->lng->txt($lang_var));
667  $non_editable_input->setValue($user->$method());
668  return $non_editable_input;
669  }
+ 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 614 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

619  if ($registration_settings->passwordGenerationEnabled()) {
620  $password_input = new ilNonEditableValueGUI($this->lng->txt($lang_var));
621  $password_input->setValue($this->lng->txt('reg_passwd_via_mail'));
622  return $password_input;
623  }
624 
625  $password_input = new ilPasswordInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
626  $password_input->setUseStripSlashes(false);
627  $password_input->setRequired(true);
628  $password_input->setInfo(ilSecuritySettingsChecker::getPasswordRequirementsInfo());
629  return $password_input;
630  }
This class represents a password property in a property form.
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 439 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

446  $radio_group = new ilRadioGroupInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
447  if ($user) {
448  $radio_group->setValue($user->$method());
449  }
450  foreach ($field_definition['values'] as $k => $v) {
451  $op = new ilRadioOption($this->lng->txt($v), $k);
452  $radio_group->addOption($op);
453  }
454  $radio_group->setRequired((bool) $this->settings->get('require_' . $field_id));
455  if (!$radio_group->getRequired() || $radio_group->getValue()) {
456  $radio_group->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
457  }
458  return $radio_group;
459  }
This class represents an option in a radio group.
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 541 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

545  : ?ilFormPropertyGUI {
546  $role_names = '';
547  if ($this->mode === self::MODE_DESKTOP
548  && $this->userSettingVisible('roles')) {
549  $global_roles = $this->rbac_review->getGlobalRoles();
550  foreach ($global_roles as $role_id) {
551  if (in_array($role_id, $this->rbac_review->assignedRoles($user->getId()))) {
552  $role_obj = ilObjectFactory::getInstanceByObjId($role_id);
553  $role_names .= $role_obj->getTitle() . ', ';
554  unset($role_obj);
555  }
556  }
557  $roles_input = new ilNonEditableValueGUI($this->lng->txt('default_roles'), 'ne_dr');
558  $roles_input->setValue(substr($role_names, 0, -2));
559  return $roles_input;
560  }
561 
562  if ($this->mode === self::MODE_REGISTRATION
563  && $registration_settings->roleSelectionEnabled()) {
564  $options = [];
565  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
566  $options[$role['id']] = $role['title'];
567  }
568 
569  if ($options === []) {
570  return null;
571  }
572 
573  if (count($options) === 1) {
574  $roles_input = new ilHiddenInputGUI('usr_' . $field_id);
575  $keys = array_keys($options);
576  $roles_input->setValue((string) array_shift($keys));
577  return $roles_input;
578  }
579 
580  $options_with_empty_value = ['' => $this->lng->txt('please_choose')] + $options;
581  $roles_input = new ilSelectInputGUI($this->lng->txt('default_role'), 'usr_' . $field_id);
582  $roles_input->setOptions($options_with_empty_value);
583  $roles_input->setRequired(true);
584  if (!$roles_input->getRequired()) {
585  $roles_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
586  }
587  return $roles_input;
588  }
589 
590  return null;
591  }
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This class represents a hidden form property in a property form.
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 64 of file class.ilUserProfile.php.

References Vendor\Package\$f.

Referenced by addStandardFieldsToForm(), and getLocalUserAdministrationFields().

64  : array // Missing array type.
65  {
66  $fields = [];
67  foreach ($this->user_fields as $f => $p) {
68  // skip hidden groups
69  if (in_array($p['group'], $this->skip_groups) ||
70  in_array($f, $this->skip_fields)) {
71  continue;
72  }
73  $fields[$f] = $p;
74  }
75  return $fields;
76  }
+ 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 394 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

401  $text_area = new ilTextAreaInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
402  if ($user !== null) {
403  $text_area->setValue($user->$method() ?? '');
404  }
405  $text_area->setRows($field_definition['rows']);
406  $text_area->setCols($field_definition['cols']);
407  $text_area->setRequired((bool) $this->settings->get('require_' . $field_id));
408  if (!$text_area->getRequired() || $text_area->getValue()) {
409  $text_area->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
410  }
411  return $text_area;
412  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 372 of file class.ilUserProfile.php.

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

Referenced by addFieldToForm().

379  $text_input = new ilTextInputGUI($this->lng->txt($lang_var), 'usr_' . $field_id);
380  $text_input->setValue('');
381  if ($user !== null) {
382  $text_input->setValue($user->$method() ?? '');
383  }
384  $text_input->setMaxLength($field_definition['maxlength']);
385  $text_input->setSize($field_definition['size']);
386  $text_input->setRequired((bool) $this->settings->get('require_' . $field_id));
387  if (!$text_input->getRequired() || $text_input->getValue()) {
388  $text_input->setDisabled((bool) $this->settings->get('usr_settings_disable_' . $field_id));
389  }
390 
391  return $text_input;
392  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 158 of file class.ilUserProfile.php.

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

Referenced by addStandardFieldsToForm().

164  : array {
165  if ($custom_fields !== [] && !$custom_fields_done
166  && ($current_group === 'other' || $next_group === 'settings')) {
167  // add 'other' subheader
168  $form = $this->addCustomFieldsToForm(
169  $form,
170  $custom_fields,
171  $current_group
172  );
173  $custom_fields_done = true;
174  }
175 
176  $section_header = new ilFormSectionHeaderGUI();
177  $section_header->setTitle($this->lng->txt($next_group));
178  $form->addItem($section_header);
179  return [
180  $form,
181  $next_group,
182  $custom_fields_done
183  ];
184  }
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 756 of file class.ilUserProfile.php.

Referenced by getIgnorableRequiredSettings().

756  : bool
757  {
758  return $this->user_settings_config->isVisibleAndChangeable($setting);
759  }
+ 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 716 of file class.ilUserProfile.php.

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

720  : bool {
721  // standard fields
722  foreach ($this->user_fields as $field => $definition) {
723  // only if visible in personal data
724  if ($personal_data_only && !$this->user_settings_config->isVisible($field)) {
725  continue;
726  }
727 
728  if ($this->settings->get('require_' . $field) && $definition['method']
729  && empty($user->{$definition['method']}())) {
730  return true;
731  }
732  }
733 
734  // custom fields
735  if (!$include_udf) {
736  return false;
737  }
738 
739  $user_defined_data = $user->getUserDefinedData();
740  $user_defined_fields = ilUserDefinedFields::_getInstance();
741  foreach ($user_defined_fields->getRequiredDefinitions() as $field => $definition) {
742  // only if visible in personal data
743  if ($personal_data_only && !$definition['visible']) {
744  continue;
745  }
746 
747  if (!($user_defined_data['f_' . $field] ?? false)) {
748  ilLoggerFactory::getLogger('user')->info('Profile is incomplete due to missing required udf.');
749  return true;
750  }
751  }
752 
753  return false;
754  }
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 687 of file class.ilUserProfile.php.

687  : void
688  {
689  $this->ajax_href = $href;
690  }

◆ setMode()

ilUserProfile::setMode ( int  $mode)

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

References $mode.

707  : bool
708  {
709  if (in_array($mode, [self::MODE_DESKTOP, self::MODE_REGISTRATION])) {
710  $this->mode = $mode;
711  return true;
712  }
713  return false;
714  }

◆ skipField()

ilUserProfile::skipField ( string  $field)

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

96  : void
97  {
98  $this->skip_fields[] = $field;
99  }

◆ skipGroup()

ilUserProfile::skipGroup ( string  $group)

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

91  : void
92  {
93  $this->skip_groups[] = $group;
94  }

◆ userSettingVisible()

ilUserProfile::userSettingVisible ( string  $setting)

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

References ILIAS\Repository\settings().

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

692  : bool
693  {
694  if ($this->mode === self::MODE_DESKTOP) {
695  return ($this->user_settings_config->isVisible($setting));
696  }
697 
698  if (isset($this->user_fields[$setting]['visib_reg_hide'])
699  && $this->user_fields[$setting]['visib_reg_hide'] === true) {
700  return true;
701  }
702 
703  return ($this->settings->get('usr_settings_visib_reg_' . $setting, '1')
704  || $this->settings->get('require_' . $setting, '0'));
705  }
+ 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 40 of file class.ilUserProfile.php.

◆ $lng

Language ilUserProfile::$lng
private

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

◆ $mode

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

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

Referenced by setMode().

◆ $rbac_review

ilRbacReview ilUserProfile::$rbac_review
private

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

◆ $settings

ilSetting ilUserProfile::$settings
private

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

◆ $skip_fields

array ilUserProfile::$skip_fields
protected

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

◆ $skip_groups

array ilUserProfile::$skip_groups
protected

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

◆ $user_fields

array ilUserProfile::$user_fields
private

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

◆ $user_settings_config

ilUserSettingsConfig ilUserProfile::$user_settings_config
protected

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

◆ MODE_DESKTOP

const ilUserProfile::MODE_DESKTOP = 1

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

◆ MODE_REGISTRATION

const ilUserProfile::MODE_REGISTRATION = 2

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

Referenced by ilAccountRegistrationGUI\initForm().


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