ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 1118 of file class.ilObjUserGUI.php.

1118 : string
1119 {
1120 $action[0] = $this->lng->txt('assigned_roles');
1121 $action[1] = $this->lng->txt('all_roles');
1122 $action[2] = $this->lng->txt('all_global_roles');
1123 $action[3] = $this->lng->txt('all_local_roles');
1124 $action[4] = $this->lng->txt('internal_local_roles_only');
1125 $action[5] = $this->lng->txt('non_internal_local_roles_only');
1126
1128 ilSession::get('filtered_roles'),
1129 'filter',
1130 $action,
1131 false,
1132 true
1133 );
1134 }
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 1055 of file class.ilObjUserGUI.php.

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

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

+ Here is the call graph for this function:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

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

1181 : string
1182 {
1183 if ($this->user_request->getSendMail() != 'y') {
1184 return '';
1185 }
1186 if (!strlen($this->object->getEmail())) {
1187 return '';
1188 }
1189
1190 $usr_lang = new ilLanguage($this->object->getLanguage());
1191 $usr_lang->loadLanguageModule('crs');
1192 $usr_lang->loadLanguageModule('registration');
1193
1194 $mmail = new ilMimeMail();
1195 $mmail->From($this->mail_sender_factory->system());
1196
1197 $mailOptions = new ilMailOptions($this->object->getId());
1198 $mmail->To($mailOptions->getExternalEmailAddresses());
1199
1200 $subject = $usr_lang->txt('profile_changed');
1201 $body = $usr_lang->txt('reg_mail_body_salutation')
1202 . ' ' . $this->object->getFullname() . ",\n\n";
1203
1204 $date = $this->object->getApproveDate();
1205
1206 if ($date !== null && (time() - strtotime($date)) < 10) {
1207 $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
1208 } else {
1209 $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
1210 }
1211
1212 // Append login info only if password has been changed
1213 if ($this->user_request->getPassword() != '') {
1214 $body .= $usr_lang->txt('reg_mail_body_text2') . "\n" .
1215 ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n" .
1216 $usr_lang->txt('login') . ': ' . $this->object->getLogin() . "\n" .
1217 $usr_lang->txt('passwd') . ': ' . $this->user_request->getPassword() . "\n\n";
1218 }
1219 $body .= $usr_lang->txt('reg_mail_body_text3') . "\n";
1220 $body .= $this->object->getProfileAsString($usr_lang);
1222
1223
1224 $mmail->Subject($subject, true);
1225 $mmail->Body($body);
1226 $mmail->Send();
1227
1228 return '<br/>' . $this->lng->txt('mail_sent');
1229 }
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 1101 of file class.ilObjUserGUI.php.

1101 : int // Missing array type.
1102 {
1103 return mktime(
1104 $a_time_arr['hour'],
1105 $a_time_arr['minute'],
1106 $a_time_arr['second'],
1107 $a_time_arr['month'],
1108 $a_time_arr['day'],
1109 $a_time_arr['year']
1110 );
1111 }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

1113 : void
1114 {
1115 ilSession::clear('filtered_roles');
1116 }
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 1140 of file class.ilObjUserGUI.php.

1140 : void
1141 {
1142 $this->locator->clearItems();
1143
1144 if ($this->admin_mode == 'settings') { // system settings
1145 $this->ctrl->setParameterByClass(
1146 'ilobjsystemfoldergui',
1147 'ref_id',
1149 );
1150 $this->locator->addItem(
1151 $this->lng->txt('administration'),
1152 $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1153 ilFrameTargetInfo::_getFrame('MainContent')
1154 );
1155
1156 if ($this->requested_ref_id == USER_FOLDER_ID) {
1157 $this->locator->addItem(
1158 $this->lng->txt('obj_' . ilObject::_lookupType(
1159 ilObject::_lookupObjId($this->requested_ref_id)
1160 )),
1161 $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1162 );
1163 } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1164 $this->locator->addItem(
1165 $this->lng->txt('obj_' . ilObject::_lookupType(
1166 ilObject::_lookupObjId($this->requested_ref_id)
1167 )),
1168 $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1169 );
1170 }
1171
1172 if ($this->obj_id > 0) {
1173 $this->locator->addItem(
1174 $this->object->getTitle(),
1175 $this->ctrl->getLinkTarget($this, 'view')
1176 );
1177 }
1178 }
1179 }
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 834 of file class.ilObjUserGUI.php.

834 : void
835 {
836 $this->form_gui->addItem(
837 $this->buildSectionHeader('user_admin_options')
838 );
839
840 $se = new ilCheckboxInputGUI($this->lng->txt('inform_user_mail'), 'send_mail');
841 $se->setInfo($this->lng->txt('inform_user_mail_info'));
842 $se->setValue('y');
843 $se->setChecked(($this->user->getPref('send_info_mails') == 'y'));
844 $this->form_gui->addItem($se);
845
846 $irf = new ilCheckboxInputGUI($this->lng->txt('ignore_required_fields'), 'ignore_rf');
847 $irf->setInfo($this->lng->txt('ignore_required_fields_info'));
848 $irf->setValue('1');
849 $this->form_gui->addItem($irf);
850 }
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 815 of file class.ilObjUserGUI.php.

817 : void {
818 if ($user === null) {
819 return;
820 }
821
822 foreach ($this->buildStatisticalInputs($user) as $input) {
823 $this->form_gui->addItem($input);
824 }
825
826 foreach ($this->legal_documents->userManagementFields($this->object) as $identifier => $value) {
827 if (is_string($value)) {
828 $value = $this->buildNonEditableInput($identifier, $value);
829 }
830 $this->form_gui->addItem($value);
831 }
832 }
buildNonEditableInput(string $identifier, string $value)
buildStatisticalInputs(?\ilObjUser $user)

◆ addSystemInformationSectionToForm()

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

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

775 : void {
776 $this->form_gui->addItem(
777 $this->buildSectionHeader('system_information')
778 );
779
781
782 $ac = new ilCheckboxInputGUI($this->lng->txt('active'), 'active');
783 $ac->setChecked(
784 $user === null
785 ? true
786 : $user->getActive()
787 );
788 $this->form_gui->addItem($ac);
789
790 $this->form_gui->addItem($this->buildTimeLimitInput($user));
791 }
addStatisticalInformationToForm(?\ilObjUser $user)
buildTimeLimitInput(?\ilObjUser $user)

◆ addValuesFromSystemInformationToUserSection()

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

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

796 : \ilObjUser {
797 $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
798 $user->setTimeLimitFrom($from ? $from->get(IL_CAL_UNIX) : null);
799 $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
800 $user->setTimeLimitUntil($until ? $until->get(IL_CAL_UNIX) : null);
801 $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited') === '1');
802
803 if ($user_creation) {
804 $user->setTimeLimitOwner($this->usrf_ref_id);
805 }
806
807 $active_from_input = $this->form_gui->getInput('active') === '1';
808 if ($user->getActive() !== $active_from_input) {
809 $user->setActive($active_from_input, $this->user->getId());
810 }
811
812 return $user;
813 }
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 1039 of file class.ilObjUserGUI.php.

1039 : void
1040 {
1041 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1042 $table_gui->writeFilterToSession();
1043 $table_gui->resetOffset();
1044 $this->roleassignmentObject();
1045 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ assignSaveObject()

ilObjUserGUI::assignSaveObject ( )

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

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

630 $input = new ilSelectInputGUI($this->lng->txt('auth_mode'), 'auth_mode');
631 $option = [];
632 foreach (ilAuthUtils::_getActiveAuthModes() as $auth_name => $auth_key) {
633 if ($auth_name == 'default') {
634 $name = $this->lng->txt('auth_' . $auth_name)
635 . ' (' . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName((string) $auth_key)) . ')';
636 } else {
637 $name = ilAuthUtils::getAuthModeTranslation((string) $auth_key, $auth_name);
638 }
639 $option[$auth_name] = $name;
640 }
641 $input->setOptions($option);
642 if ($user === null) {
643 return $input;
644 }
645
646 $input->setValue($this->object->getAuthMode());
647 return $input;
648 }
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 684 of file class.ilObjUserGUI.php.

687 $input = new ilTextInputGUI($this->lng->txt('user_ext_account'), 'ext_account');
688 $input->setSize(40);
689 $input->setMaxLength(250);
690 $input->setInfo($this->lng->txt('user_ext_account_desc'));
691 if ($user === null) {
692 return $input;
693 }
694 $input->setValue($user->getExternalAccount());
695 return $input;
696 }
This class represents a text property in a property form.

◆ buildLoginInput()

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

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

653 $field = $this->user_profile->getFieldByIdentifier('username');
654 $input = $field->getLegacyInput(
655 $this->lng,
656 $this->context,
657 $user
658 );
659 $input->setDisabled(!$this->context->isFieldChangeable($field, $user));
660 $input->setRequired($this->context->isFieldChangeable($field, $user));
661 return $input;
662 }
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 618 of file class.ilObjUserGUI.php.

622 $input = new ilNonEditableValueGUI($this->lng->txt($identifier), $identifier);
623 $input->setValue($value);
624 return $input;
625 }
This class represents a non editable value in a property form.

◆ buildPasswordInput()

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

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

667 $input = new ilPasswordInputGUI($this->lng->txt('passwd'), 'passwd');
668 $input->setUseStripSlashes(false);
669 $input->setSize(32);
670 $input->setMaxLength(80);
671 $input->setValidateAuthPost('auth_mode');
672 if ($user === null) {
673 $input->setRequiredOnAuth(true);
674 }
675 if ($this->user->getId() !== (int) SYSTEM_USER_ID
676 && in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))
677 && !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
678 $input->setDisabled(true);
679 }
681 return $input;
682 }
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 611 of file class.ilObjUserGUI.php.

612 {
613 $section = new ilFormSectionHeaderGUI();
614 $section->setTitle($this->lng->txt($title_lang_var));
615 return $section;
616 }
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 743 of file class.ilObjUserGUI.php.

745 : Generator {
746 yield $this->buildNonEditableInput(
747 'create_date',
751 ))
752 );
753
754 yield $this->buildNonEditableInput(
755 'approve_date',
759 ))
760 );
761
762 yield $this->buildNonEditableInput(
763 'last_login',
767 ))
768 );
769
770 yield $this->buildNonEditableInput('owner', $user->getOwnerName());
771 }
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 721 of file class.ilObjUserGUI.php.

723 : Generator {
724 $from = new ilDateTimeInputGUI($this->lng->txt('crs_from'), 'time_limit_from');
725 $from->setRequired(true);
726 $from->setShowTime(true);
727 $from->setMinuteStepSize(1);
728 $from->setDate(
729 new ilDateTime($user?->getTimeLimitFrom(), IL_CAL_UNIX)
730 );
731 yield $from;
732
733 $to = new ilDateTimeInputGUI($this->lng->txt('crs_to'), 'time_limit_until');
734 $to->setRequired(true);
735 $to->setShowTime(true);
736 $to->setMinuteStepSize(1);
737 $to->setDate(
738 new ilDateTime($user?->getTimeLimitUntil(), IL_CAL_UNIX)
739 );
740 yield $to;
741 }
This class represents a date/time property in a property form.

◆ buildTimeLimitInput()

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

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

700 {
701 $radg = new ilRadioGroupInputGUI($this->lng->txt('time_limit'), 'time_limit_unlimited');
702 $radg->setRequired(true);
703 $op1 = new ilRadioOption($this->lng->txt('user_access_unlimited'), '1');
704 $radg->addOption($op1);
705 $op2 = new ilRadioOption($this->lng->txt('user_access_limited'), '0');
706 foreach ($this->buildTimeLimitDateInputs($user) as $input) {
707 $op2->addSubItem($input);
708 }
709 $radg->addOption($op2);
710 $radg->setValue(
711 $user?->getTimeLimitUnlimited() ?? true ? '1' : '0'
712 );
713
714 return $radg;
715 }
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 1383 of file class.ilObjUserGUI.php.

1383 : bool
1384 {
1385 return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1386 && (
1387 $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1388 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1389 && in_array(
1390 $this->object->getId(),
1391 $this->access->filterUserIdsByPositionOfCurrentUser(
1394 [$this->object->getId()]
1395 )
1396 )
1397 );
1398 }
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 1343 of file class.ilObjUserGUI.php.

1343 : void
1344 {
1345 if ($this->context === Context::UserAdministration
1346 && !(
1347 $this->rbac_system->checkAccess(\ilObjUserFolder::PERM_READ_ALL_AND_WRITE, $this->usrf_ref_id)
1348 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1349 && in_array(
1350 $this->object->getId(),
1351 $this->access->filterUserIdsByPositionOfCurrentUser(
1354 [$this->object->getId()]
1355 )
1356 )
1357 )) {
1358 $this->tpl->setOnScreenMessage(
1359 'failure',
1360 $this->lng->txt('msg_no_perm_modify_user'),
1361 true
1362 );
1363 $this->ctrl->redirectByClass(ilObjUserFolderGUI::class);
1364 }
1365
1366 // if called from local administration $this->usrf_ref_id is category id
1367 // Todo: this has to be fixed. Do not mix user folder id and category id
1368 if ($this->usrf_ref_id !== USER_FOLDER_ID
1369 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1370 $this->tpl->setOnScreenMessage(
1371 'failure',
1372 $this->lng->txt('msg_no_perm_modify_user')
1373 );
1374 $this->redirectToRefId($this->usrf_ref_id);
1375 }
1376 }
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 519 of file class.ilObjUserGUI.php.

519 : void
520 {
522
523 if ($this->usrf_ref_id != USER_FOLDER_ID) {
524 $this->tabs_gui->clearTargets();
525 }
526
527 // get form
528 $this->initForm(true, $this->object);
529 $this->renderForm();
530 }

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

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

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

538 : void {
539 $this->form_gui = new ilPropertyFormGUI();
540 $this->form_gui->setFormAction(
541 $this->ctrl->getFormActionByClass(self::class)
542 );
543
544 $this->form_gui->setTitle($this->lng->txt('usr_new'));
545 if ($user !== null) {
546 $this->form_gui->setTitle($this->lng->txt('usr_edit'));
547 }
548
549 $this->form_gui->addItem(
550 $this->buildSectionHeader('login_data')
551 );
552
553 $this->form_gui->addItem(
555 );
556
557 if ($user !== null) {
558 $id = $this->buildNonEditableInput('usr_id', (string) $user->getId());
559 $this->form_gui->addItem($id);
560 }
561
562 $this->form_gui->addItem(
563 $this->buildLoginInput($user)
564 );
565
566 if ($this->user->getId() === (int) SYSTEM_USER_ID
567 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
568 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
569 $this->form_gui->addItem(
571 );
572 }
573
575 $this->form_gui->addItem(
577 );
578 }
579
581
582 $this->form_gui = $this->user_profile->addFieldsToForm(
583 $this->form_gui,
584 $this->context,
585 $do_require,
586 $user,
587 [Alias::class]
588 );
589
590 $this->form_gui->addItem(
591 $this->buildSectionHeader('settings')
592 );
593
594 $this->form_gui = $this->user_settings->addSectionsToLegacyForm(
595 $this->form_gui,
596 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
597 $this->context,
598 $user
599 );
600
602
603 if ($user === null) {
604 $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
605 } else {
606 $this->form_gui->addCommandButton('update', $this->lng->txt('save'));
607 }
608 $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
609 }
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 1420 of file class.ilObjUserGUI.php.

1420 : bool
1421 {
1422 if ($this->form_gui->getInput('time_limit_unlimited') === '1') {
1423 return true;
1424 }
1425 $timefrom = $this->form_gui->getItemByPostVar('time_limit_from');
1426 $timeuntil = $this->form_gui->getItemByPostVar('time_limit_until');
1427 if ($timeuntil->getDate()->get(IL_CAL_UNIX) <= $timefrom->getDate()->get(IL_CAL_UNIX)) {
1428 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
1429 $timeuntil->setAlert($this->lng->txt('time_limit_not_valid'));
1430 return false;
1431 }
1432 return true;
1433 }

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

+ Here is the call graph for this function:

◆ moveFileToStorage()

ilObjUserGUI::moveFileToStorage ( )
private

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

853 {
854 $uploads = $this->uploads->getResults();
855 $upload_tmp_name = $_FILES['userfile']['tmp_name'];
856 $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
857
858 $existing_rid = $this->object->getAvatarRid();
859 $revision_title = 'Avatar for user ' . $this->object->getLogin();
860 $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
861
862 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
863 $stream = Streams::ofResource(
864 fopen($upload_tmp_name, 'r')
865 );
866
867 if ($existing_rid === null) {
868 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
869 }
870
871 $this->irss->manage()->appendNewRevisionFromStream(
872 $existing_rid,
873 $stream,
874 $this->stakeholder,
875 $revision_title
876 );
877 return $existing_rid;
878 }
879
880 if ($avatar_upload_result === null) {
881 return null;
882 }
883
884 if ($existing_rid === null) {
885 return $this->irss->manage()->upload(
886 $avatar_upload_result,
887 $this->stakeholder,
888 $revision_title
889 );
890 }
891
892 $this->irss->manage()->replaceWithUpload(
893 $existing_rid,
894 $avatar_upload_result,
895 $this->stakeholder,
896 $revision_title
897 );
898 return $existing_rid;
899 }
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 1411 of file class.ilObjUserGUI.php.

1411 : void
1412 {
1413 if ($this->usrf_ref_id === USER_FOLDER_ID) {
1414 $this->ctrl->redirectByClass(ilObjUserFolderAccess::class);
1415 }
1416
1417 $this->redirectToRefId($this->usrf_ref_id);
1418 }

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

901 : void
902 {
903 $webspace_dir = ilFileUtils::getWebspaceDir();
904 $image_dir = $webspace_dir . '/usr_images';
905 $file = $image_dir . '/usr_' . $this->object->getId() . '.' . 'jpg';
906 $thumb_file = $image_dir . '/usr_' . $this->object->getId() . '_small.jpg';
907 $xthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xsmall.jpg';
908 $xxthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xxsmall.jpg';
909 $upload_file = $image_dir . '/upload_' . $this->object->getId();
910
911 // remove user pref file name
912 $this->object->setPref('profile_image', '');
913 $this->object->update();
914 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_image_removed'));
915
916 if (is_file($file)) {
917 unlink($file);
918 }
919 if (is_file($thumb_file)) {
920 unlink($thumb_file);
921 }
922 if (is_file($xthumb_file)) {
923 unlink($xthumb_file);
924 }
925 if (is_file($xxthumb_file)) {
926 unlink($xxthumb_file);
927 }
928 if (is_file($upload_file)) {
929 unlink($upload_file);
930 }
931
932 $this->editObject();
933 }
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 1378 of file class.ilObjUserGUI.php.

1378 : void
1379 {
1380 $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1381 }

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

+ Here is the caller graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

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

1047 : void
1048 {
1049 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1050 $table_gui->resetOffset();
1051 $table_gui->resetFilter();
1052 $this->roleassignmentObject();
1053 }

◆ retrieveAllowIncompleteProfileFromPost()

ilObjUserGUI::retrieveAllowIncompleteProfileFromPost ( )
private

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

1400 : bool
1401 {
1402 return $this->post_wrapper->retrieve(
1403 'ignore_rf',
1404 $this->refinery->byTrying([
1405 $this->refinery->kindlyTo()->bool(),
1406 $this->refinery->always(false)
1407 ])
1408 );
1409 }

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

1006 : void
1007 {
1008 $this->tabs->activateTab('role_assignment');
1009
1010 if (!$this->checkAccessToRolesTab()) {
1011 $this->tpl->setOnScreenMessage(
1012 'failure',
1013 $this->lng->txt('msg_no_perm_view_roles_of_user'),
1014 true
1015 );
1016 $this->ctrl->redirectByClass(self::class, 'edit');
1017 }
1018
1019 $req_filtered_roles = $this->user_request->getFilteredRoles();
1021 'filtered_roles',
1022 ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1023 );
1024
1025 $filtered_roles = ilSession::get('filtered_roles');
1026 if ($filtered_roles > 5) {
1027 ilSession::set('filtered_roles', 0);
1028 }
1029
1030 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1031
1032 // init table
1033 $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1034
1035 $tab->parse($this->object->getId());
1036 $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1037 }
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->user_settings->performAdditionalChecks(
343 $this->tpl,
344 $this->form_gui
345 )
346 ) {
347 $this->form_gui->setValuesByPost();
348 $this->renderForm();
349 return;
350 }
351
352 $new_user = new ilObjUser();
353 $new_user->create();
354 $new_user->saveAsNew();
355
356 $user_object = $this->user_profile->addFormValuesToUser(
357 $this->form_gui,
358 $this->context,
360 );
361
362 $user_object->setLogin($this->form_gui->getInput('username'));
363 if ($this->user->getId() === (int) SYSTEM_USER_ID
364 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
365 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
366 $user_object->setPasswd($this->form_gui->getInput('passwd'), ilObjUser::PASSWD_PLAIN);
367 }
369 $user_object->setExternalAccount($this->form_gui->getInput('ext_account'));
370 }
371 $user_object->setLastPasswordChangeTS(time());
372
373 $user_object->setTitle($user_object->getFullname());
374 $user_object->setDescription($user_object->getEmail());
375 $user_object->update();
376
377 $this->object = $this->user_settings->saveForm(
378 $this->form_gui,
379 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
380 $this->context,
381 $this->addValuesFromSystemInformationToUserSection($user_object, true)
382 );
383
384 //set role entries
385 $this->rbac_admin->assignUser(
386 (int) $this->form_gui->getInput('default_role'),
387 $user_object->getId(),
388 true
389 );
390
391 $msg = $this->lng->txt('user_added');
392
393 $this->user->writePref(
394 'send_info_mails',
395 $this->form_gui->getInput('send_mail') === 'y' ? 'y' : 'n'
396 );
397
398 if ($profile_maybe_incomplete
399 && $this->user_profile->isProfileIncomplete($this->object)) {
400 $this->object->setProfileIncomplete(true);
401 $this->object->update();
402 }
403
404 // send new account mail
405 if ($this->form_gui->getInput('send_mail') == 'y') {
406 $acc_mail = new ilAccountMail();
407 $acc_mail->useLangVariablesAsFallback(true);
408 $acc_mail->setUserPassword($this->form_gui->getInput('passwd'));
409 $acc_mail->setUser($user_object);
410
411 if ($acc_mail->send()) {
412 $msg .= '<br />' . $this->lng->txt('mail_sent');
413 $this->tpl->setOnScreenMessage('success', $msg, true);
414 } else {
415 $msg .= '<br />' . $this->lng->txt('mail_not_sent');
416 $this->tpl->setOnScreenMessage('info', $msg, true);
417 }
418 } else {
419 $this->tpl->setOnScreenMessage('success', $msg, true);
420 }
421
422 if (strtolower($this->requested_baseClass) === strtolower(ilAdministrationGUI::class)) {
423 $this->ctrl->redirectByClass('ilobjuserfoldergui', 'view');
424 return;
425 }
426
427 $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
428 }
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 430 of file class.ilObjUserGUI.php.

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

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: