ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjUserGUI Class Reference

Class ilObjUserGUI. More...

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

Public Member Functions

 __construct ( $a_data, $a_id, $a_call_by_reference=false, $a_prepare_output=true, ILIAS\UI\Factory $uiFactory=null, ILIAS\UI\Renderer $uiRenderer=null)
 ilObjUserGUI constructor. More...
 
 executeCommand ()
 
 setTitleAndDescription ()
 
 cancelObject ()
 
 getAdminTabs ()
 admin and normal tabs are equal for roles More...
 
 getTabs ()
 get tabs More...
 
 setBackTarget ($a_text, $a_link)
 set back tab target More...
 
 __checkUserDefinedRequiredFields ()
 display user create form More...
 
 __showUserDefinedFields ()
 
 initCreate ()
 
 createObject ()
 Display user create form. More...
 
 saveObject ()
 save user data public More...
 
 updateObject ()
 Update user. More...
 
 getValues ()
 Get values from user object and put them into form. More...
 
 uploadUserPictureObject ()
 upload user image More...
 
 removeUserPictureObject ()
 remove user image More...
 
 assignSaveObject ()
 assign users to role More...
 
 roleassignmentObject ()
 display roleassignment panel More...
 
 applyFilterObject ()
 Apply filter. More...
 
 resetFilterObject ()
 Reset filter. More...
 
 __getDateSelect ($a_type, $a_varname, $a_selected)
 
 __toUnix ($a_time_arr)
 
 __unsetSessionVariables ()
 
 __buildFilterSelect ()
 
 hitsperpageObject ()
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 showUpperIcon ()
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 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 public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

 $ilCtrl
 
 $gender
 
 $type
 
 $user_ref_id
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 loadValuesFromForm ($a_mode='create')
 
 isSettingChangeable ($a_field)
 Check if setting is visible This is the case when called from user folder. More...
 
 handleIgnoredRequiredFields ()
 Handles ignored required fields by changing the required flag of form elements. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 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 public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_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 $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_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...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $uiFactory
 
 $uiRenderer
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilObjUserGUI constructor.

Parameters
$a_data
$a_id
bool$a_call_by_reference
bool$a_prepare_output
\ILIAS\UI\Factory$uiFactory
\ILIAS\UI\Renderer$uiRenderer

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

References $_GET, $DIC, $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$ref_id, $uiFactory, $uiRenderer, and ILIAS\GlobalScreen\Provider\__construct().

64  {
65  global $DIC;
66 
67  if (null === $uiFactory) {
68  $uiFactory = $DIC->ui()->factory();
69  }
70  $this->uiFactory = $uiFactory;
71 
72  if (null === $uiRenderer) {
73  $uiRenderer = $DIC->ui()->renderer();
74  }
75  $this->uiRenderer = $uiRenderer;
76 
77  $ilCtrl = $DIC['ilCtrl'];
78  $lng = $DIC['lng'];
79 
80  define('USER_FOLDER_ID', 7);
81 
82  $this->type = "usr";
83  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
84  $this->usrf_ref_id = &$this->ref_id;
85 
86  $this->ctrl = $ilCtrl;
87  $this->ctrl->saveParameter($this, array('obj_id', 'letter'));
88  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "letter", $_GET["letter"]);
89  $this->ctrl->setContext($this->object->getId(), 'usr');
90  $lng->loadLanguageModule('user');
91 
92  // for gender selection. don't change this
93  // maybe deprecated
94  $this->gender = array(
95  'n' => "salutation_n",
96  'm' => "salutation_m",
97  'f' => "salutation_f",
98  );
99  }
$_GET["client_id"]
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

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

References $_SESSION, and ilUtil\formSelect().

Referenced by roleassignmentObject().

1964  {
1965  $action[0] = $this->lng->txt('assigned_roles');
1966  $action[1] = $this->lng->txt('all_roles');
1967  $action[2] = $this->lng->txt('all_global_roles');
1968  $action[3] = $this->lng->txt('all_local_roles');
1969  $action[4] = $this->lng->txt('internal_local_roles_only');
1970  $action[5] = $this->lng->txt('non_internal_local_roles_only');
1971 
1972  return ilUtil::formSelect($_SESSION['filtered_roles'], "filter", $action, false, true);
1973  }
$_SESSION["AccountId"]
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __checkUserDefinedRequiredFields()

ilObjUserGUI::__checkUserDefinedRequiredFields ( )

display user create form

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

References $_POST, and ilUserDefinedFields\_getInstance().

252  {
253  include_once './Services/User/classes/class.ilUserDefinedFields.php';
254  $this->user_defined_fields = &ilUserDefinedFields::_getInstance();
255 
256  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
257  if ($definition['required'] and !strlen($_POST['udf'][$field_id])) {
258  return false;
259  }
260  }
261  return true;
262  }
static _getInstance()
Get instance.
$_POST["username"]
+ Here is the call graph for this function:

◆ __getDateSelect()

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

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

References $i, and ilUtil\formSelect().

1903  {
1904  switch ($a_type) {
1905  case "minute":
1906  for ($i = 0;$i <= 60;$i++) {
1907  $days[$i] = $i < 10 ? "0" . $i : $i;
1908  }
1909  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
1910 
1911  case "hour":
1912  for ($i = 0;$i < 24;$i++) {
1913  $days[$i] = $i < 10 ? "0" . $i : $i;
1914  }
1915  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
1916 
1917  case "day":
1918  for ($i = 1;$i < 32;$i++) {
1919  $days[$i] = $i < 10 ? "0" . $i : $i;
1920  }
1921  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
1922 
1923  case "month":
1924  for ($i = 1;$i < 13;$i++) {
1925  $month[$i] = $i < 10 ? "0" . $i : $i;
1926  }
1927  return ilUtil::formSelect($a_selected, $a_varname, $month, false, true);
1928 
1929  case "year":
1930  if ($a_selected < date('Y', time())) {
1931  $start = $a_selected;
1932  } else {
1933  $start = date('Y', time());
1934  }
1935 
1936  for ($i = $start;$i < date("Y", time()) + 11;++$i) {
1937  $year[$i] = $i;
1938  }
1939  return ilUtil::formSelect($a_selected, $a_varname, $year, false, true);
1940  }
1941  }
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

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

References $_SESSION, $name, ilUserDefinedFields\_getInstance(), ilUtil\formSelect(), ilUtil\prepareFormOutput(), and UDF_TYPE_TEXT.

266  {
267  include_once './Services/User/classes/class.ilUserDefinedFields.php';
268  $this->user_defined_fields = &ilUserDefinedFields::_getInstance();
269 
270  if ($this->object->getType() == 'usr') {
271  $user_defined_data = $this->object->getUserDefinedData();
272  }
273  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
274  $old = isset($_SESSION["error_post_vars"]["udf"][$field_id]) ?
275  $_SESSION["error_post_vars"]["udf"][$field_id] : $user_defined_data[$field_id];
276 
277  if ($definition['field_type'] == UDF_TYPE_TEXT) {
278  $this->tpl->setCurrentBlock("field_text");
279  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
280  $this->tpl->setVariable("FIELD_VALUE", ilUtil::prepareFormOutput($old));
281  $this->tpl->parseCurrentBlock();
282  } else {
283  $this->tpl->setCurrentBlock("field_select");
284  $this->tpl->setVariable("SELECT_BOX", ilUtil::formSelect(
285  $old,
286  'udf[' . $definition['field_id'] . ']',
287  $this->user_defined_fields->fieldValuesToSelectArray(
288  $definition['field_values']
289  ),
290  false,
291  true
292  ));
293  $this->tpl->parseCurrentBlock();
294  }
295  $this->tpl->setCurrentBlock("user_defined");
296 
297  if ($definition['required']) {
298  $name = $definition['field_name'] . "<span class=\"asterisk\">*</span>";
299  } else {
300  $name = $definition['field_name'];
301  }
302  $this->tpl->setVariable("TXT_FIELD_NAME", $name);
303  $this->tpl->parseCurrentBlock();
304  }
305  return true;
306  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static _getInstance()
Get instance.
$_SESSION["AccountId"]
if($format !==null) $name
Definition: metadata.php:230
const UDF_TYPE_TEXT
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
+ Here is the call graph for this function:

◆ __toUnix()

ilObjUserGUI::__toUnix (   $a_time_arr)

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

1944  {
1945  return mktime(
1946  $a_time_arr["hour"],
1947  $a_time_arr["minute"],
1948  $a_time_arr["second"],
1949  $a_time_arr["month"],
1950  $a_time_arr["day"],
1951  $a_time_arr["year"]
1952  );
1953  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References $_SESSION.

1959  {
1960  unset($_SESSION["filtered_roles"]);
1961  }
$_SESSION["AccountId"]

◆ addAdminLocatorItems()

ilObjUserGUI::addAdminLocatorItems (   $a_do_not_add_object = false)

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

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

References $_GET, $DIC, ilFrameTargetInfo\_getFrame(), ilObject\_lookupObjId(), ilObject\_lookupType(), ROLE_FOLDER_ID, SYSTEM_FOLDER_ID, and USER_FOLDER_ID.

1986  {
1987  global $DIC;
1988 
1989  $ilLocator = $DIC['ilLocator'];
1990 
1991  $ilLocator->clearItems();
1992 
1993  if ($_GET["admin_mode"] == "settings") { // system settings
1994  $this->ctrl->setParameterByClass(
1995  "ilobjsystemfoldergui",
1996  "ref_id",
1998  );
1999  $ilLocator->addItem(
2000  $this->lng->txt("administration"),
2001  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2002  ilFrameTargetInfo::_getFrame("MainContent")
2003  );
2004 
2005  if ($_GET['ref_id'] == USER_FOLDER_ID) {
2006  $ilLocator->addItem(
2007  $this->lng->txt("obj_" . ilObject::_lookupType(
2008  ilObject::_lookupObjId($_GET["ref_id"])
2009  )),
2010  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view")
2011  );
2012  } elseif ($_GET['ref_id'] == ROLE_FOLDER_ID) {
2013  $ilLocator->addItem(
2014  $this->lng->txt("obj_" . ilObject::_lookupType(
2015  ilObject::_lookupObjId($_GET["ref_id"])
2016  )),
2017  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
2018  );
2019  }
2020 
2021  if ($_GET["obj_id"] > 0) {
2022  $ilLocator->addItem(
2023  $this->object->getTitle(),
2024  $this->ctrl->getLinkTarget($this, "view")
2025  );
2026  }
2027  } else { // repository administration
2028  // ?
2029  }
2030  }
const USER_FOLDER_ID
Definition: constants.php:31
$_GET["client_id"]
const SYSTEM_FOLDER_ID
Definition: constants.php:33
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
const ROLE_FOLDER_ID
Definition: constants.php:32
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getFrame($a_class, $a_type='')
Get content frame name.
+ Here is the call graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

Apply filter.

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

References roleassignmentObject().

1882  {
1883  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
1884  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
1885  $table_gui->writeFilterToSession(); // writes filter to session
1886  $table_gui->resetOffset(); // sets record offest to 0 (first page)
1887  $this->roleassignmentObject();
1888  }
TableGUI class for role assignment in user administration.
roleassignmentObject()
display roleassignment panel
+ Here is the call graph for this function:

◆ assignSaveObject()

ilObjUserGUI::assignSaveObject ( )

assign users to role

public

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

References $_GET, $_POST, $DIC, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilUtil\sendFailure(), SYSTEM_ROLE_ID, and SYSTEM_USER_ID.

1757  {
1758  global $DIC;
1759 
1760  $rbacsystem = $DIC['rbacsystem'];
1761  $rbacadmin = $DIC['rbacadmin'];
1762  $rbacreview = $DIC['rbacreview'];
1763 
1764  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1765  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1766  }
1767 
1768  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
1769  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
1770 
1771  // prevent unassignment of system role from system user
1772  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1773  array_push($selected_roles, SYSTEM_ROLE_ID);
1774  }
1775 
1776  $global_roles_all = $rbacreview->getGlobalRoles();
1777  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
1778  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1779  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1780  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1781 
1782  $user_not_allowed_to_change_admin_role_assginements =
1783  !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($this->user->getId()));
1784 
1785  if ($user_not_allowed_to_change_admin_role_assginements
1786  && in_array(SYSTEM_ROLE_ID, $assigned_roles_all)) {
1787  $selected_roles[] = SYSTEM_ROLE_ID;
1788  }
1789 
1790  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1791 
1792  if (empty($selected_roles) && count($assigned_roles_all) === count($assigned_roles)
1793  || empty($posted_global_roles) && count($assigned_global_roles_all) === count($assigned_global_roles)) {
1794  ilUtil::sendFailure($this->lng->txt("msg_min_one_role") . "<br/>" . $this->lng->txt("action_aborted"), true);
1795  $this->ctrl->redirect($this, 'roleassignment');
1796  }
1797 
1798  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1799  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1800  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1801  continue;
1802  }
1803  $rbacadmin->deassignUser($role, $this->object->getId());
1804  }
1805 
1806  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1807  if ($this->object->getId() === (int) SYSTEM_USER_ID && $role === SYSTEM_ROLE_ID
1808  || $user_not_allowed_to_change_admin_role_assginements && $role === SYSTEM_ROLE_ID) {
1809  continue;
1810  }
1811  $rbacadmin->assignUser($role, $this->object->getId(), false);
1812  }
1813 
1814  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
1815 
1816  // update object data entry (to update last modification date)
1817  $this->object->update();
1818 
1819  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"), true);
1820 
1821  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
1822  $this->ctrl->redirect($this, 'roleassignment');
1823  } else {
1824  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1825  }
1826  }
$_GET["client_id"]
const SYSTEM_ROLE_ID
Definition: constants.php:27
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: constants.php:24
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

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

References $_GET, and ilSession\clear().

153  {
154  ilSession::clear("saved_post");
155 
156  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
157  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
158  //$return_location = $_GET["cmd_return_location"];
159  //ilUtil::redirect($this->ctrl->getLinkTarget($this,$return_location));
160  } else {
161  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
162  }
163  }
$_GET["client_id"]
static clear($a_var)
Unset a value.
+ Here is the call graph for this function:

◆ createObject()

ilObjUserGUI::createObject ( )

Display user create form.

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

References $DIC, $ilUser, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilObjectGUI\$tpl, and initCreate().

372  {
373  global $DIC;
374 
375  $tpl = $DIC['tpl'];
376  $rbacsystem = $DIC['rbacsystem'];
377  $rbacreview = $DIC['rbacreview'];
378  $ilUser = $DIC['ilUser'];
379 
380  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id)
381  && !$rbacsystem->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
382  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
383  }
384 
385  $this->initCreate();
386  $this->initForm("create");
387  return $tpl->setContent($this->form_gui->getHtml());
388  }
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ executeCommand()

ilObjUserGUI::executeCommand ( )

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

References $DIC, ilObjectGUI\$rbacsystem, ilLearningProgressBaseGUI\LP_CONTEXT_USER_FOLDER, ilObjectGUI\prepareOutput(), and USER_FOLDER_ID.

102  {
103  global $DIC;
104 
105  $rbacsystem = $DIC['rbacsystem'];
106 
107  $next_class = $this->ctrl->getNextClass($this);
108  $cmd = $this->ctrl->getCmd();
109 
110  $this->prepareOutput();
111 
112  switch ($next_class) {
113  case "illearningprogressgui":
114  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
116  $this->ctrl->forwardCommand($new_gui);
117  break;
118 
119  case "ilobjectownershipmanagementgui":
120  include_once("Services/Object/classes/class.ilObjectOwnershipManagementGUI.php");
121  $gui = new ilObjectOwnershipManagementGUI($this->object->getId());
122  $this->ctrl->forwardCommand($gui);
123  break;
124 
125  default:
126  if ($cmd == "" || $cmd == "view") {
127  $cmd = "edit";
128  }
129  $cmd .= "Object";
130  $return = $this->$cmd();
131 
132  break;
133  }
134  return $return;
135  }
const USER_FOLDER_ID
Definition: constants.php:31
Class ilObjectOwnershipManagementGUI.
prepareOutput($a_show_subobjects=true)
prepare output
global $DIC
Definition: goto.php:24
Class ilObjUserTrackingGUI.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjUserGUI::getAdminTabs ( )

admin and normal tabs are equal for roles

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

References getTabs().

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

◆ getTabs()

ilObjUserGUI::getTabs ( )

get tabs

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

References $_GET, $_SESSION, $DIC, ilObjectGUI\$rbacsystem, ilObjUserTracking\_enabledLearningProgress(), and ilObjUserTracking\_enabledUserRelatedData().

Referenced by getAdminTabs().

177  {
178  global $DIC;
179 
180  $rbacsystem = $DIC['rbacsystem'];
181  $ilHelp = $DIC['ilHelp'];
182 
183  $this->tabs_gui->clearTargets();
184 
185  $ilHelp->setScreenIdComponent("usr");
186 
187  if ($_GET["search"]) {
188  $this->tabs_gui->setBackTarget(
189  $this->lng->txt("search_results"),
190  $_SESSION["usr_search_link"]
191  );
192 
193  $this->tabs_gui->addTarget(
194  "properties",
195  $this->ctrl->getLinkTarget($this, "edit"),
196  array("edit","","view"),
197  get_class($this),
198  "",
199  true
200  );
201  } else {
202  $this->tabs_gui->addTarget(
203  "properties",
204  $this->ctrl->getLinkTarget($this, "edit"),
205  array("edit","","view"),
206  get_class($this)
207  );
208  }
209 
210  $this->tabs_gui->addTarget(
211  "role_assignment",
212  $this->ctrl->getLinkTarget($this, "roleassignment"),
213  array("roleassignment"),
214  get_class($this)
215  );
216 
217  // learning progress
218  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
219  if ($rbacsystem->checkAccess('read', $this->ref_id) and
221  ilObjUserTracking::_enabledUserRelatedData()) {
222  $this->tabs_gui->addTarget(
223  'learning_progress',
224  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
225  '',
226  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
227  );
228  }
229 
230  $this->tabs_gui->addTarget(
231  'user_ownership',
232  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
233  '',
234  'ilobjectownershipmanagementgui'
235  );
236  }
$_SESSION["AccountId"]
$_GET["client_id"]
static _enabledLearningProgress()
check wether learing progress is enabled or not
global $DIC
Definition: goto.php:24
+ 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 949 of file class.ilObjUserGUI.php.

References $_SERVER, Vendor\Package\$a, ilObjectGUI\$data, $DIC, Vendor\Package\$e, $ilCtrl, $ilSetting, $ilUser, $lang, ilObjectGUI\$lng, $name, XapiProxy\$req, ilObjectGUI\$settings, ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_getLastHistoryDataByUserId(), ilObjUser\_getPersonalPicturePath(), ilAuthUtils\_isExternalAccountEnabled(), ilSystemStyleSettings\_lookupActivatedStyle(), ilObjUser\_lookupLogin(), ilDatePresentation\formatDate(), ilAuthUtils\getAuthModeTranslation(), ilCustomUserFieldsHelper\getInstance(), ilUtil\getPasswordRequirementsInfo(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, isSettingChangeable(), 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, user(), USER_FOLDER_ID, and ilUtil\yn2tf().

Referenced by saveObject().

950  {
951  global $DIC;
952 
953  $ilUser = $DIC['ilUser'];
954  $ilSetting = $DIC['ilSetting'];
955 
956  $data = array();
957 
958  // login data
959  $data["auth_mode"] = $this->object->getAuthMode();
960  $data["login"] = $this->object->getLogin();
961  //$data["passwd"] = "********";
962  //$data["passwd2"] = "********";
963  $data["ext_account"] = $this->object->getExternalAccount();
964 
965  // system information
966  $data["create_date"] = ilDatePresentation::formatDate(new ilDateTime($this->object->getCreateDate(), IL_CAL_DATETIME));
967  $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
968  $data["approve_date"] = ($this->object->getApproveDate() != "")
969  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getApproveDate(), IL_CAL_DATETIME))
970  : null;
971  $data["agree_date"] = ($this->object->getAgreeDate() != "")
972  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getAgreeDate(), IL_CAL_DATETIME))
973  : null;
974  $data["last_login"] = ($this->object->getLastLogin() != "")
975  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getLastLogin(), IL_CAL_DATETIME))
976  : null;
977  $data["active"] = $this->object->getActive();
978  $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited();
979 
980  $data["time_limit_from"] = $this->object->getTimeLimitFrom()
981  ? new ilDateTime($this->object->getTimeLimitFrom(), IL_CAL_UNIX)
982  : null;
983  $data["time_limit_until"] = $this->object->getTimeLimitUntil()
984  ? new ilDateTime($this->object->getTimeLimitUntil(), IL_CAL_UNIX)
985  : null;
986 
987  // personal data
988  $data["gender"] = $this->object->getGender();
989  $data["firstname"] = $this->object->getFirstname();
990  $data["lastname"] = $this->object->getLastname();
991  $data["title"] = $this->object->getUTitle();
992  $data['birthday'] = $this->object->getBirthday()
993  ? new ilDate($this->object->getBirthday(), IL_CAL_DATE)
994  : null;
995  $data["institution"] = $this->object->getInstitution();
996  $data["department"] = $this->object->getDepartment();
997  $data["street"] = $this->object->getStreet();
998  $data["city"] = $this->object->getCity();
999  $data["zipcode"] = $this->object->getZipcode();
1000  $data["country"] = $this->object->getCountry();
1001  $data["sel_country"] = $this->object->getSelectedCountry();
1002  $data["phone_office"] = $this->object->getPhoneOffice();
1003  $data["phone_home"] = $this->object->getPhoneHome();
1004  $data["phone_mobile"] = $this->object->getPhoneMobile();
1005  $data["fax"] = $this->object->getFax();
1006  $data["email"] = $this->object->getEmail();
1007  $data["second_email"] = $this->object->getSecondEmail();
1008  $data["hobby"] = $this->object->getHobby();
1009  $data["referral_comment"] = $this->object->getComment();
1010 
1011  // interests
1012  $data["interests_general"] = $this->object->getGeneralInterests();
1013  $data["interests_help_offered"] = $this->object->getOfferingHelp();
1014  $data["interests_help_looking"] = $this->object->getLookingForHelp();
1015 
1016  // other data
1017  $data["matriculation"] = $this->object->getMatriculation();
1018  $data["client_ip"] = $this->object->getClientIP();
1019 
1020  // user defined fields
1021  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1022  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
1023  $user_defined_data = $this->object->getUserDefinedData();
1024  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
1025  $data["udf_" . $field_id] = $user_defined_data["f_" . $field_id];
1026  }
1027 
1028  // settings
1029  $data["language"] = $this->object->getLanguage();
1030  $data["skin_style"] = $this->object->skin . ":" . $this->object->prefs["style"];
1031  $data["hits_per_page"] = $this->object->prefs["hits_per_page"];
1032  //$data["show_users_online"] = $this->object->prefs["show_users_online"];
1033  $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"];
1034  $data['bs_allow_to_contact_me'] = $this->object->prefs['bs_allow_to_contact_me'] == 'y';
1035  $data['chat_osc_accept_msg'] = $this->object->prefs['chat_osc_accept_msg'] == 'y';
1036  $data["session_reminder_enabled"] = (int) $this->object->prefs["session_reminder_enabled"];
1037 
1038  $data["send_mail"] = ($this->object->prefs['send_info_mails'] == 'y');
1039 
1040 
1041  $this->form_gui->setValuesByArray($data);
1042  }
static _lookupLogin($a_user_id)
lookup login
const IL_CAL_DATETIME
static _getInstance()
Get instance.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Class for single dates.
global $DIC
Definition: goto.php:24
const IL_CAL_DATE
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ 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.

protected

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

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

References ilUserDefinedFields\_getInstance(), ilUserProfile\getIgnorableRequiredSettings(), and ilNonEditableValueGUI\setValue().

Referenced by saveObject(), and updateObject().

2190  {
2191  $profile_maybe_incomplete = false;
2192 
2193  require_once 'Services/User/classes/class.ilUserProfile.php';
2194 
2195  foreach (ilUserProfile::getIgnorableRequiredSettings() as $fieldName) {
2196  $elm = $this->form_gui->getItemByPostVar($fieldName);
2197 
2198  if (!$elm) {
2199  continue;
2200  }
2201 
2202  if ($elm->getRequired()) {
2203  $profile_maybe_incomplete = true;
2204 
2205  // Flag as optional
2206  $elm->setRequired(false);
2207  }
2208  }
2209 
2210  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
2211  $user_defined_fields = ilUserDefinedFields::_getInstance();
2212  foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
2213  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
2214 
2215  if (!$elm) {
2216  continue;
2217  }
2218  if ($elm->getRequired() && $definition['required']) {
2219  $profile_maybe_incomplete = true;
2220 
2221  // Flag as optional
2222  $elm->setRequired(false);
2223  }
2224  }
2225 
2226  return $profile_maybe_incomplete;
2227  }
static _getInstance()
Get instance.
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:

◆ hitsperpageObject()

ilObjUserGUI::hitsperpageObject ( )

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

References roleassignmentObject().

1976  {
1977  parent::hitsperpageObject();
1978  $this->roleassignmentObject();
1979  }
roleassignmentObject()
display roleassignment panel
+ Here is the call graph for this function:

◆ initCreate()

ilObjUserGUI::initCreate ( )

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

References $DIC, $ilUser, $keys, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilObjectGUI\$tpl, ilObjRole\_getAssignUsersStatus(), ANONYMOUS_ROLE_ID, ROLE_FOLDER_ID, SYSTEM_ROLE_ID, and USER_FOLDER_ID.

Referenced by createObject(), and saveObject().

309  {
310  global $DIC;
311 
312  $tpl = $DIC['tpl'];
313  $rbacsystem = $DIC['rbacsystem'];
314  $rbacreview = $DIC['rbacreview'];
315  $ilUser = $DIC['ilUser'];
316 
317  if ($this->usrf_ref_id != USER_FOLDER_ID) {
318  $this->tabs_gui->clearTargets();
319  }
320 
321  // role selection
322  $obj_list = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
323  $rol = array();
324  foreach ($obj_list as $obj_data) {
325  // allow only 'assign_users' marked roles if called from category
326  if ($this->object->getRefId() != USER_FOLDER_ID and !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
327  include_once './Services/AccessControl/classes/class.ilObjRole.php';
328 
329  if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
330  continue;
331  }
332  }
333  // exclude anonymous role from list
334  if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID) {
335  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
336  if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
337  $rol[$obj_data["obj_id"]] = $obj_data["title"];
338  }
339  }
340  }
341 
342  // raise error if there is no global role user can be assigned to
343  if (!count($rol)) {
344  $this->ilias->raiseError($this->lng->txt("msg_no_roles_users_can_be_assigned_to"), $this->ilias->error_obj->MESSAGE);
345  }
346 
347  $keys = array_keys($rol);
348 
349  // set pre defined user role to default
350  if (in_array(4, $keys)) {
351  $this->default_role = 4;
352  } else {
353  if (count($keys) > 1 and in_array(2, $keys)) {
354  // remove admin role as preselectable role
355  foreach ($keys as $key => $val) {
356  if ($val == 2) {
357  unset($keys[$key]);
358  break;
359  }
360  }
361  }
362 
363  $this->default_role = array_shift($keys);
364  }
365  $this->selectable_roles = $rol;
366  }
const USER_FOLDER_ID
Definition: constants.php:31
const SYSTEM_ROLE_ID
Definition: constants.php:27
static _getAssignUsersStatus($a_role_id)
$keys
Definition: metadata.php:187
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
const ROLE_FOLDER_ID
Definition: constants.php:32
const ANONYMOUS_ROLE_ID
Definition: constants.php:26
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSettingChangeable()

ilObjUserGUI::isSettingChangeable (   $a_field)
protected

Check if setting is visible This is the case when called from user folder.

Otherwise (category local user account depend on a setting)

Parameters
array$settings
string$a_field
Returns

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

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

Referenced by getValues(), loadValuesFromForm(), saveObject(), and updateObject().

1608  {
1609  // TODO: Allow mixed field parameter to support checks against an array of field names.
1610 
1611  global $DIC;
1612 
1613  $ilSetting = $DIC['ilSetting'];
1614  static $settings = null;
1615 
1616 
1617 
1618  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1619  return true;
1620  }
1621 
1622  if ($settings == null) {
1623  $settings = $ilSetting->getAll();
1624  }
1625  return (bool) $settings['usr_settings_changeable_lua_' . $a_field];
1626  }
const USER_FOLDER_ID
Definition: constants.php:31
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ loadValuesFromForm()

ilObjUserGUI::loadValuesFromForm (   $a_mode = 'create')
protected
Parameters
object$a_mode[optional]
Returns
object ilObjUser

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

References $DIC, $ilSetting, $ilUser, ilObjectGUI\$object, ilObjectGUI\$user, IL_CAL_DATE, IL_CAL_UNIX, and isSettingChangeable().

Referenced by saveObject(), and updateObject().

610  {
611  global $DIC;
612 
613  $ilSetting = $DIC['ilSetting'];
614  $ilUser = $DIC['ilUser'];
615 
616  switch ($a_mode) {
617  case 'create':
618  $user = new ilObjUser();
619  break;
620 
621  case 'update':
623  break;
624  }
625 
626  $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
627  $user->setTimeLimitFrom($from
628  ? $from->get(IL_CAL_UNIX)
629  : null);
630 
631  $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
632  $user->setTimeLimitUntil($until
633  ? $until->get(IL_CAL_UNIX)
634  : null);
635 
636  $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited'));
637 
638  if ($a_mode == 'create') {
639  $user->setTimeLimitOwner($this->usrf_ref_id);
640  }
641 
642  // Birthday
643  if ($this->isSettingChangeable('birthday')) {
644  $bd = $this->form_gui->getItemByPostVar('birthday');
645  $bd = $bd->getDate();
646  $user->setBirthday($bd
647  ? $bd->get(IL_CAL_DATE)
648  : null);
649  }
650 
651  // Login
652  $user->setLogin($this->form_gui->getInput('login'));
653 
654 
655  // Gender
656  if ($this->isSettingChangeable('gender')) {
657  $user->setGender($this->form_gui->getInput('gender'));
658  }
659 
660  // Title
661  if ($this->isSettingChangeable('title')) {
662  $user->setUTitle($this->form_gui->getInput('title'));
663  }
664 
665  // Firstname
666  if ($this->isSettingChangeable('firstname')) {
667  $user->setFirstname($this->form_gui->getInput('firstname'));
668  }
669  // Lastname
670  if ($this->isSettingChangeable('lastname')) {
671  $user->setLastname($this->form_gui->getInput('lastname'));
672  }
673  $user->setFullname();
674 
675  // Institution
676  if ($this->isSettingChangeable('institution')) {
677  $user->setInstitution($this->form_gui->getInput('institution'));
678  }
679 
680  // Department
681  if ($this->isSettingChangeable('department')) {
682  $user->setDepartment($this->form_gui->getInput('department'));
683  }
684  // Street
685  if ($this->isSettingChangeable('street')) {
686  $user->setStreet($this->form_gui->getInput('street'));
687  }
688  // City
689  if ($this->isSettingChangeable('city')) {
690  $user->setCity($this->form_gui->getInput('city'));
691  }
692  // Zipcode
693  if ($this->isSettingChangeable('zipcode')) {
694  $user->setZipcode($this->form_gui->getInput('zipcode'));
695  }
696  // Country
697  if ($this->isSettingChangeable('country')) {
698  $user->setCountry($this->form_gui->getInput('country'));
699  }
700  // Selected Country
701  if ($this->isSettingChangeable('sel_country')) {
702  $user->setSelectedCountry($this->form_gui->getInput('sel_country'));
703  }
704  // Phone Office
705  if ($this->isSettingChangeable('phone_office')) {
706  $user->setPhoneOffice($this->form_gui->getInput('phone_office'));
707  }
708  // Phone Home
709  if ($this->isSettingChangeable('phone_home')) {
710  $user->setPhoneHome($this->form_gui->getInput('phone_home'));
711  }
712  // Phone Mobile
713  if ($this->isSettingChangeable('phone_mobile')) {
714  $user->setPhoneMobile($this->form_gui->getInput('phone_mobile'));
715  }
716  // Fax
717  if ($this->isSettingChangeable('fax')) {
718  $user->setFax($this->form_gui->getInput('fax'));
719  }
720  // Matriculation
721  if ($this->isSettingChangeable('matriculation')) {
722  $user->setMatriculation($this->form_gui->getInput('matriculation'));
723  }
724  // Email
725  if ($this->isSettingChangeable('email')) {
726  $user->setEmail($this->form_gui->getInput('email'));
727  }
728  // Second Email
729  if ($this->isSettingChangeable('second_email')) {
730  $user->setSecondEmail($this->form_gui->getInput('second_email'));
731  }
732  // Hobby
733  if ($this->isSettingChangeable('hobby')) {
734  $user->setHobby($this->form_gui->getInput('hobby'));
735  }
736  // Referral Comment
737  if ($this->isSettingChangeable('referral_comment')) {
738  $user->setComment($this->form_gui->getInput('referral_comment'));
739  }
740 
741  // interests
742  $user->setGeneralInterests($this->form_gui->getInput('interests_general'));
743  $user->setOfferingHelp($this->form_gui->getInput('interests_help_offered'));
744  $user->setLookingForHelp($this->form_gui->getInput('interests_help_looking'));
745 
746  // ClientIP
747  $user->setClientIP($this->form_gui->getInput('client_ip'));
748 
749  // Google maps
750  $user->setLatitude($this->form_gui->getInput('latitude'));
751  $user->setLongitude($this->form_gui->getInput('longitude'));
752  $user->setLocationZoom($this->form_gui->getInput('loc_zoom'));
753 
754  // External account
755  $user->setAuthMode($this->form_gui->getInput('auth_mode'));
756  $user->setExternalAccount($this->form_gui->getInput('ext_account'));
757 
758  if ((int) $user->getActive() != (int) $this->form_gui->getInput('active')) {
759  $user->setActive($this->form_gui->getInput('active'), $ilUser->getId());
760  }
761 
762  return $user;
763  }
const IL_CAL_UNIX
isSettingChangeable($a_field)
Check if setting is visible This is the case when called from user folder.
global $DIC
Definition: goto.php:24
const IL_CAL_DATE
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ 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 1717 of file class.ilObjUserGUI.php.

References ilObjectGUI\editObject(), and ilUtil\getWebspaceDir().

1718  {
1719  $webspace_dir = ilUtil::getWebspaceDir();
1720  $image_dir = $webspace_dir . "/usr_images";
1721  $file = $image_dir . "/usr_" . $this->object->getID() . "." . "jpg";
1722  $thumb_file = $image_dir . "/usr_" . $this->object->getID() . "_small.jpg";
1723  $xthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xsmall.jpg";
1724  $xxthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xxsmall.jpg";
1725  $upload_file = $image_dir . "/upload_" . $this->object->getID();
1726 
1727  // remove user pref file name
1728  $this->object->setPref("profile_image", "");
1729  $this->object->update();
1730  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1731 
1732  if (@is_file($file)) {
1733  unlink($file);
1734  }
1735  if (@is_file($thumb_file)) {
1736  unlink($thumb_file);
1737  }
1738  if (@is_file($xthumb_file)) {
1739  unlink($xthumb_file);
1740  }
1741  if (@is_file($xxthumb_file)) {
1742  unlink($xxthumb_file);
1743  }
1744  if (@is_file($upload_file)) {
1745  unlink($upload_file);
1746  }
1747 
1748  $this->editObject();
1749  }
editObject()
edit object
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

Reset filter.

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

References roleassignmentObject().

1894  {
1895  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
1896  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
1897  $table_gui->resetOffset(); // sets record offest to 0 (first page)
1898  $table_gui->resetFilter(); // clears filter
1899  $this->roleassignmentObject();
1900  }
TableGUI class for role assignment in user administration.
roleassignmentObject()
display roleassignment panel
+ Here is the call graph for this function:

◆ roleassignmentObject()

ilObjUserGUI::roleassignmentObject ( )

display roleassignment panel

public

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

References $_POST, $_SESSION, ilObjectGUI\$access, $DIC, $ilUser, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, __buildFilterSelect(), and ANONYMOUS_USER_ID.

Referenced by applyFilterObject(), hitsperpageObject(), and resetFilterObject().

1834  {
1835  global $DIC;
1836 
1837  $rbacreview = $DIC['rbacreview'];
1838  $rbacsystem = $DIC['rbacsystem'];
1839  $ilUser = $DIC['ilUser'];
1840  $ilTabs = $DIC['ilTabs'];
1841  $access = $DIC->access();
1842 
1843  $ilTabs->activateTab("role_assignment");
1844 
1845  if ($this->object->getId() === (int) ANONYMOUS_USER_ID
1846  || !$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)
1847  && !$access->isCurrentUserBasedOnPositionsAllowedTo("read_users", array($this->object->getId()))
1848  ) {
1849  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1850  }
1851 
1852  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
1853 
1854  if ($_SESSION['filtered_roles'] > 5) {
1855  $_SESSION['filtered_roles'] = 0;
1856  }
1857 
1858  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
1859 
1860  if (false) {
1861  $this->tpl->setCurrentBlock("form_filter");
1862  $this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
1863  $this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
1864  $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
1865  $this->tpl->setVariable("FILTER_NAME", 'roleassignment');
1866  $this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
1867  $this->tpl->parseCurrentBlock();
1868  }
1869 
1870  // init table
1871  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
1872  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
1873 
1874  $tab->parse($this->object->getId());
1875  $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
1876  }
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_SESSION["AccountId"]
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
TableGUI class for role assignment in user administration.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilObjUserGUI::saveObject ( )

save user data public

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

References $_GET, $_POST, ilObjectGUI\$access, $DIC, $ilSetting, $ilUser, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilObjectGUI\$tpl, ilAuthUtils\_isExternalAccountEnabled(), ilObjectGUI\editObject(), getValues(), handleIgnoredRequiredFields(), IL_PASSWD_PLAIN, initCreate(), ilUserProfile\isProfileIncomplete(), isSettingChangeable(), loadValuesFromForm(), ilObjUserFolder\ORG_OP_EDIT_USER_ACCOUNTS, ilUtil\sendInfo(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, uploadUserPictureObject(), and USER_FOLDER_ID.

395  {
396  global $DIC;
397 
398  $ilAccess = $DIC['ilAccess'];
399  $ilSetting = $DIC['ilSetting'];
400  $tpl = $DIC['tpl'];
401  $ilUser = $DIC['ilUser'];
402  $rbacadmin = $DIC['rbacadmin'];
403  $rbacsystem = $DIC['rbacsystem'];
404  $rbacreview = $DIC['rbacreview'];
405 
406  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
407 
408  // User folder
409  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id)
410  && !$ilAccess->checkAccess('cat_administrate_users', "", $this->usrf_ref_id)) {
411  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
412  }
413 
414  $this->initCreate();
415  $this->initForm("create");
416 
417  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
418  $profileMaybeIncomplete = false;
419  if ($this->form_gui->getInput('ignore_rf', false)) {
420  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
421  }
422 
423  if ($this->form_gui->checkInput()) {
424  // @todo: external account; time limit check and savings
425 
426  // checks passed. save user
427  $userObj = $this->loadValuesFromForm();
428 
429  if ($ilUser->getId() === (int) SYSTEM_USER_ID
430  || !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($this->object->getId()))
431  || in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
432  $userObj->setPasswd($this->form_gui->getInput('passwd'), IL_PASSWD_PLAIN);
433  }
434 
435  $userObj->setTitle($userObj->getFullname());
436  $userObj->setDescription($userObj->getEmail());
437 
438  $udf = array();
439  foreach ($_POST as $k => $v) {
440  if (substr($k, 0, 4) == "udf_") {
441  $udf[substr($k, 4)] = $v;
442  }
443  }
444  $userObj->setUserDefinedData($udf);
445 
446  $userObj->create();
447 
448  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
450  $userObj->setExternalAccount($_POST["ext_account"]);
451  }
452 
453  // set a timestamp for last_password_change
454  // this ts is needed by ilSecuritySettings
455  $userObj->setLastPasswordChangeTS(time());
456 
457  //insert user data in table user_data
458  $userObj->saveAsNew();
459 
460  // setup user preferences
461  if ($this->isSettingChangeable('language')) {
462  $userObj->setLanguage($_POST["language"]);
463  }
464 
465  if ($this->isSettingChangeable('skin_style')) {
466  //set user skin and style
467  $sknst = explode(":", $_POST["skin_style"]);
468 
469  if ($userObj->getPref("style") != $sknst[1] ||
470  $userObj->getPref("skin") != $sknst[0]) {
471  $userObj->setPref("skin", $sknst[0]);
472  $userObj->setPref("style", $sknst[1]);
473  }
474  }
475  if ($this->isSettingChangeable('hits_per_page')) {
476  $userObj->setPref("hits_per_page", $_POST["hits_per_page"]);
477  }
478  /*if($this->isSettingChangeable('show_users_online'))
479  {
480  $userObj->setPref("show_users_online", $_POST["show_users_online"]);
481  }*/
482  if ($this->isSettingChangeable('hide_own_online_status')) {
483  $userObj->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
484  }
485  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
486  $userObj->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
487  }
488  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
489  $userObj->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
490  }
491  if ((int) $ilSetting->get('session_reminder_enabled')) {
492  $userObj->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
493  }
494  $userObj->writePrefs();
495 
496  //set role entries
497  $rbacadmin->assignUser($_POST["default_role"], $userObj->getId(), true);
498 
499  $msg = $this->lng->txt("user_added");
500 
501  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
502  $ilUser->writePrefs();
503 
504  $this->object = $userObj;
505 
506  if ($this->isSettingChangeable('upload')) {
507  $this->uploadUserPictureObject();
508  }
509 
510  if ($profileMaybeIncomplete) {
511  include_once 'Services/User/classes/class.ilUserProfile.php';
512  if (ilUserProfile::isProfileIncomplete($this->object)) {
513  $this->object->setProfileIncomplete(true);
514  $this->object->update();
515  }
516  }
517 
518  // send new account mail
519  if ($_POST['send_mail'] == 'y') {
520  include_once('Services/Mail/classes/class.ilAccountMail.php');
521  $acc_mail = new ilAccountMail();
522  $acc_mail->useLangVariablesAsFallback(true);
523  $acc_mail->setAttachConfiguredFiles(true);
524  $acc_mail->setUserPassword($_POST['passwd']);
525  $acc_mail->setUser($userObj);
526 
527  if ($acc_mail->send()) {
528  $msg = $msg . '<br />' . $this->lng->txt('mail_sent');
529  ilUtil::sendSuccess($msg, true);
530  } else {
531  $msg = $msg . '<br />' . $this->lng->txt('mail_not_sent');
532  ilUtil::sendInfo($msg, true);
533  }
534  } else {
535  ilUtil::sendSuccess($msg, true);
536  }
537 
538 
539  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
540  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
541  } else {
542  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
543  }
544  } else {
545  $this->form_gui->setValuesByPost();
546  $tpl->setContent($this->form_gui->getHtml());
547  }
548  }
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
const IL_PASSWD_PLAIN
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
$_GET["client_id"]
loadValuesFromForm($a_mode='create')
uploadUserPictureObject()
upload user image
const SYSTEM_ROLE_ID
Definition: constants.php:27
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: constants.php:24
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
isSettingChangeable($a_field)
Check if setting is visible This is the case when called from user folder.
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
static _isExternalAccountEnabled()
Check if an external account name is required.
global $ilSetting
Definition: privfeed.php:17
Class ilAccountMail.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ setBackTarget()

ilObjUserGUI::setBackTarget (   $a_text,
  $a_link 
)

set back tab target

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

242  {
243  $this->back_target = array("text" => $a_text,
244  "link" => $a_link);
245  }

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )

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

References ilUtil\getImagePath().

140  {
141  if (strtolower(get_class($this->object)) == 'ilobjuser') {
142  $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
143  $this->tpl->setDescription($this->object->getLongDescription());
144  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_" . $this->object->getType() . ".svg"), $this->lng->txt("obj_" . $this->object->getType()));
145  } else {
146  parent::setTitleAndDescription();
147  }
148  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ showUpperIcon()

ilObjUserGUI::showUpperIcon ( )

◆ updateObject()

ilObjUserGUI::updateObject ( )

Update user.

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

References $_GET, $_POST, ilObjectGUI\$access, $DIC, Vendor\Package\$e, $ilSetting, $ilUser, ilObjectGUI\$rbacsystem, ilObjectGUI\$tpl, ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilObjUser\_resetLoginAttempts(), handleIgnoredRequiredFields(), IL_PASSWD_PLAIN, ilUserProfile\isProfileIncomplete(), isSettingChangeable(), loadValuesFromForm(), ilObjUserFolder\ORG_OP_EDIT_USER_ACCOUNTS, ilUtil\sendFailure(), SYSTEM_ROLE_ID, SYSTEM_USER_ID, uploadUserPictureObject(), user(), and USER_FOLDER_ID.

770  {
771  global $DIC;
772 
773  $tpl = $DIC->ui()->mainTemplate();
774  $rbacsystem = $DIC->rbac()->system();
775  $ilUser = $DIC->user();
776  $access = $DIC->access();
777 
778  // User folder && access granted by rbac or by org unit positions
779  if ($this->usrf_ref_id == USER_FOLDER_ID &&
780  (
781  !$rbacsystem->checkAccess('visible,read', USER_FOLDER_ID) ||
782  !$access->checkRbacOrPositionPermissionAccess('write', \ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, USER_FOLDER_ID) ||
783  !in_array(
784  $this->object->getId(),
785  $access->filterUserIdsByRbacOrPositionOfCurrentUser(
786  'write',
789  [$this->object->getId()]
790  )
791  )
792  )
793  ) {
794  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
795  }
796  // if called from local administration $this->usrf_ref_id is category id
797  // Todo: this has to be fixed. Do not mix user folder id and category id
798  if ($this->usrf_ref_id != USER_FOLDER_ID) {
799  // check if user is assigned to category
800  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
801  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
802  }
803  }
804  $this->initForm("edit");
805 
806  // we do not want to store this dates, they are only printed out
807  unset($_POST['approve_date']);
808  $_POST['agree_date'] = $this->object->getAgreeDate();
809  unset($_POST['last_login']);
810 
811  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
812  $profileMaybeIncomplete = false;
813  if ($this->form_gui->getInput('ignore_rf', false)) {
814  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
815  }
816 
817  if ($this->form_gui->checkInput()) {
818  // @todo: external account; time limit
819  // if not allowed or empty -> do no change password
821  && trim($_POST['passwd']) != ""
822  && ($this->user->getId() === (int) SYSTEM_USER_ID
823  || !in_array(SYSTEM_ROLE_ID, $this->rbacreview->assignedRoles($this->object->getId()))
824  || in_array(SYSTEM_ROLE_ID, $this->rbacreview->assignedRoles($this->user->getId())))
825  ) {
826  $this->object->setPasswd($_POST['passwd'], IL_PASSWD_PLAIN);
827  }
828 
829  /*
830  * reset counter for failed logins
831  * if $_POST['active'] is set to 1
832  */
833  if ($_POST['active'] == 1) {
834  ilObjUser::_resetLoginAttempts($this->object->getId());
835  }
836 
837  #$this->object->assignData($_POST);
838  $this->loadValuesFromForm('update');
839 
840  $udf = array();
841  foreach ($_POST as $k => $v) {
842  if (substr($k, 0, 4) == "udf_") {
843  $udf[substr($k, 4)] = $v;
844  }
845  }
846  $this->object->setUserDefinedData($udf);
847 
848  try {
849  $this->object->updateLogin($_POST['login']);
850  } catch (ilUserException $e) {
851  ilUtil::sendFailure($e->getMessage());
852  $this->form_gui->setValuesByPost();
853  return $tpl->setContent($this->form_gui->getHtml());
854  }
855 
856  $this->object->setTitle($this->object->getFullname());
857  $this->object->setDescription($this->object->getEmail());
858 
859  if ($this->isSettingChangeable('language')) {
860  $this->object->setLanguage($this->form_gui->getInput('language'));
861  }
862 
863  if ($this->isSettingChangeable('skin_style')) {
864  //set user skin and style
865  $sknst = explode(":", $_POST["skin_style"]);
866 
867  if ($this->object->getPref("style") != $sknst[1] ||
868  $this->object->getPref("skin") != $sknst[0]) {
869  $this->object->setPref("skin", $sknst[0]);
870  $this->object->setPref("style", $sknst[1]);
871  }
872  }
873  if ($this->isSettingChangeable('hits_per_page')) {
874  $this->object->setPref("hits_per_page", $_POST["hits_per_page"]);
875  }
876  /*if($this->isSettingChangeable('show_users_online'))
877  {
878  $this->object->setPref("show_users_online", $_POST["show_users_online"]);
879  }*/
880  if ($this->isSettingChangeable('hide_own_online_status')) {
881  $this->object->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
882  }
883  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
884  $this->object->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
885  }
886  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
887  $this->object->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
888  }
889 
890  // set a timestamp for last_password_change
891  // this ts is needed by ilSecuritySettings
892  $this->object->setLastPasswordChangeTS(time());
893 
894  global $DIC;
895 
896  $ilSetting = $DIC['ilSetting'];
897  if ((int) $ilSetting->get('session_reminder_enabled')) {
898  $this->object->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
899  }
900 
901  // #10054 - profile may have been completed, check below is only for incomplete
902  $this->object->setProfileIncomplete(false);
903 
904  $this->update = $this->object->update();
905 
906 
907  // If the current user is editing its own user account,
908  // we update his preferences.
909  if ($ilUser->getId() == $this->object->getId()) {
910  $ilUser->readPrefs();
911  }
912  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
913  $ilUser->writePrefs();
914 
915  $mail_message = $this->__sendProfileMail();
916  $msg = $this->lng->txt('saved_successfully') . $mail_message;
917 
918  // same personal image
919  if ($this->isSettingChangeable('upload')) {
920  $this->uploadUserPictureObject();
921  }
922 
923  if ($profileMaybeIncomplete) {
924  include_once 'Services/User/classes/class.ilUserProfile.php';
925  if (ilUserProfile::isProfileIncomplete($this->object)) {
926  $this->object->setProfileIncomplete(true);
927  $this->object->update();
928  }
929  }
930 
931  // feedback
932  ilUtil::sendSuccess($msg, true);
933 
934  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
935  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
936  } else {
937  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
938  }
939  } else {
940  $this->form_gui->setValuesByPost();
941  $this->tabs_gui->activateTab('properties');
942  $tpl->setContent($this->form_gui->getHtml());
943  }
944  }
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
Class for user related exception handling in ILIAS.
const IL_PASSWD_PLAIN
const USER_FOLDER_ID
Definition: constants.php:31
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
$_GET["client_id"]
loadValuesFromForm($a_mode='create')
uploadUserPictureObject()
upload user image
const SYSTEM_ROLE_ID
Definition: constants.php:27
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: constants.php:24
static _resetLoginAttempts($a_usr_id)
static _getAuthMode($a_auth_mode, $a_db_handler='')
user()
Definition: user.php:4
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
isSettingChangeable($a_field)
Check if setting is visible This is the case when called from user folder.
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ uploadUserPictureObject()

ilObjUserGUI::uploadUserPictureObject ( )

upload user image

(original method by ratana ty)

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

References $DIC, $ilUser, ilObjectGUI\$rbacsystem, ilUtil\escapeShellArg(), ilUtil\execConvert(), ilUtil\getWebspaceDir(), ilUtil\isConvertVersionAtLeast(), ilUtil\moveUploadedFile(), ilUtil\sendFailure(), and USER_FOLDER_ID.

Referenced by saveObject(), and updateObject().

1635  {
1636  global $DIC;
1637 
1638  $ilUser = $DIC['ilUser'];
1639  $rbacsystem = $DIC['rbacsystem'];
1640 
1641  // User folder
1642  if ($this->usrf_ref_id == USER_FOLDER_ID and
1643  !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
1644  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1645  }
1646  // if called from local administration $this->usrf_ref_id is category id
1647  // Todo: this has to be fixed. Do not mix user folder id and category id
1648  if ($this->usrf_ref_id != USER_FOLDER_ID) {
1649  // check if user is assigned to category
1650  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1651  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1652  }
1653  }
1654 
1655  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1656 
1657  if ($_FILES["userfile"]["tmp_name"] == "") {
1658  if ($userfile_input->getDeletionFlag()) {
1659  $this->object->removeUserPicture();
1660  }
1661  return;
1662  }
1663  if ($_FILES["userfile"]["size"] == 0) {
1664  ilUtil::sendFailure($this->lng->txt("msg_no_file"));
1665  } else {
1666  $webspace_dir = ilUtil::getWebspaceDir();
1667  $image_dir = $webspace_dir . "/usr_images";
1668  $store_file = "usr_" . $this->object->getId() . "." . "jpg";
1669 
1670  // store filename
1671  $this->object->setPref("profile_image", $store_file);
1672  $this->object->update();
1673 
1674  // move uploaded file
1675  $pi = pathinfo($_FILES["userfile"]["name"]);
1676  $uploaded_file = $image_dir . "/upload_" . $this->object->getId() . "." . $pi["extension"];
1678  $_FILES["userfile"]["tmp_name"],
1679  $_FILES["userfile"]["name"],
1680  $uploaded_file,
1681  false
1682  )) {
1683  ilUtil::sendFailure($this->lng->txt("upload_error", true));
1684  $this->ctrl->redirect($this, "showProfile");
1685  }
1686  chmod($uploaded_file, 0770);
1687 
1688  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1689  // taking only frame [0] to avoid problems with animated gifs
1690  $show_file = "$image_dir/usr_" . $this->object->getId() . ".jpg";
1691  $thumb_file = "$image_dir/usr_" . $this->object->getId() . "_small.jpg";
1692  $xthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xsmall.jpg";
1693  $xxthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xxsmall.jpg";
1694  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
1695  $show_file = ilUtil::escapeShellArg($show_file);
1696  $thumb_file = ilUtil::escapeShellArg($thumb_file);
1697  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
1698  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
1699 
1700  if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
1701  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
1702  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
1703  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
1704  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
1705  } else {
1706  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
1707  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
1708  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
1709  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
1710  }
1711  }
1712  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
const USER_FOLDER_ID
Definition: constants.php:31
static execConvert($args)
execute convert command
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static escapeShellArg($a_arg)
$ilUser
Definition: imgupload.php:18
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $gender

ilObjUserGUI::$gender

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

◆ $ilCtrl

ilObjUserGUI::$ilCtrl

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

Referenced by __construct(), getValues(), and showUpperIcon().

◆ $type

ilObjUserGUI::$type

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

◆ $uiFactory

ilObjUserGUI::$uiFactory
protected

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

Referenced by __construct().

◆ $uiRenderer

ilObjUserGUI::$uiRenderer
protected

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

Referenced by __construct().

◆ $user_ref_id

ilObjUserGUI::$user_ref_id

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


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