ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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
 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)
 
 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...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 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...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 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...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Private Member Functions

 moveFileToStorage ()
 
 checkUserWriteRight ()
 
 renderForm ()
 
 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 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
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 
- 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
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
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 1716 of file class.ilObjUserGUI.php.

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

1716  : string
1717  {
1718  $action[0] = $this->lng->txt('assigned_roles');
1719  $action[1] = $this->lng->txt('all_roles');
1720  $action[2] = $this->lng->txt('all_global_roles');
1721  $action[3] = $this->lng->txt('all_local_roles');
1722  $action[4] = $this->lng->txt('internal_local_roles_only');
1723  $action[5] = $this->lng->txt('non_internal_local_roles_only');
1724 
1726  ilSession::get('filtered_roles'),
1727  'filter',
1728  $action,
1729  false,
1730  true
1731  );
1732  }
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 237 of file class.ilObjUserGUI.php.

References ilUserDefinedFields\_getInstance().

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

◆ __getDateSelect()

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

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

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

1657  : string {
1658  $year = null;
1659  switch ($a_type) {
1660  case 'minute':
1661  for ($i = 0; $i <= 60; $i++) {
1662  $days[$i] = $i < 10 ? '0' . $i : $i;
1663  }
1664  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1665 
1666  case 'hour':
1667  for ($i = 0; $i < 24; $i++) {
1668  $days[$i] = $i < 10 ? '0' . $i : $i;
1669  }
1670  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1671 
1672  case 'day':
1673  for ($i = 1; $i < 32; $i++) {
1674  $days[$i] = $i < 10 ? '0' . $i : $i;
1675  }
1676  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1677 
1678  case 'month':
1679  for ($i = 1; $i < 13; $i++) {
1680  $month[$i] = $i < 10 ? '0' . $i : $i;
1681  }
1682  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1683 
1684  case 'year':
1685  if ($a_selected < date('Y')) {
1686  $start = $a_selected;
1687  } else {
1688  $start = date('Y');
1689  }
1690 
1691  for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1692  $year[$i] = $i;
1693  }
1694  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1695  }
1696  return '';
1697  }
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 1779 of file class.ilObjUserGUI.php.

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

Referenced by loadUserDefinedDataFromForm().

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

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

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

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

250  : void
251  {
252  $user_defined_data = null;
253  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
254 
255  if ($this->object->getType() == 'usr') {
256  $user_defined_data = $this->object->getUserDefinedData();
257  }
258  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
259  $error_post_vars = ilSession::get('error_post_vars');
260  $old = $error_post_vars['udf'][$field_id] ?? $user_defined_data[$field_id];
261 
262  if ($definition['field_type'] == UDF_TYPE_TEXT) {
263  $this->tpl->setCurrentBlock('field_text');
264  $this->tpl->setVariable('FIELD_NAME', 'udf[' . $definition['field_id'] . ']');
265  $this->tpl->setVariable('FIELD_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($old));
266  } else {
267  $this->tpl->setCurrentBlock('field_select');
268  $this->tpl->setVariable(
269  'SELECT_BOX',
271  $old,
272  'udf[' . $definition['field_id'] . ']',
273  $this->user_defined_fields->fieldValuesToSelectArray(
274  $definition['field_values']
275  ),
276  false,
277  true
278  )
279  );
280  }
281  $this->tpl->parseCurrentBlock();
282  $this->tpl->setCurrentBlock('user_defined');
283 
284  if ($definition['required']) {
285  $name = $definition['field_name'] . '<span class="asterisk">*</span>';
286  } else {
287  $name = $definition['field_name'];
288  }
289  $this->tpl->setVariable('TXT_FIELD_NAME', $name);
290  $this->tpl->parseCurrentBlock();
291  }
292  }
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 1699 of file class.ilObjUserGUI.php.

1699  : int // Missing array type.
1700  {
1701  return mktime(
1702  $a_time_arr['hour'],
1703  $a_time_arr['minute'],
1704  $a_time_arr['second'],
1705  $a_time_arr['month'],
1706  $a_time_arr['day'],
1707  $a_time_arr['year']
1708  );
1709  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References ilSession\clear().

1711  : void
1712  {
1713  ilSession::clear('filtered_roles');
1714  }
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 1738 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.

1738  : void
1739  {
1740  $this->locator->clearItems();
1741 
1742  if ($this->admin_mode == 'settings') { // system settings
1743  $this->ctrl->setParameterByClass(
1744  'ilobjsystemfoldergui',
1745  'ref_id',
1747  );
1748  $this->locator->addItem(
1749  $this->lng->txt('administration'),
1750  $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1751  ilFrameTargetInfo::_getFrame('MainContent')
1752  );
1753 
1754  if ($this->requested_ref_id == USER_FOLDER_ID) {
1755  $this->locator->addItem(
1756  $this->lng->txt('obj_' . ilObject::_lookupType(
1757  ilObject::_lookupObjId($this->requested_ref_id)
1758  )),
1759  $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1760  );
1761  } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1762  $this->locator->addItem(
1763  $this->lng->txt('obj_' . ilObject::_lookupType(
1764  ilObject::_lookupObjId($this->requested_ref_id)
1765  )),
1766  $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1767  );
1768  }
1769 
1770  if ($this->obj_id > 0) {
1771  $this->locator->addItem(
1772  $this->object->getTitle(),
1773  $this->ctrl->getLinkTarget($this, 'view')
1774  );
1775  }
1776  }
1777  }
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 1637 of file class.ilObjUserGUI.php.

References roleassignmentObject().

1637  : void
1638  {
1639  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1640  $table_gui->writeFilterToSession();
1641  $table_gui->resetOffset();
1642  $this->roleassignmentObject();
1643  }
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 1538 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.

1538  : void
1539  {
1540  if (!$this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)) {
1541  $this->ilias->raiseError(
1542  $this->lng->txt('msg_no_perm_assign_role_to_user'),
1543  $this->ilias->error_obj->MESSAGE
1544  );
1545  }
1546 
1547  $selected_roles = $this->user_request->getRoleIds();
1548  $posted_roles = $this->user_request->getPostedRoleIds();
1549 
1550  // prevent unassignment of system role from system user
1551  if ($this->object->getId() == SYSTEM_USER_ID && in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1552  $selected_roles[] = SYSTEM_ROLE_ID;
1553  }
1554 
1555  $global_roles_all = $this->rbac_review->getGlobalRoles();
1556  $assigned_roles_all = $this->rbac_review->assignedRoles($this->object->getId());
1557  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1558  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1559  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1560 
1561  $user_not_allowed_to_change_admin_role_assginements =
1562  !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
1563 
1564  if ($user_not_allowed_to_change_admin_role_assginements
1565  && in_array(SYSTEM_ROLE_ID, $assigned_roles_all)) {
1566  $selected_roles[] = SYSTEM_ROLE_ID;
1567  }
1568 
1569  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1570 
1571  if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
1572  || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
1573  $this->tpl->setOnScreenMessage(
1574  'failure',
1575  $this->lng->txt('msg_min_one_role') . '<br/>' . $this->lng->txt('action_aborted'),
1576  true
1577  );
1578  $this->ctrl->redirect($this, 'roleassignment');
1579  }
1580 
1581  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1582  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1583  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1584  continue;
1585  }
1586  $this->rbac_admin->deassignUser($role, $this->object->getId());
1587  }
1588 
1589  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1590  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1591  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1592  continue;
1593  }
1594  $this->rbac_admin->assignUser($role, $this->object->getId(), false);
1595  }
1596 
1597  $this->object->update();
1598 
1599  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_roleassignment_changed'), true);
1600 
1601  if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
1602  $this->ctrl->redirect($this, 'roleassignment');
1603  } else {
1604  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1605  }
1606  }
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
Class ilObjForumAdministration.
+ Here is the call graph for this function:

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

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

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

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

◆ checkAccessToRolesTab()

ilObjUserGUI::checkAccessToRolesTab ( )
private

Definition at line 1977 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().

1977  : bool
1978  {
1979  return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1980  && (
1981  $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1982  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1983  && in_array(
1984  $this->object->getId(),
1985  $this->access->filterUserIdsByPositionOfCurrentUser(
1988  [$this->object->getId()]
1989  )
1990  )
1991  );
1992  }
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 1941 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().

1941  : void
1942  {
1943  if ($this->usrf_ref_id === USER_FOLDER_ID
1944  && (
1945  !$this->rbac_system->checkAccess('visible,read', $this->usrf_ref_id)
1946  || !$this->rbac_system->checkAccess('write', $this->usrf_ref_id)
1947  && (
1948  !$this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1949  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1950  && !in_array(
1951  $this->object->getId(),
1952  $this->access->filterUserIdsByPositionOfCurrentUser(
1955  [$this->object->getId()]
1956  )
1957  )
1958  )
1959  )
1960  ) {
1961  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1962  }
1963 
1964  // if called from local administration $this->usrf_ref_id is category id
1965  // Todo: this has to be fixed. Do not mix user folder id and category id
1966  if ($this->usrf_ref_id != USER_FOLDER_ID
1967  && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1968  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1969  }
1970  }
const USER_FOLDER_ID
Definition: constants.php:33
Class ilObjForumAdministration.
+ 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 356 of file class.ilObjUserGUI.php.

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

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

◆ editObject()

ilObjUserGUI::editObject ( )

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

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

Referenced by removeUserPictureObject().

516  : void
517  {
518  $this->checkUserWriteRight();
519 
520  if ($this->usrf_ref_id != USER_FOLDER_ID) {
521  $this->tabs_gui->clearTargets();
522  }
523 
524  // get form
525  $this->initForm('edit');
526  $this->getValues();
527  $this->renderForm();
528  }
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 107 of file class.ilObjUserGUI.php.

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

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

References getTabs().

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

◆ getTabs()

ilObjUserGUI::getTabs ( )
protected

Definition at line 169 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().

169  : void
170  {
171  $this->tabs_gui->clearTargets();
172 
173  $this->help->setScreenIdComponent('usr');
174 
175  if ($this->requested_search) {
176  $this->tabs_gui->setBackTarget(
177  $this->lng->txt('search_results'),
178  ilSession::get('usr_search_link')
179  );
180 
181  $this->tabs_gui->addTarget(
182  'properties',
183  $this->ctrl->getLinkTarget($this, 'edit'),
184  ['edit', '', 'view'],
185  get_class($this),
186  '',
187  true
188  );
189  } else {
190  $this->tabs_gui->addTarget(
191  'properties',
192  $this->ctrl->getLinkTarget($this, 'edit'),
193  ['edit', '', 'view'],
194  get_class($this)
195  );
196  }
197 
198  if ($this->checkAccessToRolesTab()) {
199  $this->tabs_gui->addTarget(
200  'role_assignment',
201  $this->ctrl->getLinkTarget($this, 'roleassignment'),
202  ['roleassignment'],
203  get_class($this)
204  );
205  }
206 
207  // learning progress
208  if ($this->rbac_system->checkAccess('read', $this->ref_id) and
210  ilObjUserTracking::_enabledUserRelatedData()) {
211  $this->tabs_gui->addTarget(
212  'learning_progress',
213  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
214  '',
215  ['illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui']
216  );
217  }
218 
219  $this->tabs_gui->addTarget(
220  'user_ownership',
221  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
222  '',
223  'ilobjectownershipmanagementgui'
224  );
225  }
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 826 of file class.ilObjUserGUI.php.

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

Referenced by editObject().

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

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1903  : bool
1904  {
1905  $profile_maybe_incomplete = false;
1906 
1907  foreach ($this->user_profile->getIgnorableRequiredSettings() as $fieldName) {
1908  $elm = $this->form_gui->getItemByPostVar($fieldName);
1909 
1910  if (!$elm) {
1911  continue;
1912  }
1913 
1914  if ($elm->getRequired()) {
1915  $profile_maybe_incomplete = true;
1916 
1917  // Flag as optional
1918  $elm->setRequired(false);
1919  }
1920  }
1921 
1923  foreach ($user_defined_fields->getDefinitions() as $definition) {
1924  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
1925 
1926  if (!$elm) {
1927  continue;
1928  }
1929 
1930  if ($elm->getRequired() && $definition['required']) {
1931  $profile_maybe_incomplete = true;
1932 
1933  // Flag as optional
1934  $elm->setRequired(false);
1935  }
1936  }
1937 
1938  return $profile_maybe_incomplete;
1939  }
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 294 of file class.ilObjUserGUI.php.

References 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().

294  : void
295  {
296  if ($this->usrf_ref_id != USER_FOLDER_ID) {
297  $this->tabs_gui->clearTargets();
298  }
299 
300  // role selection
301  $obj_list = $this->rbac_review->getRoleListByObject(ROLE_FOLDER_ID);
302  $rol = [];
303  foreach ($obj_list as $obj_data) {
304  // allow only 'assign_users' marked roles if called from category
305  if ($this->object->getRefId() != USER_FOLDER_ID && !in_array(
307  $this->rbac_review->assignedRoles($this->user->getId())
308  )) {
309  if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
310  continue;
311  }
312  }
313  // exclude anonymous role from list
314  if ($obj_data['obj_id'] != ANONYMOUS_ROLE_ID) {
315  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
316  if ($obj_data['obj_id'] != SYSTEM_ROLE_ID || in_array(
318  $this->rbac_review->assignedRoles($this->user->getId())
319  )) {
320  $rol[$obj_data['obj_id']] = $obj_data['title'];
321  }
322  }
323  }
324 
325  if (!count($rol)) {
326  $this->ilias->raiseError(
327  $this->lng->txt('msg_no_roles_users_can_be_assigned_to'),
328  $this->ilias->error_obj->MESSAGE
329  );
330  }
331 
332  $keys = array_keys($rol);
333 
334  // set pre defined user role to default
335  if (in_array(4, $keys)) {
336  $this->default_role = 4;
337  } else {
338  if (count($keys) > 1 && in_array(2, $keys)) {
339  // remove admin role as preselectable role
340  foreach ($keys as $key => $val) {
341  if ($val == 2) {
342  unset($keys[$key]);
343  break;
344  }
345  }
346  }
347 
348  $this->default_role = array_shift($keys);
349  }
350  $this->selectable_roles = $rol;
351  }
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_ROLE_ID
Definition: constants.php:29
Class ilObjForumAdministration.
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 910 of file class.ilObjUserGUI.php.

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

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

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

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

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

1405  : bool
1406  {
1407  static $settings = null;
1408 
1409  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1410  return true;
1411  }
1412 
1413  if ($settings == null) {
1414  $settings = $this->settings->getAll();
1415  }
1416  return (bool) ($settings['usr_settings_changeable_lua_' . $a_field] ?? false);
1417  }
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 663 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, renderForm(), ilObjUser\setUserDefinedData(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, ilObject\update(), ilObjectGUI\updateObject(), uploadUserPicture(), ILIAS\Repository\user(), and USER_FOLDER_ID.

Referenced by saveObject().

663  : void
664  {
665  if (!$user) {
667  }
668 
670  if ($this->usrf_ref_id == USER_FOLDER_ID) {
671  $all_defs = $user_defined_fields->getDefinitions();
672  } else {
674  }
675  $udf = [];
676  foreach ($all_defs as $definition) {
677  $f = "udf_" . $definition['field_id'];
678  $item = $this->form_gui->getItemByPostVar($f);
679  if ($item && !$item->getDisabled()) {
680  $udf[$definition['field_id']] = $this->form_gui->getInput($f);
681  }
682  }
683  $user->setUserDefinedData($udf);
684  }
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 530 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().

530  : ilObjUser
531  {
532  $user = null;
533 
534  switch ($a_mode) {
535  case 'create':
536  $user = new ilObjUser();
537  break;
538 
539  case 'update':
541  break;
542  }
543 
544  $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
545  $user->setTimeLimitFrom($from
546  ? $from->get(IL_CAL_UNIX)
547  : null);
548 
549  $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
550  $user->setTimeLimitUntil($until
551  ? $until->get(IL_CAL_UNIX)
552  : null);
553 
554  $user->setTimeLimitUnlimited((bool) $this->form_gui->getInput('time_limit_unlimited'));
555 
556  if ($a_mode == 'create') {
557  $user->setTimeLimitOwner($this->usrf_ref_id);
558  }
559  if ($this->isSettingChangeable('birthday')) {
560  $bd = $this->form_gui->getItemByPostVar('birthday');
561  $bd = $bd->getDate();
562  $user->setBirthday($bd
563  ? $bd->get(IL_CAL_DATE)
564  : null);
565  }
566  $user->setLogin($this->form_gui->getInput('login'));
567  if ($this->isSettingChangeable('gender')) {
568  $user->setGender($this->form_gui->getInput('gender'));
569  }
570  if ($this->isSettingChangeable('title')) {
571  $user->setUTitle($this->form_gui->getInput('title'));
572  }
573  if ($this->isSettingChangeable('firstname')) {
574  $user->setFirstname($this->form_gui->getInput('firstname'));
575  }
576  if ($this->isSettingChangeable('lastname')) {
577  $user->setLastname($this->form_gui->getInput('lastname'));
578  }
579  $user->setFullname();
580  if ($this->isSettingChangeable('institution')) {
581  $user->setInstitution($this->form_gui->getInput('institution'));
582  }
583  if ($this->isSettingChangeable('department')) {
584  $user->setDepartment($this->form_gui->getInput('department'));
585  }
586  if ($this->isSettingChangeable('street')) {
587  $user->setStreet($this->form_gui->getInput('street'));
588  }
589  if ($this->isSettingChangeable('city')) {
590  $user->setCity($this->form_gui->getInput('city'));
591  }
592  if ($this->isSettingChangeable('zipcode')) {
593  $user->setZipcode($this->form_gui->getInput('zipcode'));
594  }
595  if ($this->isSettingChangeable('country')) {
596  $user->setCountry($this->form_gui->getInput('country'));
597  }
598  if ($this->isSettingChangeable('sel_country')) {
599  $user->setSelectedCountry($this->form_gui->getInput('sel_country'));
600  }
601  if ($this->isSettingChangeable('phone_office')) {
602  $user->setPhoneOffice($this->form_gui->getInput('phone_office'));
603  }
604  if ($this->isSettingChangeable('phone_home')) {
605  $user->setPhoneHome($this->form_gui->getInput('phone_home'));
606  }
607  if ($this->isSettingChangeable('phone_mobile')) {
608  $user->setPhoneMobile($this->form_gui->getInput('phone_mobile'));
609  }
610  if ($this->isSettingChangeable('fax')) {
611  $user->setFax($this->form_gui->getInput('fax'));
612  }
613  if ($this->isSettingChangeable('matriculation')) {
614  $user->setMatriculation($this->form_gui->getInput('matriculation'));
615  }
616  if ($this->isSettingChangeable('email')) {
617  $user->setEmail($this->form_gui->getInput('email'));
618  }
619  if ($this->isSettingChangeable('second_email')) {
620  $user->setSecondEmail($this->form_gui->getInput('second_email'));
621  }
622  if ($this->isSettingChangeable('hobby')) {
623  $user->setHobby($this->form_gui->getInput('hobby'));
624  }
625  if ($this->isSettingChangeable('referral_comment')) {
626  $user->setComment($this->form_gui->getInput('referral_comment'));
627  }
628 
629  $general_interests = is_array($this->form_gui->getInput('interests_general'))
630  ? $this->form_gui->getInput('interests_general')
631  : [];
632  $user->setGeneralInterests($general_interests);
633 
634  $offering_help = is_array($this->form_gui->getInput('interests_help_offered'))
635  ? $this->form_gui->getInput('interests_help_offered')
636  : [];
637  $user->setOfferingHelp($offering_help);
638 
639  $looking_for_help = is_array($this->form_gui->getInput('interests_help_looking'))
640  ? $this->form_gui->getInput('interests_help_looking')
641  : [];
642  $user->setLookingForHelp($looking_for_help);
643 
644  $user->setClientIP($this->form_gui->getInput('client_ip'));
645  $user->setLatitude($this->form_gui->getInput('latitude'));
646  $user->setLongitude($this->form_gui->getInput('longitude'));
647  $zoom = (int) $this->form_gui->getInput('loc_zoom');
648  if ($zoom == 0) {
649  $zoom = null;
650  }
651  $user->setLocationZoom($zoom);
652 
653  $user->setAuthMode($this->form_gui->getInput('auth_mode'));
654  $user->setExternalAccount($this->form_gui->getInput('ext_account'));
655 
656  if ((int) $user->getActive() != (int) $this->form_gui->getInput('active')) {
657  $user->setActive((bool) $this->form_gui->getInput('active'), $this->user->getId());
658  }
659 
660  return $user;
661  }
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 1451 of file class.ilObjUserGUI.php.

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

Referenced by uploadUserPicture().

1452  {
1453  $uploads = $this->uploads->getResults();
1454  $upload_tmp_name = $_FILES['userfile']['tmp_name'];
1455  $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
1456 
1457  $existing_rid = null;
1458  if ($this->object->getAvatarRid() !== null) {
1459  $existing_rid = $this->irss->manage()->find($this->object->getAvatarRid());
1460  }
1461 
1462  $revision_title = 'Avatar for user ' . $this->object->getLogin();
1463  $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
1464 
1465  if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
1466  $stream = Streams::ofResource(
1467  fopen($upload_tmp_name, 'r')
1468  );
1469 
1470  if ($existing_rid === null) {
1471  return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
1472  }
1473 
1474  $this->irss->manage()->appendNewRevisionFromStream(
1475  $existing_rid,
1476  $stream,
1477  $this->stakeholder,
1478  $revision_title
1479  );
1480  return $existing_rid;
1481  }
1482 
1483  if ($avatar_upload_result === null) {
1484  return null;
1485  }
1486 
1487  if ($existing_rid === null) {
1488  return $this->irss->manage()->upload(
1489  $avatar_upload_result,
1490  $this->stakeholder,
1491  $revision_title
1492  );
1493  }
1494 
1495  $this->irss->manage()->replaceWithUpload(
1496  $existing_rid,
1497  $avatar_upload_result,
1498  $this->stakeholder,
1499  $revision_title
1500  );
1501  return $existing_rid;
1502  }
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 1504 of file class.ilObjUserGUI.php.

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

1504  : void
1505  {
1506  $webspace_dir = ilFileUtils::getWebspaceDir();
1507  $image_dir = $webspace_dir . '/usr_images';
1508  $file = $image_dir . '/usr_' . $this->object->getId() . '.' . 'jpg';
1509  $thumb_file = $image_dir . '/usr_' . $this->object->getId() . '_small.jpg';
1510  $xthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xsmall.jpg';
1511  $xxthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xxsmall.jpg';
1512  $upload_file = $image_dir . '/upload_' . $this->object->getId();
1513 
1514  // remove user pref file name
1515  $this->object->setPref('profile_image', '');
1516  $this->object->update();
1517  $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_image_removed'));
1518 
1519  if (is_file($file)) {
1520  unlink($file);
1521  }
1522  if (is_file($thumb_file)) {
1523  unlink($thumb_file);
1524  }
1525  if (is_file($xthumb_file)) {
1526  unlink($xthumb_file);
1527  }
1528  if (is_file($xxthumb_file)) {
1529  unlink($xxthumb_file);
1530  }
1531  if (is_file($upload_file)) {
1532  unlink($upload_file);
1533  }
1534 
1535  $this->editObject();
1536  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ renderForm()

ilObjUserGUI::renderForm ( )
private

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

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

1972  : void
1973  {
1974  $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1975  }
+ Here is the caller graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

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

References roleassignmentObject().

1645  : void
1646  {
1647  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1648  $table_gui->resetOffset();
1649  $table_gui->resetFilter();
1650  $this->roleassignmentObject();
1651  }
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 1608 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().

1608  : void
1609  {
1610  $this->tabs->activateTab('role_assignment');
1611 
1612  if (!$this->checkAccessToRolesTab()) {
1613  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_view_roles_of_user'), true);
1614  $this->ctrl->redirectByClass(self::class, 'edit');
1615  }
1616 
1617  $req_filtered_roles = $this->user_request->getFilteredRoles();
1619  'filtered_roles',
1620  ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1621  );
1622 
1623  $filtered_roles = ilSession::get('filtered_roles');
1624  if ($filtered_roles > 5) {
1625  ilSession::set('filtered_roles', 0);
1626  }
1627 
1628  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1629 
1630  // init table
1631  $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1632 
1633  $tab->parse($this->object->getId());
1634  $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1635  }
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 371 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, renderForm(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, uploadUserPicture(), and ILIAS\Repository\user().

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

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

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )
protected

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

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

139  : void
140  {
141  if (strtolower(get_class($this->object)) == 'ilobjuser') {
142  $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
143  $this->tpl->setDescription($this->object->getLongDescription());
144  $this->tpl->setTitleIcon(
145  ilUtil::getImagePath('standard/icon_' . $this->object->getType() . '.svg'),
146  $this->lng->txt('obj_' . $this->object->getType())
147  );
148  } else {
149  parent::setTitleAndDescription();
150  }
151  }
static getImagePath(string $image_name, 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 1423 of file class.ilObjUserGUI.php.

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1423  : void
1424  {
1425  $userfile_input = $this->form_gui->getItemByPostVar('userfile');
1426  if ($_FILES['userfile']['tmp_name'] == '') {
1427  if ($userfile_input->getDeletionFlag()) {
1428  $this->object->removeUserPicture();
1429  }
1430  return;
1431  }
1432  if ($_FILES['userfile']['size'] == 0) {
1433  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_file'));
1434  } else {
1435  $store_file = 'usr_' . $this->object->getId() . '.' . 'jpg';
1436 
1437  $rid = $this->moveFileToStorage();
1438 
1439  if ($rid === null) {
1440  return;
1441  }
1442 
1443  $this->object->setAvatarRid($rid->serialize());
1444  $this->irss->flavours()->ensure($rid, new ilUserProfilePictureDefinition());
1445 
1446  $this->object->setPref('profile_image', $store_file); // this may be dropped with the next release
1447  $this->object->update();
1448  }
1449  }
+ 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 56 of file class.ilObjUserGUI.php.

◆ $default_layout_and_style

string ilObjUserGUI::$default_layout_and_style
private

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

◆ $default_role

int ilObjUserGUI::$default_role
private

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

◆ $form_gui

ilPropertyFormGUI ilObjUserGUI::$form_gui
private

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

◆ $help

ilHelpGUI ilObjUserGUI::$help
private

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

◆ $irss

ResourceStorageServices ilObjUserGUI::$irss
private

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

◆ $legal_documents

Conductor ilObjUserGUI::$legal_documents
private

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

◆ $mail_sender_factory

ilMailMimeSenderFactory ilObjUserGUI::$mail_sender_factory
private

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

◆ $requested_baseClass

string ilObjUserGUI::$requested_baseClass = ''
private

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

◆ $requested_letter

string ilObjUserGUI::$requested_letter = ''
private

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

◆ $requested_search

string ilObjUserGUI::$requested_search = ''
private

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

◆ $selectable_roles

array ilObjUserGUI::$selectable_roles
private

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

◆ $stakeholder

ResourceStakeholder ilObjUserGUI::$stakeholder
private

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

◆ $tabs

ilTabsGUI ilObjUserGUI::$tabs
private

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

◆ $update

bool ilObjUserGUI::$update
private

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

◆ $uploads

FileUpload ilObjUserGUI::$uploads
private

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

◆ $user_defined_fields

ilUserDefinedFields ilObjUserGUI::$user_defined_fields
private

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

◆ $user_profile

ilUserProfile ilObjUserGUI::$user_profile
private

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

◆ $user_request

UserGUIRequest ilObjUserGUI::$user_request
private

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

◆ $usrf_ref_id

int ilObjUserGUI::$usrf_ref_id
private

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


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