ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 Constructor public. 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...
 

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
 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...
 

Additional Inherited Members

- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $rbacsystem
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjUserGUI::__construct (   $a_data,
  $a_id,
  $a_call_by_reference = false,
  $a_prepare_output = true 
)

Constructor public.

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

References $_GET, $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$ref_id, array, and object.

47  {
48  global $ilCtrl, $lng;
49 
50  define('USER_FOLDER_ID', 7);
51 
52  $this->type = "usr";
53  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
54  $this->usrf_ref_id =&$this->ref_id;
55 
56  $this->ctrl = $ilCtrl;
57  $this->ctrl->saveParameter($this, array('obj_id', 'letter'));
58  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "letter", $_GET["letter"]);
59  $this->ctrl->setContext($this->object->getId(), 'usr');
60  $lng->loadLanguageModule('user');
61 
62  // for gender selection. don't change this
63  // maybe deprecated
64  $this->gender = array(
65  'n' => "salutation_n",
66  'm' => "salutation_m",
67  'f' => "salutation_f",
68  );
69  }
$_GET["client_id"]
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

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

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

Referenced by roleassignmentObject().

2126  {
2127  $action[0] = $this->lng->txt('assigned_roles');
2128  $action[1] = $this->lng->txt('all_roles');
2129  $action[2] = $this->lng->txt('all_global_roles');
2130  $action[3] = $this->lng->txt('all_local_roles');
2131  $action[4] = $this->lng->txt('internal_local_roles_only');
2132  $action[5] = $this->lng->txt('non_internal_local_roles_only');
2133 
2134  return ilUtil::formSelect($_SESSION['filtered_roles'], "filter", $action, false, true);
2135  }
$_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 216 of file class.ilObjUserGUI.php.

References $_POST, and ilUserDefinedFields\_getInstance().

217  {
218  include_once './Services/User/classes/class.ilUserDefinedFields.php';
219  $this->user_defined_fields =&ilUserDefinedFields::_getInstance();
220 
221  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
222  if ($definition['required'] and !strlen($_POST['udf'][$field_id])) {
223  return false;
224  }
225  }
226  return true;
227  }
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 2064 of file class.ilObjUserGUI.php.

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

2065  {
2066  switch ($a_type) {
2067  case "minute":
2068  for ($i=0;$i<=60;$i++) {
2069  $days[$i] = $i < 10 ? "0" . $i : $i;
2070  }
2071  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2072 
2073  case "hour":
2074  for ($i=0;$i<24;$i++) {
2075  $days[$i] = $i < 10 ? "0" . $i : $i;
2076  }
2077  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2078 
2079  case "day":
2080  for ($i=1;$i<32;$i++) {
2081  $days[$i] = $i < 10 ? "0" . $i : $i;
2082  }
2083  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2084 
2085  case "month":
2086  for ($i=1;$i<13;$i++) {
2087  $month[$i] = $i < 10 ? "0" . $i : $i;
2088  }
2089  return ilUtil::formSelect($a_selected, $a_varname, $month, false, true);
2090 
2091  case "year":
2092  if ($a_selected < date('Y', time())) {
2093  $start = $a_selected;
2094  } else {
2095  $start = date('Y', time());
2096  }
2097 
2098  for ($i = $start;$i < date("Y", time()) + 11;++$i) {
2099  $year[$i] = $i;
2100  }
2101  return ilUtil::formSelect($a_selected, $a_varname, $year, false, true);
2102  }
2103  }
$a_type
Definition: workflow.php:92
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

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

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

231  {
232  include_once './Services/User/classes/class.ilUserDefinedFields.php';
233  $this->user_defined_fields =&ilUserDefinedFields::_getInstance();
234 
235  if ($this->object->getType() == 'usr') {
236  $user_defined_data = $this->object->getUserDefinedData();
237  }
238  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
239  $old = isset($_SESSION["error_post_vars"]["udf"][$field_id]) ?
240  $_SESSION["error_post_vars"]["udf"][$field_id] : $user_defined_data[$field_id];
241 
242  if ($definition['field_type'] == UDF_TYPE_TEXT) {
243  $this->tpl->setCurrentBlock("field_text");
244  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
245  $this->tpl->setVariable("FIELD_VALUE", ilUtil::prepareFormOutput($old));
246  $this->tpl->parseCurrentBlock();
247  } else {
248  $this->tpl->setCurrentBlock("field_select");
249  $this->tpl->setVariable("SELECT_BOX", ilUtil::formSelect(
250  $old,
251  'udf[' . $definition['field_id'] . ']',
252  $this->user_defined_fields->fieldValuesToSelectArray(
253  $definition['field_values']
254  ),
255  false,
256  true
257  ));
258  $this->tpl->parseCurrentBlock();
259  }
260  $this->tpl->setCurrentBlock("user_defined");
261 
262  if ($definition['required']) {
263  $name = $definition['field_name'] . "<span class=\"asterisk\">*</span>";
264  } else {
265  $name = $definition['field_name'];
266  }
267  $this->tpl->setVariable("TXT_FIELD_NAME", $name);
268  $this->tpl->parseCurrentBlock();
269  }
270  return true;
271  }
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:146
const UDF_TYPE_TEXT
$old
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.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ __toUnix()

ilObjUserGUI::__toUnix (   $a_time_arr)

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

2106  {
2107  return mktime(
2108  $a_time_arr["hour"],
2109  $a_time_arr["minute"],
2110  $a_time_arr["second"],
2111  $a_time_arr["month"],
2112  $a_time_arr["day"],
2113  $a_time_arr["year"]
2114  );
2115  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References $_SESSION.

2121  {
2122  unset($_SESSION["filtered_roles"]);
2123  }
$_SESSION["AccountId"]

◆ _goto()

static ilObjUserGUI::_goto (   $a_target)
static

Goto user profile screen.

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

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

2258  {
2259  global $ilUser, $ilCtrl;
2260 
2261  // #10888
2262  if ($a_target == md5("usrdelown")) {
2263  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2264  $ilUser->hasDeletionFlag()) {
2265  $ilCtrl->setTargetScript("ilias.php");
2266  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2267  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalsettingsgui"), "deleteOwnAccount3");
2268  }
2269  exit("This account is not flagged for deletion."); // #12160
2270  }
2271 
2272  // badges
2273  if (substr($a_target, -4) == "_bdg") {
2274  $_GET["baseClass"] = "ilPersonalDesktopGUI";
2275  $_GET["cmd"] = "jumpToBadges";
2276  include("ilias.php");
2277  exit();
2278  }
2279 
2280  if ('registration' == $a_target) {
2281  $_GET["baseClass"] = 'ilStartUpGUI';
2282  $ilCtrl->setTargetScript('ilias.php');
2283  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilAccountRegistrationGUI'), '');
2284  } elseif ('nameassist' == $a_target) {
2285  $_GET["baseClass"] = 'ilStartUpGUI';
2286  $ilCtrl->setTargetScript('ilias.php');
2287  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), 'showUsernameAssistanceForm');
2288  } elseif ('pwassist' == $a_target) {
2289  $_GET["baseClass"] = 'ilStartUpGUI';
2290  $ilCtrl->setTargetScript('ilias.php');
2291  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), '');
2292  } elseif ('agreement' == $a_target) {
2293  if ($ilUser->getId() > 0 && !$ilUser->isAnonymous()) {
2294  $ilCtrl->setTargetScript("ilias.php");
2295  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2296  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalprofilegui"), "showUserAgreement");
2297  } else {
2298  $_GET["baseClass"] = 'ilStartUpGUI';
2299  $ilCtrl->setTargetScript('ilias.php');
2300  $ilCtrl->redirectByClass(array('ilStartUpGUI'), 'showTermsOfService');
2301  }
2302  }
2303 
2304  if (substr($a_target, 0, 1) == "n") {
2305  $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
2306  }
2307 
2308  if (strpos($a_target, 'contact_approved') !== false) {
2309  $_GET['cmd'] = 'approveContactRequest';
2310  } elseif (strpos($a_target, 'contact_ignored') !== false) {
2311  $_GET['cmd'] = 'ignoreContactRequest';
2312  } else {
2313  $_GET['cmd'] = 'view';
2314  }
2315 
2316  $_GET["user_id"] = (int) $a_target;
2317  $_GET["baseClass"] = "ilPublicUserProfileGUI";
2318  $_GET["cmdClass"] = "ilpublicuserprofilegui";
2319  include("ilias.php");
2320  exit;
2321  }
$_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
Create styles array
The data for the language used.
+ 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 2147 of file class.ilObjUserGUI.php.

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

2148  {
2149  global $ilLocator;
2150 
2151  $ilLocator->clearItems();
2152 
2153  if ($_GET["admin_mode"] == "settings") { // system settings
2154  $this->ctrl->setParameterByClass(
2155  "ilobjsystemfoldergui",
2156  "ref_id",
2157  SYSTEM_FOLDER_ID
2158  );
2159  $ilLocator->addItem(
2160  $this->lng->txt("administration"),
2161  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2162  ilFrameTargetInfo::_getFrame("MainContent")
2163  );
2164 
2165  if ($_GET['ref_id'] == USER_FOLDER_ID) {
2166  $ilLocator->addItem(
2167  $this->lng->txt("obj_" . ilObject::_lookupType(
2168  ilObject::_lookupObjId($_GET["ref_id"])
2169  )),
2170  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view")
2171  );
2172  } elseif ($_GET['ref_id'] == ROLE_FOLDER_ID) {
2173  $ilLocator->addItem(
2174  $this->lng->txt("obj_" . ilObject::_lookupType(
2175  ilObject::_lookupObjId($_GET["ref_id"])
2176  )),
2177  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
2178  );
2179  }
2180 
2181  if ($_GET["obj_id"] > 0) {
2182  $ilLocator->addItem(
2183  $this->object->getTitle(),
2184  $this->ctrl->getLinkTarget($this, "view")
2185  );
2186  }
2187  } else { // repository administration
2188  // ?
2189  }
2190  }
$_GET["client_id"]
static _lookupObjId($a_id)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getFrame($a_class, $a_type='')
Get content frame name.
Create new PHPExcel object
obj_idprivate
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

Apply filter.

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

References roleassignmentObject().

2044  {
2045  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2046  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2047  $table_gui->writeFilterToSession(); // writes filter to session
2048  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2049  $this->roleassignmentObject();
2050  }
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 1835 of file class.ilObjUserGUI.php.

References $_GET, $_POST, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, array, object, ilUtil\sendFailure(), and ilUtil\sendSuccess().

1836  {
1837  global $rbacsystem, $rbacadmin, $rbacreview;
1838 
1839  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1840  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1841  }
1842 
1843  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
1844  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
1845 
1846  // prevent unassignment of system role from system user
1847  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1848  array_push($selected_roles, SYSTEM_ROLE_ID);
1849  }
1850 
1851  $global_roles_all = $rbacreview->getGlobalRoles();
1852  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
1853  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1854  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1855  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1856  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1857 
1858  if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
1859  or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles))) {
1860  //$this->ilias->raiseError($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),$this->ilias->error_obj->MESSAGE);
1861  // workaround. sometimes jumps back to wrong page
1862  ilUtil::sendFailure($this->lng->txt("msg_min_one_role") . "<br/>" . $this->lng->txt("action_aborted"), true);
1863  $this->ctrl->redirect($this, 'roleassignment');
1864  }
1865 
1866  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1867  $rbacadmin->deassignUser($role, $this->object->getId());
1868  }
1869 
1870  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1871  $rbacadmin->assignUser($role, $this->object->getId(), false);
1872  }
1873 
1874  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
1875 
1876  // update object data entry (to update last modification date)
1877  $this->object->update();
1878 
1879  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"), true);
1880 
1881  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
1882  $this->ctrl->redirect($this, 'roleassignment');
1883  } else {
1884  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1885  }
1886  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

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

References $_GET, and ilSession\clear().

121  {
122  ilSession::clear("saved_post");
123 
124  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
125  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
126  //$return_location = $_GET["cmd_return_location"];
127  //ilUtil::redirect($this->ctrl->getLinkTarget($this,$return_location));
128  } else {
129  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
130  }
131  }
$_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 331 of file class.ilObjUserGUI.php.

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

332  {
334 
335  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id) and
336  !$rbacsystem->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
337  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
338  }
339 
340  $this->initCreate();
341  $this->initForm("create");
342  return $tpl->setContent($this->form_gui->getHtml());
343  }
$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 503 of file class.ilObjUserGUI.php.

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

Referenced by removeUserPictureObject().

504  {
505  global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser
507 
508  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
509 
510  //load ILIAS settings
511  $settings = $ilias->getAllSettings();
512 
513  // User folder
514  if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
515  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
516  }
517  // if called from local administration $this->usrf_ref_id is category id
518  // Todo: this has to be fixed. Do not mix user folder id and category id
519  if ($this->usrf_ref_id != USER_FOLDER_ID) {
520  // check if user is assigned to category
521  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
522  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
523  }
524  }
525 
526  if ($this->usrf_ref_id != USER_FOLDER_ID) {
527  $this->tabs_gui->clearTargets();
528  }
529 
530  // get form
531  $this->initForm("edit");
532  $this->getValues();
533  $this->showAcceptedTermsOfService();
534  $this->tpl->setContent($this->form_gui->getHTML());
535  }
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 71 of file class.ilObjUserGUI.php.

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

72  {
73  global $rbacsystem;
74 
75  $next_class = $this->ctrl->getNextClass($this);
76  $cmd = $this->ctrl->getCmd();
77 
78  $this->prepareOutput();
79 
80  switch ($next_class) {
81  case "illearningprogressgui":
82  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
84  $this->ctrl->forwardCommand($new_gui);
85  break;
86 
87  case "ilobjectownershipmanagementgui":
88  include_once("Services/Object/classes/class.ilObjectOwnershipManagementGUI.php");
89  $gui = new ilObjectOwnershipManagementGUI($this->object->getId());
90  $this->ctrl->forwardCommand($gui);
91  break;
92 
93  default:
94  if ($cmd == "" || $cmd == "view") {
95  $cmd = "edit";
96  }
97  $cmd .= "Object";
98  $return = $this->$cmd();
99 
100  break;
101  }
102  return $return;
103  }
Class ilObjectOwnershipManagementGUI.
prepareOutput($a_show_subobjects=true)
prepare output
Create new PHPExcel object
obj_idprivate
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 136 of file class.ilObjUserGUI.php.

References getTabs().

137  {
138  $this->getTabs();
139  }
+ Here is the call graph for this function:

◆ getTabs()

ilObjUserGUI::getTabs ( )

get tabs

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

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

Referenced by getAdminTabs().

145  {
146  global $rbacsystem, $ilHelp;
147 
148  $this->tabs_gui->clearTargets();
149 
150  $ilHelp->setScreenIdComponent("usr");
151 
152  if ($_GET["search"]) {
153  $this->tabs_gui->setBackTarget(
154  $this->lng->txt("search_results"),
155  $_SESSION["usr_search_link"]
156  );
157 
158  $this->tabs_gui->addTarget(
159  "properties",
160  $this->ctrl->getLinkTarget($this, "edit"),
161  array("edit","","view"),
162  get_class($this),
163  "",
164  true
165  );
166  } else {
167  $this->tabs_gui->addTarget(
168  "properties",
169  $this->ctrl->getLinkTarget($this, "edit"),
170  array("edit","","view"),
171  get_class($this)
172  );
173  }
174 
175  $this->tabs_gui->addTarget(
176  "role_assignment",
177  $this->ctrl->getLinkTarget($this, "roleassignment"),
178  array("roleassignment"),
179  get_class($this)
180  );
181 
182  // learning progress
183  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
184  if ($rbacsystem->checkAccess('read', $this->ref_id) and
186  ilObjUserTracking::_enabledUserRelatedData()) {
187  $this->tabs_gui->addTarget(
188  'learning_progress',
189  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
190  '',
191  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
192  );
193  }
194 
195  $this->tabs_gui->addTarget(
196  'user_ownership',
197  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
198  '',
199  'ilobjectownershipmanagementgui'
200  );
201  }
$_SESSION["AccountId"]
$_GET["client_id"]
static _enabledLearningProgress()
check wether learing progress is enabled or not
Create styles array
The data for the language used.
+ 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 862 of file class.ilObjUserGUI.php.

References $_SERVER, $counter, ilObjectGUI\$data, $id, $ilCtrl, $ilSetting, $ilUser, $info, $l, $lang, ilObjectGUI\$lng, $name, $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(), array, ilUtil\Bytes2MB(), ilDatePresentation\formatDate(), ilUtil\formatSize(), ilAuthUtils\getAuthModeTranslation(), ilDiskQuotaHandler\getFilesizeByOwner(), ilDiskQuotaHandler\getFilesizeByTypeAndOwner(), ilUtil\getPasswordRequirementsInfo(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, isSettingChangeable(), object, ilCheckboxInputGUI\setChecked(), ilImageFileInputGUI\setImage(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setMulti(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setRows(), ilTextInputGUI\setSize(), ilPasswordInputGUI\setUseStripSlashes(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), UDF_TYPE_TEXT, UDF_TYPE_WYSIWYG, USER_FOLDER_ID, and ilUtil\yn2tf().

Referenced by editObject().

863  {
864  global $ilUser, $ilSetting;
865 
866  $data = array();
867 
868  // login data
869  $data["auth_mode"] = $this->object->getAuthMode();
870  $data["login"] = $this->object->getLogin();
871  //$data["passwd"] = "********";
872  //$data["passwd2"] = "********";
873  $data["ext_account"] = $this->object->getExternalAccount();
874 
875  // system information
876  $data["create_date"] = ilDatePresentation::formatDate(new ilDateTime($this->object->getCreateDate(), IL_CAL_DATETIME));
877  $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
878  $data["approve_date"] = ($this->object->getApproveDate() != "")
879  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getApproveDate(), IL_CAL_DATETIME))
880  : null;
881  $data["agree_date"] = ($this->object->getAgreeDate() != "")
882  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getAgreeDate(), IL_CAL_DATETIME))
883  : null;
884  $data["last_login"] = ($this->object->getLastLogin() != "")
885  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getLastLogin(), IL_CAL_DATETIME))
886  : null;
887  $data["active"] = $this->object->getActive();
888  $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited();
889 
890  $data["time_limit_from"] = $this->object->getTimeLimitFrom()
891  ? new ilDateTime($this->object->getTimeLimitFrom(), IL_CAL_UNIX)
892  : null;
893  $data["time_limit_until"] = $this->object->getTimeLimitUntil()
894  ? new ilDateTime($this->object->getTimeLimitUntil(), IL_CAL_UNIX)
895  : null;
896 
897 
898  // BEGIN DiskQuota, Show disk space used
899  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
901  $data["disk_quota"] = ilUtil::Bytes2MB($this->object->getDiskQuota());
902  }
904  $data["wsp_disk_quota"] = ilUtil::Bytes2MB($this->object->getPersonalWorkspaceDiskQuota());
905  }
906  // W. Randelshofer 2008-09-09: Deactivated display of disk space usage,
907  // because determining the disk space usage may take several minutes.
908  /*
909  require_once "Modules/File/classes/class.ilObjFileAccess.php";
910  require_once "Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
911  require_once "Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
912  require_once "Services/Mail/classes/class.ilObjMailAccess.php";
913  require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
914  require_once "Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
915  $data["disk_space_used"] =
916  ilObjFileAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
917  ilObjFileBasedLMAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
918  ilObjSAHSLearningModuleAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
919  ilObjMailAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
920  ilObjForumAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
921  ilObjMediaCastAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>';
922  */
923  // END DiskQuota, Show disk space used
924 
925  // personal data
926  $data["gender"] = $this->object->getGender();
927  $data["firstname"] = $this->object->getFirstname();
928  $data["lastname"] = $this->object->getLastname();
929  $data["title"] = $this->object->getUTitle();
930  $data['birthday'] = $this->object->getBirthday()
931  ? new ilDate($this->object->getBirthday(), IL_CAL_DATE)
932  : null;
933  $data["institution"] = $this->object->getInstitution();
934  $data["department"] = $this->object->getDepartment();
935  $data["street"] = $this->object->getStreet();
936  $data["city"] = $this->object->getCity();
937  $data["zipcode"] = $this->object->getZipcode();
938  $data["country"] = $this->object->getCountry();
939  $data["sel_country"] = $this->object->getSelectedCountry();
940  $data["phone_office"] = $this->object->getPhoneOffice();
941  $data["phone_home"] = $this->object->getPhoneHome();
942  $data["phone_mobile"] = $this->object->getPhoneMobile();
943  $data["fax"] = $this->object->getFax();
944  $data["email"] = $this->object->getEmail();
945  $data["second_email"] = $this->object->getSecondEmail();
946  $data["hobby"] = $this->object->getHobby();
947  $data["referral_comment"] = $this->object->getComment();
948 
949  // interests
950  $data["interests_general"] = $this->object->getGeneralInterests();
951  $data["interests_help_offered"] = $this->object->getOfferingHelp();
952  $data["interests_help_looking"] = $this->object->getLookingForHelp();
953 
954  // other data
955  $data["matriculation"] = $this->object->getMatriculation();
956  $data["client_ip"] = $this->object->getClientIP();
957 
958  // user defined fields
959  include_once './Services/User/classes/class.ilUserDefinedFields.php';
960  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
961  $user_defined_data = $this->object->getUserDefinedData();
962  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
963  $data["udf_" . $field_id] = $user_defined_data["f_" . $field_id];
964  }
965 
966  // settings
967  $data["language"] = $this->object->getLanguage();
968  $data["skin_style"] = $this->object->skin . ":" . $this->object->prefs["style"];
969  $data["hits_per_page"] = $this->object->prefs["hits_per_page"];
970  //$data["show_users_online"] = $this->object->prefs["show_users_online"];
971  $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"];
972  $data['bs_allow_to_contact_me'] = $this->object->prefs['bs_allow_to_contact_me'] == 'y';
973  $data['chat_osc_accept_msg'] = $this->object->prefs['chat_osc_accept_msg'] == 'y';
974  $data["session_reminder_enabled"] = (int) $this->object->prefs["session_reminder_enabled"];
975 
976  $data["send_mail"] = ($this->object->prefs['send_info_mails'] == 'y');
977 
978 
979  $this->form_gui->setValuesByArray($data);
980  }
static _lookupLogin($a_user_id)
lookup login
const IL_CAL_DATETIME
static _getInstance()
Get instance.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
Class for single dates.
static Bytes2MB($a_value)
Date and time handling
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
const IL_CAL_DATE
Create new PHPExcel object
obj_idprivate
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 2331 of file class.ilObjUserGUI.php.

References ilUserDefinedFields\_getInstance(), ilTermsOfServiceHelper\getCurrentAcceptanceForUser(), ilUserProfile\getIgnorableRequiredSettings(), and ilCheckboxInputGUI\setValue().

Referenced by saveObject(), and updateObject().

2332  {
2333  $profileMaybeIncomplete = false;
2334 
2335  require_once 'Services/User/classes/class.ilUserProfile.php';
2336 
2337  foreach (ilUserProfile::getIgnorableRequiredSettings() as $fieldName) {
2338  $elm = $this->form_gui->getItemByPostVar($fieldName);
2339 
2340  if (!$elm) {
2341  continue;
2342  }
2343 
2344  if ($elm->getRequired()) {
2345  $profileMaybeIncomplete = true;
2346 
2347  // Flag as optional
2348  $elm->setRequired(false);
2349  }
2350  }
2351 
2352  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
2353  $user_defined_fields = ilUserDefinedFields::_getInstance();
2354  foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
2355  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
2356 
2357  if (!$elm) {
2358  continue;
2359  }
2360 
2361  if ($elm->getRequired() && $definition['changeable'] && $definition['required'] && $definition['visible']) {
2362  $profileMaybeIncomplete = true;
2363 
2364  // Flag as optional
2365  $elm->setRequired(false);
2366  }
2367  }
2368 
2369  return $profileMaybeIncomplete;
2370  }
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 2137 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2138  {
2139  parent::hitsperpageObject();
2140  $this->roleassignmentObject();
2141  }
roleassignmentObject()
display roleassignment panel
+ Here is the call graph for this function:

◆ initCreate()

ilObjUserGUI::initCreate ( )

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

References $ilUser, $key, $keys, ilObjectGUI\$rbacreview, ilObjectGUI\$rbacsystem, ilObjectGUI\$tpl, ilObjRole\_getAssignUsersStatus(), array, object, and USER_FOLDER_ID.

Referenced by createObject(), and saveObject().

274  {
276 
277  if ($this->usrf_ref_id != USER_FOLDER_ID) {
278  $this->tabs_gui->clearTargets();
279  }
280 
281  // role selection
282  $obj_list = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
283  $rol = array();
284  foreach ($obj_list as $obj_data) {
285  // allow only 'assign_users' marked roles if called from category
286  if ($this->object->getRefId() != USER_FOLDER_ID and !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
287  include_once './Services/AccessControl/classes/class.ilObjRole.php';
288 
289  if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
290  continue;
291  }
292  }
293  // exclude anonymous role from list
294  if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID) {
295  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
296  if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
297  $rol[$obj_data["obj_id"]] = $obj_data["title"];
298  }
299  }
300  }
301 
302  // raise error if there is no global role user can be assigned to
303  if (!count($rol)) {
304  $this->ilias->raiseError($this->lng->txt("msg_no_roles_users_can_be_assigned_to"), $this->ilias->error_obj->MESSAGE);
305  }
306 
307  $keys = array_keys($rol);
308 
309  // set pre defined user role to default
310  if (in_array(4, $keys)) {
311  $this->default_role = 4;
312  } else {
313  if (count($keys) > 1 and in_array(2, $keys)) {
314  // remove admin role as preselectable role
315  foreach ($keys as $key => $val) {
316  if ($val == 2) {
317  unset($keys[$key]);
318  break;
319  }
320  }
321  }
322 
323  $this->default_role = array_shift($keys);
324  }
325  $this->selectable_roles = $rol;
326  }
$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) ...
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
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 1689 of file class.ilObjUserGUI.php.

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

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

1690  {
1691  // TODO: Allow mixed field parameter to support checks against an array of field names.
1692 
1693  global $ilSetting;
1694  static $settings = null;
1695 
1696 
1697 
1698  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1699  return true;
1700  }
1701 
1702  if ($settings == null) {
1703  $settings = $ilSetting->getAll();
1704  }
1705  return (bool) $settings['usr_settings_changeable_lua_' . $a_field];
1706  }
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 541 of file class.ilObjUserGUI.php.

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

Referenced by saveObject(), and updateObject().

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

References $file, editObject(), ilUtil\getWebspaceDir(), and ilUtil\sendSuccess().

1796  {
1797  $webspace_dir = ilUtil::getWebspaceDir();
1798  $image_dir = $webspace_dir . "/usr_images";
1799  $file = $image_dir . "/usr_" . $this->object->getID() . "." . "jpg";
1800  $thumb_file = $image_dir . "/usr_" . $this->object->getID() . "_small.jpg";
1801  $xthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xsmall.jpg";
1802  $xxthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xxsmall.jpg";
1803  $upload_file = $image_dir . "/upload_" . $this->object->getID();
1804 
1805  // remove user pref file name
1806  $this->object->setPref("profile_image", "");
1807  $this->object->update();
1808  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1809 
1810  if (@is_file($file)) {
1811  unlink($file);
1812  }
1813  if (@is_file($thumb_file)) {
1814  unlink($thumb_file);
1815  }
1816  if (@is_file($xthumb_file)) {
1817  unlink($xthumb_file);
1818  }
1819  if (@is_file($xxthumb_file)) {
1820  unlink($xxthumb_file);
1821  }
1822  if (@is_file($upload_file)) {
1823  unlink($upload_file);
1824  }
1825 
1826  $this->editObject();
1827  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
editObject()
Display user edit form.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

Reset filter.

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

References roleassignmentObject().

2056  {
2057  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2058  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2059  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2060  $table_gui->resetFilter(); // clears filter
2061  $this->roleassignmentObject();
2062  }
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 1893 of file class.ilObjUserGUI.php.

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

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

1894  {
1895  global $rbacreview,$rbacsystem,$ilUser, $ilTabs;
1896 
1897  $ilTabs->activateTab("role_assignment");
1898 
1899  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1900  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1901  }
1902 
1903  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
1904 
1905  if ($_SESSION['filtered_roles'] > 5) {
1906  $_SESSION['filtered_roles'] = 0;
1907  }
1908 
1909  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
1910 
1911  if (false) {
1912  $this->tpl->setCurrentBlock("filter");
1913  $this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
1914  $this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
1915  $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
1916  $this->tpl->setVariable("FILTER_NAME", 'roleassignment');
1917  $this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
1918  $this->tpl->parseCurrentBlock();
1919  }
1920 
1921  // init table
1922  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
1923  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
1924 
1925  // now get roles depending on filter settings
1926  $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"], $this->object->getId());
1927  $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
1928 
1929  $counter = 0;
1930 
1931  include_once('./Services/AccessControl/classes/class.ilObjRole.php');
1932 
1933  $records = array();
1934  foreach ($role_list as $role) {
1935  // fetch context path of role
1936  $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
1937 
1938  // only list roles that are not set to status "deleted"
1939  if ($rbacreview->isDeleted($rolf[0])) {
1940  continue;
1941  }
1942 
1943  // build context path
1944  $path = "";
1945 
1946  if ($this->tree->isInTree($rolf[0])) {
1947  if ($rolf[0] == ROLE_FOLDER_ID) {
1948  $path = $this->lng->txt("global");
1949  } else {
1950  $tmpPath = $this->tree->getPathFull($rolf[0]);
1951 
1952  // count -1, to exclude the role folder itself
1953  /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
1954  {
1955  if ($path != "")
1956  {
1957  $path .= " > ";
1958  }
1959 
1960  $path .= $tmpPath[$i]["title"];
1961  }*/
1962 
1963  $path = $tmpPath[count($tmpPath)-1]["title"];
1964  }
1965  } else {
1966  $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role["obj_id"] . ")</b>";
1967  }
1968 
1969  $disabled = false;
1970 
1971  // disable checkbox for system role for the system user
1972  if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
1973  or (!in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID)) {
1974  $disabled = true;
1975  }
1976 
1977  // protected admin role
1978  if ($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
1979  include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
1980  if (ilSecuritySettings::_getInstance()->isAdminRoleProtected()) {
1981  $disabled = true;
1982  }
1983  }
1984 
1985  if (substr($role["title"], 0, 3) == "il_") {
1986  if (!$assignable) {
1987  $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
1988  $rolf2 = $rolf_arr[0];
1989  } else {
1990  $rolf2 = $rolf;
1991  }
1992 
1993  $parent_node = $this->tree->getNodeData($rolf2);
1994 
1995  $role["description"] = $this->lng->txt("obj_" . $parent_node["type"]) . "&nbsp;(#" . $parent_node["obj_id"] . ")";
1996  }
1997 
1998  $role_ids[$counter] = $role["obj_id"];
1999 
2000  $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"] . "\"/>";
2001  $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
2002  $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
2003  $result_set[$counter][] = $link = "<a href=\"" . $this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm") . "\">" . ilObjRole::_getTranslation($role["title"]) . "</a>";
2004  $title = ilObjRole::_getTranslation($role["title"]);
2005  $result_set[$counter][] = $role["description"];
2006 
2007  // Add link to objector local Rores
2008  if ($role["role_type"] == "local") {
2009  // Get Object to the role
2010  $obj_id = $rbacreview->getObjectOfRole($role["rol_id"]);
2011 
2012  $obj_type = ilObject::_lookupType($obj_id);
2013 
2015 
2016  foreach ($ref_ids as $ref_id) {
2017  }
2018 
2019  require_once("./Services/Link/classes/class.ilLink.php");
2020 
2021  $result_set[$counter][] = $context = "<a href='" . ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id)) . "' target='_top'>" . $path . "</a>";
2022  } else {
2023  $result_set[$counter][] = $path;
2024  $context = $path;
2025  }
2026 
2027  $records[] = array("path" => $path, "description" => $role["description"],
2028  "context" => $context, "checkbox" => $checkbox,
2029  "role" => $link, "title" => $title);
2030  ++$counter;
2031  }
2032 
2033  if (true) {
2034  $tab->setData($records);
2035  $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
2036  return;
2037  }
2038  }
$_SESSION["AccountId"]
$records
Definition: simple_test.php:22
static _getAllReferences($a_id)
get all reference ids of object
$counter
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
TableGUI class for role assignment in user administration.
Create new PHPExcel object
obj_idprivate
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 349 of file class.ilObjUserGUI.php.

References $_GET, $_POST, $ilSetting, $ilUser, ilObjectGUI\$rbacsystem, ilObjectGUI\$tpl, ilDiskQuotaActivationChecker\_isActive(), ilAuthUtils\_isExternalAccountEnabled(), array, handleIgnoredRequiredFields(), IL_PASSWD_PLAIN, initCreate(), ilUserProfile\isProfileIncomplete(), isSettingChangeable(), loadValuesFromForm(), ilUtil\MB2Bytes(), ilUtil\sendInfo(), ilUtil\sendSuccess(), time, and uploadUserPictureObject().

350  {
351  global $ilAccess, $ilSetting, $tpl, $ilUser, $rbacadmin, $rbacsystem;
352 
353  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
354 
355  // User folder
356  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id) &&
357  !$ilAccess->checkAccess('cat_administrate_users', "", $this->usrf_ref_id)) {
358  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
359  }
360 
361  $this->initCreate();
362  $this->initForm("create");
363 
364  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
365  $profileMaybeIncomplete = false;
366  if ($this->form_gui->getInput('ignore_rf', false)) {
367  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
368  }
369 
370  if ($this->form_gui->checkInput()) {
371  // @todo: external account; time limit check and savings
372 
373  // checks passed. save user
374  $userObj = $this->loadValuesFromForm();
375 
376  $userObj->setPasswd($this->form_gui->getInput('passwd'), IL_PASSWD_PLAIN);
377  $userObj->setTitle($userObj->getFullname());
378  $userObj->setDescription($userObj->getEmail());
379 
380  $udf = array();
381  foreach ($_POST as $k => $v) {
382  if (substr($k, 0, 4) == "udf_") {
383  $udf[substr($k, 4)] = $v;
384  }
385  }
386  $userObj->setUserDefinedData($udf);
387 
388  $userObj->create();
389 
390  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
392  $userObj->setExternalAccount($_POST["ext_account"]);
393  }
394 
395  // set a timestamp for last_password_change
396  // this ts is needed by ilSecuritySettings
397  $userObj->setLastPasswordChangeTS(time());
398 
399  //insert user data in table user_data
400  $userObj->saveAsNew();
401 
402  // setup user preferences
403  if ($this->isSettingChangeable('language')) {
404  $userObj->setLanguage($_POST["language"]);
405  }
406 
407  // Set disk quota
408  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
410  // The disk quota is entered in megabytes but stored in bytes
411  $userObj->setPref("disk_quota", ilUtil::MB2Bytes($_POST["disk_quota"]));
412  }
413 
414  if ($this->isSettingChangeable('skin_style')) {
415  //set user skin and style
416  $sknst = explode(":", $_POST["skin_style"]);
417 
418  if ($userObj->getPref("style") != $sknst[1] ||
419  $userObj->getPref("skin") != $sknst[0]) {
420  $userObj->setPref("skin", $sknst[0]);
421  $userObj->setPref("style", $sknst[1]);
422  }
423  }
424  if ($this->isSettingChangeable('hits_per_page')) {
425  $userObj->setPref("hits_per_page", $_POST["hits_per_page"]);
426  }
427  /*if($this->isSettingChangeable('show_users_online'))
428  {
429  $userObj->setPref("show_users_online", $_POST["show_users_online"]);
430  }*/
431  if ($this->isSettingChangeable('hide_own_online_status')) {
432  $userObj->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
433  }
434  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
435  $userObj->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
436  }
437  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
438  $userObj->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
439  }
440  if ((int) $ilSetting->get('session_reminder_enabled')) {
441  $userObj->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
442  }
443  $userObj->writePrefs();
444 
445  //set role entries
446  $rbacadmin->assignUser($_POST["default_role"], $userObj->getId(), true);
447 
448  $msg = $this->lng->txt("user_added");
449 
450  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
451  $ilUser->writePrefs();
452 
453  $this->object = $userObj;
454 
455  if ($this->isSettingChangeable('upload')) {
456  $this->uploadUserPictureObject();
457  }
458 
459  if ($profileMaybeIncomplete) {
460  include_once 'Services/User/classes/class.ilUserProfile.php';
461  if (ilUserProfile::isProfileIncomplete($this->object)) {
462  $this->object->setProfileIncomplete(true);
463  $this->object->update();
464  }
465  }
466 
467  // send new account mail
468  if ($_POST['send_mail'] == 'y') {
469  include_once('Services/Mail/classes/class.ilAccountMail.php');
470  $acc_mail = new ilAccountMail();
471  $acc_mail->useLangVariablesAsFallback(true);
472  $acc_mail->setUserPassword($_POST['passwd']);
473  $acc_mail->setUser($userObj);
474 
475  if ($acc_mail->send()) {
476  $msg = $msg . '<br />' . $this->lng->txt('mail_sent');
477  ilUtil::sendSuccess($msg, true);
478  } else {
479  $msg = $msg . '<br />' . $this->lng->txt('mail_not_sent');
480  ilUtil::sendInfo($msg, true);
481  }
482  } else {
483  ilUtil::sendSuccess($msg, true);
484  }
485 
486 
487  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
488  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
489  } else {
490  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
491  }
492  } else {
493  $this->form_gui->setValuesByPost();
494  $tpl->setContent($this->form_gui->getHtml());
495  }
496  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
Class ilAccountMail.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
$_POST["username"]
+ Here is the call graph for this function:

◆ setBackTarget()

ilObjUserGUI::setBackTarget (   $a_text,
  $a_link 
)

set back tab target

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

References array.

207  {
208  $this->back_target = array("text" => $a_text,
209  "link" => $a_link);
210  }
Create styles array
The data for the language used.

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )

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

References ilUtil\getImagePath(), and object.

108  {
109  if (strtolower(get_class($this->object)) == 'ilobjuser') {
110  $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
111  $this->tpl->setDescription($this->object->getLongDescription());
112  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_" . $this->object->getType() . ".svg"), $this->lng->txt("obj_" . $this->object->getType()));
113  } else {
114  parent::setTitleAndDescription();
115  }
116  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ showUpperIcon()

ilObjUserGUI::showUpperIcon ( )

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

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

2193  {
2194  }
+ Here is the call graph for this function:

◆ updateObject()

ilObjUserGUI::updateObject ( )

Update user.

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

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

699  {
700  global $tpl, $rbacsystem, $ilias, $ilUser, $ilSetting;
701 
702  // User folder
703  if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write', $this->usrf_ref_id)) {
704  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
705  }
706  // if called from local administration $this->usrf_ref_id is category id
707  // Todo: this has to be fixed. Do not mix user folder id and category id
708  if ($this->usrf_ref_id != USER_FOLDER_ID) {
709  // check if user is assigned to category
710  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
711  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
712  }
713  }
714  $this->initForm("edit");
715 
716  // we do not want to store this dates, they are only printed out
717  unset($_POST['approve_date']);
718  $_POST['agree_date'] = $this->object->getAgreeDate();
719  unset($_POST['last_login']);
720 
721  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
722  $profileMaybeIncomplete = false;
723  if ($this->form_gui->getInput('ignore_rf', false)) {
724  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
725  }
726 
727  if ($this->form_gui->checkInput()) {
728  // @todo: external account; time limit
729  // if not allowed or empty -> do no change password
731  && trim($_POST['passwd']) != "") {
732  $this->object->setPasswd($_POST['passwd'], IL_PASSWD_PLAIN);
733  }
734 
735  /*
736  * reset counter for failed logins
737  * if $_POST['active'] is set to 1
738  */
739  if ($_POST['active'] == 1) {
740  ilObjUser::_resetLoginAttempts($this->object->getId());
741  }
742 
743  #$this->object->assignData($_POST);
744  $this->loadValuesFromForm('update');
745 
746  $udf = array();
747  foreach ($_POST as $k => $v) {
748  if (substr($k, 0, 4) == "udf_") {
749  $udf[substr($k, 4)] = $v;
750  }
751  }
752  $this->object->setUserDefinedData($udf);
753 
754  try {
755  $this->object->updateLogin($_POST['login']);
756  } catch (ilUserException $e) {
757  ilUtil::sendFailure($e->getMessage());
758  $this->form_gui->setValuesByPost();
759  return $tpl->setContent($this->form_gui->getHtml());
760  }
761 
762  $this->object->setTitle($this->object->getFullname());
763  $this->object->setDescription($this->object->getEmail());
764 
765  if ($this->isSettingChangeable('language')) {
766  $this->object->setLanguage($this->form_gui->getInput('language'));
767  }
768 
769  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
771  // set disk quota
772  $this->object->setPref("disk_quota", ilUtil::MB2Bytes($_POST["disk_quota"]));
773  }
775  // set personal workspace disk quota
776  $this->object->setPref("wsp_disk_quota", ilUtil::MB2Bytes($_POST["wsp_disk_quota"]));
777  }
778 
779  if ($this->isSettingChangeable('skin_style')) {
780  //set user skin and style
781  $sknst = explode(":", $_POST["skin_style"]);
782 
783  if ($this->object->getPref("style") != $sknst[1] ||
784  $this->object->getPref("skin") != $sknst[0]) {
785  $this->object->setPref("skin", $sknst[0]);
786  $this->object->setPref("style", $sknst[1]);
787  }
788  }
789  if ($this->isSettingChangeable('hits_per_page')) {
790  $this->object->setPref("hits_per_page", $_POST["hits_per_page"]);
791  }
792  /*if($this->isSettingChangeable('show_users_online'))
793  {
794  $this->object->setPref("show_users_online", $_POST["show_users_online"]);
795  }*/
796  if ($this->isSettingChangeable('hide_own_online_status')) {
797  $this->object->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
798  }
799  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
800  $this->object->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
801  }
802  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
803  $this->object->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
804  }
805 
806  // set a timestamp for last_password_change
807  // this ts is needed by ilSecuritySettings
808  $this->object->setLastPasswordChangeTS(time());
809 
810  global $ilSetting;
811  if ((int) $ilSetting->get('session_reminder_enabled')) {
812  $this->object->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
813  }
814 
815  // #10054 - profile may have been completed, check below is only for incomplete
816  $this->object->setProfileIncomplete(false);
817 
818  $this->update = $this->object->update();
819 
820 
821  // If the current user is editing its own user account,
822  // we update his preferences.
823  if ($ilUser->getId() == $this->object->getId()) {
824  $ilUser->readPrefs();
825  }
826  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
827  $ilUser->writePrefs();
828 
829  $mail_message = $this->__sendProfileMail();
830  $msg = $this->lng->txt('saved_successfully') . $mail_message;
831 
832  // same personal image
833  if ($this->isSettingChangeable('upload')) {
834  $this->uploadUserPictureObject();
835  }
836 
837  if ($profileMaybeIncomplete) {
838  include_once 'Services/User/classes/class.ilUserProfile.php';
839  if (ilUserProfile::isProfileIncomplete($this->object)) {
840  $this->object->setProfileIncomplete(true);
841  $this->object->update();
842  }
843  }
844 
845  // feedback
846  ilUtil::sendSuccess($msg, true);
847 
848  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
849  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
850  } else {
851  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
852  }
853  } else {
854  $this->form_gui->setValuesByPost();
855  $tpl->setContent($this->form_gui->getHtml());
856  }
857  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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) ...
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
update($pash, $contents, Config $config)
Create new PHPExcel object
obj_idprivate
global $ilSetting
Definition: privfeed.php:17
const USER_FOLDER_ID
Class ilObjUserFolder.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
$_POST["username"]
+ Here is the call graph for this function:

◆ uploadUserPictureObject()

ilObjUserGUI::uploadUserPictureObject ( )

upload user image

(original method by ratana ty)

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

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

Referenced by saveObject(), and updateObject().

1716  {
1717  global $ilUser, $rbacsystem;
1718 
1719  // User folder
1720  if ($this->usrf_ref_id == USER_FOLDER_ID and
1721  !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
1722  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1723  }
1724  // if called from local administration $this->usrf_ref_id is category id
1725  // Todo: this has to be fixed. Do not mix user folder id and category id
1726  if ($this->usrf_ref_id != USER_FOLDER_ID) {
1727  // check if user is assigned to category
1728  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1729  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1730  }
1731  }
1732 
1733  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1734 
1735  if ($_FILES["userfile"]["tmp_name"] == "") {
1736  if ($userfile_input->getDeletionFlag()) {
1737  $this->object->removeUserPicture();
1738  }
1739  return;
1740  }
1741  if ($_FILES["userfile"]["size"] == 0) {
1742  ilUtil::sendFailure($this->lng->txt("msg_no_file"));
1743  } else {
1744  $webspace_dir = ilUtil::getWebspaceDir();
1745  $image_dir = $webspace_dir . "/usr_images";
1746  $store_file = "usr_" . $this->object->getId() . "." . "jpg";
1747 
1748  // store filename
1749  $this->object->setPref("profile_image", $store_file);
1750  $this->object->update();
1751 
1752  // move uploaded file
1753  $pi = pathinfo($_FILES["userfile"]["name"]);
1754  $uploaded_file = $image_dir . "/upload_" . $this->object->getId() . "." . $pi["extension"];
1755  if (!ilUtil::moveUploadedFile(
1756  $_FILES["userfile"]["tmp_name"],
1757  $_FILES["userfile"]["name"],
1758  $uploaded_file,
1759  false
1760  )) {
1761  ilUtil::sendFailure($this->lng->txt("upload_error", true));
1762  $this->ctrl->redirect($this, "showProfile");
1763  }
1764  chmod($uploaded_file, 0770);
1765 
1766  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1767  // taking only frame [0] to avoid problems with animated gifs
1768  $show_file = "$image_dir/usr_" . $this->object->getId() . ".jpg";
1769  $thumb_file = "$image_dir/usr_" . $this->object->getId() . "_small.jpg";
1770  $xthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xsmall.jpg";
1771  $xxthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xxsmall.jpg";
1772  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
1773  $show_file = ilUtil::escapeShellArg($show_file);
1774  $thumb_file = ilUtil::escapeShellArg($thumb_file);
1775  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
1776  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
1777 
1778  if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
1779  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
1780  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
1781  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
1782  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
1783  } else {
1784  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
1785  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
1786  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
1787  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
1788  }
1789  }
1790  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
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 26 of file class.ilObjUserGUI.php.

◆ $ilCtrl

ilObjUserGUI::$ilCtrl

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

Referenced by __construct(), _goto(), editObject(), and getValues().

◆ $type

ilObjUserGUI::$type

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

◆ $user_ref_id

ilObjUserGUI::$user_ref_id

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


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