ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilObjUserGUI Class Reference

Class ilObjUserGUI. More...

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

Public Member Functions

 executeCommand ()
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 createObject ()
 Display user create form. More...
 
 saveObject ()
 save user data More...
 
 updateObject ()
 updates object entry in object_data More...
 
 editObject ()
 
 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 ()
 @abstract overwrite in derived GUI class of your object type More...
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) 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 ()
 @abstract 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

 initCreate ()
 
 initForm (bool $do_require, ?\ilObjUser $user)
 Init user form. More...
 
 buildSectionHeader (string $title_lang_var)
 
 buildNonEditableInput (string $identifier, string $value)
 
 buildAuthModeInput (?\ilObjUser $user)
 
 buildLoginInput (?\ilObjUser $user)
 
 buildPasswordInput (?\ilObjUser $user)
 
 buildExternalAccountInput (?\ilObjUser $user)
 
 buildTimeLimitInput (?\ilObjUser $user)
 
 buildTimeLimitDateInputs (?\ilObjUser $user)
 
 buildStatisticalInputs (?\ilObjUser $user)
 
 addSystemInformationSectionToForm (?\ilObjUser $user)
 
 addValuesFromSystemInformationToUserSection (\ilObjUser $user, bool $user_creation)
 
 addStatisticalInformationToForm (?\ilObjUser $user)
 
 addOptionsSectionToForm ()
 
 moveFileToStorage ()
 
 handleIgnoredRequiredFields ()
 Handles ignored required fields by changing the required flag of form elements. More...
 
 checkUserWritePermission ()
 
 renderForm ()
 
 checkAccessToRolesTab ()
 
 retrieveAllowIncompleteProfileFromPost ()
 
 redirectDependingOnParent ()
 
 isAccessRangeInputValid ()
 

Private Attributes

ilPropertyFormGUI $form_gui
 
UserGUIRequest $user_request
 
ilHelpGUI $help
 
ilTabsGUI $tabs
 
RepositoryGUIs $repository_guis
 
ilMailMimeSenderFactory $mail_sender_factory
 
FileUpload $uploads
 
ResourceStorageServices $irss
 
ResourceStakeholder $stakeholder
 
UserSettingsImplementation $user_settings
 
Profile $user_profile
 
string $requested_letter = ''
 
string $requested_baseClass = ''
 
string $requested_search = ''
 
array $selectable_roles
 
int $default_role
 
string $default_layout_and_style
 
int $usrf_ref_id
 
Context $context
 
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
 
GlobalHttpState $http
 
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
 
CustomIconFactory $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 1110 of file class.ilObjUserGUI.php.

1110 : string
1111 {
1112 $action[0] = $this->lng->txt('assigned_roles');
1113 $action[1] = $this->lng->txt('all_roles');
1114 $action[2] = $this->lng->txt('all_global_roles');
1115 $action[3] = $this->lng->txt('all_local_roles');
1116 $action[4] = $this->lng->txt('internal_local_roles_only');
1117 $action[5] = $this->lng->txt('non_internal_local_roles_only');
1118
1120 ilSession::get('filtered_roles'),
1121 'filter',
1122 $action,
1123 false,
1124 true
1125 );
1126 }
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 get(string $a_var)

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

+ Here is the call graph for this function:

◆ __getDateSelect()

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

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

1051 : string {
1052 $year = null;
1053 switch ($a_type) {
1054 case 'minute':
1055 for ($i = 0; $i <= 60; $i++) {
1056 $days[$i] = $i < 10 ? '0' . $i : $i;
1057 }
1058 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1059
1060 case 'hour':
1061 for ($i = 0; $i < 24; $i++) {
1062 $days[$i] = $i < 10 ? '0' . $i : $i;
1063 }
1064 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1065
1066 case 'day':
1067 for ($i = 1; $i < 32; $i++) {
1068 $days[$i] = $i < 10 ? '0' . $i : $i;
1069 }
1070 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1071
1072 case 'month':
1073 for ($i = 1; $i < 13; $i++) {
1074 $month[$i] = $i < 10 ? '0' . $i : $i;
1075 }
1076 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1077
1078 case 'year':
1079 if ($a_selected < date('Y')) {
1080 $start = $a_selected;
1081 } else {
1082 $start = date('Y');
1083 }
1084
1085 for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1086 $year[$i] = $i;
1087 }
1088 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1089 }
1090 return '';
1091 }

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

+ Here is the call graph for this function:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

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

1173 : string
1174 {
1175 if ($this->user_request->getSendMail() != 'y') {
1176 return '';
1177 }
1178 if (!strlen($this->object->getEmail())) {
1179 return '';
1180 }
1181
1182 $usr_lang = new ilLanguage($this->object->getLanguage());
1183 $usr_lang->loadLanguageModule('crs');
1184 $usr_lang->loadLanguageModule('registration');
1185
1186 $mmail = new ilMimeMail();
1187 $mmail->From($this->mail_sender_factory->system());
1188
1189 $mailOptions = new ilMailOptions($this->object->getId());
1190 $mmail->To($mailOptions->getExternalEmailAddresses());
1191
1192 $subject = $usr_lang->txt('profile_changed');
1193 $body = $usr_lang->txt('reg_mail_body_salutation')
1194 . ' ' . $this->object->getFullname() . ",\n\n";
1195
1196 $date = $this->object->getApproveDate();
1197
1198 if ($date !== null && (time() - strtotime($date)) < 10) {
1199 $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
1200 } else {
1201 $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
1202 }
1203
1204 // Append login info only if password has been changed
1205 if ($this->user_request->getPassword() != '') {
1206 $body .= $usr_lang->txt('reg_mail_body_text2') . "\n" .
1207 ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n" .
1208 $usr_lang->txt('login') . ': ' . $this->object->getLogin() . "\n" .
1209 $usr_lang->txt('passwd') . ': ' . $this->user_request->getPassword() . "\n\n";
1210 }
1211 $body .= $usr_lang->txt('reg_mail_body_text3') . "\n";
1212 $body .= $this->object->getProfileAsString($usr_lang);
1214
1215
1216 $mmail->Subject($subject, true);
1217 $mmail->Body($body);
1218 $mmail->Send();
1219
1220 return '<br/>' . $this->lng->txt('mail_sent');
1221 }
language handling
static _getInstallationSignature()
const CLIENT_ID
Definition: constants.php:41

References ilMail\_getInstallationSignature(), CLIENT_ID, ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by updateObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __toUnix()

ilObjUserGUI::__toUnix ( array  $a_time_arr)

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

1093 : int // Missing array type.
1094 {
1095 return mktime(
1096 $a_time_arr['hour'],
1097 $a_time_arr['minute'],
1098 $a_time_arr['second'],
1099 $a_time_arr['month'],
1100 $a_time_arr['day'],
1101 $a_time_arr['year']
1102 );
1103 }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

1105 : void
1106 {
1107 ilSession::clear('filtered_roles');
1108 }
static clear(string $a_var)

References ilSession\clear().

+ 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)

Reimplemented from ilObjectGUI.

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

1132 : void
1133 {
1134 $this->locator->clearItems();
1135
1136 if ($this->admin_mode == 'settings') { // system settings
1137 $this->ctrl->setParameterByClass(
1138 'ilobjsystemfoldergui',
1139 'ref_id',
1141 );
1142 $this->locator->addItem(
1143 $this->lng->txt('administration'),
1144 $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1145 ilFrameTargetInfo::_getFrame('MainContent')
1146 );
1147
1148 if ($this->requested_ref_id == USER_FOLDER_ID) {
1149 $this->locator->addItem(
1150 $this->lng->txt('obj_' . ilObject::_lookupType(
1151 ilObject::_lookupObjId($this->requested_ref_id)
1152 )),
1153 $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1154 );
1155 } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1156 $this->locator->addItem(
1157 $this->lng->txt('obj_' . ilObject::_lookupType(
1158 ilObject::_lookupObjId($this->requested_ref_id)
1159 )),
1160 $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1161 );
1162 }
1163
1164 if ($this->obj_id > 0) {
1165 $this->locator->addItem(
1166 $this->object->getTitle(),
1167 $this->ctrl->getLinkTarget($this, 'view')
1168 );
1169 }
1170 }
1171 }
static _getFrame(string $a_class)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_FOLDER_ID
Definition: constants.php:35
const ROLE_FOLDER_ID
Definition: constants.php:34

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.

+ Here is the call graph for this function:

◆ addOptionsSectionToForm()

ilObjUserGUI::addOptionsSectionToForm ( )
private

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

826 : void
827 {
828 $this->form_gui->addItem(
829 $this->buildSectionHeader('user_admin_options')
830 );
831
832 $se = new ilCheckboxInputGUI($this->lng->txt('inform_user_mail'), 'send_mail');
833 $se->setInfo($this->lng->txt('inform_user_mail_info'));
834 $se->setValue('y');
835 $se->setChecked(($this->user->getPref('send_info_mails') == 'y'));
836 $this->form_gui->addItem($se);
837
838 $irf = new ilCheckboxInputGUI($this->lng->txt('ignore_required_fields'), 'ignore_rf');
839 $irf->setInfo($this->lng->txt('ignore_required_fields_info'));
840 $irf->setValue('1');
841 $this->form_gui->addItem($irf);
842 }
This class represents a checkbox property in a property form.
buildSectionHeader(string $title_lang_var)

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

+ Here is the call graph for this function:

◆ addStatisticalInformationToForm()

ilObjUserGUI::addStatisticalInformationToForm ( ?\ilObjUser  $user)
private

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

809 : void {
810 if ($user === null) {
811 return;
812 }
813
814 foreach ($this->buildStatisticalInputs($user) as $input) {
815 $this->form_gui->addItem($input);
816 }
817
818 foreach ($this->legal_documents->userManagementFields($this->object) as $identifier => $value) {
819 if (is_string($value)) {
820 $value = $this->buildNonEditableInput($identifier, $value);
821 }
822 $this->form_gui->addItem($value);
823 }
824 }
buildNonEditableInput(string $identifier, string $value)
buildStatisticalInputs(?\ilObjUser $user)

◆ addSystemInformationSectionToForm()

ilObjUserGUI::addSystemInformationSectionToForm ( ?\ilObjUser  $user)
private

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

767 : void {
768 $this->form_gui->addItem(
769 $this->buildSectionHeader('system_information')
770 );
771
773
774 $ac = new ilCheckboxInputGUI($this->lng->txt('active'), 'active');
775 $ac->setChecked(
776 $user === null
777 ? true
778 : $user->getActive()
779 );
780 $this->form_gui->addItem($ac);
781
782 $this->form_gui->addItem($this->buildTimeLimitInput($user));
783 }
addStatisticalInformationToForm(?\ilObjUser $user)
buildTimeLimitInput(?\ilObjUser $user)

◆ addValuesFromSystemInformationToUserSection()

ilObjUserGUI::addValuesFromSystemInformationToUserSection ( \ilObjUser  $user,
bool  $user_creation 
)
private

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

788 : \ilObjUser {
789 $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
790 $user->setTimeLimitFrom($from ? $from->get(IL_CAL_UNIX) : null);
791 $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
792 $user->setTimeLimitUntil($until ? $until->get(IL_CAL_UNIX) : null);
793 $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited') === '1');
794
795 if ($user_creation) {
796 $user->setTimeLimitOwner($this->usrf_ref_id);
797 }
798
799 $active_from_input = $this->form_gui->getInput('active') === '1';
800 if ($user->getActive() !== $active_from_input) {
801 $user->setActive($active_from_input, $this->user->getId());
802 }
803
804 return $user;
805 }
const IL_CAL_UNIX
User class.
setTimeLimitUntil(?int $a_until)
setTimeLimitFrom(?int $a_from)
setActive(bool $active, int $owner=0)
set user active state and updates system fields appropriately
setTimeLimitOwner(int $a_owner)
setTimeLimitUnlimited(bool $unlimited)

References ilObjUser\setTimeLimitOwner().

Referenced by saveObject(), and updateObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

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

1031 : void
1032 {
1033 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1034 $table_gui->writeFilterToSession();
1035 $table_gui->resetOffset();
1036 $this->roleassignmentObject();
1037 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ assignSaveObject()

ilObjUserGUI::assignSaveObject ( )

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

927 : void
928 {
929 if (!$this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)) {
930 $this->tpl->setOnScreenMessage(
931 'failure',
932 $this->lng->txt('msg_no_perm_assign_role_to_user')
933 );
935 }
936
937 $selected_roles = $this->user_request->getRoleIds();
938 $posted_roles = $this->user_request->getPostedRoleIds();
939
940 // prevent unassignment of system role from system user
941 if ($this->object->getId() == SYSTEM_USER_ID && in_array(SYSTEM_ROLE_ID, $posted_roles)) {
942 $selected_roles[] = SYSTEM_ROLE_ID;
943 }
944
945 $global_roles_all = $this->rbac_review->getGlobalRoles();
946 $assigned_roles_all = $this->rbac_review->assignedRoles($this->object->getId());
947 $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
948 $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
949 $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
950
951 $user_not_allowed_to_change_admin_role_assginements =
952 !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()));
953
954 if ($user_not_allowed_to_change_admin_role_assginements
955 && in_array(SYSTEM_ROLE_ID, $assigned_roles_all)) {
956 $selected_roles[] = SYSTEM_ROLE_ID;
957 }
958
959 $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
960
961 if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
962 || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
963 $this->tpl->setOnScreenMessage(
964 'failure',
965 "{$this->lng->txt('action_aborted')}: {$this->lng->txt('msg_min_one_role')}",
966 true
967 );
968 $this->ctrl->redirect($this, 'roleassignment');
969 }
970
971 foreach (array_diff($assigned_roles, $selected_roles) as $role) {
972 if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
973 || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
974 continue;
975 }
976 $this->rbac_admin->deassignUser($role, $this->object->getId());
977 }
978
979 foreach (array_diff($selected_roles, $assigned_roles) as $role) {
980 if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
981 || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
982 continue;
983 }
984 $this->rbac_admin->assignUser($role, $this->object->getId(), false);
985 }
986
987 $this->object->update();
988
989 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_roleassignment_changed'), true);
990
991 if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
992 $this->ctrl->redirect($this, 'roleassignment');
993 } else {
994 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
995 }
996 }
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

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

+ Here is the call graph for this function:

◆ buildAuthModeInput()

ilObjUserGUI::buildAuthModeInput ( ?\ilObjUser  $user)
private

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

622 $input = new ilSelectInputGUI($this->lng->txt('auth_mode'), 'auth_mode');
623 $option = [];
624 foreach (ilAuthUtils::_getActiveAuthModes() as $auth_name => $auth_key) {
625 if ($auth_name == 'default') {
626 $name = $this->lng->txt('auth_' . $auth_name)
627 . ' (' . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName((string) $auth_key)) . ')';
628 } else {
629 $name = ilAuthUtils::getAuthModeTranslation((string) $auth_key, $auth_name);
630 }
631 $option[$auth_name] = $name;
632 }
633 $input->setOptions($option);
634 if ($user === null) {
635 return $input;
636 }
637
638 $input->setValue($this->object->getAuthMode());
639 return $input;
640 }
static _getActiveAuthModes()
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _getAuthModeName($a_auth_key)
This class represents a selection list property in a property form.

References ilAuthUtils\_getAuthModeName(), ilAuthUtils\getAuthModeTranslation(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildExternalAccountInput()

ilObjUserGUI::buildExternalAccountInput ( ?\ilObjUser  $user)
private

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

679 $input = new ilTextInputGUI($this->lng->txt('user_ext_account'), 'ext_account');
680 $input->setSize(40);
681 $input->setMaxLength(250);
682 $input->setInfo($this->lng->txt('user_ext_account_desc'));
683 if ($user === null) {
684 return $input;
685 }
686 $input->setValue($user->getExternalAccount());
687 return $input;
688 }
This class represents a text property in a property form.

◆ buildLoginInput()

ilObjUserGUI::buildLoginInput ( ?\ilObjUser  $user)
private

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

645 $field = $this->user_profile->getFieldByIdentifier('username');
646 $input = $field->getLegacyInput(
647 $this->lng,
648 $this->context,
649 $user
650 );
651 $input->setDisabled(!$this->context->isFieldChangeable($field, $user));
652 $input->setRequired($this->context->isFieldChangeable($field, $user));
653 return $input;
654 }
setDisabled(bool $a_disabled)
This class represents a user login property in a property form.

◆ buildNonEditableInput()

ilObjUserGUI::buildNonEditableInput ( string  $identifier,
string  $value 
)
private

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

614 $input = new ilNonEditableValueGUI($this->lng->txt($identifier), $identifier);
615 $input->setValue($value);
616 return $input;
617 }
This class represents a non editable value in a property form.

◆ buildPasswordInput()

ilObjUserGUI::buildPasswordInput ( ?\ilObjUser  $user)
private

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

659 $input = new ilPasswordInputGUI($this->lng->txt('passwd'), 'passwd');
660 $input->setUseStripSlashes(false);
661 $input->setSize(32);
662 $input->setMaxLength(80);
663 $input->setValidateAuthPost('auth_mode');
664 if ($user === null) {
665 $input->setRequiredOnAuth(true);
666 }
667 if ($this->user->getId() !== (int) SYSTEM_USER_ID
668 && in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))
669 && !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
670 $input->setDisabled(true);
671 }
673 return $input;
674 }
This class represents a password property in a property form.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()

◆ buildSectionHeader()

ilObjUserGUI::buildSectionHeader ( string  $title_lang_var)
private

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

604 {
605 $section = new ilFormSectionHeaderGUI();
606 $section->setTitle($this->lng->txt($title_lang_var));
607 return $section;
608 }
This class represents a section header in a property form.

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildStatisticalInputs()

ilObjUserGUI::buildStatisticalInputs ( ?\ilObjUser  $user)
private

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

737 : Generator {
738 yield $this->buildNonEditableInput(
739 'create_date',
743 ))
744 );
745
746 yield $this->buildNonEditableInput(
747 'approve_date',
751 ))
752 );
753
754 yield $this->buildNonEditableInput(
755 'last_login',
759 ))
760 );
761
762 yield $this->buildNonEditableInput('owner', $user->getOwnerName());
763 }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
getOwnerName()
get full name of object owner
getCreateDate()
Get create date in YYYY-MM-DD HH-MM-SS format.

◆ buildTimeLimitDateInputs()

ilObjUserGUI::buildTimeLimitDateInputs ( ?\ilObjUser  $user)
private
Returns
array<\ilDateTimeInputGUI>

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

715 : Generator {
716 $from = new ilDateTimeInputGUI($this->lng->txt('crs_from'), 'time_limit_from');
717 $from->setRequired(true);
718 $from->setShowTime(true);
719 $from->setMinuteStepSize(1);
720 $from->setDate(
721 new ilDateTime($user?->getTimeLimitFrom(), IL_CAL_UNIX)
722 );
723 yield $from;
724
725 $to = new ilDateTimeInputGUI($this->lng->txt('crs_to'), 'time_limit_until');
726 $to->setRequired(true);
727 $to->setShowTime(true);
728 $to->setMinuteStepSize(1);
729 $to->setDate(
730 new ilDateTime($user?->getTimeLimitUntil(), IL_CAL_UNIX)
731 );
732 yield $to;
733 }
This class represents a date/time property in a property form.

◆ buildTimeLimitInput()

ilObjUserGUI::buildTimeLimitInput ( ?\ilObjUser  $user)
private

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

692 {
693 $radg = new ilRadioGroupInputGUI($this->lng->txt('time_limit'), 'time_limit_unlimited');
694 $radg->setRequired(true);
695 $op1 = new ilRadioOption($this->lng->txt('user_access_unlimited'), '1');
696 $radg->addOption($op1);
697 $op2 = new ilRadioOption($this->lng->txt('user_access_limited'), '0');
698 foreach ($this->buildTimeLimitDateInputs($user) as $input) {
699 $op2->addSubItem($input);
700 }
701 $radg->addOption($op2);
702 $radg->setValue(
703 $user?->getTimeLimitUnlimited() ?? true ? '1' : '0'
704 );
705
706 return $radg;
707 }
buildTimeLimitDateInputs(?\ilObjUser $user)
This class represents a property in a property form.
This class represents an option in a radio group.

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

cancel action and go back to previous page

Reimplemented from ilObjectGUI.

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

169 : void
170 {
171 ilSession::clear('saved_post');
172
173 if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
174 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
175 } else {
176 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
177 }
178 }

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

+ Here is the call graph for this function:

◆ checkAccessToRolesTab()

ilObjUserGUI::checkAccessToRolesTab ( )
private

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

1375 : bool
1376 {
1377 return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1378 && (
1379 $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1380 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1381 && in_array(
1382 $this->object->getId(),
1383 $this->access->filterUserIdsByPositionOfCurrentUser(
1386 [$this->object->getId()]
1387 )
1388 )
1389 );
1390 }
const ANONYMOUS_USER_ID
Definition: constants.php:27

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkUserWritePermission()

ilObjUserGUI::checkUserWritePermission ( )
private

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

1335 : void
1336 {
1337 if ($this->context === Context::UserAdministration
1338 && !(
1339 $this->rbac_system->checkAccess(\ilObjUserFolder::PERM_READ_ALL_AND_WRITE, $this->usrf_ref_id)
1340 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1341 && in_array(
1342 $this->object->getId(),
1343 $this->access->filterUserIdsByPositionOfCurrentUser(
1346 [$this->object->getId()]
1347 )
1348 )
1349 )) {
1350 $this->tpl->setOnScreenMessage(
1351 'failure',
1352 $this->lng->txt('msg_no_perm_modify_user'),
1353 true
1354 );
1355 $this->ctrl->redirectByClass(ilObjUserFolderGUI::class);
1356 }
1357
1358 // if called from local administration $this->usrf_ref_id is category id
1359 // Todo: this has to be fixed. Do not mix user folder id and category id
1360 if ($this->usrf_ref_id !== USER_FOLDER_ID
1361 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1362 $this->tpl->setOnScreenMessage(
1363 'failure',
1364 $this->lng->txt('msg_no_perm_modify_user')
1365 );
1366 $this->redirectToRefId($this->usrf_ref_id);
1367 }
1368 }
const string PERM_READ_ALL_AND_WRITE
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 sav...

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

Referenced by editObject(), and updateObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createObject()

ilObjUserGUI::createObject ( )

Display user create form.

Reimplemented from ilObjectGUI.

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

307 : void
308 {
309 if (!$this->rbac_system->checkAccess('create_usr', $this->usrf_ref_id)
310 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
311 $this->tpl->setOnScreenMessage(
312 'failure',
313 $this->lng->txt('permission_denied')
314 );
316 }
317
318 $this->initCreate();
319 $this->initForm(true, null);
320 $this->renderForm();
321 }
initForm(bool $do_require, ?\ilObjUser $user)
Init user form.

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

+ Here is the call graph for this function:

◆ editObject()

ilObjUserGUI::editObject ( )

Reimplemented from ilObjectGUI.

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

511 : void
512 {
514
515 if ($this->usrf_ref_id != USER_FOLDER_ID) {
516 $this->tabs_gui->clearTargets();
517 }
518
519 // get form
520 $this->initForm(true, $this->object);
521 $this->renderForm();
522 }

References checkUserWritePermission(), initForm(), renderForm(), and USER_FOLDER_ID.

+ Here is the call graph for this function:

◆ executeCommand()

ilObjUserGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

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

120 : void
121 {
122 $next_class = $this->ctrl->getNextClass($this);
123 $cmd = $this->ctrl->getCmd();
124
125 $this->prepareOutput();
126
127 switch ($next_class) {
128 case 'illearningprogressgui':
129 $new_gui = new ilLearningProgressGUI(
132 $this->object->getId()
133 );
134 $this->ctrl->forwardCommand($new_gui);
135 break;
136
137 case strtolower(ilObjectOwnershipManagementGUI::class):
138 $this->ctrl->forwardCommand(
139 $this->repository_guis->ownershipManagementGUI(
140 $this->object->getId()
141 )
142 );
143 break;
144
145 default:
146 if ($cmd == '' || $cmd == 'view') {
147 $cmd = 'edit';
148 }
149 $cmd .= 'Object';
150 $this->$cmd();
151 break;
152 }
153 }
Class ilObjUserTrackingGUI.
prepareOutput(bool $show_sub_objects=true)

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

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjUserGUI::getAdminTabs ( )

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

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

180 : void
181 {
182 $this->getTabs();
183 }
getTabs()
@abstract overwrite in derived GUI class of your object type

References getTabs().

+ Here is the call graph for this function:

◆ getTabs()

ilObjUserGUI::getTabs ( )
protected

@abstract overwrite in derived GUI class of your object type

Reimplemented from ilObjectGUI.

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

185 : void
186 {
187 $this->tabs_gui->clearTargets();
188
189 $this->help->setScreenIdComponent('usr');
190
191 if ($this->requested_search) {
192 $this->tabs_gui->setBackTarget(
193 $this->lng->txt('search_results'),
194 ilSession::get('usr_search_link')
195 );
196
197 $this->tabs_gui->addTarget(
198 'properties',
199 $this->ctrl->getLinkTarget($this, 'edit'),
200 ['edit', '', 'view'],
201 get_class($this),
202 '',
203 true
204 );
205 } else {
206 $this->tabs_gui->addTarget(
207 'properties',
208 $this->ctrl->getLinkTarget($this, 'edit'),
209 ['edit', '', 'view'],
210 get_class($this)
211 );
212 }
213
214 if ($this->checkAccessToRolesTab()) {
215 $this->tabs_gui->addTarget(
216 'role_assignment',
217 $this->ctrl->getLinkTarget($this, 'roleassignment'),
218 ['roleassignment'],
219 get_class($this)
220 );
221 }
222
223 if ((
224 $this->context === Context::LocalUserAdministration
225 && $this->rbac_system->checkAccess('read', $this->ref_id)
226 || $this->context === Context::UserAdministration
227 && $this->rbac_system->checkAccess(\ilObjUserFolder::PERM_READ_ALL, $this->ref_id)
230 $this->tabs_gui->addTarget(
231 'learning_progress',
232 $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
233 '',
234 ['illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui']
235 );
236 }
237
238 $this->tabs_gui->addTarget(
239 'user_ownership',
240 $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
241 '',
242 'ilobjectownershipmanagementgui'
243 );
244 }
const string PERM_READ_ALL

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

Referenced by getAdminTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleIgnoredRequiredFields()

ilObjUserGUI::handleIgnoredRequiredFields ( )
private

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

1298 : bool
1299 {
1300 $profile_maybe_incomplete = false;
1301
1302 foreach ($this->user_profile->getIgnorableRequiredFields() as $fieldName) {
1303 $elm = $this->form_gui->getItemByPostVar($fieldName);
1304
1305 if (!$elm) {
1306 continue;
1307 }
1308
1309 if ($elm->getRequired()) {
1310 $profile_maybe_incomplete = true;
1311
1312 // Flag as optional
1313 $elm->setRequired(false);
1314 }
1315 }
1316
1317 foreach ($this->user_profile->getAllUserDefinedFields() as $field) {
1318 $elm = $this->form_gui->getItemByPostVar('udf_' . $field->getIdentifier());
1319
1320 if (!$elm) {
1321 continue;
1322 }
1323
1324 if ($elm->getRequired() && $field->isRequired()) {
1325 $profile_maybe_incomplete = true;
1326
1327 // Flag as optional
1328 $elm->setRequired(false);
1329 }
1330 }
1331
1332 return $profile_maybe_incomplete;
1333 }

◆ initCreate()

ilObjUserGUI::initCreate ( )
private

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

246 : void
247 {
248 if ($this->usrf_ref_id !== USER_FOLDER_ID) {
249 $this->tabs_gui->clearTargets();
250 }
251
252 // role selection
253 $obj_list = $this->rbac_review->getRoleListByObject(ROLE_FOLDER_ID);
254 $rol = [];
255 foreach ($obj_list as $obj_data) {
256 // allow only 'assign_users' marked roles if called from category
257 if ($this->object->getRefId() !== USER_FOLDER_ID && !in_array(
259 $this->rbac_review->assignedRoles($this->user->getId())
260 )) {
261 if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
262 continue;
263 }
264 }
265 // exclude anonymous role from list
266 if ($obj_data['obj_id'] !== ANONYMOUS_ROLE_ID) {
267 // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
268 if ($obj_data['obj_id'] !== SYSTEM_ROLE_ID || in_array(
270 $this->rbac_review->assignedRoles($this->user->getId())
271 )) {
272 $rol[$obj_data['obj_id']] = $obj_data['title'];
273 }
274 }
275 }
276
277 if ($rol === null) {
278 $this->tpl->setOnScreenMessage(
279 'failure',
280 $this->lng->txt('msg_no_roles_users_can_be_assigned_to')
281 );
283 }
284
285 $keys = array_keys($rol);
286
287 // set pre defined user role to default
288 if (in_array(4, $keys)) {
289 $this->default_role = 4;
290 } elseif (count($keys) > 1 && in_array(2, $keys)) {
291 // remove admin role as preselectable role
292 foreach ($keys as $key => $val) {
293 if ($val == 2) {
294 unset($keys[$key]);
295 break;
296 }
297 }
298
299 $this->default_role = array_shift($keys);
300 }
301 $this->selectable_roles = $rol;
302 }
static _getAssignUsersStatus(int $a_role_id)
const ANONYMOUS_ROLE_ID
Definition: constants.php:28

References ilObjRole\_getAssignUsersStatus(), ANONYMOUS_ROLE_ID, ILIAS\Repository\lng(), ILIAS\Repository\object(), redirectDependingOnParent(), ROLE_FOLDER_ID, SYSTEM_ROLE_ID, and USER_FOLDER_ID.

Referenced by createObject(), and saveObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilObjUserGUI::initForm ( bool  $do_require,
?\ilObjUser  $user 
)
private

Init user form.

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

530 : void {
531 $this->form_gui = new ilPropertyFormGUI();
532 $this->form_gui->setFormAction(
533 $this->ctrl->getFormActionByClass(self::class)
534 );
535
536 $this->form_gui->setTitle($this->lng->txt('usr_new'));
537 if ($user !== null) {
538 $this->form_gui->setTitle($this->lng->txt('usr_edit'));
539 }
540
541 $this->form_gui->addItem(
542 $this->buildSectionHeader('login_data')
543 );
544
545 $this->form_gui->addItem(
547 );
548
549 if ($user !== null) {
550 $id = $this->buildNonEditableInput('usr_id', (string) $user->getId());
551 $this->form_gui->addItem($id);
552 }
553
554 $this->form_gui->addItem(
555 $this->buildLoginInput($user)
556 );
557
558 if ($this->user->getId() === (int) SYSTEM_USER_ID
559 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
560 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
561 $this->form_gui->addItem(
563 );
564 }
565
567 $this->form_gui->addItem(
569 );
570 }
571
573
574 $this->form_gui = $this->user_profile->addFieldsToForm(
575 $this->form_gui,
576 $this->context,
577 $do_require,
578 $user,
579 [Alias::class]
580 );
581
582 $this->form_gui->addItem(
583 $this->buildSectionHeader('settings')
584 );
585
586 $this->form_gui = $this->user_settings->addSectionsToLegacyForm(
587 $this->form_gui,
588 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
589 $this->context,
590 $user
591 );
592
594
595 if ($user === null) {
596 $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
597 } else {
598 $this->form_gui->addCommandButton('update', $this->lng->txt('save'));
599 }
600 $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
601 }
static _isExternalAccountEnabled()
Check if an external account name is required.
buildLoginInput(?\ilObjUser $user)
buildPasswordInput(?\ilObjUser $user)
addSystemInformationSectionToForm(?\ilObjUser $user)
buildExternalAccountInput(?\ilObjUser $user)
buildAuthModeInput(?\ilObjUser $user)
This class represents a property form user interface.

References ILIAS\Repository\lng().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAccessRangeInputValid()

ilObjUserGUI::isAccessRangeInputValid ( )
private

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

1412 : bool
1413 {
1414 if ($this->form_gui->getInput('time_limit_unlimited') === '1') {
1415 return true;
1416 }
1417 $timefrom = $this->form_gui->getItemByPostVar('time_limit_from');
1418 $timeuntil = $this->form_gui->getItemByPostVar('time_limit_until');
1419 if ($timeuntil->getDate()->get(IL_CAL_UNIX) <= $timefrom->getDate()->get(IL_CAL_UNIX)) {
1420 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
1421 $timeuntil->setAlert($this->lng->txt('time_limit_not_valid'));
1422 return false;
1423 }
1424 return true;
1425 }

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

+ Here is the call graph for this function:

◆ moveFileToStorage()

ilObjUserGUI::moveFileToStorage ( )
private

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

845 {
846 $uploads = $this->uploads->getResults();
847 $upload_tmp_name = $_FILES['userfile']['tmp_name'];
848 $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
849
850 $existing_rid = $this->object->getAvatarRid();
851 $revision_title = 'Avatar for user ' . $this->object->getLogin();
852 $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
853
854 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
855 $stream = Streams::ofResource(
856 fopen($upload_tmp_name, 'r')
857 );
858
859 if ($existing_rid === null) {
860 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
861 }
862
863 $this->irss->manage()->appendNewRevisionFromStream(
864 $existing_rid,
865 $stream,
866 $this->stakeholder,
867 $revision_title
868 );
869 return $existing_rid;
870 }
871
872 if ($avatar_upload_result === null) {
873 return null;
874 }
875
876 if ($existing_rid === null) {
877 return $this->irss->manage()->upload(
878 $avatar_upload_result,
879 $this->stakeholder,
880 $revision_title
881 );
882 }
883
884 $this->irss->manage()->replaceWithUpload(
885 $existing_rid,
886 $avatar_upload_result,
887 $this->stakeholder,
888 $revision_title
889 );
890 return $existing_rid;
891 }
FileUpload $uploads
getResults()
Returns the results of the processing and moving operation of the uploaded files.

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

+ Here is the call graph for this function:

◆ redirectDependingOnParent()

ilObjUserGUI::redirectDependingOnParent ( )
private

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

1403 : void
1404 {
1405 if ($this->usrf_ref_id === USER_FOLDER_ID) {
1406 $this->ctrl->redirectByClass(ilObjUserFolderAccess::class);
1407 }
1408
1409 $this->redirectToRefId($this->usrf_ref_id);
1410 }

References ILIAS\Repository\ctrl(), and USER_FOLDER_ID.

Referenced by createObject(), and initCreate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeUserPictureObject()

ilObjUserGUI::removeUserPictureObject ( )

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

893 : void
894 {
895 $webspace_dir = ilFileUtils::getWebspaceDir();
896 $image_dir = $webspace_dir . '/usr_images';
897 $file = $image_dir . '/usr_' . $this->object->getId() . '.' . 'jpg';
898 $thumb_file = $image_dir . '/usr_' . $this->object->getId() . '_small.jpg';
899 $xthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xsmall.jpg';
900 $xxthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xxsmall.jpg';
901 $upload_file = $image_dir . '/upload_' . $this->object->getId();
902
903 // remove user pref file name
904 $this->object->setPref('profile_image', '');
905 $this->object->update();
906 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_image_removed'));
907
908 if (is_file($file)) {
909 unlink($file);
910 }
911 if (is_file($thumb_file)) {
912 unlink($thumb_file);
913 }
914 if (is_file($xthumb_file)) {
915 unlink($xthumb_file);
916 }
917 if (is_file($xxthumb_file)) {
918 unlink($xxthumb_file);
919 }
920 if (is_file($upload_file)) {
921 unlink($upload_file);
922 }
923
924 $this->editObject();
925 }
static getWebspaceDir(string $mode="filesystem")
get webspace directory

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

+ Here is the call graph for this function:

◆ renderForm()

ilObjUserGUI::renderForm ( )
private

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

1370 : void
1371 {
1372 $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1373 }

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

+ Here is the caller graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

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

1039 : void
1040 {
1041 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1042 $table_gui->resetOffset();
1043 $table_gui->resetFilter();
1044 $this->roleassignmentObject();
1045 }

◆ retrieveAllowIncompleteProfileFromPost()

ilObjUserGUI::retrieveAllowIncompleteProfileFromPost ( )
private

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

1392 : bool
1393 {
1394 return $this->post_wrapper->retrieve(
1395 'ignore_rf',
1396 $this->refinery->byTrying([
1397 $this->refinery->kindlyTo()->bool(),
1398 $this->refinery->always(false)
1399 ])
1400 );
1401 }

References ILIAS\Repository\refinery().

Referenced by saveObject(), and updateObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roleassignmentObject()

ilObjUserGUI::roleassignmentObject ( )

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

998 : void
999 {
1000 $this->tabs->activateTab('role_assignment');
1001
1002 if (!$this->checkAccessToRolesTab()) {
1003 $this->tpl->setOnScreenMessage(
1004 'failure',
1005 $this->lng->txt('msg_no_perm_view_roles_of_user'),
1006 true
1007 );
1008 $this->ctrl->redirectByClass(self::class, 'edit');
1009 }
1010
1011 $req_filtered_roles = $this->user_request->getFilteredRoles();
1013 'filtered_roles',
1014 ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1015 );
1016
1017 $filtered_roles = ilSession::get('filtered_roles');
1018 if ($filtered_roles > 5) {
1019 ilSession::set('filtered_roles', 0);
1020 }
1021
1022 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1023
1024 // init table
1025 $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1026
1027 $tab->parse($this->object->getId());
1028 $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1029 }
static set(string $a_var, $a_val)
Set a value.

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

+ Here is the call graph for this function:

◆ saveObject()

ilObjUserGUI::saveObject ( )

save user data

Reimplemented from ilObjectGUI.

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

326 : void
327 {
328 if (!$this->rbac_system->checkAccess('create_usr', $this->usrf_ref_id)
329 && !$this->access->checkAccess('cat_administrate_users', '', $this->usrf_ref_id)) {
330 $this->tpl->setOnScreenMessage(
331 'failure',
332 $this->lng->txt('msg_no_perm_modify_user')
333 );
334 $this->redirectToRefId($this->usrf_ref_id);
335 }
336
337 $this->initCreate();
338 $profile_maybe_incomplete = $this->retrieveAllowIncompleteProfileFromPost();
339 $this->initForm(!$profile_maybe_incomplete, null);
340
341 if (!$this->form_gui->checkInput()) {
342 $this->form_gui->setValuesByPost();
343 $this->renderForm();
344 return;
345 }
346
347 $new_user = new ilObjUser();
348 $new_user->create();
349 $new_user->saveAsNew();
350
351 $user_object = $this->user_profile->addFormValuesToUser(
352 $this->form_gui,
353 $this->context,
355 );
356
357 $user_object->setLogin($this->form_gui->getInput('username'));
358 if ($this->user->getId() === (int) SYSTEM_USER_ID
359 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
360 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
361 $user_object->setPasswd($this->form_gui->getInput('passwd'), ilObjUser::PASSWD_PLAIN);
362 }
364 $user_object->setExternalAccount($this->form_gui->getInput('ext_account'));
365 }
366 $user_object->setLastPasswordChangeTS(time());
367
368 $user_object->setTitle($user_object->getFullname());
369 $user_object->setDescription($user_object->getEmail());
370 $user_object->update();
371
372 $this->object = $this->user_settings->saveForm(
373 $this->form_gui,
374 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
375 $this->context,
376 $this->addValuesFromSystemInformationToUserSection($user_object, true)
377 );
378
379 //set role entries
380 $this->rbac_admin->assignUser(
381 (int) $this->form_gui->getInput('default_role'),
382 $user_object->getId(),
383 true
384 );
385
386 $msg = $this->lng->txt('user_added');
387
388 $this->user->writePref(
389 'send_info_mails',
390 $this->form_gui->getInput('send_mail') === 'y' ? 'y' : 'n'
391 );
392
393 if ($profile_maybe_incomplete
394 && $this->user_profile->isProfileIncomplete($this->object)) {
395 $this->object->setProfileIncomplete(true);
396 $this->object->update();
397 }
398
399 // send new account mail
400 if ($this->form_gui->getInput('send_mail') == 'y') {
401 $acc_mail = new ilAccountMail();
402 $acc_mail->useLangVariablesAsFallback(true);
403 $acc_mail->setUserPassword($this->form_gui->getInput('passwd'));
404 $acc_mail->setUser($user_object);
405
406 if ($acc_mail->send()) {
407 $msg .= '<br />' . $this->lng->txt('mail_sent');
408 $this->tpl->setOnScreenMessage('success', $msg, true);
409 } else {
410 $msg .= '<br />' . $this->lng->txt('mail_not_sent');
411 $this->tpl->setOnScreenMessage('info', $msg, true);
412 }
413 } else {
414 $this->tpl->setOnScreenMessage('success', $msg, true);
415 }
416
417 if (strtolower($this->requested_baseClass) === strtolower(ilAdministrationGUI::class)) {
418 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
419 return;
420 }
421
422 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
423 }
addValuesFromSystemInformationToUserSection(\ilObjUser $user, bool $user_creation)
retrieveAllowIncompleteProfileFromPost()
const PASSWD_PLAIN
$new_user

References $new_user, ilAuthUtils\_isExternalAccountEnabled(), addValuesFromSystemInformationToUserSection(), ILIAS\Repository\ctrl(), initCreate(), initForm(), ILIAS\Repository\lng(), ilObjUser\PASSWD_PLAIN, ilObjectGUI\redirectToRefId(), renderForm(), retrieveAllowIncompleteProfileFromPost(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )
protected

Reimplemented from ilObjectGUI.

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

155 : void
156 {
157 if (strtolower(get_class($this->object)) == 'ilobjuser') {
158 $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
159 $this->tpl->setDescription($this->object->getLongDescription());
160 $this->tpl->setTitleIcon(
161 ilUtil::getImagePath('standard/icon_' . $this->object->getType() . '.svg'),
162 $this->lng->txt('obj_' . $this->object->getType())
163 );
164 } else {
165 parent::setTitleAndDescription();
166 }
167 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

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

+ Here is the call graph for this function:

◆ updateObject()

ilObjUserGUI::updateObject ( )

updates object entry in object_data

Reimplemented from ilObjectGUI.

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

425 : void
426 {
428
429 $profile_maybe_incomplete = $this->retrieveAllowIncompleteProfileFromPost();
430 $this->initForm(!$profile_maybe_incomplete, $this->object);
431
432 if (!$this->form_gui->checkInput()
433 || !$this->isAccessRangeInputValid()) {
434 $this->form_gui->setValuesByPost();
435 $this->tabs_gui->activateTab('properties');
436 $this->renderForm();
437 return;
438 }
439
440 try {
441 $this->object->updateLogin($this->form_gui->getInput('username'), $this->context);
442 } catch (ilUserException $e) {
443 $this->tpl->setOnScreenMessage('failure', $e->getMessage());
444 $this->form_gui->setValuesByPost();
445 $this->renderForm();
446 return;
447 }
448
449 $this->object->setAuthMode($this->form_gui->getInput('auth_mode'));
450
451 $this->object = $this->user_profile->addFormValuesToUser(
452 $this->form_gui,
453 $this->context,
454 $this->object
455 );
456
457 $passwd = $this->form_gui->getInput('passwd');
458 if (($this->user->getId() === (int) SYSTEM_USER_ID
459 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
460 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId())))
461 && !empty($passwd)) {
462 $this->object->setPasswd($passwd, ilObjUser::PASSWD_PLAIN);
463 }
465 $this->object->setExternalAccount($this->form_gui->getInput('ext_account'));
466 }
467
468 $this->object->setTitle($this->object->getFullname());
469 $this->object->setDescription($this->object->getEmail());
470
471 $this->object = $this->user_settings->saveForm(
472 $this->form_gui,
473 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
474 $this->context,
475 $this->addValuesFromSystemInformationToUserSection($this->object, false)
476 );
477
478 $this->object->setLastPasswordChangeTS(time());
479 $this->object->setProfileIncomplete(false);
480
481 // If the current user is editing its own user account,
482 // we update his preferences.
483 if ($this->user->getId() === $this->object->getId()) {
484 $this->user = $this->object;
485 }
486 $this->user->writePref(
487 'send_info_mails',
488 ($this->form_gui->getInput('send_mail') === 'y') ? 'y' : 'n'
489 );
490
491 $mail_message = $this->__sendProfileMail();
492 $msg = $this->lng->txt('saved_successfully') . $mail_message;
493
494 if ($profile_maybe_incomplete
495 && $this->user_profile->isProfileIncomplete($this->object)) {
496 $this->object->setProfileIncomplete(true);
497 $this->object->update();
498 }
499
500 // feedback
501 $this->tpl->setOnScreenMessage('success', $msg, true);
502
503 if (strtolower($this->requested_baseClass) === strtolower(ilAdministrationGUI::class)) {
504 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
505 return;
506 }
507
508 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
509 }

References Vendor\Package\$e, ilObjectGUI\$object, __sendProfileMail(), ilAuthUtils\_isExternalAccountEnabled(), addValuesFromSystemInformationToUserSection(), checkUserWritePermission(), ILIAS\Repository\ctrl(), initForm(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilObjUser\PASSWD_PLAIN, renderForm(), retrieveAllowIncompleteProfileFromPost(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Field Documentation

◆ $context

Context ilObjUserGUI::$context
private

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

◆ $default_layout_and_style

string ilObjUserGUI::$default_layout_and_style
private

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

◆ $default_role

int ilObjUserGUI::$default_role
private

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

◆ $form_gui

ilPropertyFormGUI ilObjUserGUI::$form_gui
private

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

◆ $help

ilHelpGUI ilObjUserGUI::$help
private

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

◆ $irss

ResourceStorageServices ilObjUserGUI::$irss
private

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

◆ $legal_documents

Conductor ilObjUserGUI::$legal_documents
private

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

◆ $mail_sender_factory

ilMailMimeSenderFactory ilObjUserGUI::$mail_sender_factory
private

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

◆ $repository_guis

RepositoryGUIs ilObjUserGUI::$repository_guis
private

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

◆ $requested_baseClass

string ilObjUserGUI::$requested_baseClass = ''
private

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

◆ $requested_letter

string ilObjUserGUI::$requested_letter = ''
private

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

◆ $requested_search

string ilObjUserGUI::$requested_search = ''
private

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

◆ $selectable_roles

array ilObjUserGUI::$selectable_roles
private

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

◆ $stakeholder

ResourceStakeholder ilObjUserGUI::$stakeholder
private

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

◆ $tabs

ilTabsGUI ilObjUserGUI::$tabs
private

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

◆ $uploads

FileUpload ilObjUserGUI::$uploads
private

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

◆ $user_profile

Profile ilObjUserGUI::$user_profile
private

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

◆ $user_request

UserGUIRequest ilObjUserGUI::$user_request
private

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

◆ $user_settings

UserSettingsImplementation ilObjUserGUI::$user_settings
private

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

◆ $usrf_ref_id

int ilObjUserGUI::$usrf_ref_id
private

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


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