ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilObjUserGUI Class Reference

Class ilObjUserGUI. More...

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

Public Member Functions

 ilObjUserGUI ($a_data, $a_id, $a_call_by_reference=false, $a_prepare_output=true)
 Constructor public. More...
 
executeCommand ()
 
 setTitleAndDescription ()
 
 cancelObject ()
 
 getAdminTabs (&$tabs_gui)
 admin and normal tabs are equal for roles More...
 
 getTabs (&$tabs_gui)
 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...
 
 initForm ($a_mode)
 Init user form. More...
 
 uploadUserPictureObject ()
 upload user image More...
 
 removeUserPictureObject ()
 remove user image More...
 
 updateObjectOld ()
 save user data public 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 ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 showUpperIcon ()
 
 __sendProfileMail ()
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
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...
 
 getAdminTabs (&$tabs_gui)
 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 ($in_rep=false)
 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...
 
 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 ()
 
 prepareOutput ()
 prepare output More...
 
 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)
 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...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 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 ($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...
 

Detailed Description

Member Function Documentation

◆ __buildFilterSelect()

ilObjUserGUI::__buildFilterSelect ( )

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

References $_SESSION, and ilUtil\formSelect().

Referenced by roleassignmentObject().

2801  {
2802  $action[0] = $this->lng->txt('assigned_roles');
2803  $action[1] = $this->lng->txt('all_roles');
2804  $action[2] = $this->lng->txt('all_global_roles');
2805  $action[3] = $this->lng->txt('all_local_roles');
2806  $action[4] = $this->lng->txt('internal_local_roles_only');
2807  $action[5] = $this->lng->txt('non_internal_local_roles_only');
2808 
2809  return ilUtil::formSelect($_SESSION['filtered_roles'],"filter",$action,false,true);
2810  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
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 209 of file class.ilObjUserGUI.php.

References $_POST, and ilUserDefinedFields\_getInstance().

Referenced by updateObjectOld().

210  {
211  include_once './Services/User/classes/class.ilUserDefinedFields.php';
212  $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
213 
214  foreach($this->user_defined_fields->getDefinitions() as $field_id => $definition)
215  {
216  if($definition['required'] and !strlen($_POST['udf'][$field_id]))
217  {
218  return false;
219  }
220  }
221  return true;
222  }
$_POST['username']
Definition: cron.php:12
static _getInstance()
Get instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getDateSelect()

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

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

References ilUtil\formSelect().

2733  {
2734  switch($a_type)
2735  {
2736  case "minute":
2737  for($i=0;$i<=60;$i++)
2738  {
2739  $days[$i] = $i < 10 ? "0".$i : $i;
2740  }
2741  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2742 
2743  case "hour":
2744  for($i=0;$i<24;$i++)
2745  {
2746  $days[$i] = $i < 10 ? "0".$i : $i;
2747  }
2748  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2749 
2750  case "day":
2751  for($i=1;$i<32;$i++)
2752  {
2753  $days[$i] = $i < 10 ? "0".$i : $i;
2754  }
2755  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2756 
2757  case "month":
2758  for($i=1;$i<13;$i++)
2759  {
2760  $month[$i] = $i < 10 ? "0".$i : $i;
2761  }
2762  return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
2763 
2764  case "year":
2765  if($a_selected < date('Y',time()))
2766  {
2767  $start = $a_selected;
2768  }
2769  else
2770  {
2771  $start = date('Y',time());
2772  }
2773 
2774  for($i = $start;$i < date("Y",time()) + 11;++$i)
2775  {
2776  $year[$i] = $i;
2777  }
2778  return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
2779  }
2780  }
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:

◆ __sendProfileMail()

ilObjUserGUI::__sendProfileMail ( )

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

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

Referenced by updateObject(), and updateObjectOld().

2866  {
2867  global $ilUser,$ilias;
2868 
2869  if($_POST['send_mail'] != 'y')
2870  {
2871  return '';
2872  }
2873  if(!strlen($this->object->getEmail()))
2874  {
2875  return '';
2876  }
2877 
2878  // Choose language of user
2879  $usr_lang = new ilLanguage($this->object->getLanguage());
2880  $usr_lang->loadLanguageModule('crs');
2881  $usr_lang->loadLanguageModule('registration');
2882 
2883  include_once "Services/Mail/classes/class.ilMimeMail.php";
2884 
2885  $mmail = new ilMimeMail();
2886  $mmail->autoCheck(false);
2887  $mmail->From($ilUser->getEmail());
2888  $mmail->To($this->object->getEmail());
2889 
2890  // mail subject
2891  $subject = $usr_lang->txt("profile_changed");
2892 
2893 
2894  // mail body
2895  $body = ($usr_lang->txt("reg_mail_body_salutation")." ".$this->object->getFullname().",\n\n");
2896 
2897  $date = $this->object->getApproveDate();
2898  // Approve
2899  if((time() - strtotime($date)) < 10)
2900  {
2901  $body .= ($usr_lang->txt('reg_mail_body_approve')."\n\n");
2902  }
2903  else
2904  {
2905  $body .= ($usr_lang->txt('reg_mail_body_profile_changed')."\n\n");
2906  }
2907 
2908  // Append login info only if password has been chacnged
2909  if($_POST['passwd'] != '********')
2910  {
2911  $body .= $usr_lang->txt("reg_mail_body_text2")."\n".
2912  ILIAS_HTTP_PATH."/login.php?client_id=".$ilias->client_id."\n".
2913  $usr_lang->txt("login").": ".$this->object->getLogin()."\n".
2914  $usr_lang->txt("passwd").": ".$_POST['passwd']."\n\n";
2915  }
2916  $body .= ($usr_lang->txt("reg_mail_body_text3")."\n");
2917  $body .= $this->object->getProfileAsString($usr_lang);
2918 
2919  $mmail->Subject($subject);
2920  $mmail->Body($body);
2921  $mmail->Send();
2922 
2923 
2924  return "<br/>".$this->lng->txt("mail_sent");
2925  }
$_POST['username']
Definition: cron.php:12
this class encapsulates the PHP mail() function.
global $ilUser
Definition: imgupload.php:15
loadLanguageModule($a_module)
language handling
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __showUserDefinedFields()

ilObjUserGUI::__showUserDefinedFields ( )

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

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

226  {
227  include_once './Services/User/classes/class.ilUserDefinedFields.php';
228  $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
229 
230  if($this->object->getType() == 'usr')
231  {
232  $user_defined_data = $this->object->getUserDefinedData();
233  }
234  foreach($this->user_defined_fields->getDefinitions() as $field_id => $definition)
235  {
236  $old = isset($_SESSION["error_post_vars"]["udf"][$field_id]) ?
237  $_SESSION["error_post_vars"]["udf"][$field_id] : $user_defined_data[$field_id];
238 
239  if($definition['field_type'] == UDF_TYPE_TEXT)
240  {
241  $this->tpl->setCurrentBlock("field_text");
242  $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
243  $this->tpl->setVariable("FIELD_VALUE",ilUtil::prepareFormOutput($old));
244  $this->tpl->parseCurrentBlock();
245  }
246  else
247  {
248  $this->tpl->setCurrentBlock("field_select");
249  $this->tpl->setVariable("SELECT_BOX",ilUtil::formSelect($old,
250  'udf['.$definition['field_id'].']',
251  $this->user_defined_fields->fieldValuesToSelectArray(
252  $definition['field_values']),
253  false,
254  true));
255  $this->tpl->parseCurrentBlock();
256  }
257  $this->tpl->setCurrentBlock("user_defined");
258 
259  if($definition['required'])
260  {
261  $name = $definition['field_name']."<span class=\"asterisk\">*</span>";
262  }
263  else
264  {
265  $name = $definition['field_name'];
266  }
267  $this->tpl->setVariable("TXT_FIELD_NAME",$name);
268  $this->tpl->parseCurrentBlock();
269  }
270  return true;
271  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static _getInstance()
Get instance.
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
+ Here is the call graph for this function:

◆ __toUnix()

ilObjUserGUI::__toUnix (   $a_time_arr)

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

Referenced by updateObjectOld().

2783  {
2784  return mktime($a_time_arr["hour"],
2785  $a_time_arr["minute"],
2786  $a_time_arr["second"],
2787  $a_time_arr["month"],
2788  $a_time_arr["day"],
2789  $a_time_arr["year"]);
2790  }
+ Here is the caller graph for this function:

◆ __unsetSessionVariables()

ilObjUserGUI::__unsetSessionVariables ( )

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

References $_SESSION.

2796  {
2797  unset($_SESSION["filtered_roles"]);
2798  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ _goto()

static ilObjUserGUI::_goto (   $a_target)
static

Goto user profile screen.

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

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

2931  {
2932  global $ilUser, $ilCtrl;
2933 
2934  // #10888
2935  if($a_target == md5("usrdelown"))
2936  {
2937  if($ilUser->getId() != ANONYMOUS_USER_ID &&
2938  $ilUser->hasDeletionFlag())
2939  {
2940  $ilCtrl->setTargetScript("ilias.php");
2941  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2942  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalsettingsgui"), "deleteOwnAccount3");
2943  }
2944  exit("This account is not flagged for deletion."); // #12160
2945  }
2946 
2947  if (substr($a_target, 0, 1) == "n")
2948  {
2949  $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
2950  }
2951 
2952  $_GET["cmd"] = "view";
2953  $_GET["user_id"] = (int) $a_target;
2954  $_GET["baseClass"] = "ilPublicUserProfileGUI";
2955  $_GET["cmdClass"] = "ilpublicuserprofilegui";
2956  include("ilias.php");
2957  exit;
2958  }
exit
Definition: login.php:54
$_GET["client_id"]
static _lookupId($a_user_str)
lookup id by login
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ addAdminLocatorItems()

ilObjUserGUI::addAdminLocatorItems ( )

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

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

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

2823  {
2824  global $ilLocator;
2825 
2826  $ilLocator->clearItems();
2827 
2828  if ($_GET["admin_mode"] == "settings") // system settings
2829  {
2830  $this->ctrl->setParameterByClass("ilobjsystemfoldergui",
2831  "ref_id", SYSTEM_FOLDER_ID);
2832  $ilLocator->addItem($this->lng->txt("administration"),
2833  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2834  ilFrameTargetInfo::_getFrame("MainContent"));
2835 
2836  if ($_GET['ref_id'] == USER_FOLDER_ID)
2837  {
2838  $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
2839  ilObject::_lookupObjId($_GET["ref_id"]))),
2840  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
2841  }
2842  elseif ($_GET['ref_id'] == ROLE_FOLDER_ID)
2843  {
2844  $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
2845  ilObject::_lookupObjId($_GET["ref_id"]))),
2846  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view"));
2847  }
2848 
2849  if ($_GET["obj_id"] > 0)
2850  {
2851  $ilLocator->addItem($this->object->getTitle(),
2852  $this->ctrl->getLinkTarget($this, "view"));
2853  }
2854  }
2855  else // repository administration
2856  {
2857  // ?
2858  }
2859  }
$_GET["client_id"]
static _lookupObjId($a_id)
static _getFrame($a_class, $a_type='')
Get content frame name.
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:

◆ applyFilterObject()

ilObjUserGUI::applyFilterObject ( )

Apply filter.

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

References roleassignmentObject().

2712  {
2713  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2714  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2715  $table_gui->writeFilterToSession(); // writes filter to session
2716  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2717  $this->roleassignmentObject();
2718  }
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 2474 of file class.ilObjUserGUI.php.

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

2475  {
2476  global $rbacsystem, $rbacadmin, $rbacreview;
2477 
2478  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
2479  {
2480  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
2481  }
2482 
2483  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
2484  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
2485 
2486  // prevent unassignment of system role from system user
2487  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles))
2488  {
2489  array_push($selected_roles,SYSTEM_ROLE_ID);
2490  }
2491 
2492  $global_roles_all = $rbacreview->getGlobalRoles();
2493  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
2494  $assigned_roles = array_intersect($assigned_roles_all,$posted_roles);
2495  $assigned_global_roles_all = array_intersect($assigned_roles_all,$global_roles_all);
2496  $assigned_global_roles = array_intersect($assigned_global_roles_all,$posted_roles);
2497  $posted_global_roles = array_intersect($selected_roles,$global_roles_all);
2498 
2499  if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
2500  or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles)))
2501  {
2502  //$this->ilias->raiseError($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),$this->ilias->error_obj->MESSAGE);
2503  // workaround. sometimes jumps back to wrong page
2504  ilUtil::sendFailure($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),true);
2505  $this->ctrl->redirect($this,'roleassignment');
2506  }
2507 
2508  foreach (array_diff($assigned_roles,$selected_roles) as $role)
2509  {
2510  $rbacadmin->deassignUser($role,$this->object->getId());
2511  }
2512 
2513  foreach (array_diff($selected_roles,$assigned_roles) as $role)
2514  {
2515  $rbacadmin->assignUser($role,$this->object->getId(),false);
2516  }
2517 
2518  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
2519 
2520  // update object data entry (to update last modification date)
2521  $this->object->update();
2522 
2523  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"),true);
2524 
2525  if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
2526  {
2527  $this->ctrl->redirect($this,'roleassignment');
2528  }
2529  else
2530  {
2531  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
2532  }
2533 
2534  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ cancelObject()

ilObjUserGUI::cancelObject ( )

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

References $_GET, and ilSession\clear().

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

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

345  {
346  global $tpl, $rbacsystem, $rbacreview, $ilUser;
347 
348  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id) and
349  !$rbacsystem->checkAccess('cat_administrate_users',$this->usrf_ref_id))
350  {
351  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
352  }
353 
354  $this->initCreate();
355  $this->initForm("create");
356  return $tpl->setContent($this->form_gui->getHtml());
357  }
redirection script todo: (a better solution should control the processing via a xml file) ...
initForm($a_mode)
Init user form.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ editObject()

ilObjUserGUI::editObject ( )

Display user edit form.

public

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

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

Referenced by removeUserPictureObject(), and updateObjectOld().

547  {
548  global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser
550 
551  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
552 
553  //load ILIAS settings
554  $settings = $ilias->getAllSettings();
555 
556  // User folder
557  if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
558  {
559  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
560  }
561  // if called from local administration $this->usrf_ref_id is category id
562  // Todo: this has to be fixed. Do not mix user folder id and category id
563  if($this->usrf_ref_id != USER_FOLDER_ID)
564  {
565  // check if user is assigned to category
566  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
567  {
568  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
569  }
570  }
571 
572  if($this->usrf_ref_id != USER_FOLDER_ID)
573  {
574  $this->tabs_gui->clearTargets();
575  }
576 
577  // get form
578  $this->initForm("edit");
579  $this->getValues();
580  $this->showAcceptedTermsOfService();
581  $this->tpl->setContent($this->form_gui->getHTML());
582  }
getValues()
Get values from user object and put them into form.
redirection script todo: (a better solution should control the processing via a xml file) ...
initForm($a_mode)
Init user form.
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
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 $cmd, ilLearningProgressBaseGUI\LP_CONTEXT_USER_FOLDER, 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  {
82  case "illearningprogressgui":
83  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
85  $this->ctrl->forwardCommand($new_gui);
86  break;
87 
88  case "ilobjectownershipmanagementgui":
89  include_once("Services/Object/classes/class.ilObjectOwnershipManagementGUI.php");
90  $gui = new ilObjectOwnershipManagementGUI($this->object->getId());
91  $this->ctrl->forwardCommand($gui);
92  break;
93 
94  default:
95  if($cmd == "" || $cmd == "view")
96  {
97  $cmd = "edit";
98  }
99  $cmd .= "Object";
100  $return = $this->$cmd();
101 
102  break;
103  }
104  return $return;
105  }
$cmd
Definition: sahs_server.php:35
Class ilObjectOwnershipManagementGUI.
prepareOutput()
prepare output
const USER_FOLDER_ID
Class ilObjUserFolder.
Class ilObjUserTrackingGUI.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjUserGUI::getAdminTabs ( $tabs_gui)

admin and normal tabs are equal for roles

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

References getTabs().

145  {
146  $this->getTabs($tabs_gui);
147  }
getTabs(&$tabs_gui)
get tabs
+ Here is the call graph for this function:

◆ getTabs()

ilObjUserGUI::getTabs ( $tabs_gui)

get tabs

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

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

Referenced by getAdminTabs().

153  {
154  global $rbacsystem, $ilHelp;
155 
156  $tabs_gui->clearTargets();
157 
158  $ilHelp->setScreenIdComponent("usr");
159 
160  if ($_GET["search"])
161  {
162  $tabs_gui->setBackTarget(
163  $this->lng->txt("search_results"),$_SESSION["usr_search_link"]);
164 
165  $tabs_gui->addTarget("properties",
166  $this->ctrl->getLinkTarget($this, "edit"), array("edit","","view"), get_class($this),"",true);
167  }
168  else
169  {
170  $tabs_gui->addTarget("properties",
171  $this->ctrl->getLinkTarget($this, "edit"), array("edit","","view"), get_class($this));
172  }
173 
174  $tabs_gui->addTarget("role_assignment",
175  $this->ctrl->getLinkTarget($this, "roleassignment"), array("roleassignment"), get_class($this));
176 
177  // learning progress
178  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
179  if($rbacsystem->checkAccess('read',$this->ref_id) and
181  ilObjUserTracking::_enabledUserRelatedData())
182  {
183 
184  $tabs_gui->addTarget('learning_progress',
185  $this->ctrl->getLinkTargetByClass('illearningprogressgui',''),
186  '',
187  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
188  }
189 
190  $tabs_gui->addTarget('user_ownership',
191  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui',''),
192  '',
193  'ilobjectownershipmanagementgui');
194  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_GET["client_id"]
static _enabledLearningProgress()
check wether learing progress is enabled or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValues()

ilObjUserGUI::getValues ( )

Get values from user object and put them into form.

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

References ilObjectGUI\$data, $ilSetting, $ilUser, ilUserDefinedFields\_getInstance(), ilFormat\_getSizeMagnitude(), ilDiskQuotaActivationChecker\_isActive(), ilDiskQuotaActivationChecker\_isPersonalWorkspaceActive(), ilObjUser\_lookupLogin(), ilFormat\formatDate(), ilDateTime\get(), IL_CAL_FKT_DATE, and IL_CAL_UNIX.

Referenced by editObject().

967  {
968  global $ilUser, $ilSetting;
969 
970  $data = array();
971 
972  // login data
973  $data["auth_mode"] = $this->object->getAuthMode();
974  $data["login"] = $this->object->getLogin();
975  //$data["passwd"] = "********";
976  //$data["passwd2"] = "********";
977  $data["ext_account"] = $this->object->getExternalAccount();
978 
979  // system information
980  require_once './Services/Utilities/classes/class.ilFormat.php';
981  $data["create_date"] = ilFormat::formatDate($this->object->getCreateDate(),'datetime',true);
982  $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
983  $data["approve_date"] = ($this->object->getApproveDate() != "")
984  ? ilFormat::formatDate($this->object->getApproveDate(),'datetime',true)
985  : null;
986  $data["agree_date"] = ($this->object->getAgreeDate() != "")
987  ? ilFormat::formatDate($this->object->getAgreeDate(),'datetime',true)
988  : null;
989  $data["last_login"] = ($this->object->getLastLogin() != "")
990  ? ilFormat::formatDate($this->object->getLastLogin(),'datetime',true)
991  : null;
992  $data["active"] = $this->object->getActive();
993  $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited();
994 
995  $from = new ilDateTime($this->object->getTimeLimitFrom() ? $this->object->getTimeLimitFrom() : time(),IL_CAL_UNIX);
996  $data["time_limit_from"]["date"] = $from->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
997  $data["time_limit_from"]["time"] = $from->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
998 
999  $until = new ilDateTime($this->object->getTimeLimitUntil() ? $this->object->getTimeLimitUntil() : time(),IL_CAL_UNIX);
1000  $data['time_limit_until']['date'] = $until->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
1001  $data['time_limit_until']['time'] = $until->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
1002 
1003 
1004  // BEGIN DiskQuota, Show disk space used
1005  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
1007  {
1008  $data["disk_quota"] = $this->object->getDiskQuota() / ilFormat::_getSizeMagnitude() / ilFormat::_getSizeMagnitude();
1009  }
1011  {
1012  $data["wsp_disk_quota"] = $this->object->getPersonalWorkspaceDiskQuota() / ilFormat::_getSizeMagnitude() / ilFormat::_getSizeMagnitude();
1013  }
1014  // W. Randelshofer 2008-09-09: Deactivated display of disk space usage,
1015  // because determining the disk space usage may take several minutes.
1016  /*
1017  require_once "Modules/File/classes/class.ilObjFileAccess.php";
1018  require_once "Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
1019  require_once "Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
1020  require_once "Services/Mail/classes/class.ilObjMailAccess.php";
1021  require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
1022  require_once "Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
1023  $data["disk_space_used"] =
1024  ilObjFileAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1025  ilObjFileBasedLMAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1026  ilObjSAHSLearningModuleAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1027  ilObjMailAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1028  ilObjForumAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1029  ilObjMediaCastAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>';
1030  */
1031  // END DiskQuota, Show disk space used
1032 
1033  // personal data
1034  $data["gender"] = $this->object->getGender();
1035  $data["firstname"] = $this->object->getFirstname();
1036  $data["lastname"] = $this->object->getLastname();
1037  $data["title"] = $this->object->getUTitle();
1038  $data['birthday'] = $this->object->getBirthday();
1039  $data["institution"] = $this->object->getInstitution();
1040  $data["department"] = $this->object->getDepartment();
1041  $data["street"] = $this->object->getStreet();
1042  $data["city"] = $this->object->getCity();
1043  $data["zipcode"] = $this->object->getZipcode();
1044  $data["country"] = $this->object->getCountry();
1045  $data["sel_country"] = $this->object->getSelectedCountry();
1046  $data["phone_office"] = $this->object->getPhoneOffice();
1047  $data["phone_home"] = $this->object->getPhoneHome();
1048  $data["phone_mobile"] = $this->object->getPhoneMobile();
1049  $data["fax"] = $this->object->getFax();
1050  $data["email"] = $this->object->getEmail();
1051  $data["hobby"] = $this->object->getHobby();
1052  $data["referral_comment"] = $this->object->getComment();
1053 
1054  // interests
1055  $data["interests_general"] = $this->object->getGeneralInterests();
1056  $data["interests_help_offered"] = $this->object->getOfferingHelp();
1057  $data["interests_help_looking"] = $this->object->getLookingForHelp();
1058 
1059  // instant messengers
1060  $data["im_icq"] = $this->object->getInstantMessengerId('icq');
1061  $data["im_yahoo"] = $this->object->getInstantMessengerId('yahoo');
1062  $data["im_msn"] = $this->object->getInstantMessengerId('msn');
1063  $data["im_aim"] = $this->object->getInstantMessengerId('aim');
1064  $data["im_skype"] = $this->object->getInstantMessengerId('skype');
1065  $data["im_jabber"] = $this->object->getInstantMessengerId('jabber');
1066  $data["im_voip"] = $this->object->getInstantMessengerId('voip');
1067 
1068  // other data
1069  $data["matriculation"] = $this->object->getMatriculation();
1070  $data["delicious"] = $this->object->getDelicious();
1071  $data["client_ip"] = $this->object->getClientIP();
1072 
1073  // user defined fields
1074  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1075  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
1076  $user_defined_data = $this->object->getUserDefinedData();
1077  foreach($this->user_defined_fields->getDefinitions() as $field_id => $definition)
1078  {
1079  $data["udf_".$field_id] = $user_defined_data["f_".$field_id];
1080  }
1081 
1082  // settings
1083  $data["language"] = $this->object->getLanguage();
1084  $data["skin_style"] = $this->object->skin.":".$this->object->prefs["style"];
1085  $data["hits_per_page"] = $this->object->prefs["hits_per_page"];
1086  $data["show_users_online"] = $this->object->prefs["show_users_online"];
1087  $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"] == 'y';
1088  $data["session_reminder_enabled"] = (int)$this->object->prefs["session_reminder_enabled"];
1089 
1090  $this->form_gui->setValuesByArray($data);
1091  }
static _getInstance()
Get instance.
const IL_CAL_UNIX
const IL_CAL_FKT_DATE
Date and time handling
_lookupLogin($a_user_id)
lookup login
get($a_format, $a_format_str='', $a_tz='')
get formatted date
static _getSizeMagnitude()
Returns the magnitude used for size units.
formatDate($a_date, $a_mode="datetime", $a_omit_seconds=false, $a_relative=TRUE)
format a date according to the user language shortcut for Format::fmtDateTime public ...
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
+ 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 2968 of file class.ilObjUserGUI.php.

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

Referenced by saveObject(), and updateObject().

2969  {
2970  $profileMaybeIncomplete = false;
2971 
2972  require_once 'Services/User/classes/class.ilUserProfile.php';
2973 
2974  foreach( ilUserProfile::getIgnorableRequiredSettings() as $fieldName )
2975  {
2976  $elm = $this->form_gui->getItemByPostVar($fieldName);
2977 
2978  if( !$elm ) continue;
2979 
2980  if( $elm->getRequired() )
2981  {
2982  $profileMaybeIncomplete = true;
2983 
2984  // Flag as optional
2985  $elm->setRequired( false );
2986  }
2987  }
2988 
2989  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
2990  $user_defined_fields = ilUserDefinedFields::_getInstance();
2991  foreach($user_defined_fields->getDefinitions() as $field_id => $definition)
2992  {
2993  $elm = $this->form_gui->getItemByPostVar('udf_'.$definition['field_id']);
2994 
2995  if( !$elm ) continue;
2996 
2997  if( $elm->getRequired() && $definition['changeable'] && $definition['required'] && $definition['visible'] )
2998  {
2999  $profileMaybeIncomplete = true;
3000 
3001  // Flag as optional
3002  $elm->setRequired( false );
3003  }
3004  }
3005 
3006  return $profileMaybeIncomplete;
3007  }
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 2812 of file class.ilObjUserGUI.php.

References roleassignmentObject().

2813  {
2814  parent::hitsperpageObject();
2815  $this->roleassignmentObject();
2816  }
roleassignmentObject()
display roleassignment panel
+ Here is the call graph for this function:

◆ ilObjUserGUI()

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

Constructor public.

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

References $_GET, $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$ref_id, and ilObjectGUI\ilObjectGUI().

48  {
49  global $ilCtrl, $lng;
50 
51  define('USER_FOLDER_ID',7);
52 
53  $this->type = "usr";
54  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
55  $this->usrf_ref_id =& $this->ref_id;
56 
57  $this->ctrl =& $ilCtrl;
58  $this->ctrl->saveParameter($this, array('obj_id', 'letter'));
59  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "letter", $_GET["letter"]);
60 
61  $lng->loadLanguageModule('user');
62 
63  // for gender selection. don't change this
64  // maybe deprecated
65  $this->gender = array(
66  'm' => "salutation_m",
67  'f' => "salutation_f"
68  );
69  }
$_GET["client_id"]
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
+ Here is the call graph for this function:

◆ initCreate()

ilObjUserGUI::initCreate ( )

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

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

Referenced by createObject(), and saveObject().

274  {
275  global $tpl, $rbacsystem, $rbacreview, $ilUser;
276 
277  if($this->usrf_ref_id != USER_FOLDER_ID)
278  {
279  $this->tabs_gui->clearTargets();
280  }
281 
282  // role selection
283  $obj_list = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
284  $rol = array();
285  foreach ($obj_list as $obj_data)
286  {
287  // allow only 'assign_users' marked roles if called from category
288  if($this->object->getRefId() != USER_FOLDER_ID and !in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
289  {
290  include_once './Services/AccessControl/classes/class.ilObjRole.php';
291 
292  if(!ilObjRole::_getAssignUsersStatus($obj_data['obj_id']))
293  {
294  continue;
295  }
296  }
297  // exclude anonymous role from list
298  if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID)
299  {
300  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
301  if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
302  {
303  $rol[$obj_data["obj_id"]] = $obj_data["title"];
304  }
305  }
306  }
307 
308  // raise error if there is no global role user can be assigned to
309  if(!count($rol))
310  {
311  $this->ilias->raiseError($this->lng->txt("msg_no_roles_users_can_be_assigned_to"),$this->ilias->error_obj->MESSAGE);
312  }
313 
314  $keys = array_keys($rol);
315 
316  // set pre defined user role to default
317  if (in_array(4,$keys))
318  {
319  $this->default_role = 4;
320  }
321  else
322  {
323  if (count($keys) > 1 and in_array(2,$keys))
324  {
325  // remove admin role as preselectable role
326  foreach ($keys as $key => $val)
327  {
328  if ($val == 2)
329  {
330  unset($keys[$key]);
331  break;
332  }
333  }
334  }
335 
336  $this->default_role = array_shift($keys);
337  }
338  $this->selectable_roles = $rol;
339  }
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilUser
Definition: imgupload.php:15
_getAssignUsersStatus($a_role_id)
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilObjUserGUI::initForm (   $a_mode)

Init user form.

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

References $ilCtrl, $ilSetting, $ilUser, $lang, ilObjectGUI\$lng, $options, ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_getLastHistoryDataByUserId(), ilObjUser\_getPersonalPicturePath(), ilDiskQuotaActivationChecker\_isActive(), ilAuthUtils\_isExternalAccountEnabled(), ilDiskQuotaActivationChecker\_isPersonalWorkspaceActive(), ilObjStyleSettings\_lookupActivatedStyle(), ilDiskQuotaChecker\_lookupDiskQuota(), ilDiskQuotaChecker\_lookupDiskUsage(), ilDiskQuotaChecker\_lookupPersonalWorkspaceDiskQuota(), ilDatePresentation\formatDate(), ilFormat\formatSize(), ilDiskQuotaHandler\getFilesizeByOwner(), ilDiskQuotaHandler\getFilesizeByTypeAndOwner(), ilUtil\getPasswordRequirementsInfo(), IL_CAL_DATETIME, IL_CAL_UNIX, isSettingChangeable(), ilCheckboxInputGUI\setChecked(), ilImageFileInputGUI\setImage(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setMulti(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setRows(), ilDateTimeInputGUI\setShowTime(), ilPasswordInputGUI\setSize(), ilTextInputGUI\setSize(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), UDF_TYPE_TEXT, UDF_TYPE_WYSIWYG, and USER_FOLDER_ID.

Referenced by createObject(), editObject(), saveObject(), and updateObject().

1097  {
1098  global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser;
1099 
1100  $settings = $ilSetting->getAll();
1101 
1102  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1103 
1104  $this->form_gui = new ilPropertyFormGUI();
1105  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1106  if ($a_mode == "create")
1107  {
1108  $this->form_gui->setTitle($lng->txt("usr_new"));
1109  }
1110  else
1111  {
1112  $this->form_gui->setTitle($lng->txt("usr_edit"));
1113  }
1114 
1115  // login data
1116  $sec_l = new ilFormSectionHeaderGUI();
1117  $sec_l->setTitle($lng->txt("login_data"));
1118  $this->form_gui->addItem($sec_l);
1119 
1120  // authentication mode
1121  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
1122  $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
1123  $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode");
1124  $option = array();
1125  foreach ($active_auth_modes as $auth_name => $auth_key)
1126  {
1127  if ($auth_name == 'default')
1128  {
1129  $name = $this->lng->txt('auth_'.$auth_name)." (".$this->lng->txt('auth_'.ilAuthUtils::_getAuthModeName($auth_key)).")";
1130  }
1131  else
1132  {
1133  $name = $this->lng->txt('auth_'.$auth_name);
1134  }
1135  $option[$auth_name] = $name;
1136  }
1137  $am->setOptions($option);
1138  $this->form_gui->addItem($am);
1139 
1140  if($a_mode == "edit")
1141  {
1142  $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id");
1143  $id->setValue($this->object->getId());
1144  $this->form_gui->addItem($id);
1145  }
1146 
1147  // login
1148  $lo = new ilUserLoginInputGUI($lng->txt("login"), "login");
1149  $lo->setRequired(true);
1150  if ($a_mode == "edit")
1151  {
1152  $lo->setCurrentUserId($this->object->getId());
1153  try
1154  {
1155  include_once 'Services/Calendar/classes/class.ilDate.php';
1156 
1157  $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
1158  $lo->setInfo(
1159  sprintf(
1160  $this->lng->txt('usr_loginname_history_info'),
1161  ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)),
1162  $last_history_entry[0]
1163  )
1164  );
1165  }
1166  catch(ilUserException $e) { }
1167  }
1168 
1169  $this->form_gui->addItem($lo);
1170 
1171  // passwords
1172 // @todo: do not show passwords, if there is not a single auth, that
1173 // allows password setting
1174  {
1175  $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd");
1176  $pw->setSize(32);
1177  $pw->setMaxLength(32);
1178  $pw->setValidateAuthPost("auth_mode");
1179  if ($a_mode == "create")
1180  {
1181  $pw->setRequiredOnAuth(true);
1182  }
1183  $pw->setInfo(ilUtil::getPasswordRequirementsInfo());
1184  $this->form_gui->addItem($pw);
1185  }
1186  // @todo: invisible/hidden passwords
1187 
1188  // external account
1189  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
1191  {
1192  $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account");
1193  $ext->setSize(40);
1194  $ext->setMaxLength(250);
1195  $ext->setInfo($lng->txt("user_ext_account_desc"));
1196  $this->form_gui->addItem($ext);
1197  }
1198 
1199  // login data
1200  $sec_si = new ilFormSectionHeaderGUI();
1201  $sec_si->setTitle($this->lng->txt("system_information"));
1202  $this->form_gui->addItem($sec_si);
1203 
1204  // create date, approve date, agreement date, last login
1205  if ($a_mode == "edit")
1206  {
1207  $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner");
1208  foreach($sia as $a)
1209  {
1210  $siai = new ilNonEditableValueGUI($lng->txt($a), $a);
1211  $this->form_gui->addItem($siai);
1212  }
1213  }
1214 
1215  // active
1216  $ac = new ilCheckboxInputGUI($lng->txt("active"), "active");
1217  $ac->setChecked(true);
1218  $this->form_gui->addItem($ac);
1219 
1220  // access @todo: get fields right (names change)
1221  $lng->loadLanguageModule('crs');
1222 
1223  // access
1224  $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
1225  $radg->setValue(1);
1226  $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1);
1227  $radg->addOption($op1);
1228  $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0);
1229  $radg->addOption($op2);
1230 
1231 // $ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
1232 // $ac->setChecked(true);
1233 // $ac->setOptionTitle($lng->txt("crs_unlimited"));
1234 
1235  // access.from
1236  $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
1237  $acfrom->setShowTime(true);
1238 // $ac->addSubItem($acfrom);
1239  $op2->addSubItem($acfrom);
1240 
1241  // access.to
1242  $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
1243  $acto->setShowTime(true);
1244 // $ac->addSubItem($acto);
1245  $op2->addSubItem($acto);
1246 
1247 // $this->form_gui->addItem($ac);
1248  $this->form_gui->addItem($radg);
1249 
1250  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
1252  {
1253  $lng->loadLanguageModule("file");
1254 
1255  $quota_head = new ilFormSectionHeaderGUI();
1256  $quota_head->setTitle($lng->txt("repository_disk_quota"));
1257  $this->form_gui->addItem($quota_head);
1258 
1259  // disk quota
1260  $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota");
1261  $disk_quota->setSize(10);
1262  $disk_quota->setMaxLength(11);
1263  $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
1264  $this->form_gui->addItem($disk_quota);
1265 
1266  if ($a_mode == "edit")
1267  {
1268  // show which disk quota is in effect, and explain why
1269  require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
1270  $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId());
1271  if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota'])
1272  {
1273  $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'),
1274  ilFormat::formatSize($dq_info['user_disk_quota'],'short'),
1275  ilFormat::formatSize($dq_info['role_disk_quota'],'short'),
1276  $dq_info['role_title']);
1277  }
1278  else if (is_infinite($dq_info['role_disk_quota']))
1279  {
1280  $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
1281  }
1282  else
1283  {
1284  $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'),
1285  ilFormat::formatSize($dq_info['role_disk_quota'],'short'),
1286  $dq_info['role_title']);
1287  }
1288  $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc").'<br>'.$info_text);
1289 
1290 
1291  // disk usage
1292  $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId());
1293  $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
1294  if ($du_info['last_update'] === null)
1295  {
1296  $disk_usage->setValue($lng->txt('unknown'));
1297  }
1298  else
1299  {
1300  require_once './Services/Utilities/classes/class.ilFormat.php';
1301  $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'],'short'));
1302  $info = '<table class="il_user_quota_disk_usage_overview">';
1303  // write the count and size of each object type
1304  foreach ($du_info['details'] as $detail_data)
1305  {
1306  $info .= '<tr>'.
1307  '<td class="std">'.$detail_data['count'].'</td>'.
1308  '<td class="std">'.$lng->txt($detail_data['type']).'</td>'.
1309  '<td class="std">'.ilFormat::formatSize($detail_data['size'], 'short').'</td>'.
1310  '</tr>'
1311  ;
1312  }
1313  $info .= '</table>';
1314  $info .= '<br>'.$this->lng->txt('last_update').': '.
1315  ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME));
1316  $disk_usage->setInfo($info);
1317 
1318  }
1319  $this->form_gui->addItem($disk_usage);
1320 
1321  // date when the last disk quota reminder was sent to the user
1322  if (true || $dq_info['last_reminder'])
1323  {
1324  $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder");
1325  $reminder->setValue(
1326  ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME))
1327  );
1328  $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc"));
1329  $this->form_gui->addItem($reminder);
1330  }
1331  }
1332  }
1333 
1335  {
1336  $lng->loadLanguageModule("file");
1337 
1338  $quota_head = new ilFormSectionHeaderGUI();
1339  $quota_head->setTitle($lng->txt("personal_workspace_disk_quota"));
1340  $this->form_gui->addItem($quota_head);
1341 
1342  // personal workspace disk quota
1343  $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota");
1344  $wsp_disk_quota->setSize(10);
1345  $wsp_disk_quota->setMaxLength(11);
1346  $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
1347  $this->form_gui->addItem($wsp_disk_quota);
1348 
1349  if ($a_mode == "edit")
1350  {
1351  // show which disk quota is in effect, and explain why
1352  require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
1353  $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId());
1354  if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota'])
1355  {
1356  $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'),
1357  ilFormat::formatSize($dq_info['user_wsp_disk_quota'],'short'),
1358  ilFormat::formatSize($dq_info['role_wsp_disk_quota'],'short'),
1359  $dq_info['role_title']);
1360  }
1361  else if (is_infinite($dq_info['role_wsp_disk_quota']))
1362  {
1363  $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
1364  }
1365  else
1366  {
1367  $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'),
1368  ilFormat::formatSize($dq_info['role_wsp_disk_quota'],'short'),
1369  $dq_info['role_title']);
1370  }
1371  $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc").'<br>'.$info_text);
1372  }
1373 
1374  // disk usage
1375  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
1376  $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId());
1377  $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
1378  if (!sizeof($du_info))
1379  {
1380  $disk_usage->setValue($lng->txt('unknown'));
1381  }
1382  else
1383  {
1384  require_once './Services/Utilities/classes/class.ilFormat.php';
1385  $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId())));
1386  $info = '<table class="il_user_quota_disk_usage_overview">';
1387  // write the count and size of each object type
1388  foreach ($du_info as $detail_data)
1389  {
1390  $info .= '<tr>'.
1391  '<td class="std">'.$detail_data['count'].'</td>'.
1392  '<td class="std">'.$lng->txt("obj_".$detail_data["src_type"]).'</td>'.
1393  '<td class="std">'.ilFormat::formatSize($detail_data['filesize'], 'short').'</td>'.
1394  '</tr>'
1395  ;
1396  }
1397  $info .= '</table>';
1398  $disk_usage->setInfo($info);
1399 
1400  }
1401  $this->form_gui->addItem($disk_usage);
1402  }
1403 
1404  // personal data
1405  if(
1406  $this->isSettingChangeable('gender') or
1407  $this->isSettingChangeable('firstname') or
1408  $this->isSettingChangeable('lastname') or
1409  $this->isSettingChangeable('title') or
1410  $this->isSettingChangeable('personal_image') or
1411  $this->isSettingChangeable('birhtday')
1412  )
1413  {
1414  $sec_pd = new ilFormSectionHeaderGUI();
1415  $sec_pd->setTitle($this->lng->txt("personal_data"));
1416  $this->form_gui->addItem($sec_pd);
1417  }
1418 
1419  // gender
1420  if($this->isSettingChangeable('gender'))
1421  {
1422  $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender");
1423  $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]);
1424  $female = new ilRadioOption($lng->txt("gender_f"), "f");
1425  $gndr->addOption($female);
1426  $male = new ilRadioOption($lng->txt("gender_m"), "m");
1427  $gndr->addOption($male);
1428  $this->form_gui->addItem($gndr);
1429  }
1430 
1431  // firstname, lastname, title
1432  $fields = array("firstname" => true, "lastname" => true,
1433  "title" => isset($settings["require_title"]) && $settings["require_title"]);
1434  foreach($fields as $field => $req)
1435  {
1436  if($this->isSettingChangeable($field))
1437  {
1438  $inp = new ilTextInputGUI($lng->txt($field), $field);
1439  $inp->setSize(32);
1440  $inp->setMaxLength(32);
1441  $inp->setRequired($req);
1442  $this->form_gui->addItem($inp);
1443  }
1444  }
1445 
1446  // personal image
1447  if($this->isSettingChangeable('upload'))
1448  {
1449  $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
1450  if ($a_mode == "edit" || $a_mode == "upload")
1451  {
1452  $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true,
1453  true));
1454  }
1455  $this->form_gui->addItem($pi);
1456  }
1457 
1458  if($this->isSettingChangeable('birthday'))
1459  {
1460  $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday');
1461  $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]);
1462  $birthday->setShowEmpty(true);
1463  $birthday->setStartYear(1900);
1464  $this->form_gui->addItem($birthday);
1465  }
1466 
1467 
1468  // institution, department, street, city, zip code, country, phone office
1469  // phone home, phone mobile, fax, e-mail
1470  $fields = array(
1471  array("institution", 40, 80),
1472  array("department", 40, 80),
1473  array("street", 40, 40),
1474  array("city", 40, 40),
1475  array("zipcode", 10, 10),
1476  array("country", 40, 40),
1477  array("sel_country"),
1478  array("phone_office", 30, 30),
1479  array("phone_home", 30, 30),
1480  array("phone_mobile", 30, 30),
1481  array("fax", 30, 30));
1482 
1483  $counter = 0;
1484  foreach ($fields as $field)
1485  {
1486  if(!$counter++ and $this->isSettingChangeable($field[0]))
1487  {
1488  // contact data
1489  $sec_cd = new ilFormSectionHeaderGUI();
1490  $sec_cd->setTitle($this->lng->txt("contact_data"));
1491  $this->form_gui->addItem($sec_cd);
1492  }
1493  if($this->isSettingChangeable($field[0]))
1494  {
1495  if ($field[0] != "sel_country")
1496  {
1497  $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]);
1498  $inp->setSize($field[1]);
1499  $inp->setMaxLength($field[2]);
1500  $inp->setRequired(isset($settings["require_".$field[0]]) &&
1501  $settings["require_".$field[0]]);
1502  $this->form_gui->addItem($inp);
1503  }
1504  else
1505  {
1506  // country selection
1507  include_once("./Services/Form/classes/class.ilCountrySelectInputGUI.php");
1508  $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]);
1509  $cs->setRequired(isset($settings["require_".$field[0]]) &&
1510  $settings["require_".$field[0]]);
1511  $this->form_gui->addItem($cs);
1512  }
1513  }
1514  }
1515 
1516  // email
1517  if($this->isSettingChangeable('email'))
1518  {
1519  $em = new ilEMailInputGUI($lng->txt("email"), "email");
1520  $em->setRequired(isset($settings["require_email"]) &&
1521  $settings["require_email"]);
1522  $this->form_gui->addItem($em);
1523  }
1524 
1525  // interests/hobbies
1526  if($this->isSettingChangeable('hobby'))
1527  {
1528  $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby");
1529  $hob->setRows(3);
1530  $hob->setCols(40);
1531  $hob->setRequired(isset($settings["require_hobby"]) &&
1532  $settings["require_hobby"]);
1533  $this->form_gui->addItem($hob);
1534  }
1535 
1536  // referral comment
1537  if($this->isSettingChangeable('referral_comment'))
1538  {
1539  $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment");
1540  $rc->setRows(3);
1541  $rc->setCols(40);
1542  $rc->setRequired(isset($settings["require_referral_comment"]) &&
1543  $settings["require_referral_comment"]);
1544  $this->form_gui->addItem($rc);
1545  }
1546 
1547 
1548  // interests
1549 
1550  $sh = new ilFormSectionHeaderGUI();
1551  $sh->setTitle($lng->txt("interests"));
1552  $this->form_gui->addItem($sh);
1553 
1554  $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
1555  foreach($multi_fields as $multi_field)
1556  {
1557  if($this->isSettingChangeable($multi_field))
1558  {
1559  // see ilUserProfile
1560  $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field);
1561  $ti->setMulti(true);
1562  $ti->setMaxLength(40);
1563  $ti->setSize(40);
1564  $ti->setRequired(isset($settings["require_".$multi_field]) &&
1565  $settings["require_".$multi_field]);
1566  $this->form_gui->addItem($ti);
1567  }
1568  }
1569 
1570 
1571  // instant messengers
1572  if($this->isSettingChangeable('instant_messengers'))
1573  {
1574  $sec_im = new ilFormSectionHeaderGUI();
1575  $sec_im->setTitle($this->lng->txt("instant_messengers"));
1576  $this->form_gui->addItem($sec_im);
1577  }
1578 
1579  // icq, yahoo, msn, aim, skype
1580  $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
1581  foreach ($fields as $field)
1582  {
1583  if($this->isSettingChangeable('instant_messengers'))
1584  {
1585  $im = new ilTextInputGUI($lng->txt("im_".$field), "im_".$field);
1586  $im->setSize(40);
1587  $im->setMaxLength(40);
1588  $this->form_gui->addItem($im);
1589  }
1590  }
1591 
1592  // other information
1593  if($this->isSettingChangeable('user_profile_other'))
1594  {
1595  $sec_oi = new ilFormSectionHeaderGUI();
1596  $sec_oi->setTitle($this->lng->txt("user_profile_other"));
1597  $this->form_gui->addItem($sec_oi);
1598  }
1599 
1600  // matriculation number
1601  if($this->isSettingChangeable('matriculation'))
1602  {
1603  $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation");
1604  $mr->setSize(40);
1605  $mr->setMaxLength(40);
1606  $mr->setRequired(isset($settings["require_matriculation"]) &&
1607  $settings["require_matriculation"]);
1608  $this->form_gui->addItem($mr);
1609  }
1610 
1611  // delicious
1612  if($this->isSettingChangeable('delicious'))
1613  {
1614  $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious");
1615  $mr->setSize(40);
1616  $mr->setMaxLength(40);
1617  $mr->setRequired(isset($settings["require_delicious"]) &&
1618  $settings["require_delicious"]);
1619  $this->form_gui->addItem($mr);
1620  }
1621 
1622  // client IP
1623  $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip");
1624  $ip->setSize(40);
1625  $ip->setMaxLength(255);
1626  $ip->setInfo($this->lng->txt("current_ip")." ".$_SERVER["REMOTE_ADDR"]." <br />".
1627  '<span class="warning">'.$this->lng->txt("current_ip_alert")."</span>");
1628  $this->form_gui->addItem($ip);
1629 
1630  // additional user defined fields
1631  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1632  $user_defined_fields = ilUserDefinedFields::_getInstance();
1633 
1634  if($this->usrf_ref_id == USER_FOLDER_ID)
1635  {
1636  $all_defs = $user_defined_fields->getDefinitions();
1637  }
1638  else
1639  {
1640  $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions();
1641  }
1642 
1643  foreach($all_defs as $field_id => $definition)
1644  {
1645  if($definition['field_type'] == UDF_TYPE_TEXT) // text input
1646  {
1647  $udf = new ilTextInputGUI($definition['field_name'],
1648  "udf_".$definition['field_id']);
1649  $udf->setSize(40);
1650  $udf->setMaxLength(255);
1651  }
1652  else if($definition['field_type'] == UDF_TYPE_WYSIWYG) // text area input
1653  {
1654  $udf = new ilTextAreaInputGUI($definition['field_name'],
1655  "udf_".$definition['field_id']);
1656  $udf->setUseRte(true);
1657  }
1658  else // selection input
1659  {
1660  $udf = new ilSelectInputGUI($definition['field_name'],
1661  "udf_".$definition['field_id']);
1662  $udf->setOptions($user_defined_fields->fieldValuesToSelectArray(
1663  $definition['field_values']));
1664  }
1665  $udf->setRequired($definition['required']);
1666  $this->form_gui->addItem($udf);
1667  }
1668 
1669  // settings
1670  if(
1671  $a_mode == 'create' or
1672  $this->isSettingChangeable( 'language') or
1673  $this->isSettingChangeable( 'skin_style') or
1674  $this->isSettingChangeable( 'hits_per_page') or
1675  $this->isSettingChangeable( 'hide_own_online_status')
1676  )
1677  {
1678  $sec_st = new ilFormSectionHeaderGUI();
1679  $sec_st->setTitle($this->lng->txt("settings"));
1680  $this->form_gui->addItem($sec_st);
1681  }
1682 
1683  // role
1684  if ($a_mode == "create")
1685  {
1686  $role = new ilSelectInputGUI($lng->txt("default_role"),
1687  'default_role');
1688  $role->setRequired(true);
1689  $role->setValue($this->default_role);
1690  $role->setOptions($this->selectable_roles);
1691  $this->form_gui->addItem($role);
1692  }
1693 
1694  // language
1695  if($this->isSettingChangeable('language'))
1696  {
1697  $lang = new ilSelectInputGUI($lng->txt("language"),
1698  'language');
1699  $languages = $lng->getInstalledLanguages();
1700  $lng->loadLanguageModule("meta");
1701  $options = array();
1702  foreach($languages as $l)
1703  {
1704  $options[$l] = $lng->txt("meta_l_".$l);
1705  }
1706  $lang->setOptions($options);
1707  $lang->setValue($ilSetting->get("language"));
1708  $this->form_gui->addItem($lang);
1709  }
1710 
1711  // skin/style
1712  if($this->isSettingChangeable('skin_style'))
1713  {
1714  $sk = new ilSelectInputGUI($lng->txt("skin_style"),
1715  'skin_style');
1716  $templates = $styleDefinition->getAllTemplates();
1717 
1718  include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
1719 
1720  $options = array();
1721  if (count($templates) > 0 && is_array ($templates))
1722  {
1723  foreach ($templates as $template)
1724  {
1725  $styleDef =& new ilStyleDefinition($template["id"]);
1726  $styleDef->startParsing();
1727  $styles = $styleDef->getStyles();
1728  foreach ($styles as $style)
1729  {
1730  if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
1731  {
1732  continue;
1733  }
1734  $options[$template["id"].":".$style["id"]] =
1735  $styleDef->getTemplateName()." / ".$style["name"];
1736  }
1737  }
1738  }
1739  $sk->setOptions($options);
1740  $sk->setValue($ilClientIniFile->readVariable("layout","skin").
1741  ":".$ilClientIniFile->readVariable("layout","style"));
1742 
1743  $this->form_gui->addItem($sk);
1744  }
1745 
1746  // hits per page
1747  if($this->isSettingChangeable('hits_per_page'))
1748  {
1749  $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"),
1750  'hits_per_page');
1751  $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40,
1752  50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit"));
1753  $hpp->setOptions($options);
1754  $hpp->setValue($ilSetting->get("hits_per_page"));
1755  $this->form_gui->addItem($hpp);
1756 
1757  // users online
1758  $uo = new ilSelectInputGUI($lng->txt("users_online"),
1759  'show_users_online');
1760  $options = array(
1761  "y" => $lng->txt("users_online_show_y"),
1762  "associated" => $lng->txt("users_online_show_associated"),
1763  "n" => $lng->txt("users_online_show_n"));
1764  $uo->setOptions($options);
1765  $uo->setValue($ilSetting->get("show_users_online"));
1766  $this->form_gui->addItem($uo);
1767  }
1768 
1769  // hide online status
1770  if($this->isSettingChangeable('hide_own_online_status'))
1771  {
1772  $os = new ilCheckboxInputGUI($lng->txt("hide_own_online_status"), "hide_own_online_status");
1773  $this->form_gui->addItem($os);
1774  }
1775 
1776  if((int)$ilSetting->get('session_reminder_enabled'))
1777  {
1778  $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
1779  $cb->setValue(1);
1780  $this->form_gui->addItem($cb);
1781  }
1782 
1783  // Options
1784  if($this->isSettingChangeable('send_mail'))
1785  {
1786  $sec_op = new ilFormSectionHeaderGUI();
1787  $sec_op->setTitle($this->lng->txt("options"));
1788  $this->form_gui->addItem($sec_op);
1789  }
1790 
1791  // send email
1792  $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail');
1793  $se->setInfo($lng->txt('inform_user_mail_info'));
1794  $se->setValue('y');
1795  $se->setChecked(($ilUser->getPref('send_info_mails') == 'y'));
1796  $this->form_gui->addItem($se);
1797 
1798  // ignore required fields
1799  $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf');
1800  $irf->setInfo($lng->txt('ignore_required_fields_info'));
1801  $irf->setValue(1);
1802  $this->form_gui->addItem($irf);
1803 
1804  // @todo: handle all required fields
1805 
1806  // command buttons
1807  if ($a_mode == "create" || $a_mode == "save")
1808  {
1809  $this->form_gui->addCommandButton("save", $lng->txt("save"));
1810  }
1811  if ($a_mode == "edit" || $a_mode == "update")
1812  {
1813  $this->form_gui->addCommandButton("update", $lng->txt("save"));
1814  }
1815  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
1816  }
Class for user related exception handling in ILIAS.
This class represents an option in a radio group.
const IL_CAL_DATETIME
static _getInstance()
Get instance.
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.
_lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
This class represents a section header in a property form.
static _lookupPersonalWorkspaceDiskQuota($a_user_id)
This class represents a user login property in a property form.
static _getLastHistoryDataByUserId($a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
This class represents a checkbox property in a property form.
This class represents a email property in a property form.
const IL_CAL_UNIX
static _getAuthModeName($a_auth_key)
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
This class represents a date/time property in a property form.
setInfo($a_info)
Set Information Text.
setChecked($a_checked)
Set Checked.
isSettingChangeable($a_field)
Check if setting is visible This is the case when called from user folder.
This class represents a property in a property form.
if(!is_array($argv)) $options
setImage($a_image)
Set Image.
static _lookupDiskQuota($a_user_id)
Gets the disk quota info for the specified user account.
setValue($a_value)
Set Value.
setSize($a_size)
Set Size.
const UDF_TYPE_TEXT
This class represents a text property in a property form.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
This class represents a password property in a property form.
static _isExternalAccountEnabled()
Check if an external account name is required.
setOptions($a_options)
Set Options.
const UDF_TYPE_WYSIWYG
static getFilesizeByOwner($a_owner_id)
Get current storage size for owner.
This class represents an image file property in a property form.
static _lookupDiskUsage($a_user_id)
Gets the disk usage info for the specified user account.
This class represents a non editable value in a property form.
setMulti($a_multi, $a_sortable=false, $a_addremove=true)
Set Multi.
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
This class represents a text area property in a property form.
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
parses the template.xml that defines all styles of the current template
const USER_FOLDER_ID
Class ilObjUserFolder.
This class represents a text property in a property form.
setRequired($a_required)
Set Required.
setShowTime($a_showtime)
Set Show Time Information.
static getFilesizeByTypeAndOwner($a_owner_id)
Get current storage size for owner (grouped by type)
+ 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 1826 of file class.ilObjUserGUI.php.

References $ilSetting, and USER_FOLDER_ID.

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

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

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

Referenced by saveObject(), and updateObject().

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

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

1942  {
1943  $webspace_dir = ilUtil::getWebspaceDir();
1944  $image_dir = $webspace_dir."/usr_images";
1945  $file = $image_dir."/usr_".$this->object->getID()."."."jpg";
1946  $thumb_file = $image_dir."/usr_".$this->object->getID()."_small.jpg";
1947  $xthumb_file = $image_dir."/usr_".$this->object->getID()."_xsmall.jpg";
1948  $xxthumb_file = $image_dir."/usr_".$this->object->getID()."_xxsmall.jpg";
1949  $upload_file = $image_dir."/upload_".$this->object->getID();
1950 
1951  // remove user pref file name
1952  $this->object->setPref("profile_image", "");
1953  $this->object->update();
1954  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1955 
1956  if (@is_file($file))
1957  {
1958  unlink($file);
1959  }
1960  if (@is_file($thumb_file))
1961  {
1962  unlink($thumb_file);
1963  }
1964  if (@is_file($xthumb_file))
1965  {
1966  unlink($xthumb_file);
1967  }
1968  if (@is_file($xxthumb_file))
1969  {
1970  unlink($xxthumb_file);
1971  }
1972  if (@is_file($upload_file))
1973  {
1974  unlink($upload_file);
1975  }
1976 
1977  $this->editObject();
1978  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
editObject()
Display user edit form.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ resetFilterObject()

ilObjUserGUI::resetFilterObject ( )

Reset filter.

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

References roleassignmentObject().

2724  {
2725  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2726  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2727  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2728  $table_gui->resetFilter(); // clears filter
2729  $this->roleassignmentObject();
2730  }
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 2541 of file class.ilObjUserGUI.php.

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

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

2542  {
2543  global $rbacreview,$rbacsystem,$ilUser, $ilTabs;
2544 
2545  $ilTabs->activateTab("role_assignment");
2546 
2547  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
2548  {
2549  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
2550  }
2551 
2552  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
2553 
2554  if ($_SESSION['filtered_roles'] > 5)
2555  {
2556  $_SESSION['filtered_roles'] = 0;
2557  }
2558 
2559  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.usr_role_assignment.html','Services/User');
2560 
2561  if(false)
2562  {
2563  $this->tpl->setCurrentBlock("filter");
2564  $this->tpl->setVariable("FILTER_TXT_FILTER",$this->lng->txt('filter'));
2565  $this->tpl->setVariable("SELECT_FILTER",$this->__buildFilterSelect());
2566  $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getFormAction($this));
2567  $this->tpl->setVariable("FILTER_NAME",'roleassignment');
2568  $this->tpl->setVariable("FILTER_VALUE",$this->lng->txt('apply_filter'));
2569  $this->tpl->parseCurrentBlock();
2570  }
2571 
2572  // init table
2573  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2574  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
2575 
2576  // now get roles depending on filter settings
2577  $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"],$this->object->getId());
2578  $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
2579 
2580  $counter = 0;
2581 
2582  include_once ('./Services/AccessControl/classes/class.ilObjRole.php');
2583 
2584  $records = array();
2585  foreach ($role_list as $role)
2586  {
2587  // fetch context path of role
2588  $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
2589 
2590  // only list roles that are not set to status "deleted"
2591  if ($rbacreview->isDeleted($rolf[0]))
2592  {
2593  continue;
2594  }
2595 
2596  // build context path
2597  $path = "";
2598 
2599  if ($this->tree->isInTree($rolf[0]))
2600  {
2601  if ($rolf[0] == ROLE_FOLDER_ID)
2602  {
2603  $path = $this->lng->txt("global");
2604  }
2605  else
2606  {
2607  $tmpPath = $this->tree->getPathFull($rolf[0]);
2608 
2609  // count -1, to exclude the role folder itself
2610  /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
2611  {
2612  if ($path != "")
2613  {
2614  $path .= " > ";
2615  }
2616 
2617  $path .= $tmpPath[$i]["title"];
2618  }*/
2619 
2620  $path = $tmpPath[count($tmpPath)-1]["title"];
2621  }
2622  }
2623  else
2624  {
2625  $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$role["obj_id"].")</b>";
2626  }
2627 
2628  $disabled = false;
2629 
2630  // disable checkbox for system role for the system user
2631  if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
2632  or (!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID))
2633  {
2634  $disabled = true;
2635  }
2636 
2637  // protected admin role
2638  if($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID))
2639  {
2640  include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
2641  if(ilSecuritySettings::_getInstance()->isAdminRoleProtected())
2642  {
2643  $disabled = true;
2644  }
2645  }
2646 
2647  if (substr($role["title"],0,3) == "il_")
2648  {
2649  if (!$assignable)
2650  {
2651  $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
2652  $rolf2 = $rolf_arr[0];
2653  }
2654  else
2655  {
2656  $rolf2 = $rolf;
2657  }
2658 
2659  $parent_node = $this->tree->getNodeData($rolf2);
2660 
2661  $role["description"] = $this->lng->txt("obj_".$parent_node["type"])."&nbsp;(#".$parent_node["obj_id"].")";
2662  }
2663 
2664  $role_ids[$counter] = $role["obj_id"];
2665 
2666  $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"]."\"/>";
2667  $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
2668  $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
2669  $result_set[$counter][] = $link = "<a href=\"".$this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm")."\">".ilObjRole::_getTranslation($role["title"])."</a>";
2670  $title = ilObjRole::_getTranslation($role["title"]);
2671  $result_set[$counter][] = $role["description"];
2672 
2673  // Add link to objector local Rores
2674  if ($role["role_type"] == "local") {
2675  // Get Object to the role
2676  $obj_id = ilRbacReview::getObjectOfRole($role["rol_id"]);
2677 
2678  $obj_type = ilObject::_lookupType($obj_id);
2679 
2681 
2682  foreach ($ref_ids as $ref_id) {}
2683 
2684  require_once("./Services/Link/classes/class.ilLink.php");
2685 
2686  $result_set[$counter][] = $context = "<a href='".ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id))."' target='_top'>".$path."</a>";
2687  }
2688  else
2689  {
2690  $result_set[$counter][] = $path;
2691  $context = $path;
2692  }
2693 
2694  $records[] = array("path" => $path, "description" => $role["description"],
2695  "context" => $context, "checkbox" => $checkbox,
2696  "role" => $link, "title" => $title);
2697  ++$counter;
2698  }
2699 
2700  if (true)
2701  {
2702  $tab->setData($records);
2703  $this->tpl->setVariable("ROLES_TABLE",$tab->getHTML());
2704  return;
2705  }
2706  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
_getTranslation($a_role_title)
$records
Definition: simple_test.php:17
static _getAllReferences($a_id)
get all reference ids of object
redirection script todo: (a better solution should control the processing via a xml file) ...
getObjectOfRole($a_role_id)
Get object id of objects a role is assigned to.
static _lookupType($a_id, $a_reference=false)
lookup object type
TableGUI class for role assignment in user administration.
global $ilUser
Definition: imgupload.php:15
$path
Definition: index.php:22
static _getInstance()
Get instance of ilSecuritySettings.
+ 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 363 of file class.ilObjUserGUI.php.

References $_GET, $_POST, $ilSetting, $ilUser, ilObjectGUI\$tpl, ilFormat\_getSizeMagnitude(), ilDiskQuotaActivationChecker\_isActive(), ilAuthUtils\_isExternalAccountEnabled(), handleIgnoredRequiredFields(), IL_PASSWD_PLAIN, initCreate(), initForm(), ilUserProfile\isProfileIncomplete(), isSettingChangeable(), loadValuesFromForm(), ilUtil\sendFailure(), ilUtil\sendInfo(), ilUtil\sendSuccess(), and uploadUserPictureObject().

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

◆ setBackTarget()

ilObjUserGUI::setBackTarget (   $a_text,
  $a_link 
)

set back tab target

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

200  {
201  $this->back_target = array("text" => $a_text,
202  "link" => $a_link);
203  }

◆ setTitleAndDescription()

ilObjUserGUI::setTitleAndDescription ( )

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

References ilUtil\getImagePath().

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

◆ showUpperIcon()

ilObjUserGUI::showUpperIcon ( )

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

2862  {
2863  }

◆ updateObject()

ilObjUserGUI::updateObject ( )

Update user.

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

References $_GET, $_POST, ilObjectGUI\$ilias, $ilSetting, $ilUser, ilObjectGUI\$tpl, __sendProfileMail(), ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilFormat\_getSizeMagnitude(), ilDiskQuotaActivationChecker\_isActive(), ilDiskQuotaActivationChecker\_isPersonalWorkspaceActive(), ilObjUser\_resetLoginAttempts(), handleIgnoredRequiredFields(), IL_PASSWD_PLAIN, initForm(), ilUserProfile\isProfileIncomplete(), isSettingChangeable(), loadValuesFromForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), uploadUserPictureObject(), and USER_FOLDER_ID.

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

◆ updateObjectOld()

ilObjUserGUI::updateObjectOld ( )

save user data public

Does input checks and updates a user account if everything is fine. public

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

References $_GET, $_POST, $_SESSION, ilObjectGUI\$ilias, $ilUser, ilObjectGUI\$tpl, __checkUserDefinedRequiredFields(), __sendProfileMail(), __toUnix(), ilAuthUtils\_allowPasswordModificationByAuthMode(), ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_getAuthMode(), ilObjUser\_loginExists(), ilAuthUtils\_needsExternalAccountByAuthMode(), editObject(), IL_PASSWD_PLAIN, ilUtil\is_email(), ilUtil\isLogin(), ilUtil\isPassword(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilUtil\stripSlashes(), and USER_FOLDER_ID.

2217  {
2218  global $ilias, $rbacsystem, $rbacadmin,$ilUser;
2219 
2220  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
2221 
2222  //load ILIAS settings
2223  $settings = $ilias->getAllSettings();
2224 
2225  // User folder
2226  if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write',$this->usrf_ref_id))
2227  {
2228  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
2229  }
2230  // if called from local administration $this->usrf_ref_id is category id
2231  // Todo: this has to be fixed. Do not mix user folder id and category id
2232  if($this->usrf_ref_id != USER_FOLDER_ID)
2233  {
2234  // check if user is assigned to category
2235  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
2236  {
2237  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
2238  }
2239  }
2240 
2241  foreach ($_POST["Fobject"] as $key => $val)
2242  {
2243  $_POST["Fobject"][$key] = ilUtil::stripSlashes($val);
2244  }
2245 
2246  // check dynamically required fields
2247  foreach ($settings as $key => $val)
2248  {
2249  $field = substr($key,8);
2250  switch($field)
2251  {
2252  case 'passwd':
2253  case 'passwd2':
2255  {
2256  $require_keys[] = $field;
2257  }
2258  break;
2259  default:
2260  $require_keys[] = $field;
2261  break;
2262 
2263  }
2264  }
2265 
2266  foreach ($require_keys as $key => $val)
2267  {
2268  // exclude required system and registration-only fields
2269  $system_fields = array("default_role");
2270  if (!in_array($val, $system_fields))
2271  {
2272  if (isset($settings["require_" . $val]) && $settings["require_" . $val])
2273  {
2274  if (empty($_POST["Fobject"][$val]))
2275  {
2276  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
2277  $this->lng->txt($val),$this->ilias->error_obj->MESSAGE);
2278  }
2279  }
2280  }
2281  }
2282 
2283  if(!$this->__checkUserDefinedRequiredFields())
2284  {
2285  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
2286  }
2287  // validate login
2288  if ($this->object->getLogin() != $_POST["Fobject"]["login"] &&
2289  !ilUtil::isLogin($_POST["Fobject"]["login"]))
2290  {
2291  $this->ilias->raiseError($this->lng->txt("login_invalid"),$this->ilias->error_obj->MESSAGE);
2292  }
2293 
2294  // check loginname
2295  if (ilObjUser::_loginExists($_POST["Fobject"]["login"],$this->id))
2296  {
2297  $this->ilias->raiseError($this->lng->txt("login_exists"),$this->ilias->error_obj->MESSAGE);
2298  }
2299 
2301  {
2302  if($_POST['Fobject']['passwd'] == "********" and
2303  !strlen($this->object->getPasswd()))
2304  {
2305  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
2306  $this->lng->txt('password'),$this->ilias->error_obj->MESSAGE);
2307  }
2308  // check passwords
2309  if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"])
2310  {
2311  $this->ilias->raiseError($this->lng->txt("passwd_not_match"),$this->ilias->error_obj->MESSAGE);
2312  }
2313 
2314  // validate password
2315  if (!ilUtil::isPassword($_POST["Fobject"]["passwd"]))
2316  {
2317  $this->ilias->raiseError($this->lng->txt("passwd_invalid"),$this->ilias->error_obj->MESSAGE);
2318  }
2319  }
2320  else
2321  {
2322  // Password will not be changed...
2323  $_POST['Fobject']['passwd'] = "********";
2324  }
2326  {
2327  if(!strlen($_POST['Fobject']['ext_account']))
2328  {
2329  $this->ilias->raiseError($this->lng->txt('ext_acccount_required'),$this->ilias->error_obj->MESSAGE);
2330  }
2331  }
2332  if($_POST['Fobject']['ext_account'] &&
2333  ($elogin = ilObjUser::_checkExternalAuthAccount($_POST['Fobject']['auth_mode'],$_POST['Fobject']['ext_account'])))
2334  {
2335  if($elogin != $this->object->getLogin())
2336  {
2337  $this->ilias->raiseError(
2338  sprintf($this->lng->txt("err_auth_ext_user_exists"),
2339  $_POST["Fobject"]["ext_account"],
2340  $_POST['Fobject']['auth_mode'],
2341  $elogin),
2342  $this->ilias->error_obj->MESSAGE);
2343  }
2344  }
2345 
2346  // The password type is not passed with the post data. Therefore we
2347  // append it here manually.
2348  include_once ('./Services/User/classes/class.ilObjUser.php');
2349  $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
2350 
2351  // validate email
2352  if (strlen($_POST['Fobject']['email']) and !ilUtil::is_email($_POST["Fobject"]["email"]))
2353  {
2354  $this->ilias->raiseError($this->lng->txt("email_not_valid"),$this->ilias->error_obj->MESSAGE);
2355  }
2356 
2357  $start = $this->__toUnix($_POST["time_limit"]["from"]);
2358  $end = $this->__toUnix($_POST["time_limit"]["until"]);
2359 
2360  // validate time limit
2361  if (!$_POST["time_limit"]["unlimited"] and
2362  ( $start > $end))
2363  {
2364  $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"),$this->ilias->error_obj->MESSAGE);
2365  }
2366 
2367  if(!$this->ilias->account->getTimeLimitUnlimited())
2368  {
2369  if($start < $this->ilias->account->getTimeLimitFrom() or
2370  $end > $this->ilias->account->getTimeLimitUntil() or
2371  $_POST['time_limit']['unlimited'])
2372  {
2373  $_SESSION['error_post_vars'] = $_POST;
2374 
2375  ilUtil::sendFailure($this->lng->txt('time_limit_not_within_owners'));
2376  $this->editObject();
2377 
2378  return false;
2379  }
2380  }
2381 
2382  // TODO: check length of login and passwd
2383 
2384  // checks passed. save user
2385  $_POST['Fobject']['time_limit_owner'] = $this->object->getTimeLimitOwner();
2386 
2387  $_POST['Fobject']['time_limit_unlimited'] = (int) $_POST['time_limit']['unlimited'];
2388  $_POST['Fobject']['time_limit_from'] = $this->__toUnix($_POST['time_limit']['from']);
2389  $_POST['Fobject']['time_limit_until'] = $this->__toUnix($_POST['time_limit']['until']);
2390 
2391  if($_POST['Fobject']['time_limit_unlimited'] != $this->object->getTimeLimitUnlimited() or
2392  $_POST['Fobject']['time_limit_from'] != $this->object->getTimeLimitFrom() or
2393  $_POST['Fobject']['time_limit_until'] != $this->object->getTimeLimitUntil())
2394  {
2395  $_POST['Fobject']['time_limit_message'] = 0;
2396  }
2397  else
2398  {
2399  $_POST['Fobject']['time_limit_message'] = $this->object->getTimeLimitMessage();
2400  }
2401 
2402  $this->object->assignData($_POST["Fobject"]);
2403  $this->object->setUserDefinedData($_POST['udf']);
2404 
2405  try
2406  {
2407  $this->object->updateLogin($_POST['Fobject']['login']);
2408  }
2409  catch (ilUserException $e)
2410  {
2411  ilUtil::sendFailure($e->getMessage());
2412  $this->form_gui->setValuesByPost();
2413  return $tpl->setContent($this->form_gui->getHtml());
2414  }
2415 
2416  $this->object->setTitle($this->object->getFullname());
2417  $this->object->setDescription($this->object->getEmail());
2418  $this->object->setLanguage($_POST["Fobject"]["language"]);
2419 
2420  //set user skin and style
2421  $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
2422 
2423  if ($this->object->getPref("style") != $sknst[1] ||
2424  $this->object->getPref("skin") != $sknst[0])
2425  {
2426  $this->object->setPref("skin", $sknst[0]);
2427  $this->object->setPref("style", $sknst[1]);
2428  }
2429 
2430  // set hits per pages
2431  $this->object->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
2432  // set show users online
2433  $this->object->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
2434  // set hide_own_online_status
2435  if ($_POST["Fobject"]["hide_own_online_status"]) {
2436  $this->object->setPref("hide_own_online_status", $_POST["Fobject"]["hide_own_online_status"]);
2437  }
2438  else {
2439  $this->object->setPref("hide_own_online_status", "n");
2440  }
2441 
2442  $this->update = $this->object->update();
2443  //$rbacadmin->updateDefaultRole($_POST["Fobject"]["default_role"], $this->object->getId());
2444 
2445  // BEGIN DiskQuota: Remember the state of the "send info mail" checkbox
2446  global $ilUser;
2447  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
2448  $ilUser->writePrefs();
2449  // END DiskQuota: Remember the state of the "send info mail" checkbox
2450 
2451  $mail_message = $this->__sendProfileMail();
2452  $msg = $this->lng->txt('saved_successfully').$mail_message;
2453 
2454  // feedback
2455  ilUtil::sendSuccess($msg,true);
2456 
2457  if (strtolower($_GET["baseClass"]) == 'iladministrationgui')
2458  {
2459  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
2460  }
2461  else
2462  {
2463  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
2464  }
2465  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class for user related exception handling in ILIAS.
const IL_PASSWD_PLAIN
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
static _needsExternalAccountByAuthMode($a_auth_mode)
Check if chosen auth mode needs an external account entry.
static isPassword($a_passwd, &$customError=null)
validates a password public
__toUnix($a_time_arr)
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
__checkUserDefinedRequiredFields()
display user create form
redirection script todo: (a better solution should control the processing via a xml file) ...
editObject()
Display user edit form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
_getAuthMode($a_auth_mode, $a_db_handler='')
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
isLogin($a_login)
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
const USER_FOLDER_ID
Class ilObjUserFolder.
+ Here is the call graph for this function:

◆ uploadUserPictureObject()

ilObjUserGUI::uploadUserPictureObject ( )

upload user image

(original method by ratana ty)

Definition at line 1854 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().

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

◆ $ilCtrl

ilObjUserGUI::$ilCtrl

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

Referenced by _goto(), editObject(), ilObjUserGUI(), and initForm().

◆ $type

ilObjUserGUI::$type

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

◆ $user_ref_id

ilObjUserGUI::$user_ref_id

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


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