ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 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 ()
 

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...
 
 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
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 

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"]
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

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

References $_SESSION, and ilUtil\formSelect().

Referenced by roleassignmentObject().

2222  {
2223  $action[0] = $this->lng->txt('assigned_roles');
2224  $action[1] = $this->lng->txt('all_roles');
2225  $action[2] = $this->lng->txt('all_global_roles');
2226  $action[3] = $this->lng->txt('all_local_roles');
2227  $action[4] = $this->lng->txt('internal_local_roles_only');
2228  $action[5] = $this->lng->txt('non_internal_local_roles_only');
2229 
2230  return ilUtil::formSelect($_SESSION['filtered_roles'], "filter", $action, false, true);
2231  }
$_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 2160 of file class.ilObjUserGUI.php.

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

2161  {
2162  switch ($a_type) {
2163  case "minute":
2164  for ($i = 0;$i <= 60;$i++) {
2165  $days[$i] = $i < 10 ? "0" . $i : $i;
2166  }
2167  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2168 
2169  case "hour":
2170  for ($i = 0;$i < 24;$i++) {
2171  $days[$i] = $i < 10 ? "0" . $i : $i;
2172  }
2173  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2174 
2175  case "day":
2176  for ($i = 1;$i < 32;$i++) {
2177  $days[$i] = $i < 10 ? "0" . $i : $i;
2178  }
2179  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2180 
2181  case "month":
2182  for ($i = 1;$i < 13;$i++) {
2183  $month[$i] = $i < 10 ? "0" . $i : $i;
2184  }
2185  return ilUtil::formSelect($a_selected, $a_varname, $month, false, true);
2186 
2187  case "year":
2188  if ($a_selected < date('Y', time())) {
2189  $start = $a_selected;
2190  } else {
2191  $start = date('Y', time());
2192  }
2193 
2194  for ($i = $start;$i < date("Y", time()) + 11;++$i) {
2195  $year[$i] = $i;
2196  }
2197  return ilUtil::formSelect($a_selected, $a_varname, $year, false, true);
2198  }
2199  }
$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: 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 2201 of file class.ilObjUserGUI.php.

2202  {
2203  return mktime(
2204  $a_time_arr["hour"],
2205  $a_time_arr["minute"],
2206  $a_time_arr["second"],
2207  $a_time_arr["month"],
2208  $a_time_arr["day"],
2209  $a_time_arr["year"]
2210  );
2211  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References $_SESSION.

2217  {
2218  unset($_SESSION["filtered_roles"]);
2219  }
$_SESSION["AccountId"]

◆ _goto()

static ilObjUserGUI::_goto (   $a_target)
static

Goto user profile screen.

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

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

2361  {
2362  global $DIC;
2363 
2364  $ilUser = $DIC['ilUser'];
2365  $ilCtrl = $DIC['ilCtrl'];
2366 
2367  // #10888
2368  if ($a_target == md5("usrdelown")) {
2369  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2370  $ilUser->hasDeletionFlag()) {
2371  $ilCtrl->initBaseClass("ildashboardgui");
2372  $ilCtrl->redirectByClass(array("ildashboardgui", "ilpersonalsettingsgui"), "deleteOwnAccount3");
2373  }
2374  exit("This account is not flagged for deletion."); // #12160
2375  }
2376 
2377  // badges
2378  if (substr($a_target, -4) == "_bdg") {
2379  $_GET["baseClass"] = "ilDashboardGUI";
2380  $_GET["cmd"] = "jumpToBadges";
2381  include("ilias.php");
2382  exit();
2383  }
2384 
2385  if ('registration' == $a_target) {
2386  $_GET["baseClass"] = 'ilStartUpGUI';
2387  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilAccountRegistrationGUI'), '');
2388  } elseif ('nameassist' == $a_target) {
2389  $_GET["baseClass"] = 'ilStartUpGUI';
2390  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), 'showUsernameAssistanceForm');
2391  } elseif ('pwassist' == $a_target) {
2392  $_GET["baseClass"] = 'ilStartUpGUI';
2393  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), '');
2394  } elseif ('agreement' == $a_target) {
2395  if ($ilUser->getId() > 0 && !$ilUser->isAnonymous()) {
2396  $ilCtrl->setTargetScript('ilias.php');
2397  $ilCtrl->initBaseClass('ildashboardgui');
2398  $ilCtrl->redirectByClass(array('ildashboardgui', 'ilpersonalprofilegui'), 'showUserAgreement');
2399  } else {
2400  $_GET['baseClass'] = 'ilStartUpGUI';
2401  $ilCtrl->setTargetScript('ilias.php');
2402  $ilCtrl->redirectByClass(array('ilStartUpGUI'), 'showTermsOfService');
2403  }
2404  }
2405 
2406  if (substr($a_target, 0, 1) == "n") {
2407  $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
2408  }
2409 
2410  if (strpos($a_target, 'contact_approved') !== false) {
2411  $_GET['cmd'] = 'approveContactRequest';
2412  } elseif (strpos($a_target, 'contact_ignored') !== false) {
2413  $_GET['cmd'] = 'ignoreContactRequest';
2414  } else {
2415  $_GET['cmd'] = 'view';
2416  }
2417 
2418  $_GET["user_id"] = (int) $a_target;
2419  $_GET["baseClass"] = "ilPublicUserProfileGUI";
2420  $_GET["cmdClass"] = "ilpublicuserprofilegui";
2421  include("ilias.php");
2422  exit;
2423  }
exit
Definition: login.php:29
$_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
$DIC
Definition: xapitoken.php:46
+ 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 2243 of file class.ilObjUserGUI.php.

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

2244  {
2245  global $DIC;
2246 
2247  $ilLocator = $DIC['ilLocator'];
2248 
2249  $ilLocator->clearItems();
2250 
2251  if ($_GET["admin_mode"] == "settings") { // system settings
2252  $this->ctrl->setParameterByClass(
2253  "ilobjsystemfoldergui",
2254  "ref_id",
2255  SYSTEM_FOLDER_ID
2256  );
2257  $ilLocator->addItem(
2258  $this->lng->txt("administration"),
2259  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2260  ilFrameTargetInfo::_getFrame("MainContent")
2261  );
2262 
2263  if ($_GET['ref_id'] == USER_FOLDER_ID) {
2264  $ilLocator->addItem(
2265  $this->lng->txt("obj_" . ilObject::_lookupType(
2266  ilObject::_lookupObjId($_GET["ref_id"])
2267  )),
2268  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view")
2269  );
2270  } elseif ($_GET['ref_id'] == ROLE_FOLDER_ID) {
2271  $ilLocator->addItem(
2272  $this->lng->txt("obj_" . ilObject::_lookupType(
2273  ilObject::_lookupObjId($_GET["ref_id"])
2274  )),
2275  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
2276  );
2277  }
2278 
2279  if ($_GET["obj_id"] > 0) {
2280  $ilLocator->addItem(
2281  $this->object->getTitle(),
2282  $this->ctrl->getLinkTarget($this, "view")
2283  );
2284  }
2285  } else { // repository administration
2286  // ?
2287  }
2288  }
$_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.
$DIC
Definition: xapitoken.php:46
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

Apply filter.

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

References roleassignmentObject().

2140  {
2141  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2142  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2143  $table_gui->writeFilterToSession(); // writes filter to session
2144  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2145  $this->roleassignmentObject();
2146  }
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 1919 of file class.ilObjUserGUI.php.

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

1920  {
1921  global $DIC;
1922 
1923  $rbacsystem = $DIC['rbacsystem'];
1924  $rbacadmin = $DIC['rbacadmin'];
1925  $rbacreview = $DIC['rbacreview'];
1926 
1927  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1928  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1929  }
1930 
1931  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
1932  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
1933 
1934  // prevent unassignment of system role from system user
1935  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1936  array_push($selected_roles, SYSTEM_ROLE_ID);
1937  }
1938 
1939  $global_roles_all = $rbacreview->getGlobalRoles();
1940  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
1941  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1942  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1943  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1944  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1945 
1946  if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
1947  or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles))) {
1948  //$this->ilias->raiseError($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),$this->ilias->error_obj->MESSAGE);
1949  // workaround. sometimes jumps back to wrong page
1950  ilUtil::sendFailure($this->lng->txt("msg_min_one_role") . "<br/>" . $this->lng->txt("action_aborted"), true);
1951  $this->ctrl->redirect($this, 'roleassignment');
1952  }
1953 
1954  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1955  $rbacadmin->deassignUser($role, $this->object->getId());
1956  }
1957 
1958  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1959  $rbacadmin->assignUser($role, $this->object->getId(), false);
1960  }
1961 
1962  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
1963 
1964  // update object data entry (to update last modification date)
1965  $this->object->update();
1966 
1967  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"), true);
1968 
1969  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
1970  $this->ctrl->redirect($this, 'roleassignment');
1971  } else {
1972  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1973  }
1974  }
$_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.
$DIC
Definition: xapitoken.php:46
$_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) 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  }
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ editObject()

ilObjUserGUI::editObject ( )

Display user edit form.

public

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

References ilObjectGUI\$access, $DIC, ilObjectGUI\$rbacsystem, getValues(), ilObjUserFolder\ORG_OP_EDIT_USER_ACCOUNTS, and USER_FOLDER_ID.

Referenced by removeUserPictureObject().

556  {
557  global $DIC;
558 
559  $ilias = $DIC['ilias'];
560  $rbacsystem = $DIC->rbac()->system();
561  $access = $DIC->access();
562 
563  // User folder
564  // User folder && access granted by rbac or by org unit positions
565  if ($this->usrf_ref_id == USER_FOLDER_ID &&
566  (
567  !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id) ||
568  !$access->checkRbacOrPositionPermissionAccess('write', \ilObjUserFolder::ORG_OP_EDIT_USER_ACCOUNTS, $this->usrf_ref_id) ||
569  !in_array(
570  $this->object->getId(),
571  $access->filterUserIdsByRbacOrPositionOfCurrentUser(
572  'write',
575  [$this->object->getId()]
576  )
577  )
578  )
579  ) {
580  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
581  }
582 
583  if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
584  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
585  }
586  // if called from local administration $this->usrf_ref_id is category id
587  // Todo: this has to be fixed. Do not mix user folder id and category id
588  if ($this->usrf_ref_id != USER_FOLDER_ID) {
589  // check if user is assigned to category
590  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
591  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
592  }
593  }
594 
595  if ($this->usrf_ref_id != USER_FOLDER_ID) {
596  $this->tabs_gui->clearTargets();
597  }
598 
599  // get form
600  $this->initForm("edit");
601  $this->getValues();
602  $this->showAcceptedTermsOfService();
603  $this->tpl->setContent($this->form_gui->getHTML());
604  }
getValues()
Get values from user object and put them into form.
redirection script todo: (a better solution should control the processing via a xml file) ...
$DIC
Definition: xapitoken.php:46
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, 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  }
Class ilObjectOwnershipManagementGUI.
prepareOutput($a_show_subobjects=true)
prepare output
$DIC
Definition: xapitoken.php:46
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, 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
$DIC
Definition: xapitoken.php:46
+ 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 954 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(), 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(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setRows(), ilPasswordInputGUI\setUseStripSlashes(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), USER_FOLDER_ID, and ilUtil\yn2tf().

Referenced by editObject().

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

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

Referenced by saveObject(), and updateObject().

2434  {
2435  $profileMaybeIncomplete = false;
2436 
2437  require_once 'Services/User/classes/class.ilUserProfile.php';
2438 
2439  foreach (ilUserProfile::getIgnorableRequiredSettings() as $fieldName) {
2440  $elm = $this->form_gui->getItemByPostVar($fieldName);
2441 
2442  if (!$elm) {
2443  continue;
2444  }
2445 
2446  if ($elm->getRequired()) {
2447  $profileMaybeIncomplete = true;
2448 
2449  // Flag as optional
2450  $elm->setRequired(false);
2451  }
2452  }
2453 
2454  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
2455  $user_defined_fields = ilUserDefinedFields::_getInstance();
2456  foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
2457  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
2458 
2459  if (!$elm) {
2460  continue;
2461  }
2462 
2463  if ($elm->getRequired() && $definition['changeable'] && $definition['required'] && $definition['visible']) {
2464  $profileMaybeIncomplete = true;
2465 
2466  // Flag as optional
2467  $elm->setRequired(false);
2468  }
2469  }
2470 
2471  return $profileMaybeIncomplete;
2472  }
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 2233 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2234  {
2235  parent::hitsperpageObject();
2236  $this->roleassignmentObject();
2237  }
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(), 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  }
static _getAssignUsersStatus($a_role_id)
$keys
Definition: metadata.php:187
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
$DIC
Definition: xapitoken.php:46
const USER_FOLDER_ID
Class ilObjUserFolder.
+ 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 1768 of file class.ilObjUserGUI.php.

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

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

1769  {
1770  // TODO: Allow mixed field parameter to support checks against an array of field names.
1771 
1772  global $DIC;
1773 
1774  $ilSetting = $DIC['ilSetting'];
1775  static $settings = null;
1776 
1777 
1778 
1779  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1780  return true;
1781  }
1782 
1783  if ($settings == null) {
1784  $settings = $ilSetting->getAll();
1785  }
1786  return (bool) $settings['usr_settings_changeable_lua_' . $a_field];
1787  }
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
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 610 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().

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

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

1880  {
1881  $webspace_dir = ilUtil::getWebspaceDir();
1882  $image_dir = $webspace_dir . "/usr_images";
1883  $file = $image_dir . "/usr_" . $this->object->getID() . "." . "jpg";
1884  $thumb_file = $image_dir . "/usr_" . $this->object->getID() . "_small.jpg";
1885  $xthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xsmall.jpg";
1886  $xxthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xxsmall.jpg";
1887  $upload_file = $image_dir . "/upload_" . $this->object->getID();
1888 
1889  // remove user pref file name
1890  $this->object->setPref("profile_image", "");
1891  $this->object->update();
1892  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1893 
1894  if (@is_file($file)) {
1895  unlink($file);
1896  }
1897  if (@is_file($thumb_file)) {
1898  unlink($thumb_file);
1899  }
1900  if (@is_file($xthumb_file)) {
1901  unlink($xthumb_file);
1902  }
1903  if (@is_file($xxthumb_file)) {
1904  unlink($xxthumb_file);
1905  }
1906  if (@is_file($upload_file)) {
1907  unlink($upload_file);
1908  }
1909 
1910  $this->editObject();
1911  }
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 2151 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2152  {
2153  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2154  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2155  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2156  $table_gui->resetFilter(); // clears filter
2157  $this->roleassignmentObject();
2158  }
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 1981 of file class.ilObjUserGUI.php.

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

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

1982  {
1983  global $DIC;
1984 
1985  $rbacreview = $DIC['rbacreview'];
1986  $rbacsystem = $DIC['rbacsystem'];
1987  $ilUser = $DIC['ilUser'];
1988  $ilTabs = $DIC['ilTabs'];
1989  $access = $DIC->access();
1990 
1991  $ilTabs->activateTab("role_assignment");
1992 
1993  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id) &&
1994  !$access->isCurrentUserBasedOnPositionsAllowedTo("read_users", array($this->object->getId()))
1995  ) {
1996  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1997  }
1998 
1999  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
2000 
2001  if ($_SESSION['filtered_roles'] > 5) {
2002  $_SESSION['filtered_roles'] = 0;
2003  }
2004 
2005  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
2006 
2007  if (false) {
2008  $this->tpl->setCurrentBlock("form_filter");
2009  $this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
2010  $this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
2011  $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
2012  $this->tpl->setVariable("FILTER_NAME", 'roleassignment');
2013  $this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
2014  $this->tpl->parseCurrentBlock();
2015  }
2016 
2017  // init table
2018  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2019  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
2020 
2021  // now get roles depending on filter settings
2022  $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"], $this->object->getId());
2023  $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
2024 
2025  $counter = 0;
2026 
2027  include_once('./Services/AccessControl/classes/class.ilObjRole.php');
2028 
2029  $records = array();
2030  foreach ($role_list as $role) {
2031  // fetch context path of role
2032  $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
2033 
2034  // only list roles that are not set to status "deleted"
2035  if ($rbacreview->isDeleted($rolf[0])) {
2036  continue;
2037  }
2038 
2039  // build context path
2040  $path = "";
2041 
2042  if ($this->tree->isInTree($rolf[0])) {
2043  if ($rolf[0] == ROLE_FOLDER_ID) {
2044  $path = $this->lng->txt("global");
2045  } else {
2046  $tmpPath = $this->tree->getPathFull($rolf[0]);
2047 
2048  // count -1, to exclude the role folder itself
2049  /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
2050  {
2051  if ($path != "")
2052  {
2053  $path .= " > ";
2054  }
2055 
2056  $path .= $tmpPath[$i]["title"];
2057  }*/
2058 
2059  $path = $tmpPath[count($tmpPath) - 1]["title"];
2060  }
2061  } else {
2062  $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role["obj_id"] . ")</b>";
2063  }
2064 
2065  $disabled = false;
2066 
2067  // disable checkbox for system role for the system user
2068  if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
2069  or (!in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID)) {
2070  $disabled = true;
2071  }
2072 
2073  // protected admin role
2074  if ($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
2075  include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
2076  if (ilSecuritySettings::_getInstance()->isAdminRoleProtected()) {
2077  $disabled = true;
2078  }
2079  }
2080 
2081  if (substr($role["title"], 0, 3) == "il_") {
2082  if (!$assignable) {
2083  $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
2084  $rolf2 = $rolf_arr[0];
2085  } else {
2086  $rolf2 = $rolf;
2087  }
2088 
2089  $parent_node = $this->tree->getNodeData($rolf2);
2090 
2091  $role["description"] = $this->lng->txt("obj_" . $parent_node["type"]) . "&nbsp;(#" . $parent_node["obj_id"] . ")";
2092  }
2093 
2094  $role_ids[$counter] = $role["obj_id"];
2095 
2096  $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"] . "\"/>";
2097  $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
2098  $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
2099  $result_set[$counter][] = $link = "<a href=\"" . $this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm") . "\">" . ilObjRole::_getTranslation($role["title"]) . "</a>";
2100  $title = ilObjRole::_getTranslation($role["title"]);
2101  $result_set[$counter][] = $role["description"];
2102 
2103  // Add link to objector local Rores
2104  if ($role["role_type"] == "local") {
2105  // Get Object to the role
2106  $obj_id = $rbacreview->getObjectOfRole($role["rol_id"]);
2107 
2108  $obj_type = ilObject::_lookupType($obj_id);
2109 
2111 
2112  foreach ($ref_ids as $ref_id) {
2113  }
2114 
2115  require_once("./Services/Link/classes/class.ilLink.php");
2116 
2117  $result_set[$counter][] = $context = "<a href='" . ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id)) . "' target='_top'>" . $path . "</a>";
2118  } else {
2119  $result_set[$counter][] = $path;
2120  $context = $path;
2121  }
2122 
2123  $records[] = array("path" => $path, "description" => $role["description"],
2124  "context" => $context, "checkbox" => $checkbox,
2125  "role" => $link, "title" => $title);
2126  ++$counter;
2127  }
2128 
2129  if (true) {
2130  $tab->setData($records);
2131  $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
2132  return;
2133  }
2134  }
$context
Definition: webdav.php:26
$_SESSION["AccountId"]
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.
$DIC
Definition: xapitoken.php:46
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\$rbacsystem, 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
461  // The disk quota is entered in megabytes but stored in bytes
462  $userObj->setPref("disk_quota", ilUtil::MB2Bytes($_POST["disk_quota"]));
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
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.
$DIC
Definition: xapitoken.php:46
$_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 2290 of file class.ilObjUserGUI.php.

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

2291  {
2292  }
+ Here is the call graph for this function:

◆ updateObject()

ilObjUserGUI::updateObject ( )

Update user.

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

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

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

1797  {
1798  global $DIC;
1799 
1800  $ilUser = $DIC['ilUser'];
1801  $rbacsystem = $DIC['rbacsystem'];
1802 
1803  // User folder
1804  if ($this->usrf_ref_id == USER_FOLDER_ID and
1805  !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
1806  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1807  }
1808  // if called from local administration $this->usrf_ref_id is category id
1809  // Todo: this has to be fixed. Do not mix user folder id and category id
1810  if ($this->usrf_ref_id != USER_FOLDER_ID) {
1811  // check if user is assigned to category
1812  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1813  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1814  }
1815  }
1816 
1817  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1818 
1819  if ($_FILES["userfile"]["tmp_name"] == "") {
1820  if ($userfile_input->getDeletionFlag()) {
1821  $this->object->removeUserPicture();
1822  }
1823  return;
1824  }
1825  if ($_FILES["userfile"]["size"] == 0) {
1826  ilUtil::sendFailure($this->lng->txt("msg_no_file"));
1827  } else {
1828  $webspace_dir = ilUtil::getWebspaceDir();
1829  $image_dir = $webspace_dir . "/usr_images";
1830  $store_file = "usr_" . $this->object->getId() . "." . "jpg";
1831 
1832  // store filename
1833  $this->object->setPref("profile_image", $store_file);
1834  $this->object->update();
1835 
1836  // move uploaded file
1837  $pi = pathinfo($_FILES["userfile"]["name"]);
1838  $uploaded_file = $image_dir . "/upload_" . $this->object->getId() . "." . $pi["extension"];
1840  $_FILES["userfile"]["tmp_name"],
1841  $_FILES["userfile"]["name"],
1842  $uploaded_file,
1843  false
1844  )) {
1845  ilUtil::sendFailure($this->lng->txt("upload_error", true));
1846  $this->ctrl->redirect($this, "showProfile");
1847  }
1848  chmod($uploaded_file, 0770);
1849 
1850  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1851  // taking only frame [0] to avoid problems with animated gifs
1852  $show_file = "$image_dir/usr_" . $this->object->getId() . ".jpg";
1853  $thumb_file = "$image_dir/usr_" . $this->object->getId() . "_small.jpg";
1854  $xthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xsmall.jpg";
1855  $xxthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xxsmall.jpg";
1856  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
1857  $show_file = ilUtil::escapeShellArg($show_file);
1858  $thumb_file = ilUtil::escapeShellArg($thumb_file);
1859  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
1860  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
1861 
1862  if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
1863  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
1864  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
1865  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
1866  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
1867  } else {
1868  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
1869  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
1870  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
1871  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
1872  }
1873  }
1874  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
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
$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)
$DIC
Definition: xapitoken.php:46
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(), 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: