ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjUserGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct ( $a_data, int $a_id, bool $a_call_by_reference=false, bool $a_prepare_output=true, ILIAS\UI\Factory $uiFactory=null, ILIAS\UI\Renderer $uiRenderer=null)
 
 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 ()
 Display user edit form. More...
 
 getValues ()
 Get values from user object and put them into form. More...
 
 initForm (string $a_mode)
 Init user form. More...
 
 uploadUserPictureObject ()
 upload user image (original method by ratana ty) More...
 
 removeUserPictureObject ()
 remove user image More...
 
 assignSaveObject ()
 assign users to role More...
 
 roleassignmentObject ()
 display role assignment panel More...
 
 applyFilterObject ()
 Apply filter. More...
 
 resetFilterObject ()
 Reset filter. More...
 
 __getDateSelect (string $a_type, string $a_varname, string $a_selected)
 
 __toUnix (array $a_time_arr)
 
 __unsetSessionVariables ()
 
 __buildFilterSelect ()
 
- Public Member Functions inherited from ilObjectGUI
 __construct ($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
 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] don't belong to the current 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...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 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)
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html Should be overwritten and redirect to settings screen. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

ilCtrl $ilCtrl
 
array $gender
 
int $user_ref_id
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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
 

Protected Member Functions

 setTitleAndDescription ()
 
 getTabs ()
 
 loadValuesFromForm (string $a_mode='create')
 
 loadUserDefinedDataFromForm (?ilObjUser $user=null)
 
 isSettingChangeable (string $a_field)
 
 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 ()
 
 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...
 
 initCreationForms (string $new_type)
 Init creation forms. More...
 
 getCreationFormsHTML (array $forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm (string $new_type)
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 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...
 
 initImportForm (string $new_type)
 
 importFileObject (int $parent_id=null)
 
 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...
 
 fillCloneTemplate (?string $tpl_name, string $type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. 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...
 
 showCustomIconsEditing ( $input_colspan=1, ilPropertyFormGUI $form=null, $as_section=true)
 show edit section of custom icons for container More...
 

Protected Attributes

bool $update
 
array $selectable_roles
 
int $default_role
 
ilUserDefinedFields $user_defined_fields
 
array $back_target
 
ilPropertyFormGUI $form_gui
 
ILIAS User StandardGUIRequest $user_request
 
int $usrf_ref_id
 
ILIAS UI Factory $uiFactory
 
ILIAS UI Renderer $uiRenderer
 
string $requested_letter = ""
 
string $requested_baseClass = ""
 
string $requested_search = ""
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Factory $refinery
 
ilFavouritesManager $favourites
 
ilObjectCustomIconFactory $custom_icon_factory
 
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 = ""
 

Private Member Functions

 checkUserWriteRight ()
 

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)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjUserGUI

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de ilObjUserGUI: ilLearningProgressGUI, ilObjectOwnershipManagementGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilObjUserGUI::__construct (   $a_data,
int  $a_id,
bool  $a_call_by_reference = false,
bool  $a_prepare_output = true,
ILIAS\UI\Factory  $uiFactory = null,
ILIAS\UI\Renderer  $uiRenderer = null 
)

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

References $DIC, $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$ref_id, $uiFactory, $uiRenderer, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), and ilLanguage\loadLanguageModule().

54  {
55  global $DIC;
56 
57  if (null === $uiFactory) {
58  $uiFactory = $DIC->ui()->factory();
59  }
60  $this->uiFactory = $uiFactory;
61 
62  if (null === $uiRenderer) {
63  $uiRenderer = $DIC->ui()->renderer();
64  }
65  $this->uiRenderer = $uiRenderer;
66 
67  $ilCtrl = $DIC['ilCtrl'];
68  $lng = $DIC['lng'];
69 
70  $this->type = "usr";
71  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
72  $this->usrf_ref_id = $this->ref_id;
73 
74  $this->ctrl = $ilCtrl;
75  $this->ctrl->saveParameter($this, array('obj_id', 'letter'));
76  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "letter", $this->requested_letter);
77  //$this->ctrl->setContext($this->object->getId(), 'usr');
78  $lng->loadLanguageModule('user');
79 
80  // for gender selection. don't change this
81  // maybe deprecated
82  $this->gender = array(
83  'n' => "salutation_n",
84  'm' => "salutation_m",
85  'f' => "salutation_f",
86  );
87 
88  $this->user_request = new \ILIAS\User\StandardGUIRequest(
89  $DIC->http(),
90  $DIC->refinery()
91  );
92 
93  $this->requested_letter = $this->user_request->getLetter();
94  $this->requested_baseClass = $this->user_request->getBaseClass();
95  $this->requested_search = $this->user_request->getSearch();
96  }
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: feed.php:28
ilLanguage $lng
ILIAS UI Renderer $uiRenderer
__construct(Container $dic, ilPlugin $plugin)
ILIAS UI Factory $uiFactory
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

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

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

1891  : string
1892  {
1893  $action[0] = $this->lng->txt('assigned_roles');
1894  $action[1] = $this->lng->txt('all_roles');
1895  $action[2] = $this->lng->txt('all_global_roles');
1896  $action[3] = $this->lng->txt('all_local_roles');
1897  $action[4] = $this->lng->txt('internal_local_roles_only');
1898  $action[5] = $this->lng->txt('non_internal_local_roles_only');
1899 
1901  ilSession::get("filtered_roles"),
1902  "filter",
1903  $action,
1904  false,
1905  true
1906  );
1907  }
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 233 of file class.ilObjUserGUI.php.

References ilUserDefinedFields\_getInstance().

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

◆ __getDateSelect()

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

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

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

1832  : string {
1833  $year = null;
1834  switch ($a_type) {
1835  case "minute":
1836  for ($i = 0; $i <= 60; $i++) {
1837  $days[$i] = $i < 10 ? "0" . $i : $i;
1838  }
1839  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1840 
1841  case "hour":
1842  for ($i = 0; $i < 24; $i++) {
1843  $days[$i] = $i < 10 ? "0" . $i : $i;
1844  }
1845  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1846 
1847  case "day":
1848  for ($i = 1; $i < 32; $i++) {
1849  $days[$i] = $i < 10 ? "0" . $i : $i;
1850  }
1851  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $days, false, true);
1852 
1853  case "month":
1854  for ($i = 1; $i < 13; $i++) {
1855  $month[$i] = $i < 10 ? "0" . $i : $i;
1856  }
1857  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $month, false, true);
1858 
1859  case "year":
1860  if ($a_selected < date('Y')) {
1861  $start = $a_selected;
1862  } else {
1863  $start = date('Y');
1864  }
1865 
1866  for ($i = $start; $i < ((int) date("Y") + 11); ++$i) {
1867  $year[$i] = $i;
1868  }
1869  return ilLegacyFormElementsUtil::formSelect($a_selected, $a_varname, $year, false, true);
1870  }
1871  return "";
1872  }
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.
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

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

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

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

1874  : int // Missing array type.
1875  {
1876  return mktime(
1877  $a_time_arr["hour"],
1878  $a_time_arr["minute"],
1879  $a_time_arr["second"],
1880  $a_time_arr["month"],
1881  $a_time_arr["day"],
1882  $a_time_arr["year"]
1883  );
1884  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References ilSession\clear().

1886  : void
1887  {
1888  ilSession::clear("filtered_roles");
1889  }
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 1913 of file class.ilObjUserGUI.php.

References $DIC, $GLOBALS, ilObjectGUI\$ilias, $ilUser, ilFrameTargetInfo\_getFrame(), ilMail\_getInstallationSignature(), ilObjUser\_lookupId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ANONYMOUS_USER_ID, ilPersonalProfileGUI\CHANGE_EMAIL_CMD, ilCtrl\clearParametersByClass(), ILIAS\Repository\ctrl(), exit, ILIAS\Repository\lng(), ILIAS\Repository\object(), ilCtrl\redirectByClass(), ROLE_FOLDER_ID, ilCtrl\setParameterByClass(), ilCtrl\setTargetScript(), ilUtil\stripSlashes(), SYSTEM_FOLDER_ID, and USER_FOLDER_ID.

1913  : void
1914  {
1915  global $DIC;
1916 
1917  $ilLocator = $DIC['ilLocator'];
1918 
1919  $ilLocator->clearItems();
1920 
1921  if ($this->admin_mode == "settings") { // system settings
1922  $this->ctrl->setParameterByClass(
1923  "ilobjsystemfoldergui",
1924  "ref_id",
1926  );
1927  $ilLocator->addItem(
1928  $this->lng->txt("administration"),
1929  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
1930  ilFrameTargetInfo::_getFrame("MainContent")
1931  );
1932 
1933  if ($this->requested_ref_id == USER_FOLDER_ID) {
1934  $ilLocator->addItem(
1935  $this->lng->txt("obj_" . ilObject::_lookupType(
1936  ilObject::_lookupObjId($this->requested_ref_id)
1937  )),
1938  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view")
1939  );
1940  } elseif ($this->requested_ref_id == ROLE_FOLDER_ID) {
1941  $ilLocator->addItem(
1942  $this->lng->txt("obj_" . ilObject::_lookupType(
1943  ilObject::_lookupObjId($this->requested_ref_id)
1944  )),
1945  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
1946  );
1947  }
1948 
1949  if ($this->obj_id > 0) {
1950  $ilLocator->addItem(
1951  $this->object->getTitle(),
1952  $this->ctrl->getLinkTarget($this, "view")
1953  );
1954  }
1955  }
1956  }
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_FOLDER_ID
Definition: constants.php:35
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
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 ( )

Apply filter.

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

References roleassignmentObject().

1809  : void
1810  {
1811  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
1812  $table_gui->writeFilterToSession(); // writes filter to session
1813  $table_gui->resetOffset(); // sets record offest to 0 (first page)
1814  $this->roleassignmentObject();
1815  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
roleassignmentObject()
display role assignment panel
+ Here is the call graph for this function:

◆ assignSaveObject()

ilObjUserGUI::assignSaveObject ( )

assign users to role

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

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

1685  : void
1686  {
1687  global $DIC;
1688 
1689  $rbacsystem = $DIC['rbacsystem'];
1690  $rbacadmin = $DIC['rbacadmin'];
1691  $rbacreview = $DIC['rbacreview'];
1692 
1693  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1694  $this->ilias->raiseError(
1695  $this->lng->txt("msg_no_perm_assign_role_to_user"),
1696  $this->ilias->error_obj->MESSAGE
1697  );
1698  }
1699 
1700  $selected_roles = $this->user_request->getRoleIds();
1701  $posted_roles = $this->user_request->getPostedRoleIds();
1702 
1703  // prevent unassignment of system role from system user
1704  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1705  $selected_roles[] = SYSTEM_ROLE_ID;
1706  }
1707 
1708  $global_roles_all = $rbacreview->getGlobalRoles();
1709  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
1710  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1711  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1712  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1713 
1714  $user_not_allowed_to_change_admin_role_assginements =
1715  !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($this->user->getId()));
1716 
1717  if ($user_not_allowed_to_change_admin_role_assginements
1718  && in_array(SYSTEM_ROLE_ID, $assigned_roles_all)) {
1719  $selected_roles[] = SYSTEM_ROLE_ID;
1720  }
1721 
1722  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1723 
1724  if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
1725  || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
1726  $this->tpl->setOnScreenMessage(
1727  'failure',
1728  $this->lng->txt('msg_min_one_role') . '<br/>' . $this->lng->txt('action_aborted'),
1729  true
1730  );
1731  $this->ctrl->redirect($this, 'roleassignment');
1732  }
1733 
1734  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1735  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1736  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1737  continue;
1738  }
1739  $rbacadmin->deassignUser($role, $this->object->getId());
1740  }
1741 
1742  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1743  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1744  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1745  continue;
1746  }
1747  $rbacadmin->assignUser($role, $this->object->getId(), false);
1748  }
1749 
1750  // update object data entry (to update last modification date)
1751  $this->object->update();
1752 
1753  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_roleassignment_changed"), true);
1754 
1755  if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
1756  $this->ctrl->redirect($this, 'roleassignment');
1757  } else {
1758  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1759  }
1760  }
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
global $DIC
Definition: feed.php:28
header include for all ilias files.
+ Here is the call graph for this function:

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

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

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

144  : void
145  {
146  ilSession::clear("saved_post");
147 
148  if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
149  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
150  } else {
151  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
152  }
153  }
static clear(string $a_var)
+ Here is the call graph for this function:

◆ checkUserWriteRight()

ilObjUserGUI::checkUserWriteRight ( )
private

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

2161  : void
2162  {
2163  if ($this->usrf_ref_id == USER_FOLDER_ID
2164  && (
2165  !$this->rbac_system->checkAccess('visible,read', $this->usrf_ref_id)
2166  || !$this->rbac_system->checkAccess('write', $this->usrf_ref_id)
2167  && (
2168  !$this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
2169  || $this->access->checkPositionAccess(\ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id)
2170  && !in_array(
2171  $this->object->getId(),
2172  $this->access->filterUserIdsByPositionOfCurrentUser(
2175  [$this->object->getId()]
2176  )
2177  )
2178  )
2179  )
2180  ) {
2181  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
2182  }
2183 
2184  // if called from local administration $this->usrf_ref_id is category id
2185  // Todo: this has to be fixed. Do not mix user folder id and category id
2186  if ($this->usrf_ref_id != USER_FOLDER_ID
2187  && !$this->rbac_system->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
2188  $this->ilias->raiseError($this->lng->txt('msg_no_perm_modify_user'), $this->ilias->error_obj->MESSAGE);
2189  }
2190  }
const USER_FOLDER_ID
Definition: constants.php:33
header include for all ilias files.
+ 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 358 of file class.ilObjUserGUI.php.

References $DIC, ilObjectGUI\$tpl, initCreate(), initForm(), ILIAS\Repository\lng(), and ilGlobalTemplateInterface\setContent().

358  : void
359  {
360  global $DIC;
361 
362  $tpl = $DIC['tpl'];
363  $rbacsystem = $DIC['rbacsystem'];
364 
365  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id)
366  && !$rbacsystem->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
367  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
368  }
369 
370  $this->initCreate();
371  $this->initForm("create");
372  $tpl->setContent($this->form_gui->getHTML());
373  }
initForm(string $a_mode)
Init user form.
global $DIC
Definition: feed.php:28
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
header include for all ilias files.
+ Here is the call graph for this function:

◆ editObject()

ilObjUserGUI::editObject ( )

Display user edit form.

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

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

Referenced by removeUserPictureObject().

543  : void
544  {
545  $this->checkUserWriteRight();
546 
547  if ($this->usrf_ref_id != USER_FOLDER_ID) {
548  $this->tabs_gui->clearTargets();
549  }
550 
551  // get form
552  $this->initForm("edit");
553  $this->getValues();
554  $this->showAcceptedTermsOfService();
555  $this->tpl->setContent($this->form_gui->getHTML());
556  }
getValues()
Get values from user object and put them into form.
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 98 of file class.ilObjUserGUI.php.

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

98  : void
99  {
100  $next_class = $this->ctrl->getNextClass($this);
101  $cmd = $this->ctrl->getCmd();
102 
103  $this->prepareOutput();
104 
105  switch ($next_class) {
106  case "illearningprogressgui":
107  $new_gui = new ilLearningProgressGUI(
110  $this->object->getId()
111  );
112  $this->ctrl->forwardCommand($new_gui);
113  break;
114 
115  case "ilobjectownershipmanagementgui":
116  $gui = new ilObjectOwnershipManagementGUI($this->object->getId());
117  $this->ctrl->forwardCommand($gui);
118  break;
119 
120  default:
121  if ($cmd == "" || $cmd == "view") {
122  $cmd = "edit";
123  }
124  $cmd .= "Object";
125  $this->$cmd();
126  break;
127  }
128  }
const USER_FOLDER_ID
Definition: constants.php:33
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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:

◆ getAdminTabs()

ilObjUserGUI::getAdminTabs ( )

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

References getTabs().

155  : void
156  {
157  $this->getTabs();
158  }
+ Here is the call graph for this function:

◆ getTabs()

ilObjUserGUI::getTabs ( )
protected

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

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

Referenced by getAdminTabs().

160  : void
161  {
162  global $DIC;
163 
164  $rbacsystem = $DIC['rbacsystem'];
165  $ilHelp = $DIC['ilHelp'];
166 
167  $this->tabs_gui->clearTargets();
168 
169  $ilHelp->setScreenIdComponent("usr");
170 
171  if ($this->requested_search) {
172  $this->tabs_gui->setBackTarget(
173  $this->lng->txt("search_results"),
174  ilSession::get("usr_search_link")
175  );
176 
177  $this->tabs_gui->addTarget(
178  "properties",
179  $this->ctrl->getLinkTarget($this, "edit"),
180  array("edit", "", "view"),
181  get_class($this),
182  "",
183  true
184  );
185  } else {
186  $this->tabs_gui->addTarget(
187  "properties",
188  $this->ctrl->getLinkTarget($this, "edit"),
189  array("edit", "", "view"),
190  get_class($this)
191  );
192  }
193 
194  $this->tabs_gui->addTarget(
195  "role_assignment",
196  $this->ctrl->getLinkTarget($this, "roleassignment"),
197  array("roleassignment"),
198  get_class($this)
199  );
200 
201  // learning progress
202  if ($rbacsystem->checkAccess('read', $this->ref_id) and
204  ilObjUserTracking::_enabledUserRelatedData()) {
205  $this->tabs_gui->addTarget(
206  'learning_progress',
207  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
208  '',
209  array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui')
210  );
211  }
212 
213  $this->tabs_gui->addTarget(
214  'user_ownership',
215  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
216  '',
217  'ilobjectownershipmanagementgui'
218  );
219  }
static get(string $a_var)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValues()

ilObjUserGUI::getValues ( )

Get values from user object and put them into form.

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

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

Referenced by editObject().

905  : void
906  {
907  $data = array();
908 
909  // login data
910  $data["auth_mode"] = $this->object->getAuthMode();
911  $data["login"] = $this->object->getLogin();
912  //$data["passwd"] = "********";
913  //$data["passwd2"] = "********";
914  $data["ext_account"] = $this->object->getExternalAccount();
915 
916  // system information
917  $data["create_date"] = ilDatePresentation::formatDate(new ilDateTime(
918  $this->object->getCreateDate(),
920  ));
921  $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
922  $data["approve_date"] = ($this->object->getApproveDate() != "")
923  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getApproveDate(), IL_CAL_DATETIME))
924  : null;
925  $data["agree_date"] = ($this->object->getAgreeDate() != "")
926  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getAgreeDate(), IL_CAL_DATETIME))
927  : null;
928  $data["last_login"] = ($this->object->getLastLogin() != "")
929  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getLastLogin(), IL_CAL_DATETIME))
930  : null;
931  $data["active"] = $this->object->getActive();
932  $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited() ? '1' : '0';
933 
934  $data["time_limit_from"] = $this->object->getTimeLimitFrom()
935  ? new ilDateTime($this->object->getTimeLimitFrom(), IL_CAL_UNIX)
936  : null;
937  $data["time_limit_until"] = $this->object->getTimeLimitUntil()
938  ? new ilDateTime($this->object->getTimeLimitUntil(), IL_CAL_UNIX)
939  : null;
940 
941  // personal data
942  $data["gender"] = $this->object->getGender();
943  $data["firstname"] = $this->object->getFirstname();
944  $data["lastname"] = $this->object->getLastname();
945  $data["title"] = $this->object->getUTitle();
946  $data['birthday'] = $this->object->getBirthday()
947  ? new ilDate($this->object->getBirthday(), IL_CAL_DATE)
948  : null;
949  $data["institution"] = $this->object->getInstitution();
950  $data["department"] = $this->object->getDepartment();
951  $data["street"] = $this->object->getStreet();
952  $data["city"] = $this->object->getCity();
953  $data["zipcode"] = $this->object->getZipcode();
954  $data["country"] = $this->object->getCountry();
955  $data["sel_country"] = $this->object->getSelectedCountry();
956  $data["phone_office"] = $this->object->getPhoneOffice();
957  $data["phone_home"] = $this->object->getPhoneHome();
958  $data["phone_mobile"] = $this->object->getPhoneMobile();
959  $data["fax"] = $this->object->getFax();
960  $data["email"] = $this->object->getEmail();
961  $data["second_email"] = $this->object->getSecondEmail();
962  $data["hobby"] = $this->object->getHobby();
963  $data["referral_comment"] = $this->object->getComment();
964 
965  // interests
966  $data["interests_general"] = $this->object->getGeneralInterests();
967  $data["interests_help_offered"] = $this->object->getOfferingHelp();
968  $data["interests_help_looking"] = $this->object->getLookingForHelp();
969 
970  // other data
971  $data["matriculation"] = $this->object->getMatriculation();
972  $data["client_ip"] = $this->object->getClientIP();
973 
974  // user defined fields
975  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
976  $user_defined_data = $this->object->getUserDefinedData();
977  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
978  $data["udf_" . $field_id] = $user_defined_data["f_" . $field_id] ?? "";
979  }
980 
981  // settings
982  $data["language"] = $this->object->getLanguage();
983  $data["skin_style"] = $this->object->skin . ":" . $this->object->prefs["style"];
984  $data["hits_per_page"] = $this->object->prefs["hits_per_page"] ?? "";
985  $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"] ?? "";
986  $data['bs_allow_to_contact_me'] = ($this->object->prefs['bs_allow_to_contact_me'] ?? "") == 'y';
987  $data['chat_osc_accept_msg'] = ($this->object->prefs['chat_osc_accept_msg'] ?? "") == 'y';
988  $data['chat_broadcast_typing'] = ($this->object->prefs['chat_broadcast_typing'] ?? "") == 'y';
989  $data["session_reminder_enabled"] = (int) ($this->object->prefs["session_reminder_enabled"] ?? 0);
990 
991  $data["send_mail"] = (($this->object->prefs['send_info_mails'] ?? "") == 'y');
992 
993  $this->form_gui->setValuesByArray($data);
994  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
const IL_CAL_DATE
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 2089 of file class.ilObjUserGUI.php.

References ilObjectGUI\$object, ilObjectGUI\$user, ilUserDefinedFields\_getInstance(), ilUserDefinedFields\getDefinitions(), ilUserProfile\getIgnorableRequiredSettings(), ILIAS\Repository\lng(), and ilNonEditableValueGUI\setValue().

Referenced by loadUserDefinedDataFromForm(), and saveObject().

2089  : bool
2090  {
2091  $profile_maybe_incomplete = false;
2092 
2093  foreach (ilUserProfile::getIgnorableRequiredSettings() as $fieldName) {
2094  $elm = $this->form_gui->getItemByPostVar($fieldName);
2095 
2096  if (!$elm) {
2097  continue;
2098  }
2099 
2100  if ($elm->getRequired()) {
2101  $profile_maybe_incomplete = true;
2102 
2103  // Flag as optional
2104  $elm->setRequired(false);
2105  }
2106  }
2107 
2109  foreach ($user_defined_fields->getDefinitions() as $definition) {
2110  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
2111 
2112  if (!$elm) {
2113  continue;
2114  }
2115  if ($elm->getRequired() && $definition['required']) {
2116  $profile_maybe_incomplete = true;
2117 
2118  // Flag as optional
2119  $elm->setRequired(false);
2120  }
2121  }
2122 
2123  return $profile_maybe_incomplete;
2124  }
ilUserDefinedFields $user_defined_fields
static getIgnorableRequiredSettings()
Returns an array of all ignorable profiel fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreate()

ilObjUserGUI::initCreate ( )

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

References $DIC, $ilUser, ILIAS\LTI\ToolProvider\$key, $keys, 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().

290  : void
291  {
292  global $DIC;
293 
294  $rbacreview = $DIC['rbacreview'];
295  $ilUser = $DIC['ilUser'];
296 
297  if ($this->usrf_ref_id != USER_FOLDER_ID) {
298  $this->tabs_gui->clearTargets();
299  }
300 
301  // role selection
302  $obj_list = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
303  $rol = array();
304  foreach ($obj_list as $obj_data) {
305  // allow only 'assign_users' marked roles if called from category
306  if ($this->object->getRefId() != USER_FOLDER_ID and !in_array(
308  $rbacreview->assignedRoles($ilUser->getId())
309  )) {
310  if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
311  continue;
312  }
313  }
314  // exclude anonymous role from list
315  if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID) {
316  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
317  if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(
319  $rbacreview->assignedRoles($ilUser->getId())
320  )) {
321  $rol[$obj_data["obj_id"]] = $obj_data["title"];
322  }
323  }
324  }
325 
326  // raise error if there is no global role user can be assigned to
327  if (!count($rol)) {
328  $this->ilias->raiseError(
329  $this->lng->txt("msg_no_roles_users_can_be_assigned_to"),
330  $this->ilias->error_obj->MESSAGE
331  );
332  }
333 
334  $keys = array_keys($rol);
335 
336  // set pre defined user role to default
337  if (in_array(4, $keys)) {
338  $this->default_role = 4;
339  } else {
340  if (count($keys) > 1 and in_array(2, $keys)) {
341  // remove admin role as preselectable role
342  foreach ($keys as $key => $val) {
343  if ($val == 2) {
344  unset($keys[$key]);
345  break;
346  }
347  }
348  }
349 
350  $this->default_role = array_shift($keys);
351  }
352  $this->selectable_roles = $rol;
353  }
const USER_FOLDER_ID
Definition: constants.php:33
const SYSTEM_ROLE_ID
Definition: constants.php:29
global $DIC
Definition: feed.php:28
$keys
Definition: metadata.php:204
string $key
Consumer key/client ID value.
Definition: System.php:193
header include for all ilias files.
const ROLE_FOLDER_ID
Definition: constants.php:34
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
$ilUser
Definition: imgupload.php:34
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 999 of file class.ilObjUserGUI.php.

References $_SERVER, Vendor\Package\$a, $DIC, Vendor\Package\$e, ilObjectGUI\$id, $ilSetting, $ilUser, $lang, ilObjectGUI\$lng, $name, XapiProxy\$req, ilObjectGUI\$settings, ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_getLastHistoryDataByUserId(), ilObjUser\_getPersonalPicturePath(), ilAuthUtils\_isExternalAccountEnabled(), ilSystemStyleSettings\_lookupActivatedStyle(), ilDatePresentation\formatDate(), ilAuthUtils\getAuthModeTranslation(), ilUserDefinedFields\getChangeableLocalUserAdministrationDefinitions(), ilUserDefinedFields\getDefinitions(), ilCtrl\getFormAction(), ilCustomUserFieldsHelper\getInstance(), ilSecuritySettingsChecker\getPasswordRequirementsInfo(), IL_CAL_UNIX, ILIAS\Repository\int(), isSettingChangeable(), ILIAS\Repository\lng(), ilLanguage\loadLanguageModule(), ILIAS\Repository\object(), ilCheckboxInputGUI\setChecked(), ilImageFileInputGUI\setImage(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setRows(), ilPasswordInputGUI\setUseStripSlashes(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, ilLanguage\txt(), ILIAS\Repository\user(), USER_FOLDER_ID, and ilUtil\yn2tf().

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

999  : void
1000  {
1001  global $DIC;
1002 
1003  $lng = $DIC['lng'];
1004  $ilCtrl = $DIC['ilCtrl'];
1005  $ilSetting = $DIC['ilSetting'];
1006  $ilClientIniFile = $DIC['ilClientIniFile'];
1007  $ilUser = $DIC['ilUser'];
1008 
1009  $settings = $ilSetting->getAll();
1010 
1011  $this->form_gui = new ilPropertyFormGUI();
1012  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1013  if ($a_mode == "create") {
1014  $this->form_gui->setTitle($lng->txt("usr_new"));
1015  } else {
1016  $this->form_gui->setTitle($lng->txt("usr_edit"));
1017  }
1018 
1019  // login data
1020  $sec_l = new ilFormSectionHeaderGUI();
1021  $sec_l->setTitle($lng->txt("login_data"));
1022  $this->form_gui->addItem($sec_l);
1023 
1024  // authentication mode
1025  $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
1026  $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode");
1027  $option = array();
1028  foreach ($active_auth_modes as $auth_name => $auth_key) {
1029  if ($auth_name == 'default') {
1030  $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
1031  } else {
1032  // begin-patch ldap_multiple
1033  #$name = $this->lng->txt('auth_'.$auth_name);
1034  $name = ilAuthUtils::getAuthModeTranslation($auth_key, $auth_name);
1035  // end-patch ldap_multiple
1036  }
1037  $option[$auth_name] = $name;
1038  }
1039  $am->setOptions($option);
1040  $this->form_gui->addItem($am);
1041 
1042  if ($a_mode == "edit") {
1043  $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id");
1044  $id->setValue($this->object->getId());
1045  $this->form_gui->addItem($id);
1046  }
1047 
1048  // login
1049  $lo = new ilUserLoginInputGUI($lng->txt("login"), "login");
1050  $lo->setRequired(true);
1051  if ($a_mode == "edit") {
1052  $lo->setCurrentUserId($this->object->getId());
1053  try {
1054  $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
1055  $lo->setInfo(
1056  sprintf(
1057  $this->lng->txt('usr_loginname_history_info'),
1058  ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)),
1059  $last_history_entry[0]
1060  )
1061  );
1062  } catch (ilUserException $e) {
1063  }
1064  }
1065 
1066  $this->form_gui->addItem($lo);
1067 
1068  if ($this->user->getId() === (int) SYSTEM_USER_ID
1069  || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
1070  || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
1071 
1072  // passwords
1073  // @todo: do not show passwords, if there is not a single auth, that
1074  // allows password setting
1075  $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd");
1076  $pw->setUseStripSlashes(false);
1077  $pw->setSize(32);
1078  $pw->setMaxLength(80); // #17221
1079  $pw->setValidateAuthPost("auth_mode");
1080  if ($a_mode == "create") {
1081  $pw->setRequiredOnAuth(true);
1082  }
1084  $this->form_gui->addItem($pw);
1085  // @todo: invisible/hidden passwords
1086  }
1087 
1088  // external account
1090  $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account");
1091  $ext->setSize(40);
1092  $ext->setMaxLength(250);
1093  $ext->setInfo($lng->txt("user_ext_account_desc"));
1094  $this->form_gui->addItem($ext);
1095  }
1096 
1097  // login data
1098  $sec_si = new ilFormSectionHeaderGUI();
1099  $sec_si->setTitle($this->lng->txt("system_information"));
1100  $this->form_gui->addItem($sec_si);
1101 
1102  // create date, approve date, agreement date, last login
1103  if ($a_mode == "edit") {
1104  $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner");
1105  foreach ($sia as $a) {
1106  $siai = new ilNonEditableValueGUI($lng->txt($a), $a);
1107  $this->form_gui->addItem($siai);
1108  }
1109  }
1110 
1111  // active
1112  $ac = new ilCheckboxInputGUI($lng->txt("active"), "active");
1113  $ac->setChecked(true);
1114  $this->form_gui->addItem($ac);
1115 
1116  // access @todo: get fields right (names change)
1117  $lng->loadLanguageModule('crs');
1118 
1119  // access
1120  $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
1121  $radg->setValue(1);
1122  $radg->setRequired(true);
1123  $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), '1');
1124  $radg->addOption($op1);
1125  $op2 = new ilRadioOption($lng->txt("user_access_limited"), '0');
1126  $radg->addOption($op2);
1127 
1128  // access.from
1129  $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
1130  $acfrom->setRequired(true);
1131  $acfrom->setShowTime(true);
1132  $acfrom->setMinuteStepSize(1);
1133  $op2->addSubItem($acfrom);
1134 
1135  // access.to
1136  $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
1137  $acto->setRequired(true);
1138  $acto->setShowTime(true);
1139  $acto->setMinuteStepSize(1);
1140  $op2->addSubItem($acto);
1141 
1142  // $this->form_gui->addItem($ac);
1143  $this->form_gui->addItem($radg);
1144 
1145  // personal data
1146  if (
1147  $this->isSettingChangeable('gender') or
1148  $this->isSettingChangeable('firstname') or
1149  $this->isSettingChangeable('lastname') or
1150  $this->isSettingChangeable('title') or
1151  $this->isSettingChangeable('personal_image') or
1152  $this->isSettingChangeable('birhtday')
1153  ) {
1154  $sec_pd = new ilFormSectionHeaderGUI();
1155  $sec_pd->setTitle($this->lng->txt("personal_data"));
1156  $this->form_gui->addItem($sec_pd);
1157  }
1158 
1159  // gender
1160  if ($this->isSettingChangeable('gender')) {
1161  $gndr = new ilRadioGroupInputGUI($lng->txt("salutation"), "gender");
1162  $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]);
1163  $neutral = new ilRadioOption($lng->txt("salutation_n"), "n");
1164  $gndr->addOption($neutral);
1165  $female = new ilRadioOption($lng->txt("salutation_f"), "f");
1166  $gndr->addOption($female);
1167  $male = new ilRadioOption($lng->txt("salutation_m"), "m");
1168  $gndr->addOption($male);
1169  $this->form_gui->addItem($gndr);
1170  }
1171 
1172  // firstname, lastname, title
1173  $fields = [
1174  "firstname" => true,
1175  "lastname" => true,
1176  "title" => isset($settings["require_title"]) && $settings["require_title"]
1177  ];
1178  foreach ($fields as $field => $req) {
1179  $max_len = $field === 'title' ? 32 : 128;
1180  if ($this->isSettingChangeable($field)) {
1181  // #18795
1182  $caption = ($field == "title")
1183  ? "person_title"
1184  : $field;
1185  $inp = new ilTextInputGUI($lng->txt($caption), $field);
1186  $inp->setSize(32);
1187  $inp->setMaxLength($max_len);
1188  $inp->setRequired($req);
1189  $this->form_gui->addItem($inp);
1190  }
1191  }
1192 
1193  // personal image
1194  if ($this->isSettingChangeable('upload')) {
1195  $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
1196  if ($a_mode == "edit" || $a_mode == "upload") {
1198  $this->object->getId(),
1199  "small",
1200  true,
1201  true
1202  ));
1203  }
1204  $this->form_gui->addItem($pi);
1205  }
1206 
1207  if ($this->isSettingChangeable('birthday')) {
1208  $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday');
1209  $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]);
1210  $this->form_gui->addItem($birthday);
1211  }
1212 
1213  // institution, department, street, city, zip code, country, phone office
1214  // phone home, phone mobile, fax, e-mail
1215  $fields = array(
1216  array("institution", 40, 80),
1217  array("department", 40, 80),
1218  array("street", 40, 40),
1219  array("city", 40, 40),
1220  array("zipcode", 10, 10),
1221  array("country", 40, 40),
1222  array("sel_country"),
1223  array("phone_office", 30, 30),
1224  array("phone_home", 30, 30),
1225  array("phone_mobile", 30, 30),
1226  array("fax", 30, 30)
1227  );
1228 
1229  $counter = 0;
1230  foreach ($fields as $field) {
1231  if (!$counter++ and $this->isSettingChangeable($field[0])) {
1232  // contact data
1233  $sec_cd = new ilFormSectionHeaderGUI();
1234  $sec_cd->setTitle($this->lng->txt("contact_data"));
1235  $this->form_gui->addItem($sec_cd);
1236 
1237  // org units
1238  if ($a_mode == "edit") {
1239  $orgus = new ilNonEditableValueGUI($lng->txt('objs_orgu'), 'org_units');
1240  $orgus->setValue($this->object->getOrgUnitsRepresentation());
1241  $this->form_gui->addItem($orgus);
1242  }
1243  }
1244  if ($this->isSettingChangeable($field[0])) {
1245  if ($field[0] != "sel_country") {
1246  $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]);
1247  $inp->setSize($field[1]);
1248  $inp->setMaxLength($field[2]);
1249  $inp->setRequired(isset($settings["require_" . $field[0]]) &&
1250  $settings["require_" . $field[0]]);
1251  $this->form_gui->addItem($inp);
1252  } else {
1253  // country selection
1254  $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]);
1255  $cs->setRequired(isset($settings["require_" . $field[0]]) &&
1256  $settings["require_" . $field[0]]);
1257  $this->form_gui->addItem($cs);
1258  }
1259  }
1260  }
1261 
1262  // email
1263  if ($this->isSettingChangeable('email')) {
1264  $em = new ilEMailInputGUI($lng->txt("email"), "email");
1265  $em->setRequired(isset($settings["require_email"]) &&
1266  $settings["require_email"]);
1267  $em->setMaxLength(128);
1268  $this->form_gui->addItem($em);
1269  }
1270 
1271  // second email
1272  if ($this->isSettingChangeable('second_email')) {
1273  $em = new ilEMailInputGUI($lng->txt("second_email"), "second_email");
1274 
1275  $this->form_gui->addItem($em);
1276  }
1277 
1278  // interests/hobbies
1279  if ($this->isSettingChangeable('hobby')) {
1280  $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby");
1281  $hob->setRows(3);
1282  $hob->setCols(40);
1283  $hob->setRequired(isset($settings["require_hobby"]) &&
1284  $settings["require_hobby"]);
1285  $this->form_gui->addItem($hob);
1286  }
1287 
1288  // referral comment
1289  if ($this->isSettingChangeable('referral_comment')) {
1290  $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment");
1291  $rc->setRows(3);
1292  $rc->setCols(40);
1293  $rc->setRequired(isset($settings["require_referral_comment"]) &&
1294  $settings["require_referral_comment"]);
1295  $this->form_gui->addItem($rc);
1296  }
1297 
1298  // interests
1299 
1300  $sh = new ilFormSectionHeaderGUI();
1301  $sh->setTitle($lng->txt("interests"));
1302  $this->form_gui->addItem($sh);
1303 
1304  $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
1305  foreach ($multi_fields as $multi_field) {
1306  if ($this->isSettingChangeable($multi_field)) {
1307  // see ilUserProfile
1308  $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field);
1309  $ti->setMulti(true);
1310  $ti->setMaxLength(40);
1311  $ti->setSize(40);
1312  $ti->setRequired(isset($settings["require_" . $multi_field]) &&
1313  $settings["require_" . $multi_field]);
1314  $this->form_gui->addItem($ti);
1315  }
1316  }
1317 
1318  // other information
1319  if ($this->isSettingChangeable('user_profile_other')) {
1320  $sec_oi = new ilFormSectionHeaderGUI();
1321  $sec_oi->setTitle($this->lng->txt("user_profile_other"));
1322  $this->form_gui->addItem($sec_oi);
1323  }
1324 
1325  // matriculation number
1326  if ($this->isSettingChangeable('matriculation')) {
1327  $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation");
1328  $mr->setSize(40);
1329  $mr->setMaxLength(40);
1330  $mr->setRequired(isset($settings["require_matriculation"]) &&
1331  $settings["require_matriculation"]);
1332  $this->form_gui->addItem($mr);
1333  }
1334 
1335  // client IP
1336  $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip");
1337  $ip->setSize(40);
1338  $ip->setMaxLength(255);
1339  $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" .
1340  '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>");
1341  $this->form_gui->addItem($ip);
1342 
1343  // additional user defined fields
1345 
1346  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1347  $all_defs = $user_defined_fields->getDefinitions();
1348  } else {
1350  }
1351 
1352  foreach ($all_defs as $definition) {
1353  $f_property = ilCustomUserFieldsHelper::getInstance()->getFormPropertyForDefinition($definition, true);
1354  if ($f_property instanceof ilFormPropertyGUI) {
1355  $this->form_gui->addItem($f_property);
1356  }
1357  }
1358 
1359  // settings
1360  if (
1361  $a_mode == 'create' or
1362  $this->isSettingChangeable('language') or
1363  $this->isSettingChangeable('skin_style') or
1364  $this->isSettingChangeable('hits_per_page') or
1365  $this->isSettingChangeable('hide_own_online_status') or
1366  $this->isSettingChangeable('bs_allow_to_contact_me') or
1367  $this->isSettingChangeable('chat_osc_accept_msg') or
1368  $this->isSettingChangeable('chat_broadcast_typing')
1369  ) {
1370  $sec_st = new ilFormSectionHeaderGUI();
1371  $sec_st->setTitle($this->lng->txt("settings"));
1372  $this->form_gui->addItem($sec_st);
1373  }
1374 
1375  // role
1376  if ($a_mode == "create") {
1377  $role = new ilSelectInputGUI(
1378  $lng->txt("default_role"),
1379  'default_role'
1380  );
1381  $role->setRequired(true);
1382  $role->setValue($this->default_role);
1383  $role->setOptions($this->selectable_roles);
1384  $this->form_gui->addItem($role);
1385  }
1386 
1387  // language
1388  if ($this->isSettingChangeable('language')) {
1389  $languages = $this->lng->getInstalledLanguages();
1390  $this->lng->loadLanguageModule('meta');
1391  $options = [];
1392  foreach ($languages as $l) {
1393  $options[$l] = $lng->txt("meta_l_" . $l);
1394  }
1395  $lang = new ilSelectInputGUI(
1396  $this->lng->txt('language'),
1397  'language'
1398  );
1399  $lang->setOptions($options);
1400  $lang->setValue($ilSetting->get("language"));
1401  if (count($options) <= 1) {
1402  $lang->setDisabled(true);
1403  }
1404  $this->form_gui->addItem($lang);
1405  }
1406 
1407  // skin/style
1408  if ($this->isSettingChangeable('skin_style')) {
1409  $sk = new ilSelectInputGUI(
1410  $lng->txt("skin_style"),
1411  'skin_style'
1412  );
1413 
1414  $skins = ilStyleDefinition::getAllSkins();
1415 
1416  $options = array();
1417  if (is_array($skins)) {
1418  $sk = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
1419 
1420  $options = array();
1421  foreach ($skins as $skin) {
1422  foreach ($skin->getStyles() as $style) {
1423  if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId())) {
1424  continue;
1425  }
1426 
1427  $options[$skin->getId() . ":" . $style->getId()] = $skin->getName() . " / " . $style->getName();
1428  }
1429  }
1430  }
1431  $sk->setOptions($options);
1432  $sk->setValue($ilClientIniFile->readVariable("layout", "skin") .
1433  ":" . $ilClientIniFile->readVariable("layout", "style"));
1434 
1435  $this->form_gui->addItem($sk);
1436  }
1437 
1438  // hits per page
1439  if ($this->isSettingChangeable('hits_per_page')) {
1440  $hpp = new ilSelectInputGUI(
1441  $lng->txt("hits_per_page"),
1442  'hits_per_page'
1443  );
1444  $options = array(10 => 10,
1445  15 => 15,
1446  20 => 20,
1447  30 => 30,
1448  40 => 40,
1449  50 => 50,
1450  100 => 100,
1451  9999 => $this->lng->txt("no_limit")
1452  );
1453  $hpp->setOptions($options);
1454  $hpp->setValue($ilSetting->get("hits_per_page"));
1455  $this->form_gui->addItem($hpp);
1456  }
1457 
1458  // hide online status
1459  if ($this->isSettingChangeable('hide_own_online_status')) {
1460  $lng->loadLanguageModule("awrn");
1461 
1462  $default = ($ilSetting->get('hide_own_online_status') == "n")
1463  ? $this->lng->txt("user_awrn_show")
1464  : $this->lng->txt("user_awrn_hide");
1465 
1466  $options = array(
1467  "" => $this->lng->txt("user_awrn_default") . " (" . $default . ")",
1468  "n" => $this->lng->txt("user_awrn_show"),
1469  "y" => $this->lng->txt("user_awrn_hide")
1470  );
1471  $os = new ilSelectInputGUI($lng->txt("awrn_user_show"), "hide_own_online_status");
1472  $os->setOptions($options);
1473  $os->setDisabled((bool) $ilSetting->get("usr_settings_disable_hide_own_online_status"));
1474  $os->setInfo($lng->txt("awrn_hide_from_awareness_info"));
1475  $this->form_gui->addItem($os);
1476 
1477  //$os = new ilCheckboxInputGUI($lng->txt("awrn_hide_from_awareness"), "hide_own_online_status");
1478  //$this->form_gui->addItem($os);
1479  }
1480 
1481  // allow to contact me
1482  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
1483  $lng->loadLanguageModule('buddysystem');
1484  $os = new ilCheckboxInputGUI($lng->txt('buddy_allow_to_contact_me'), 'bs_allow_to_contact_me');
1485  if ($a_mode == 'create') {
1486  $os->setChecked(ilUtil::yn2tf($ilSetting->get('bs_allow_to_contact_me', 'n')));
1487  }
1488  $this->form_gui->addItem($os);
1489  }
1490  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
1491  $lng->loadLanguageModule('chatroom');
1492  $chat_osc_acm = new ilCheckboxInputGUI($lng->txt('chat_osc_accept_msg'), 'chat_osc_accept_msg');
1493  if ($a_mode == 'create') {
1494  $chat_osc_acm->setChecked(ilUtil::yn2tf($ilSetting->get('chat_osc_accept_msg', 'n')));
1495  }
1496  $this->form_gui->addItem($chat_osc_acm);
1497  }
1498 
1499  if ((int) $ilSetting->get('session_reminder_enabled')) {
1500  $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
1501  $cb->setValue(1);
1502  $this->form_gui->addItem($cb);
1503  }
1504 
1505  // Options
1506  if ($this->isSettingChangeable('send_mail')) {
1507  $sec_op = new ilFormSectionHeaderGUI();
1508  $sec_op->setTitle($this->lng->txt("options"));
1509  $this->form_gui->addItem($sec_op);
1510  }
1511 
1512  // send email
1513  $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail');
1514  $se->setInfo($lng->txt('inform_user_mail_info'));
1515  $se->setValue('y');
1516  $se->setChecked(($ilUser->getPref('send_info_mails') == 'y'));
1517  $this->form_gui->addItem($se);
1518 
1519  // ignore required fields
1520  $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf');
1521  $irf->setInfo($lng->txt('ignore_required_fields_info'));
1522  $irf->setValue(1);
1523  $this->form_gui->addItem($irf);
1524 
1525  // @todo: handle all required fields
1526 
1527  // command buttons
1528  if ($a_mode == "create" || $a_mode == "save") {
1529  $this->form_gui->addCommandButton("save", $lng->txt("save"));
1530  }
1531  if ($a_mode == "edit" || $a_mode == "update") {
1532  $this->form_gui->addCommandButton("update", $lng->txt("save"));
1533  }
1534  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
1535  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilUserDefinedFields $user_defined_fields
const USER_FOLDER_ID
Definition: constants.php:33
static getAuthModeTranslation(string $a_auth_key, string $auth_name='')
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
loadLanguageModule(string $a_module)
Load language module.
setOptions(array $a_options)
static _getActiveAuthModes()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
static _getAuthModeName($a_auth_key)
isSettingChangeable(string $a_field)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
catch(\Exception $e) $req
Definition: xapiproxy.php:93
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
static _getLastHistoryDataByUserId(int $a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
ilLanguage $lng
This class represents a property in a property form.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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()
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)
$lang
Definition: xapiexit.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
global $ilSetting
Definition: privfeed.php:17
This class represents a text area property in a property form.
$ilUser
Definition: imgupload.php:34
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static yn2tf(string $a_yn)
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
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 1537 of file class.ilObjUserGUI.php.

References $DIC, $ilSetting, ilObjectGUI\$settings, and USER_FOLDER_ID.

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

1537  : bool
1538  {
1539  global $DIC;
1540 
1541  $ilSetting = $DIC['ilSetting'];
1542  static $settings = null;
1543 
1544  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1545  return true;
1546  }
1547 
1548  if ($settings == null) {
1549  $settings = $ilSetting->getAll();
1550  }
1551  return (bool) ($settings['usr_settings_changeable_lua_' . $a_field] ?? false);
1552  }
const USER_FOLDER_ID
Definition: constants.php:33
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17
ilSetting $settings
+ Here is the caller graph for this function:

◆ loadUserDefinedDataFromForm()

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

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

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

Referenced by saveObject().

727  : void
728  {
729  if (!$user) {
731  }
732 
734  if ($this->usrf_ref_id == USER_FOLDER_ID) {
735  $all_defs = $user_defined_fields->getDefinitions();
736  } else {
738  }
739  $udf = [];
740  foreach ($all_defs as $definition) {
741  $f = "udf_" . $definition['field_id'];
742  $item = $this->form_gui->getItemByPostVar($f);
743  if ($item && !$item->getDisabled()) {
744  $udf[$definition['field_id']] = $this->form_gui->getInput($f);
745  }
746  }
747  $user->setUserDefinedData($udf);
748  }
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 558 of file class.ilObjUserGUI.php.

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

Referenced by loadUserDefinedDataFromForm(), and saveObject().

558  : ilObjUser
559  {
560  global $DIC;
561 
562  $user = null;
563  $ilUser = $DIC['ilUser'];
564 
565  switch ($a_mode) {
566  case 'create':
567  $user = new ilObjUser();
568  break;
569 
570  case 'update':
572  break;
573  }
574 
575  $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
576  $user->setTimeLimitFrom($from
577  ? $from->get(IL_CAL_UNIX)
578  : null);
579 
580  $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
581  $user->setTimeLimitUntil($until
582  ? $until->get(IL_CAL_UNIX)
583  : null);
584 
585  $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited'));
586 
587  if ($a_mode == 'create') {
588  $user->setTimeLimitOwner($this->usrf_ref_id);
589  }
590 
591  // Birthday
592  if ($this->isSettingChangeable('birthday')) {
593  $bd = $this->form_gui->getItemByPostVar('birthday');
594  $bd = $bd->getDate();
595  $user->setBirthday($bd
596  ? $bd->get(IL_CAL_DATE)
597  : null);
598  }
599 
600  // Login
601  $user->setLogin($this->form_gui->getInput('login'));
602 
603  // Gender
604  if ($this->isSettingChangeable('gender')) {
605  $user->setGender($this->form_gui->getInput('gender'));
606  }
607 
608  // Title
609  if ($this->isSettingChangeable('title')) {
610  $user->setUTitle($this->form_gui->getInput('title'));
611  }
612 
613  // Firstname
614  if ($this->isSettingChangeable('firstname')) {
615  $user->setFirstname($this->form_gui->getInput('firstname'));
616  }
617  // Lastname
618  if ($this->isSettingChangeable('lastname')) {
619  $user->setLastname($this->form_gui->getInput('lastname'));
620  }
621  $user->setFullname();
622 
623  // Institution
624  if ($this->isSettingChangeable('institution')) {
625  $user->setInstitution($this->form_gui->getInput('institution'));
626  }
627 
628  // Department
629  if ($this->isSettingChangeable('department')) {
630  $user->setDepartment($this->form_gui->getInput('department'));
631  }
632  // Street
633  if ($this->isSettingChangeable('street')) {
634  $user->setStreet($this->form_gui->getInput('street'));
635  }
636  // City
637  if ($this->isSettingChangeable('city')) {
638  $user->setCity($this->form_gui->getInput('city'));
639  }
640  // Zipcode
641  if ($this->isSettingChangeable('zipcode')) {
642  $user->setZipcode($this->form_gui->getInput('zipcode'));
643  }
644  // Country
645  if ($this->isSettingChangeable('country')) {
646  $user->setCountry($this->form_gui->getInput('country'));
647  }
648  // Selected Country
649  if ($this->isSettingChangeable('sel_country')) {
650  $user->setSelectedCountry($this->form_gui->getInput('sel_country'));
651  }
652  // Phone Office
653  if ($this->isSettingChangeable('phone_office')) {
654  $user->setPhoneOffice($this->form_gui->getInput('phone_office'));
655  }
656  // Phone Home
657  if ($this->isSettingChangeable('phone_home')) {
658  $user->setPhoneHome($this->form_gui->getInput('phone_home'));
659  }
660  // Phone Mobile
661  if ($this->isSettingChangeable('phone_mobile')) {
662  $user->setPhoneMobile($this->form_gui->getInput('phone_mobile'));
663  }
664  // Fax
665  if ($this->isSettingChangeable('fax')) {
666  $user->setFax($this->form_gui->getInput('fax'));
667  }
668  // Matriculation
669  if ($this->isSettingChangeable('matriculation')) {
670  $user->setMatriculation($this->form_gui->getInput('matriculation'));
671  }
672  // Email
673  if ($this->isSettingChangeable('email')) {
674  $user->setEmail($this->form_gui->getInput('email'));
675  }
676  // Second Email
677  if ($this->isSettingChangeable('second_email')) {
678  $user->setSecondEmail($this->form_gui->getInput('second_email'));
679  }
680  // Hobby
681  if ($this->isSettingChangeable('hobby')) {
682  $user->setHobby($this->form_gui->getInput('hobby'));
683  }
684  // Referral Comment
685  if ($this->isSettingChangeable('referral_comment')) {
686  $user->setComment($this->form_gui->getInput('referral_comment'));
687  }
688 
689  $general_interests = is_array($this->form_gui->getInput('interests_general'))
690  ? $this->form_gui->getInput('interests_general')
691  : [];
692  $user->setGeneralInterests($general_interests);
693 
694  $offering_help = is_array($this->form_gui->getInput('interests_help_offered'))
695  ? $this->form_gui->getInput('interests_help_offered')
696  : [];
697  $user->setOfferingHelp($offering_help);
698 
699  $looking_for_help = is_array($this->form_gui->getInput('interests_help_looking'))
700  ? $this->form_gui->getInput('interests_help_looking')
701  : [];
702  $user->setLookingForHelp($looking_for_help);
703 
704  // ClientIP
705  $user->setClientIP($this->form_gui->getInput('client_ip'));
706 
707  // Google maps
708  $user->setLatitude($this->form_gui->getInput('latitude'));
709  $user->setLongitude($this->form_gui->getInput('longitude'));
710  $zoom = (int) $this->form_gui->getInput('loc_zoom');
711  if ($zoom == 0) {
712  $zoom = null;
713  }
714  $user->setLocationZoom($zoom);
715 
716  // External account
717  $user->setAuthMode($this->form_gui->getInput('auth_mode'));
718  $user->setExternalAccount($this->form_gui->getInput('ext_account'));
719 
720  if ((int) $user->getActive() != (int) $this->form_gui->getInput('active')) {
721  $user->setActive($this->form_gui->getInput('active'), $ilUser->getId());
722  }
723 
724  return $user;
725  }
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)
global $DIC
Definition: feed.php:28
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)
$ilUser
Definition: imgupload.php:34
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:

◆ removeUserPictureObject()

ilObjUserGUI::removeUserPictureObject ( )

remove user image

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

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

1648  : void
1649  {
1650  $webspace_dir = ilFileUtils::getWebspaceDir();
1651  $image_dir = $webspace_dir . "/usr_images";
1652  $file = $image_dir . "/usr_" . $this->object->getId() . "." . "jpg";
1653  $thumb_file = $image_dir . "/usr_" . $this->object->getId() . "_small.jpg";
1654  $xthumb_file = $image_dir . "/usr_" . $this->object->getId() . "_xsmall.jpg";
1655  $xxthumb_file = $image_dir . "/usr_" . $this->object->getId() . "_xxsmall.jpg";
1656  $upload_file = $image_dir . "/upload_" . $this->object->getId();
1657 
1658  // remove user pref file name
1659  $this->object->setPref("profile_image", "");
1660  $this->object->update();
1661  $this->tpl->setOnScreenMessage('success', $this->lng->txt("user_image_removed"));
1662 
1663  if (is_file($file)) {
1664  unlink($file);
1665  }
1666  if (is_file($thumb_file)) {
1667  unlink($thumb_file);
1668  }
1669  if (is_file($xthumb_file)) {
1670  unlink($xthumb_file);
1671  }
1672  if (is_file($xxthumb_file)) {
1673  unlink($xxthumb_file);
1674  }
1675  if (is_file($upload_file)) {
1676  unlink($upload_file);
1677  }
1678 
1679  $this->editObject();
1680  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
editObject()
Display user edit form.
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

Reset filter.

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

References roleassignmentObject().

1820  : void
1821  {
1822  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
1823  $table_gui->resetOffset(); // sets record offest to 0 (first page)
1824  $table_gui->resetFilter(); // clears filter
1825  $this->roleassignmentObject();
1826  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
roleassignmentObject()
display role assignment panel
+ Here is the call graph for this function:

◆ roleassignmentObject()

ilObjUserGUI::roleassignmentObject ( )

display role assignment panel

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

References ilObjectGUI\$access, $DIC, ANONYMOUS_USER_ID, ilSession\get(), ILIAS\Repository\int(), ilOrgUnitPositionAccessHandler\isCurrentUserBasedOnPositionsAllowedTo(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilSession\set().

Referenced by applyFilterObject(), and resetFilterObject().

1765  : void
1766  {
1767  global $DIC;
1768 
1769  $rbacsystem = $DIC['rbacsystem'];
1770  $ilTabs = $DIC['ilTabs'];
1771  $access = $DIC->access();
1772 
1773  $ilTabs->activateTab("role_assignment");
1774 
1775  if ($this->object->getId() === (int) ANONYMOUS_USER_ID
1776  || !$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)
1777  && !$access->isCurrentUserBasedOnPositionsAllowedTo("read_users", array($this->object->getId()))
1778  ) {
1779  $this->ilias->raiseError(
1780  $this->lng->txt("msg_no_perm_assign_role_to_user"),
1781  $this->ilias->error_obj->MESSAGE
1782  );
1783  }
1784 
1785  $filtered_roles = ilSession::get("filtered_roles");
1786  $req_filtered_roles = $this->user_request->getFilteredRoles();
1788  "filtered_roles",
1789  ($req_filtered_roles > 0) ? $req_filtered_roles : $filtered_roles
1790  );
1791 
1792  $filtered_roles = ilSession::get("filtered_roles");
1793  if ($filtered_roles > 5) {
1794  ilSession::set("filtered_roles", 0);
1795  }
1796 
1797  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
1798 
1799  // init table
1800  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
1801 
1802  $tab->parse($this->object->getId());
1803  $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
1804  }
static get(string $a_var)
isCurrentUserBasedOnPositionsAllowedTo(string $permission, array $on_user_ids)
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
header include for all ilias files.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAccessHandler $access
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 378 of file class.ilObjUserGUI.php.

References $DIC, $ilSetting, $ilUser, ilObjectGUI\$tpl, ilAuthUtils\_isExternalAccountEnabled(), ILIAS\Repository\ctrl(), handleIgnoredRequiredFields(), initCreate(), initForm(), ILIAS\Repository\int(), ilUserProfile\isProfileIncomplete(), isSettingChangeable(), ILIAS\Repository\lng(), loadUserDefinedDataFromForm(), loadValuesFromForm(), ilObjUser\PASSWD_PLAIN, ilGlobalTemplateInterface\setContent(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, uploadUserPictureObject(), and ILIAS\Repository\user().

378  : void
379  {
380  global $DIC;
381 
382  $ilAccess = $DIC['ilAccess'];
383  $ilSetting = $DIC['ilSetting'];
384  $tpl = $DIC['tpl'];
385  $ilUser = $DIC['ilUser'];
386  $rbacadmin = $DIC['rbacadmin'];
387  $rbacsystem = $DIC['rbacsystem'];
388 
389  // User folder
390  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id)
391  && !$ilAccess->checkAccess('cat_administrate_users', "", $this->usrf_ref_id)) {
392  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
393  }
394 
395  $this->initCreate();
396  $this->initForm("create");
397 
398  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
399  $profileMaybeIncomplete = false;
400  if ($this->form_gui->getInput('ignore_rf', false)) {
401  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
402  }
403 
404  if ($this->form_gui->checkInput()) {
405  // @todo: external account; time limit check and savings
406 
407  // checks passed. save user
408  $userObj = $this->loadValuesFromForm();
409  if ($this->user->getId() === (int) SYSTEM_USER_ID
410  || !in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->object->getId()))
411  || in_array(SYSTEM_ROLE_ID, $this->rbac_review->assignedRoles($this->user->getId()))) {
412  $userObj->setPasswd($this->form_gui->getInput('passwd'), ilObjUser::PASSWD_PLAIN);
413  }
414  $userObj->setTitle($userObj->getFullname());
415  $userObj->setDescription($userObj->getEmail());
416 
417  $this->loadUserDefinedDataFromForm($userObj);
418 
419  $userObj->create();
420 
422  $userObj->setExternalAccount($this->form_gui->getInput("ext_account"));
423  }
424 
425  // set a timestamp for last_password_change
426  // this ts is needed by ilSecuritySettings
427  $userObj->setLastPasswordChangeTS(time());
428 
429  //insert user data in table user_data
430  $userObj->saveAsNew();
431 
432  // setup user preferences
433  if ($this->isSettingChangeable('language')) {
434  $userObj->setLanguage($this->form_gui->getInput("language"));
435  }
436 
437  if ($this->isSettingChangeable('skin_style')) {
438  //set user skin and style
439  $sknst = explode(":", $this->form_gui->getInput("skin_style"));
440 
441  if ($userObj->getPref("style") != $sknst[1] ||
442  $userObj->getPref("skin") != $sknst[0]) {
443  $userObj->setPref("skin", $sknst[0]);
444  $userObj->setPref("style", $sknst[1]);
445  }
446  }
447  if ($this->isSettingChangeable('hits_per_page')) {
448  $userObj->setPref("hits_per_page", $this->form_gui->getInput("hits_per_page"));
449  }
450  if ($this->isSettingChangeable('hide_own_online_status')) {
451  $userObj->setPref(
452  "hide_own_online_status",
453  $this->form_gui->getInput("hide_own_online_status")
454  );
455  }
456  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
457  $userObj->setPref(
458  'bs_allow_to_contact_me',
459  $this->form_gui->getInput("bs_allow_to_contact_me") ? 'y' : 'n'
460  );
461  }
462  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
463  $userObj->setPref(
464  'chat_osc_accept_msg',
465  $this->form_gui->getInput("chat_osc_accept_msg") ? 'y' : 'n'
466  );
467  }
468  if ($this->isSettingChangeable('chat_broadcast_typing')) {
469  $userObj->setPref(
470  'chat_broadcast_typing',
471  $this->form_gui->getInput("chat_broadcast_typing") ? 'y' : 'n'
472  );
473  }
474  if ((int) $ilSetting->get('session_reminder_enabled')) {
475  $userObj->setPref(
476  'session_reminder_enabled',
477  (int) $this->form_gui->getInput("session_reminder_enabled")
478  );
479  }
480  $userObj->writePrefs();
481 
482  //set role entries
483  $rbacadmin->assignUser(
484  $this->form_gui->getInput("default_role"),
485  $userObj->getId(),
486  true
487  );
488 
489  $msg = $this->lng->txt("user_added");
490 
491  $ilUser->setPref(
492  'send_info_mails',
493  ($this->form_gui->getInput("send_mail") == 'y') ? 'y' : 'n'
494  );
495  $ilUser->writePrefs();
496 
497  $this->object = $userObj;
498 
499  if ($this->isSettingChangeable('upload')) {
500  $this->uploadUserPictureObject();
501  }
502 
503  if ($profileMaybeIncomplete) {
504  if (ilUserProfile::isProfileIncomplete($this->object)) {
505  $this->object->setProfileIncomplete(true);
506  $this->object->update();
507  }
508  }
509 
510  // send new account mail
511  if ($this->form_gui->getInput("send_mail") == 'y') {
512  $acc_mail = new ilAccountMail();
513  $acc_mail->useLangVariablesAsFallback(true);
514  $acc_mail->setAttachConfiguredFiles(true);
515  $acc_mail->setUserPassword($this->form_gui->getInput("passwd"));
516  $acc_mail->setUser($userObj);
517 
518  if ($acc_mail->send()) {
519  $msg .= '<br />' . $this->lng->txt('mail_sent');
520  $this->tpl->setOnScreenMessage('success', $msg, true);
521  } else {
522  $msg .= '<br />' . $this->lng->txt('mail_not_sent');
523  $this->tpl->setOnScreenMessage('info', $msg, true);
524  }
525  } else {
526  $this->tpl->setOnScreenMessage('success', $msg, true);
527  }
528 
529  if (strtolower($this->requested_baseClass) == 'iladministrationgui') {
530  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
531  } else {
532  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
533  }
534  } else {
535  $this->form_gui->setValuesByPost();
536  $tpl->setContent($this->form_gui->getHTML());
537  }
538  }
static isProfileIncomplete(ilObjUser $a_user, bool $a_include_udf=true, bool $a_personal_data_only=true)
Check if all required personal data fields are set.
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
uploadUserPictureObject()
upload user image (original method by ratana ty)
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)
global $DIC
Definition: feed.php:28
loadValuesFromForm(string $a_mode='create')
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
header include for all ilias files.
static _isExternalAccountEnabled()
Check if an external account name is required.
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:34
Class ilAccountMail.
+ Here is the call graph for this function:

◆ setBackTarget()

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

set back tab target

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

227  : void {
228  $this->back_target = array("text" => $a_text,
229  "link" => $a_link
230  );
231  }

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )
protected

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

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

130  : void
131  {
132  if (strtolower(get_class($this->object)) == 'ilobjuser') {
133  $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
134  $this->tpl->setDescription($this->object->getLongDescription());
135  $this->tpl->setTitleIcon(
136  ilUtil::getImagePath("icon_" . $this->object->getType() . ".svg"),
137  $this->lng->txt("obj_" . $this->object->getType())
138  );
139  } else {
140  parent::setTitleAndDescription();
141  }
142  }
static getImagePath(string $img, 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:

◆ uploadUserPictureObject()

ilObjUserGUI::uploadUserPictureObject ( )

upload user image (original method by ratana ty)

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

References $DIC, ILIAS\Repository\ctrl(), ilShellUtil\escapeShellArg(), ilShellUtil\execConvert(), ilFileUtils\getWebspaceDir(), ilShellUtil\isConvertVersionAtLeast(), ILIAS\Repository\lng(), ilFileUtils\moveUploadedFile(), and USER_FOLDER_ID.

Referenced by loadUserDefinedDataFromForm(), and saveObject().

1558  : void
1559  {
1560  global $DIC;
1561 
1562  $rbacsystem = $DIC['rbacsystem'];
1563 
1564  // User folder
1565  if ($this->usrf_ref_id == USER_FOLDER_ID and
1566  !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
1567  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1568  }
1569  // if called from local administration $this->usrf_ref_id is category id
1570  // Todo: this has to be fixed. Do not mix user folder id and category id
1571  if ($this->usrf_ref_id != USER_FOLDER_ID) {
1572  // check if user is assigned to category
1573  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1574  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1575  }
1576  }
1577 
1578  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1579 
1580  if ($_FILES["userfile"]["tmp_name"] == "") {
1581  if ($userfile_input->getDeletionFlag()) {
1582  $this->object->removeUserPicture();
1583  }
1584  return;
1585  }
1586  if ($_FILES["userfile"]["size"] == 0) {
1587  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_no_file"));
1588  } else {
1589  $webspace_dir = ilFileUtils::getWebspaceDir();
1590  $image_dir = $webspace_dir . "/usr_images";
1591  $store_file = "usr_" . $this->object->getId() . "." . "jpg";
1592 
1593  // store filename
1594  $this->object->setPref("profile_image", $store_file);
1595  $this->object->update();
1596 
1597  // move uploaded file
1598  $pi = pathinfo($_FILES["userfile"]["name"]);
1599  $uploaded_file = $image_dir . "/upload_" . $this->object->getId() . "." . $pi["extension"];
1601  $_FILES["userfile"]["tmp_name"],
1602  $_FILES["userfile"]["name"],
1603  $uploaded_file,
1604  false
1605  )) {
1606  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("upload_error", true));
1607  $this->ctrl->redirect($this, "showProfile");
1608  }
1609  chmod($uploaded_file, 0770);
1610 
1611  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1612  // taking only frame [0] to avoid problems with animated gifs
1613  $show_file = "$image_dir/usr_" . $this->object->getId() . ".jpg";
1614  $thumb_file = "$image_dir/usr_" . $this->object->getId() . "_small.jpg";
1615  $xthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xsmall.jpg";
1616  $xxthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xxsmall.jpg";
1617  $uploaded_file = ilShellUtil::escapeShellArg($uploaded_file);
1618  $show_file = ilShellUtil::escapeShellArg($show_file);
1619  $thumb_file = ilShellUtil::escapeShellArg($thumb_file);
1620  $xthumb_file = ilShellUtil::escapeShellArg($xthumb_file);
1621  $xxthumb_file = ilShellUtil::escapeShellArg($xxthumb_file);
1622 
1623  if (ilShellUtil::isConvertVersionAtLeast("6.3.8-3")) {
1625  $uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file
1626  );
1628  $uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file
1629  );
1631  $uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file
1632  );
1634  $uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file
1635  );
1636  } else {
1637  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
1638  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
1639  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
1640  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
1641  }
1642  }
1643  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
const USER_FOLDER_ID
Definition: constants.php:33
static isConvertVersionAtLeast(string $a_version)
Compare convert version numbers.
static escapeShellArg(string $a_arg)
global $DIC
Definition: feed.php:28
header include for all ilias files.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static execConvert(string $args)
execute convert command
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $back_target

array ilObjUserGUI::$back_target
protected

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

◆ $default_role

int ilObjUserGUI::$default_role
protected

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

◆ $form_gui

ilPropertyFormGUI ilObjUserGUI::$form_gui
protected

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

◆ $gender

array ilObjUserGUI::$gender

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

◆ $ilCtrl

ilCtrl ilObjUserGUI::$ilCtrl

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

Referenced by __construct().

◆ $requested_baseClass

string ilObjUserGUI::$requested_baseClass = ""
protected

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

◆ $requested_letter

string ilObjUserGUI::$requested_letter = ""
protected

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

◆ $requested_search

string ilObjUserGUI::$requested_search = ""
protected

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

◆ $selectable_roles

array ilObjUserGUI::$selectable_roles
protected

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

◆ $uiFactory

ILIAS UI Factory ilObjUserGUI::$uiFactory
protected

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

Referenced by __construct().

◆ $uiRenderer

ILIAS UI Renderer ilObjUserGUI::$uiRenderer
protected

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

Referenced by __construct().

◆ $update

bool ilObjUserGUI::$update
protected

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

◆ $user_defined_fields

ilUserDefinedFields ilObjUserGUI::$user_defined_fields
protected

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

◆ $user_ref_id

int ilObjUserGUI::$user_ref_id

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

◆ $user_request

ILIAS User StandardGUIRequest ilObjUserGUI::$user_request
protected

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

◆ $usrf_ref_id

int ilObjUserGUI::$usrf_ref_id
protected

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


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