ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 __sendProfileMail ()
 
- 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...
 
 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
 
 $ilias
 
 $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...
 
 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...
 
 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
 $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, and array.

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 
60  $lng->loadLanguageModule('user');
61 
62  // for gender selection. don't change this
63  // maybe deprecated
64  $this->gender = array(
65  'm' => "salutation_m",
66  'f' => "salutation_f"
67  );
68  }
$_GET["client_id"]
Create styles array
The data for the language used.

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

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

References $_SESSION, and ilUtil\formSelect().

Referenced by roleassignmentObject().

2312  {
2313  $action[0] = $this->lng->txt('assigned_roles');
2314  $action[1] = $this->lng->txt('all_roles');
2315  $action[2] = $this->lng->txt('all_global_roles');
2316  $action[3] = $this->lng->txt('all_local_roles');
2317  $action[4] = $this->lng->txt('internal_local_roles_only');
2318  $action[5] = $this->lng->txt('non_internal_local_roles_only');
2319 
2320  return ilUtil::formSelect($_SESSION['filtered_roles'],"filter",$action,false,true);
2321  }
$_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 208 of file class.ilObjUserGUI.php.

References $_POST, and ilUserDefinedFields\_getInstance().

209  {
210  include_once './Services/User/classes/class.ilUserDefinedFields.php';
211  $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
212 
213  foreach($this->user_defined_fields->getDefinitions() as $field_id => $definition)
214  {
215  if($definition['required'] and !strlen($_POST['udf'][$field_id]))
216  {
217  return false;
218  }
219  }
220  return true;
221  }
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 2243 of file class.ilObjUserGUI.php.

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

2244  {
2245  switch($a_type)
2246  {
2247  case "minute":
2248  for($i=0;$i<=60;$i++)
2249  {
2250  $days[$i] = $i < 10 ? "0".$i : $i;
2251  }
2252  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2253 
2254  case "hour":
2255  for($i=0;$i<24;$i++)
2256  {
2257  $days[$i] = $i < 10 ? "0".$i : $i;
2258  }
2259  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2260 
2261  case "day":
2262  for($i=1;$i<32;$i++)
2263  {
2264  $days[$i] = $i < 10 ? "0".$i : $i;
2265  }
2266  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2267 
2268  case "month":
2269  for($i=1;$i<13;$i++)
2270  {
2271  $month[$i] = $i < 10 ? "0".$i : $i;
2272  }
2273  return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
2274 
2275  case "year":
2276  if($a_selected < date('Y',time()))
2277  {
2278  $start = $a_selected;
2279  }
2280  else
2281  {
2282  $start = date('Y',time());
2283  }
2284 
2285  for($i = $start;$i < date("Y",time()) + 11;++$i)
2286  {
2287  $year[$i] = $i;
2288  }
2289  return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
2290  }
2291  }
$a_type
Definition: workflow.php:93
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.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

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

References $_POST, ilObjectGUI\$ilias, $ilUser, ilLanguage\loadLanguageModule(), object, and time.

Referenced by updateObject().

2377  {
2378  global $ilUser,$ilias;
2379 
2380  if($_POST['send_mail'] != 'y')
2381  {
2382  return '';
2383  }
2384  if(!strlen($this->object->getEmail()))
2385  {
2386  return '';
2387  }
2388 
2389  // Choose language of user
2390  $usr_lang = new ilLanguage($this->object->getLanguage());
2391  $usr_lang->loadLanguageModule('crs');
2392  $usr_lang->loadLanguageModule('registration');
2393 
2394  include_once "Services/Mail/classes/class.ilMimeMail.php";
2395 
2396  $mmail = new ilMimeMail();
2397  $mmail->autoCheck(false);
2398  $mmail->From($ilUser->getEmail());
2399  $mmail->To($this->object->getEmail());
2400 
2401  // mail subject
2402  $subject = $usr_lang->txt("profile_changed");
2403 
2404 
2405  // mail body
2406  $body = ($usr_lang->txt("reg_mail_body_salutation")." ".$this->object->getFullname().",\n\n");
2407 
2408  $date = $this->object->getApproveDate();
2409  // Approve
2410  if((time() - strtotime($date)) < 10)
2411  {
2412  $body .= ($usr_lang->txt('reg_mail_body_approve')."\n\n");
2413  }
2414  else
2415  {
2416  $body .= ($usr_lang->txt('reg_mail_body_profile_changed')."\n\n");
2417  }
2418 
2419  // Append login info only if password has been chacnged
2420  if($_POST['passwd'] != '')
2421  {
2422  $body .= $usr_lang->txt("reg_mail_body_text2")."\n".
2423  ILIAS_HTTP_PATH."/login.php?client_id=".$ilias->client_id."\n".
2424  $usr_lang->txt("login").": ".$this->object->getLogin()."\n".
2425  $usr_lang->txt("passwd").": ".$_POST['passwd']."\n\n";
2426  }
2427  $body .= ($usr_lang->txt("reg_mail_body_text3")."\n");
2428  $body .= $this->object->getProfileAsString($usr_lang);
2429 
2430  $mmail->Subject($subject);
2431  $mmail->Body($body);
2432  $mmail->Send();
2433 
2434 
2435  return "<br/>".$this->lng->txt("mail_sent");
2436  }
this class encapsulates the PHP mail() function.
$ilUser
Definition: imgupload.php:18
Create new PHPExcel object
obj_idprivate
loadLanguageModule($a_module)
language handling
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:
+ Here is the caller graph for this function:

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

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

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

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

◆ __toUnix()

ilObjUserGUI::__toUnix (   $a_time_arr)

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

2294  {
2295  return mktime($a_time_arr["hour"],
2296  $a_time_arr["minute"],
2297  $a_time_arr["second"],
2298  $a_time_arr["month"],
2299  $a_time_arr["day"],
2300  $a_time_arr["year"]);
2301  }

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References $_SESSION.

2307  {
2308  unset($_SESSION["filtered_roles"]);
2309  }
$_SESSION["AccountId"]

◆ _goto()

static ilObjUserGUI::_goto (   $a_target)
static

Goto user profile screen.

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

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

2442  {
2443  global $ilUser, $ilCtrl;
2444 
2445  // #10888
2446  if($a_target == md5("usrdelown"))
2447  {
2448  if($ilUser->getId() != ANONYMOUS_USER_ID &&
2449  $ilUser->hasDeletionFlag())
2450  {
2451  $ilCtrl->setTargetScript("ilias.php");
2452  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2453  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalsettingsgui"), "deleteOwnAccount3");
2454  }
2455  exit("This account is not flagged for deletion."); // #12160
2456  }
2457 
2458  // badges
2459  if(substr($a_target, -4) == "_bdg")
2460  {
2461  $_GET["baseClass"] = "ilPersonalDesktopGUI";
2462  $_GET["cmd"] = "jumpToBadges";
2463  include("ilias.php");
2464  exit();
2465  }
2466 
2467  if (substr($a_target, 0, 1) == "n")
2468  {
2469  $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
2470  }
2471 
2472  if(strpos($a_target, 'contact_approved') !== false)
2473  {
2474  $_GET['cmd'] = 'approveContactRequest';
2475  }
2476  else if(strpos($a_target, 'contact_ignored') !== false)
2477  {
2478  $_GET['cmd'] = 'ignoreContactRequest';
2479  }
2480  else
2481  {
2482  $_GET['cmd'] = 'view';
2483  }
2484 
2485  $_GET["user_id"] = (int) $a_target;
2486  $_GET["baseClass"] = "ilPublicUserProfileGUI";
2487  $_GET["cmdClass"] = "ilpublicuserprofilegui";
2488  include("ilias.php");
2489  exit;
2490  }
$_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 2333 of file class.ilObjUserGUI.php.

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

2334  {
2335  global $ilLocator;
2336 
2337  $ilLocator->clearItems();
2338 
2339  if ($_GET["admin_mode"] == "settings") // system settings
2340  {
2341  $this->ctrl->setParameterByClass("ilobjsystemfoldergui",
2342  "ref_id", SYSTEM_FOLDER_ID);
2343  $ilLocator->addItem($this->lng->txt("administration"),
2344  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2345  ilFrameTargetInfo::_getFrame("MainContent"));
2346 
2347  if ($_GET['ref_id'] == USER_FOLDER_ID)
2348  {
2349  $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
2350  ilObject::_lookupObjId($_GET["ref_id"]))),
2351  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
2352  }
2353  elseif ($_GET['ref_id'] == ROLE_FOLDER_ID)
2354  {
2355  $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
2356  ilObject::_lookupObjId($_GET["ref_id"]))),
2357  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view"));
2358  }
2359 
2360  if ($_GET["obj_id"] > 0)
2361  {
2362  $ilLocator->addItem($this->object->getTitle(),
2363  $this->ctrl->getLinkTarget($this, "view"));
2364  }
2365  }
2366  else // repository administration
2367  {
2368  // ?
2369  }
2370  }
$_GET["client_id"]
static _lookupObjId($a_id)
Create styles array
The data for the language used.
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 2222 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2223  {
2224  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2225  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2226  $table_gui->writeFilterToSession(); // writes filter to session
2227  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2228  $this->roleassignmentObject();
2229  }
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 1985 of file class.ilObjUserGUI.php.

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

1986  {
1987  global $rbacsystem, $rbacadmin, $rbacreview;
1988 
1989  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
1990  {
1991  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
1992  }
1993 
1994  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
1995  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
1996 
1997  // prevent unassignment of system role from system user
1998  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles))
1999  {
2000  array_push($selected_roles,SYSTEM_ROLE_ID);
2001  }
2002 
2003  $global_roles_all = $rbacreview->getGlobalRoles();
2004  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
2005  $assigned_roles = array_intersect($assigned_roles_all,$posted_roles);
2006  $assigned_global_roles_all = array_intersect($assigned_roles_all,$global_roles_all);
2007  $assigned_global_roles = array_intersect($assigned_global_roles_all,$posted_roles);
2008  $posted_global_roles = array_intersect($selected_roles,$global_roles_all);
2009 
2010  if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
2011  or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles)))
2012  {
2013  //$this->ilias->raiseError($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),$this->ilias->error_obj->MESSAGE);
2014  // workaround. sometimes jumps back to wrong page
2015  ilUtil::sendFailure($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),true);
2016  $this->ctrl->redirect($this,'roleassignment');
2017  }
2018 
2019  foreach (array_diff($assigned_roles,$selected_roles) as $role)
2020  {
2021  $rbacadmin->deassignUser($role,$this->object->getId());
2022  }
2023 
2024  foreach (array_diff($selected_roles,$assigned_roles) as $role)
2025  {
2026  $rbacadmin->assignUser($role,$this->object->getId(),false);
2027  }
2028 
2029  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
2030 
2031  // update object data entry (to update last modification date)
2032  $this->object->update();
2033 
2034  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"),true);
2035 
2036  if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
2037  {
2038  $this->ctrl->redirect($this,'roleassignment');
2039  }
2040  else
2041  {
2042  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
2043  }
2044 
2045  }
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 124 of file class.ilObjUserGUI.php.

References $_GET, and ilSession\clear().

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

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

344  {
345  global $tpl, $rbacsystem, $rbacreview, $ilUser;
346 
347  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id) and
348  !$rbacsystem->checkAccess('cat_administrate_users',$this->usrf_ref_id))
349  {
350  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
351  }
352 
353  $this->initCreate();
354  $this->initForm("create");
355  return $tpl->setContent($this->form_gui->getHtml());
356  }
$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 545 of file class.ilObjUserGUI.php.

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

Referenced by removeUserPictureObject().

546  {
547  global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser
549 
550  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
551 
552  //load ILIAS settings
553  $settings = $ilias->getAllSettings();
554 
555  // User folder
556  if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
557  {
558  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
559  }
560  // if called from local administration $this->usrf_ref_id is category id
561  // Todo: this has to be fixed. Do not mix user folder id and category id
562  if($this->usrf_ref_id != USER_FOLDER_ID)
563  {
564  // check if user is assigned to category
565  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
566  {
567  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
568  }
569  }
570 
571  if($this->usrf_ref_id != USER_FOLDER_ID)
572  {
573  $this->tabs_gui->clearTargets();
574  }
575 
576  // get form
577  $this->initForm("edit");
578  $this->getValues();
579  $this->showAcceptedTermsOfService();
580  $this->tpl->setContent($this->form_gui->getHTML());
581  }
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 70 of file class.ilObjUserGUI.php.

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

71  {
72  global $rbacsystem;
73 
74  $next_class = $this->ctrl->getNextClass($this);
75  $cmd = $this->ctrl->getCmd();
76 
77  $this->prepareOutput();
78 
79  switch($next_class)
80  {
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  {
96  $cmd = "edit";
97  }
98  $cmd .= "Object";
99  $return = $this->$cmd();
100 
101  break;
102  }
103  return $return;
104  }
$cmd
Definition: sahs_server.php:35
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 143 of file class.ilObjUserGUI.php.

References getTabs().

144  {
145  $this->getTabs();
146  }
+ Here is the call graph for this function:

◆ getTabs()

ilObjUserGUI::getTabs ( )

get tabs

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

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

Referenced by getAdminTabs().

152  {
153  global $rbacsystem, $ilHelp;
154 
155  $this->tabs_gui->clearTargets();
156 
157  $ilHelp->setScreenIdComponent("usr");
158 
159  if ($_GET["search"])
160  {
161  $this->tabs_gui->setBackTarget(
162  $this->lng->txt("search_results"),$_SESSION["usr_search_link"]);
163 
164  $this->tabs_gui->addTarget("properties",
165  $this->ctrl->getLinkTarget($this, "edit"), array("edit","","view"), get_class($this),"",true);
166  }
167  else
168  {
169  $this->tabs_gui->addTarget("properties",
170  $this->ctrl->getLinkTarget($this, "edit"), array("edit","","view"), get_class($this));
171  }
172 
173  $this->tabs_gui->addTarget("role_assignment",
174  $this->ctrl->getLinkTarget($this, "roleassignment"), array("roleassignment"), get_class($this));
175 
176  // learning progress
177  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
178  if($rbacsystem->checkAccess('read',$this->ref_id) and
180  ilObjUserTracking::_enabledUserRelatedData())
181  {
182 
183  $this->tabs_gui->addTarget('learning_progress',
184  $this->ctrl->getLinkTargetByClass('illearningprogressgui',''),
185  '',
186  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
187  }
188 
189  $this->tabs_gui->addTarget('user_ownership',
190  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui',''),
191  '',
192  'ilobjectownershipmanagementgui');
193  }
$_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 958 of file class.ilObjUserGUI.php.

References $_SERVER, $counter, ilObjectGUI\$data, $ilCtrl, $ilSetting, $ilUser, $info, $l, $lang, $languages, ilObjectGUI\$lng, $options, $style, 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(), 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(), ilPasswordInputGUI\setSize(), ilTextInputGUI\setSize(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), UDF_TYPE_TEXT, UDF_TYPE_WYSIWYG, USER_FOLDER_ID, and ilUtil\yn2tf().

Referenced by editObject().

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

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

Referenced by saveObject(), and updateObject().

2501  {
2502  $profileMaybeIncomplete = false;
2503 
2504  require_once 'Services/User/classes/class.ilUserProfile.php';
2505 
2506  foreach( ilUserProfile::getIgnorableRequiredSettings() as $fieldName )
2507  {
2508  $elm = $this->form_gui->getItemByPostVar($fieldName);
2509 
2510  if( !$elm ) continue;
2511 
2512  if( $elm->getRequired() )
2513  {
2514  $profileMaybeIncomplete = true;
2515 
2516  // Flag as optional
2517  $elm->setRequired( false );
2518  }
2519  }
2520 
2521  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
2522  $user_defined_fields = ilUserDefinedFields::_getInstance();
2523  foreach($user_defined_fields->getDefinitions() as $field_id => $definition)
2524  {
2525  $elm = $this->form_gui->getItemByPostVar('udf_'.$definition['field_id']);
2526 
2527  if( !$elm ) continue;
2528 
2529  if( $elm->getRequired() && $definition['changeable'] && $definition['required'] && $definition['visible'] )
2530  {
2531  $profileMaybeIncomplete = true;
2532 
2533  // Flag as optional
2534  $elm->setRequired( false );
2535  }
2536  }
2537 
2538  return $profileMaybeIncomplete;
2539  }
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 2323 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2324  {
2325  parent::hitsperpageObject();
2326  $this->roleassignmentObject();
2327  }
roleassignmentObject()
display roleassignment panel
+ Here is the call graph for this function:

◆ initCreate()

ilObjUserGUI::initCreate ( )

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

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

Referenced by createObject(), and saveObject().

273  {
274  global $tpl, $rbacsystem, $rbacreview, $ilUser;
275 
276  if($this->usrf_ref_id != USER_FOLDER_ID)
277  {
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  {
286  // allow only 'assign_users' marked roles if called from category
287  if($this->object->getRefId() != USER_FOLDER_ID and !in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
288  {
289  include_once './Services/AccessControl/classes/class.ilObjRole.php';
290 
291  if(!ilObjRole::_getAssignUsersStatus($obj_data['obj_id']))
292  {
293  continue;
294  }
295  }
296  // exclude anonymous role from list
297  if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID)
298  {
299  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
300  if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
301  {
302  $rol[$obj_data["obj_id"]] = $obj_data["title"];
303  }
304  }
305  }
306 
307  // raise error if there is no global role user can be assigned to
308  if(!count($rol))
309  {
310  $this->ilias->raiseError($this->lng->txt("msg_no_roles_users_can_be_assigned_to"),$this->ilias->error_obj->MESSAGE);
311  }
312 
313  $keys = array_keys($rol);
314 
315  // set pre defined user role to default
316  if (in_array(4,$keys))
317  {
318  $this->default_role = 4;
319  }
320  else
321  {
322  if (count($keys) > 1 and in_array(2,$keys))
323  {
324  // remove admin role as preselectable role
325  foreach ($keys as $key => $val)
326  {
327  if ($val == 2)
328  {
329  unset($keys[$key]);
330  break;
331  }
332  }
333  }
334 
335  $this->default_role = array_shift($keys);
336  }
337  $this->selectable_roles = $rol;
338  }
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.
+ 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 1824 of file class.ilObjUserGUI.php.

References $ilSetting, and USER_FOLDER_ID.

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

1825  {
1826  // TODO: Allow mixed field parameter to support checks against an array of field names.
1827 
1828  global $ilSetting;
1829  static $settings = null;
1830 
1831 
1832 
1833  if($this->usrf_ref_id == USER_FOLDER_ID)
1834  {
1835  return true;
1836  }
1837 
1838  if($settings == NULL)
1839  {
1840  $settings = $ilSetting->getAll();
1841  }
1842  return (bool) $settings['usr_settings_changeable_lua_'.$a_field];
1843  }
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 587 of file class.ilObjUserGUI.php.

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

Referenced by saveObject(), and updateObject().

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

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

1941  {
1942  $webspace_dir = ilUtil::getWebspaceDir();
1943  $image_dir = $webspace_dir."/usr_images";
1944  $file = $image_dir."/usr_".$this->object->getID()."."."jpg";
1945  $thumb_file = $image_dir."/usr_".$this->object->getID()."_small.jpg";
1946  $xthumb_file = $image_dir."/usr_".$this->object->getID()."_xsmall.jpg";
1947  $xxthumb_file = $image_dir."/usr_".$this->object->getID()."_xxsmall.jpg";
1948  $upload_file = $image_dir."/upload_".$this->object->getID();
1949 
1950  // remove user pref file name
1951  $this->object->setPref("profile_image", "");
1952  $this->object->update();
1953  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1954 
1955  if (@is_file($file))
1956  {
1957  unlink($file);
1958  }
1959  if (@is_file($thumb_file))
1960  {
1961  unlink($thumb_file);
1962  }
1963  if (@is_file($xthumb_file))
1964  {
1965  unlink($xthumb_file);
1966  }
1967  if (@is_file($xxthumb_file))
1968  {
1969  unlink($xxthumb_file);
1970  }
1971  if (@is_file($upload_file))
1972  {
1973  unlink($upload_file);
1974  }
1975 
1976  $this->editObject();
1977  }
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 2234 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2235  {
2236  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2237  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2238  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2239  $table_gui->resetFilter(); // clears filter
2240  $this->roleassignmentObject();
2241  }
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 2052 of file class.ilObjUserGUI.php.

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

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

2053  {
2054  global $rbacreview,$rbacsystem,$ilUser, $ilTabs;
2055 
2056  $ilTabs->activateTab("role_assignment");
2057 
2058  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
2059  {
2060  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
2061  }
2062 
2063  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
2064 
2065  if ($_SESSION['filtered_roles'] > 5)
2066  {
2067  $_SESSION['filtered_roles'] = 0;
2068  }
2069 
2070  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.usr_role_assignment.html','Services/User');
2071 
2072  if(false)
2073  {
2074  $this->tpl->setCurrentBlock("filter");
2075  $this->tpl->setVariable("FILTER_TXT_FILTER",$this->lng->txt('filter'));
2076  $this->tpl->setVariable("SELECT_FILTER",$this->__buildFilterSelect());
2077  $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getFormAction($this));
2078  $this->tpl->setVariable("FILTER_NAME",'roleassignment');
2079  $this->tpl->setVariable("FILTER_VALUE",$this->lng->txt('apply_filter'));
2080  $this->tpl->parseCurrentBlock();
2081  }
2082 
2083  // init table
2084  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2085  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
2086 
2087  // now get roles depending on filter settings
2088  $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"],$this->object->getId());
2089  $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
2090 
2091  $counter = 0;
2092 
2093  include_once ('./Services/AccessControl/classes/class.ilObjRole.php');
2094 
2095  $records = array();
2096  foreach ($role_list as $role)
2097  {
2098  // fetch context path of role
2099  $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
2100 
2101  // only list roles that are not set to status "deleted"
2102  if ($rbacreview->isDeleted($rolf[0]))
2103  {
2104  continue;
2105  }
2106 
2107  // build context path
2108  $path = "";
2109 
2110  if ($this->tree->isInTree($rolf[0]))
2111  {
2112  if ($rolf[0] == ROLE_FOLDER_ID)
2113  {
2114  $path = $this->lng->txt("global");
2115  }
2116  else
2117  {
2118  $tmpPath = $this->tree->getPathFull($rolf[0]);
2119 
2120  // count -1, to exclude the role folder itself
2121  /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
2122  {
2123  if ($path != "")
2124  {
2125  $path .= " > ";
2126  }
2127 
2128  $path .= $tmpPath[$i]["title"];
2129  }*/
2130 
2131  $path = $tmpPath[count($tmpPath)-1]["title"];
2132  }
2133  }
2134  else
2135  {
2136  $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$role["obj_id"].")</b>";
2137  }
2138 
2139  $disabled = false;
2140 
2141  // disable checkbox for system role for the system user
2142  if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
2143  or (!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID))
2144  {
2145  $disabled = true;
2146  }
2147 
2148  // protected admin role
2149  if($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID))
2150  {
2151  include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
2152  if(ilSecuritySettings::_getInstance()->isAdminRoleProtected())
2153  {
2154  $disabled = true;
2155  }
2156  }
2157 
2158  if (substr($role["title"],0,3) == "il_")
2159  {
2160  if (!$assignable)
2161  {
2162  $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
2163  $rolf2 = $rolf_arr[0];
2164  }
2165  else
2166  {
2167  $rolf2 = $rolf;
2168  }
2169 
2170  $parent_node = $this->tree->getNodeData($rolf2);
2171 
2172  $role["description"] = $this->lng->txt("obj_".$parent_node["type"])."&nbsp;(#".$parent_node["obj_id"].")";
2173  }
2174 
2175  $role_ids[$counter] = $role["obj_id"];
2176 
2177  $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"]."\"/>";
2178  $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
2179  $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
2180  $result_set[$counter][] = $link = "<a href=\"".$this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm")."\">".ilObjRole::_getTranslation($role["title"])."</a>";
2181  $title = ilObjRole::_getTranslation($role["title"]);
2182  $result_set[$counter][] = $role["description"];
2183 
2184  // Add link to objector local Rores
2185  if ($role["role_type"] == "local") {
2186  // Get Object to the role
2187  $obj_id = $rbacreview->getObjectOfRole($role["rol_id"]);
2188 
2189  $obj_type = ilObject::_lookupType($obj_id);
2190 
2192 
2193  foreach ($ref_ids as $ref_id) {}
2194 
2195  require_once("./Services/Link/classes/class.ilLink.php");
2196 
2197  $result_set[$counter][] = $context = "<a href='".ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id))."' target='_top'>".$path."</a>";
2198  }
2199  else
2200  {
2201  $result_set[$counter][] = $path;
2202  $context = $path;
2203  }
2204 
2205  $records[] = array("path" => $path, "description" => $role["description"],
2206  "context" => $context, "checkbox" => $checkbox,
2207  "role" => $link, "title" => $title);
2208  ++$counter;
2209  }
2210 
2211  if (true)
2212  {
2213  $tab->setData($records);
2214  $this->tpl->setVariable("ROLES_TABLE",$tab->getHTML());
2215  return;
2216  }
2217  }
$path
Definition: aliased.php:25
$_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 362 of file class.ilObjUserGUI.php.

References $_GET, $_POST, $ilSetting, $ilUser, 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().

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

References array.

199  {
200  $this->back_target = array("text" => $a_text,
201  "link" => $a_link);
202  }
Create styles array
The data for the language used.

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )

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

References ilUtil\getImagePath(), and object.

109  {
110  if(strtolower(get_class($this->object)) == 'ilobjuser')
111  {
112  $this->tpl->setTitle('['.$this->object->getLogin().'] '.$this->object->getTitle());
113  $this->tpl->setDescription($this->object->getLongDescription());
114  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_".$this->object->getType().".svg"), $this->lng->txt("obj_" . $this->object->getType()));
115  }
116  else
117  {
118  parent::setTitleAndDescription();
119  }
120  }
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 2372 of file class.ilObjUserGUI.php.

2373  {
2374  }

◆ updateObject()

ilObjUserGUI::updateObject ( )

Update user.

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

References $_GET, $_POST, ilObjectGUI\$ilias, $ilSetting, $ilUser, ilObjectGUI\$tpl, __sendProfileMail(), 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, uploadUserPictureObject(), and USER_FOLDER_ID.

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

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

Referenced by saveObject(), and updateObject().

1853  {
1854  global $ilUser, $rbacsystem;
1855 
1856  // User folder
1857  if($this->usrf_ref_id == USER_FOLDER_ID and
1858  !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
1859  {
1860  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
1861  }
1862  // if called from local administration $this->usrf_ref_id is category id
1863  // Todo: this has to be fixed. Do not mix user folder id and category id
1864  if($this->usrf_ref_id != USER_FOLDER_ID)
1865  {
1866  // check if user is assigned to category
1867  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
1868  {
1869  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
1870  }
1871  }
1872 
1873  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1874 
1875  if ($_FILES["userfile"]["tmp_name"] == "")
1876  {
1877  if ($userfile_input->getDeletionFlag())
1878  {
1879  $this->object->removeUserPicture();
1880  }
1881  return;
1882  }
1883  if ($_FILES["userfile"]["size"] == 0)
1884  {
1885  ilUtil::sendFailure($this->lng->txt("msg_no_file"));
1886  }
1887  else
1888  {
1889  $webspace_dir = ilUtil::getWebspaceDir();
1890  $image_dir = $webspace_dir."/usr_images";
1891  $store_file = "usr_".$this->object->getId()."."."jpg";
1892 
1893  // store filename
1894  $this->object->setPref("profile_image", $store_file);
1895  $this->object->update();
1896 
1897  // move uploaded file
1898  $pi = pathinfo($_FILES["userfile"]["name"]);
1899  $uploaded_file = $image_dir."/upload_".$this->object->getId().".".$pi["extension"];
1900  if (!ilUtil::moveUploadedFile($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"],
1901  $uploaded_file, false))
1902  {
1903  ilUtil::sendFailure($this->lng->txt("upload_error", true));
1904  $this->ctrl->redirect($this, "showProfile");
1905  }
1906  chmod($uploaded_file, 0770);
1907 
1908  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1909  // taking only frame [0] to avoid problems with animated gifs
1910  $show_file = "$image_dir/usr_".$this->object->getId().".jpg";
1911  $thumb_file = "$image_dir/usr_".$this->object->getId()."_small.jpg";
1912  $xthumb_file = "$image_dir/usr_".$this->object->getId()."_xsmall.jpg";
1913  $xxthumb_file = "$image_dir/usr_".$this->object->getId()."_xxsmall.jpg";
1914  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
1915  $show_file = ilUtil::escapeShellArg($show_file);
1916  $thumb_file = ilUtil::escapeShellArg($thumb_file);
1917  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
1918  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
1919 
1920  if(ilUtil::isConvertVersionAtLeast("6.3.8-3"))
1921  {
1922  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:".$show_file);
1923  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:".$thumb_file);
1924  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:".$xthumb_file);
1925  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:".$xxthumb_file);
1926  }
1927  else
1928  {
1929  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:".$show_file);
1930  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
1931  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:".$xthumb_file);
1932  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:".$xxthumb_file);
1933  }
1934  }
1935  }
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)
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: