ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 

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

1098 : string
1099 {
1100 $action[0] = $this->lng->txt('assigned_roles');
1101 $action[1] = $this->lng->txt('all_roles');
1102 $action[2] = $this->lng->txt('all_global_roles');
1103 $action[3] = $this->lng->txt('all_local_roles');
1104 $action[4] = $this->lng->txt('internal_local_roles_only');
1105 $action[5] = $this->lng->txt('non_internal_local_roles_only');
1106
1108 ilSession::get('filtered_roles'),
1109 'filter',
1110 $action,
1111 false,
1112 true
1113 );
1114 }
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 1035 of file class.ilObjUserGUI.php.

1039 : string {
1040 $year = null;
1041 switch ($a_type) {
1042 case 'minute':
1043 for ($i = 0; $i <= 60; $i++) {
1044 $days[$i] = $i < 10 ? '0' . $i : $i;
1045 }
1046 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1047
1048 case 'hour':
1049 for ($i = 0; $i < 24; $i++) {
1050 $days[$i] = $i < 10 ? '0' . $i : $i;
1051 }
1052 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1053
1054 case 'day':
1055 for ($i = 1; $i < 32; $i++) {
1056 $days[$i] = $i < 10 ? '0' . $i : $i;
1057 }
1058 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1059
1060 case 'month':
1061 for ($i = 1; $i < 13; $i++) {
1062 $month[$i] = $i < 10 ? '0' . $i : $i;
1063 }
1064 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1065
1066 case 'year':
1067 if ($a_selected < date('Y')) {
1068 $start = $a_selected;
1069 } else {
1070 $start = date('Y');
1071 }
1072
1073 for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1074 $year[$i] = $i;
1075 }
1076 return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1077 }
1078 return '';
1079 }

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

+ Here is the call graph for this function:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

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

1161 : string
1162 {
1163 if ($this->user_request->getSendMail() != 'y') {
1164 return '';
1165 }
1166 if (!strlen($this->object->getEmail())) {
1167 return '';
1168 }
1169
1170 $usr_lang = new ilLanguage($this->object->getLanguage());
1171 $usr_lang->loadLanguageModule('crs');
1172 $usr_lang->loadLanguageModule('registration');
1173
1174 $mmail = new ilMimeMail();
1175 $mmail->From($this->mail_sender_factory->system());
1176
1177 $mailOptions = new ilMailOptions($this->object->getId());
1178 $mmail->To($mailOptions->getExternalEmailAddresses());
1179
1180 $subject = $usr_lang->txt('profile_changed');
1181 $body = $usr_lang->txt('reg_mail_body_salutation')
1182 . ' ' . $this->object->getFullname() . ",\n\n";
1183
1184 $date = $this->object->getApproveDate();
1185
1186 if ($date !== null && (time() - strtotime($date)) < 10) {
1187 $body .= $usr_lang->txt('reg_mail_body_approve') . "\n\n";
1188 } else {
1189 $body .= $usr_lang->txt('reg_mail_body_profile_changed') . "\n\n";
1190 }
1191
1192 // Append login info only if password has been changed
1193 if ($this->user_request->getPassword() != '') {
1194 $body .= $usr_lang->txt('reg_mail_body_text2') . "\n" .
1195 ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n" .
1196 $usr_lang->txt('login') . ': ' . $this->object->getLogin() . "\n" .
1197 $usr_lang->txt('passwd') . ': ' . $this->user_request->getPassword() . "\n\n";
1198 }
1199 $body .= $usr_lang->txt('reg_mail_body_text3') . "\n";
1200 $body .= $this->object->getProfileAsString($usr_lang);
1202
1203
1204 $mmail->Subject($subject, true);
1205 $mmail->Body($body);
1206 $mmail->Send();
1207
1208 return '<br/>' . $this->lng->txt('mail_sent');
1209 }
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 1081 of file class.ilObjUserGUI.php.

1081 : int // Missing array type.
1082 {
1083 return mktime(
1084 $a_time_arr['hour'],
1085 $a_time_arr['minute'],
1086 $a_time_arr['second'],
1087 $a_time_arr['month'],
1088 $a_time_arr['day'],
1089 $a_time_arr['year']
1090 );
1091 }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

1093 : void
1094 {
1095 ilSession::clear('filtered_roles');
1096 }
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 1120 of file class.ilObjUserGUI.php.

1120 : void
1121 {
1122 $this->locator->clearItems();
1123
1124 if ($this->admin_mode == 'settings') { // system settings
1125 $this->ctrl->setParameterByClass(
1126 'ilobjsystemfoldergui',
1127 'ref_id',
1129 );
1130 $this->locator->addItem(
1131 $this->lng->txt('administration'),
1132 $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1133 ilFrameTargetInfo::_getFrame('MainContent')
1134 );
1135
1136 if ($this->requested_ref_id == USER_FOLDER_ID) {
1137 $this->locator->addItem(
1138 $this->lng->txt('obj_' . ilObject::_lookupType(
1139 ilObject::_lookupObjId($this->requested_ref_id)
1140 )),
1141 $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1142 );
1143 } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1144 $this->locator->addItem(
1145 $this->lng->txt('obj_' . ilObject::_lookupType(
1146 ilObject::_lookupObjId($this->requested_ref_id)
1147 )),
1148 $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1149 );
1150 }
1151
1152 if ($this->obj_id > 0) {
1153 $this->locator->addItem(
1154 $this->object->getTitle(),
1155 $this->ctrl->getLinkTarget($this, 'view')
1156 );
1157 }
1158 }
1159 }
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 814 of file class.ilObjUserGUI.php.

814 : void
815 {
816 $this->form_gui->addItem(
817 $this->buildSectionHeader('user_admin_options')
818 );
819
820 $se = new ilCheckboxInputGUI($this->lng->txt('inform_user_mail'), 'send_mail');
821 $se->setInfo($this->lng->txt('inform_user_mail_info'));
822 $se->setValue('y');
823 $se->setChecked(($this->user->getPref('send_info_mails') == 'y'));
824 $this->form_gui->addItem($se);
825
826 $irf = new ilCheckboxInputGUI($this->lng->txt('ignore_required_fields'), 'ignore_rf');
827 $irf->setInfo($this->lng->txt('ignore_required_fields_info'));
828 $irf->setValue('1');
829 $this->form_gui->addItem($irf);
830 }
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 798 of file class.ilObjUserGUI.php.

800 : void {
801 if ($user === null) {
802 return;
803 }
804
805 foreach ($this->buildStatisticalInputs($user) as $input) {
806 $this->form_gui->addItem($input);
807 }
808
809 foreach ($this->legal_documents->userManagementFields($this->object) as $input) {
810 $this->form_gui->addItem($input);
811 }
812 }
buildStatisticalInputs(?\ilObjUser $user)

◆ addSystemInformationSectionToForm()

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

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

758 : void {
759 $this->form_gui->addItem(
760 $this->buildSectionHeader('system_information')
761 );
762
764
765 $ac = new ilCheckboxInputGUI($this->lng->txt('active'), 'active');
766 $ac->setChecked(
767 $user === null
768 ? true
769 : $user->getActive()
770 );
771 $this->form_gui->addItem($ac);
772
773 $this->form_gui->addItem($this->buildTimeLimitInput($user));
774 }
addStatisticalInformationToForm(?\ilObjUser $user)
buildTimeLimitInput(?\ilObjUser $user)

◆ addValuesFromSystemInformationToUserSection()

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

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

779 : \ilObjUser {
780 $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
781 $user->setTimeLimitFrom($from ? $from->get(IL_CAL_UNIX) : null);
782 $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
783 $user->setTimeLimitUntil($until ? $until->get(IL_CAL_UNIX) : null);
784 $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited') === '1');
785
786 if ($user_creation) {
787 $user->setTimeLimitOwner($this->usrf_ref_id);
788 }
789
790 $active_from_input = $this->form_gui->getInput('active') === '1';
791 if ($user->getActive() !== $active_from_input) {
792 $user->setActive($active_from_input, $this->user->getId());
793 }
794
795 return $user;
796 }
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 1019 of file class.ilObjUserGUI.php.

1019 : void
1020 {
1021 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1022 $table_gui->writeFilterToSession();
1023 $table_gui->resetOffset();
1024 $this->roleassignmentObject();
1025 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ assignSaveObject()

ilObjUserGUI::assignSaveObject ( )

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

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

613 $input = new ilSelectInputGUI($this->lng->txt('auth_mode'), 'auth_mode');
614 $option = [];
615 foreach (ilAuthUtils::_getActiveAuthModes() as $auth_name => $auth_key) {
616 if ($auth_name == 'default') {
617 $name = $this->lng->txt('auth_' . $auth_name)
618 . ' (' . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName((string) $auth_key)) . ')';
619 } else {
620 $name = ilAuthUtils::getAuthModeTranslation((string) $auth_key, $auth_name);
621 }
622 $option[$auth_name] = $name;
623 }
624 $input->setOptions($option);
625 if ($user === null) {
626 return $input;
627 }
628
629 $input->setValue($this->object->getAuthMode());
630 return $input;
631 }
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 667 of file class.ilObjUserGUI.php.

670 $input = new ilTextInputGUI($this->lng->txt('user_ext_account'), 'ext_account');
671 $input->setSize(40);
672 $input->setMaxLength(250);
673 $input->setInfo($this->lng->txt('user_ext_account_desc'));
674 if ($user === null) {
675 return $input;
676 }
677 $input->setValue($user->getExternalAccount());
678 return $input;
679 }
This class represents a text property in a property form.

◆ buildLoginInput()

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

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

636 $field = $this->user_profile->getFieldByIdentifier('username');
637 $input = $field->getLegacyInput(
638 $this->lng,
639 $this->context,
640 $user
641 );
642 $input->setDisabled(!$this->context->isFieldChangeableInType($field, $user));
643 $input->setRequired($this->context->isFieldChangeableInType($field, $user));
644 return $input;
645 }
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 601 of file class.ilObjUserGUI.php.

605 $input = new ilNonEditableValueGUI($this->lng->txt($identifier), $identifier);
606 $input->setValue($value);
607 return $input;
608 }
This class represents a non editable value in a property form.

◆ buildPasswordInput()

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

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

650 $input = new ilPasswordInputGUI($this->lng->txt('passwd'), 'passwd');
651 $input->setUseStripSlashes(false);
652 $input->setSize(32);
653 $input->setMaxLength(80);
654 $input->setValidateAuthPost('auth_mode');
655 if ($user === null) {
656 $input->setRequiredOnAuth(true);
657 }
658 if ($this->user->getId() !== (int) SYSTEM_USER_ID
659 && in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))
660 && !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
661 $input->setDisabled(true);
662 }
664 return $input;
665 }
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 594 of file class.ilObjUserGUI.php.

595 {
596 $section = new ilFormSectionHeaderGUI();
597 $section->setTitle($this->lng->txt($title_lang_var));
598 return $section;
599 }
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 726 of file class.ilObjUserGUI.php.

728 : Generator {
729 yield $this->buildNonEditableInput(
730 'create_date',
734 ))
735 );
736
737 yield $this->buildNonEditableInput(
738 'approve_date',
742 ))
743 );
744
745 yield $this->buildNonEditableInput(
746 'last_login',
750 ))
751 );
752
753 yield $this->buildNonEditableInput('owner', $user->getOwnerName());
754 }
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
buildNonEditableInput(string $identifier, string $value)
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 704 of file class.ilObjUserGUI.php.

706 : Generator {
707 $from = new ilDateTimeInputGUI($this->lng->txt('crs_from'), 'time_limit_from');
708 $from->setRequired(true);
709 $from->setShowTime(true);
710 $from->setMinuteStepSize(1);
711 $from->setDate(
712 new ilDateTime($user?->getTimeLimitFrom(), IL_CAL_UNIX)
713 );
714 yield $from;
715
716 $to = new ilDateTimeInputGUI($this->lng->txt('crs_to'), 'time_limit_until');
717 $to->setRequired(true);
718 $to->setShowTime(true);
719 $to->setMinuteStepSize(1);
720 $to->setDate(
721 new ilDateTime($user?->getTimeLimitUntil(), IL_CAL_UNIX)
722 );
723 yield $to;
724 }
This class represents a date/time property in a property form.

◆ buildTimeLimitInput()

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

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

683 {
684 $radg = new ilRadioGroupInputGUI($this->lng->txt('time_limit'), 'time_limit_unlimited');
685 $radg->setRequired(true);
686 $op1 = new ilRadioOption($this->lng->txt('user_access_unlimited'), '1');
687 $radg->addOption($op1);
688 $op2 = new ilRadioOption($this->lng->txt('user_access_limited'), '0');
689 foreach ($this->buildTimeLimitDateInputs($user) as $input) {
690 $op2->addSubItem($input);
691 }
692 $radg->addOption($op2);
693 $radg->setValue(
694 $user?->getTimeLimitUnlimited() ?? false ? '1' : '0'
695 );
696
697 return $radg;
698 }
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 1367 of file class.ilObjUserGUI.php.

1367 : bool
1368 {
1369 return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1370 && (
1371 $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1372 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1373 && in_array(
1374 $this->object->getId(),
1375 $this->access->filterUserIdsByPositionOfCurrentUser(
1378 [$this->object->getId()]
1379 )
1380 )
1381 );
1382 }
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 1323 of file class.ilObjUserGUI.php.

1323 : void
1324 {
1325 if ($this->usrf_ref_id === USER_FOLDER_ID
1326 && (
1327 !$this->rbac_system->checkAccess('visible,read', $this->usrf_ref_id)
1328 || !$this->rbac_system->checkAccess('write', $this->usrf_ref_id)
1329 && (
1330 !$this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1331 || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1332 && !in_array(
1333 $this->object->getId(),
1334 $this->access->filterUserIdsByPositionOfCurrentUser(
1337 [$this->object->getId()]
1338 )
1339 )
1340 )
1341 )
1342 ) {
1343 $this->tpl->setOnScreenMessage(
1344 'failure',
1345 $this->lng->txt('msg_no_perm_modify_user')
1346 );
1347 $this->ctrl->redirectByClass(ilObjUserFolderAccess::class);
1348 }
1349
1350 // if called from local administration $this->usrf_ref_id is category id
1351 // Todo: this has to be fixed. Do not mix user folder id and category id
1352 if ($this->usrf_ref_id !== USER_FOLDER_ID
1353 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1354 $this->tpl->setOnScreenMessage(
1355 'failure',
1356 $this->lng->txt('msg_no_perm_modify_user')
1357 );
1358 $this->redirectToRefId($this->usrf_ref_id);
1359 }
1360 }
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, 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 304 of file class.ilObjUserGUI.php.

304 : void
305 {
306 if (!$this->rbac_system->checkAccess('create_usr', $this->usrf_ref_id)
307 && !$this->rbac_system->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
308 $this->tpl->setOnScreenMessage(
309 'failure',
310 $this->lng->txt('permission_denied')
311 );
313 }
314
315 $this->initCreate();
316 $this->initForm(true, null);
317 $this->renderForm();
318 }
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 502 of file class.ilObjUserGUI.php.

502 : void
503 {
505
506 if ($this->usrf_ref_id != USER_FOLDER_ID) {
507 $this->tabs_gui->clearTargets();
508 }
509
510 // get form
511 $this->initForm(true, $this->object);
512 $this->renderForm();
513 }

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 // learning progress
224 if ($this->rbac_system->checkAccess('read', $this->ref_id) and
227 $this->tabs_gui->addTarget(
228 'learning_progress',
229 $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
230 '',
231 ['illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui']
232 );
233 }
234
235 $this->tabs_gui->addTarget(
236 'user_ownership',
237 $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
238 '',
239 'ilobjectownershipmanagementgui'
240 );
241 }

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

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

1286 : bool
1287 {
1288 $profile_maybe_incomplete = false;
1289
1290 foreach ($this->user_profile->getIgnorableRequiredFields() as $fieldName) {
1291 $elm = $this->form_gui->getItemByPostVar($fieldName);
1292
1293 if (!$elm) {
1294 continue;
1295 }
1296
1297 if ($elm->getRequired()) {
1298 $profile_maybe_incomplete = true;
1299
1300 // Flag as optional
1301 $elm->setRequired(false);
1302 }
1303 }
1304
1305 foreach ($this->user_profile->getAllUserDefinedFields() as $field) {
1306 $elm = $this->form_gui->getItemByPostVar('udf_' . $field->getIdentifier());
1307
1308 if (!$elm) {
1309 continue;
1310 }
1311
1312 if ($elm->getRequired() && $field->isRequired()) {
1313 $profile_maybe_incomplete = true;
1314
1315 // Flag as optional
1316 $elm->setRequired(false);
1317 }
1318 }
1319
1320 return $profile_maybe_incomplete;
1321 }

◆ initCreate()

ilObjUserGUI::initCreate ( )
private

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

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

521 : void {
522 $this->form_gui = new ilPropertyFormGUI();
523 $this->form_gui->setFormAction(
524 $this->ctrl->getFormActionByClass(self::class)
525 );
526
527 $this->form_gui->setTitle($this->lng->txt('usr_new'));
528 if ($user !== null) {
529 $this->form_gui->setTitle($this->lng->txt('usr_edit'));
530 }
531
532 $this->form_gui->addItem(
533 $this->buildSectionHeader('login_data')
534 );
535
536 $this->form_gui->addItem(
538 );
539
540 if ($user !== null) {
541 $id = $this->buildNonEditableInput('usr_id', (string) $user->getId());
542 $this->form_gui->addItem($id);
543 }
544
545 $this->form_gui->addItem(
546 $this->buildLoginInput($user)
547 );
548
549 if ($this->user->getId() === (int) SYSTEM_USER_ID
550 || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
551 || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
552 $this->form_gui->addItem(
554 );
555 }
556
558 $this->form_gui->addItem(
560 );
561 }
562
564
565 $this->form_gui = $this->user_profile->addFieldsToForm(
566 $this->form_gui,
567 $this->context,
568 $do_require,
569 $user,
570 [Alias::class]
571 );
572
573 $this->form_gui->addItem(
574 $this->buildSectionHeader('settings')
575 );
576
577 $this->form_gui = $this->user_settings->addSectionsToLegacyForm(
578 $this->form_gui,
579 [AvailablePages::MainSettings, AvailablePages::PrivacySettings],
580 $this->context,
581 $user
582 );
583
585
586 if ($user === null) {
587 $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
588 } else {
589 $this->form_gui->addCommandButton('update', $this->lng->txt('save'));
590 }
591 $this->form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
592 }
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:

◆ moveFileToStorage()

ilObjUserGUI::moveFileToStorage ( )
private

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

833 {
834 $uploads = $this->uploads->getResults();
835 $upload_tmp_name = $_FILES['userfile']['tmp_name'];
836 $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
837
838 $existing_rid = $this->object->getAvatarRid();
839 $revision_title = 'Avatar for user ' . $this->object->getLogin();
840 $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
841
842 if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
843 $stream = Streams::ofResource(
844 fopen($upload_tmp_name, 'r')
845 );
846
847 if ($existing_rid === null) {
848 return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
849 }
850
851 $this->irss->manage()->appendNewRevisionFromStream(
852 $existing_rid,
853 $stream,
854 $this->stakeholder,
855 $revision_title
856 );
857 return $existing_rid;
858 }
859
860 if ($avatar_upload_result === null) {
861 return null;
862 }
863
864 if ($existing_rid === null) {
865 return $this->irss->manage()->upload(
866 $avatar_upload_result,
867 $this->stakeholder,
868 $revision_title
869 );
870 }
871
872 $this->irss->manage()->replaceWithUpload(
873 $existing_rid,
874 $avatar_upload_result,
875 $this->stakeholder,
876 $revision_title
877 );
878 return $existing_rid;
879 }
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 1395 of file class.ilObjUserGUI.php.

1395 : void
1396 {
1397 if ($this->usrf_ref_id === USER_FOLDER_ID) {
1398 $this->ctrl->redirectByClass(ilObjUserFolderAccess::class);
1399 }
1400
1401 $this->redirectToRefId($this->usrf_ref_id);
1402 }

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

881 : void
882 {
883 $webspace_dir = ilFileUtils::getWebspaceDir();
884 $image_dir = $webspace_dir . '/usr_images';
885 $file = $image_dir . '/usr_' . $this->object->getId() . '.' . 'jpg';
886 $thumb_file = $image_dir . '/usr_' . $this->object->getId() . '_small.jpg';
887 $xthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xsmall.jpg';
888 $xxthumb_file = $image_dir . '/usr_' . $this->object->getId() . '_xxsmall.jpg';
889 $upload_file = $image_dir . '/upload_' . $this->object->getId();
890
891 // remove user pref file name
892 $this->object->setPref('profile_image', '');
893 $this->object->update();
894 $this->tpl->setOnScreenMessage('success', $this->lng->txt('user_image_removed'));
895
896 if (is_file($file)) {
897 unlink($file);
898 }
899 if (is_file($thumb_file)) {
900 unlink($thumb_file);
901 }
902 if (is_file($xthumb_file)) {
903 unlink($xthumb_file);
904 }
905 if (is_file($xxthumb_file)) {
906 unlink($xxthumb_file);
907 }
908 if (is_file($upload_file)) {
909 unlink($upload_file);
910 }
911
912 $this->editObject();
913 }
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 1362 of file class.ilObjUserGUI.php.

1362 : void
1363 {
1364 $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1365 }

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

+ Here is the caller graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

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

1027 : void
1028 {
1029 $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1030 $table_gui->resetOffset();
1031 $table_gui->resetFilter();
1032 $this->roleassignmentObject();
1033 }

◆ retrieveAllowIncompleteProfileFromPost()

ilObjUserGUI::retrieveAllowIncompleteProfileFromPost ( )
private

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

1384 : bool
1385 {
1386 return $this->post_wrapper->retrieve(
1387 'ignore_rf',
1388 $this->refinery->byTrying([
1389 $this->refinery->kindlyTo()->bool(),
1390 $this->refinery->always(false)
1391 ])
1392 );
1393 }

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

986 : void
987 {
988 $this->tabs->activateTab('role_assignment');
989
990 if (!$this->checkAccessToRolesTab()) {
991 $this->tpl->setOnScreenMessage(
992 'failure',
993 $this->lng->txt('msg_no_perm_view_roles_of_user'),
994 true
995 );
996 $this->ctrl->redirectByClass(self::class, 'edit');
997 }
998
999 $req_filtered_roles = $this->user_request->getFilteredRoles();
1001 'filtered_roles',
1002 ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1003 );
1004
1005 $filtered_roles = ilSession::get('filtered_roles');
1006 if ($filtered_roles > 5) {
1007 ilSession::set('filtered_roles', 0);
1008 }
1009
1010 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1011
1012 // init table
1013 $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1014
1015 $tab->parse($this->object->getId());
1016 $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1017 }
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 323 of file class.ilObjUserGUI.php.

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

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

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

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: