ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilObjUserGUI Class Reference

Class ilObjUserGUI. More...

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

Public Member Functions

 executeCommand ()
 
 cancelObject ()
 
 getAdminTabs ()
 
 setBackTarget (string $a_text, string $a_link)
 set back tab target More...
 
 __checkUserDefinedRequiredFields ()
 
 __showUserDefinedFields ()
 
 initCreate ()
 
 createObject ()
 Display user create form. More...
 
 saveObject ()
 save user data More...
 
 editObject ()
 
 getValues ()
 
 initForm (string $a_mode)
 Init user form. More...
 
 removeUserPictureObject ()
 
 assignSaveObject ()
 
 roleassignmentObject ()
 
 applyFilterObject ()
 
 resetFilterObject ()
 
 __getDateSelect (string $a_type, string $a_varname, string $a_selected)
 
 __toUnix (array $a_time_arr)
 
 __unsetSessionVariables ()
 
 __buildFilterSelect ()
 
 __sendProfileMail ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Protected Member Functions

 setTitleAndDescription ()
 
 getTabs ()
 
 loadValuesFromForm (string $a_mode='create')
 
 loadUserDefinedDataFromForm (?ilObjUser $user=null)
 
 isSettingChangeable (string $a_field)
 
 uploadUserPicture ()
 upload user image (original method by ratana ty) More...
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 handleIgnoredRequiredFields ()
 Handles ignored required fields by changing the required flag of form elements. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Private Member Functions

 moveFileToStorage ()
 
 checkUserWriteRight ()
 
 renderForm ()
 
 checkAccessToRolesTab ()
 

Private Attributes

ilPropertyFormGUI $form_gui
 
UserGUIRequest $user_request
 
ilHelpGUI $help
 
ilTabsGUI $tabs
 
RepositoryGUIs $repository_guis
 
ilMailMimeSenderFactory $mail_sender_factory
 
FileUpload $uploads
 
ResourceStorageServices $irss
 
ResourceStakeholder $stakeholder
 
ilUserProfile $user_profile
 
string $requested_letter = ''
 
string $requested_baseClass = ''
 
string $requested_search = ''
 
array $back_target
 
bool $update
 
array $selectable_roles
 
int $default_role
 
string $default_layout_and_style
 
ilUserDefinedFields $user_defined_fields
 
int $usrf_ref_id
 
Conductor $legal_documents
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
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 1721 of file class.ilObjUserGUI.php.

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

1721  : string
1722  {
1723  $action[0] = $this->lng->txt('assigned_roles');
1724  $action[1] = $this->lng->txt('all_roles');
1725  $action[2] = $this->lng->txt('all_global_roles');
1726  $action[3] = $this->lng->txt('all_local_roles');
1727  $action[4] = $this->lng->txt('internal_local_roles_only');
1728  $action[5] = $this->lng->txt('non_internal_local_roles_only');
1729 
1731  ilSession::get('filtered_roles'),
1732  'filter',
1733  $action,
1734  false,
1735  true
1736  );
1737  }
static get(string $a_var)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
+ Here is the call graph for this function:

◆ __checkUserDefinedRequiredFields()

ilObjUserGUI::__checkUserDefinedRequiredFields ( )

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

References ilUserDefinedFields\_getInstance().

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

◆ __getDateSelect()

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

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

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

1662  : string {
1663  $year = null;
1664  switch ($a_type) {
1665  case 'minute':
1666  for ($i = 0; $i <= 60; $i++) {
1667  $days[$i] = $i < 10 ? '0' . $i : $i;
1668  }
1669  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1670 
1671  case 'hour':
1672  for ($i = 0; $i < 24; $i++) {
1673  $days[$i] = $i < 10 ? '0' . $i : $i;
1674  }
1675  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1676 
1677  case 'day':
1678  for ($i = 1; $i < 32; $i++) {
1679  $days[$i] = $i < 10 ? '0' . $i : $i;
1680  }
1681  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1682 
1683  case 'month':
1684  for ($i = 1; $i < 13; $i++) {
1685  $month[$i] = $i < 10 ? '0' . $i : $i;
1686  }
1687  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1688 
1689  case 'year':
1690  if ($a_selected < date('Y')) {
1691  $start = $a_selected;
1692  } else {
1693  $start = date('Y');
1694  }
1695 
1696  for ($i = $start; $i < ((int) date('Y') + 11); ++$i) {
1697  $year[$i] = $i;
1698  }
1699  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1700  }
1701  return '';
1702  }
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

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

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

Referenced by loadUserDefinedDataFromForm().

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

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

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

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

255  : void
256  {
257  $user_defined_data = null;
258  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
259 
260  if ($this->object->getType() == 'usr') {
261  $user_defined_data = $this->object->getUserDefinedData();
262  }
263  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
264  $error_post_vars = ilSession::get('error_post_vars');
265  $old = $error_post_vars['udf'][$field_id] ?? $user_defined_data[$field_id];
266 
267  if ($definition['field_type'] == UDF_TYPE_TEXT) {
268  $this->tpl->setCurrentBlock('field_text');
269  $this->tpl->setVariable('FIELD_NAME', 'udf[' . $definition['field_id'] . ']');
270  $this->tpl->setVariable('FIELD_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($old));
271  } else {
272  $this->tpl->setCurrentBlock('field_select');
273  $this->tpl->setVariable(
274  'SELECT_BOX',
276  $old,
277  'udf[' . $definition['field_id'] . ']',
278  $this->user_defined_fields->fieldValuesToSelectArray(
279  $definition['field_values']
280  ),
281  false,
282  true
283  )
284  );
285  }
286  $this->tpl->parseCurrentBlock();
287  $this->tpl->setCurrentBlock('user_defined');
288 
289  if ($definition['required']) {
290  $name = $definition['field_name'] . '<span class="asterisk">*</span>';
291  } else {
292  $name = $definition['field_name'];
293  }
294  $this->tpl->setVariable('TXT_FIELD_NAME', $name);
295  $this->tpl->parseCurrentBlock();
296  }
297  }
static get(string $a_var)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
static prepareFormOutput($a_str, bool $a_strip=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ __toUnix()

ilObjUserGUI::__toUnix ( array  $a_time_arr)

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

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

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References ilSession\clear().

1716  : void
1717  {
1718  ilSession::clear('filtered_roles');
1719  }
static clear(string $a_var)
+ Here is the call graph for this function:

◆ addAdminLocatorItems()

ilObjUserGUI::addAdminLocatorItems ( bool  $do_not_add_object = false)
protected

should be overwritten to add object specific items (repository items are preloaded)

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

References ilFrameTargetInfo\_getFrame(), ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\locator(), ILIAS\Repository\object(), ROLE_FOLDER_ID, SYSTEM_FOLDER_ID, and USER_FOLDER_ID.

1743  : void
1744  {
1745  $this->locator->clearItems();
1746 
1747  if ($this->admin_mode == 'settings') { // system settings
1748  $this->ctrl->setParameterByClass(
1749  'ilobjsystemfoldergui',
1750  'ref_id',
1752  );
1753  $this->locator->addItem(
1754  $this->lng->txt('administration'),
1755  $this->ctrl->getLinkTargetByClass(['iladministrationgui', 'ilobjsystemfoldergui'], ''),
1756  ilFrameTargetInfo::_getFrame('MainContent')
1757  );
1758 
1759  if ($this->requested_ref_id == USER_FOLDER_ID) {
1760  $this->locator->addItem(
1761  $this->lng->txt('obj_' . ilObject::_lookupType(
1762  ilObject::_lookupObjId($this->requested_ref_id)
1763  )),
1764  $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'view')
1765  );
1766  } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1767  $this->locator->addItem(
1768  $this->lng->txt('obj_' . ilObject::_lookupType(
1769  ilObject::_lookupObjId($this->requested_ref_id)
1770  )),
1771  $this->ctrl->getLinkTargetByClass('ilobjrolefoldergui', 'view')
1772  );
1773  }
1774 
1775  if ($this->obj_id > 0) {
1776  $this->locator->addItem(
1777  $this->object->getTitle(),
1778  $this->ctrl->getLinkTarget($this, 'view')
1779  );
1780  }
1781  }
1782  }
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_FOLDER_ID
Definition: constants.php:35
static _lookupObjId(int $ref_id)
const ROLE_FOLDER_ID
Definition: constants.php:34
static _getFrame(string $a_class)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

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

References roleassignmentObject().

1642  : void
1643  {
1644  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1645  $table_gui->writeFilterToSession();
1646  $table_gui->resetOffset();
1647  $this->roleassignmentObject();
1648  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ assignSaveObject()

ilObjUserGUI::assignSaveObject ( )

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

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

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

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

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

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

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

◆ checkAccessToRolesTab()

ilObjUserGUI::checkAccessToRolesTab ( )
private

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

References ILIAS\Repository\access(), ANONYMOUS_USER_ID, ILIAS\Repository\int(), ILIAS\Repository\object(), ilObjUserFolder\ORG_OP_EDIT_USER_ACCOUNTS, and USER_FOLDER_ID.

Referenced by getTabs(), and roleassignmentObject().

1982  : bool
1983  {
1984  return $this->object->getId() !== (int) ANONYMOUS_USER_ID
1985  && (
1986  $this->rbac_system->checkAccess('edit_roleassignment', $this->usrf_ref_id)
1987  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1988  && in_array(
1989  $this->object->getId(),
1990  $this->access->filterUserIdsByPositionOfCurrentUser(
1993  [$this->object->getId()]
1994  )
1995  )
1996  );
1997  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
const USER_FOLDER_ID
Definition: constants.php:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkUserWriteRight()

ilObjUserGUI::checkUserWriteRight ( )
private

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

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

Referenced by editObject(), and loadUserDefinedDataFromForm().

1946  : void
1947  {
1948  if ($this->usrf_ref_id === USER_FOLDER_ID
1949  && (
1950  !$this->rbac_system->checkAccess('visible,read', $this->usrf_ref_id)
1951  || !$this->rbac_system->checkAccess('write', $this->usrf_ref_id)
1952  && (
1953  !$this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1954  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
1955  && !in_array(
1956  $this->object->getId(),
1957  $this->access->filterUserIdsByPositionOfCurrentUser(
1960  [$this->object->getId()]
1961  )
1962  )
1963  )
1964  )
1965  ) {
1966  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1967  }
1968 
1969  // if called from local administration $this->usrf_ref_id is category id
1970  // Todo: this has to be fixed. Do not mix user folder id and category id
1971  if ($this->usrf_ref_id != USER_FOLDER_ID
1972  && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1973  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
1974  }
1975  }
const USER_FOLDER_ID
Definition: constants.php:33
Class ilObjForumAdministration.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createObject()

ilObjUserGUI::createObject ( )

Display user create form.

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

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

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

◆ editObject()

ilObjUserGUI::editObject ( )

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

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

Referenced by removeUserPictureObject().

521  : void
522  {
523  $this->checkUserWriteRight();
524 
525  if ($this->usrf_ref_id != USER_FOLDER_ID) {
526  $this->tabs_gui->clearTargets();
527  }
528 
529  // get form
530  $this->initForm('edit');
531  $this->getValues();
532  $this->renderForm();
533  }
const USER_FOLDER_ID
Definition: constants.php:33
initForm(string $a_mode)
Init user form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjUserGUI::executeCommand ( )

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

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

109  : void
110  {
111  $next_class = $this->ctrl->getNextClass($this);
112  $cmd = $this->ctrl->getCmd();
113 
114  $this->prepareOutput();
115 
116  switch ($next_class) {
117  case 'illearningprogressgui':
118  $new_gui = new ilLearningProgressGUI(
121  $this->object->getId()
122  );
123  $this->ctrl->forwardCommand($new_gui);
124  break;
125 
126  case strtolower(ilObjectOwnershipManagementGUI::class):
127  $this->ctrl->forwardCommand(
128  $this->repository_guis->ownershipManagementGUI(
129  $this->object->getId()
130  )
131  );
132  break;
133 
134  default:
135  if ($cmd == '' || $cmd == 'view') {
136  $cmd = 'edit';
137  }
138  $cmd .= 'Object';
139  $this->$cmd();
140  break;
141  }
142  }
const USER_FOLDER_ID
Definition: constants.php:33
prepareOutput(bool $show_sub_objects=true)
Class ilObjUserTrackingGUI.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjUserGUI::getAdminTabs ( )

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

References getTabs().

169  : void
170  {
171  $this->getTabs();
172  }
+ Here is the call graph for this function:

◆ getTabs()

ilObjUserGUI::getTabs ( )
protected

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

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

Referenced by getAdminTabs().

174  : void
175  {
176  $this->tabs_gui->clearTargets();
177 
178  $this->help->setScreenIdComponent('usr');
179 
180  if ($this->requested_search) {
181  $this->tabs_gui->setBackTarget(
182  $this->lng->txt('search_results'),
183  ilSession::get('usr_search_link')
184  );
185 
186  $this->tabs_gui->addTarget(
187  'properties',
188  $this->ctrl->getLinkTarget($this, 'edit'),
189  ['edit', '', 'view'],
190  get_class($this),
191  '',
192  true
193  );
194  } else {
195  $this->tabs_gui->addTarget(
196  'properties',
197  $this->ctrl->getLinkTarget($this, 'edit'),
198  ['edit', '', 'view'],
199  get_class($this)
200  );
201  }
202 
203  if ($this->checkAccessToRolesTab()) {
204  $this->tabs_gui->addTarget(
205  'role_assignment',
206  $this->ctrl->getLinkTarget($this, 'roleassignment'),
207  ['roleassignment'],
208  get_class($this)
209  );
210  }
211 
212  // learning progress
213  if ($this->rbac_system->checkAccess('read', $this->ref_id) and
215  ilObjUserTracking::_enabledUserRelatedData()) {
216  $this->tabs_gui->addTarget(
217  'learning_progress',
218  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
219  '',
220  ['illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui']
221  );
222  }
223 
224  $this->tabs_gui->addTarget(
225  'user_ownership',
226  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
227  '',
228  'ilobjectownershipmanagementgui'
229  );
230  }
static get(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValues()

ilObjUserGUI::getValues ( )

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

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

Referenced by editObject().

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

◆ handleIgnoredRequiredFields()

ilObjUserGUI::handleIgnoredRequiredFields ( )
protected

Handles ignored required fields by changing the required flag of form elements.

Returns
bool A flag whether the user profile is maybe incomplete after saving the form data

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

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1908  : bool
1909  {
1910  $profile_maybe_incomplete = false;
1911 
1912  foreach ($this->user_profile->getIgnorableRequiredSettings() as $fieldName) {
1913  $elm = $this->form_gui->getItemByPostVar($fieldName);
1914 
1915  if (!$elm) {
1916  continue;
1917  }
1918 
1919  if ($elm->getRequired()) {
1920  $profile_maybe_incomplete = true;
1921 
1922  // Flag as optional
1923  $elm->setRequired(false);
1924  }
1925  }
1926 
1928  foreach ($user_defined_fields->getDefinitions() as $definition) {
1929  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
1930 
1931  if (!$elm) {
1932  continue;
1933  }
1934 
1935  if ($elm->getRequired() && $definition['required']) {
1936  $profile_maybe_incomplete = true;
1937 
1938  // Flag as optional
1939  $elm->setRequired(false);
1940  }
1941  }
1942 
1943  return $profile_maybe_incomplete;
1944  }
ilUserDefinedFields $user_defined_fields
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreate()

ilObjUserGUI::initCreate ( )

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

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

Referenced by createObject(), and saveObject().

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

◆ initForm()

ilObjUserGUI::initForm ( string  $a_mode)

Init user form.

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

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

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

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

◆ isSettingChangeable()

ilObjUserGUI::isSettingChangeable ( string  $a_field)
protected

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

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

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

1410  : bool
1411  {
1412  static $settings = null;
1413 
1414  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1415  return true;
1416  }
1417 
1418  if ($settings == null) {
1419  $settings = $this->settings->getAll();
1420  }
1421  return (bool) ($settings['usr_settings_changeable_lua_' . $a_field] ?? false);
1422  }
const USER_FOLDER_ID
Definition: constants.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilSetting $settings
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadUserDefinedDataFromForm()

ilObjUserGUI::loadUserDefinedDataFromForm ( ?ilObjUser  $user = null)
protected

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

References Vendor\Package\$e, Vendor\Package\$f, ilObjectGUI\$object, ilObjectGUI\$user, __sendProfileMail(), ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilUserDefinedFields\_getInstance(), checkUserWriteRight(), ILIAS\Repository\ctrl(), ilUserDefinedFields\getChangeableLocalUserAdministrationDefinitions(), ilUserDefinedFields\getDefinitions(), handleIgnoredRequiredFields(), initForm(), ILIAS\Repository\int(), isSettingChangeable(), ILIAS\Repository\lng(), loadValuesFromForm(), ILIAS\Repository\object(), ilObjUser\PASSWD_PLAIN, renderForm(), ilObjUser\setUserDefinedData(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, ilObject\update(), ilObjectGUI\updateObject(), uploadUserPicture(), ILIAS\Repository\user(), and USER_FOLDER_ID.

Referenced by saveObject().

668  : void
669  {
670  if (!$user) {
672  }
673 
675  if ($this->usrf_ref_id == USER_FOLDER_ID) {
676  $all_defs = $user_defined_fields->getDefinitions();
677  } else {
679  }
680  $udf = [];
681  foreach ($all_defs as $definition) {
682  $f = "udf_" . $definition['field_id'];
683  $item = $this->form_gui->getItemByPostVar($f);
684  if ($item && !$item->getDisabled()) {
685  $udf[$definition['field_id']] = $this->form_gui->getInput($f);
686  }
687  }
688  $user->setUserDefinedData($udf);
689  }
ilUserDefinedFields $user_defined_fields
const USER_FOLDER_ID
Definition: constants.php:33
setUserDefinedData(array $a_data)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadValuesFromForm()

ilObjUserGUI::loadValuesFromForm ( string  $a_mode = 'create')
protected

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

References ilObjectGUI\$object, ilObjectGUI\$user, ilObjUser\getActive(), IL_CAL_DATE, IL_CAL_UNIX, ILIAS\Repository\int(), isSettingChangeable(), null, ilObjUser\setActive(), ilObjUser\setAuthMode(), ilObjUser\setBirthday(), ilObjUser\setCity(), ilObjUser\setClientIP(), ilObjUser\setComment(), ilObjUser\setCountry(), ilObjUser\setDepartment(), ilObjUser\setEmail(), ilObjUser\setExternalAccount(), ilObjUser\setFax(), ilObjUser\setFirstname(), ilObjUser\setFullname(), ilObjUser\setGender(), ilObjUser\setGeneralInterests(), ilObjUser\setHobby(), ilObjUser\setInstitution(), ilObjUser\setLastname(), ilObjUser\setLatitude(), ilObjUser\setLocationZoom(), ilObjUser\setLogin(), ilObjUser\setLongitude(), ilObjUser\setLookingForHelp(), ilObjUser\setMatriculation(), ilObjUser\setOfferingHelp(), ilObjUser\setPhoneHome(), ilObjUser\setPhoneMobile(), ilObjUser\setPhoneOffice(), ilObjUser\setSecondEmail(), ilObjUser\setSelectedCountry(), ilObjUser\setStreet(), ilObjUser\setTimeLimitFrom(), ilObjUser\setTimeLimitOwner(), ilObjUser\setTimeLimitUnlimited(), ilObjUser\setTimeLimitUntil(), ilObjUser\setUTitle(), ilObjUser\setZipcode(), and ILIAS\Repository\user().

Referenced by loadUserDefinedDataFromForm(), and saveObject().

535  : ilObjUser
536  {
537  $user = null;
538 
539  switch ($a_mode) {
540  case 'create':
541  $user = new ilObjUser();
542  break;
543 
544  case 'update':
546  break;
547  }
548 
549  $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
550  $user->setTimeLimitFrom($from
551  ? $from->get(IL_CAL_UNIX)
552  : null);
553 
554  $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
555  $user->setTimeLimitUntil($until
556  ? $until->get(IL_CAL_UNIX)
557  : null);
558 
559  $user->setTimeLimitUnlimited((bool) $this->form_gui->getInput('time_limit_unlimited'));
560 
561  if ($a_mode == 'create') {
562  $user->setTimeLimitOwner($this->usrf_ref_id);
563  }
564  if ($this->isSettingChangeable('birthday')) {
565  $bd = $this->form_gui->getItemByPostVar('birthday');
566  $bd = $bd->getDate();
567  $user->setBirthday($bd
568  ? $bd->get(IL_CAL_DATE)
569  : null);
570  }
571  $user->setLogin($this->form_gui->getInput('login'));
572  if ($this->isSettingChangeable('gender')) {
573  $user->setGender($this->form_gui->getInput('gender'));
574  }
575  if ($this->isSettingChangeable('title')) {
576  $user->setUTitle($this->form_gui->getInput('title'));
577  }
578  if ($this->isSettingChangeable('firstname')) {
579  $user->setFirstname($this->form_gui->getInput('firstname'));
580  }
581  if ($this->isSettingChangeable('lastname')) {
582  $user->setLastname($this->form_gui->getInput('lastname'));
583  }
584  $user->setFullname();
585  if ($this->isSettingChangeable('institution')) {
586  $user->setInstitution($this->form_gui->getInput('institution'));
587  }
588  if ($this->isSettingChangeable('department')) {
589  $user->setDepartment($this->form_gui->getInput('department'));
590  }
591  if ($this->isSettingChangeable('street')) {
592  $user->setStreet($this->form_gui->getInput('street'));
593  }
594  if ($this->isSettingChangeable('city')) {
595  $user->setCity($this->form_gui->getInput('city'));
596  }
597  if ($this->isSettingChangeable('zipcode')) {
598  $user->setZipcode($this->form_gui->getInput('zipcode'));
599  }
600  if ($this->isSettingChangeable('country')) {
601  $user->setCountry($this->form_gui->getInput('country'));
602  }
603  if ($this->isSettingChangeable('sel_country')) {
604  $user->setSelectedCountry($this->form_gui->getInput('sel_country'));
605  }
606  if ($this->isSettingChangeable('phone_office')) {
607  $user->setPhoneOffice($this->form_gui->getInput('phone_office'));
608  }
609  if ($this->isSettingChangeable('phone_home')) {
610  $user->setPhoneHome($this->form_gui->getInput('phone_home'));
611  }
612  if ($this->isSettingChangeable('phone_mobile')) {
613  $user->setPhoneMobile($this->form_gui->getInput('phone_mobile'));
614  }
615  if ($this->isSettingChangeable('fax')) {
616  $user->setFax($this->form_gui->getInput('fax'));
617  }
618  if ($this->isSettingChangeable('matriculation')) {
619  $user->setMatriculation($this->form_gui->getInput('matriculation'));
620  }
621  if ($this->isSettingChangeable('email')) {
622  $user->setEmail($this->form_gui->getInput('email'));
623  }
624  if ($this->isSettingChangeable('second_email')) {
625  $user->setSecondEmail($this->form_gui->getInput('second_email'));
626  }
627  if ($this->isSettingChangeable('hobby')) {
628  $user->setHobby($this->form_gui->getInput('hobby'));
629  }
630  if ($this->isSettingChangeable('referral_comment')) {
631  $user->setComment($this->form_gui->getInput('referral_comment'));
632  }
633 
634  $general_interests = is_array($this->form_gui->getInput('interests_general'))
635  ? $this->form_gui->getInput('interests_general')
636  : [];
637  $user->setGeneralInterests($general_interests);
638 
639  $offering_help = is_array($this->form_gui->getInput('interests_help_offered'))
640  ? $this->form_gui->getInput('interests_help_offered')
641  : [];
642  $user->setOfferingHelp($offering_help);
643 
644  $looking_for_help = is_array($this->form_gui->getInput('interests_help_looking'))
645  ? $this->form_gui->getInput('interests_help_looking')
646  : [];
647  $user->setLookingForHelp($looking_for_help);
648 
649  $user->setClientIP($this->form_gui->getInput('client_ip'));
650  $user->setLatitude($this->form_gui->getInput('latitude'));
651  $user->setLongitude($this->form_gui->getInput('longitude'));
652  $zoom = (int) $this->form_gui->getInput('loc_zoom');
653  if ($zoom == 0) {
654  $zoom = null;
655  }
656  $user->setLocationZoom($zoom);
657 
658  $user->setAuthMode($this->form_gui->getInput('auth_mode'));
659  $user->setExternalAccount($this->form_gui->getInput('ext_account'));
660 
661  if ((int) $user->getActive() != (int) $this->form_gui->getInput('active')) {
662  $user->setActive((bool) $this->form_gui->getInput('active'), $this->user->getId());
663  }
664 
665  return $user;
666  }
setUTitle(string $a_str)
set user title (note: don&#39;t mix up this method with setTitle() that is derived from ilObject and sets...
setTimeLimitUnlimited(bool $a_unlimited)
setClientIP(string $a_str)
setMatriculation(string $a_str)
setPhoneOffice(string $a_str)
setSelectedCountry(string $a_val)
Set selected country (selection drop down)
setFullname()
builds a string with title + firstname + lastname method is used to build fullname in member variable...
const IL_CAL_UNIX
setTimeLimitUntil(?int $a_until)
isSettingChangeable(string $a_field)
setInstitution(string $a_str)
setCity(string $a_str)
setLatitude(?string $a_latitude)
setComment(string $a_str)
setGender(string $a_str)
setExternalAccount(string $a_str)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setBirthday(?string $a_birthday)
setLogin(string $a_str)
setActive(bool $a_active, int $a_owner=0)
set user active state and updates system fields appropriately
setDepartment(string $a_str)
setOfferingHelp(?array $value=null)
setPhoneHome(string $a_str)
setHobby(string $a_str)
setCountry(string $a_str)
setEmail(string $a_str)
setFax(string $a_str)
setPhoneMobile(string $a_str)
setLastname(string $a_str)
setStreet(string $a_str)
const IL_CAL_DATE
setTimeLimitOwner(int $a_owner)
setSecondEmail(?string $second_email)
setLongitude(?string $a_longitude)
setLocationZoom(?int $a_locationzoom)
setZipcode(string $a_str)
setGeneralInterests(?array $value=null)
setTimeLimitFrom(?int $a_from)
setFirstname(string $a_str)
setAuthMode(?string $a_str)
setLookingForHelp(?array $value=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveFileToStorage()

ilObjUserGUI::moveFileToStorage ( )
private

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

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

Referenced by uploadUserPicture().

1457  {
1458  $uploads = $this->uploads->getResults();
1459  $upload_tmp_name = $_FILES['userfile']['tmp_name'];
1460  $avatar_upload_result = $uploads[$upload_tmp_name] ?? null;
1461 
1462  $existing_rid = null;
1463  if ($this->object->getAvatarRid() !== null) {
1464  $existing_rid = $this->irss->manage()->find($this->object->getAvatarRid());
1465  }
1466 
1467  $revision_title = 'Avatar for user ' . $this->object->getLogin();
1468  $this->stakeholder->setOwner($this->object->getId()); // The Resource is owned by the user we are editing
1469 
1470  if ($avatar_upload_result === null && file_exists($upload_tmp_name)) {
1471  $stream = Streams::ofResource(
1472  fopen($upload_tmp_name, 'r')
1473  );
1474 
1475  if ($existing_rid === null) {
1476  return $this->irss->manage()->stream($stream, $this->stakeholder, $revision_title);
1477  }
1478 
1479  $this->irss->manage()->appendNewRevisionFromStream(
1480  $existing_rid,
1481  $stream,
1482  $this->stakeholder,
1483  $revision_title
1484  );
1485  return $existing_rid;
1486  }
1487 
1488  if ($avatar_upload_result === null) {
1489  return null;
1490  }
1491 
1492  if ($existing_rid === null) {
1493  return $this->irss->manage()->upload(
1494  $avatar_upload_result,
1495  $this->stakeholder,
1496  $revision_title
1497  );
1498  }
1499 
1500  $this->irss->manage()->replaceWithUpload(
1501  $existing_rid,
1502  $avatar_upload_result,
1503  $this->stakeholder,
1504  $revision_title
1505  );
1506  return $existing_rid;
1507  }
FileUpload $uploads
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getResults()
Returns the results of the processing and moving operation of the uploaded files. ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeUserPictureObject()

ilObjUserGUI::removeUserPictureObject ( )

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

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

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

◆ renderForm()

ilObjUserGUI::renderForm ( )
private

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

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

1977  : void
1978  {
1979  $this->tpl->setContent($this->legal_documents->userManagementModals() . $this->form_gui->getHTML());
1980  }
+ Here is the caller graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

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

References roleassignmentObject().

1650  : void
1651  {
1652  $table_gui = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1653  $table_gui->resetOffset();
1654  $table_gui->resetFilter();
1655  $this->roleassignmentObject();
1656  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ roleassignmentObject()

ilObjUserGUI::roleassignmentObject ( )

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

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

Referenced by applyFilterObject(), and resetFilterObject().

1613  : void
1614  {
1615  $this->tabs->activateTab('role_assignment');
1616 
1617  if (!$this->checkAccessToRolesTab()) {
1618  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_view_roles_of_user'), true);
1619  $this->ctrl->redirectByClass(self::class, 'edit');
1620  }
1621 
1622  $req_filtered_roles = $this->user_request->getFilteredRoles();
1624  'filtered_roles',
1625  ($req_filtered_roles > 0) ? $req_filtered_roles : ilSession::get('filtered_roles')
1626  );
1627 
1628  $filtered_roles = ilSession::get('filtered_roles');
1629  if ($filtered_roles > 5) {
1630  ilSession::set('filtered_roles', 0);
1631  }
1632 
1633  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'components/ILIAS/User');
1634 
1635  // init table
1636  $tab = new ilRoleAssignmentTableGUI($this, 'roleassignment');
1637 
1638  $tab->parse($this->object->getId());
1639  $this->tpl->setVariable('ROLES_TABLE', $tab->getHTML());
1640  }
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilObjUserGUI::saveObject ( )

save user data

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

References ilAuthUtils\_isExternalAccountEnabled(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), handleIgnoredRequiredFields(), initCreate(), initForm(), ILIAS\Repository\int(), isSettingChangeable(), ILIAS\Repository\lng(), loadUserDefinedDataFromForm(), loadValuesFromForm(), ilObjUser\PASSWD_PLAIN, renderForm(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, uploadUserPicture(), and ILIAS\Repository\user().

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

◆ setBackTarget()

ilObjUserGUI::setBackTarget ( string  $a_text,
string  $a_link 
)

set back tab target

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

238  : void {
239  $this->back_target = ['text' => $a_text, 'link' => $a_link];
240  }

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )
protected

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

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

144  : void
145  {
146  if (strtolower(get_class($this->object)) == 'ilobjuser') {
147  $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
148  $this->tpl->setDescription($this->object->getLongDescription());
149  $this->tpl->setTitleIcon(
150  ilUtil::getImagePath('standard/icon_' . $this->object->getType() . '.svg'),
151  $this->lng->txt('obj_' . $this->object->getType())
152  );
153  } else {
154  parent::setTitleAndDescription();
155  }
156  }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ uploadUserPicture()

ilObjUserGUI::uploadUserPicture ( )
protected

upload user image (original method by ratana ty)

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

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

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

Field Documentation

◆ $back_target

array ilObjUserGUI::$back_target
private

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

◆ $default_layout_and_style

string ilObjUserGUI::$default_layout_and_style
private

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

◆ $default_role

int ilObjUserGUI::$default_role
private

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

◆ $form_gui

ilPropertyFormGUI ilObjUserGUI::$form_gui
private

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

◆ $help

ilHelpGUI ilObjUserGUI::$help
private

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

◆ $irss

ResourceStorageServices ilObjUserGUI::$irss
private

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

◆ $legal_documents

Conductor ilObjUserGUI::$legal_documents
private

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

◆ $mail_sender_factory

ilMailMimeSenderFactory ilObjUserGUI::$mail_sender_factory
private

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

◆ $repository_guis

RepositoryGUIs ilObjUserGUI::$repository_guis
private

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

◆ $requested_baseClass

string ilObjUserGUI::$requested_baseClass = ''
private

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

◆ $requested_letter

string ilObjUserGUI::$requested_letter = ''
private

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

◆ $requested_search

string ilObjUserGUI::$requested_search = ''
private

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

◆ $selectable_roles

array ilObjUserGUI::$selectable_roles
private

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

◆ $stakeholder

ResourceStakeholder ilObjUserGUI::$stakeholder
private

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

◆ $tabs

ilTabsGUI ilObjUserGUI::$tabs
private

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

◆ $update

bool ilObjUserGUI::$update
private

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

◆ $uploads

FileUpload ilObjUserGUI::$uploads
private

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

◆ $user_defined_fields

ilUserDefinedFields ilObjUserGUI::$user_defined_fields
private

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

◆ $user_profile

ilUserProfile ilObjUserGUI::$user_profile
private

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

◆ $user_request

UserGUIRequest ilObjUserGUI::$user_request
private

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

◆ $usrf_ref_id

int ilObjUserGUI::$usrf_ref_id
private

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


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