ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 editObject ()
 Display user edit form. 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 ()
 list childs of current object 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...
 

Static Public Member Functions

static _goto ($a_target)
 Goto user profile screen. More...
 
- 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...
 

Data Fields

 $ilCtrl
 
 $gender
 
 $type
 
 $user_ref_id
 
- Data Fields inherited from ilObjectGUI
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...
 
 showMountWebfolderIcon ()
 
 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
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 

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, and $uiRenderer.

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  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

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

References $_SESSION, $action, and ilUtil\formSelect().

Referenced by roleassignmentObject().

2195  {
2196  $action[0] = $this->lng->txt('assigned_roles');
2197  $action[1] = $this->lng->txt('all_roles');
2198  $action[2] = $this->lng->txt('all_global_roles');
2199  $action[3] = $this->lng->txt('all_local_roles');
2200  $action[4] = $this->lng->txt('internal_local_roles_only');
2201  $action[5] = $this->lng->txt('non_internal_local_roles_only');
2202 
2203  return ilUtil::formSelect($_SESSION['filtered_roles'], "filter", $action, false, true);
2204  }
$_SESSION["AccountId"]
$action
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 2133 of file class.ilObjUserGUI.php.

References $a_type, $i, $start, and ilUtil\formSelect().

2134  {
2135  switch ($a_type) {
2136  case "minute":
2137  for ($i = 0;$i <= 60;$i++) {
2138  $days[$i] = $i < 10 ? "0" . $i : $i;
2139  }
2140  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2141 
2142  case "hour":
2143  for ($i = 0;$i < 24;$i++) {
2144  $days[$i] = $i < 10 ? "0" . $i : $i;
2145  }
2146  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2147 
2148  case "day":
2149  for ($i = 1;$i < 32;$i++) {
2150  $days[$i] = $i < 10 ? "0" . $i : $i;
2151  }
2152  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2153 
2154  case "month":
2155  for ($i = 1;$i < 13;$i++) {
2156  $month[$i] = $i < 10 ? "0" . $i : $i;
2157  }
2158  return ilUtil::formSelect($a_selected, $a_varname, $month, false, true);
2159 
2160  case "year":
2161  if ($a_selected < date('Y', time())) {
2162  $start = $a_selected;
2163  } else {
2164  $start = date('Y', time());
2165  }
2166 
2167  for ($i = $start;$i < date("Y", time()) + 11;++$i) {
2168  $year[$i] = $i;
2169  }
2170  return ilUtil::formSelect($a_selected, $a_varname, $year, false, true);
2171  }
2172  }
$start
Definition: bench.php:8
$a_type
Definition: workflow.php:92
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: disco.tpl.php:19
+ 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"]
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 2174 of file class.ilObjUserGUI.php.

2175  {
2176  return mktime(
2177  $a_time_arr["hour"],
2178  $a_time_arr["minute"],
2179  $a_time_arr["second"],
2180  $a_time_arr["month"],
2181  $a_time_arr["day"],
2182  $a_time_arr["year"]
2183  );
2184  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References $_SESSION.

2190  {
2191  unset($_SESSION["filtered_roles"]);
2192  }
$_SESSION["AccountId"]

◆ _goto()

static ilObjUserGUI::_goto (   $a_target)
static

Goto user profile screen.

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

References $_GET, $DIC, $ilCtrl, $ilUser, ilObjUser\_lookupId(), exit, and ilUtil\stripSlashes().

2332  {
2333  global $DIC;
2334 
2335  $ilUser = $DIC['ilUser'];
2336  $ilCtrl = $DIC['ilCtrl'];
2337 
2338  // #10888
2339  if ($a_target == md5("usrdelown")) {
2340  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2341  $ilUser->hasDeletionFlag()) {
2342  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2343  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalsettingsgui"), "deleteOwnAccount3");
2344  }
2345  exit("This account is not flagged for deletion."); // #12160
2346  }
2347 
2348  // badges
2349  if (substr($a_target, -4) == "_bdg") {
2350  $_GET["baseClass"] = "ilPersonalDesktopGUI";
2351  $_GET["cmd"] = "jumpToBadges";
2352  include("ilias.php");
2353  exit();
2354  }
2355 
2356  if ('registration' == $a_target) {
2357  $_GET["baseClass"] = 'ilStartUpGUI';
2358  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilAccountRegistrationGUI'), '');
2359  } elseif ('nameassist' == $a_target) {
2360  $_GET["baseClass"] = 'ilStartUpGUI';
2361  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), 'showUsernameAssistanceForm');
2362  } elseif ('pwassist' == $a_target) {
2363  $_GET["baseClass"] = 'ilStartUpGUI';
2364  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), '');
2365  } elseif ('agreement' == $a_target) {
2366  if ($ilUser->getId() > 0 && !$ilUser->isAnonymous()) {
2367  $ilCtrl->setTargetScript('ilias.php');
2368  $ilCtrl->initBaseClass('ilpersonaldesktopgui');
2369  $ilCtrl->redirectByClass(array('ilpersonaldesktopgui', 'ilpersonalprofilegui'), 'showUserAgreement');
2370  } else {
2371  $_GET['baseClass'] = 'ilStartUpGUI';
2372  $ilCtrl->setTargetScript('ilias.php');
2373  $ilCtrl->redirectByClass(array('ilStartUpGUI'), 'showTermsOfService');
2374  }
2375  }
2376 
2377  if (substr($a_target, 0, 1) == "n") {
2378  $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
2379  }
2380 
2381  if (strpos($a_target, 'contact_approved') !== false) {
2382  $_GET['cmd'] = 'approveContactRequest';
2383  } elseif (strpos($a_target, 'contact_ignored') !== false) {
2384  $_GET['cmd'] = 'ignoreContactRequest';
2385  } else {
2386  $_GET['cmd'] = 'view';
2387  }
2388 
2389  $_GET["user_id"] = (int) $a_target;
2390  $_GET["baseClass"] = "ilPublicUserProfileGUI";
2391  $_GET["cmdClass"] = "ilpublicuserprofilegui";
2392  include("ilias.php");
2393  exit;
2394  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _lookupId($a_user_str)
Lookup id by login.
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
exit
Definition: backend.php:16
+ Here is the call graph for this function:

◆ addAdminLocatorItems()

ilObjUserGUI::addAdminLocatorItems (   $a_do_not_add_object = false)

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

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

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

2217  {
2218  global $DIC;
2219 
2220  $ilLocator = $DIC['ilLocator'];
2221 
2222  $ilLocator->clearItems();
2223 
2224  if ($_GET["admin_mode"] == "settings") { // system settings
2225  $this->ctrl->setParameterByClass(
2226  "ilobjsystemfoldergui",
2227  "ref_id",
2228  SYSTEM_FOLDER_ID
2229  );
2230  $ilLocator->addItem(
2231  $this->lng->txt("administration"),
2232  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2233  ilFrameTargetInfo::_getFrame("MainContent")
2234  );
2235 
2236  if ($_GET['ref_id'] == USER_FOLDER_ID) {
2237  $ilLocator->addItem(
2238  $this->lng->txt("obj_" . ilObject::_lookupType(
2239  ilObject::_lookupObjId($_GET["ref_id"])
2240  )),
2241  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view")
2242  );
2243  } elseif ($_GET['ref_id'] == ROLE_FOLDER_ID) {
2244  $ilLocator->addItem(
2245  $this->lng->txt("obj_" . ilObject::_lookupType(
2246  ilObject::_lookupObjId($_GET["ref_id"])
2247  )),
2248  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
2249  );
2250  }
2251 
2252  if ($_GET["obj_id"] > 0) {
2253  $ilLocator->addItem(
2254  $this->object->getTitle(),
2255  $this->ctrl->getLinkTarget($this, "view")
2256  );
2257  }
2258  } else { // repository administration
2259  // ?
2260  }
2261  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getFrame($a_class, $a_type='')
Get content frame name.
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

Apply filter.

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

References roleassignmentObject().

2113  {
2114  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2115  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2116  $table_gui->writeFilterToSession(); // writes filter to session
2117  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2118  $this->roleassignmentObject();
2119  }
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 1895 of file class.ilObjUserGUI.php.

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

1896  {
1897  global $DIC;
1898 
1899  $rbacsystem = $DIC['rbacsystem'];
1900  $rbacadmin = $DIC['rbacadmin'];
1901  $rbacreview = $DIC['rbacreview'];
1902 
1903  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1904  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1905  }
1906 
1907  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
1908  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
1909 
1910  // prevent unassignment of system role from system user
1911  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1912  array_push($selected_roles, SYSTEM_ROLE_ID);
1913  }
1914 
1915  $global_roles_all = $rbacreview->getGlobalRoles();
1916  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
1917  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1918  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1919  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1920  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1921 
1922  if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
1923  or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles))) {
1924  //$this->ilias->raiseError($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),$this->ilias->error_obj->MESSAGE);
1925  // workaround. sometimes jumps back to wrong page
1926  ilUtil::sendFailure($this->lng->txt("msg_min_one_role") . "<br/>" . $this->lng->txt("action_aborted"), true);
1927  $this->ctrl->redirect($this, 'roleassignment');
1928  }
1929 
1930  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1931  $rbacadmin->deassignUser($role, $this->object->getId());
1932  }
1933 
1934  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1935  $rbacadmin->assignUser($role, $this->object->getId(), false);
1936  }
1937 
1938  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
1939 
1940  // update object data entry (to update last modification date)
1941  $this->object->update();
1942 
1943  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"), true);
1944 
1945  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
1946  $this->ctrl->redirect($this, 'roleassignment');
1947  } else {
1948  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1949  }
1950  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
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\$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) and
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: saml.php:7
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

◆ editObject()

ilObjUserGUI::editObject ( )

Display user edit form.

public

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

References $ilCtrl, $ilSetting, $ilUser, ilObjectGUI\$rbacreview, ilObjectGUI\$settings, getValues(), and USER_FOLDER_ID.

Referenced by removeUserPictureObject().

557  {
558  global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser
560 
561  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
562 
563  //load ILIAS settings
564  $settings = $ilias->getAllSettings();
565 
566  // User folder
567  if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
568  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
569  }
570  // if called from local administration $this->usrf_ref_id is category id
571  // Todo: this has to be fixed. Do not mix user folder id and category id
572  if ($this->usrf_ref_id != USER_FOLDER_ID) {
573  // check if user is assigned to category
574  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
575  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
576  }
577  }
578 
579  if ($this->usrf_ref_id != USER_FOLDER_ID) {
580  $this->tabs_gui->clearTargets();
581  }
582 
583  // get form
584  $this->initForm("edit");
585  $this->getValues();
586  $this->showAcceptedTermsOfService();
587  $this->tpl->setContent($this->form_gui->getHTML());
588  }
getValues()
Get values from user object and put them into form.
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilSetting
Definition: privfeed.php:17
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjUserGUI::executeCommand ( )

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

References $DIC, 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  }
global $DIC
Definition: saml.php:7
Class ilObjectOwnershipManagementGUI.
prepareOutput($a_show_subobjects=true)
prepare output
const USER_FOLDER_ID
Class ilObjUserFolder.
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, 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"]
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _enabledLearningProgress()
check wether learing progress is enabled or not
+ 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 926 of file class.ilObjUserGUI.php.

References $_SERVER, ilObjectGUI\$data, $default, $DIC, $id, $ilCtrl, $ilSetting, $ilUser, $info, $l, $lang, $languages, ilObjectGUI\$lng, $name, PHPMailer\PHPMailer\$options, $req, ilObjectGUI\$settings, $style, ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_getLastHistoryDataByUserId(), ilDiskQuotaActivationChecker\_isActive(), ilAuthUtils\_isExternalAccountEnabled(), ilDiskQuotaActivationChecker\_isPersonalWorkspaceActive(), ilSystemStyleSettings\_lookupActivatedStyle(), ilDiskQuotaChecker\_lookupDiskQuota(), ilDiskQuotaChecker\_lookupDiskUsage(), ilObjUser\_lookupLogin(), ilDiskQuotaChecker\_lookupPersonalWorkspaceDiskQuota(), ilUtil\Bytes2MB(), ilDatePresentation\formatDate(), ilUtil\formatSize(), ilAuthUtils\getAuthModeTranslation(), ilDiskQuotaHandler\getFilesizeByOwner(), ilDiskQuotaHandler\getFilesizeByTypeAndOwner(), ilCustomUserFieldsHelper\getInstance(), ilUtil\getPasswordRequirementsInfo(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, isSettingChangeable(), ilCheckboxInputGUI\setChecked(), ilImageFileInputGUI\setImage(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setMulti(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setRows(), ilTextInputGUI\setSize(), ilPasswordInputGUI\setUseStripSlashes(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), USER_FOLDER_ID, and ilUtil\yn2tf().

Referenced by editObject().

927  {
928  global $DIC;
929 
930  $ilUser = $DIC['ilUser'];
931  $ilSetting = $DIC['ilSetting'];
932 
933  $data = array();
934 
935  // login data
936  $data["auth_mode"] = $this->object->getAuthMode();
937  $data["login"] = $this->object->getLogin();
938  //$data["passwd"] = "********";
939  //$data["passwd2"] = "********";
940  $data["ext_account"] = $this->object->getExternalAccount();
941 
942  // system information
943  $data["create_date"] = ilDatePresentation::formatDate(new ilDateTime($this->object->getCreateDate(), IL_CAL_DATETIME));
944  $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
945  $data["approve_date"] = ($this->object->getApproveDate() != "")
946  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getApproveDate(), IL_CAL_DATETIME))
947  : null;
948  $data["agree_date"] = ($this->object->getAgreeDate() != "")
949  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getAgreeDate(), IL_CAL_DATETIME))
950  : null;
951  $data["last_login"] = ($this->object->getLastLogin() != "")
952  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getLastLogin(), IL_CAL_DATETIME))
953  : null;
954  $data["active"] = $this->object->getActive();
955  $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited();
956 
957  $data["time_limit_from"] = $this->object->getTimeLimitFrom()
958  ? new ilDateTime($this->object->getTimeLimitFrom(), IL_CAL_UNIX)
959  : null;
960  $data["time_limit_until"] = $this->object->getTimeLimitUntil()
961  ? new ilDateTime($this->object->getTimeLimitUntil(), IL_CAL_UNIX)
962  : null;
963 
964 
965  // BEGIN DiskQuota, Show disk space used
966  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
968  $data["disk_quota"] = ilUtil::Bytes2MB($this->object->getDiskQuota());
969  }
971  $data["wsp_disk_quota"] = ilUtil::Bytes2MB($this->object->getPersonalWorkspaceDiskQuota());
972  }
973  // W. Randelshofer 2008-09-09: Deactivated display of disk space usage,
974  // because determining the disk space usage may take several minutes.
975  /*
976  require_once "Modules/File/classes/class.ilObjFileAccess.php";
977  require_once "Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
978  require_once "Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
979  require_once "Services/Mail/classes/class.ilObjMailAccess.php";
980  require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
981  require_once "Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
982  $data["disk_space_used"] =
983  ilObjFileAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
984  ilObjFileBasedLMAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
985  ilObjSAHSLearningModuleAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
986  ilObjMailAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
987  ilObjForumAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
988  ilObjMediaCastAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>';
989  */
990  // END DiskQuota, Show disk space used
991 
992  // personal data
993  $data["gender"] = $this->object->getGender();
994  $data["firstname"] = $this->object->getFirstname();
995  $data["lastname"] = $this->object->getLastname();
996  $data["title"] = $this->object->getUTitle();
997  $data['birthday'] = $this->object->getBirthday()
998  ? new ilDate($this->object->getBirthday(), IL_CAL_DATE)
999  : null;
1000  $data["institution"] = $this->object->getInstitution();
1001  $data["department"] = $this->object->getDepartment();
1002  $data["street"] = $this->object->getStreet();
1003  $data["city"] = $this->object->getCity();
1004  $data["zipcode"] = $this->object->getZipcode();
1005  $data["country"] = $this->object->getCountry();
1006  $data["sel_country"] = $this->object->getSelectedCountry();
1007  $data["phone_office"] = $this->object->getPhoneOffice();
1008  $data["phone_home"] = $this->object->getPhoneHome();
1009  $data["phone_mobile"] = $this->object->getPhoneMobile();
1010  $data["fax"] = $this->object->getFax();
1011  $data["email"] = $this->object->getEmail();
1012  $data["second_email"] = $this->object->getSecondEmail();
1013  $data["hobby"] = $this->object->getHobby();
1014  $data["referral_comment"] = $this->object->getComment();
1015 
1016  // interests
1017  $data["interests_general"] = $this->object->getGeneralInterests();
1018  $data["interests_help_offered"] = $this->object->getOfferingHelp();
1019  $data["interests_help_looking"] = $this->object->getLookingForHelp();
1020 
1021  // other data
1022  $data["matriculation"] = $this->object->getMatriculation();
1023  $data["client_ip"] = $this->object->getClientIP();
1024 
1025  // user defined fields
1026  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1027  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
1028  $user_defined_data = $this->object->getUserDefinedData();
1029  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
1030  $data["udf_" . $field_id] = $user_defined_data["f_" . $field_id];
1031  }
1032 
1033  // settings
1034  $data["language"] = $this->object->getLanguage();
1035  $data["skin_style"] = $this->object->skin . ":" . $this->object->prefs["style"];
1036  $data["hits_per_page"] = $this->object->prefs["hits_per_page"];
1037  //$data["show_users_online"] = $this->object->prefs["show_users_online"];
1038  $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"];
1039  $data['bs_allow_to_contact_me'] = $this->object->prefs['bs_allow_to_contact_me'] == 'y';
1040  $data['chat_osc_accept_msg'] = $this->object->prefs['chat_osc_accept_msg'] == 'y';
1041  $data["session_reminder_enabled"] = (int) $this->object->prefs["session_reminder_enabled"];
1042 
1043  $data["send_mail"] = ($this->object->prefs['send_info_mails'] == 'y');
1044 
1045 
1046  $this->form_gui->setValuesByArray($data);
1047  }
static _lookupLogin($a_user_id)
lookup login
const IL_CAL_DATETIME
static _getInstance()
Get instance.
global $DIC
Definition: saml.php:7
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.
static Bytes2MB($a_value)
Date and time handling
$ilUser
Definition: imgupload.php:18
const IL_CAL_DATE
global $ilSetting
Definition: privfeed.php:17
+ 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 2404 of file class.ilObjUserGUI.php.

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

Referenced by saveObject(), and updateObject().

2405  {
2406  $profileMaybeIncomplete = false;
2407 
2408  require_once 'Services/User/classes/class.ilUserProfile.php';
2409 
2410  foreach (ilUserProfile::getIgnorableRequiredSettings() as $fieldName) {
2411  $elm = $this->form_gui->getItemByPostVar($fieldName);
2412 
2413  if (!$elm) {
2414  continue;
2415  }
2416 
2417  if ($elm->getRequired()) {
2418  $profileMaybeIncomplete = true;
2419 
2420  // Flag as optional
2421  $elm->setRequired(false);
2422  }
2423  }
2424 
2425  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
2426  $user_defined_fields = ilUserDefinedFields::_getInstance();
2427  foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
2428  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
2429 
2430  if (!$elm) {
2431  continue;
2432  }
2433 
2434  if ($elm->getRequired() && $definition['changeable'] && $definition['required'] && $definition['visible']) {
2435  $profileMaybeIncomplete = true;
2436 
2437  // Flag as optional
2438  $elm->setRequired(false);
2439  }
2440  }
2441 
2442  return $profileMaybeIncomplete;
2443  }
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 2206 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2207  {
2208  parent::hitsperpageObject();
2209  $this->roleassignmentObject();
2210  }
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, $key, $keys, ilObjectGUI\$rbacreview, ilObjectGUI\$tpl, ilObjRole\_getAssignUsersStatus(), 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  }
global $DIC
Definition: saml.php:7
$keys
static _getAssignUsersStatus($a_role_id)
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
const USER_FOLDER_ID
Class ilObjUserFolder.
$key
Definition: croninfo.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 1744 of file class.ilObjUserGUI.php.

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

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

1745  {
1746  // TODO: Allow mixed field parameter to support checks against an array of field names.
1747 
1748  global $DIC;
1749 
1750  $ilSetting = $DIC['ilSetting'];
1751  static $settings = null;
1752 
1753 
1754 
1755  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1756  return true;
1757  }
1758 
1759  if ($settings == null) {
1760  $settings = $ilSetting->getAll();
1761  }
1762  return (bool) $settings['usr_settings_changeable_lua_' . $a_field];
1763  }
global $DIC
Definition: saml.php:7
global $ilSetting
Definition: privfeed.php:17
const USER_FOLDER_ID
Class ilObjUserFolder.
+ 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 594 of file class.ilObjUserGUI.php.

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

Referenced by saveObject(), and updateObject().

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

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

1856  {
1857  $webspace_dir = ilUtil::getWebspaceDir();
1858  $image_dir = $webspace_dir . "/usr_images";
1859  $file = $image_dir . "/usr_" . $this->object->getID() . "." . "jpg";
1860  $thumb_file = $image_dir . "/usr_" . $this->object->getID() . "_small.jpg";
1861  $xthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xsmall.jpg";
1862  $xxthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xxsmall.jpg";
1863  $upload_file = $image_dir . "/upload_" . $this->object->getID();
1864 
1865  // remove user pref file name
1866  $this->object->setPref("profile_image", "");
1867  $this->object->update();
1868  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1869 
1870  if (@is_file($file)) {
1871  unlink($file);
1872  }
1873  if (@is_file($thumb_file)) {
1874  unlink($thumb_file);
1875  }
1876  if (@is_file($xthumb_file)) {
1877  unlink($xthumb_file);
1878  }
1879  if (@is_file($xxthumb_file)) {
1880  unlink($xxthumb_file);
1881  }
1882  if (@is_file($upload_file)) {
1883  unlink($upload_file);
1884  }
1885 
1886  $this->editObject();
1887  }
editObject()
Display user edit form.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

Reset filter.

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

References roleassignmentObject().

2125  {
2126  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2127  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2128  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2129  $table_gui->resetFilter(); // clears filter
2130  $this->roleassignmentObject();
2131  }
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 1957 of file class.ilObjUserGUI.php.

References $_POST, $_SESSION, $context, $DIC, $ilUser, ilObjectGUI\$obj_id, $path, ilObjectGUI\$rbacreview, $records, ilObjectGUI\$ref_id, $tab, $title, __buildFilterSelect(), ilObject\_getAllReferences(), ilSecuritySettings\_getInstance(), ilLink\_getLink(), ilObjRole\_getTranslation(), and ilObject\_lookupType().

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

1958  {
1959  global $DIC;
1960 
1961  $rbacreview = $DIC['rbacreview'];
1962  $rbacsystem = $DIC['rbacsystem'];
1963  $ilUser = $DIC['ilUser'];
1964  $ilTabs = $DIC['ilTabs'];
1965 
1966  $ilTabs->activateTab("role_assignment");
1967 
1968  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1969  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1970  }
1971 
1972  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
1973 
1974  if ($_SESSION['filtered_roles'] > 5) {
1975  $_SESSION['filtered_roles'] = 0;
1976  }
1977 
1978  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
1979 
1980  if (false) {
1981  $this->tpl->setCurrentBlock("filter");
1982  $this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
1983  $this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
1984  $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
1985  $this->tpl->setVariable("FILTER_NAME", 'roleassignment');
1986  $this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
1987  $this->tpl->parseCurrentBlock();
1988  }
1989 
1990  // init table
1991  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
1992  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
1993 
1994  // now get roles depending on filter settings
1995  $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"], $this->object->getId());
1996  $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
1997 
1998  $counter = 0;
1999 
2000  include_once('./Services/AccessControl/classes/class.ilObjRole.php');
2001 
2002  $records = array();
2003  foreach ($role_list as $role) {
2004  // fetch context path of role
2005  $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
2006 
2007  // only list roles that are not set to status "deleted"
2008  if ($rbacreview->isDeleted($rolf[0])) {
2009  continue;
2010  }
2011 
2012  // build context path
2013  $path = "";
2014 
2015  if ($this->tree->isInTree($rolf[0])) {
2016  if ($rolf[0] == ROLE_FOLDER_ID) {
2017  $path = $this->lng->txt("global");
2018  } else {
2019  $tmpPath = $this->tree->getPathFull($rolf[0]);
2020 
2021  // count -1, to exclude the role folder itself
2022  /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
2023  {
2024  if ($path != "")
2025  {
2026  $path .= " > ";
2027  }
2028 
2029  $path .= $tmpPath[$i]["title"];
2030  }*/
2031 
2032  $path = $tmpPath[count($tmpPath) - 1]["title"];
2033  }
2034  } else {
2035  $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role["obj_id"] . ")</b>";
2036  }
2037 
2038  $disabled = false;
2039 
2040  // disable checkbox for system role for the system user
2041  if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
2042  or (!in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID)) {
2043  $disabled = true;
2044  }
2045 
2046  // protected admin role
2047  if ($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
2048  include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
2049  if (ilSecuritySettings::_getInstance()->isAdminRoleProtected()) {
2050  $disabled = true;
2051  }
2052  }
2053 
2054  if (substr($role["title"], 0, 3) == "il_") {
2055  if (!$assignable) {
2056  $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
2057  $rolf2 = $rolf_arr[0];
2058  } else {
2059  $rolf2 = $rolf;
2060  }
2061 
2062  $parent_node = $this->tree->getNodeData($rolf2);
2063 
2064  $role["description"] = $this->lng->txt("obj_" . $parent_node["type"]) . "&nbsp;(#" . $parent_node["obj_id"] . ")";
2065  }
2066 
2067  $role_ids[$counter] = $role["obj_id"];
2068 
2069  $result_set[$counter][] = $checkbox = ilUtil::formCheckBox(in_array($role["obj_id"], $assigned_roles), "role_id[]", $role["obj_id"], $disabled) . "<input type=\"hidden\" name=\"role_id_ctrl[]\" value=\"" . $role["obj_id"] . "\"/>";
2070  $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
2071  $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
2072  $result_set[$counter][] = $link = "<a href=\"" . $this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm") . "\">" . ilObjRole::_getTranslation($role["title"]) . "</a>";
2073  $title = ilObjRole::_getTranslation($role["title"]);
2074  $result_set[$counter][] = $role["description"];
2075 
2076  // Add link to objector local Rores
2077  if ($role["role_type"] == "local") {
2078  // Get Object to the role
2079  $obj_id = $rbacreview->getObjectOfRole($role["rol_id"]);
2080 
2081  $obj_type = ilObject::_lookupType($obj_id);
2082 
2084 
2085  foreach ($ref_ids as $ref_id) {
2086  }
2087 
2088  require_once("./Services/Link/classes/class.ilLink.php");
2089 
2090  $result_set[$counter][] = $context = "<a href='" . ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id)) . "' target='_top'>" . $path . "</a>";
2091  } else {
2092  $result_set[$counter][] = $path;
2093  $context = $path;
2094  }
2095 
2096  $records[] = array("path" => $path, "description" => $role["description"],
2097  "context" => $context, "checkbox" => $checkbox,
2098  "role" => $link, "title" => $title);
2099  ++$counter;
2100  }
2101 
2102  if (true) {
2103  $tab->setData($records);
2104  $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
2105  return;
2106  }
2107  }
$path
Definition: aliased.php:25
$context
Definition: webdav.php:25
$_SESSION["AccountId"]
global $DIC
Definition: saml.php:7
$records
Definition: simple_test.php:22
static _getAllReferences($a_id)
get all reference ids of object
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getTranslation($a_role_title)
static _lookupType($a_id, $a_reference=false)
lookup object type
TableGUI class for role assignment in user administration.
static _getInstance()
Get instance of ilSecuritySettings.
$_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, $DIC, $ilSetting, $ilUser, ilObjectGUI\$tpl, ilDiskQuotaActivationChecker\_isActive(), ilAuthUtils\_isExternalAccountEnabled(), handleIgnoredRequiredFields(), IL_PASSWD_PLAIN, initCreate(), ilUserProfile\isProfileIncomplete(), isSettingChangeable(), loadValuesFromForm(), ilUtil\MB2Bytes(), ilUtil\sendInfo(), and uploadUserPictureObject().

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 
405  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
406 
407  // User folder
408  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id) &&
409  !$ilAccess->checkAccess('cat_administrate_users', "", $this->usrf_ref_id)) {
410  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
411  }
412 
413  $this->initCreate();
414  $this->initForm("create");
415 
416  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
417  $profileMaybeIncomplete = false;
418  if ($this->form_gui->getInput('ignore_rf', false)) {
419  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
420  }
421 
422  if ($this->form_gui->checkInput()) {
423  // @todo: external account; time limit check and savings
424 
425  // checks passed. save user
426  $userObj = $this->loadValuesFromForm();
427 
428  $userObj->setPasswd($this->form_gui->getInput('passwd'), IL_PASSWD_PLAIN);
429  $userObj->setTitle($userObj->getFullname());
430  $userObj->setDescription($userObj->getEmail());
431 
432  $udf = array();
433  foreach ($_POST as $k => $v) {
434  if (substr($k, 0, 4) == "udf_") {
435  $udf[substr($k, 4)] = $v;
436  }
437  }
438  $userObj->setUserDefinedData($udf);
439 
440  $userObj->create();
441 
442  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
444  $userObj->setExternalAccount($_POST["ext_account"]);
445  }
446 
447  // set a timestamp for last_password_change
448  // this ts is needed by ilSecuritySettings
449  $userObj->setLastPasswordChangeTS(time());
450 
451  //insert user data in table user_data
452  $userObj->saveAsNew();
453 
454  // setup user preferences
455  if ($this->isSettingChangeable('language')) {
456  $userObj->setLanguage($_POST["language"]);
457  }
458 
459  // Set disk quota
460  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
462  // The disk quota is entered in megabytes but stored in bytes
463  $userObj->setPref("disk_quota", ilUtil::MB2Bytes($_POST["disk_quota"]));
464  }
465 
466  if ($this->isSettingChangeable('skin_style')) {
467  //set user skin and style
468  $sknst = explode(":", $_POST["skin_style"]);
469 
470  if ($userObj->getPref("style") != $sknst[1] ||
471  $userObj->getPref("skin") != $sknst[0]) {
472  $userObj->setPref("skin", $sknst[0]);
473  $userObj->setPref("style", $sknst[1]);
474  }
475  }
476  if ($this->isSettingChangeable('hits_per_page')) {
477  $userObj->setPref("hits_per_page", $_POST["hits_per_page"]);
478  }
479  /*if($this->isSettingChangeable('show_users_online'))
480  {
481  $userObj->setPref("show_users_online", $_POST["show_users_online"]);
482  }*/
483  if ($this->isSettingChangeable('hide_own_online_status')) {
484  $userObj->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
485  }
486  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
487  $userObj->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
488  }
489  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
490  $userObj->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
491  }
492  if ((int) $ilSetting->get('session_reminder_enabled')) {
493  $userObj->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
494  }
495  $userObj->writePrefs();
496 
497  //set role entries
498  $rbacadmin->assignUser($_POST["default_role"], $userObj->getId(), true);
499 
500  $msg = $this->lng->txt("user_added");
501 
502  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
503  $ilUser->writePrefs();
504 
505  $this->object = $userObj;
506 
507  if ($this->isSettingChangeable('upload')) {
508  $this->uploadUserPictureObject();
509  }
510 
511  if ($profileMaybeIncomplete) {
512  include_once 'Services/User/classes/class.ilUserProfile.php';
513  if (ilUserProfile::isProfileIncomplete($this->object)) {
514  $this->object->setProfileIncomplete(true);
515  $this->object->update();
516  }
517  }
518 
519  // send new account mail
520  if ($_POST['send_mail'] == 'y') {
521  include_once('Services/Mail/classes/class.ilAccountMail.php');
522  $acc_mail = new ilAccountMail();
523  $acc_mail->useLangVariablesAsFallback(true);
524  $acc_mail->setAttachConfiguredFiles(true);
525  $acc_mail->setUserPassword($_POST['passwd']);
526  $acc_mail->setUser($userObj);
527 
528  if ($acc_mail->send()) {
529  $msg = $msg . '<br />' . $this->lng->txt('mail_sent');
530  ilUtil::sendSuccess($msg, true);
531  } else {
532  $msg = $msg . '<br />' . $this->lng->txt('mail_not_sent');
533  ilUtil::sendInfo($msg, true);
534  }
535  } else {
536  ilUtil::sendSuccess($msg, true);
537  }
538 
539 
540  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
541  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
542  } else {
543  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
544  }
545  } else {
546  $this->form_gui->setValuesByPost();
547  $tpl->setContent($this->form_gui->getHtml());
548  }
549  }
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.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
loadValuesFromForm($a_mode='create')
uploadUserPictureObject()
upload user image
static MB2Bytes($a_value)
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.
$ilUser
Definition: imgupload.php:18
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.
$_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 ( )

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

References $_POST, $DIC, $GLOBALS, $ilUser, ilMailOptions\getExternalEmailsByUser(), and ilLanguage\loadLanguageModule().

2264  {
2265  }
+ Here is the call graph for this function:

◆ updateObject()

ilObjUserGUI::updateObject ( )

Update user.

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

References $_GET, $_POST, $DIC, $ilSetting, $ilUser, ilObjectGUI\$tpl, ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilDiskQuotaActivationChecker\_isActive(), ilDiskQuotaActivationChecker\_isPersonalWorkspaceActive(), ilObjUser\_resetLoginAttempts(), handleIgnoredRequiredFields(), IL_PASSWD_PLAIN, ilUserProfile\isProfileIncomplete(), isSettingChangeable(), loadValuesFromForm(), ilUtil\MB2Bytes(), ilUtil\sendFailure(), League\Flysystem\Adapter\Polyfill\update(), uploadUserPictureObject(), and USER_FOLDER_ID.

755  {
756  global $DIC;
757 
758  $tpl = $DIC['tpl'];
759  $rbacsystem = $DIC['rbacsystem'];
760  $ilias = $DIC['ilias'];
761  $ilUser = $DIC['ilUser'];
762  $ilSetting = $DIC['ilSetting'];
763 
764  // User folder
765  if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write', $this->usrf_ref_id)) {
766  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
767  }
768  // if called from local administration $this->usrf_ref_id is category id
769  // Todo: this has to be fixed. Do not mix user folder id and category id
770  if ($this->usrf_ref_id != USER_FOLDER_ID) {
771  // check if user is assigned to category
772  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
773  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
774  }
775  }
776  $this->initForm("edit");
777 
778  // we do not want to store this dates, they are only printed out
779  unset($_POST['approve_date']);
780  $_POST['agree_date'] = $this->object->getAgreeDate();
781  unset($_POST['last_login']);
782 
783  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
784  $profileMaybeIncomplete = false;
785  if ($this->form_gui->getInput('ignore_rf', false)) {
786  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
787  }
788 
789  if ($this->form_gui->checkInput()) {
790  // @todo: external account; time limit
791  // if not allowed or empty -> do no change password
793  && trim($_POST['passwd']) != "") {
794  $this->object->setPasswd($_POST['passwd'], IL_PASSWD_PLAIN);
795  }
796 
797  /*
798  * reset counter for failed logins
799  * if $_POST['active'] is set to 1
800  */
801  if ($_POST['active'] == 1) {
802  ilObjUser::_resetLoginAttempts($this->object->getId());
803  }
804 
805  #$this->object->assignData($_POST);
806  $this->loadValuesFromForm('update');
807 
808  $udf = array();
809  foreach ($_POST as $k => $v) {
810  if (substr($k, 0, 4) == "udf_") {
811  $udf[substr($k, 4)] = $v;
812  }
813  }
814  $this->object->setUserDefinedData($udf);
815 
816  try {
817  $this->object->updateLogin($_POST['login']);
818  } catch (ilUserException $e) {
819  ilUtil::sendFailure($e->getMessage());
820  $this->form_gui->setValuesByPost();
821  return $tpl->setContent($this->form_gui->getHtml());
822  }
823 
824  $this->object->setTitle($this->object->getFullname());
825  $this->object->setDescription($this->object->getEmail());
826 
827  if ($this->isSettingChangeable('language')) {
828  $this->object->setLanguage($this->form_gui->getInput('language'));
829  }
830 
831  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
833  // set disk quota
834  $this->object->setPref("disk_quota", ilUtil::MB2Bytes($_POST["disk_quota"]));
835  }
837  // set personal workspace disk quota
838  $this->object->setPref("wsp_disk_quota", ilUtil::MB2Bytes($_POST["wsp_disk_quota"]));
839  }
840 
841  if ($this->isSettingChangeable('skin_style')) {
842  //set user skin and style
843  $sknst = explode(":", $_POST["skin_style"]);
844 
845  if ($this->object->getPref("style") != $sknst[1] ||
846  $this->object->getPref("skin") != $sknst[0]) {
847  $this->object->setPref("skin", $sknst[0]);
848  $this->object->setPref("style", $sknst[1]);
849  }
850  }
851  if ($this->isSettingChangeable('hits_per_page')) {
852  $this->object->setPref("hits_per_page", $_POST["hits_per_page"]);
853  }
854  /*if($this->isSettingChangeable('show_users_online'))
855  {
856  $this->object->setPref("show_users_online", $_POST["show_users_online"]);
857  }*/
858  if ($this->isSettingChangeable('hide_own_online_status')) {
859  $this->object->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
860  }
861  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
862  $this->object->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
863  }
864  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
865  $this->object->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
866  }
867 
868  // set a timestamp for last_password_change
869  // this ts is needed by ilSecuritySettings
870  $this->object->setLastPasswordChangeTS(time());
871 
872  global $DIC;
873 
874  $ilSetting = $DIC['ilSetting'];
875  if ((int) $ilSetting->get('session_reminder_enabled')) {
876  $this->object->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
877  }
878 
879  // #10054 - profile may have been completed, check below is only for incomplete
880  $this->object->setProfileIncomplete(false);
881 
882  $this->update = $this->object->update();
883 
884 
885  // If the current user is editing its own user account,
886  // we update his preferences.
887  if ($ilUser->getId() == $this->object->getId()) {
888  $ilUser->readPrefs();
889  }
890  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
891  $ilUser->writePrefs();
892 
893  $mail_message = $this->__sendProfileMail();
894  $msg = $this->lng->txt('saved_successfully') . $mail_message;
895 
896  // same personal image
897  if ($this->isSettingChangeable('upload')) {
898  $this->uploadUserPictureObject();
899  }
900 
901  if ($profileMaybeIncomplete) {
902  include_once 'Services/User/classes/class.ilUserProfile.php';
903  if (ilUserProfile::isProfileIncomplete($this->object)) {
904  $this->object->setProfileIncomplete(true);
905  $this->object->update();
906  }
907  }
908 
909  // feedback
910  ilUtil::sendSuccess($msg, true);
911 
912  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
913  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
914  } else {
915  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
916  }
917  } else {
918  $this->form_gui->setValuesByPost();
919  $tpl->setContent($this->form_gui->getHtml());
920  }
921  }
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
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
loadValuesFromForm($a_mode='create')
uploadUserPictureObject()
upload user image
static MB2Bytes($a_value)
static _resetLoginAttempts($a_usr_id)
static _getAuthMode($a_auth_mode, $a_db_handler='')
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.
$ilUser
Definition: imgupload.php:18
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.
update($pash, $contents, Config $config)
global $ilSetting
Definition: privfeed.php:17
const USER_FOLDER_ID
Class ilObjUserFolder.
$_POST["username"]
+ Here is the call graph for this function:

◆ uploadUserPictureObject()

ilObjUserGUI::uploadUserPictureObject ( )

upload user image

(original method by ratana ty)

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

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

Referenced by saveObject(), and updateObject().

1773  {
1774  global $DIC;
1775 
1776  $ilUser = $DIC['ilUser'];
1777  $rbacsystem = $DIC['rbacsystem'];
1778 
1779  // User folder
1780  if ($this->usrf_ref_id == USER_FOLDER_ID and
1781  !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
1782  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1783  }
1784  // if called from local administration $this->usrf_ref_id is category id
1785  // Todo: this has to be fixed. Do not mix user folder id and category id
1786  if ($this->usrf_ref_id != USER_FOLDER_ID) {
1787  // check if user is assigned to category
1788  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1789  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1790  }
1791  }
1792 
1793  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1794 
1795  if ($_FILES["userfile"]["tmp_name"] == "") {
1796  if ($userfile_input->getDeletionFlag()) {
1797  $this->object->removeUserPicture();
1798  }
1799  return;
1800  }
1801  if ($_FILES["userfile"]["size"] == 0) {
1802  ilUtil::sendFailure($this->lng->txt("msg_no_file"));
1803  } else {
1804  $webspace_dir = ilUtil::getWebspaceDir();
1805  $image_dir = $webspace_dir . "/usr_images";
1806  $store_file = "usr_" . $this->object->getId() . "." . "jpg";
1807 
1808  // store filename
1809  $this->object->setPref("profile_image", $store_file);
1810  $this->object->update();
1811 
1812  // move uploaded file
1813  $pi = pathinfo($_FILES["userfile"]["name"]);
1814  $uploaded_file = $image_dir . "/upload_" . $this->object->getId() . "." . $pi["extension"];
1815  if (!ilUtil::moveUploadedFile(
1816  $_FILES["userfile"]["tmp_name"],
1817  $_FILES["userfile"]["name"],
1818  $uploaded_file,
1819  false
1820  )) {
1821  ilUtil::sendFailure($this->lng->txt("upload_error", true));
1822  $this->ctrl->redirect($this, "showProfile");
1823  }
1824  chmod($uploaded_file, 0770);
1825 
1826  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1827  // taking only frame [0] to avoid problems with animated gifs
1828  $show_file = "$image_dir/usr_" . $this->object->getId() . ".jpg";
1829  $thumb_file = "$image_dir/usr_" . $this->object->getId() . "_small.jpg";
1830  $xthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xsmall.jpg";
1831  $xxthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xxsmall.jpg";
1832  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
1833  $show_file = ilUtil::escapeShellArg($show_file);
1834  $thumb_file = ilUtil::escapeShellArg($thumb_file);
1835  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
1836  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
1837 
1838  if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
1839  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
1840  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
1841  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
1842  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
1843  } else {
1844  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
1845  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
1846  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
1847  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
1848  }
1849  }
1850  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
global $DIC
Definition: saml.php:7
static execConvert($args)
execute convert command
$ilUser
Definition: imgupload.php:18
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)
const USER_FOLDER_ID
Class ilObjUserFolder.
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(), _goto(), editObject(), and getValues().

◆ $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: