ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 

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 1720 of file class.ilObjUserGUI.php.

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

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

References ilUserDefinedFields\_getInstance().

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

◆ __getDateSelect()

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

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

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

1661  : string {
1662  $year = null;
1663  switch ($a_type) {
1664  case 'minute':
1665  for ($i = 0; $i <= 60; $i++) {
1666  $days[$i] = $i < 10 ? '0' . $i : $i;
1667  }
1668  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1669 
1670  case 'hour':
1671  for ($i = 0; $i < 24; $i++) {
1672  $days[$i] = $i < 10 ? '0' . $i : $i;
1673  }
1674  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1675 
1676  case 'day':
1677  for ($i = 1; $i < 32; $i++) {
1678  $days[$i] = $i < 10 ? '0' . $i : $i;
1679  }
1680  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1681 
1682  case 'month':
1683  for ($i = 1; $i < 13; $i++) {
1684  $month[$i] = $i < 10 ? '0' . $i : $i;
1685  }
1686  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1687 
1688  case 'year':
1689  if ($a_selected < date('Y')) {
1690  $start = $a_selected;
1691  } else {
1692  $start = date('Y');
1693  }
1694 
1695  for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1696  $year[$i] = $i;
1697  }
1698  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1699  }
1700  return '';
1701  }
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

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

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

Referenced by loadUserDefinedDataFromForm().

1783  : string
1784  {
1785  if ($this->user_request->getSendMail() != 'y') {
1786  return '';
1787  }
1788  if (!strlen($this->object->getEmail())) {
1789  return '';
1790  }
1791 
1792  $usr_lang = new ilLanguage($this->object->getLanguage());
1793  $usr_lang->loadLanguageModule('crs');
1794  $usr_lang->loadLanguageModule('registration');
1795 
1796  $mmail = new ilMimeMail();
1797  $mmail->From($this->mail_sender_factory->system());
1798 
1799  $mailOptions = new ilMailOptions($this->object->getId());
1800  $mmail->To($mailOptions->getExternalEmailAddresses());
1801 
1802  $subject = $usr_lang->txt('profile_changed');
1803  $body = $usr_lang->txt('reg_mail_body_salutation')
1804  . ' ' . $this->object->getFullname() . ",\n\n";
1805 
1806  $date = $this->object->getApproveDate();
1807 
1808  if ($date !== null && (time() - strtotime($date)) < 10) {
1809  $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
1810  } else {
1811  $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
1812  }
1813 
1814  // Append login info only if password has been changed
1815  if ($this->user_request->getPassword() != '') {
1816  $body .= $usr_lang->txt('reg_mail_body_text2') . "\n" .
1817  ILIAS_HTTP_PATH . '/login.php?client_id=' . $this->ilias->client_id . "\n" .
1818  $usr_lang->txt('login') . ': ' . $this->object->getLogin() . "\n" .
1819  $usr_lang->txt('passwd') . ': ' . $this->user_request->getPassword() . "\n\n";
1820  }
1821  $body .= $usr_lang->txt('reg_mail_body_text3') . "\n";
1822  $body .= $this->object->getProfileAsString($usr_lang);
1824 
1825 
1826  $mmail->Subject($subject, true);
1827  $mmail->Body($body);
1828  $mmail->Send();
1829 
1830  return '<br/>' . $this->lng->txt('mail_sent');
1831  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 248 of file class.ilObjUserGUI.php.

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

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

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

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References ilSession\clear().

1715  : void
1716  {
1717  ilSession::clear('filtered_roles');
1718  }
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 1742 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.

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

References roleassignmentObject().

1641  : void
1642  {
1643  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1644  $table_gui->writeFilterToSession();
1645  $table_gui->resetOffset();
1646  $this->roleassignmentObject();
1647  }
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 1536 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.

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

◆ checkUserWriteRight()

ilObjUserGUI::checkUserWriteRight ( )
private

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

1934  : void
1935  {
1936  if ($this->usrf_ref_id === USER_FOLDER_ID
1937  && (
1938  !$this->rbac_system->checkAccess('visible,read', $this->usrf_ref_id)
1939  || !$this->rbac_system->checkAccess('write', $this->usrf_ref_id)
1940  && (
1941  !$this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1942  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1943  && !in_array(
1944  $this->object->getId(),
1945  $this->access->filterUserIdsByPositionOfCurrentUser(
1948  [$this->object->getId()]
1949  )
1950  )
1951  )
1952  )
1953  ) {
1954  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1955  }
1956 
1957  // if called from local administration $this->usrf_ref_id is category id
1958  // Todo: this has to be fixed. Do not mix user folder id and category id
1959  if ($this->usrf_ref_id != USER_FOLDER_ID
1960  && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1961  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1962  }
1963  }
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 354 of file class.ilObjUserGUI.php.

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

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

◆ editObject()

ilObjUserGUI::editObject ( )

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

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

Referenced by removeUserPictureObject().

514  : void
515  {
516  $this->checkUserWriteRight();
517 
518  if ($this->usrf_ref_id != USER_FOLDER_ID) {
519  $this->tabs_gui->clearTargets();
520  }
521 
522  // get form
523  $this->initForm('edit');
524  $this->getValues();
525  $this->renderForm();
526  }
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.
Class ilObjUserTrackingGUI.
+ 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(), 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  $this->tabs_gui->addTarget(
199  'role_assignment',
200  $this->ctrl->getLinkTarget($this, 'roleassignment'),
201  ['roleassignment'],
202  get_class($this)
203  );
204 
205  // learning progress
206  if ($this->rbac_system->checkAccess('read', $this->ref_id) and
208  ilObjUserTracking::_enabledUserRelatedData()) {
209  $this->tabs_gui->addTarget(
210  'learning_progress',
211  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
212  '',
213  ['illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui']
214  );
215  }
216 
217  $this->tabs_gui->addTarget(
218  'user_ownership',
219  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
220  '',
221  'ilobjectownershipmanagementgui'
222  );
223  }
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 824 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, null, and ILIAS\Repository\object().

Referenced by editObject().

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

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1896  : bool
1897  {
1898  $profile_maybe_incomplete = false;
1899 
1900  foreach ($this->user_profile->getIgnorableRequiredSettings() as $fieldName) {
1901  $elm = $this->form_gui->getItemByPostVar($fieldName);
1902 
1903  if (!$elm) {
1904  continue;
1905  }
1906 
1907  if ($elm->getRequired()) {
1908  $profile_maybe_incomplete = true;
1909 
1910  // Flag as optional
1911  $elm->setRequired(false);
1912  }
1913  }
1914 
1916  foreach ($user_defined_fields->getDefinitions() as $definition) {
1917  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
1918 
1919  if (!$elm) {
1920  continue;
1921  }
1922 
1923  if ($elm->getRequired() && $definition['required']) {
1924  $profile_maybe_incomplete = true;
1925 
1926  // Flag as optional
1927  $elm->setRequired(false);
1928  }
1929  }
1930 
1931  return $profile_maybe_incomplete;
1932  }
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 292 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().

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

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

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

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

1403  : bool
1404  {
1405  static $settings = null;
1406 
1407  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1408  return true;
1409  }
1410 
1411  if ($settings == null) {
1412  $settings = $this->settings->getAll();
1413  }
1414  return (bool) ($settings['usr_settings_changeable_lua_' . $a_field] ?? false);
1415  }
const USER_FOLDER_ID
Definition: constants.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 661 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().

661  : void
662  {
663  if (!$user) {
665  }
666 
668  if ($this->usrf_ref_id == USER_FOLDER_ID) {
669  $all_defs = $user_defined_fields->getDefinitions();
670  } else {
672  }
673  $udf = [];
674  foreach ($all_defs as $definition) {
675  $f = "udf_" . $definition['field_id'];
676  $item = $this->form_gui->getItemByPostVar($f);
677  if ($item && !$item->getDisabled()) {
678  $udf[$definition['field_id']] = $this->form_gui->getInput($f);
679  }
680  }
681  $user->setUserDefinedData($udf);
682  }
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 528 of file class.ilObjUserGUI.php.

References ilObjectGUI\$object, ilObjectGUI\$user, ilObjUser\getActive(), IL_CAL_DATE, IL_CAL_UNIX, ILIAS\Repository\int(), isSettingChangeable(), null, 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().

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

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

Referenced by uploadUserPicture().

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

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

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

◆ renderForm()

ilObjUserGUI::renderForm ( )
private

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

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

1965  : void
1966  {
1967  $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1968  }
+ Here is the caller graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

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

References roleassignmentObject().

1649  : void
1650  {
1651  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1652  $table_gui->resetOffset();
1653  $table_gui->resetFilter();
1654  $this->roleassignmentObject();
1655  }
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 1606 of file class.ilObjUserGUI.php.

References ILIAS\Repository\access(), ANONYMOUS_USER_ID, ilSession\get(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilSession\set(), and ILIAS\Repository\tabs().

Referenced by applyFilterObject(), and resetFilterObject().

1606  : void
1607  {
1608  $this->tabs->activateTab('role_assignment');
1609 
1610  if ($this->object->getId() === (int) ANONYMOUS_USER_ID
1611  || !$this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1612  && !$this->access->isCurrentUserBasedOnPositionsAllowedTo('read_users', [$this->object->getId()])
1613  ) {
1614  $this->ilias->raiseError(
1615  $this->lng->txt('msg_no_perm_assign_role_to_user'),
1616  $this->ilias->error_obj->MESSAGE
1617  );
1618  }
1619 
1620  $filtered_roles = ilSession::get('filtered_roles');
1621  $req_filtered_roles = $this->user_request->getFilteredRoles();
1623  'filtered_roles',
1624  ($req_filtered_roles > 0) ? $req_filtered_roles : $filtered_roles
1625  );
1626 
1627  $filtered_roles = ilSession::get('filtered_roles');
1628  if ($filtered_roles > 5) {
1629  ilSession::set('filtered_roles', 0);
1630  }
1631 
1632  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1633 
1634  // init table
1635  $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1636 
1637  $tab->parse($this->object->getId());
1638  $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1639  }
static get(string $a_var)
const ANONYMOUS_USER_ID
Definition: constants.php:27
Class ilObjForumAdministration.
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 369 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().

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

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

◆ 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 1421 of file class.ilObjUserGUI.php.

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1421  : void
1422  {
1423  $userfile_input = $this->form_gui->getItemByPostVar('userfile');
1424  if ($_FILES['userfile']['tmp_name'] == '') {
1425  if ($userfile_input->getDeletionFlag()) {
1426  $this->object->removeUserPicture();
1427  }
1428  return;
1429  }
1430  if ($_FILES['userfile']['size'] == 0) {
1431  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_file'));
1432  } else {
1433  $store_file = 'usr_' . $this->object->getId() . '.' . 'jpg';
1434 
1435  $rid = $this->moveFileToStorage();
1436 
1437  if ($rid === null) {
1438  return;
1439  }
1440 
1441  $this->object->setAvatarRid($rid->serialize());
1442  $this->irss->flavours()->ensure($rid, new ilUserProfilePictureDefinition());
1443 
1444  $this->object->setPref('profile_image', $store_file); // this may be dropped with the next release
1445  $this->object->update();
1446  }
1447  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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: