ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjUserGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObjectGUI.php";
5 include_once('./Services/Calendar/classes/class.ilDatePresentation.php');
6 
19 {
20  var $ilCtrl;
21 
27  var $gender;
28 
34  var $type;
35 
42 
47  function ilObjUserGUI($a_data,$a_id,$a_call_by_reference = false, $a_prepare_output = true)
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  }
70 
71  function &executeCommand()
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  }
106 
107  /* Overwritten from base class
108  */
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  }
122 
123 
124 
125  function cancelObject()
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  }
140 
144  function getAdminTabs(&$tabs_gui)
145  {
146  $this->getTabs($tabs_gui);
147  }
148 
152  function getTabs(&$tabs_gui)
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
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  }
195 
199  function setBackTarget($a_text, $a_link)
200  {
201  $this->back_target = array("text" => $a_text,
202  "link" => $a_link);
203  }
204 
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  }
223 
224 
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  }
272 
273  function initCreate()
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  }
340 
344  function createObject()
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  }
358 
363  function saveObject()
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($this->isSettingChangeable('bs_allow_to_contact_me'))
469  {
470  $userObj->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
471  }
472  if((int)$ilSetting->get('session_reminder_enabled'))
473  {
474  $userObj->setPref('session_reminder_enabled', (int)$_POST['session_reminder_enabled']);
475  }
476  $userObj->writePrefs();
477 
478  //set role entries
479  $rbacadmin->assignUser($_POST["default_role"],$userObj->getId(),true);
480 
481  $msg = $this->lng->txt("user_added");
482 
483  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
484  $ilUser->writePrefs();
485 
486  $this->object = $userObj;
487 
488  if($this->isSettingChangeable('upload'))
489  {
490  $this->uploadUserPictureObject();
491  }
492 
493  if( $profileMaybeIncomplete )
494  {
495  include_once 'Services/User/classes/class.ilUserProfile.php';
496  if( ilUserProfile::isProfileIncomplete($this->object) )
497  {
498  $this->object->setProfileIncomplete( true );
499  $this->object->update();
500  }
501  }
502 
503  // send new account mail
504  if($_POST['send_mail'] == 'y')
505  {
506  include_once('Services/Mail/classes/class.ilAccountMail.php');
507  $acc_mail = new ilAccountMail();
508  $acc_mail->useLangVariablesAsFallback(true);
509  $acc_mail->setUserPassword($_POST['passwd']);
510  $acc_mail->setUser($userObj);
511 
512  if ($acc_mail->send())
513  {
514  $msg = $msg.'<br />'.$this->lng->txt('mail_sent');
515  ilUtil::sendSuccess($msg, true);
516  }
517  else
518  {
519  $msg = $msg.'<br />'.$this->lng->txt('mail_not_sent');
520  ilUtil::sendInfo($msg, true);
521  }
522  }
523  else
524  {
525  ilUtil::sendSuccess($msg, true);
526  }
527 
528 
529  if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
530  {
531  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
532  }
533  else
534  {
535  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
536  }
537  }
538  else
539  {
540  $this->form_gui->setValuesByPost();
541  $tpl->setContent($this->form_gui->getHtml());
542  }
543  }
544 
550  function editObject()
551  {
552  global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser
554 
555  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
556 
557  //load ILIAS settings
558  $settings = $ilias->getAllSettings();
559 
560  // User folder
561  if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
562  {
563  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
564  }
565  // if called from local administration $this->usrf_ref_id is category id
566  // Todo: this has to be fixed. Do not mix user folder id and category id
567  if($this->usrf_ref_id != USER_FOLDER_ID)
568  {
569  // check if user is assigned to category
570  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
571  {
572  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
573  }
574  }
575 
576  if($this->usrf_ref_id != USER_FOLDER_ID)
577  {
578  $this->tabs_gui->clearTargets();
579  }
580 
581  // get form
582  $this->initForm("edit");
583  $this->getValues();
584  $this->showAcceptedTermsOfService();
585  $this->tpl->setContent($this->form_gui->getHTML());
586  }
587 
592  protected function loadValuesFromForm($a_mode = 'create')
593  {
594  global $ilSetting,$ilUser;
595 
596  switch($a_mode)
597  {
598  case 'create':
599  $user = new ilObjUser();
600  break;
601 
602  case 'update':
603  $user = $this->object;
604  break;
605  }
606 
607  $from = new ilDateTime($_POST['time_limit_from']['date'].' '.$_POST['time_limit_from']['time'],IL_CAL_DATETIME);
608  $user->setTimeLimitFrom($from->get(IL_CAL_UNIX));
609 
610  $until = new ilDateTime($_POST['time_limit_until']['date'].' '.$_POST['time_limit_until']['time'],IL_CAL_DATETIME);
611  $user->setTimeLimitUntil($until->get(IL_CAL_UNIX));
612 
613  $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited'));
614 
615  if($a_mode == 'create')
616  {
617  $user->setTimeLimitOwner($this->usrf_ref_id);
618  }
619 
620  // Birthday
621  if($this->isSettingChangeable('birthday'))
622  {
623  $bd = $this->form_gui->getInput('birthday');
624  if($bd['date'])
625  {
626  $user->setBirthday($bd['date']);
627  }
628  else
629  {
630  $user->setBirthday(null);
631  }
632  }
633 
634  // Login
635  $user->setLogin($this->form_gui->getInput('login'));
636 
637 
638  // Gender
639  if($this->isSettingChangeable('gender'))
640  {
641  $user->setGender($this->form_gui->getInput('gender'));
642  }
643 
644  // Title
645  if($this->isSettingChangeable('title'))
646  {
647  $user->setUTitle($this->form_gui->getInput('title'));
648  }
649 
650  // Firstname
651  if($this->isSettingChangeable('firstname'))
652  {
653  $user->setFirstname($this->form_gui->getInput('firstname'));
654  }
655  // Lastname
656  if($this->isSettingChangeable('lastname'))
657  {
658  $user->setLastname($this->form_gui->getInput('lastname'));
659  }
660  $user->setFullname();
661 
662  // Institution
663  if($this->isSettingChangeable('institution'))
664  {
665  $user->setInstitution($this->form_gui->getInput('institution'));
666  }
667 
668  // Department
669  if($this->isSettingChangeable('department'))
670  {
671  $user->setDepartment($this->form_gui->getInput('department'));
672  }
673  // Street
674  if($this->isSettingChangeable('street'))
675  {
676  $user->setStreet($this->form_gui->getInput('street'));
677  }
678  // City
679  if($this->isSettingChangeable('city'))
680  {
681  $user->setCity($this->form_gui->getInput('city'));
682  }
683  // Zipcode
684  if($this->isSettingChangeable('zipcode'))
685  {
686  $user->setZipcode($this->form_gui->getInput('zipcode'));
687  }
688  // Country
689  if($this->isSettingChangeable('country'))
690  {
691  $user->setCountry($this->form_gui->getInput('country'));
692  }
693  // Selected Country
694  if($this->isSettingChangeable('sel_country'))
695  {
696  $user->setSelectedCountry($this->form_gui->getInput('sel_country'));
697  }
698  // Phone Office
699  if($this->isSettingChangeable('phone_office'))
700  {
701  $user->setPhoneOffice($this->form_gui->getInput('phone_office'));
702  }
703  // Phone Home
704  if($this->isSettingChangeable('phone_home'))
705  {
706  $user->setPhoneHome($this->form_gui->getInput('phone_home'));
707  }
708  // Phone Mobile
709  if($this->isSettingChangeable('phone_mobile'))
710  {
711  $user->setPhoneMobile($this->form_gui->getInput('phone_mobile'));
712  }
713  // Fax
714  if($this->isSettingChangeable('fax'))
715  {
716  $user->setFax($this->form_gui->getInput('fax'));
717  }
718  // Matriculation
719  if($this->isSettingChangeable('matriculation'))
720  {
721  $user->setMatriculation($this->form_gui->getInput('matriculation'));
722  }
723  // Email
724  if($this->isSettingChangeable('email'))
725  {
726  $user->setEmail($this->form_gui->getInput('email'));
727  }
728  // Hobby
729  if($this->isSettingChangeable('hobby'))
730  {
731  $user->setHobby($this->form_gui->getInput('hobby'));
732  }
733  // Referral Comment
734  if($this->isSettingChangeable('referral_comment'))
735  {
736  $user->setComment($this->form_gui->getInput('referral_comment'));
737  }
738 
739  // interests
740  $user->setGeneralInterests($this->form_gui->getInput('interests_general'));
741  $user->setOfferingHelp($this->form_gui->getInput('interests_help_offered'));
742  $user->setLookingForHelp($this->form_gui->getInput('interests_help_looking'));
743 
744  // ClientIP
745  $user->setClientIP($this->form_gui->getInput('client_ip'));
746 
747  if($this->isSettingChangeable('instant_messengers'))
748  {
749  $user->setInstantMessengerId('icq', $this->form_gui->getInput('im_icq'));
750  $user->setInstantMessengerId('yahoo', $this->form_gui->getInput('im_yahoo'));
751  $user->setInstantMessengerId('msn', $this->form_gui->getInput('im_msn'));
752  $user->setInstantMessengerId('aim', $this->form_gui->getInput('im_aim'));
753  $user->setInstantMessengerId('skype', $this->form_gui->getInput('im_skype'));
754  $user->setInstantMessengerId('jabber', $this->form_gui->getInput('im_jabber'));
755  $user->setInstantMessengerId('voip', $this->form_gui->getInput('im_voip'));
756  }
757  // Delicious
758  if($this->isSettingChangeable('delicious'))
759  {
760  $user->setDelicious($this->form_gui->getInput('delicious'));
761  }
762  // Google maps
763  $user->setLatitude($this->form_gui->getInput('latitude'));
764  $user->setLongitude($this->form_gui->getInput('longitude'));
765  $user->setLocationZoom($this->form_gui->getInput('loc_zoom'));
766 
767  // External account
768  $user->setAuthMode($this->form_gui->getInput('auth_mode'));
769  $user->setExternalAccount($this->form_gui->getInput('ext_account'));
770 
771  if((int) $user->getActive() != (int) $this->form_gui->getInput('active'))
772  {
773  $user->setActive($this->form_gui->getInput('active'), $ilUser->getId());
774  }
775 
776  return $user;
777  }
778 
779 
783  public function updateObject()
784  {
785  global $tpl, $rbacsystem, $ilias, $ilUser, $ilSetting;
786 
787  // User folder
788  if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write',$this->usrf_ref_id))
789  {
790  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
791  }
792  // if called from local administration $this->usrf_ref_id is category id
793  // Todo: this has to be fixed. Do not mix user folder id and category id
794  if($this->usrf_ref_id != USER_FOLDER_ID)
795  {
796  // check if user is assigned to category
797  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
798  {
799  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
800  }
801  }
802  $this->initForm("edit");
803 
804  // we do not want to store this dates, they are only printed out
805  unset($_POST['approve_date']);
806  $_POST['agree_date'] = $this->object->getAgreeDate();
807  unset($_POST['last_login']);
808 
809  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
810  $profileMaybeIncomplete = false;
811  if($this->form_gui->getInput('ignore_rf', false))
812  {
813  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
814  }
815 
816  if ($this->form_gui->checkInput())
817  {
818  // @todo: external account; time limit
819  // if not allowed or empty -> do no change password
821  && trim($_POST['passwd']) != "")
822  {
823  $this->object->setPasswd($_POST['passwd'], IL_PASSWD_PLAIN);
824  }
825 
826  /*
827  * reset counter for failed logins
828  * if $_POST['active'] is set to 1
829  */
830  if( $_POST['active'] == 1 )
831  {
832  ilObjUser::_resetLoginAttempts( $this->object->getId() );
833  }
834 
835  #$this->object->assignData($_POST);
836  $this->loadValuesFromForm('update');
837 
838  $udf = array();
839  foreach($_POST as $k => $v)
840  {
841  if (substr($k, 0, 4) == "udf_")
842  {
843  $udf[substr($k, 4)] = $v;
844  }
845  }
846  $this->object->setUserDefinedData($udf);
847 
848  try
849  {
850  $this->object->updateLogin($_POST['login']);
851  }
852  catch (ilUserException $e)
853  {
854  ilUtil::sendFailure($e->getMessage());
855  $this->form_gui->setValuesByPost();
856  return $tpl->setContent($this->form_gui->getHtml());
857  }
858 
859  $this->object->setTitle($this->object->getFullname());
860  $this->object->setDescription($this->object->getEmail());
861 
862  if($this->isSettingChangeable('language'))
863  {
864  $this->object->setLanguage($this->form_gui->getInput('language'));
865  }
866 
867  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
869  {
870  // set disk quota
871  $this->object->setPref("disk_quota", $_POST["disk_quota"] * ilFormat::_getSizeMagnitude() * ilFormat::_getSizeMagnitude());
872  }
874  {
875  // set personal workspace disk quota
876  $this->object->setPref("wsp_disk_quota", $_POST["wsp_disk_quota"] * ilFormat::_getSizeMagnitude() * ilFormat::_getSizeMagnitude());
877  }
878 
879  if($this->isSettingChangeable('skin_style'))
880  {
881  //set user skin and style
882  $sknst = explode(":", $_POST["skin_style"]);
883 
884  if ($this->object->getPref("style") != $sknst[1] ||
885  $this->object->getPref("skin") != $sknst[0])
886  {
887  $this->object->setPref("skin", $sknst[0]);
888  $this->object->setPref("style", $sknst[1]);
889  }
890  }
891  if($this->isSettingChangeable('hits_per_page'))
892  {
893  $this->object->setPref("hits_per_page", $_POST["hits_per_page"]);
894  }
895  /*if($this->isSettingChangeable('show_users_online'))
896  {
897  $this->object->setPref("show_users_online", $_POST["show_users_online"]);
898  }*/
899  if($this->isSettingChangeable('hide_own_online_status'))
900  {
901  $this->object->setPref("hide_own_online_status", $_POST["hide_own_online_status"] ? 'y' : 'n');
902  }
903  if($this->isSettingChangeable('bs_allow_to_contact_me'))
904  {
905  $this->object->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
906  }
907 
908  // set a timestamp for last_password_change
909  // this ts is needed by ilSecuritySettings
910  $this->object->setLastPasswordChangeTS( time() );
911 
912  global $ilSetting;
913  if((int)$ilSetting->get('session_reminder_enabled'))
914  {
915  $this->object->setPref('session_reminder_enabled', (int)$_POST['session_reminder_enabled']);
916  }
917 
918  // #10054 - profile may have been completed, check below is only for incomplete
919  $this->object->setProfileIncomplete( false );
920 
921  $this->update = $this->object->update();
922 
923 
924  // If the current user is editing its own user account,
925  // we update his preferences.
926  if ($ilUser->getId() == $this->object->getId())
927  {
928  $ilUser->readPrefs();
929  }
930  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
931  $ilUser->writePrefs();
932 
933  $mail_message = $this->__sendProfileMail();
934  $msg = $this->lng->txt('saved_successfully').$mail_message;
935 
936  // same personal image
937  if($this->isSettingChangeable('upload'))
938  {
939  $this->uploadUserPictureObject();
940  }
941 
942  if( $profileMaybeIncomplete )
943  {
944  include_once 'Services/User/classes/class.ilUserProfile.php';
945  if( ilUserProfile::isProfileIncomplete($this->object) )
946  {
947  $this->object->setProfileIncomplete( true );
948  $this->object->update();
949  }
950  }
951 
952  // feedback
953  ilUtil::sendSuccess($msg,true);
954 
955  if (strtolower($_GET["baseClass"]) == 'iladministrationgui')
956  {
957  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
958  }
959  else
960  {
961  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
962  }
963  }
964  else
965  {
966  $this->form_gui->setValuesByPost();
967  $tpl->setContent($this->form_gui->getHtml());
968  }
969  }
970 
974  function getValues()
975  {
976  global $ilUser, $ilSetting;
977 
978  $data = array();
979 
980  // login data
981  $data["auth_mode"] = $this->object->getAuthMode();
982  $data["login"] = $this->object->getLogin();
983  //$data["passwd"] = "********";
984  //$data["passwd2"] = "********";
985  $data["ext_account"] = $this->object->getExternalAccount();
986 
987  // system information
988  require_once './Services/Utilities/classes/class.ilFormat.php';
989  $data["create_date"] = ilFormat::formatDate($this->object->getCreateDate(),'datetime',true);
990  $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
991  $data["approve_date"] = ($this->object->getApproveDate() != "")
992  ? ilFormat::formatDate($this->object->getApproveDate(),'datetime',true)
993  : null;
994  $data["agree_date"] = ($this->object->getAgreeDate() != "")
995  ? ilFormat::formatDate($this->object->getAgreeDate(),'datetime',true)
996  : null;
997  $data["last_login"] = ($this->object->getLastLogin() != "")
998  ? ilFormat::formatDate($this->object->getLastLogin(),'datetime',true)
999  : null;
1000  $data["active"] = $this->object->getActive();
1001  $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited();
1002 
1003  $from = new ilDateTime($this->object->getTimeLimitFrom() ? $this->object->getTimeLimitFrom() : time(),IL_CAL_UNIX);
1004  $data["time_limit_from"]["date"] = $from->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
1005  $data["time_limit_from"]["time"] = $from->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
1006 
1007  $until = new ilDateTime($this->object->getTimeLimitUntil() ? $this->object->getTimeLimitUntil() : time(),IL_CAL_UNIX);
1008  $data['time_limit_until']['date'] = $until->get(IL_CAL_FKT_DATE,'Y-m-d',$ilUser->getTimeZone());
1009  $data['time_limit_until']['time'] = $until->get(IL_CAL_FKT_DATE,'H:i:s',$ilUser->getTimeZone());
1010 
1011 
1012  // BEGIN DiskQuota, Show disk space used
1013  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
1015  {
1016  $data["disk_quota"] = $this->object->getDiskQuota() / ilFormat::_getSizeMagnitude() / ilFormat::_getSizeMagnitude();
1017  }
1019  {
1020  $data["wsp_disk_quota"] = $this->object->getPersonalWorkspaceDiskQuota() / ilFormat::_getSizeMagnitude() / ilFormat::_getSizeMagnitude();
1021  }
1022  // W. Randelshofer 2008-09-09: Deactivated display of disk space usage,
1023  // because determining the disk space usage may take several minutes.
1024  /*
1025  require_once "Modules/File/classes/class.ilObjFileAccess.php";
1026  require_once "Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
1027  require_once "Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
1028  require_once "Services/Mail/classes/class.ilObjMailAccess.php";
1029  require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
1030  require_once "Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
1031  $data["disk_space_used"] =
1032  ilObjFileAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1033  ilObjFileBasedLMAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1034  ilObjSAHSLearningModuleAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1035  ilObjMailAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1036  ilObjForumAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
1037  ilObjMediaCastAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>';
1038  */
1039  // END DiskQuota, Show disk space used
1040 
1041  // personal data
1042  $data["gender"] = $this->object->getGender();
1043  $data["firstname"] = $this->object->getFirstname();
1044  $data["lastname"] = $this->object->getLastname();
1045  $data["title"] = $this->object->getUTitle();
1046  $data['birthday'] = $this->object->getBirthday();
1047  $data["institution"] = $this->object->getInstitution();
1048  $data["department"] = $this->object->getDepartment();
1049  $data["street"] = $this->object->getStreet();
1050  $data["city"] = $this->object->getCity();
1051  $data["zipcode"] = $this->object->getZipcode();
1052  $data["country"] = $this->object->getCountry();
1053  $data["sel_country"] = $this->object->getSelectedCountry();
1054  $data["phone_office"] = $this->object->getPhoneOffice();
1055  $data["phone_home"] = $this->object->getPhoneHome();
1056  $data["phone_mobile"] = $this->object->getPhoneMobile();
1057  $data["fax"] = $this->object->getFax();
1058  $data["email"] = $this->object->getEmail();
1059  $data["hobby"] = $this->object->getHobby();
1060  $data["referral_comment"] = $this->object->getComment();
1061 
1062  // interests
1063  $data["interests_general"] = $this->object->getGeneralInterests();
1064  $data["interests_help_offered"] = $this->object->getOfferingHelp();
1065  $data["interests_help_looking"] = $this->object->getLookingForHelp();
1066 
1067  // instant messengers
1068  $data["im_icq"] = $this->object->getInstantMessengerId('icq');
1069  $data["im_yahoo"] = $this->object->getInstantMessengerId('yahoo');
1070  $data["im_msn"] = $this->object->getInstantMessengerId('msn');
1071  $data["im_aim"] = $this->object->getInstantMessengerId('aim');
1072  $data["im_skype"] = $this->object->getInstantMessengerId('skype');
1073  $data["im_jabber"] = $this->object->getInstantMessengerId('jabber');
1074  $data["im_voip"] = $this->object->getInstantMessengerId('voip');
1075 
1076  // other data
1077  $data["matriculation"] = $this->object->getMatriculation();
1078  $data["delicious"] = $this->object->getDelicious();
1079  $data["client_ip"] = $this->object->getClientIP();
1080 
1081  // user defined fields
1082  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1083  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
1084  $user_defined_data = $this->object->getUserDefinedData();
1085  foreach($this->user_defined_fields->getDefinitions() as $field_id => $definition)
1086  {
1087  $data["udf_".$field_id] = $user_defined_data["f_".$field_id];
1088  }
1089 
1090  // settings
1091  $data["language"] = $this->object->getLanguage();
1092  $data["skin_style"] = $this->object->skin.":".$this->object->prefs["style"];
1093  $data["hits_per_page"] = $this->object->prefs["hits_per_page"];
1094  //$data["show_users_online"] = $this->object->prefs["show_users_online"];
1095  $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"] == 'y';
1096  $data['bs_allow_to_contact_me'] = $this->object->prefs['bs_allow_to_contact_me'] == 'y';
1097  $data["session_reminder_enabled"] = (int)$this->object->prefs["session_reminder_enabled"];
1098 
1099  $data["send_mail"] = ($this->object->prefs['send_info_mails'] == 'y');
1100 
1101 
1102  $this->form_gui->setValuesByArray($data);
1103  }
1104 
1108  function initForm($a_mode)
1109  {
1110  global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser;
1111 
1112  $settings = $ilSetting->getAll();
1113 
1114  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1115 
1116  $this->form_gui = new ilPropertyFormGUI();
1117  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
1118  if ($a_mode == "create")
1119  {
1120  $this->form_gui->setTitle($lng->txt("usr_new"));
1121  }
1122  else
1123  {
1124  $this->form_gui->setTitle($lng->txt("usr_edit"));
1125  }
1126 
1127  // login data
1128  $sec_l = new ilFormSectionHeaderGUI();
1129  $sec_l->setTitle($lng->txt("login_data"));
1130  $this->form_gui->addItem($sec_l);
1131 
1132  // authentication mode
1133  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
1134  $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
1135  $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode");
1136  $option = array();
1137  foreach ($active_auth_modes as $auth_name => $auth_key)
1138  {
1139  if ($auth_name == 'default')
1140  {
1141  $name = $this->lng->txt('auth_'.$auth_name)." (".$this->lng->txt('auth_'.ilAuthUtils::_getAuthModeName($auth_key)).")";
1142  }
1143  else
1144  {
1145  // begin-patch ldap_multiple
1146  #$name = $this->lng->txt('auth_'.$auth_name);
1147  include_once './Services/Authentication/classes/class.ilAuthUtils.php';
1148  $name = ilAuthUtils::getAuthModeTranslation($auth_key);
1149  // end-patch ldap_multiple
1150 
1151  }
1152  $option[$auth_name] = $name;
1153  }
1154  $am->setOptions($option);
1155  $this->form_gui->addItem($am);
1156 
1157  if($a_mode == "edit")
1158  {
1159  $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id");
1160  $id->setValue($this->object->getId());
1161  $this->form_gui->addItem($id);
1162  }
1163 
1164  // login
1165  $lo = new ilUserLoginInputGUI($lng->txt("login"), "login");
1166  $lo->setRequired(true);
1167  if ($a_mode == "edit")
1168  {
1169  $lo->setCurrentUserId($this->object->getId());
1170  try
1171  {
1172  include_once 'Services/Calendar/classes/class.ilDate.php';
1173 
1174  $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
1175  $lo->setInfo(
1176  sprintf(
1177  $this->lng->txt('usr_loginname_history_info'),
1178  ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)),
1179  $last_history_entry[0]
1180  )
1181  );
1182  }
1183  catch(ilUserException $e) { }
1184  }
1185 
1186  $this->form_gui->addItem($lo);
1187 
1188  // passwords
1189 // @todo: do not show passwords, if there is not a single auth, that
1190 // allows password setting
1191  {
1192  $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd");
1193  $pw->setSize(32);
1194  $pw->setMaxLength(80); // #17221
1195  $pw->setValidateAuthPost("auth_mode");
1196  if ($a_mode == "create")
1197  {
1198  $pw->setRequiredOnAuth(true);
1199  }
1200  $pw->setInfo(ilUtil::getPasswordRequirementsInfo());
1201  $this->form_gui->addItem($pw);
1202  }
1203  // @todo: invisible/hidden passwords
1204 
1205  // external account
1206  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
1208  {
1209  $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account");
1210  $ext->setSize(40);
1211  $ext->setMaxLength(250);
1212  $ext->setInfo($lng->txt("user_ext_account_desc"));
1213  $this->form_gui->addItem($ext);
1214  }
1215 
1216  // login data
1217  $sec_si = new ilFormSectionHeaderGUI();
1218  $sec_si->setTitle($this->lng->txt("system_information"));
1219  $this->form_gui->addItem($sec_si);
1220 
1221  // create date, approve date, agreement date, last login
1222  if ($a_mode == "edit")
1223  {
1224  $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner");
1225  foreach($sia as $a)
1226  {
1227  $siai = new ilNonEditableValueGUI($lng->txt($a), $a);
1228  $this->form_gui->addItem($siai);
1229  }
1230  }
1231 
1232  // active
1233  $ac = new ilCheckboxInputGUI($lng->txt("active"), "active");
1234  $ac->setChecked(true);
1235  $this->form_gui->addItem($ac);
1236 
1237  // access @todo: get fields right (names change)
1238  $lng->loadLanguageModule('crs');
1239 
1240  // access
1241  $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
1242  $radg->setValue(1);
1243  $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1);
1244  $radg->addOption($op1);
1245  $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0);
1246  $radg->addOption($op2);
1247 
1248 // $ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
1249 // $ac->setChecked(true);
1250 // $ac->setOptionTitle($lng->txt("crs_unlimited"));
1251 
1252  // access.from
1253  $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
1254  $acfrom->setShowTime(true);
1255 // $ac->addSubItem($acfrom);
1256  $op2->addSubItem($acfrom);
1257 
1258  // access.to
1259  $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
1260  $acto->setShowTime(true);
1261 // $ac->addSubItem($acto);
1262  $op2->addSubItem($acto);
1263 
1264 // $this->form_gui->addItem($ac);
1265  $this->form_gui->addItem($radg);
1266 
1267  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
1269  {
1270  $lng->loadLanguageModule("file");
1271 
1272  $quota_head = new ilFormSectionHeaderGUI();
1273  $quota_head->setTitle($lng->txt("repository_disk_quota"));
1274  $this->form_gui->addItem($quota_head);
1275 
1276  // disk quota
1277  $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota");
1278  $disk_quota->setSize(10);
1279  $disk_quota->setMaxLength(11);
1280  $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
1281  $this->form_gui->addItem($disk_quota);
1282 
1283  if ($a_mode == "edit")
1284  {
1285  // show which disk quota is in effect, and explain why
1286  require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
1287  $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId());
1288  if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota'])
1289  {
1290  $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'),
1291  ilFormat::formatSize($dq_info['user_disk_quota'],'short'),
1292  ilFormat::formatSize($dq_info['role_disk_quota'],'short'),
1293  $dq_info['role_title']);
1294  }
1295  else if (is_infinite($dq_info['role_disk_quota']))
1296  {
1297  $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
1298  }
1299  else
1300  {
1301  $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'),
1302  ilFormat::formatSize($dq_info['role_disk_quota'],'short'),
1303  $dq_info['role_title']);
1304  }
1305  $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc").'<br>'.$info_text);
1306 
1307 
1308  // disk usage
1309  $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId());
1310  $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
1311  if ($du_info['last_update'] === null)
1312  {
1313  $disk_usage->setValue($lng->txt('unknown'));
1314  }
1315  else
1316  {
1317  require_once './Services/Utilities/classes/class.ilFormat.php';
1318  $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'],'short'));
1319  $info = '<table class="il_user_quota_disk_usage_overview">';
1320  // write the count and size of each object type
1321  foreach ($du_info['details'] as $detail_data)
1322  {
1323  $info .= '<tr>'.
1324  '<td class="std">'.$detail_data['count'].'</td>'.
1325  '<td class="std">'.$lng->txt($detail_data['type']).'</td>'.
1326  '<td class="std">'.ilFormat::formatSize($detail_data['size'], 'short').'</td>'.
1327  '</tr>'
1328  ;
1329  }
1330  $info .= '</table>';
1331  $info .= '<br>'.$this->lng->txt('last_update').': '.
1332  ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME));
1333  $disk_usage->setInfo($info);
1334 
1335  }
1336  $this->form_gui->addItem($disk_usage);
1337 
1338  // date when the last disk quota reminder was sent to the user
1339  if (true || $dq_info['last_reminder'])
1340  {
1341  $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder");
1342  $reminder->setValue(
1343  ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME))
1344  );
1345  $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc"));
1346  $this->form_gui->addItem($reminder);
1347  }
1348  }
1349  }
1350 
1352  {
1353  $lng->loadLanguageModule("file");
1354 
1355  $quota_head = new ilFormSectionHeaderGUI();
1356  $quota_head->setTitle($lng->txt("personal_workspace_disk_quota"));
1357  $this->form_gui->addItem($quota_head);
1358 
1359  // personal workspace disk quota
1360  $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota");
1361  $wsp_disk_quota->setSize(10);
1362  $wsp_disk_quota->setMaxLength(11);
1363  $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
1364  $this->form_gui->addItem($wsp_disk_quota);
1365 
1366  if ($a_mode == "edit")
1367  {
1368  // show which disk quota is in effect, and explain why
1369  require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
1370  $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId());
1371  if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota'])
1372  {
1373  $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'),
1374  ilFormat::formatSize($dq_info['user_wsp_disk_quota'],'short'),
1375  ilFormat::formatSize($dq_info['role_wsp_disk_quota'],'short'),
1376  $dq_info['role_title']);
1377  }
1378  else if (is_infinite($dq_info['role_wsp_disk_quota']))
1379  {
1380  $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
1381  }
1382  else
1383  {
1384  $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'),
1385  ilFormat::formatSize($dq_info['role_wsp_disk_quota'],'short'),
1386  $dq_info['role_title']);
1387  }
1388  $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc").'<br>'.$info_text);
1389  }
1390 
1391  // disk usage
1392  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
1393  $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId());
1394  $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
1395  if (!sizeof($du_info))
1396  {
1397  $disk_usage->setValue($lng->txt('unknown'));
1398  }
1399  else
1400  {
1401  require_once './Services/Utilities/classes/class.ilFormat.php';
1402  $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId())));
1403  $info = '<table class="il_user_quota_disk_usage_overview">';
1404  // write the count and size of each object type
1405  foreach ($du_info as $detail_data)
1406  {
1407  $info .= '<tr>'.
1408  '<td class="std">'.$detail_data['count'].'</td>'.
1409  '<td class="std">'.$lng->txt("obj_".$detail_data["src_type"]).'</td>'.
1410  '<td class="std">'.ilFormat::formatSize($detail_data['filesize'], 'short').'</td>'.
1411  '</tr>'
1412  ;
1413  }
1414  $info .= '</table>';
1415  $disk_usage->setInfo($info);
1416 
1417  }
1418  $this->form_gui->addItem($disk_usage);
1419  }
1420 
1421  // personal data
1422  if(
1423  $this->isSettingChangeable('gender') or
1424  $this->isSettingChangeable('firstname') or
1425  $this->isSettingChangeable('lastname') or
1426  $this->isSettingChangeable('title') or
1427  $this->isSettingChangeable('personal_image') or
1428  $this->isSettingChangeable('birhtday')
1429  )
1430  {
1431  $sec_pd = new ilFormSectionHeaderGUI();
1432  $sec_pd->setTitle($this->lng->txt("personal_data"));
1433  $this->form_gui->addItem($sec_pd);
1434  }
1435 
1436  // gender
1437  if($this->isSettingChangeable('gender'))
1438  {
1439  $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender");
1440  $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]);
1441  $female = new ilRadioOption($lng->txt("gender_f"), "f");
1442  $gndr->addOption($female);
1443  $male = new ilRadioOption($lng->txt("gender_m"), "m");
1444  $gndr->addOption($male);
1445  $this->form_gui->addItem($gndr);
1446  }
1447 
1448  // firstname, lastname, title
1449  $fields = array("firstname" => true, "lastname" => true,
1450  "title" => isset($settings["require_title"]) && $settings["require_title"]);
1451  foreach($fields as $field => $req)
1452  {
1453  if($this->isSettingChangeable($field))
1454  {
1455  // #18795
1456  $caption = ($field == "title")
1457  ? "person_title"
1458  : $field;
1459  $inp = new ilTextInputGUI($lng->txt($caption), $field);
1460  $inp->setSize(32);
1461  $inp->setMaxLength(32);
1462  $inp->setRequired($req);
1463  $this->form_gui->addItem($inp);
1464  }
1465  }
1466 
1467  // personal image
1468  if($this->isSettingChangeable('upload'))
1469  {
1470  $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
1471  if ($a_mode == "edit" || $a_mode == "upload")
1472  {
1473  $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true,
1474  true));
1475  }
1476  $this->form_gui->addItem($pi);
1477  }
1478 
1479  if($this->isSettingChangeable('birthday'))
1480  {
1481  $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday');
1482  $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]);
1483  $birthday->setShowEmpty(true);
1484  $birthday->setStartYear(1900);
1485  $this->form_gui->addItem($birthday);
1486  }
1487 
1488 
1489  // institution, department, street, city, zip code, country, phone office
1490  // phone home, phone mobile, fax, e-mail
1491  $fields = array(
1492  array("institution", 40, 80),
1493  array("department", 40, 80),
1494  array("street", 40, 40),
1495  array("city", 40, 40),
1496  array("zipcode", 10, 10),
1497  array("country", 40, 40),
1498  array("sel_country"),
1499  array("phone_office", 30, 30),
1500  array("phone_home", 30, 30),
1501  array("phone_mobile", 30, 30),
1502  array("fax", 30, 30));
1503 
1504  $counter = 0;
1505  foreach ($fields as $field)
1506  {
1507  if(!$counter++ and $this->isSettingChangeable($field[0]))
1508  {
1509  // contact data
1510  $sec_cd = new ilFormSectionHeaderGUI();
1511  $sec_cd->setTitle($this->lng->txt("contact_data"));
1512  $this->form_gui->addItem($sec_cd);
1513  }
1514  if($this->isSettingChangeable($field[0]))
1515  {
1516  if ($field[0] != "sel_country")
1517  {
1518  $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]);
1519  $inp->setSize($field[1]);
1520  $inp->setMaxLength($field[2]);
1521  $inp->setRequired(isset($settings["require_".$field[0]]) &&
1522  $settings["require_".$field[0]]);
1523  $this->form_gui->addItem($inp);
1524  }
1525  else
1526  {
1527  // country selection
1528  include_once("./Services/Form/classes/class.ilCountrySelectInputGUI.php");
1529  $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]);
1530  $cs->setRequired(isset($settings["require_".$field[0]]) &&
1531  $settings["require_".$field[0]]);
1532  $this->form_gui->addItem($cs);
1533  }
1534  }
1535  }
1536 
1537  // email
1538  if($this->isSettingChangeable('email'))
1539  {
1540  $em = new ilEMailInputGUI($lng->txt("email"), "email");
1541  $em->setRequired(isset($settings["require_email"]) &&
1542  $settings["require_email"]);
1543  $this->form_gui->addItem($em);
1544  }
1545 
1546  // interests/hobbies
1547  if($this->isSettingChangeable('hobby'))
1548  {
1549  $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby");
1550  $hob->setRows(3);
1551  $hob->setCols(40);
1552  $hob->setRequired(isset($settings["require_hobby"]) &&
1553  $settings["require_hobby"]);
1554  $this->form_gui->addItem($hob);
1555  }
1556 
1557  // referral comment
1558  if($this->isSettingChangeable('referral_comment'))
1559  {
1560  $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment");
1561  $rc->setRows(3);
1562  $rc->setCols(40);
1563  $rc->setRequired(isset($settings["require_referral_comment"]) &&
1564  $settings["require_referral_comment"]);
1565  $this->form_gui->addItem($rc);
1566  }
1567 
1568 
1569  // interests
1570 
1571  $sh = new ilFormSectionHeaderGUI();
1572  $sh->setTitle($lng->txt("interests"));
1573  $this->form_gui->addItem($sh);
1574 
1575  $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
1576  foreach($multi_fields as $multi_field)
1577  {
1578  if($this->isSettingChangeable($multi_field))
1579  {
1580  // see ilUserProfile
1581  $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field);
1582  $ti->setMulti(true);
1583  $ti->setMaxLength(40);
1584  $ti->setSize(40);
1585  $ti->setRequired(isset($settings["require_".$multi_field]) &&
1586  $settings["require_".$multi_field]);
1587  $this->form_gui->addItem($ti);
1588  }
1589  }
1590 
1591 
1592  // instant messengers
1593  if($this->isSettingChangeable('instant_messengers'))
1594  {
1595  $sec_im = new ilFormSectionHeaderGUI();
1596  $sec_im->setTitle($this->lng->txt("instant_messengers"));
1597  $this->form_gui->addItem($sec_im);
1598  }
1599 
1600  // icq, yahoo, msn, aim, skype
1601  $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
1602  foreach ($fields as $field)
1603  {
1604  if($this->isSettingChangeable('instant_messengers'))
1605  {
1606  $im = new ilTextInputGUI($lng->txt("im_".$field), "im_".$field);
1607  $im->setRequired(isset($settings["require_instant_messengers"]) && $settings["require_instant_messengers"]);
1608  $im->setSize(40);
1609  $im->setMaxLength(40);
1610  $this->form_gui->addItem($im);
1611  }
1612  }
1613 
1614  // other information
1615  if($this->isSettingChangeable('user_profile_other'))
1616  {
1617  $sec_oi = new ilFormSectionHeaderGUI();
1618  $sec_oi->setTitle($this->lng->txt("user_profile_other"));
1619  $this->form_gui->addItem($sec_oi);
1620  }
1621 
1622  // matriculation number
1623  if($this->isSettingChangeable('matriculation'))
1624  {
1625  $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation");
1626  $mr->setSize(40);
1627  $mr->setMaxLength(40);
1628  $mr->setRequired(isset($settings["require_matriculation"]) &&
1629  $settings["require_matriculation"]);
1630  $this->form_gui->addItem($mr);
1631  }
1632 
1633  // delicious
1634  if($this->isSettingChangeable('delicious'))
1635  {
1636  $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious");
1637  $mr->setSize(40);
1638  $mr->setMaxLength(40);
1639  $mr->setRequired(isset($settings["require_delicious"]) &&
1640  $settings["require_delicious"]);
1641  $this->form_gui->addItem($mr);
1642  }
1643 
1644  // client IP
1645  $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip");
1646  $ip->setSize(40);
1647  $ip->setMaxLength(255);
1648  $ip->setInfo($this->lng->txt("current_ip")." ".$_SERVER["REMOTE_ADDR"]." <br />".
1649  '<span class="warning">'.$this->lng->txt("current_ip_alert")."</span>");
1650  $this->form_gui->addItem($ip);
1651 
1652  // additional user defined fields
1653  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1654  $user_defined_fields = ilUserDefinedFields::_getInstance();
1655 
1656  if($this->usrf_ref_id == USER_FOLDER_ID)
1657  {
1658  $all_defs = $user_defined_fields->getDefinitions();
1659  }
1660  else
1661  {
1662  $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions();
1663  }
1664 
1665  foreach($all_defs as $field_id => $definition)
1666  {
1667  if($definition['field_type'] == UDF_TYPE_TEXT) // text input
1668  {
1669  $udf = new ilTextInputGUI($definition['field_name'],
1670  "udf_".$definition['field_id']);
1671  $udf->setSize(40);
1672  $udf->setMaxLength(255);
1673  }
1674  else if($definition['field_type'] == UDF_TYPE_WYSIWYG) // text area input
1675  {
1676  $udf = new ilTextAreaInputGUI($definition['field_name'],
1677  "udf_".$definition['field_id']);
1678  $udf->setUseRte(true);
1679  }
1680  else // selection input
1681  {
1682  $udf = new ilSelectInputGUI($definition['field_name'],
1683  "udf_".$definition['field_id']);
1684  $udf->setOptions($user_defined_fields->fieldValuesToSelectArray(
1685  $definition['field_values']));
1686  }
1687  $udf->setRequired($definition['required']);
1688  $this->form_gui->addItem($udf);
1689  }
1690 
1691  // settings
1692  if(
1693  $a_mode == 'create' or
1694  $this->isSettingChangeable( 'language') or
1695  $this->isSettingChangeable( 'skin_style') or
1696  $this->isSettingChangeable( 'hits_per_page') or
1697  $this->isSettingChangeable( 'hide_own_online_status') or
1698  $this->isSettingChangeable( 'bs_allow_to_contact_me')
1699  )
1700  {
1701  $sec_st = new ilFormSectionHeaderGUI();
1702  $sec_st->setTitle($this->lng->txt("settings"));
1703  $this->form_gui->addItem($sec_st);
1704  }
1705 
1706  // role
1707  if ($a_mode == "create")
1708  {
1709  $role = new ilSelectInputGUI($lng->txt("default_role"),
1710  'default_role');
1711  $role->setRequired(true);
1712  $role->setValue($this->default_role);
1713  $role->setOptions($this->selectable_roles);
1714  $this->form_gui->addItem($role);
1715  }
1716 
1717  // language
1718  if($this->isSettingChangeable('language'))
1719  {
1720  $lang = new ilSelectInputGUI($lng->txt("language"),
1721  'language');
1722  $languages = $lng->getInstalledLanguages();
1723  $lng->loadLanguageModule("meta");
1724  $options = array();
1725  foreach($languages as $l)
1726  {
1727  $options[$l] = $lng->txt("meta_l_".$l);
1728  }
1729  $lang->setOptions($options);
1730  $lang->setValue($ilSetting->get("language"));
1731  $this->form_gui->addItem($lang);
1732  }
1733 
1734  // skin/style
1735  if($this->isSettingChangeable('skin_style'))
1736  {
1737  $sk = new ilSelectInputGUI($lng->txt("skin_style"),
1738  'skin_style');
1739  $templates = $styleDefinition->getAllTemplates();
1740 
1741  include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
1742 
1743  $options = array();
1744  if (count($templates) > 0 && is_array ($templates))
1745  {
1746  foreach ($templates as $template)
1747  {
1748  $styleDef =& new ilStyleDefinition($template["id"]);
1749  $styleDef->startParsing();
1750  $styles = $styleDef->getStyles();
1751  foreach ($styles as $style)
1752  {
1753  if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
1754  {
1755  continue;
1756  }
1757  $options[$template["id"].":".$style["id"]] =
1758  $styleDef->getTemplateName()." / ".$style["name"];
1759  }
1760  }
1761  }
1762  $sk->setOptions($options);
1763  $sk->setValue($ilClientIniFile->readVariable("layout","skin").
1764  ":".$ilClientIniFile->readVariable("layout","style"));
1765 
1766  $this->form_gui->addItem($sk);
1767  }
1768 
1769  // hits per page
1770  if($this->isSettingChangeable('hits_per_page'))
1771  {
1772  $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"),
1773  'hits_per_page');
1774  $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40,
1775  50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit"));
1776  $hpp->setOptions($options);
1777  $hpp->setValue($ilSetting->get("hits_per_page"));
1778  $this->form_gui->addItem($hpp);
1779 
1780  // users online
1781  /*$uo = new ilSelectInputGUI($lng->txt("users_online"),
1782  'show_users_online');
1783  $options = array(
1784  "y" => $lng->txt("users_online_show_y"),
1785  "associated" => $lng->txt("users_online_show_associated"),
1786  "n" => $lng->txt("users_online_show_n"));
1787  $uo->setOptions($options);
1788  $uo->setValue($ilSetting->get("show_users_online"));
1789  $this->form_gui->addItem($uo);*/
1790  }
1791 
1792  // hide online status
1793  if($this->isSettingChangeable('hide_own_online_status'))
1794  {
1795  $lng->loadLanguageModule("awrn");
1796  $os = new ilCheckboxInputGUI($lng->txt("awrn_hide_from_awareness"), "hide_own_online_status");
1797  $this->form_gui->addItem($os);
1798  }
1799 
1800  // allow to contact me
1801  if($this->isSettingChangeable('bs_allow_to_contact_me'))
1802  {
1803  $lng->loadLanguageModule('buddysystem');
1804  $os = new ilCheckboxInputGUI($lng->txt('buddy_allow_to_contact_me'), 'bs_allow_to_contact_me');
1805  $this->form_gui->addItem($os);
1806  }
1807 
1808  if((int)$ilSetting->get('session_reminder_enabled'))
1809  {
1810  $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
1811  $cb->setValue(1);
1812  $this->form_gui->addItem($cb);
1813  }
1814 
1815  // Options
1816  if($this->isSettingChangeable('send_mail'))
1817  {
1818  $sec_op = new ilFormSectionHeaderGUI();
1819  $sec_op->setTitle($this->lng->txt("options"));
1820  $this->form_gui->addItem($sec_op);
1821  }
1822 
1823  // send email
1824  $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail');
1825  $se->setInfo($lng->txt('inform_user_mail_info'));
1826  $se->setValue('y');
1827  $se->setChecked(($ilUser->getPref('send_info_mails') == 'y'));
1828  $this->form_gui->addItem($se);
1829 
1830  // ignore required fields
1831  $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf');
1832  $irf->setInfo($lng->txt('ignore_required_fields_info'));
1833  $irf->setValue(1);
1834  $this->form_gui->addItem($irf);
1835 
1836  // @todo: handle all required fields
1837 
1838  // command buttons
1839  if ($a_mode == "create" || $a_mode == "save")
1840  {
1841  $this->form_gui->addCommandButton("save", $lng->txt("save"));
1842  }
1843  if ($a_mode == "edit" || $a_mode == "update")
1844  {
1845  $this->form_gui->addCommandButton("update", $lng->txt("save"));
1846  }
1847  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
1848  }
1849 
1858  protected function isSettingChangeable($a_field)
1859  {
1860  // TODO: Allow mixed field parameter to support checks against an array of field names.
1861 
1862  global $ilSetting;
1863  static $settings = null;
1864 
1865 
1866 
1867  if($this->usrf_ref_id == USER_FOLDER_ID)
1868  {
1869  return true;
1870  }
1871 
1872  if($settings == NULL)
1873  {
1874  $settings = $ilSetting->getAll();
1875  }
1876  return (bool) $settings['usr_settings_changeable_lua_'.$a_field];
1877  }
1878 
1879 
1880 // BEGIN DiskQuota: Allow administrators to edit user picture
1887  {
1888  global $ilUser, $rbacsystem;
1889 
1890  // User folder
1891  if($this->usrf_ref_id == USER_FOLDER_ID and
1892  !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
1893  {
1894  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
1895  }
1896  // if called from local administration $this->usrf_ref_id is category id
1897  // Todo: this has to be fixed. Do not mix user folder id and category id
1898  if($this->usrf_ref_id != USER_FOLDER_ID)
1899  {
1900  // check if user is assigned to category
1901  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
1902  {
1903  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
1904  }
1905  }
1906 
1907  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1908 
1909  if ($_FILES["userfile"]["tmp_name"] == "")
1910  {
1911  if ($userfile_input->getDeletionFlag())
1912  {
1913  $this->object->removeUserPicture();
1914  }
1915  return;
1916  }
1917  if ($_FILES["userfile"]["size"] == 0)
1918  {
1919  ilUtil::sendFailure($this->lng->txt("msg_no_file"));
1920  }
1921  else
1922  {
1923  $webspace_dir = ilUtil::getWebspaceDir();
1924  $image_dir = $webspace_dir."/usr_images";
1925  $store_file = "usr_".$this->object->getId()."."."jpg";
1926 
1927  // store filename
1928  $this->object->setPref("profile_image", $store_file);
1929  $this->object->update();
1930 
1931  // move uploaded file
1932  $pi = pathinfo($_FILES["userfile"]["name"]);
1933  $uploaded_file = $image_dir."/upload_".$this->object->getId().".".$pi["extension"];
1934  if (!ilUtil::moveUploadedFile($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"],
1935  $uploaded_file, false))
1936  {
1937  ilUtil::sendFailure($this->lng->txt("upload_error", true));
1938  $this->ctrl->redirect($this, "showProfile");
1939  }
1940  chmod($uploaded_file, 0770);
1941 
1942  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1943  // taking only frame [0] to avoid problems with animated gifs
1944  $show_file = "$image_dir/usr_".$this->object->getId().".jpg";
1945  $thumb_file = "$image_dir/usr_".$this->object->getId()."_small.jpg";
1946  $xthumb_file = "$image_dir/usr_".$this->object->getId()."_xsmall.jpg";
1947  $xxthumb_file = "$image_dir/usr_".$this->object->getId()."_xxsmall.jpg";
1948  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
1949  $show_file = ilUtil::escapeShellArg($show_file);
1950  $thumb_file = ilUtil::escapeShellArg($thumb_file);
1951  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
1952  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
1953 
1954  if(ilUtil::isConvertVersionAtLeast("6.3.8-3"))
1955  {
1956  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:".$show_file);
1957  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:".$thumb_file);
1958  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:".$xthumb_file);
1959  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:".$xxthumb_file);
1960  }
1961  else
1962  {
1963  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:".$show_file);
1964  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
1965  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:".$xthumb_file);
1966  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:".$xxthumb_file);
1967  }
1968  }
1969  }
1970 
1975  {
1976  $webspace_dir = ilUtil::getWebspaceDir();
1977  $image_dir = $webspace_dir."/usr_images";
1978  $file = $image_dir."/usr_".$this->object->getID()."."."jpg";
1979  $thumb_file = $image_dir."/usr_".$this->object->getID()."_small.jpg";
1980  $xthumb_file = $image_dir."/usr_".$this->object->getID()."_xsmall.jpg";
1981  $xxthumb_file = $image_dir."/usr_".$this->object->getID()."_xxsmall.jpg";
1982  $upload_file = $image_dir."/upload_".$this->object->getID();
1983 
1984  // remove user pref file name
1985  $this->object->setPref("profile_image", "");
1986  $this->object->update();
1987  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1988 
1989  if (@is_file($file))
1990  {
1991  unlink($file);
1992  }
1993  if (@is_file($thumb_file))
1994  {
1995  unlink($thumb_file);
1996  }
1997  if (@is_file($xthumb_file))
1998  {
1999  unlink($xthumb_file);
2000  }
2001  if (@is_file($xxthumb_file))
2002  {
2003  unlink($xxthumb_file);
2004  }
2005  if (@is_file($upload_file))
2006  {
2007  unlink($upload_file);
2008  }
2009 
2010  $this->editObject();
2011  }
2012 // END DiskQuota: Allow administrators to edit user picture
2013 
2018 /*
2019  function saveObjectOld()
2020  {
2021  global $ilias, $rbacsystem, $rbacadmin, $ilSetting;
2022 
2023  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
2024 
2025  //load ILIAS settings
2026  $settings = $ilias->getAllSettings();
2027 
2028  // User folder
2029  if (!$rbacsystem->checkAccess('create_user', $this->usrf_ref_id) and
2030  !$rbacsystem->checkAccess('cat_administrate_users',$this->usrf_ref_id))
2031  {
2032  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
2033  }
2034 
2035  // check dynamically required fields
2036  foreach ($settings as $key => $val)
2037  {
2038  if (substr($key,0,8) == "require_")
2039  {
2040  $field = substr($key,8);
2041 
2042  switch($field)
2043  {
2044  case 'passwd':
2045  case 'passwd2':
2046  if(ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
2047  {
2048  $require_keys[] = $field;
2049  }
2050  break;
2051  default:
2052  $require_keys[] = $field;
2053  break;
2054  }
2055  }
2056  }
2057 
2058  foreach ($require_keys as $key => $val)
2059  {
2060  if (isset($settings["require_" . $val]) && $settings["require_" . $val])
2061  {
2062  if (empty($_POST["Fobject"][$val]))
2063  {
2064  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
2065  $this->lng->txt($val),$this->ilias->error_obj->MESSAGE);
2066  }
2067  }
2068  }
2069 
2070  if(!$this->__checkUserDefinedRequiredFields())
2071  {
2072  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
2073  }
2074 
2075  // validate login
2076  if (!ilUtil::isLogin($_POST["Fobject"]["login"]))
2077  {
2078  $this->ilias->raiseError($this->lng->txt("login_invalid"),$this->ilias->error_obj->MESSAGE);
2079  }
2080 
2081  // check loginname
2082  if (ilObjUser::_loginExists($_POST["Fobject"]["login"]))
2083  {
2084  $this->ilias->raiseError($this->lng->txt("login_exists"),$this->ilias->error_obj->MESSAGE);
2085  }
2086 
2087  // Do password checks only if auth mode allows password modifications
2088  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
2089  if(ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
2090  {
2091  // check passwords
2092  if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"])
2093  {
2094  $this->ilias->raiseError($this->lng->txt("passwd_not_match"),$this->ilias->error_obj->MESSAGE);
2095  }
2096 
2097  // validate password
2098  if (!ilUtil::isPassword($_POST["Fobject"]["passwd"]))
2099  {
2100  $this->ilias->raiseError($this->lng->txt("passwd_invalid"),$this->ilias->error_obj->MESSAGE);
2101  }
2102  }
2103  if(ilAuthUtils::_needsExternalAccountByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
2104  {
2105  if(!strlen($_POST['Fobject']['ext_account']))
2106  {
2107  $this->ilias->raiseError($this->lng->txt('ext_acccount_required'),$this->ilias->error_obj->MESSAGE);
2108  }
2109  }
2110 
2111  if($_POST['Fobject']['ext_account'] &&
2112  ($elogin = ilObjUser::_checkExternalAuthAccount($_POST['Fobject']['auth_mode'],$_POST['Fobject']['ext_account'])))
2113  {
2114  if($elogin != '')
2115  {
2116  $this->ilias->raiseError(
2117  sprintf($this->lng->txt("err_auth_ext_user_exists"),
2118  $_POST["Fobject"]["ext_account"],
2119  $_POST['Fobject']['auth_mode'],
2120  $elogin),
2121  $this->ilias->error_obj->MESSAGE);
2122  }
2123  }
2124 
2125 
2126  // The password type is not passed in the post data. Therefore we
2127  // append it here manually.
2128  include_once ('./Services/User/classes/class.ilObjUser.php');
2129  $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
2130 
2131  // validate email
2132  if (strlen($_POST['Fobject']['email']) and !ilUtil::is_email($_POST["Fobject"]["email"]))
2133  {
2134  $this->ilias->raiseError($this->lng->txt("email_not_valid"),$this->ilias->error_obj->MESSAGE);
2135  }
2136 
2137  // validate time limit
2138  if ($_POST["time_limit"]["unlimited"] != 1 and
2139  ($this->__toUnix($_POST["time_limit"]["until"]) < $this->__toUnix($_POST["time_limit"]["from"])))
2140  {
2141  $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"),$this->ilias->error_obj->MESSAGE);
2142  }
2143  if(!$this->ilias->account->getTimeLimitUnlimited())
2144  {
2145  if($this->__toUnix($_POST["time_limit"]["from"]) < $this->ilias->account->getTimeLimitFrom() or
2146  $this->__toUnix($_POST["time_limit"]["until"])> $this->ilias->account->getTimeLimitUntil() or
2147  $_POST['time_limit']['unlimited'])
2148  {
2149  $this->ilias->raiseError($this->lng->txt("time_limit_not_within_owners"),$this->ilias->error_obj->MESSAGE);
2150  }
2151  }
2152 
2153  // TODO: check if login or passwd already exists
2154  // TODO: check length of login and passwd
2155 
2156  // checks passed. save user
2157  $userObj = new ilObjUser();
2158  $userObj->assignData($_POST["Fobject"]);
2159  $userObj->setTitle($userObj->getFullname());
2160  $userObj->setDescription($userObj->getEmail());
2161 
2162  $userObj->setTimeLimitOwner($this->object->getRefId());
2163  $userObj->setTimeLimitUnlimited($_POST["time_limit"]["unlimited"]);
2164  $userObj->setTimeLimitFrom($this->__toUnix($_POST["time_limit"]["from"]));
2165  $userObj->setTimeLimitUntil($this->__toUnix($_POST["time_limit"]["until"]));
2166 
2167  $userObj->setUserDefinedData($_POST['udf']);
2168 
2169  $userObj->create();
2170 
2171  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
2172  if(ilAuthUtils::_isExternalAccountEnabled())
2173  {
2174  $userObj->setExternalAccount($_POST["Fobject"]["ext_account"]);
2175  }
2176 
2177  //$user->setId($userObj->getId());
2178 
2179  //insert user data in table user_data
2180  $userObj->saveAsNew();
2181 
2182  // setup user preferences
2183  $userObj->setLanguage($_POST["Fobject"]["language"]);
2184 
2185  //set user skin and style
2186  $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
2187 
2188  if ($userObj->getPref("style") != $sknst[1] ||
2189  $userObj->getPref("skin") != $sknst[0])
2190  {
2191  $userObj->setPref("skin", $sknst[0]);
2192  $userObj->setPref("style", $sknst[1]);
2193  }
2194 
2195  // set hits per pages
2196  $userObj->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
2197  // set show users online
2198  $userObj->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
2199  // set hide_own_online_status
2200  $userObj->setPref("hide_own_online_status", $_POST["Fobject"]["hide_own_online_status"]);
2201 
2202  $userObj->writePrefs();
2203 
2204  //set role entries
2205  $rbacadmin->assignUser($_POST["Fobject"]["default_role"],$userObj->getId(),true);
2206 
2207  $msg = $this->lng->txt("user_added");
2208 
2209  // BEGIN DiskQuota: Remember the state of the "send info mail" checkbox
2210  global $ilUser;
2211  $ilUser->setPref('send_info_mails', ($_POST["send_mail"] != "") ? 'y' : 'n');
2212  $ilUser->writePrefs();
2213  // END DiskQuota: Remember the state of the "send info mail" checkbox
2214 
2215  // send new account mail
2216  if ($_POST["send_mail"] != "")
2217  {
2218  include_once("Services/Mail/classes/class.ilAccountMail.php");
2219  $acc_mail = new ilAccountMail();
2220  $acc_mail->setUserPassword($_POST["Fobject"]["passwd"]);
2221  $acc_mail->setUser($userObj);
2222 
2223  if ($acc_mail->send())
2224  {
2225  $msg = $msg."<br />".$this->lng->txt("mail_sent");
2226  }
2227  else
2228  {
2229  $msg = $msg."<br />".$this->lng->txt("mail_not_sent");
2230  }
2231  }
2232 
2233  ilUtil::sendInfo($msg, true);
2234 
2235  if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
2236  {
2237  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
2238  }
2239  else
2240  {
2241  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
2242  }
2243  }
2244 */
2249  function updateObjectOld()
2250  {
2251  global $ilias, $rbacsystem, $rbacadmin,$ilUser;
2252 
2253  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
2254 
2255  //load ILIAS settings
2256  $settings = $ilias->getAllSettings();
2257 
2258  // User folder
2259  if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write',$this->usrf_ref_id))
2260  {
2261  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
2262  }
2263  // if called from local administration $this->usrf_ref_id is category id
2264  // Todo: this has to be fixed. Do not mix user folder id and category id
2265  if($this->usrf_ref_id != USER_FOLDER_ID)
2266  {
2267  // check if user is assigned to category
2268  if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
2269  {
2270  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
2271  }
2272  }
2273 
2274  foreach ($_POST["Fobject"] as $key => $val)
2275  {
2276  $_POST["Fobject"][$key] = ilUtil::stripSlashes($val);
2277  }
2278 
2279  // check dynamically required fields
2280  foreach ($settings as $key => $val)
2281  {
2282  $field = substr($key,8);
2283  switch($field)
2284  {
2285  case 'passwd':
2286  case 'passwd2':
2288  {
2289  $require_keys[] = $field;
2290  }
2291  break;
2292  default:
2293  $require_keys[] = $field;
2294  break;
2295 
2296  }
2297  }
2298 
2299  foreach ($require_keys as $key => $val)
2300  {
2301  // exclude required system and registration-only fields
2302  $system_fields = array("default_role");
2303  if (!in_array($val, $system_fields))
2304  {
2305  if (isset($settings["require_" . $val]) && $settings["require_" . $val])
2306  {
2307  if (empty($_POST["Fobject"][$val]))
2308  {
2309  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
2310  $this->lng->txt($val),$this->ilias->error_obj->MESSAGE);
2311  }
2312  }
2313  }
2314  }
2315 
2316  if(!$this->__checkUserDefinedRequiredFields())
2317  {
2318  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
2319  }
2320  // validate login
2321  if ($this->object->getLogin() != $_POST["Fobject"]["login"] &&
2322  !ilUtil::isLogin($_POST["Fobject"]["login"]))
2323  {
2324  $this->ilias->raiseError($this->lng->txt("login_invalid"),$this->ilias->error_obj->MESSAGE);
2325  }
2326 
2327  // check loginname
2328  if (ilObjUser::_loginExists($_POST["Fobject"]["login"],$this->id))
2329  {
2330  $this->ilias->raiseError($this->lng->txt("login_exists"),$this->ilias->error_obj->MESSAGE);
2331  }
2332 
2334  {
2335  if($_POST['Fobject']['passwd'] == "********" and
2336  !strlen($this->object->getPasswd()))
2337  {
2338  $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
2339  $this->lng->txt('password'),$this->ilias->error_obj->MESSAGE);
2340  }
2341  // check passwords
2342  if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"])
2343  {
2344  $this->ilias->raiseError($this->lng->txt("passwd_not_match"),$this->ilias->error_obj->MESSAGE);
2345  }
2346 
2347  // validate password
2348  if (!ilUtil::isPassword($_POST["Fobject"]["passwd"]))
2349  {
2350  $this->ilias->raiseError($this->lng->txt("passwd_invalid"),$this->ilias->error_obj->MESSAGE);
2351  }
2352  }
2353  else
2354  {
2355  // Password will not be changed...
2356  $_POST['Fobject']['passwd'] = "********";
2357  }
2359  {
2360  if(!strlen($_POST['Fobject']['ext_account']))
2361  {
2362  $this->ilias->raiseError($this->lng->txt('ext_acccount_required'),$this->ilias->error_obj->MESSAGE);
2363  }
2364  }
2365  if($_POST['Fobject']['ext_account'] &&
2366  ($elogin = ilObjUser::_checkExternalAuthAccount($_POST['Fobject']['auth_mode'],$_POST['Fobject']['ext_account'])))
2367  {
2368  if($elogin != $this->object->getLogin())
2369  {
2370  $this->ilias->raiseError(
2371  sprintf($this->lng->txt("err_auth_ext_user_exists"),
2372  $_POST["Fobject"]["ext_account"],
2373  $_POST['Fobject']['auth_mode'],
2374  $elogin),
2375  $this->ilias->error_obj->MESSAGE);
2376  }
2377  }
2378 
2379  // The password type is not passed with the post data. Therefore we
2380  // append it here manually.
2381  include_once ('./Services/User/classes/class.ilObjUser.php');
2382  $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
2383 
2384  // validate email
2385  if (strlen($_POST['Fobject']['email']) and !ilUtil::is_email($_POST["Fobject"]["email"]))
2386  {
2387  $this->ilias->raiseError($this->lng->txt("email_not_valid"),$this->ilias->error_obj->MESSAGE);
2388  }
2389 
2390  $start = $this->__toUnix($_POST["time_limit"]["from"]);
2391  $end = $this->__toUnix($_POST["time_limit"]["until"]);
2392 
2393  // validate time limit
2394  if (!$_POST["time_limit"]["unlimited"] and
2395  ( $start > $end))
2396  {
2397  $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"),$this->ilias->error_obj->MESSAGE);
2398  }
2399 
2400  if(!$this->ilias->account->getTimeLimitUnlimited())
2401  {
2402  if($start < $this->ilias->account->getTimeLimitFrom() or
2403  $end > $this->ilias->account->getTimeLimitUntil() or
2404  $_POST['time_limit']['unlimited'])
2405  {
2406  $_SESSION['error_post_vars'] = $_POST;
2407 
2408  ilUtil::sendFailure($this->lng->txt('time_limit_not_within_owners'));
2409  $this->editObject();
2410 
2411  return false;
2412  }
2413  }
2414 
2415  // TODO: check length of login and passwd
2416 
2417  // checks passed. save user
2418  $_POST['Fobject']['time_limit_owner'] = $this->object->getTimeLimitOwner();
2419 
2420  $_POST['Fobject']['time_limit_unlimited'] = (int) $_POST['time_limit']['unlimited'];
2421  $_POST['Fobject']['time_limit_from'] = $this->__toUnix($_POST['time_limit']['from']);
2422  $_POST['Fobject']['time_limit_until'] = $this->__toUnix($_POST['time_limit']['until']);
2423 
2424  if($_POST['Fobject']['time_limit_unlimited'] != $this->object->getTimeLimitUnlimited() or
2425  $_POST['Fobject']['time_limit_from'] != $this->object->getTimeLimitFrom() or
2426  $_POST['Fobject']['time_limit_until'] != $this->object->getTimeLimitUntil())
2427  {
2428  $_POST['Fobject']['time_limit_message'] = 0;
2429  }
2430  else
2431  {
2432  $_POST['Fobject']['time_limit_message'] = $this->object->getTimeLimitMessage();
2433  }
2434 
2435  $this->object->assignData($_POST["Fobject"]);
2436  $this->object->setUserDefinedData($_POST['udf']);
2437 
2438  try
2439  {
2440  $this->object->updateLogin($_POST['Fobject']['login']);
2441  }
2442  catch (ilUserException $e)
2443  {
2444  ilUtil::sendFailure($e->getMessage());
2445  $this->form_gui->setValuesByPost();
2446  return $tpl->setContent($this->form_gui->getHtml());
2447  }
2448 
2449  $this->object->setTitle($this->object->getFullname());
2450  $this->object->setDescription($this->object->getEmail());
2451  $this->object->setLanguage($_POST["Fobject"]["language"]);
2452 
2453  //set user skin and style
2454  $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
2455 
2456  if ($this->object->getPref("style") != $sknst[1] ||
2457  $this->object->getPref("skin") != $sknst[0])
2458  {
2459  $this->object->setPref("skin", $sknst[0]);
2460  $this->object->setPref("style", $sknst[1]);
2461  }
2462 
2463  // set hits per pages
2464  $this->object->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
2465  // set show users online
2466  //$this->object->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
2467  // set hide_own_online_status
2468  if ($_POST["Fobject"]["hide_own_online_status"]) {
2469  $this->object->setPref("hide_own_online_status", $_POST["Fobject"]["hide_own_online_status"]);
2470  }
2471  else {
2472  $this->object->setPref("hide_own_online_status", "n");
2473  }
2474  // set allow to contact me
2475  if(isset($_POST['Fobject']['bs_allow_to_contact_me']) && $_POST['Fobject']['bs_allow_to_contact_me'] == 1)
2476  {
2477  $this->object->setPref('bs_allow_to_contact_me', 'y');
2478  }
2479  else
2480  {
2481  $this->object->setPref('bs_allow_to_contact_me', 'n');
2482  }
2483 
2484  $this->update = $this->object->update();
2485  //$rbacadmin->updateDefaultRole($_POST["Fobject"]["default_role"], $this->object->getId());
2486 
2487  // BEGIN DiskQuota: Remember the state of the "send info mail" checkbox
2488  global $ilUser;
2489  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
2490  $ilUser->writePrefs();
2491  // END DiskQuota: Remember the state of the "send info mail" checkbox
2492 
2493  $mail_message = $this->__sendProfileMail();
2494  $msg = $this->lng->txt('saved_successfully').$mail_message;
2495 
2496  // feedback
2497  ilUtil::sendSuccess($msg,true);
2498 
2499  if (strtolower($_GET["baseClass"]) == 'iladministrationgui')
2500  {
2501  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
2502  }
2503  else
2504  {
2505  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
2506  }
2507  }
2508 
2509 
2510 
2516  function assignSaveObject()
2517  {
2518  global $rbacsystem, $rbacadmin, $rbacreview;
2519 
2520  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
2521  {
2522  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
2523  }
2524 
2525  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
2526  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
2527 
2528  // prevent unassignment of system role from system user
2529  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles))
2530  {
2531  array_push($selected_roles,SYSTEM_ROLE_ID);
2532  }
2533 
2534  $global_roles_all = $rbacreview->getGlobalRoles();
2535  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
2536  $assigned_roles = array_intersect($assigned_roles_all,$posted_roles);
2537  $assigned_global_roles_all = array_intersect($assigned_roles_all,$global_roles_all);
2538  $assigned_global_roles = array_intersect($assigned_global_roles_all,$posted_roles);
2539  $posted_global_roles = array_intersect($selected_roles,$global_roles_all);
2540 
2541  if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
2542  or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles)))
2543  {
2544  //$this->ilias->raiseError($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),$this->ilias->error_obj->MESSAGE);
2545  // workaround. sometimes jumps back to wrong page
2546  ilUtil::sendFailure($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),true);
2547  $this->ctrl->redirect($this,'roleassignment');
2548  }
2549 
2550  foreach (array_diff($assigned_roles,$selected_roles) as $role)
2551  {
2552  $rbacadmin->deassignUser($role,$this->object->getId());
2553  }
2554 
2555  foreach (array_diff($selected_roles,$assigned_roles) as $role)
2556  {
2557  $rbacadmin->assignUser($role,$this->object->getId(),false);
2558  }
2559 
2560  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
2561 
2562  // update object data entry (to update last modification date)
2563  $this->object->update();
2564 
2565  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"),true);
2566 
2567  if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
2568  {
2569  $this->ctrl->redirect($this,'roleassignment');
2570  }
2571  else
2572  {
2573  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
2574  }
2575 
2576  }
2577 
2584  {
2585  global $rbacreview,$rbacsystem,$ilUser, $ilTabs;
2586 
2587  $ilTabs->activateTab("role_assignment");
2588 
2589  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
2590  {
2591  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
2592  }
2593 
2594  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
2595 
2596  if ($_SESSION['filtered_roles'] > 5)
2597  {
2598  $_SESSION['filtered_roles'] = 0;
2599  }
2600 
2601  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.usr_role_assignment.html','Services/User');
2602 
2603  if(false)
2604  {
2605  $this->tpl->setCurrentBlock("filter");
2606  $this->tpl->setVariable("FILTER_TXT_FILTER",$this->lng->txt('filter'));
2607  $this->tpl->setVariable("SELECT_FILTER",$this->__buildFilterSelect());
2608  $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getFormAction($this));
2609  $this->tpl->setVariable("FILTER_NAME",'roleassignment');
2610  $this->tpl->setVariable("FILTER_VALUE",$this->lng->txt('apply_filter'));
2611  $this->tpl->parseCurrentBlock();
2612  }
2613 
2614  // init table
2615  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2616  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
2617 
2618  // now get roles depending on filter settings
2619  $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"],$this->object->getId());
2620  $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
2621 
2622  $counter = 0;
2623 
2624  include_once ('./Services/AccessControl/classes/class.ilObjRole.php');
2625 
2626  $records = array();
2627  foreach ($role_list as $role)
2628  {
2629  // fetch context path of role
2630  $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
2631 
2632  // only list roles that are not set to status "deleted"
2633  if ($rbacreview->isDeleted($rolf[0]))
2634  {
2635  continue;
2636  }
2637 
2638  // build context path
2639  $path = "";
2640 
2641  if ($this->tree->isInTree($rolf[0]))
2642  {
2643  if ($rolf[0] == ROLE_FOLDER_ID)
2644  {
2645  $path = $this->lng->txt("global");
2646  }
2647  else
2648  {
2649  $tmpPath = $this->tree->getPathFull($rolf[0]);
2650 
2651  // count -1, to exclude the role folder itself
2652  /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
2653  {
2654  if ($path != "")
2655  {
2656  $path .= " > ";
2657  }
2658 
2659  $path .= $tmpPath[$i]["title"];
2660  }*/
2661 
2662  $path = $tmpPath[count($tmpPath)-1]["title"];
2663  }
2664  }
2665  else
2666  {
2667  $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$role["obj_id"].")</b>";
2668  }
2669 
2670  $disabled = false;
2671 
2672  // disable checkbox for system role for the system user
2673  if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
2674  or (!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID))
2675  {
2676  $disabled = true;
2677  }
2678 
2679  // protected admin role
2680  if($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(),SYSTEM_ROLE_ID))
2681  {
2682  include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
2683  if(ilSecuritySettings::_getInstance()->isAdminRoleProtected())
2684  {
2685  $disabled = true;
2686  }
2687  }
2688 
2689  if (substr($role["title"],0,3) == "il_")
2690  {
2691  if (!$assignable)
2692  {
2693  $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
2694  $rolf2 = $rolf_arr[0];
2695  }
2696  else
2697  {
2698  $rolf2 = $rolf;
2699  }
2700 
2701  $parent_node = $this->tree->getNodeData($rolf2);
2702 
2703  $role["description"] = $this->lng->txt("obj_".$parent_node["type"])."&nbsp;(#".$parent_node["obj_id"].")";
2704  }
2705 
2706  $role_ids[$counter] = $role["obj_id"];
2707 
2708  $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"]."\"/>";
2709  $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
2710  $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
2711  $result_set[$counter][] = $link = "<a href=\"".$this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm")."\">".ilObjRole::_getTranslation($role["title"])."</a>";
2712  $title = ilObjRole::_getTranslation($role["title"]);
2713  $result_set[$counter][] = $role["description"];
2714 
2715  // Add link to objector local Rores
2716  if ($role["role_type"] == "local") {
2717  // Get Object to the role
2718  $obj_id = ilRbacReview::getObjectOfRole($role["rol_id"]);
2719 
2720  $obj_type = ilObject::_lookupType($obj_id);
2721 
2723 
2724  foreach ($ref_ids as $ref_id) {}
2725 
2726  require_once("./Services/Link/classes/class.ilLink.php");
2727 
2728  $result_set[$counter][] = $context = "<a href='".ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id))."' target='_top'>".$path."</a>";
2729  }
2730  else
2731  {
2732  $result_set[$counter][] = $path;
2733  $context = $path;
2734  }
2735 
2736  $records[] = array("path" => $path, "description" => $role["description"],
2737  "context" => $context, "checkbox" => $checkbox,
2738  "role" => $link, "title" => $title);
2739  ++$counter;
2740  }
2741 
2742  if (true)
2743  {
2744  $tab->setData($records);
2745  $this->tpl->setVariable("ROLES_TABLE",$tab->getHTML());
2746  return;
2747  }
2748  }
2749 
2754  {
2755  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2756  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2757  $table_gui->writeFilterToSession(); // writes filter to session
2758  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2759  $this->roleassignmentObject();
2760  }
2761 
2766  {
2767  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2768  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2769  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2770  $table_gui->resetFilter(); // clears filter
2771  $this->roleassignmentObject();
2772  }
2773 
2774  function __getDateSelect($a_type,$a_varname,$a_selected)
2775  {
2776  switch($a_type)
2777  {
2778  case "minute":
2779  for($i=0;$i<=60;$i++)
2780  {
2781  $days[$i] = $i < 10 ? "0".$i : $i;
2782  }
2783  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2784 
2785  case "hour":
2786  for($i=0;$i<24;$i++)
2787  {
2788  $days[$i] = $i < 10 ? "0".$i : $i;
2789  }
2790  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2791 
2792  case "day":
2793  for($i=1;$i<32;$i++)
2794  {
2795  $days[$i] = $i < 10 ? "0".$i : $i;
2796  }
2797  return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
2798 
2799  case "month":
2800  for($i=1;$i<13;$i++)
2801  {
2802  $month[$i] = $i < 10 ? "0".$i : $i;
2803  }
2804  return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
2805 
2806  case "year":
2807  if($a_selected < date('Y',time()))
2808  {
2809  $start = $a_selected;
2810  }
2811  else
2812  {
2813  $start = date('Y',time());
2814  }
2815 
2816  for($i = $start;$i < date("Y",time()) + 11;++$i)
2817  {
2818  $year[$i] = $i;
2819  }
2820  return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
2821  }
2822  }
2823 
2824  function __toUnix($a_time_arr)
2825  {
2826  return mktime($a_time_arr["hour"],
2827  $a_time_arr["minute"],
2828  $a_time_arr["second"],
2829  $a_time_arr["month"],
2830  $a_time_arr["day"],
2831  $a_time_arr["year"]);
2832  }
2833 
2834 
2835 
2836 
2838  {
2839  unset($_SESSION["filtered_roles"]);
2840  }
2841 
2843  {
2844  $action[0] = $this->lng->txt('assigned_roles');
2845  $action[1] = $this->lng->txt('all_roles');
2846  $action[2] = $this->lng->txt('all_global_roles');
2847  $action[3] = $this->lng->txt('all_local_roles');
2848  $action[4] = $this->lng->txt('internal_local_roles_only');
2849  $action[5] = $this->lng->txt('non_internal_local_roles_only');
2850 
2851  return ilUtil::formSelect($_SESSION['filtered_roles'],"filter",$action,false,true);
2852  }
2853 
2855  {
2856  parent::hitsperpageObject();
2857  $this->roleassignmentObject();
2858  }
2859 
2865  {
2866  global $ilLocator;
2867 
2868  $ilLocator->clearItems();
2869 
2870  if ($_GET["admin_mode"] == "settings") // system settings
2871  {
2872  $this->ctrl->setParameterByClass("ilobjsystemfoldergui",
2873  "ref_id", SYSTEM_FOLDER_ID);
2874  $ilLocator->addItem($this->lng->txt("administration"),
2875  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2876  ilFrameTargetInfo::_getFrame("MainContent"));
2877 
2878  if ($_GET['ref_id'] == USER_FOLDER_ID)
2879  {
2880  $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
2881  ilObject::_lookupObjId($_GET["ref_id"]))),
2882  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
2883  }
2884  elseif ($_GET['ref_id'] == ROLE_FOLDER_ID)
2885  {
2886  $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
2887  ilObject::_lookupObjId($_GET["ref_id"]))),
2888  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view"));
2889  }
2890 
2891  if ($_GET["obj_id"] > 0)
2892  {
2893  $ilLocator->addItem($this->object->getTitle(),
2894  $this->ctrl->getLinkTarget($this, "view"));
2895  }
2896  }
2897  else // repository administration
2898  {
2899  // ?
2900  }
2901  }
2902 
2903  function showUpperIcon()
2904  {
2905  }
2906 
2908  {
2909  global $ilUser,$ilias;
2910 
2911  if($_POST['send_mail'] != 'y')
2912  {
2913  return '';
2914  }
2915  if(!strlen($this->object->getEmail()))
2916  {
2917  return '';
2918  }
2919 
2920  // Choose language of user
2921  $usr_lang = new ilLanguage($this->object->getLanguage());
2922  $usr_lang->loadLanguageModule('crs');
2923  $usr_lang->loadLanguageModule('registration');
2924 
2925  include_once "Services/Mail/classes/class.ilMimeMail.php";
2926 
2927  $mmail = new ilMimeMail();
2928  $mmail->autoCheck(false);
2929  $mmail->From($ilUser->getEmail());
2930  $mmail->To($this->object->getEmail());
2931 
2932  // mail subject
2933  $subject = $usr_lang->txt("profile_changed");
2934 
2935 
2936  // mail body
2937  $body = ($usr_lang->txt("reg_mail_body_salutation")." ".$this->object->getFullname().",\n\n");
2938 
2939  $date = $this->object->getApproveDate();
2940  // Approve
2941  if((time() - strtotime($date)) < 10)
2942  {
2943  $body .= ($usr_lang->txt('reg_mail_body_approve')."\n\n");
2944  }
2945  else
2946  {
2947  $body .= ($usr_lang->txt('reg_mail_body_profile_changed')."\n\n");
2948  }
2949 
2950  // Append login info only if password has been chacnged
2951  if($_POST['passwd'] != '')
2952  {
2953  $body .= $usr_lang->txt("reg_mail_body_text2")."\n".
2954  ILIAS_HTTP_PATH."/login.php?client_id=".$ilias->client_id."\n".
2955  $usr_lang->txt("login").": ".$this->object->getLogin()."\n".
2956  $usr_lang->txt("passwd").": ".$_POST['passwd']."\n\n";
2957  }
2958  $body .= ($usr_lang->txt("reg_mail_body_text3")."\n");
2959  $body .= $this->object->getProfileAsString($usr_lang);
2960 
2961  $mmail->Subject($subject);
2962  $mmail->Body($body);
2963  $mmail->Send();
2964 
2965 
2966  return "<br/>".$this->lng->txt("mail_sent");
2967  }
2968 
2972  public static function _goto($a_target)
2973  {
2974  global $ilUser, $ilCtrl;
2975 
2976  // #10888
2977  if($a_target == md5("usrdelown"))
2978  {
2979  if($ilUser->getId() != ANONYMOUS_USER_ID &&
2980  $ilUser->hasDeletionFlag())
2981  {
2982  $ilCtrl->setTargetScript("ilias.php");
2983  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2984  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalsettingsgui"), "deleteOwnAccount3");
2985  }
2986  exit("This account is not flagged for deletion."); // #12160
2987  }
2988 
2989  if (substr($a_target, 0, 1) == "n")
2990  {
2991  $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
2992  }
2993 
2994  if(strpos($a_target, 'contact_approved') !== false)
2995  {
2996  $_GET['cmd'] = 'approveContactRequest';
2997  }
2998  else if(strpos($a_target, 'contact_ignored') !== false)
2999  {
3000  $_GET['cmd'] = 'ignoreContactRequest';
3001  }
3002  else
3003  {
3004  $_GET['cmd'] = 'view';
3005  }
3006 
3007  $_GET["user_id"] = (int) $a_target;
3008  $_GET["baseClass"] = "ilPublicUserProfileGUI";
3009  $_GET["cmdClass"] = "ilpublicuserprofilegui";
3010  include("ilias.php");
3011  exit;
3012  }
3013 
3022  protected function handleIgnoredRequiredFields()
3023  {
3024  $profileMaybeIncomplete = false;
3025 
3026  require_once 'Services/User/classes/class.ilUserProfile.php';
3027 
3028  foreach( ilUserProfile::getIgnorableRequiredSettings() as $fieldName )
3029  {
3030  $elm = $this->form_gui->getItemByPostVar($fieldName);
3031 
3032  if( !$elm ) continue;
3033 
3034  if( $elm->getRequired() )
3035  {
3036  $profileMaybeIncomplete = true;
3037 
3038  // Flag as optional
3039  $elm->setRequired( false );
3040  }
3041  }
3042 
3043  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
3044  $user_defined_fields = ilUserDefinedFields::_getInstance();
3045  foreach($user_defined_fields->getDefinitions() as $field_id => $definition)
3046  {
3047  $elm = $this->form_gui->getItemByPostVar('udf_'.$definition['field_id']);
3048 
3049  if( !$elm ) continue;
3050 
3051  if( $elm->getRequired() && $definition['changeable'] && $definition['required'] && $definition['visible'] )
3052  {
3053  $profileMaybeIncomplete = true;
3054 
3055  // Flag as optional
3056  $elm->setRequired( false );
3057  }
3058  }
3059 
3060  return $profileMaybeIncomplete;
3061  }
3062 
3066  protected function showAcceptedTermsOfService()
3067  {
3071  $agree_date = $this->form_gui->getItemByPostVar('agree_date');
3072  if($agree_date && $agree_date->getValue())
3073  {
3074  $this->lng->loadLanguageModule('tos');
3075  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
3079  $entity = ilTermsOfServiceHelper::getCurrentAcceptanceForUser($this->object);
3080  if($entity->getId())
3081  {
3082  $show_agreement_text = new ilCheckboxInputGUI($this->lng->txt('tos_show_signed_text'), 'tos_show_signed_text');
3083 
3084  $agreement_lang = new ilNonEditableValueGUI($this->lng->txt('language'), '');
3085  $agreement_lang->setValue($this->lng->txt('meta_l_' . $entity->getIso2LanguageCode()));
3086  $show_agreement_text->addSubItem($agreement_lang);
3087 
3088  require_once 'Services/TermsOfService/classes/form/class.ilTermsOfServiceSignedDocumentFormElementGUI.php';
3089  $agreement_document = new ilTermsOfServiceSignedDocumentFormElementGUI($this->lng->txt('tos_agreement_document'), '', $entity);
3090  $show_agreement_text->addSubItem($agreement_document);
3091  $agree_date->addSubItem($show_agreement_text);
3092  }
3093  }
3094  else if($agree_date)
3095  {
3096  $agree_date->setValue($this->lng->txt('tos_not_accepted_yet'));
3097  }
3098  }
3099 } // END class.ilObjUserGUI
3100 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static _lookupLogin($a_user_id)
lookup login
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.
getAdminTabs(&$tabs_gui)
admin and normal tabs are equal for roles
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
print $file
assignSaveObject()
assign users to role
const IL_PASSWD_PLAIN
$style
Definition: example_012.php:70
getValues()
Get values from user object and put them into form.
exit
Definition: login.php:54
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
addAdminLocatorItems()
should be overwritten to add object specific items (repository items are preloaded) ...
$_POST['username']
Definition: cron.php:12
createObject()
Display user create form.
const IL_CAL_DATETIME
updateObjectOld()
save user data public
static _getInstance()
Get instance.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
This class represents a property form user interface.
handleIgnoredRequiredFields()
Handles ignored required fields by changing the required flag of form elements.
This class represents a selection list property in a property form.
$_GET["client_id"]
loadValuesFromForm($a_mode='create')
_lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
This class represents a section header in a property form.
uploadUserPictureObject()
upload user image
removeUserPictureObject()
remove user image
_getTranslation($a_role_title)
$cmd
Definition: sahs_server.php:35
static _lookupPersonalWorkspaceDiskQuota($a_user_id)
This class represents a user login property in a property form.
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
static _getLastHistoryDataByUserId($a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
static _lookupId($a_user_str)
Lookup id by login.
This class represents a checkbox property in a property form.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static getIgnorableRequiredSettings()
Returns an array of all ignorable profiel fields.
ilObjUserGUI($a_data, $a_id, $a_call_by_reference=false, $a_prepare_output=true)
Constructor public.
This class represents a email property in a property form.
static _needsExternalAccountByAuthMode($a_auth_mode)
Check if chosen auth mode needs an external account entry.
const IL_CAL_UNIX
$records
Definition: simple_test.php:17
Class ilObjectOwnershipManagementGUI.
static _resetLoginAttempts($a_usr_id)
static _getAuthModeName($a_auth_key)
static isPassword($a_passwd, &$customError=null)
validates a password public
static _getAllReferences($a_id)
get all reference ids of object
static _goto($a_target)
Goto user profile screen.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
__toUnix($a_time_arr)
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
This class represents a date/time property in a property form.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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...
setChecked($a_checked)
Set Checked.
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
isSettingChangeable($a_field)
Check if setting is visible This is the case when called from user folder.
$info
Definition: example_052.php:80
static _enabledLearningProgress()
check wether learing progress is enabled or not
__checkUserDefinedRequiredFields()
display user create form
This class represents a property in a property form.
getTabs(&$tabs_gui)
get tabs
static execConvert($args)
execute convert command
if(!is_array($argv)) $options
this class encapsulates the PHP mail() function.
setImage($a_image)
Set Image.
__getDateSelect($a_type, $a_varname, $a_selected)
static getCurrentAcceptanceForUser(ilObjUser $user)
resetFilterObject()
Reset filter.
static _lookupDiskQuota($a_user_id)
Gets the disk quota info for the specified user account.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
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.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
setValue($a_value)
Set Value.
setSize($a_size)
Set Size.
const IL_CAL_FKT_DATE
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.
redirection script todo: (a better solution should control the processing via a xml file) ...
initForm($a_mode)
Init user form.
static clear($a_var)
Unset a value.
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 _isExternalAccountEnabled()
Check if an external account name is required.
setOptions($a_options)
Set Options.
get($a_format, $a_format_str='', $a_tz='')
get formatted date
getObjectOfRole($a_role_id)
Get object id of objects a role is assigned to.
const UDF_TYPE_WYSIWYG
static getFilesizeByOwner($a_owner_id)
Get current storage size for owner.
prepareOutput()
prepare output
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _getSizeMagnitude()
Returns the magnitude used for size units.
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.
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 ...
static _getFrame($a_class, $a_type='')
Get content frame name.
TableGUI class for role assignment in user administration.
This class represents a non editable value in a property form.
setMulti($a_multi, $a_sortable=false, $a_addremove=true)
Set Multi.
static getAuthModeTranslation($a_auth_key)
global $ilUser
Definition: imgupload.php:15
global $l
Definition: afr.php:30
isLogin($a_login)
global $ilSetting
Definition: privfeed.php:40
_getAssignUsersStatus($a_role_id)
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
static escapeShellArg($a_arg)
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
applyFilterObject()
Apply filter.
$path
Definition: index.php:22
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.
loadLanguageModule($a_module)
saveObject()
save user data public
Class ilAccountMail.
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.
language handling
setBackTarget($a_text, $a_link)
set back tab target
updateObject()
Update user.
Class ilObjUserGUI.
static getWebspaceDir($mode="filesystem")
get webspace directory
static _getInstance()
Get instance of ilSecuritySettings.
Class ilObjUserTrackingGUI.
setRequired($a_required)
Set Required.
setShowTime($a_showtime)
Set Show Time Information.
roleassignmentObject()
display roleassignment panel
static getFilesizeByTypeAndOwner($a_owner_id)
Get current storage size for owner (grouped by type)