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

Class ilObjUserGUI. More...

+ Inheritance diagram for ilObjUserGUI:
+ Collaboration diagram for ilObjUserGUI:

Public Member Functions

 executeCommand ()
 
 cancelObject ()
 
 getAdminTabs ()
 
 setBackTarget (string $a_text, string $a_link)
 set back tab target More...
 
 __checkUserDefinedRequiredFields ()
 
 __showUserDefinedFields ()
 
 initCreate ()
 
 createObject ()
 Display user create form. More...
 
 saveObject ()
 save user data More...
 
 editObject ()
 
 getValues ()
 
 initForm (string $a_mode)
 Init user form. More...
 
 removeUserPictureObject ()
 
 assignSaveObject ()
 
 roleassignmentObject ()
 
 applyFilterObject ()
 
 resetFilterObject ()
 
 __getDateSelect (string $a_type, string $a_varname, string $a_selected)
 
 __toUnix (array $a_time_arr)
 
 __unsetSessionVariables ()
 
 __buildFilterSelect ()
 
 __sendProfileMail ()
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 setTitleAndDescription ()
 
 getTabs ()
 
 loadValuesFromForm (string $a_mode='create')
 
 loadUserDefinedDataFromForm (?ilObjUser $user=null)
 
 isSettingChangeable (string $a_field)
 
 uploadUserPicture ()
 upload user image (original method by ratana ty) More...
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 handleIgnoredRequiredFields ()
 Handles ignored required fields by changing the required flag of form elements. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 addAdoptContentLinkToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 

Private Member Functions

 moveFileToStorage ()
 
 checkUserWriteRight ()
 
 checkAccessToRolesTab ()
 

Private Attributes

ilPropertyFormGUI $form_gui
 
UserGUIRequest $user_request
 
ilHelpGUI $help
 
ilTabsGUI $tabs
 
ilMailMimeSenderFactory $mail_sender_factory
 
FileUpload $uploads
 
ResourceStorageServices $irss
 
ResourceStakeholder $stakeholder
 
ilUserProfile $user_profile
 
string $requested_letter = ''
 
string $requested_baseClass = ''
 
string $requested_search = ''
 
array $back_target
 
bool $update
 
array $selectable_roles
 
int $default_role
 
string $default_layout_and_style
 
ilUserDefinedFields $user_defined_fields
 
int $usrf_ref_id
 
Conductor $legal_documents
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Detailed Description

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

Definition at line 1729 of file class.ilObjUserGUI.php.

References ilLegacyFormElementsUtil\formSelect(), ilSession\get(), and ILIAS\Repository\lng().

1729  : string
1730  {
1731  $action[0] = $this->lng->txt('assigned_roles');
1732  $action[1] = $this->lng->txt('all_roles');
1733  $action[2] = $this->lng->txt('all_global_roles');
1734  $action[3] = $this->lng->txt('all_local_roles');
1735  $action[4] = $this->lng->txt('internal_local_roles_only');
1736  $action[5] = $this->lng->txt('non_internal_local_roles_only');
1737 
1739  ilSession::get('filtered_roles'),
1740  'filter',
1741  $action,
1742  false,
1743  true
1744  );
1745  }
static get(string $a_var)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
+ Here is the call graph for this function:

◆ __checkUserDefinedRequiredFields()

ilObjUserGUI::__checkUserDefinedRequiredFields ( )

Definition at line 236 of file class.ilObjUserGUI.php.

References ilUserDefinedFields\_getInstance().

236  : bool
237  {
238  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
239 
240  $udfs = $this->user_request->getUDFs();
241  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
242  if ($definition['required'] and !strlen($udfs[$field_id])) {
243  return false;
244  }
245  }
246  return true;
247  }
+ Here is the call graph for this function:

◆ __getDateSelect()

ilObjUserGUI::__getDateSelect ( string  $a_type,
string  $a_varname,
string  $a_selected 
)

Definition at line 1666 of file class.ilObjUserGUI.php.

References ilLegacyFormElementsUtil\formSelect(), and ILIAS\Repository\int().

1670  : string {
1671  $year = null;
1672  switch ($a_type) {
1673  case 'minute':
1674  for ($i = 0; $i <= 60; $i++) {
1675  $days[$i] = $i < 10 ? '0' . $i : $i;
1676  }
1677  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1678 
1679  case 'hour':
1680  for ($i = 0; $i < 24; $i++) {
1681  $days[$i] = $i < 10 ? '0' . $i : $i;
1682  }
1683  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1684 
1685  case 'day':
1686  for ($i = 1; $i < 32; $i++) {
1687  $days[$i] = $i < 10 ? '0' . $i : $i;
1688  }
1689  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1690 
1691  case 'month':
1692  for ($i = 1; $i < 13; $i++) {
1693  $month[$i] = $i < 10 ? '0' . $i : $i;
1694  }
1695  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1696 
1697  case 'year':
1698  if ($a_selected < date('Y')) {
1699  $start = $a_selected;
1700  } else {
1701  $start = date('Y');
1702  }
1703 
1704  for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1705  $year[$i] = $i;
1706  }
1707  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1708  }
1709  return '';
1710  }
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
+ Here is the call graph for this function:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

Definition at line 1792 of file class.ilObjUserGUI.php.

References $DIC, ILIAS\LTI\ToolProvider\$key, ilMail\_getInstallationSignature(), ilObjUser\_lookupId(), ANONYMOUS_USER_ID, ilPersonalProfileGUI\CHANGE_EMAIL_CMD, exit, ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilUtil\stripSlashes().

Referenced by loadUserDefinedDataFromForm().

1792  : string
1793  {
1794  if ($this->user_request->getSendMail() != 'y') {
1795  return '';
1796  }
1797  if (!strlen($this->object->getEmail())) {
1798  return '';
1799  }
1800 
1801  $usr_lang = new ilLanguage($this->object->getLanguage());
1802  $usr_lang->loadLanguageModule('crs');
1803  $usr_lang->loadLanguageModule('registration');
1804 
1805  $mmail = new ilMimeMail();
1806  $mmail->From($this->mail_sender_factory->system());
1807 
1808  $mailOptions = new ilMailOptions($this->object->getId());
1809  $mmail->To($mailOptions->getExternalEmailAddresses());
1810 
1811  $subject = $usr_lang->txt('profile_changed');
1812  $body = $usr_lang->txt('reg_mail_body_salutation')
1813  . ' ' . $this->object->getFullname() . ",\n\n";
1814 
1815  $date = $this->object->getApproveDate();
1816 
1817  if ($date !== null && (time() - strtotime($date)) < 10) {
1818  $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
1819  } else {
1820  $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
1821  }
1822 
1823  // Append login info only if password has been changed
1824  if ($this->user_request->getPassword() != '') {
1825  $body .= $usr_lang->txt('reg_mail_body_text2') . "\n" .
1826  ILIAS_HTTP_PATH . '/login.php?client_id=' . $this->ilias->client_id . "\n" .
1827  $usr_lang->txt('login') . ': ' . $this->object->getLogin() . "\n" .
1828  $usr_lang->txt('passwd') . ': ' . $this->user_request->getPassword() . "\n\n";
1829  }
1830  $body .= $usr_lang->txt('reg_mail_body_text3') . "\n";
1831  $body .= $this->object->getProfileAsString($usr_lang);
1833 
1834 
1835  $mmail->Subject($subject, true);
1836  $mmail->Body($body);
1837  $mmail->Send();
1838 
1839  return '<br/>' . $this->lng->txt('mail_sent');
1840  }
header include for all ilias files.
static _getInstallationSignature()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

Definition at line 249 of file class.ilObjUserGUI.php.

References ilUserDefinedFields\_getInstance(), ilLegacyFormElementsUtil\formSelect(), ilSession\get(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and UDF_TYPE_TEXT.

249  : void
250  {
251  $user_defined_data = null;
252  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
253 
254  if ($this->object->getType() == 'usr') {
255  $user_defined_data = $this->object->getUserDefinedData();
256  }
257  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
258  $error_post_vars = ilSession::get('error_post_vars');
259  $old = $error_post_vars['udf'][$field_id] ?? $user_defined_data[$field_id];
260 
261  if ($definition['field_type'] == UDF_TYPE_TEXT) {
262  $this->tpl->setCurrentBlock('field_text');
263  $this->tpl->setVariable('FIELD_NAME', 'udf[' . $definition['field_id'] . ']');
264  $this->tpl->setVariable('FIELD_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($old));
265  } else {
266  $this->tpl->setCurrentBlock('field_select');
267  $this->tpl->setVariable(
268  'SELECT_BOX',
270  $old,
271  'udf[' . $definition['field_id'] . ']',
272  $this->user_defined_fields->fieldValuesToSelectArray(
273  $definition['field_values']
274  ),
275  false,
276  true
277  )
278  );
279  }
280  $this->tpl->parseCurrentBlock();
281  $this->tpl->setCurrentBlock('user_defined');
282 
283  if ($definition['required']) {
284  $name = $definition['field_name'] . '<span class="asterisk">*</span>';
285  } else {
286  $name = $definition['field_name'];
287  }
288  $this->tpl->setVariable('TXT_FIELD_NAME', $name);
289  $this->tpl->parseCurrentBlock();
290  }
291  }
static get(string $a_var)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
static prepareFormOutput($a_str, bool $a_strip=false)
const UDF_TYPE_TEXT
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:

◆ __toUnix()

ilObjUserGUI::__toUnix ( array  $a_time_arr)

Definition at line 1712 of file class.ilObjUserGUI.php.

1712  : int // Missing array type.
1713  {
1714  return mktime(
1715  $a_time_arr['hour'],
1716  $a_time_arr['minute'],
1717  $a_time_arr['second'],
1718  $a_time_arr['month'],
1719  $a_time_arr['day'],
1720  $a_time_arr['year']
1721  );
1722  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

Definition at line 1724 of file class.ilObjUserGUI.php.

References ilSession\clear().

1724  : void
1725  {
1726  ilSession::clear('filtered_roles');
1727  }
static clear(string $a_var)
+ Here is the call graph for this function:

◆ addAdminLocatorItems()

ilObjUserGUI::addAdminLocatorItems ( bool  $do_not_add_object = false)
protected

should be overwritten to add object specific items (repository items are preloaded)

Definition at line 1751 of file class.ilObjUserGUI.php.

References ilFrameTargetInfo\_getFrame(), ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\locator(), ILIAS\Repository\object(), ROLE_FOLDER_ID, SYSTEM_FOLDER_ID, and USER_FOLDER_ID.

1751  : void
1752  {
1753  $this->locator->clearItems();
1754 
1755  if ($this->admin_mode == 'settings') { // system settings
1756  $this->ctrl->setParameterByClass(
1757  'ilobjsystemfoldergui',
1758  'ref_id',
1760  );
1761  $this->locator->addItem(
1762  $this->lng->txt('administration'),
1763  $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1764  ilFrameTargetInfo::_getFrame('MainContent')
1765  );
1766 
1767  if ($this->requested_ref_id == USER_FOLDER_ID) {
1768  $this->locator->addItem(
1769  $this->lng->txt('obj_' . ilObject::_lookupType(
1770  ilObject::_lookupObjId($this->requested_ref_id)
1771  )),
1772  $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1773  );
1774  } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1775  $this->locator->addItem(
1776  $this->lng->txt('obj_' . ilObject::_lookupType(
1777  ilObject::_lookupObjId($this->requested_ref_id)
1778  )),
1779  $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1780  );
1781  }
1782 
1783  if ($this->obj_id > 0) {
1784  $this->locator->addItem(
1785  $this->object->getTitle(),
1786  $this->ctrl->getLinkTarget($this, 'view')
1787  );
1788  }
1789  }
1790  }
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_FOLDER_ID
Definition: constants.php:35
static _lookupObjId(int $ref_id)
const ROLE_FOLDER_ID
Definition: constants.php:34
static _getFrame(string $a_class)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

Definition at line 1650 of file class.ilObjUserGUI.php.

References roleassignmentObject().

1650  : void
1651  {
1652  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1653  $table_gui->writeFilterToSession();
1654  $table_gui->resetOffset();
1655  $this->roleassignmentObject();
1656  }
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:

◆ assignSaveObject()

ilObjUserGUI::assignSaveObject ( )

Definition at line 1551 of file class.ilObjUserGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\object(), SYSTEM_ROLE_ID, and SYSTEM_USER_ID.

1551  : void
1552  {
1553  if (!$this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)) {
1554  $this->ilias->raiseError(
1555  $this->lng->txt('msg_no_perm_assign_role_to_user'),
1556  $this->ilias->error_obj->MESSAGE
1557  );
1558  }
1559 
1560  $selected_roles = $this->user_request->getRoleIds();
1561  $posted_roles = $this->user_request->getPostedRoleIds();
1562 
1563  // prevent unassignment of system role from system user
1564  if ($this->object->getId() == SYSTEM_USER_ID && in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1565  $selected_roles[] = SYSTEM_ROLE_ID;
1566  }
1567 
1568  $global_roles_all = $this->rbac_review->getGlobalRoles();
1569  $assigned_roles_all = $this->rbac_review->assignedRoles($this->object->getId());
1570  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1571  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1572  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1573 
1574  $user_not_allowed_to_change_admin_role_assginements =
1575  !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
1576 
1577  if ($user_not_allowed_to_change_admin_role_assginements
1578  && in_array(SYSTEM_ROLE_ID, $assigned_roles_all)) {
1579  $selected_roles[] = SYSTEM_ROLE_ID;
1580  }
1581 
1582  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1583 
1584  if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
1585  || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
1586  $this->tpl->setOnScreenMessage(
1587  'failure',
1588  $this->lng->txt('msg_min_one_role') . '<br/>' . $this->lng->txt('action_aborted'),
1589  true
1590  );
1591  $this->ctrl->redirect($this, 'roleassignment');
1592  }
1593 
1594  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1595  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1596  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1597  continue;
1598  }
1599  $this->rbac_admin->deassignUser($role, $this->object->getId());
1600  }
1601 
1602  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1603  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1604  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1605  continue;
1606  }
1607  $this->rbac_admin->assignUser($role, $this->object->getId(), false);
1608  }
1609 
1610  $this->object->update();
1611 
1612  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_roleassignment_changed'), true);
1613 
1614  if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
1615  $this->ctrl->redirect($this, 'roleassignment');
1616  } else {
1617  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1618  }
1619  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
header include for all ilias files.
+ Here is the call graph for this function:

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

Definition at line 152 of file class.ilObjUserGUI.php.

References ilSession\clear(), and ILIAS\Repository\ctrl().

152  : void
153  {
154  ilSession::clear('saved_post');
155 
156  if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
157  $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
158  } else {
159  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
160  }
161  }
static clear(string $a_var)
+ Here is the call graph for this function:

◆ checkAccessToRolesTab()

ilObjUserGUI::checkAccessToRolesTab ( )
private

Definition at line 1994 of file class.ilObjUserGUI.php.

References ILIAS\Repository\access(), ANONYMOUS_USER_ID, ILIAS\Repository\int(), ILIAS\Repository\object(), ilObjUserFolder\ORG_OP_EDIT_USER_ACCOUNTS, and USER_FOLDER_ID.

Referenced by getTabs(), and roleassignmentObject().

1994  : bool
1995  {
1996  return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1997  && (
1998  $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1999  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
2000  && in_array(
2001  $this->object->getId(),
2002  $this->access->filterUserIdsByPositionOfCurrentUser(
2005  [$this->object->getId()]
2006  )
2007  )
2008  );
2009  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
const USER_FOLDER_ID
Definition: constants.php:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkUserWriteRight()

ilObjUserGUI::checkUserWriteRight ( )
private

Definition at line 1963 of file class.ilObjUserGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilObjUserFolder\ORG_OP_EDIT_USER_ACCOUNTS, and USER_FOLDER_ID.

Referenced by editObject(), and loadUserDefinedDataFromForm().

1963  : void
1964  {
1965  if ($this->usrf_ref_id === USER_FOLDER_ID
1966  && (
1967  !$this->rbac_system->checkAccess('visible', $this->usrf_ref_id)
1968  || !$this->rbac_system->checkAccess('write', $this->usrf_ref_id)
1969  && (
1970  !$this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1971  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1972  && !in_array(
1973  $this->object->getId(),
1974  $this->access->filterUserIdsByPositionOfCurrentUser(
1977  [$this->object->getId()]
1978  )
1979  )
1980  )
1981  )
1982  ) {
1983  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1984  }
1985 
1986  // if called from local administration $this->usrf_ref_id is category id
1987  // Todo: this has to be fixed. Do not mix user folder id and category id
1988  if ($this->usrf_ref_id != USER_FOLDER_ID
1989  && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1990  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1991  }
1992  }
const USER_FOLDER_ID
Definition: constants.php:33
header include for all ilias files.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createObject()

ilObjUserGUI::createObject ( )

Display user create form.

Definition at line 355 of file class.ilObjUserGUI.php.

References initCreate(), initForm(), and ILIAS\Repository\lng().

355  : void
356  {
357  if (!$this->rbac_system->checkAccess('create_usr', $this->usrf_ref_id)
358  && !$this->rbac_system->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
359  $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
360  }
361 
362  $this->initCreate();
363  $this->initForm('create');
364  $this->tpl->setContent($this->form_gui->getHTML());
365  }
initForm(string $a_mode)
Init user form.
header include for all ilias files.
+ Here is the call graph for this function:

◆ editObject()

ilObjUserGUI::editObject ( )

Definition at line 521 of file class.ilObjUserGUI.php.

References checkUserWriteRight(), getValues(), initForm(), and USER_FOLDER_ID.

Referenced by removeUserPictureObject().

521  : void
522  {
523  $this->checkUserWriteRight();
524 
525  if ($this->usrf_ref_id != USER_FOLDER_ID) {
526  $this->tabs_gui->clearTargets();
527  }
528 
529  // get form
530  $this->initForm('edit');
531  $this->getValues();
532  $this->tpl->setContent($this->form_gui->getHTML());
533  }
const USER_FOLDER_ID
Definition: constants.php:33
initForm(string $a_mode)
Init user form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjUserGUI::executeCommand ( )

Definition at line 106 of file class.ilObjUserGUI.php.

References ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\LP_CONTEXT_USER_FOLDER, ILIAS\Repository\object(), ilObjectGUI\prepareOutput(), and USER_FOLDER_ID.

106  : void
107  {
108  $next_class = $this->ctrl->getNextClass($this);
109  $cmd = $this->ctrl->getCmd();
110 
111  $this->prepareOutput();
112 
113  switch ($next_class) {
114  case 'illearningprogressgui':
115  $new_gui = new ilLearningProgressGUI(
118  $this->object->getId()
119  );
120  $this->ctrl->forwardCommand($new_gui);
121  break;
122 
123  case 'ilobjectownershipmanagementgui':
124  $gui = new ilObjectOwnershipManagementGUI($this->object->getId());
125  $this->ctrl->forwardCommand($gui);
126  break;
127 
128  default:
129  if ($cmd == '' || $cmd == 'view') {
130  $cmd = 'edit';
131  }
132  $cmd .= 'Object';
133  $this->$cmd();
134  break;
135  }
136  }
const USER_FOLDER_ID
Definition: constants.php:33
prepareOutput(bool $show_sub_objects=true)
Class ilObjectOwnershipManagementGUI.
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:

◆ getAdminTabs()

ilObjUserGUI::getAdminTabs ( )

Definition at line 163 of file class.ilObjUserGUI.php.

References getTabs().

163  : void
164  {
165  $this->getTabs();
166  }
+ Here is the call graph for this function:

◆ getTabs()

ilObjUserGUI::getTabs ( )
protected

Definition at line 168 of file class.ilObjUserGUI.php.

References ilObjUserTracking\_enabledLearningProgress(), ilObjUserTracking\_enabledUserRelatedData(), checkAccessToRolesTab(), ILIAS\Repository\ctrl(), ilSession\get(), ILIAS\Repository\help(), and ILIAS\Repository\lng().

Referenced by getAdminTabs().

168  : void
169  {
170  $this->tabs_gui->clearTargets();
171 
172  $this->help->setScreenIdComponent('usr');
173 
174  if ($this->requested_search) {
175  $this->tabs_gui->setBackTarget(
176  $this->lng->txt('search_results'),
177  ilSession::get('usr_search_link')
178  );
179 
180  $this->tabs_gui->addTarget(
181  'properties',
182  $this->ctrl->getLinkTarget($this, 'edit'),
183  ['edit', '', 'view'],
184  get_class($this),
185  '',
186  true
187  );
188  } else {
189  $this->tabs_gui->addTarget(
190  'properties',
191  $this->ctrl->getLinkTarget($this, 'edit'),
192  ['edit', '', 'view'],
193  get_class($this)
194  );
195  }
196 
197  if ($this->checkAccessToRolesTab()) {
198  $this->tabs_gui->addTarget(
199  'role_assignment',
200  $this->ctrl->getLinkTarget($this, 'roleassignment'),
201  ['roleassignment'],
202  get_class($this)
203  );
204  }
205 
206  // learning progress
207  if ($this->rbac_system->checkAccess('read', $this->ref_id) and
209  ilObjUserTracking::_enabledUserRelatedData()) {
210  $this->tabs_gui->addTarget(
211  'learning_progress',
212  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
213  '',
214  ['illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui']
215  );
216  }
217 
218  $this->tabs_gui->addTarget(
219  'user_ownership',
220  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
221  '',
222  'ilobjectownershipmanagementgui'
223  );
224  }
static get(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValues()

ilObjUserGUI::getValues ( )

Definition at line 836 of file class.ilObjUserGUI.php.

References ilObjectGUI\$data, ilUserDefinedFields\_getInstance(), ilObjUser\_lookupLogin(), ilDatePresentation\formatDate(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, ILIAS\Repository\int(), and ILIAS\Repository\object().

Referenced by editObject().

836  : void
837  {
838  $data = [];
839 
840  // login data
841  $data['auth_mode'] = $this->object->getAuthMode();
842  $data['login'] = $this->object->getLogin();
843  $data['ext_account'] = $this->object->getExternalAccount();
844  $data['create_date'] = ilDatePresentation::formatDate(new ilDateTime(
845  $this->object->getCreateDate(),
847  ));
848  $data['owner'] = ilObjUser::_lookupLogin($this->object->getOwner());
849  $data['approve_date'] = ($this->object->getApproveDate() != '')
850  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getApproveDate(), IL_CAL_DATETIME))
851  : null;
852 
853  $data['last_login'] = ($this->object->getLastLogin() != '')
854  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getLastLogin(), IL_CAL_DATETIME))
855  : null;
856  $data['active'] = $this->object->getActive();
857  $data['time_limit_unlimited'] = $this->object->getTimeLimitUnlimited() ? '1' : '0';
858 
859  $data['time_limit_from'] = $this->object->getTimeLimitFrom()
860  ? new ilDateTime($this->object->getTimeLimitFrom(), IL_CAL_UNIX)
861  : null;
862  $data['time_limit_until'] = $this->object->getTimeLimitUntil()
863  ? new ilDateTime($this->object->getTimeLimitUntil(), IL_CAL_UNIX)
864  : null;
865 
866  $data['gender'] = $this->object->getGender();
867  $data['firstname'] = $this->object->getFirstname();
868  $data['lastname'] = $this->object->getLastname();
869  $data['title'] = $this->object->getUTitle();
870  $data['birthday'] = $this->object->getBirthday()
871  ? new ilDate($this->object->getBirthday(), IL_CAL_DATE)
872  : null;
873  $data['institution'] = $this->object->getInstitution();
874  $data['department'] = $this->object->getDepartment();
875  $data['street'] = $this->object->getStreet();
876  $data['city'] = $this->object->getCity();
877  $data['zipcode'] = $this->object->getZipcode();
878  $data['country'] = $this->object->getCountry();
879  $data['sel_country'] = $this->object->getSelectedCountry();
880  $data['phone_office'] = $this->object->getPhoneOffice();
881  $data['phone_home'] = $this->object->getPhoneHome();
882  $data['phone_mobile'] = $this->object->getPhoneMobile();
883  $data['fax'] = $this->object->getFax();
884  $data['email'] = $this->object->getEmail();
885  $data['second_email'] = $this->object->getSecondEmail();
886  $data['hobby'] = $this->object->getHobby();
887  $data['referral_comment'] = $this->object->getComment();
888 
889  $data['interests_general'] = $this->object->getGeneralInterests();
890  $data['interests_help_offered'] = $this->object->getOfferingHelp();
891  $data['interests_help_looking'] = $this->object->getLookingForHelp();
892 
893  $data['matriculation'] = $this->object->getMatriculation();
894  $data['client_ip'] = $this->object->getClientIP();
895 
896  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
897  $user_defined_data = $this->object->getUserDefinedData();
898  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
899  $data['udf_' . $field_id] = $user_defined_data['f_' . $field_id] ?? '';
900  }
901 
902  $data['language'] = $this->object->getLanguage();
903  $data['skin_style'] = $this->object->skin . ':' . $this->object->prefs['style'];
904  $data['hits_per_page'] = $this->object->prefs['hits_per_page'] ?? '';
905  $data['hide_own_online_status'] = $this->object->prefs['hide_own_online_status'] ?? '';
906  $data['bs_allow_to_contact_me'] = ($this->object->prefs['bs_allow_to_contact_me'] ?? '') == 'y';
907  $data['chat_osc_accept_msg'] = ($this->object->prefs['chat_osc_accept_msg'] ?? '') == 'y';
908  $data['chat_broadcast_typing'] = ($this->object->prefs['chat_broadcast_typing'] ?? '') == 'y';
909  $data['session_reminder_enabled'] = (int) ($this->object->prefs['session_reminder_enabled'] ?? 0);
910 
911  $data['send_mail'] = (($this->object->prefs['send_info_mails'] ?? '') == 'y');
912 
913  $this->form_gui->setValuesByArray($data);
914  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
const IL_CAL_DATE
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleIgnoredRequiredFields()

ilObjUserGUI::handleIgnoredRequiredFields ( )
protected

Handles ignored required fields by changing the required flag of form elements.

Returns
bool A flag whether the user profile is maybe incomplete after saving the form data

Definition at line 1925 of file class.ilObjUserGUI.php.

References ilUserDefinedFields\_getInstance(), and ilUserDefinedFields\getDefinitions().

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1925  : bool
1926  {
1927  $profile_maybe_incomplete = false;
1928 
1929  foreach ($this->user_profile->getIgnorableRequiredSettings() as $fieldName) {
1930  $elm = $this->form_gui->getItemByPostVar($fieldName);
1931 
1932  if (!$elm) {
1933  continue;
1934  }
1935 
1936  if ($elm->getRequired()) {
1937  $profile_maybe_incomplete = true;
1938 
1939  // Flag as optional
1940  $elm->setRequired(false);
1941  }
1942  }
1943 
1945  foreach ($user_defined_fields->getDefinitions() as $definition) {
1946  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
1947 
1948  if (!$elm) {
1949  continue;
1950  }
1951 
1952  if ($elm->getRequired() && $definition['required']) {
1953  $profile_maybe_incomplete = true;
1954 
1955  // Flag as optional
1956  $elm->setRequired(false);
1957  }
1958  }
1959 
1960  return $profile_maybe_incomplete;
1961  }
ilUserDefinedFields $user_defined_fields
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreate()

ilObjUserGUI::initCreate ( )

Definition at line 293 of file class.ilObjUserGUI.php.

References ILIAS\LTI\ToolProvider\$key, ilObjRole\_getAssignUsersStatus(), ANONYMOUS_ROLE_ID, ILIAS\Repository\lng(), ILIAS\Repository\object(), ROLE_FOLDER_ID, SYSTEM_ROLE_ID, and USER_FOLDER_ID.

Referenced by createObject(), and saveObject().

293  : void
294  {
295  if ($this->usrf_ref_id != USER_FOLDER_ID) {
296  $this->tabs_gui->clearTargets();
297  }
298 
299  // role selection
300  $obj_list = $this->rbac_review->getRoleListByObject(ROLE_FOLDER_ID);
301  $rol = [];
302  foreach ($obj_list as $obj_data) {
303  // allow only 'assign_users' marked roles if called from category
304  if ($this->object->getRefId() != USER_FOLDER_ID && !in_array(
306  $this->rbac_review->assignedRoles($this->user->getId())
307  )) {
308  if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
309  continue;
310  }
311  }
312  // exclude anonymous role from list
313  if ($obj_data['obj_id'] != ANONYMOUS_ROLE_ID) {
314  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
315  if ($obj_data['obj_id'] != SYSTEM_ROLE_ID || in_array(
317  $this->rbac_review->assignedRoles($this->user->getId())
318  )) {
319  $rol[$obj_data['obj_id']] = $obj_data['title'];
320  }
321  }
322  }
323 
324  if (!count($rol)) {
325  $this->ilias->raiseError(
326  $this->lng->txt('msg_no_roles_users_can_be_assigned_to'),
327  $this->ilias->error_obj->MESSAGE
328  );
329  }
330 
331  $keys = array_keys($rol);
332 
333  // set pre defined user role to default
334  if (in_array(4, $keys)) {
335  $this->default_role = 4;
336  } else {
337  if (count($keys) > 1 && in_array(2, $keys)) {
338  // remove admin role as preselectable role
339  foreach ($keys as $key => $val) {
340  if ($val == 2) {
341  unset($keys[$key]);
342  break;
343  }
344  }
345  }
346 
347  $this->default_role = array_shift($keys);
348  }
349  $this->selectable_roles = $rol;
350  }
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_ROLE_ID
Definition: constants.php:29
string $key
Consumer key/client ID value.
Definition: System.php:193
header include for all ilias files.
const ROLE_FOLDER_ID
Definition: constants.php:34
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
static _getAssignUsersStatus(int $a_role_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilObjUserGUI::initForm ( string  $a_mode)

Init user form.

Definition at line 919 of file class.ilObjUserGUI.php.

References $_SERVER, Vendor\Package\$a, Vendor\Package\$e, ilObjectGUI\$id, $lang, XapiProxy\$req, ilObjectGUI\$settings, ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_getLastHistoryDataByUserId(), ilObjUser\_getPersonalPicturePath(), ilAuthUtils\_isExternalAccountEnabled(), ilSystemStyleSettings\_lookupActivatedStyle(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilAuthUtils\getAuthModeTranslation(), ilUserDefinedFields\getChangeableLocalUserAdministrationDefinitions(), ilUserDefinedFields\getDefinitions(), ilCustomUserFieldsHelper\getInstance(), ilSecuritySettingsChecker\getPasswordRequirementsInfo(), IL_CAL_UNIX, ILIAS\Repository\int(), isSettingChangeable(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilImageFileInputGUI\setImage(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setRows(), ILIAS\Repository\settings(), ilPasswordInputGUI\setUseStripSlashes(), ilRadioGroupInputGUI\setValue(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, ILIAS\Repository\user(), USER_FOLDER_ID, and ilUtil\yn2tf().

Referenced by createObject(), editObject(), loadUserDefinedDataFromForm(), and saveObject().

919  : void
920  {
921  $settings = $this->settings->getAll();
922 
923  $this->form_gui = new ilPropertyFormGUI();
924  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
925  if ($a_mode == 'create') {
926  $this->form_gui->setTitle($this->lng->txt('usr_new'));
927  } else {
928  $this->form_gui->setTitle($this->lng->txt('usr_edit'));
929  }
930 
931  // login data
932  $sec_l = new ilFormSectionHeaderGUI();
933  $sec_l->setTitle($this->lng->txt('login_data'));
934  $this->form_gui->addItem($sec_l);
935 
936  // authentication mode
937  $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
938  $am = new ilSelectInputGUI($this->lng->txt('auth_mode'), 'auth_mode');
939  $option = [];
940  foreach ($active_auth_modes as $auth_name => $auth_key) {
941  if ($auth_name == 'default') {
942  $name = $this->lng->txt('auth_' . $auth_name) . ' (' . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ')';
943  } else {
944  $name = ilAuthUtils::getAuthModeTranslation((string) $auth_key, $auth_name);
945  }
946  $option[$auth_name] = $name;
947  }
948  $am->setOptions($option);
949  $this->form_gui->addItem($am);
950 
951  if ($a_mode == 'edit') {
952  $id = new ilNonEditableValueGUI($this->lng->txt('usr_id'), 'id');
953  $id->setValue($this->object->getId());
954  $this->form_gui->addItem($id);
955  }
956 
957  $lo = new ilUserLoginInputGUI($this->lng->txt('login'), 'login');
958  $lo->setRequired(true);
959  if ($a_mode == 'edit') {
960  $lo->setCurrentUserId($this->object->getId());
961  try {
962  $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
963  $lo->setInfo(
964  sprintf(
965  $this->lng->txt('usr_loginname_history_info'),
966  ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)),
967  $last_history_entry[0]
968  )
969  );
970  } catch (ilUserException $e) {
971  }
972  }
973 
974  $this->form_gui->addItem($lo);
975 
976  if ($this->user->getId() === (int) SYSTEM_USER_ID
977  || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
978  || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
979  $pw = new ilPasswordInputGUI($this->lng->txt('passwd'), 'passwd');
980  $pw->setUseStripSlashes(false);
981  $pw->setSize(32);
982  $pw->setMaxLength(80);
983  $pw->setValidateAuthPost('auth_mode');
984  if ($a_mode == 'create') {
985  $pw->setRequiredOnAuth(true);
986  }
987  if ($this->user->getId() !== (int) SYSTEM_USER_ID
988  && in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
989  && !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
990  $pw->setDisabled(true);
991  }
993  $this->form_gui->addItem($pw);
994  }
995 
997  $ext = new ilTextInputGUI($this->lng->txt('user_ext_account'), 'ext_account');
998  $ext->setSize(40);
999  $ext->setMaxLength(250);
1000  $ext->setInfo($this->lng->txt('user_ext_account_desc'));
1001  $this->form_gui->addItem($ext);
1002  }
1003 
1004  $sec_si = new ilFormSectionHeaderGUI();
1005  $sec_si->setTitle($this->lng->txt('system_information'));
1006  $this->form_gui->addItem($sec_si);
1007 
1008  // create date, approve date, agreement date, last login
1009  if ($a_mode == 'edit') {
1010  $sia = [
1011  'create_date' => '',
1012  'approve_date' => '',
1013  ...$this->legal_documents->userManagementFields($this->object),
1014  'last_login' => '',
1015  'owner' => '',
1016  ];
1017  foreach ($sia as $a => $v) {
1018  if (is_string($v)) {
1019  $siai = new ilNonEditableValueGUI($this->lng->txt($a), $a);
1020  $siai->setValue($v);
1021  $this->form_gui->addItem($siai);
1022  } else {
1023  $this->form_gui->addItem($v);
1024  }
1025  }
1026  }
1027 
1028  $ac = new ilCheckboxInputGUI($this->lng->txt('active'), 'active');
1029  $ac->setChecked(true);
1030  $this->form_gui->addItem($ac);
1031 
1032  $this->lng->loadLanguageModule('crs');
1033 
1034  $radg = new ilRadioGroupInputGUI($this->lng->txt('time_limit'), 'time_limit_unlimited');
1035  $radg->setValue('1');
1036  $radg->setRequired(true);
1037  $op1 = new ilRadioOption($this->lng->txt('user_access_unlimited'), '1');
1038  $radg->addOption($op1);
1039  $op2 = new ilRadioOption($this->lng->txt('user_access_limited'), '0');
1040  $radg->addOption($op2);
1041 
1042  $acfrom = new ilDateTimeInputGUI($this->lng->txt('crs_from'), 'time_limit_from');
1043  $acfrom->setRequired(true);
1044  $acfrom->setShowTime(true);
1045  $acfrom->setMinuteStepSize(1);
1046  $op2->addSubItem($acfrom);
1047 
1048  $acto = new ilDateTimeInputGUI($this->lng->txt('crs_to'), 'time_limit_until');
1049  $acto->setRequired(true);
1050  $acto->setShowTime(true);
1051  $acto->setMinuteStepSize(1);
1052  $op2->addSubItem($acto);
1053 
1054  $this->form_gui->addItem($radg);
1055 
1056  if ($this->isSettingChangeable('gender')
1057  || $this->isSettingChangeable('firstname')
1058  || $this->isSettingChangeable('lastname')
1059  || $this->isSettingChangeable('title')
1060  || $this->isSettingChangeable('personal_image')
1061  || $this->isSettingChangeable('birhtday')
1062  ) {
1063  $sec_pd = new ilFormSectionHeaderGUI();
1064  $sec_pd->setTitle($this->lng->txt('personal_data'));
1065  $this->form_gui->addItem($sec_pd);
1066  }
1067 
1068  if ($this->isSettingChangeable('gender')) {
1069  $gndr = new ilRadioGroupInputGUI($this->lng->txt('salutation'), 'gender');
1070  $gndr->setRequired(isset($settings['require_gender']) && $settings['require_gender']);
1071  $neutral = new ilRadioOption($this->lng->txt('salutation_n'), 'n');
1072  $gndr->addOption($neutral);
1073  $female = new ilRadioOption($this->lng->txt('salutation_f'), 'f');
1074  $gndr->addOption($female);
1075  $male = new ilRadioOption($this->lng->txt('salutation_m'), 'm');
1076  $gndr->addOption($male);
1077  $this->form_gui->addItem($gndr);
1078  }
1079 
1080  $fields = [
1081  'firstname' => true,
1082  'lastname' => true,
1083  'title' => isset($settings['require_title']) && $settings['require_title']
1084  ];
1085  foreach ($fields as $field => $req) {
1086  $max_len = $field === 'title' ? 32 : 128;
1087  if ($this->isSettingChangeable($field)) {
1088  // #18795
1089  $caption = ($field == 'title')
1090  ? 'person_title'
1091  : $field;
1092  $inp = new ilTextInputGUI($this->lng->txt($caption), $field);
1093  $inp->setSize(32);
1094  $inp->setMaxLength($max_len);
1095  $inp->setRequired($req);
1096  $this->form_gui->addItem($inp);
1097  }
1098  }
1099 
1100  // personal image
1101  if ($this->isSettingChangeable('upload')) {
1102  $pi = new ilImageFileInputGUI($this->lng->txt('personal_picture'), 'userfile');
1103  if ($a_mode == 'edit' || $a_mode == 'upload') {
1105  $this->object->getId(),
1106  'small',
1107  true,
1108  true
1109  ));
1110  }
1111  $this->form_gui->addItem($pi);
1112  }
1113 
1114  if ($this->isSettingChangeable('birthday')) {
1115  $birthday = new ilBirthdayInputGUI($this->lng->txt('birthday'), 'birthday');
1116  $birthday->setRequired(isset($settings['require_birthday']) && $settings['require_birthday']);
1117  $this->form_gui->addItem($birthday);
1118  }
1119 
1120  // institution, department, street, city, zip code, country, phone office
1121  // phone home, phone mobile, fax, e-mail
1122  $fields = [
1123  ['institution', 40, 80],
1124  ['department', 40, 80],
1125  ['street', 40, 40],
1126  ['city', 40, 40],
1127  ['zipcode', 10, 10],
1128  ['country', 40, 40],
1129  ['sel_country'],
1130  ['phone_office', 30, 30],
1131  ['phone_home', 30, 30],
1132  ['phone_mobile', 30, 30],
1133  ['fax', 30, 30]
1134  ];
1135 
1136  $counter = 0;
1137  foreach ($fields as $field) {
1138  if (!$counter++ and $this->isSettingChangeable($field[0])) {
1139  // contact data
1140  $sec_cd = new ilFormSectionHeaderGUI();
1141  $sec_cd->setTitle($this->lng->txt('contact_data'));
1142  $this->form_gui->addItem($sec_cd);
1143 
1144  // org units
1145  if ($a_mode == 'edit') {
1146  $orgus = new ilNonEditableValueGUI($this->lng->txt('objs_orgu'), 'org_units');
1147  $orgus->setValue($this->object->getOrgUnitsRepresentation());
1148  $this->form_gui->addItem($orgus);
1149  }
1150  }
1151  if ($this->isSettingChangeable($field[0])) {
1152  if ($field[0] != 'sel_country') {
1153  $inp = new ilTextInputGUI($this->lng->txt($field[0]), $field[0]);
1154  $inp->setSize($field[1]);
1155  $inp->setMaxLength($field[2]);
1156  $inp->setRequired(isset($settings['require_' . $field[0]]) &&
1157  $settings['require_' . $field[0]]);
1158  $this->form_gui->addItem($inp);
1159  } else {
1160  // country selection
1161  $cs = new ilCountrySelectInputGUI($this->lng->txt($field[0]), $field[0]);
1162  $cs->setRequired(isset($settings['require_' . $field[0]]) &&
1163  $settings['require_' . $field[0]]);
1164  $this->form_gui->addItem($cs);
1165  }
1166  }
1167  }
1168 
1169  if ($this->isSettingChangeable('email')) {
1170  $em = new ilEMailInputGUI($this->lng->txt('email'), 'email');
1171  $em->setRequired(isset($settings['require_email']) && $settings['require_email']);
1172  $em->setMaxLength(128);
1173  $this->form_gui->addItem($em);
1174  }
1175 
1176  if ($this->isSettingChangeable('second_email')) {
1177  $em = new ilEMailInputGUI($this->lng->txt('second_email'), 'second_email');
1178 
1179  $this->form_gui->addItem($em);
1180  }
1181 
1182  if ($this->isSettingChangeable('hobby')) {
1183  $hob = new ilTextAreaInputGUI($this->lng->txt('hobby'), 'hobby');
1184  $hob->setRows(3);
1185  $hob->setCols(40);
1186  $hob->setRequired(isset($settings['require_hobby']) &&
1187  $settings['require_hobby']);
1188  $this->form_gui->addItem($hob);
1189  }
1190 
1191  if ($this->isSettingChangeable('referral_comment')) {
1192  $rc = new ilTextAreaInputGUI($this->lng->txt('referral_comment'), 'referral_comment');
1193  $rc->setRows(3);
1194  $rc->setCols(40);
1195  $rc->setRequired(isset($settings['require_referral_comment']) &&
1196  $settings['require_referral_comment']);
1197  $this->form_gui->addItem($rc);
1198  }
1199 
1200  $sh = new ilFormSectionHeaderGUI();
1201  $sh->setTitle($this->lng->txt('interests'));
1202  $this->form_gui->addItem($sh);
1203 
1204  $multi_fields = ['interests_general', 'interests_help_offered', 'interests_help_looking'];
1205  foreach ($multi_fields as $multi_field) {
1206  if ($this->isSettingChangeable($multi_field)) {
1207  // see ilUserProfile
1208  $ti = new ilTextInputGUI($this->lng->txt($multi_field), $multi_field);
1209  $ti->setMulti(true);
1210  $ti->setMaxLength(40);
1211  $ti->setSize(40);
1212  $ti->setRequired(isset($settings['require_' . $multi_field]) &&
1213  $settings['require_' . $multi_field]);
1214  $this->form_gui->addItem($ti);
1215  }
1216  }
1217 
1218  if ($this->isSettingChangeable('user_profile_other')) {
1219  $sec_oi = new ilFormSectionHeaderGUI();
1220  $sec_oi->setTitle($this->lng->txt('user_profile_other'));
1221  $this->form_gui->addItem($sec_oi);
1222  }
1223 
1224  if ($this->isSettingChangeable('matriculation')) {
1225  $mr = new ilTextInputGUI($this->lng->txt('matriculation'), 'matriculation');
1226  $mr->setSize(40);
1227  $mr->setMaxLength(40);
1228  $mr->setRequired(isset($settings['require_matriculation']) &&
1229  $settings['require_matriculation']);
1230  $this->form_gui->addItem($mr);
1231  }
1232 
1233  $ip = new ilTextInputGUI($this->lng->txt('client_ip'), 'client_ip');
1234  $ip->setSize(40);
1235  $ip->setMaxLength(255);
1236  $ip->setInfo($this->lng->txt('current_ip') . ' ' . $_SERVER['REMOTE_ADDR'] . ' <br />' .
1237  '<span class="warning">' . $this->lng->txt('current_ip_alert') . '</span>');
1238  $this->form_gui->addItem($ip);
1239 
1241 
1242  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1243  $all_defs = $user_defined_fields->getDefinitions();
1244  } else {
1246  }
1247 
1248  foreach ($all_defs as $definition) {
1249  $f_property = ilCustomUserFieldsHelper::getInstance()->getFormPropertyForDefinition($definition, true);
1250  if ($f_property instanceof ilFormPropertyGUI) {
1251  $this->form_gui->addItem($f_property);
1252  }
1253  }
1254 
1255  if ($a_mode == 'create'
1256  || $this->isSettingChangeable('language')
1257  || $this->isSettingChangeable('skin_style')
1258  || $this->isSettingChangeable('hits_per_page')
1259  || $this->isSettingChangeable('hide_own_online_status')
1260  || $this->isSettingChangeable('bs_allow_to_contact_me')
1261  || $this->isSettingChangeable('chat_osc_accept_msg')
1262  || $this->isSettingChangeable('chat_broadcast_typing')
1263  ) {
1264  $sec_st = new ilFormSectionHeaderGUI();
1265  $sec_st->setTitle($this->lng->txt('settings'));
1266  $this->form_gui->addItem($sec_st);
1267  }
1268 
1269  if ($a_mode == 'create') {
1270  $role = new ilSelectInputGUI(
1271  $this->lng->txt('default_role'),
1272  'default_role'
1273  );
1274  $role->setRequired(true);
1275  $role->setValue($this->default_role);
1276  $role->setOptions($this->selectable_roles);
1277  $this->form_gui->addItem($role);
1278  }
1279 
1280  if ($this->isSettingChangeable('language')) {
1281  $languages = $this->lng->getInstalledLanguages();
1282  $this->lng->loadLanguageModule('meta');
1283  $options = [];
1284  foreach ($languages as $l) {
1285  $options[$l] = $this->lng->txt('meta_l_' . $l);
1286  }
1287  $lang = new ilSelectInputGUI(
1288  $this->lng->txt('language'),
1289  'language'
1290  );
1291  $lang->setOptions($options);
1292  $lang->setValue($this->settings->get('language'));
1293  if (count($options) <= 1) {
1294  $lang->setDisabled(true);
1295  }
1296  $this->form_gui->addItem($lang);
1297  }
1298 
1299  if ($this->isSettingChangeable('skin_style')) {
1300  $sk = new ilSelectInputGUI(
1301  $this->lng->txt('skin_style'),
1302  'skin_style'
1303  );
1304 
1305  $skins = ilStyleDefinition::getAllSkins();
1306 
1307  $options = [];
1308  if (is_array($skins)) {
1309  $sk = new ilSelectInputGUI($this->lng->txt('skin_style'), 'skin_style');
1310 
1311  $options = [];
1312  foreach ($skins as $skin) {
1313  foreach ($skin->getStyles() as $style) {
1314  if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId())) {
1315  continue;
1316  }
1317 
1318  $options[$skin->getId() . ':' . $style->getId()] = $skin->getName() . ' / ' . $style->getName();
1319  }
1320  }
1321  }
1322  $sk->setOptions($options);
1323  $sk->setValue($this->default_layout_and_style);
1324 
1325  $this->form_gui->addItem($sk);
1326  }
1327 
1328  if ($this->isSettingChangeable('hits_per_page')) {
1329  $hpp = new ilSelectInputGUI(
1330  $this->lng->txt('hits_per_page'),
1331  'hits_per_page'
1332  );
1333  $options = [
1334  10 => 10,
1335  15 => 15,
1336  20 => 20,
1337  30 => 30,
1338  40 => 40,
1339  50 => 50,
1340  100 => 100,
1341  9999 => $this->lng->txt('no_limit')
1342  ];
1343  $hpp->setOptions($options);
1344  $hpp->setValue($this->settings->get('hits_per_page'));
1345  $this->form_gui->addItem($hpp);
1346  }
1347 
1348  if ($this->isSettingChangeable('hide_own_online_status')) {
1349  $this->lng->loadLanguageModule('awrn');
1350 
1351  $default = ($this->settings->get('hide_own_online_status') == 'n')
1352  ? $this->lng->txt('user_awrn_show')
1353  : $this->lng->txt('user_awrn_hide');
1354 
1355  $options = [
1356  '' => $this->lng->txt('user_awrn_default') . ' (' . $default . ')',
1357  'n' => $this->lng->txt('user_awrn_show'),
1358  'y' => $this->lng->txt('user_awrn_hide')
1359  ];
1360  $os = new ilSelectInputGUI($this->lng->txt('awrn_user_show'), 'hide_own_online_status');
1361  $os->setOptions($options);
1362  $os->setDisabled((bool) $this->settings->get('usr_settings_disable_hide_own_online_status'));
1363  $os->setInfo($this->lng->txt('awrn_hide_from_awareness_info'));
1364  $this->form_gui->addItem($os);
1365  }
1366 
1367  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
1368  $this->lng->loadLanguageModule('buddysystem');
1369  $os = new ilCheckboxInputGUI($this->lng->txt('buddy_allow_to_contact_me'), 'bs_allow_to_contact_me');
1370  if ($a_mode == 'create') {
1371  $os->setChecked(ilUtil::yn2tf($this->settings->get('bs_allow_to_contact_me', 'n')));
1372  }
1373  $this->form_gui->addItem($os);
1374  }
1375  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
1376  $this->lng->loadLanguageModule('chatroom');
1377  $chat_osc_acm = new ilCheckboxInputGUI($this->lng->txt('chat_osc_accept_msg'), 'chat_osc_accept_msg');
1378  if ($a_mode == 'create') {
1379  $chat_osc_acm->setChecked(ilUtil::yn2tf($this->settings->get('chat_osc_accept_msg', 'n')));
1380  }
1381  $this->form_gui->addItem($chat_osc_acm);
1382  }
1383 
1384  if ((int) $this->settings->get('session_reminder_enabled')) {
1385  $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
1386  $cb->setValue('1');
1387  $this->form_gui->addItem($cb);
1388  }
1389 
1390  if ($this->isSettingChangeable('send_mail')) {
1391  $sec_op = new ilFormSectionHeaderGUI();
1392  $sec_op->setTitle($this->lng->txt('options'));
1393  $this->form_gui->addItem($sec_op);
1394  }
1395 
1396  $se = new ilCheckboxInputGUI($this->lng->txt('inform_user_mail'), 'send_mail');
1397  $se->setInfo($this->lng->txt('inform_user_mail_info'));
1398  $se->setValue('y');
1399  $se->setChecked(($this->user->getPref('send_info_mails') == 'y'));
1400  $this->form_gui->addItem($se);
1401 
1402  $irf = new ilCheckboxInputGUI($this->lng->txt('ignore_required_fields'), 'ignore_rf');
1403  $irf->setInfo($this->lng->txt('ignore_required_fields_info'));
1404  $irf->setValue('1');
1405  $this->form_gui->addItem($irf);
1406 
1407  if ($a_mode == 'create' || $a_mode == 'save') {
1408  $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
1409  }
1410  if ($a_mode == 'edit' || $a_mode == 'update') {
1411  $this->form_gui->addCommandButton('update', $this->lng->txt('save'));
1412  }
1413  $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
1414  }
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...
ilUserDefinedFields $user_defined_fields
const USER_FOLDER_ID
Definition: constants.php:33
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
This class represents a selection list property in a property form.
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SYSTEM_ROLE_ID
Definition: constants.php:29
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOptions(array $a_options)
static _getActiveAuthModes()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
static _getAuthModeName($a_auth_key)
isSettingChangeable(string $a_field)
This class represents a date/time property in a property form.
catch(\Exception $e) $req
Definition: xapiproxy.php:93
static _getLastHistoryDataByUserId(int $a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
This class represents a property in a property form.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
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 _isExternalAccountEnabled()
Check if an external account name is required.
setRequired(bool $a_required)
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
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)
$lang
Definition: xapiexit.php:26
This class represents an image file property in a property form.
This class represents a text area property in a property form.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static yn2tf(string $a_yn)
ilSetting $settings
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSettingChangeable()

ilObjUserGUI::isSettingChangeable ( string  $a_field)
protected

Definition at line 1416 of file class.ilObjUserGUI.php.

References ilObjectGUI\$settings, ILIAS\Repository\settings(), and USER_FOLDER_ID.

Referenced by initForm(), loadUserDefinedDataFromForm(), loadValuesFromForm(), and saveObject().

1416  : bool
1417  {
1418  static $settings = null;
1419 
1420  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1421  return true;
1422  }
1423 
1424  if ($settings == null) {
1425  $settings = $this->settings->getAll();
1426  }
1427  return (bool) ($settings['usr_settings_changeable_lua_' . $a_field] ?? false);
1428  }
const USER_FOLDER_ID
Definition: constants.php:33
ilSetting $settings
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadUserDefinedDataFromForm()

ilObjUserGUI::loadUserDefinedDataFromForm ( ?ilObjUser  $user = null)
protected

Definition at line 668 of file class.ilObjUserGUI.php.

References Vendor\Package\$e, Vendor\Package\$f, ilObjectGUI\$object, ilObjectGUI\$user, __sendProfileMail(), ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilUserDefinedFields\_getInstance(), checkUserWriteRight(), ILIAS\Repository\ctrl(), ilUserDefinedFields\getChangeableLocalUserAdministrationDefinitions(), ilUserDefinedFields\getDefinitions(), handleIgnoredRequiredFields(), initForm(), ILIAS\Repository\int(), isSettingChangeable(), ILIAS\Repository\lng(), loadValuesFromForm(), ILIAS\Repository\object(), ilObjUser\PASSWD_PLAIN, ILIAS\Repository\settings(), ilObjUser\setUserDefinedData(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, ilObject\update(), ilObjectGUI\updateObject(), uploadUserPicture(), ILIAS\Repository\user(), and USER_FOLDER_ID.

Referenced by saveObject().

668  : void
669  {
670  if (!$user) {
672  }
673 
675  if ($this->usrf_ref_id == USER_FOLDER_ID) {
676  $all_defs = $user_defined_fields->getDefinitions();
677  } else {
679  }
680  $udf = [];
681  foreach ($all_defs as $definition) {
682  $f = "udf_" . $definition['field_id'];
683  $item = $this->form_gui->getItemByPostVar($f);
684  if ($item && !$item->getDisabled()) {
685  $udf[$definition['field_id']] = $this->form_gui->getInput($f);
686  }
687  }
688  $user->setUserDefinedData($udf);
689  }
ilUserDefinedFields $user_defined_fields
const USER_FOLDER_ID
Definition: constants.php:33
setUserDefinedData(array $a_data)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadValuesFromForm()

ilObjUserGUI::loadValuesFromForm ( string  $a_mode = 'create')
protected

Definition at line 535 of file class.ilObjUserGUI.php.

References ilObjectGUI\$object, ilObjectGUI\$user, ilObjUser\getActive(), IL_CAL_DATE, IL_CAL_UNIX, ILIAS\Repository\int(), isSettingChangeable(), ilObjUser\setActive(), ilObjUser\setAuthMode(), ilObjUser\setBirthday(), ilObjUser\setCity(), ilObjUser\setClientIP(), ilObjUser\setComment(), ilObjUser\setCountry(), ilObjUser\setDepartment(), ilObjUser\setEmail(), ilObjUser\setExternalAccount(), ilObjUser\setFax(), ilObjUser\setFirstname(), ilObjUser\setFullname(), ilObjUser\setGender(), ilObjUser\setGeneralInterests(), ilObjUser\setHobby(), ilObjUser\setInstitution(), ilObjUser\setLastname(), ilObjUser\setLatitude(), ilObjUser\setLocationZoom(), ilObjUser\setLogin(), ilObjUser\setLongitude(), ilObjUser\setLookingForHelp(), ilObjUser\setMatriculation(), ilObjUser\setOfferingHelp(), ilObjUser\setPhoneHome(), ilObjUser\setPhoneMobile(), ilObjUser\setPhoneOffice(), ilObjUser\setSecondEmail(), ilObjUser\setSelectedCountry(), ilObjUser\setStreet(), ilObjUser\setTimeLimitFrom(), ilObjUser\setTimeLimitOwner(), ilObjUser\setTimeLimitUnlimited(), ilObjUser\setTimeLimitUntil(), ilObjUser\setUTitle(), ilObjUser\setZipcode(), and ILIAS\Repository\user().

Referenced by loadUserDefinedDataFromForm(), and saveObject().

535  : ilObjUser
536  {
537  $user = null;
538 
539  switch ($a_mode) {
540  case 'create':
541  $user = new ilObjUser();
542  break;
543 
544  case 'update':
546  break;
547  }
548 
549  $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
550  $user->setTimeLimitFrom($from
551  ? $from->get(IL_CAL_UNIX)
552  : null);
553 
554  $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
555  $user->setTimeLimitUntil($until
556  ? $until->get(IL_CAL_UNIX)
557  : null);
558 
559  $user->setTimeLimitUnlimited((bool) $this->form_gui->getInput('time_limit_unlimited'));
560 
561  if ($a_mode == 'create') {
562  $user->setTimeLimitOwner($this->usrf_ref_id);
563  }
564  if ($this->isSettingChangeable('birthday')) {
565  $bd = $this->form_gui->getItemByPostVar('birthday');
566  $bd = $bd->getDate();
567  $user->setBirthday($bd
568  ? $bd->get(IL_CAL_DATE)
569  : null);
570  }
571  $user->setLogin($this->form_gui->getInput('login'));
572  if ($this->isSettingChangeable('gender')) {
573  $user->setGender($this->form_gui->getInput('gender'));
574  }
575  if ($this->isSettingChangeable('title')) {
576  $user->setUTitle($this->form_gui->getInput('title'));
577  }
578  if ($this->isSettingChangeable('firstname')) {
579  $user->setFirstname($this->form_gui->getInput('firstname'));
580  }
581  if ($this->isSettingChangeable('lastname')) {
582  $user->setLastname($this->form_gui->getInput('lastname'));
583  }
584  $user->setFullname();
585  if ($this->isSettingChangeable('institution')) {
586  $user->setInstitution($this->form_gui->getInput('institution'));
587  }
588  if ($this->isSettingChangeable('department')) {
589  $user->setDepartment($this->form_gui->getInput('department'));
590  }
591  if ($this->isSettingChangeable('street')) {
592  $user->setStreet($this->form_gui->getInput('street'));
593  }
594  if ($this->isSettingChangeable('city')) {
595  $user->setCity($this->form_gui->getInput('city'));
596  }
597  if ($this->isSettingChangeable('zipcode')) {
598  $user->setZipcode($this->form_gui->getInput('zipcode'));
599  }
600  if ($this->isSettingChangeable('country')) {
601  $user->setCountry($this->form_gui->getInput('country'));
602  }
603  if ($this->isSettingChangeable('sel_country')) {
604  $user->setSelectedCountry($this->form_gui->getInput('sel_country'));
605  }
606  if ($this->isSettingChangeable('phone_office')) {
607  $user->setPhoneOffice($this->form_gui->getInput('phone_office'));
608  }
609  if ($this->isSettingChangeable('phone_home')) {
610  $user->setPhoneHome($this->form_gui->getInput('phone_home'));
611  }
612  if ($this->isSettingChangeable('phone_mobile')) {
613  $user->setPhoneMobile($this->form_gui->getInput('phone_mobile'));
614  }
615  if ($this->isSettingChangeable('fax')) {
616  $user->setFax($this->form_gui->getInput('fax'));
617  }
618  if ($this->isSettingChangeable('matriculation')) {
619  $user->setMatriculation($this->form_gui->getInput('matriculation'));
620  }
621  if ($this->isSettingChangeable('email')) {
622  $user->setEmail($this->form_gui->getInput('email'));
623  }
624  if ($this->isSettingChangeable('second_email')) {
625  $user->setSecondEmail($this->form_gui->getInput('second_email'));
626  }
627  if ($this->isSettingChangeable('hobby')) {
628  $user->setHobby($this->form_gui->getInput('hobby'));
629  }
630  if ($this->isSettingChangeable('referral_comment')) {
631  $user->setComment($this->form_gui->getInput('referral_comment'));
632  }
633 
634  $general_interests = is_array($this->form_gui->getInput('interests_general'))
635  ? $this->form_gui->getInput('interests_general')
636  : [];
637  $user->setGeneralInterests($general_interests);
638 
639  $offering_help = is_array($this->form_gui->getInput('interests_help_offered'))
640  ? $this->form_gui->getInput('interests_help_offered')
641  : [];
642  $user->setOfferingHelp($offering_help);
643 
644  $looking_for_help = is_array($this->form_gui->getInput('interests_help_looking'))
645  ? $this->form_gui->getInput('interests_help_looking')
646  : [];
647  $user->setLookingForHelp($looking_for_help);
648 
649  $user->setClientIP($this->form_gui->getInput('client_ip'));
650  $user->setLatitude($this->form_gui->getInput('latitude'));
651  $user->setLongitude($this->form_gui->getInput('longitude'));
652  $zoom = (int) $this->form_gui->getInput('loc_zoom');
653  if ($zoom == 0) {
654  $zoom = null;
655  }
656  $user->setLocationZoom($zoom);
657 
658  $user->setAuthMode($this->form_gui->getInput('auth_mode'));
659  $user->setExternalAccount($this->form_gui->getInput('ext_account'));
660 
661  if ((int) $user->getActive() != (int) $this->form_gui->getInput('active')) {
662  $user->setActive((bool) $this->form_gui->getInput('active'), $this->user->getId());
663  }
664 
665  return $user;
666  }
setUTitle(string $a_str)
set user title (note: don&#39;t mix up this method with setTitle() that is derived from ilObject and sets...
setTimeLimitUnlimited(bool $a_unlimited)
setClientIP(string $a_str)
setMatriculation(string $a_str)
setPhoneOffice(string $a_str)
setSelectedCountry(string $a_val)
Set selected country (selection drop down)
setFullname()
builds a string with title + firstname + lastname method is used to build fullname in member variable...
const IL_CAL_UNIX
setTimeLimitUntil(?int $a_until)
isSettingChangeable(string $a_field)
setInstitution(string $a_str)
setCity(string $a_str)
setLatitude(?string $a_latitude)
setComment(string $a_str)
setGender(string $a_str)
setExternalAccount(string $a_str)
setBirthday(?string $a_birthday)
setLogin(string $a_str)
setActive(bool $a_active, int $a_owner=0)
set user active state and updates system fields appropriately
setDepartment(string $a_str)
setOfferingHelp(?array $value=null)
setPhoneHome(string $a_str)
setHobby(string $a_str)
setCountry(string $a_str)
setEmail(string $a_str)
setFax(string $a_str)
setPhoneMobile(string $a_str)
setLastname(string $a_str)
setStreet(string $a_str)
const IL_CAL_DATE
setTimeLimitOwner(int $a_owner)
setSecondEmail(?string $second_email)
setLongitude(?string $a_longitude)
setLocationZoom(?int $a_locationzoom)
setZipcode(string $a_str)
setGeneralInterests(?array $value=null)
setTimeLimitFrom(?int $a_from)
setFirstname(string $a_str)
setAuthMode(?string $a_str)
setLookingForHelp(?array $value=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveFileToStorage()

ilObjUserGUI::moveFileToStorage ( )
private

Definition at line 1464 of file class.ilObjUserGUI.php.

References ILIAS\FileUpload\FileUpload\getResults(), and ILIAS\Repository\object().

Referenced by uploadUserPicture().

1465  {
1466  $uploads = $this->uploads->getResults();
1467  $upload_tmp_name = $_FILES['userfile']['tmp_name'];
1468  $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
1469 
1470  $existing_rid = null;
1471  if ($this->object->getAvatarRid() !== null) {
1472  $existing_rid = $this->irss->manage()->find($this->object->getAvatarRid());
1473  }
1474 
1475  $revision_title = 'Avatar for user ' . $this->object->getLogin();
1476  $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
1477 
1478  if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
1479  $stream = Streams::ofResource(
1480  fopen($upload_tmp_name, 'r')
1481  );
1482 
1483  if ($existing_rid === null) {
1484  return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
1485  }
1486 
1487  $this->irss->manage()->appendNewRevisionFromStream(
1488  $existing_rid,
1489  $stream,
1490  $this->stakeholder,
1491  $revision_title
1492  );
1493  return $existing_rid;
1494  }
1495 
1496  if ($avatar_upload_result === null) {
1497  return null;
1498  }
1499 
1500  if ($existing_rid === null) {
1501  return $this->irss->manage()->upload(
1502  $avatar_upload_result,
1503  $this->stakeholder,
1504  $revision_title
1505  );
1506  }
1507 
1508  $this->irss->manage()->replaceWithUpload(
1509  $existing_rid,
1510  $avatar_upload_result,
1511  $this->stakeholder,
1512  $revision_title
1513  );
1514  return $existing_rid;
1515  }
FileUpload $uploads
getResults()
Returns the results of the processing and moving operation of the uploaded files. ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeUserPictureObject()

ilObjUserGUI::removeUserPictureObject ( )

Definition at line 1517 of file class.ilObjUserGUI.php.

References editObject(), ilFileUtils\getWebspaceDir(), and ILIAS\Repository\lng().

1517  : void
1518  {
1519  $webspace_dir = ilFileUtils::getWebspaceDir();
1520  $image_dir = $webspace_dir . '/usr_images';
1521  $file = $image_dir . '/usr_' . $this->object->getId() . '.' . 'jpg';
1522  $thumb_file = $image_dir . '/usr_' . $this->object->getId() . '_small.jpg';
1523  $xthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xsmall.jpg';
1524  $xxthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xxsmall.jpg';
1525  $upload_file = $image_dir . '/upload_' . $this->object->getId();
1526 
1527  // remove user pref file name
1528  $this->object->setPref('profile_image', '');
1529  $this->object->update();
1530  $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_image_removed'));
1531 
1532  if (is_file($file)) {
1533  unlink($file);
1534  }
1535  if (is_file($thumb_file)) {
1536  unlink($thumb_file);
1537  }
1538  if (is_file($xthumb_file)) {
1539  unlink($xthumb_file);
1540  }
1541  if (is_file($xxthumb_file)) {
1542  unlink($xxthumb_file);
1543  }
1544  if (is_file($upload_file)) {
1545  unlink($upload_file);
1546  }
1547 
1548  $this->editObject();
1549  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

Definition at line 1658 of file class.ilObjUserGUI.php.

References roleassignmentObject().

1658  : void
1659  {
1660  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1661  $table_gui->resetOffset();
1662  $table_gui->resetFilter();
1663  $this->roleassignmentObject();
1664  }
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:

◆ roleassignmentObject()

ilObjUserGUI::roleassignmentObject ( )

Definition at line 1621 of file class.ilObjUserGUI.php.

References checkAccessToRolesTab(), ILIAS\Repository\ctrl(), ilSession\get(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilSession\set(), and ILIAS\Repository\tabs().

Referenced by applyFilterObject(), and resetFilterObject().

1621  : void
1622  {
1623  $this->tabs->activateTab('role_assignment');
1624 
1625  if (!$this->checkAccessToRolesTab()) {
1626  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_view_roles_of_user'), true);
1627  $this->ctrl->redirectByClass(self::class, 'edit');
1628  }
1629 
1630  $req_filtered_roles = $this->user_request->getFilteredRoles();
1632  'filtered_roles',
1633  ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1634  );
1635 
1636  $filtered_roles = ilSession::get('filtered_roles');
1637  if ($filtered_roles > 5) {
1638  ilSession::set('filtered_roles', 0);
1639  }
1640 
1641  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
1642 
1643  // init table
1644  $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1645 
1646  $tab->parse($this->object->getId());
1647  $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1648  }
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilObjUserGUI::saveObject ( )

save user data

Definition at line 370 of file class.ilObjUserGUI.php.

References ilAuthUtils\_isExternalAccountEnabled(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), handleIgnoredRequiredFields(), initCreate(), initForm(), ILIAS\Repository\int(), isSettingChangeable(), ILIAS\Repository\lng(), loadUserDefinedDataFromForm(), loadValuesFromForm(), ilObjUser\PASSWD_PLAIN, ILIAS\Repository\settings(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, uploadUserPicture(), and ILIAS\Repository\user().

370  : void
371  {
372  if (!$this->rbac_system->checkAccess('create_usr', $this->usrf_ref_id)
373  && !$this->access->checkAccess('cat_administrate_users', '', $this->usrf_ref_id)) {
374  $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
375  }
376 
377  $this->initCreate();
378  $this->initForm('create');
379 
380  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
381  $profile_maybe_incomplete = false;
382  if ($this->form_gui->getInput('ignore_rf', false)) {
383  $profile_maybe_incomplete = $this->handleIgnoredRequiredFields();
384  }
385 
386  if (!$this->form_gui->checkInput()) {
387  $this->form_gui->setValuesByPost();
388  $this->tpl->setContent($this->form_gui->getHTML());
389  return;
390  }
391 
392  // checks passed. save user
393  $user_object = $this->loadValuesFromForm();
394  if ($this->user->getId() === (int) SYSTEM_USER_ID
395  || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
396  || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
397  $user_object->setPasswd($this->form_gui->getInput('passwd'), ilObjUser::PASSWD_PLAIN);
398  }
399  $user_object->setTitle($user_object->getFullname());
400  $user_object->setDescription($user_object->getEmail());
401 
402  $this->loadUserDefinedDataFromForm($user_object);
403 
404  $user_object->create();
405 
407  $user_object->setExternalAccount($this->form_gui->getInput('ext_account'));
408  }
409 
410  // set a timestamp for last_password_change
411  // this ts is needed by ilSecuritySettings
412  $user_object->setLastPasswordChangeTS(time());
413 
414  //insert user data in table user_data
415  $user_object->saveAsNew();
416 
417  // setup user preferences
418  if ($this->isSettingChangeable('language')) {
419  $user_object->setLanguage($this->form_gui->getInput('language'));
420  }
421 
422  if ($this->isSettingChangeable('skin_style')) {
423  //set user skin and style
424  $sknst = explode(':', $this->form_gui->getInput('skin_style'));
425 
426  if ($user_object->getPref('style') != $sknst[1] ||
427  $user_object->getPref('skin') != $sknst[0]) {
428  $user_object->setPref('skin', $sknst[0]);
429  $user_object->setPref('style', $sknst[1]);
430  }
431  }
432  if ($this->isSettingChangeable('hits_per_page')) {
433  $user_object->setPref('hits_per_page', $this->form_gui->getInput('hits_per_page'));
434  }
435  if ($this->isSettingChangeable('hide_own_online_status')) {
436  $user_object->setPref(
437  'hide_own_online_status',
438  $this->form_gui->getInput('hide_own_online_status')
439  );
440  }
441  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
442  $user_object->setPref(
443  'bs_allow_to_contact_me',
444  $this->form_gui->getInput('bs_allow_to_contact_me') ? 'y' : 'n'
445  );
446  }
447  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
448  $user_object->setPref(
449  'chat_osc_accept_msg',
450  $this->form_gui->getInput('chat_osc_accept_msg') ? 'y' : 'n'
451  );
452  }
453  if ($this->isSettingChangeable('chat_broadcast_typing')) {
454  $user_object->setPref(
455  'chat_broadcast_typing',
456  $this->form_gui->getInput('chat_broadcast_typing') ? 'y' : 'n'
457  );
458  }
459  if ($this->settings->get('session_reminder_enabled') === '1') {
460  $user_object->setPref(
461  'session_reminder_enabled',
462  $this->form_gui->getInput('session_reminder_enabled')
463  );
464  }
465  $user_object->writePrefs();
466 
467  //set role entries
468  $this->rbac_admin->assignUser(
469  (int) $this->form_gui->getInput('default_role'),
470  $user_object->getId(),
471  true
472  );
473 
474  $msg = $this->lng->txt('user_added');
475 
476  $this->user->setPref(
477  'send_info_mails',
478  ($this->form_gui->getInput('send_mail') == 'y') ? 'y' : 'n'
479  );
480  $this->user->writePrefs();
481 
482  $this->object = $user_object;
483 
484  if ($this->isSettingChangeable('upload')) {
485  $this->uploadUserPicture();
486  }
487 
488  if ($profile_maybe_incomplete
489  && $this->user_profile->isProfileIncomplete($this->object)) {
490  $this->object->setProfileIncomplete(true);
491  $this->object->update();
492  }
493 
494  // send new account mail
495  if ($this->form_gui->getInput('send_mail') == 'y') {
496  $acc_mail = new ilAccountMail();
497  $acc_mail->useLangVariablesAsFallback(true);
498  $acc_mail->setAttachConfiguredFiles(true);
499  $acc_mail->setUserPassword($this->form_gui->getInput('passwd'));
500  $acc_mail->setUser($user_object);
501 
502  if ($acc_mail->send()) {
503  $msg .= '<br />' . $this->lng->txt('mail_sent');
504  $this->tpl->setOnScreenMessage('success', $msg, true);
505  } else {
506  $msg .= '<br />' . $this->lng->txt('mail_not_sent');
507  $this->tpl->setOnScreenMessage('info', $msg, true);
508  }
509  } else {
510  $this->tpl->setOnScreenMessage('success', $msg, true);
511  }
512 
513  if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
514  $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
515  return;
516  }
517 
518  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
519  }
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
const SYSTEM_ROLE_ID
Definition: constants.php:29
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
Definition: constants.php:26
const PASSWD_PLAIN
loadUserDefinedDataFromForm(?ilObjUser $user=null)
initForm(string $a_mode)
Init user form.
isSettingChangeable(string $a_field)
uploadUserPicture()
upload user image (original method by ratana ty)
loadValuesFromForm(string $a_mode='create')
header include for all ilias files.
static _isExternalAccountEnabled()
Check if an external account name is required.
Class ilAccountMail.
+ Here is the call graph for this function:

◆ setBackTarget()

ilObjUserGUI::setBackTarget ( string  $a_text,
string  $a_link 
)

set back tab target

Definition at line 229 of file class.ilObjUserGUI.php.

232  : void {
233  $this->back_target = ['text' => $a_text, 'link' => $a_link];
234  }

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )
protected

Definition at line 138 of file class.ilObjUserGUI.php.

References ilUtil\getImagePath(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

138  : void
139  {
140  if (strtolower(get_class($this->object)) == 'ilobjuser') {
141  $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
142  $this->tpl->setDescription($this->object->getLongDescription());
143  $this->tpl->setTitleIcon(
144  ilUtil::getImagePath('standard/icon_' . $this->object->getType() . '.svg'),
145  $this->lng->txt('obj_' . $this->object->getType())
146  );
147  } else {
148  parent::setTitleAndDescription();
149  }
150  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ uploadUserPicture()

ilObjUserGUI::uploadUserPicture ( )
protected

upload user image (original method by ratana ty)

Definition at line 1434 of file class.ilObjUserGUI.php.

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1434  : void
1435  {
1436 
1437  $userfile_input = $this->form_gui->getItemByPostVar('userfile');
1438 
1439  if ($_FILES['userfile']['tmp_name'] == '') {
1440  if ($userfile_input->getDeletionFlag()) {
1441  $this->object->removeUserPicture();
1442  }
1443  return;
1444  }
1445  if ($_FILES['userfile']['size'] == 0) {
1446  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_file'));
1447  } else {
1448  $store_file = 'usr_' . $this->object->getId() . '.' . 'jpg';
1449 
1450  $rid = $this->moveFileToStorage();
1451 
1452  if ($rid === null) {
1453  return;
1454  }
1455 
1456  $this->object->setAvatarRid($rid->serialize());
1457  $this->irss->flavours()->ensure($rid, new ilUserProfilePictureDefinition());
1458 
1459  $this->object->setPref('profile_image', $store_file); // this may be dropped with the next release
1460  $this->object->update();
1461  }
1462  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $back_target

array ilObjUserGUI::$back_target
private

Definition at line 55 of file class.ilObjUserGUI.php.

◆ $default_layout_and_style

string ilObjUserGUI::$default_layout_and_style
private

Definition at line 59 of file class.ilObjUserGUI.php.

◆ $default_role

int ilObjUserGUI::$default_role
private

Definition at line 58 of file class.ilObjUserGUI.php.

◆ $form_gui

ilPropertyFormGUI ilObjUserGUI::$form_gui
private

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

◆ $help

ilHelpGUI ilObjUserGUI::$help
private

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

◆ $irss

ResourceStorageServices ilObjUserGUI::$irss
private

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

◆ $legal_documents

Conductor ilObjUserGUI::$legal_documents
private

Definition at line 63 of file class.ilObjUserGUI.php.

◆ $mail_sender_factory

ilMailMimeSenderFactory ilObjUserGUI::$mail_sender_factory
private

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

◆ $requested_baseClass

string ilObjUserGUI::$requested_baseClass = ''
private

Definition at line 50 of file class.ilObjUserGUI.php.

◆ $requested_letter

string ilObjUserGUI::$requested_letter = ''
private

Definition at line 49 of file class.ilObjUserGUI.php.

◆ $requested_search

string ilObjUserGUI::$requested_search = ''
private

Definition at line 51 of file class.ilObjUserGUI.php.

◆ $selectable_roles

array ilObjUserGUI::$selectable_roles
private

Definition at line 57 of file class.ilObjUserGUI.php.

◆ $stakeholder

ResourceStakeholder ilObjUserGUI::$stakeholder
private

Definition at line 45 of file class.ilObjUserGUI.php.

◆ $tabs

ilTabsGUI ilObjUserGUI::$tabs
private

Definition at line 40 of file class.ilObjUserGUI.php.

◆ $update

bool ilObjUserGUI::$update
private

Definition at line 56 of file class.ilObjUserGUI.php.

◆ $uploads

FileUpload ilObjUserGUI::$uploads
private

Definition at line 43 of file class.ilObjUserGUI.php.

◆ $user_defined_fields

ilUserDefinedFields ilObjUserGUI::$user_defined_fields
private

Definition at line 60 of file class.ilObjUserGUI.php.

◆ $user_profile

ilUserProfile ilObjUserGUI::$user_profile
private

Definition at line 47 of file class.ilObjUserGUI.php.

◆ $user_request

UserGUIRequest ilObjUserGUI::$user_request
private

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

◆ $usrf_ref_id

int ilObjUserGUI::$usrf_ref_id
private

Definition at line 62 of file class.ilObjUserGUI.php.


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