ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
18 {
19  public $ilCtrl;
20 
26  public $gender;
27 
33  public $type;
34 
40  public $user_ref_id;
41 
46  public function __construct($a_data, $a_id, $a_call_by_reference = false, $a_prepare_output = true)
47  {
48  global $ilCtrl, $lng;
49 
50  define('USER_FOLDER_ID', 7);
51 
52  $this->type = "usr";
53  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
54  $this->usrf_ref_id =&$this->ref_id;
55 
56  $this->ctrl = $ilCtrl;
57  $this->ctrl->saveParameter($this, array('obj_id', 'letter'));
58  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "letter", $_GET["letter"]);
59  $this->ctrl->setContext($this->object->getId(), 'usr');
60  $lng->loadLanguageModule('user');
61 
62  // for gender selection. don't change this
63  // maybe deprecated
64  $this->gender = array(
65  'n' => "salutation_n",
66  'm' => "salutation_m",
67  'f' => "salutation_f",
68  );
69  }
70 
71  public 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  case "illearningprogressgui":
82  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
84  $this->ctrl->forwardCommand($new_gui);
85  break;
86 
87  case "ilobjectownershipmanagementgui":
88  include_once("Services/Object/classes/class.ilObjectOwnershipManagementGUI.php");
89  $gui = new ilObjectOwnershipManagementGUI($this->object->getId());
90  $this->ctrl->forwardCommand($gui);
91  break;
92 
93  default:
94  if ($cmd == "" || $cmd == "view") {
95  $cmd = "edit";
96  }
97  $cmd .= "Object";
98  $return = $this->$cmd();
99 
100  break;
101  }
102  return $return;
103  }
104 
105  /* Overwritten from base class
106  */
107  public function setTitleAndDescription()
108  {
109  if (strtolower(get_class($this->object)) == 'ilobjuser') {
110  $this->tpl->setTitle('[' . $this->object->getLogin() . '] ' . $this->object->getTitle());
111  $this->tpl->setDescription($this->object->getLongDescription());
112  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_" . $this->object->getType() . ".svg"), $this->lng->txt("obj_" . $this->object->getType()));
113  } else {
114  parent::setTitleAndDescription();
115  }
116  }
117 
118 
119 
120  public function cancelObject()
121  {
122  ilSession::clear("saved_post");
123 
124  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
125  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
126  //$return_location = $_GET["cmd_return_location"];
127  //ilUtil::redirect($this->ctrl->getLinkTarget($this,$return_location));
128  } else {
129  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
130  }
131  }
132 
136  public function getAdminTabs()
137  {
138  $this->getTabs();
139  }
140 
144  public function getTabs()
145  {
146  global $rbacsystem, $ilHelp;
147 
148  $this->tabs_gui->clearTargets();
149 
150  $ilHelp->setScreenIdComponent("usr");
151 
152  if ($_GET["search"]) {
153  $this->tabs_gui->setBackTarget(
154  $this->lng->txt("search_results"),
155  $_SESSION["usr_search_link"]
156  );
157 
158  $this->tabs_gui->addTarget(
159  "properties",
160  $this->ctrl->getLinkTarget($this, "edit"),
161  array("edit","","view"),
162  get_class($this),
163  "",
164  true
165  );
166  } else {
167  $this->tabs_gui->addTarget(
168  "properties",
169  $this->ctrl->getLinkTarget($this, "edit"),
170  array("edit","","view"),
171  get_class($this)
172  );
173  }
174 
175  $this->tabs_gui->addTarget(
176  "role_assignment",
177  $this->ctrl->getLinkTarget($this, "roleassignment"),
178  array("roleassignment"),
179  get_class($this)
180  );
181 
182  // learning progress
183  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
184  if ($rbacsystem->checkAccess('read', $this->ref_id) and
187  $this->tabs_gui->addTarget(
188  'learning_progress',
189  $this->ctrl->getLinkTargetByClass('illearningprogressgui', ''),
190  '',
191  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
192  );
193  }
194 
195  $this->tabs_gui->addTarget(
196  'user_ownership',
197  $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui', ''),
198  '',
199  'ilobjectownershipmanagementgui'
200  );
201  }
202 
206  public function setBackTarget($a_text, $a_link)
207  {
208  $this->back_target = array("text" => $a_text,
209  "link" => $a_link);
210  }
211 
217  {
218  include_once './Services/User/classes/class.ilUserDefinedFields.php';
219  $this->user_defined_fields =&ilUserDefinedFields::_getInstance();
220 
221  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
222  if ($definition['required'] and !strlen($_POST['udf'][$field_id])) {
223  return false;
224  }
225  }
226  return true;
227  }
228 
229 
230  public function __showUserDefinedFields()
231  {
232  include_once './Services/User/classes/class.ilUserDefinedFields.php';
233  $this->user_defined_fields =&ilUserDefinedFields::_getInstance();
234 
235  if ($this->object->getType() == 'usr') {
236  $user_defined_data = $this->object->getUserDefinedData();
237  }
238  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
239  $old = isset($_SESSION["error_post_vars"]["udf"][$field_id]) ?
240  $_SESSION["error_post_vars"]["udf"][$field_id] : $user_defined_data[$field_id];
241 
242  if ($definition['field_type'] == UDF_TYPE_TEXT) {
243  $this->tpl->setCurrentBlock("field_text");
244  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
245  $this->tpl->setVariable("FIELD_VALUE", ilUtil::prepareFormOutput($old));
246  $this->tpl->parseCurrentBlock();
247  } else {
248  $this->tpl->setCurrentBlock("field_select");
249  $this->tpl->setVariable("SELECT_BOX", ilUtil::formSelect(
250  $old,
251  'udf[' . $definition['field_id'] . ']',
252  $this->user_defined_fields->fieldValuesToSelectArray(
253  $definition['field_values']
254  ),
255  false,
256  true
257  ));
258  $this->tpl->parseCurrentBlock();
259  }
260  $this->tpl->setCurrentBlock("user_defined");
261 
262  if ($definition['required']) {
263  $name = $definition['field_name'] . "<span class=\"asterisk\">*</span>";
264  } else {
265  $name = $definition['field_name'];
266  }
267  $this->tpl->setVariable("TXT_FIELD_NAME", $name);
268  $this->tpl->parseCurrentBlock();
269  }
270  return true;
271  }
272 
273  public function initCreate()
274  {
276 
277  if ($this->usrf_ref_id != USER_FOLDER_ID) {
278  $this->tabs_gui->clearTargets();
279  }
280 
281  // role selection
282  $obj_list = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
283  $rol = array();
284  foreach ($obj_list as $obj_data) {
285  // allow only 'assign_users' marked roles if called from category
286  if ($this->object->getRefId() != USER_FOLDER_ID and !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
287  include_once './Services/AccessControl/classes/class.ilObjRole.php';
288 
289  if (!ilObjRole::_getAssignUsersStatus($obj_data['obj_id'])) {
290  continue;
291  }
292  }
293  // exclude anonymous role from list
294  if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID) {
295  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
296  if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
297  $rol[$obj_data["obj_id"]] = $obj_data["title"];
298  }
299  }
300  }
301 
302  // raise error if there is no global role user can be assigned to
303  if (!count($rol)) {
304  $this->ilias->raiseError($this->lng->txt("msg_no_roles_users_can_be_assigned_to"), $this->ilias->error_obj->MESSAGE);
305  }
306 
307  $keys = array_keys($rol);
308 
309  // set pre defined user role to default
310  if (in_array(4, $keys)) {
311  $this->default_role = 4;
312  } else {
313  if (count($keys) > 1 and in_array(2, $keys)) {
314  // remove admin role as preselectable role
315  foreach ($keys as $key => $val) {
316  if ($val == 2) {
317  unset($keys[$key]);
318  break;
319  }
320  }
321  }
322 
323  $this->default_role = array_shift($keys);
324  }
325  $this->selectable_roles = $rol;
326  }
327 
331  public function createObject()
332  {
334 
335  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id) and
336  !$rbacsystem->checkAccess('cat_administrate_users', $this->usrf_ref_id)) {
337  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
338  }
339 
340  $this->initCreate();
341  $this->initForm("create");
342  return $tpl->setContent($this->form_gui->getHtml());
343  }
344 
349  public function saveObject()
350  {
351  global $ilAccess, $ilSetting, $tpl, $ilUser, $rbacadmin, $rbacsystem;
352 
353  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
354 
355  // User folder
356  if (!$rbacsystem->checkAccess('create_usr', $this->usrf_ref_id) &&
357  !$ilAccess->checkAccess('cat_administrate_users', "", $this->usrf_ref_id)) {
358  $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
359  }
360 
361  $this->initCreate();
362  $this->initForm("create");
363 
364  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
365  $profileMaybeIncomplete = false;
366  if ($this->form_gui->getInput('ignore_rf', false)) {
367  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
368  }
369 
370  if ($this->form_gui->checkInput()) {
371  // @todo: external account; time limit check and savings
372 
373  // checks passed. save user
374  $userObj = $this->loadValuesFromForm();
375 
376  $userObj->setPasswd($this->form_gui->getInput('passwd'), IL_PASSWD_PLAIN);
377  $userObj->setTitle($userObj->getFullname());
378  $userObj->setDescription($userObj->getEmail());
379 
380  $udf = array();
381  foreach ($_POST as $k => $v) {
382  if (substr($k, 0, 4) == "udf_") {
383  $udf[substr($k, 4)] = $v;
384  }
385  }
386  $userObj->setUserDefinedData($udf);
387 
388  $userObj->create();
389 
390  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
392  $userObj->setExternalAccount($_POST["ext_account"]);
393  }
394 
395  // set a timestamp for last_password_change
396  // this ts is needed by ilSecuritySettings
397  $userObj->setLastPasswordChangeTS(time());
398 
399  //insert user data in table user_data
400  $userObj->saveAsNew();
401 
402  // setup user preferences
403  if ($this->isSettingChangeable('language')) {
404  $userObj->setLanguage($_POST["language"]);
405  }
406 
407  // Set disk quota
408  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
410  // The disk quota is entered in megabytes but stored in bytes
411  $userObj->setPref("disk_quota", ilUtil::MB2Bytes($_POST["disk_quota"]));
412  }
413 
414  if ($this->isSettingChangeable('skin_style')) {
415  //set user skin and style
416  $sknst = explode(":", $_POST["skin_style"]);
417 
418  if ($userObj->getPref("style") != $sknst[1] ||
419  $userObj->getPref("skin") != $sknst[0]) {
420  $userObj->setPref("skin", $sknst[0]);
421  $userObj->setPref("style", $sknst[1]);
422  }
423  }
424  if ($this->isSettingChangeable('hits_per_page')) {
425  $userObj->setPref("hits_per_page", $_POST["hits_per_page"]);
426  }
427  /*if($this->isSettingChangeable('show_users_online'))
428  {
429  $userObj->setPref("show_users_online", $_POST["show_users_online"]);
430  }*/
431  if ($this->isSettingChangeable('hide_own_online_status')) {
432  $userObj->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
433  }
434  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
435  $userObj->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
436  }
437  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
438  $userObj->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
439  }
440  if ((int) $ilSetting->get('session_reminder_enabled')) {
441  $userObj->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
442  }
443  $userObj->writePrefs();
444 
445  //set role entries
446  $rbacadmin->assignUser($_POST["default_role"], $userObj->getId(), true);
447 
448  $msg = $this->lng->txt("user_added");
449 
450  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
451  $ilUser->writePrefs();
452 
453  $this->object = $userObj;
454 
455  if ($this->isSettingChangeable('upload')) {
456  $this->uploadUserPictureObject();
457  }
458 
459  if ($profileMaybeIncomplete) {
460  include_once 'Services/User/classes/class.ilUserProfile.php';
461  if (ilUserProfile::isProfileIncomplete($this->object)) {
462  $this->object->setProfileIncomplete(true);
463  $this->object->update();
464  }
465  }
466 
467  // send new account mail
468  if ($_POST['send_mail'] == 'y') {
469  include_once('Services/Mail/classes/class.ilAccountMail.php');
470  $acc_mail = new ilAccountMail();
471  $acc_mail->useLangVariablesAsFallback(true);
472  $acc_mail->setUserPassword($_POST['passwd']);
473  $acc_mail->setUser($userObj);
474 
475  if ($acc_mail->send()) {
476  $msg = $msg . '<br />' . $this->lng->txt('mail_sent');
477  ilUtil::sendSuccess($msg, true);
478  } else {
479  $msg = $msg . '<br />' . $this->lng->txt('mail_not_sent');
480  ilUtil::sendInfo($msg, true);
481  }
482  } else {
483  ilUtil::sendSuccess($msg, true);
484  }
485 
486 
487  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
488  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
489  } else {
490  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
491  }
492  } else {
493  $this->form_gui->setValuesByPost();
494  $tpl->setContent($this->form_gui->getHtml());
495  }
496  }
497 
503  public function editObject()
504  {
505  global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser
507 
508  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
509 
510  //load ILIAS settings
511  $settings = $ilias->getAllSettings();
512 
513  // User folder
514  if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
515  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
516  }
517  // if called from local administration $this->usrf_ref_id is category id
518  // Todo: this has to be fixed. Do not mix user folder id and category id
519  if ($this->usrf_ref_id != USER_FOLDER_ID) {
520  // check if user is assigned to category
521  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
522  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
523  }
524  }
525 
526  if ($this->usrf_ref_id != USER_FOLDER_ID) {
527  $this->tabs_gui->clearTargets();
528  }
529 
530  // get form
531  $this->initForm("edit");
532  $this->getValues();
533  $this->showAcceptedTermsOfService();
534  $this->tpl->setContent($this->form_gui->getHTML());
535  }
536 
541  protected function loadValuesFromForm($a_mode = 'create')
542  {
543  global $ilSetting,$ilUser;
544 
545  switch ($a_mode) {
546  case 'create':
547  $user = new ilObjUser();
548  break;
549 
550  case 'update':
552  break;
553  }
554 
555  $from = $this->form_gui->getItemByPostVar('time_limit_from')->getDate();
556  $user->setTimeLimitFrom($from
557  ? $from->get(IL_CAL_UNIX)
558  : null);
559 
560  $until = $this->form_gui->getItemByPostVar('time_limit_until')->getDate();
561  $user->setTimeLimitUntil($until
562  ? $until->get(IL_CAL_UNIX)
563  : null);
564 
565  $user->setTimeLimitUnlimited($this->form_gui->getInput('time_limit_unlimited'));
566 
567  if ($a_mode == 'create') {
568  $user->setTimeLimitOwner($this->usrf_ref_id);
569  }
570 
571  // Birthday
572  if ($this->isSettingChangeable('birthday')) {
573  $bd = $this->form_gui->getItemByPostVar('birthday');
574  $bd = $bd->getDate();
575  $user->setBirthday($bd
576  ? $bd->get(IL_CAL_DATE)
577  : null);
578  }
579 
580  // Login
581  $user->setLogin($this->form_gui->getInput('login'));
582 
583 
584  // Gender
585  if ($this->isSettingChangeable('gender')) {
586  $user->setGender($this->form_gui->getInput('gender'));
587  }
588 
589  // Title
590  if ($this->isSettingChangeable('title')) {
591  $user->setUTitle($this->form_gui->getInput('title'));
592  }
593 
594  // Firstname
595  if ($this->isSettingChangeable('firstname')) {
596  $user->setFirstname($this->form_gui->getInput('firstname'));
597  }
598  // Lastname
599  if ($this->isSettingChangeable('lastname')) {
600  $user->setLastname($this->form_gui->getInput('lastname'));
601  }
602  $user->setFullname();
603 
604  // Institution
605  if ($this->isSettingChangeable('institution')) {
606  $user->setInstitution($this->form_gui->getInput('institution'));
607  }
608 
609  // Department
610  if ($this->isSettingChangeable('department')) {
611  $user->setDepartment($this->form_gui->getInput('department'));
612  }
613  // Street
614  if ($this->isSettingChangeable('street')) {
615  $user->setStreet($this->form_gui->getInput('street'));
616  }
617  // City
618  if ($this->isSettingChangeable('city')) {
619  $user->setCity($this->form_gui->getInput('city'));
620  }
621  // Zipcode
622  if ($this->isSettingChangeable('zipcode')) {
623  $user->setZipcode($this->form_gui->getInput('zipcode'));
624  }
625  // Country
626  if ($this->isSettingChangeable('country')) {
627  $user->setCountry($this->form_gui->getInput('country'));
628  }
629  // Selected Country
630  if ($this->isSettingChangeable('sel_country')) {
631  $user->setSelectedCountry($this->form_gui->getInput('sel_country'));
632  }
633  // Phone Office
634  if ($this->isSettingChangeable('phone_office')) {
635  $user->setPhoneOffice($this->form_gui->getInput('phone_office'));
636  }
637  // Phone Home
638  if ($this->isSettingChangeable('phone_home')) {
639  $user->setPhoneHome($this->form_gui->getInput('phone_home'));
640  }
641  // Phone Mobile
642  if ($this->isSettingChangeable('phone_mobile')) {
643  $user->setPhoneMobile($this->form_gui->getInput('phone_mobile'));
644  }
645  // Fax
646  if ($this->isSettingChangeable('fax')) {
647  $user->setFax($this->form_gui->getInput('fax'));
648  }
649  // Matriculation
650  if ($this->isSettingChangeable('matriculation')) {
651  $user->setMatriculation($this->form_gui->getInput('matriculation'));
652  }
653  // Email
654  if ($this->isSettingChangeable('email')) {
655  $user->setEmail($this->form_gui->getInput('email'));
656  }
657  // Second Email
658  if ($this->isSettingChangeable('second_email')) {
659  $user->setSecondEmail($this->form_gui->getInput('second_email'));
660  }
661  // Hobby
662  if ($this->isSettingChangeable('hobby')) {
663  $user->setHobby($this->form_gui->getInput('hobby'));
664  }
665  // Referral Comment
666  if ($this->isSettingChangeable('referral_comment')) {
667  $user->setComment($this->form_gui->getInput('referral_comment'));
668  }
669 
670  // interests
671  $user->setGeneralInterests($this->form_gui->getInput('interests_general'));
672  $user->setOfferingHelp($this->form_gui->getInput('interests_help_offered'));
673  $user->setLookingForHelp($this->form_gui->getInput('interests_help_looking'));
674 
675  // ClientIP
676  $user->setClientIP($this->form_gui->getInput('client_ip'));
677 
678  // Google maps
679  $user->setLatitude($this->form_gui->getInput('latitude'));
680  $user->setLongitude($this->form_gui->getInput('longitude'));
681  $user->setLocationZoom($this->form_gui->getInput('loc_zoom'));
682 
683  // External account
684  $user->setAuthMode($this->form_gui->getInput('auth_mode'));
685  $user->setExternalAccount($this->form_gui->getInput('ext_account'));
686 
687  if ((int) $user->getActive() != (int) $this->form_gui->getInput('active')) {
688  $user->setActive($this->form_gui->getInput('active'), $ilUser->getId());
689  }
690 
691  return $user;
692  }
693 
694 
698  public function updateObject()
699  {
700  global $tpl, $rbacsystem, $ilias, $ilUser, $ilSetting;
701 
702  // User folder
703  if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write', $this->usrf_ref_id)) {
704  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
705  }
706  // if called from local administration $this->usrf_ref_id is category id
707  // Todo: this has to be fixed. Do not mix user folder id and category id
708  if ($this->usrf_ref_id != USER_FOLDER_ID) {
709  // check if user is assigned to category
710  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
711  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
712  }
713  }
714  $this->initForm("edit");
715 
716  // we do not want to store this dates, they are only printed out
717  unset($_POST['approve_date']);
718  $_POST['agree_date'] = $this->object->getAgreeDate();
719  unset($_POST['last_login']);
720 
721  // Manipulate form so ignore required fields are no more required. This has to be done before ilPropertyFormGUI::checkInput() is called.
722  $profileMaybeIncomplete = false;
723  if ($this->form_gui->getInput('ignore_rf', false)) {
724  $profileMaybeIncomplete = $this->handleIgnoredRequiredFields();
725  }
726 
727  if ($this->form_gui->checkInput()) {
728  // @todo: external account; time limit
729  // if not allowed or empty -> do no change password
731  && trim($_POST['passwd']) != "") {
732  $this->object->setPasswd($_POST['passwd'], IL_PASSWD_PLAIN);
733  }
734 
735  /*
736  * reset counter for failed logins
737  * if $_POST['active'] is set to 1
738  */
739  if ($_POST['active'] == 1) {
740  ilObjUser::_resetLoginAttempts($this->object->getId());
741  }
742 
743  #$this->object->assignData($_POST);
744  $this->loadValuesFromForm('update');
745 
746  $udf = array();
747  foreach ($_POST as $k => $v) {
748  if (substr($k, 0, 4) == "udf_") {
749  $udf[substr($k, 4)] = $v;
750  }
751  }
752  $this->object->setUserDefinedData($udf);
753 
754  try {
755  $this->object->updateLogin($_POST['login']);
756  } catch (ilUserException $e) {
757  ilUtil::sendFailure($e->getMessage());
758  $this->form_gui->setValuesByPost();
759  return $tpl->setContent($this->form_gui->getHtml());
760  }
761 
762  $this->object->setTitle($this->object->getFullname());
763  $this->object->setDescription($this->object->getEmail());
764 
765  if ($this->isSettingChangeable('language')) {
766  $this->object->setLanguage($this->form_gui->getInput('language'));
767  }
768 
769  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
771  // set disk quota
772  $this->object->setPref("disk_quota", ilUtil::MB2Bytes($_POST["disk_quota"]));
773  }
775  // set personal workspace disk quota
776  $this->object->setPref("wsp_disk_quota", ilUtil::MB2Bytes($_POST["wsp_disk_quota"]));
777  }
778 
779  if ($this->isSettingChangeable('skin_style')) {
780  //set user skin and style
781  $sknst = explode(":", $_POST["skin_style"]);
782 
783  if ($this->object->getPref("style") != $sknst[1] ||
784  $this->object->getPref("skin") != $sknst[0]) {
785  $this->object->setPref("skin", $sknst[0]);
786  $this->object->setPref("style", $sknst[1]);
787  }
788  }
789  if ($this->isSettingChangeable('hits_per_page')) {
790  $this->object->setPref("hits_per_page", $_POST["hits_per_page"]);
791  }
792  /*if($this->isSettingChangeable('show_users_online'))
793  {
794  $this->object->setPref("show_users_online", $_POST["show_users_online"]);
795  }*/
796  if ($this->isSettingChangeable('hide_own_online_status')) {
797  $this->object->setPref("hide_own_online_status", $_POST["hide_own_online_status"]);
798  }
799  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
800  $this->object->setPref('bs_allow_to_contact_me', $_POST['bs_allow_to_contact_me'] ? 'y' : 'n');
801  }
802  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
803  $this->object->setPref('chat_osc_accept_msg', $_POST['chat_osc_accept_msg'] ? 'y' : 'n');
804  }
805 
806  // set a timestamp for last_password_change
807  // this ts is needed by ilSecuritySettings
808  $this->object->setLastPasswordChangeTS(time());
809 
810  global $ilSetting;
811  if ((int) $ilSetting->get('session_reminder_enabled')) {
812  $this->object->setPref('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
813  }
814 
815  // #10054 - profile may have been completed, check below is only for incomplete
816  $this->object->setProfileIncomplete(false);
817 
818  $this->update = $this->object->update();
819 
820 
821  // If the current user is editing its own user account,
822  // we update his preferences.
823  if ($ilUser->getId() == $this->object->getId()) {
824  $ilUser->readPrefs();
825  }
826  $ilUser->setPref('send_info_mails', ($_POST['send_mail'] == 'y') ? 'y' : 'n');
827  $ilUser->writePrefs();
828 
829  $mail_message = $this->__sendProfileMail();
830  $msg = $this->lng->txt('saved_successfully') . $mail_message;
831 
832  // same personal image
833  if ($this->isSettingChangeable('upload')) {
834  $this->uploadUserPictureObject();
835  }
836 
837  if ($profileMaybeIncomplete) {
838  include_once 'Services/User/classes/class.ilUserProfile.php';
839  if (ilUserProfile::isProfileIncomplete($this->object)) {
840  $this->object->setProfileIncomplete(true);
841  $this->object->update();
842  }
843  }
844 
845  // feedback
846  ilUtil::sendSuccess($msg, true);
847 
848  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
849  $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
850  } else {
851  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
852  }
853  } else {
854  $this->form_gui->setValuesByPost();
855  $tpl->setContent($this->form_gui->getHtml());
856  }
857  }
858 
862  public function getValues()
863  {
864  global $ilUser, $ilSetting;
865 
866  $data = array();
867 
868  // login data
869  $data["auth_mode"] = $this->object->getAuthMode();
870  $data["login"] = $this->object->getLogin();
871  //$data["passwd"] = "********";
872  //$data["passwd2"] = "********";
873  $data["ext_account"] = $this->object->getExternalAccount();
874 
875  // system information
876  $data["create_date"] = ilDatePresentation::formatDate(new ilDateTime($this->object->getCreateDate(), IL_CAL_DATETIME));
877  $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
878  $data["approve_date"] = ($this->object->getApproveDate() != "")
879  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getApproveDate(), IL_CAL_DATETIME))
880  : null;
881  $data["agree_date"] = ($this->object->getAgreeDate() != "")
882  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getAgreeDate(), IL_CAL_DATETIME))
883  : null;
884  $data["last_login"] = ($this->object->getLastLogin() != "")
885  ? ilDatePresentation::formatDate(new ilDateTime($this->object->getLastLogin(), IL_CAL_DATETIME))
886  : null;
887  $data["active"] = $this->object->getActive();
888  $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited();
889 
890  $data["time_limit_from"] = $this->object->getTimeLimitFrom()
891  ? new ilDateTime($this->object->getTimeLimitFrom(), IL_CAL_UNIX)
892  : null;
893  $data["time_limit_until"] = $this->object->getTimeLimitUntil()
894  ? new ilDateTime($this->object->getTimeLimitUntil(), IL_CAL_UNIX)
895  : null;
896 
897 
898  // BEGIN DiskQuota, Show disk space used
899  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
901  $data["disk_quota"] = ilUtil::Bytes2MB($this->object->getDiskQuota());
902  }
904  $data["wsp_disk_quota"] = ilUtil::Bytes2MB($this->object->getPersonalWorkspaceDiskQuota());
905  }
906  // W. Randelshofer 2008-09-09: Deactivated display of disk space usage,
907  // because determining the disk space usage may take several minutes.
908  /*
909  require_once "Modules/File/classes/class.ilObjFileAccess.php";
910  require_once "Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
911  require_once "Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
912  require_once "Services/Mail/classes/class.ilObjMailAccess.php";
913  require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
914  require_once "Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
915  $data["disk_space_used"] =
916  ilObjFileAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
917  ilObjFileBasedLMAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
918  ilObjSAHSLearningModuleAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
919  ilObjMailAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
920  ilObjForumAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
921  ilObjMediaCastAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>';
922  */
923  // END DiskQuota, Show disk space used
924 
925  // personal data
926  $data["gender"] = $this->object->getGender();
927  $data["firstname"] = $this->object->getFirstname();
928  $data["lastname"] = $this->object->getLastname();
929  $data["title"] = $this->object->getUTitle();
930  $data['birthday'] = $this->object->getBirthday()
931  ? new ilDate($this->object->getBirthday(), IL_CAL_DATE)
932  : null;
933  $data["institution"] = $this->object->getInstitution();
934  $data["department"] = $this->object->getDepartment();
935  $data["street"] = $this->object->getStreet();
936  $data["city"] = $this->object->getCity();
937  $data["zipcode"] = $this->object->getZipcode();
938  $data["country"] = $this->object->getCountry();
939  $data["sel_country"] = $this->object->getSelectedCountry();
940  $data["phone_office"] = $this->object->getPhoneOffice();
941  $data["phone_home"] = $this->object->getPhoneHome();
942  $data["phone_mobile"] = $this->object->getPhoneMobile();
943  $data["fax"] = $this->object->getFax();
944  $data["email"] = $this->object->getEmail();
945  $data["second_email"] = $this->object->getSecondEmail();
946  $data["hobby"] = $this->object->getHobby();
947  $data["referral_comment"] = $this->object->getComment();
948 
949  // interests
950  $data["interests_general"] = $this->object->getGeneralInterests();
951  $data["interests_help_offered"] = $this->object->getOfferingHelp();
952  $data["interests_help_looking"] = $this->object->getLookingForHelp();
953 
954  // other data
955  $data["matriculation"] = $this->object->getMatriculation();
956  $data["client_ip"] = $this->object->getClientIP();
957 
958  // user defined fields
959  include_once './Services/User/classes/class.ilUserDefinedFields.php';
960  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
961  $user_defined_data = $this->object->getUserDefinedData();
962  foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
963  $data["udf_" . $field_id] = $user_defined_data["f_" . $field_id];
964  }
965 
966  // settings
967  $data["language"] = $this->object->getLanguage();
968  $data["skin_style"] = $this->object->skin . ":" . $this->object->prefs["style"];
969  $data["hits_per_page"] = $this->object->prefs["hits_per_page"];
970  //$data["show_users_online"] = $this->object->prefs["show_users_online"];
971  $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"];
972  $data['bs_allow_to_contact_me'] = $this->object->prefs['bs_allow_to_contact_me'] == 'y';
973  $data['chat_osc_accept_msg'] = $this->object->prefs['chat_osc_accept_msg'] == 'y';
974  $data["session_reminder_enabled"] = (int) $this->object->prefs["session_reminder_enabled"];
975 
976  $data["send_mail"] = ($this->object->prefs['send_info_mails'] == 'y');
977 
978 
979  $this->form_gui->setValuesByArray($data);
980  }
981 
985  public function initForm($a_mode)
986  {
987  global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser;
988 
989  $settings = $ilSetting->getAll();
990 
991  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
992 
993  $this->form_gui = new ilPropertyFormGUI();
994  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
995  if ($a_mode == "create") {
996  $this->form_gui->setTitle($lng->txt("usr_new"));
997  } else {
998  $this->form_gui->setTitle($lng->txt("usr_edit"));
999  }
1000 
1001  // login data
1002  $sec_l = new ilFormSectionHeaderGUI();
1003  $sec_l->setTitle($lng->txt("login_data"));
1004  $this->form_gui->addItem($sec_l);
1005 
1006  // authentication mode
1007  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
1008  $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
1009  $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode");
1010  $option = array();
1011  foreach ($active_auth_modes as $auth_name => $auth_key) {
1012  if ($auth_name == 'default') {
1013  $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
1014  } else {
1015  // begin-patch ldap_multiple
1016  #$name = $this->lng->txt('auth_'.$auth_name);
1017  include_once './Services/Authentication/classes/class.ilAuthUtils.php';
1019  // end-patch ldap_multiple
1020  }
1021  $option[$auth_name] = $name;
1022  }
1023  $am->setOptions($option);
1024  $this->form_gui->addItem($am);
1025 
1026  if ($a_mode == "edit") {
1027  $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id");
1028  $id->setValue($this->object->getId());
1029  $this->form_gui->addItem($id);
1030  }
1031 
1032  // login
1033  $lo = new ilUserLoginInputGUI($lng->txt("login"), "login");
1034  $lo->setRequired(true);
1035  if ($a_mode == "edit") {
1036  $lo->setCurrentUserId($this->object->getId());
1037  try {
1038  include_once 'Services/Calendar/classes/class.ilDate.php';
1039 
1040  $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
1041  $lo->setInfo(
1042  sprintf(
1043  $this->lng->txt('usr_loginname_history_info'),
1044  ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)),
1045  $last_history_entry[0]
1046  )
1047  );
1048  } catch (ilUserException $e) {
1049  }
1050  }
1051 
1052  $this->form_gui->addItem($lo);
1053 
1054  // passwords
1055  // @todo: do not show passwords, if there is not a single auth, that
1056  // allows password setting
1057  {
1058  $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd");
1059  $pw->setUseStripSlashes(false);
1060  $pw->setSize(32);
1061  $pw->setMaxLength(80); // #17221
1062  $pw->setValidateAuthPost("auth_mode");
1063  if ($a_mode == "create") {
1064  $pw->setRequiredOnAuth(true);
1065  }
1066  $pw->setInfo(ilUtil::getPasswordRequirementsInfo());
1067  $this->form_gui->addItem($pw);
1068  }
1069  // @todo: invisible/hidden passwords
1070 
1071  // external account
1072  include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
1074  $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account");
1075  $ext->setSize(40);
1076  $ext->setMaxLength(250);
1077  $ext->setInfo($lng->txt("user_ext_account_desc"));
1078  $this->form_gui->addItem($ext);
1079  }
1080 
1081  // login data
1082  $sec_si = new ilFormSectionHeaderGUI();
1083  $sec_si->setTitle($this->lng->txt("system_information"));
1084  $this->form_gui->addItem($sec_si);
1085 
1086  // create date, approve date, agreement date, last login
1087  if ($a_mode == "edit") {
1088  $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner");
1089  foreach ($sia as $a) {
1090  $siai = new ilNonEditableValueGUI($lng->txt($a), $a);
1091  $this->form_gui->addItem($siai);
1092  }
1093  }
1094 
1095  // active
1096  $ac = new ilCheckboxInputGUI($lng->txt("active"), "active");
1097  $ac->setChecked(true);
1098  $this->form_gui->addItem($ac);
1099 
1100  // access @todo: get fields right (names change)
1101  $lng->loadLanguageModule('crs');
1102 
1103  // access
1104  $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
1105  $radg->setValue(1);
1106  $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1);
1107  $radg->addOption($op1);
1108  $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0);
1109  $radg->addOption($op2);
1110 
1111  // $ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
1112  // $ac->setChecked(true);
1113  // $ac->setOptionTitle($lng->txt("crs_unlimited"));
1114 
1115  // access.from
1116  $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
1117  $acfrom->setRequired(true);
1118  $acfrom->setShowTime(true);
1119  // $ac->addSubItem($acfrom);
1120  $op2->addSubItem($acfrom);
1121 
1122  // access.to
1123  $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
1124  $acto->setRequired(true);
1125  $acto->setShowTime(true);
1126  // $ac->addSubItem($acto);
1127  $op2->addSubItem($acto);
1128 
1129  // $this->form_gui->addItem($ac);
1130  $this->form_gui->addItem($radg);
1131 
1132  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
1134  $lng->loadLanguageModule("file");
1135 
1136  $quota_head = new ilFormSectionHeaderGUI();
1137  $quota_head->setTitle($lng->txt("repository_disk_quota"));
1138  $this->form_gui->addItem($quota_head);
1139 
1140  // disk quota
1141  $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota");
1142  $disk_quota->setSize(10);
1143  $disk_quota->setMaxLength(11);
1144  $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
1145  $this->form_gui->addItem($disk_quota);
1146 
1147  if ($a_mode == "edit") {
1148  // show which disk quota is in effect, and explain why
1149  require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
1150  $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId());
1151  if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) {
1152  $info_text = sprintf(
1153  $lng->txt('disk_quota_is_1_instead_of_2_by_3'),
1154  ilUtil::formatSize($dq_info['user_disk_quota'], 'short'),
1155  ilUtil::formatSize($dq_info['role_disk_quota'], 'short'),
1156  $dq_info['role_title']
1157  );
1158  } elseif (is_infinite($dq_info['role_disk_quota'])) {
1159  $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
1160  } else {
1161  $info_text = sprintf(
1162  $lng->txt('disk_quota_is_1_by_2'),
1163  ilUtil::formatSize($dq_info['role_disk_quota'], 'short'),
1164  $dq_info['role_title']
1165  );
1166  }
1167  $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
1168 
1169 
1170  // disk usage
1171  $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId());
1172  $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
1173  if ($du_info['last_update'] === null) {
1174  $disk_usage->setValue($lng->txt('unknown'));
1175  } else {
1176  $disk_usage->setValue(ilUtil::formatSize($du_info['disk_usage'], 'short'));
1177  $info = '<table class="il_user_quota_disk_usage_overview">';
1178  // write the count and size of each object type
1179  foreach ($du_info['details'] as $detail_data) {
1180  $info .= '<tr>' .
1181  '<td class="std">' . $detail_data['count'] . '</td>' .
1182  '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' .
1183  '<td class="std">' . ilUtil::formatSize($detail_data['size'], 'short') . '</td>' .
1184  '</tr>'
1185  ;
1186  }
1187  $info .= '</table>';
1188  $info .= '<br>' . $this->lng->txt('last_update') . ': ' .
1189  ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME));
1190  $disk_usage->setInfo($info);
1191  }
1192  $this->form_gui->addItem($disk_usage);
1193 
1194  // date when the last disk quota reminder was sent to the user
1195  if (true || $dq_info['last_reminder']) {
1196  $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder");
1197  $reminder->setValue(
1198  ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME))
1199  );
1200  $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc"));
1201  $this->form_gui->addItem($reminder);
1202  }
1203  }
1204  }
1205 
1207  $lng->loadLanguageModule("file");
1208 
1209  $quota_head = new ilFormSectionHeaderGUI();
1210  $quota_head->setTitle($lng->txt("personal_workspace_disk_quota"));
1211  $this->form_gui->addItem($quota_head);
1212 
1213  // personal workspace disk quota
1214  $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota");
1215  $wsp_disk_quota->setSize(10);
1216  $wsp_disk_quota->setMaxLength(11);
1217  $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
1218  $this->form_gui->addItem($wsp_disk_quota);
1219 
1220  if ($a_mode == "edit") {
1221  // show which disk quota is in effect, and explain why
1222  require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
1224  if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota']) {
1225  $info_text = sprintf(
1226  $lng->txt('disk_quota_is_1_instead_of_2_by_3'),
1227  ilUtil::formatSize($dq_info['user_wsp_disk_quota'], 'short'),
1228  ilUtil::formatSize($dq_info['role_wsp_disk_quota'], 'short'),
1229  $dq_info['role_title']
1230  );
1231  } elseif (is_infinite($dq_info['role_wsp_disk_quota'])) {
1232  $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
1233  } else {
1234  $info_text = sprintf(
1235  $lng->txt('disk_quota_is_1_by_2'),
1236  ilUtil::formatSize($dq_info['role_wsp_disk_quota'], 'short'),
1237  $dq_info['role_title']
1238  );
1239  }
1240  $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
1241  }
1242 
1243  // disk usage
1244  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
1245  $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId());
1246  $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
1247  if (!sizeof($du_info)) {
1248  $disk_usage->setValue($lng->txt('unknown'));
1249  } else {
1250  $disk_usage->setValue(ilUtil::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId())));
1251  $info = '<table class="il_user_quota_disk_usage_overview">';
1252  // write the count and size of each object type
1253  foreach ($du_info as $detail_data) {
1254  $info .= '<tr>' .
1255  '<td class="std">' . $detail_data['count'] . '</td>' .
1256  '<td class="std">' . $lng->txt("obj_" . $detail_data["src_type"]) . '</td>' .
1257  '<td class="std">' . ilUtil::formatSize($detail_data['filesize'], 'short') . '</td>' .
1258  '</tr>'
1259  ;
1260  }
1261  $info .= '</table>';
1262  $disk_usage->setInfo($info);
1263  }
1264  $this->form_gui->addItem($disk_usage);
1265  }
1266 
1267  // personal data
1268  if (
1269  $this->isSettingChangeable('gender') or
1270  $this->isSettingChangeable('firstname') or
1271  $this->isSettingChangeable('lastname') or
1272  $this->isSettingChangeable('title') or
1273  $this->isSettingChangeable('personal_image') or
1274  $this->isSettingChangeable('birhtday')
1275  ) {
1276  $sec_pd = new ilFormSectionHeaderGUI();
1277  $sec_pd->setTitle($this->lng->txt("personal_data"));
1278  $this->form_gui->addItem($sec_pd);
1279  }
1280 
1281  // gender
1282  if ($this->isSettingChangeable('gender')) {
1283  $gndr = new ilRadioGroupInputGUI($lng->txt("salutation"), "gender");
1284  $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]);
1285  $neutral = new ilRadioOption($lng->txt("salutation_n"), "n");
1286  $gndr->addOption($neutral);
1287  $female = new ilRadioOption($lng->txt("salutation_f"), "f");
1288  $gndr->addOption($female);
1289  $male = new ilRadioOption($lng->txt("salutation_m"), "m");
1290  $gndr->addOption($male);
1291  $this->form_gui->addItem($gndr);
1292  }
1293 
1294  // firstname, lastname, title
1295  $fields = array("firstname" => true, "lastname" => true,
1296  "title" => isset($settings["require_title"]) && $settings["require_title"]);
1297  foreach ($fields as $field => $req) {
1298  if ($this->isSettingChangeable($field)) {
1299  // #18795
1300  $caption = ($field == "title")
1301  ? "person_title"
1302  : $field;
1303  $inp = new ilTextInputGUI($lng->txt($caption), $field);
1304  $inp->setSize(32);
1305  $inp->setMaxLength(32);
1306  $inp->setRequired($req);
1307  $this->form_gui->addItem($inp);
1308  }
1309  }
1310 
1311  // personal image
1312  if ($this->isSettingChangeable('upload')) {
1313  $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
1314  if ($a_mode == "edit" || $a_mode == "upload") {
1315  $pi->setImage(ilObjUser::_getPersonalPicturePath(
1316  $this->object->getId(),
1317  "small",
1318  true,
1319  true
1320  ));
1321  }
1322  $this->form_gui->addItem($pi);
1323  }
1324 
1325  if ($this->isSettingChangeable('birthday')) {
1326  $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday');
1327  $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]);
1328  $this->form_gui->addItem($birthday);
1329  }
1330 
1331 
1332  // institution, department, street, city, zip code, country, phone office
1333  // phone home, phone mobile, fax, e-mail
1334  $fields = array(
1335  array("institution", 40, 80),
1336  array("department", 40, 80),
1337  array("street", 40, 40),
1338  array("city", 40, 40),
1339  array("zipcode", 10, 10),
1340  array("country", 40, 40),
1341  array("sel_country"),
1342  array("phone_office", 30, 30),
1343  array("phone_home", 30, 30),
1344  array("phone_mobile", 30, 30),
1345  array("fax", 30, 30));
1346 
1347  $counter = 0;
1348  foreach ($fields as $field) {
1349  if (!$counter++ and $this->isSettingChangeable($field[0])) {
1350  // contact data
1351  $sec_cd = new ilFormSectionHeaderGUI();
1352  $sec_cd->setTitle($this->lng->txt("contact_data"));
1353  $this->form_gui->addItem($sec_cd);
1354 
1355  // org units
1356  if ($a_mode == "edit") {
1357  $orgus = new ilNonEditableValueGUI($lng->txt('objs_orgu'), 'org_units');
1358  $orgus->setValue($this->object->getOrgUnitsRepresentation());
1359  $this->form_gui->addItem($orgus);
1360  }
1361  }
1362  if ($this->isSettingChangeable($field[0])) {
1363  if ($field[0] != "sel_country") {
1364  $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]);
1365  $inp->setSize($field[1]);
1366  $inp->setMaxLength($field[2]);
1367  $inp->setRequired(isset($settings["require_" . $field[0]]) &&
1368  $settings["require_" . $field[0]]);
1369  $this->form_gui->addItem($inp);
1370  } else {
1371  // country selection
1372  include_once("./Services/Form/classes/class.ilCountrySelectInputGUI.php");
1373  $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]);
1374  $cs->setRequired(isset($settings["require_" . $field[0]]) &&
1375  $settings["require_" . $field[0]]);
1376  $this->form_gui->addItem($cs);
1377  }
1378  }
1379  }
1380 
1381  // email
1382  if ($this->isSettingChangeable('email')) {
1383  $em = new ilEMailInputGUI($lng->txt("email"), "email");
1384  $em->setRequired(isset($settings["require_email"]) &&
1385  $settings["require_email"]);
1386  $this->form_gui->addItem($em);
1387  }
1388 
1389  // second email
1390  if ($this->isSettingChangeable('second_email')) {
1391  $em = new ilEMailInputGUI($lng->txt("second_email"), "second_email");
1392 
1393  $this->form_gui->addItem($em);
1394  }
1395 
1396  // interests/hobbies
1397  if ($this->isSettingChangeable('hobby')) {
1398  $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby");
1399  $hob->setRows(3);
1400  $hob->setCols(40);
1401  $hob->setRequired(isset($settings["require_hobby"]) &&
1402  $settings["require_hobby"]);
1403  $this->form_gui->addItem($hob);
1404  }
1405 
1406  // referral comment
1407  if ($this->isSettingChangeable('referral_comment')) {
1408  $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment");
1409  $rc->setRows(3);
1410  $rc->setCols(40);
1411  $rc->setRequired(isset($settings["require_referral_comment"]) &&
1412  $settings["require_referral_comment"]);
1413  $this->form_gui->addItem($rc);
1414  }
1415 
1416 
1417  // interests
1418 
1419  $sh = new ilFormSectionHeaderGUI();
1420  $sh->setTitle($lng->txt("interests"));
1421  $this->form_gui->addItem($sh);
1422 
1423  $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
1424  foreach ($multi_fields as $multi_field) {
1425  if ($this->isSettingChangeable($multi_field)) {
1426  // see ilUserProfile
1427  $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field);
1428  $ti->setMulti(true);
1429  $ti->setMaxLength(40);
1430  $ti->setSize(40);
1431  $ti->setRequired(isset($settings["require_" . $multi_field]) &&
1432  $settings["require_" . $multi_field]);
1433  $this->form_gui->addItem($ti);
1434  }
1435  }
1436 
1437 
1438  // other information
1439  if ($this->isSettingChangeable('user_profile_other')) {
1440  $sec_oi = new ilFormSectionHeaderGUI();
1441  $sec_oi->setTitle($this->lng->txt("user_profile_other"));
1442  $this->form_gui->addItem($sec_oi);
1443  }
1444 
1445  // matriculation number
1446  if ($this->isSettingChangeable('matriculation')) {
1447  $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation");
1448  $mr->setSize(40);
1449  $mr->setMaxLength(40);
1450  $mr->setRequired(isset($settings["require_matriculation"]) &&
1451  $settings["require_matriculation"]);
1452  $this->form_gui->addItem($mr);
1453  }
1454 
1455  // client IP
1456  $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip");
1457  $ip->setSize(40);
1458  $ip->setMaxLength(255);
1459  $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" .
1460  '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>");
1461  $this->form_gui->addItem($ip);
1462 
1463  // additional user defined fields
1464  include_once './Services/User/classes/class.ilUserDefinedFields.php';
1465  $user_defined_fields = ilUserDefinedFields::_getInstance();
1466 
1467  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1468  $all_defs = $user_defined_fields->getDefinitions();
1469  } else {
1470  $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions();
1471  }
1472 
1473  foreach ($all_defs as $field_id => $definition) {
1474  if ($definition['field_type'] == UDF_TYPE_TEXT) { // text input
1475  $udf = new ilTextInputGUI(
1476  $definition['field_name'],
1477  "udf_" . $definition['field_id']
1478  );
1479  $udf->setSize(40);
1480  $udf->setMaxLength(255);
1481  } elseif ($definition['field_type'] == UDF_TYPE_WYSIWYG) { // text area input
1482  $udf = new ilTextAreaInputGUI(
1483  $definition['field_name'],
1484  "udf_" . $definition['field_id']
1485  );
1486  $udf->setUseRte(true);
1487  } else { // selection input
1488  $udf = new ilSelectInputGUI(
1489  $definition['field_name'],
1490  "udf_" . $definition['field_id']
1491  );
1492  $udf->setOptions($user_defined_fields->fieldValuesToSelectArray(
1493  $definition['field_values']
1494  ));
1495  }
1496  $udf->setRequired($definition['required']);
1497  $this->form_gui->addItem($udf);
1498  }
1499 
1500  // settings
1501  if (
1502  $a_mode == 'create' or
1503  $this->isSettingChangeable('language') or
1504  $this->isSettingChangeable('skin_style') or
1505  $this->isSettingChangeable('hits_per_page') or
1506  $this->isSettingChangeable('hide_own_online_status') or
1507  $this->isSettingChangeable('bs_allow_to_contact_me') or
1508  $this->isSettingChangeable('chat_osc_accept_msg')
1509  ) {
1510  $sec_st = new ilFormSectionHeaderGUI();
1511  $sec_st->setTitle($this->lng->txt("settings"));
1512  $this->form_gui->addItem($sec_st);
1513  }
1514 
1515  // role
1516  if ($a_mode == "create") {
1517  $role = new ilSelectInputGUI(
1518  $lng->txt("default_role"),
1519  'default_role'
1520  );
1521  $role->setRequired(true);
1522  $role->setValue($this->default_role);
1523  $role->setOptions($this->selectable_roles);
1524  $this->form_gui->addItem($role);
1525  }
1526 
1527  // language
1528  if ($this->isSettingChangeable('language')) {
1529  $lang = new ilSelectInputGUI(
1530  $lng->txt("language"),
1531  'language'
1532  );
1533  $languages = $lng->getInstalledLanguages();
1534  $lng->loadLanguageModule("meta");
1535  $options = array();
1536  foreach ($languages as $l) {
1537  $options[$l] = $lng->txt("meta_l_" . $l);
1538  }
1539  $lang->setOptions($options);
1540  $lang->setValue($ilSetting->get("language"));
1541  $this->form_gui->addItem($lang);
1542  }
1543 
1544  // skin/style
1545  if ($this->isSettingChangeable('skin_style')) {
1546  $sk = new ilSelectInputGUI(
1547  $lng->txt("skin_style"),
1548  'skin_style'
1549  );
1553  $skins = $styleDefinition->getAllSkins();
1554 
1555  $options = array();
1556  if (is_array($skins)) {
1557  $sk = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
1558 
1559  $options = array();
1560  foreach ($skins as $skin) {
1561  foreach ($skin->getStyles() as $style) {
1562  include_once("./Services/Style/System/classes/class.ilSystemStyleSettings.php");
1563  if (!ilSystemStyleSettings::_lookupActivatedStyle($skin->getId(), $style->getId())) {
1564  continue;
1565  }
1566 
1567  $options[$skin->getId() . ":" . $style->getId()] = $skin->getName() . " / " . $style->getName();
1568  }
1569  }
1570  }
1571  $sk->setOptions($options);
1572  $sk->setValue($ilClientIniFile->readVariable("layout", "skin") .
1573  ":" . $ilClientIniFile->readVariable("layout", "style"));
1574 
1575  $this->form_gui->addItem($sk);
1576  }
1577 
1578  // hits per page
1579  if ($this->isSettingChangeable('hits_per_page')) {
1580  $hpp = new ilSelectInputGUI(
1581  $lng->txt("hits_per_page"),
1582  'hits_per_page'
1583  );
1584  $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40,
1585  50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit"));
1586  $hpp->setOptions($options);
1587  $hpp->setValue($ilSetting->get("hits_per_page"));
1588  $this->form_gui->addItem($hpp);
1589 
1590  // users online
1591  /*$uo = new ilSelectInputGUI($lng->txt("users_online"),
1592  'show_users_online');
1593  $options = array(
1594  "y" => $lng->txt("users_online_show_y"),
1595  "associated" => $lng->txt("users_online_show_associated"),
1596  "n" => $lng->txt("users_online_show_n"));
1597  $uo->setOptions($options);
1598  $uo->setValue($ilSetting->get("show_users_online"));
1599  $this->form_gui->addItem($uo);*/
1600  }
1601 
1602  // hide online status
1603  if ($this->isSettingChangeable('hide_own_online_status')) {
1604  $lng->loadLanguageModule("awrn");
1605 
1606  $default = ($ilSetting->get('hide_own_online_status') == "n")
1607  ? $this->lng->txt("user_awrn_show")
1608  : $this->lng->txt("user_awrn_hide");
1609 
1610  $options = array(
1611  "" => $this->lng->txt("user_awrn_default")." (".$default.")",
1612  "n" => $this->lng->txt("user_awrn_show"),
1613  "y" => $this->lng->txt("user_awrn_hide"));
1614  $os = new ilSelectInputGUI($lng->txt("awrn_user_show"), "hide_own_online_status");
1615  $os->setOptions($options);
1616  $os->setDisabled($ilSetting->get("usr_settings_disable_hide_own_online_status"));
1617  $os->setInfo($lng->txt("awrn_hide_from_awareness_info"));
1618  $this->form_gui->addItem($os);
1619 
1620 
1621  //$os = new ilCheckboxInputGUI($lng->txt("awrn_hide_from_awareness"), "hide_own_online_status");
1622  //$this->form_gui->addItem($os);
1623  }
1624 
1625  // allow to contact me
1626  if ($this->isSettingChangeable('bs_allow_to_contact_me')) {
1627  $lng->loadLanguageModule('buddysystem');
1628  $os = new ilCheckboxInputGUI($lng->txt('buddy_allow_to_contact_me'), 'bs_allow_to_contact_me');
1629  if ($a_mode == 'create') {
1630  $os->setChecked(ilUtil::yn2tf($ilSetting->get('bs_allow_to_contact_me', 'n')));
1631  }
1632  $this->form_gui->addItem($os);
1633  }
1634  if ($this->isSettingChangeable('chat_osc_accept_msg')) {
1635  $lng->loadLanguageModule('chatroom');
1636  $chat_osc_acm = new ilCheckboxInputGUI($lng->txt('chat_osc_accept_msg'), 'chat_osc_accept_msg');
1637  if ($a_mode == 'create') {
1638  $chat_osc_acm->setChecked(ilUtil::yn2tf($ilSetting->get('chat_osc_accept_msg', 'n')));
1639  }
1640  $this->form_gui->addItem($chat_osc_acm);
1641  }
1642 
1643  if ((int) $ilSetting->get('session_reminder_enabled')) {
1644  $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
1645  $cb->setValue(1);
1646  $this->form_gui->addItem($cb);
1647  }
1648 
1649  // Options
1650  if ($this->isSettingChangeable('send_mail')) {
1651  $sec_op = new ilFormSectionHeaderGUI();
1652  $sec_op->setTitle($this->lng->txt("options"));
1653  $this->form_gui->addItem($sec_op);
1654  }
1655 
1656  // send email
1657  $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail');
1658  $se->setInfo($lng->txt('inform_user_mail_info'));
1659  $se->setValue('y');
1660  $se->setChecked(($ilUser->getPref('send_info_mails') == 'y'));
1661  $this->form_gui->addItem($se);
1662 
1663  // ignore required fields
1664  $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf');
1665  $irf->setInfo($lng->txt('ignore_required_fields_info'));
1666  $irf->setValue(1);
1667  $this->form_gui->addItem($irf);
1668 
1669  // @todo: handle all required fields
1670 
1671  // command buttons
1672  if ($a_mode == "create" || $a_mode == "save") {
1673  $this->form_gui->addCommandButton("save", $lng->txt("save"));
1674  }
1675  if ($a_mode == "edit" || $a_mode == "update") {
1676  $this->form_gui->addCommandButton("update", $lng->txt("save"));
1677  }
1678  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
1679  }
1680 
1689  protected function isSettingChangeable($a_field)
1690  {
1691  // TODO: Allow mixed field parameter to support checks against an array of field names.
1692 
1693  global $ilSetting;
1694  static $settings = null;
1695 
1696 
1697 
1698  if ($this->usrf_ref_id == USER_FOLDER_ID) {
1699  return true;
1700  }
1701 
1702  if ($settings == null) {
1703  $settings = $ilSetting->getAll();
1704  }
1705  return (bool) $settings['usr_settings_changeable_lua_' . $a_field];
1706  }
1707 
1708 
1709  // BEGIN DiskQuota: Allow administrators to edit user picture
1715  public function uploadUserPictureObject()
1716  {
1717  global $ilUser, $rbacsystem;
1718 
1719  // User folder
1720  if ($this->usrf_ref_id == USER_FOLDER_ID and
1721  !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
1722  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1723  }
1724  // if called from local administration $this->usrf_ref_id is category id
1725  // Todo: this has to be fixed. Do not mix user folder id and category id
1726  if ($this->usrf_ref_id != USER_FOLDER_ID) {
1727  // check if user is assigned to category
1728  if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
1729  $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
1730  }
1731  }
1732 
1733  $userfile_input = $this->form_gui->getItemByPostVar("userfile");
1734 
1735  if ($_FILES["userfile"]["tmp_name"] == "") {
1736  if ($userfile_input->getDeletionFlag()) {
1737  $this->object->removeUserPicture();
1738  }
1739  return;
1740  }
1741  if ($_FILES["userfile"]["size"] == 0) {
1742  ilUtil::sendFailure($this->lng->txt("msg_no_file"));
1743  } else {
1744  $webspace_dir = ilUtil::getWebspaceDir();
1745  $image_dir = $webspace_dir . "/usr_images";
1746  $store_file = "usr_" . $this->object->getId() . "." . "jpg";
1747 
1748  // store filename
1749  $this->object->setPref("profile_image", $store_file);
1750  $this->object->update();
1751 
1752  // move uploaded file
1753  $pi = pathinfo($_FILES["userfile"]["name"]);
1754  $uploaded_file = $image_dir . "/upload_" . $this->object->getId() . "." . $pi["extension"];
1755  if (!ilUtil::moveUploadedFile(
1756  $_FILES["userfile"]["tmp_name"],
1757  $_FILES["userfile"]["name"],
1758  $uploaded_file,
1759  false
1760  )) {
1761  ilUtil::sendFailure($this->lng->txt("upload_error", true));
1762  $this->ctrl->redirect($this, "showProfile");
1763  }
1764  chmod($uploaded_file, 0770);
1765 
1766  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
1767  // taking only frame [0] to avoid problems with animated gifs
1768  $show_file = "$image_dir/usr_" . $this->object->getId() . ".jpg";
1769  $thumb_file = "$image_dir/usr_" . $this->object->getId() . "_small.jpg";
1770  $xthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xsmall.jpg";
1771  $xxthumb_file = "$image_dir/usr_" . $this->object->getId() . "_xxsmall.jpg";
1772  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
1773  $show_file = ilUtil::escapeShellArg($show_file);
1774  $thumb_file = ilUtil::escapeShellArg($thumb_file);
1775  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
1776  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
1777 
1778  if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
1779  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
1780  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
1781  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
1782  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
1783  } else {
1784  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
1785  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
1786  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
1787  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
1788  }
1789  }
1790  }
1791 
1795  public function removeUserPictureObject()
1796  {
1797  $webspace_dir = ilUtil::getWebspaceDir();
1798  $image_dir = $webspace_dir . "/usr_images";
1799  $file = $image_dir . "/usr_" . $this->object->getID() . "." . "jpg";
1800  $thumb_file = $image_dir . "/usr_" . $this->object->getID() . "_small.jpg";
1801  $xthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xsmall.jpg";
1802  $xxthumb_file = $image_dir . "/usr_" . $this->object->getID() . "_xxsmall.jpg";
1803  $upload_file = $image_dir . "/upload_" . $this->object->getID();
1804 
1805  // remove user pref file name
1806  $this->object->setPref("profile_image", "");
1807  $this->object->update();
1808  ilUtil::sendSuccess($this->lng->txt("user_image_removed"));
1809 
1810  if (@is_file($file)) {
1811  unlink($file);
1812  }
1813  if (@is_file($thumb_file)) {
1814  unlink($thumb_file);
1815  }
1816  if (@is_file($xthumb_file)) {
1817  unlink($xthumb_file);
1818  }
1819  if (@is_file($xxthumb_file)) {
1820  unlink($xxthumb_file);
1821  }
1822  if (@is_file($upload_file)) {
1823  unlink($upload_file);
1824  }
1825 
1826  $this->editObject();
1827  }
1828  // END DiskQuota: Allow administrators to edit user picture
1829 
1835  public function assignSaveObject()
1836  {
1837  global $rbacsystem, $rbacadmin, $rbacreview;
1838 
1839  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1840  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1841  }
1842 
1843  $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
1844  $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
1845 
1846  // prevent unassignment of system role from system user
1847  if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles)) {
1848  array_push($selected_roles, SYSTEM_ROLE_ID);
1849  }
1850 
1851  $global_roles_all = $rbacreview->getGlobalRoles();
1852  $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
1853  $assigned_roles = array_intersect($assigned_roles_all, $posted_roles);
1854  $assigned_global_roles_all = array_intersect($assigned_roles_all, $global_roles_all);
1855  $assigned_global_roles = array_intersect($assigned_global_roles_all, $posted_roles);
1856  $posted_global_roles = array_intersect($selected_roles, $global_roles_all);
1857 
1858  if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
1859  or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles))) {
1860  //$this->ilias->raiseError($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),$this->ilias->error_obj->MESSAGE);
1861  // workaround. sometimes jumps back to wrong page
1862  ilUtil::sendFailure($this->lng->txt("msg_min_one_role") . "<br/>" . $this->lng->txt("action_aborted"), true);
1863  $this->ctrl->redirect($this, 'roleassignment');
1864  }
1865 
1866  foreach (array_diff($assigned_roles, $selected_roles) as $role) {
1867  $rbacadmin->deassignUser($role, $this->object->getId());
1868  }
1869 
1870  foreach (array_diff($selected_roles, $assigned_roles) as $role) {
1871  $rbacadmin->assignUser($role, $this->object->getId(), false);
1872  }
1873 
1874  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
1875 
1876  // update object data entry (to update last modification date)
1877  $this->object->update();
1878 
1879  ilUtil::sendSuccess($this->lng->txt("msg_roleassignment_changed"), true);
1880 
1881  if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
1882  $this->ctrl->redirect($this, 'roleassignment');
1883  } else {
1884  $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
1885  }
1886  }
1887 
1893  public function roleassignmentObject()
1894  {
1895  global $rbacreview,$rbacsystem,$ilUser, $ilTabs;
1896 
1897  $ilTabs->activateTab("role_assignment");
1898 
1899  if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
1900  $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
1901  }
1902 
1903  $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
1904 
1905  if ($_SESSION['filtered_roles'] > 5) {
1906  $_SESSION['filtered_roles'] = 0;
1907  }
1908 
1909  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
1910 
1911  if (false) {
1912  $this->tpl->setCurrentBlock("filter");
1913  $this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
1914  $this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
1915  $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
1916  $this->tpl->setVariable("FILTER_NAME", 'roleassignment');
1917  $this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
1918  $this->tpl->parseCurrentBlock();
1919  }
1920 
1921  // init table
1922  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
1923  $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
1924 
1925  // now get roles depending on filter settings
1926  $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"], $this->object->getId());
1927  $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
1928 
1929  $counter = 0;
1930 
1931  include_once('./Services/AccessControl/classes/class.ilObjRole.php');
1932 
1933  $records = array();
1934  foreach ($role_list as $role) {
1935  // fetch context path of role
1936  $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
1937 
1938  // only list roles that are not set to status "deleted"
1939  if ($rbacreview->isDeleted($rolf[0])) {
1940  continue;
1941  }
1942 
1943  // build context path
1944  $path = "";
1945 
1946  if ($this->tree->isInTree($rolf[0])) {
1947  if ($rolf[0] == ROLE_FOLDER_ID) {
1948  $path = $this->lng->txt("global");
1949  } else {
1950  $tmpPath = $this->tree->getPathFull($rolf[0]);
1951 
1952  // count -1, to exclude the role folder itself
1953  /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
1954  {
1955  if ($path != "")
1956  {
1957  $path .= " > ";
1958  }
1959 
1960  $path .= $tmpPath[$i]["title"];
1961  }*/
1962 
1963  $path = $tmpPath[count($tmpPath)-1]["title"];
1964  }
1965  } else {
1966  $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role["obj_id"] . ")</b>";
1967  }
1968 
1969  $disabled = false;
1970 
1971  // disable checkbox for system role for the system user
1972  if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
1973  or (!in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID)) {
1974  $disabled = true;
1975  }
1976 
1977  // protected admin role
1978  if ($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
1979  include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
1980  if (ilSecuritySettings::_getInstance()->isAdminRoleProtected()) {
1981  $disabled = true;
1982  }
1983  }
1984 
1985  if (substr($role["title"], 0, 3) == "il_") {
1986  if (!$assignable) {
1987  $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
1988  $rolf2 = $rolf_arr[0];
1989  } else {
1990  $rolf2 = $rolf;
1991  }
1992 
1993  $parent_node = $this->tree->getNodeData($rolf2);
1994 
1995  $role["description"] = $this->lng->txt("obj_" . $parent_node["type"]) . "&nbsp;(#" . $parent_node["obj_id"] . ")";
1996  }
1997 
1998  $role_ids[$counter] = $role["obj_id"];
1999 
2000  $result_set[$counter][] = $checkbox = ilUtil::formCheckBox(in_array($role["obj_id"], $assigned_roles), "role_id[]", $role["obj_id"], $disabled) . "<input type=\"hidden\" name=\"role_id_ctrl[]\" value=\"" . $role["obj_id"] . "\"/>";
2001  $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
2002  $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
2003  $result_set[$counter][] = $link = "<a href=\"" . $this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm") . "\">" . ilObjRole::_getTranslation($role["title"]) . "</a>";
2004  $title = ilObjRole::_getTranslation($role["title"]);
2005  $result_set[$counter][] = $role["description"];
2006 
2007  // Add link to objector local Rores
2008  if ($role["role_type"] == "local") {
2009  // Get Object to the role
2010  $obj_id = $rbacreview->getObjectOfRole($role["rol_id"]);
2011 
2012  $obj_type = ilObject::_lookupType($obj_id);
2013 
2015 
2016  foreach ($ref_ids as $ref_id) {
2017  }
2018 
2019  require_once("./Services/Link/classes/class.ilLink.php");
2020 
2021  $result_set[$counter][] = $context = "<a href='" . ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id)) . "' target='_top'>" . $path . "</a>";
2022  } else {
2023  $result_set[$counter][] = $path;
2024  $context = $path;
2025  }
2026 
2027  $records[] = array("path" => $path, "description" => $role["description"],
2028  "context" => $context, "checkbox" => $checkbox,
2029  "role" => $link, "title" => $title);
2030  ++$counter;
2031  }
2032 
2033  if (true) {
2034  $tab->setData($records);
2035  $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
2036  return;
2037  }
2038  }
2039 
2043  public function applyFilterObject()
2044  {
2045  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2046  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2047  $table_gui->writeFilterToSession(); // writes filter to session
2048  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2049  $this->roleassignmentObject();
2050  }
2051 
2055  public function resetFilterObject()
2056  {
2057  include_once("./Services/User/classes/class.ilRoleAssignmentTableGUI.php");
2058  $table_gui = new ilRoleAssignmentTableGUI($this, "roleassignment");
2059  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2060  $table_gui->resetFilter(); // clears filter
2061  $this->roleassignmentObject();
2062  }
2063 
2064  public function __getDateSelect($a_type, $a_varname, $a_selected)
2065  {
2066  switch ($a_type) {
2067  case "minute":
2068  for ($i=0;$i<=60;$i++) {
2069  $days[$i] = $i < 10 ? "0" . $i : $i;
2070  }
2071  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2072 
2073  case "hour":
2074  for ($i=0;$i<24;$i++) {
2075  $days[$i] = $i < 10 ? "0" . $i : $i;
2076  }
2077  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2078 
2079  case "day":
2080  for ($i=1;$i<32;$i++) {
2081  $days[$i] = $i < 10 ? "0" . $i : $i;
2082  }
2083  return ilUtil::formSelect($a_selected, $a_varname, $days, false, true);
2084 
2085  case "month":
2086  for ($i=1;$i<13;$i++) {
2087  $month[$i] = $i < 10 ? "0" . $i : $i;
2088  }
2089  return ilUtil::formSelect($a_selected, $a_varname, $month, false, true);
2090 
2091  case "year":
2092  if ($a_selected < date('Y', time())) {
2093  $start = $a_selected;
2094  } else {
2095  $start = date('Y', time());
2096  }
2097 
2098  for ($i = $start;$i < date("Y", time()) + 11;++$i) {
2099  $year[$i] = $i;
2100  }
2101  return ilUtil::formSelect($a_selected, $a_varname, $year, false, true);
2102  }
2103  }
2104 
2105  public function __toUnix($a_time_arr)
2106  {
2107  return mktime(
2108  $a_time_arr["hour"],
2109  $a_time_arr["minute"],
2110  $a_time_arr["second"],
2111  $a_time_arr["month"],
2112  $a_time_arr["day"],
2113  $a_time_arr["year"]
2114  );
2115  }
2116 
2117 
2118 
2119 
2120  public function __unsetSessionVariables()
2121  {
2122  unset($_SESSION["filtered_roles"]);
2123  }
2124 
2125  public function __buildFilterSelect()
2126  {
2127  $action[0] = $this->lng->txt('assigned_roles');
2128  $action[1] = $this->lng->txt('all_roles');
2129  $action[2] = $this->lng->txt('all_global_roles');
2130  $action[3] = $this->lng->txt('all_local_roles');
2131  $action[4] = $this->lng->txt('internal_local_roles_only');
2132  $action[5] = $this->lng->txt('non_internal_local_roles_only');
2133 
2134  return ilUtil::formSelect($_SESSION['filtered_roles'], "filter", $action, false, true);
2135  }
2136 
2137  public function hitsperpageObject()
2138  {
2139  parent::hitsperpageObject();
2140  $this->roleassignmentObject();
2141  }
2142 
2147  public function addAdminLocatorItems($a_do_not_add_object = false)
2148  {
2149  global $ilLocator;
2150 
2151  $ilLocator->clearItems();
2152 
2153  if ($_GET["admin_mode"] == "settings") { // system settings
2154  $this->ctrl->setParameterByClass(
2155  "ilobjsystemfoldergui",
2156  "ref_id",
2157  SYSTEM_FOLDER_ID
2158  );
2159  $ilLocator->addItem(
2160  $this->lng->txt("administration"),
2161  $this->ctrl->getLinkTargetByClass(array("iladministrationgui", "ilobjsystemfoldergui"), ""),
2162  ilFrameTargetInfo::_getFrame("MainContent")
2163  );
2164 
2165  if ($_GET['ref_id'] == USER_FOLDER_ID) {
2166  $ilLocator->addItem(
2167  $this->lng->txt("obj_" . ilObject::_lookupType(
2168  ilObject::_lookupObjId($_GET["ref_id"])
2169  )),
2170  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view")
2171  );
2172  } elseif ($_GET['ref_id'] == ROLE_FOLDER_ID) {
2173  $ilLocator->addItem(
2174  $this->lng->txt("obj_" . ilObject::_lookupType(
2175  ilObject::_lookupObjId($_GET["ref_id"])
2176  )),
2177  $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view")
2178  );
2179  }
2180 
2181  if ($_GET["obj_id"] > 0) {
2182  $ilLocator->addItem(
2183  $this->object->getTitle(),
2184  $this->ctrl->getLinkTarget($this, "view")
2185  );
2186  }
2187  } else { // repository administration
2188  // ?
2189  }
2190  }
2191 
2192  public function showUpperIcon()
2193  {
2194  }
2195 
2196  public function __sendProfileMail()
2197  {
2198  global $ilUser,$ilias;
2199 
2200  if ($_POST['send_mail'] != 'y') {
2201  return '';
2202  }
2203  if (!strlen($this->object->getEmail())) {
2204  return '';
2205  }
2206 
2207  // Choose language of user
2208  $usr_lang = new ilLanguage($this->object->getLanguage());
2209  $usr_lang->loadLanguageModule('crs');
2210  $usr_lang->loadLanguageModule('registration');
2211 
2212  include_once "Services/Mail/classes/class.ilMimeMail.php";
2213 
2215  $senderFactory = $GLOBALS["DIC"]["mail.mime.sender.factory"];
2216 
2217  $mmail = new ilMimeMail();
2218  $mmail->From($senderFactory->system());
2219  $mmail->To(ilMailOptions::getExternalEmailsByUser($this->object));
2220 
2221  // mail subject
2222  $subject = $usr_lang->txt("profile_changed");
2223 
2224 
2225  // mail body
2226  $body = ($usr_lang->txt("reg_mail_body_salutation") . " " . $this->object->getFullname() . ",\n\n");
2227 
2228  $date = $this->object->getApproveDate();
2229  // Approve
2230  if ((time() - strtotime($date)) < 10) {
2231  $body .= ($usr_lang->txt('reg_mail_body_approve') . "\n\n");
2232  } else {
2233  $body .= ($usr_lang->txt('reg_mail_body_profile_changed') . "\n\n");
2234  }
2235 
2236  // Append login info only if password has been chacnged
2237  if ($_POST['passwd'] != '') {
2238  $body .= $usr_lang->txt("reg_mail_body_text2") . "\n" .
2239  ILIAS_HTTP_PATH . "/login.php?client_id=" . $ilias->client_id . "\n" .
2240  $usr_lang->txt("login") . ": " . $this->object->getLogin() . "\n" .
2241  $usr_lang->txt("passwd") . ": " . $_POST['passwd'] . "\n\n";
2242  }
2243  $body .= ($usr_lang->txt("reg_mail_body_text3") . "\n");
2244  $body .= $this->object->getProfileAsString($usr_lang);
2245 
2246  $mmail->Subject($subject);
2247  $mmail->Body($body);
2248  $mmail->Send();
2249 
2250 
2251  return "<br/>" . $this->lng->txt("mail_sent");
2252  }
2253 
2257  public static function _goto($a_target)
2258  {
2259  global $ilUser, $ilCtrl;
2260 
2261  // #10888
2262  if ($a_target == md5("usrdelown")) {
2263  if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2264  $ilUser->hasDeletionFlag()) {
2265  $ilCtrl->setTargetScript("ilias.php");
2266  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2267  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalsettingsgui"), "deleteOwnAccount3");
2268  }
2269  exit("This account is not flagged for deletion."); // #12160
2270  }
2271 
2272  // badges
2273  if (substr($a_target, -4) == "_bdg") {
2274  $_GET["baseClass"] = "ilPersonalDesktopGUI";
2275  $_GET["cmd"] = "jumpToBadges";
2276  include("ilias.php");
2277  exit();
2278  }
2279 
2280  if ('registration' == $a_target) {
2281  $_GET["baseClass"] = 'ilStartUpGUI';
2282  $ilCtrl->setTargetScript('ilias.php');
2283  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilAccountRegistrationGUI'), '');
2284  } elseif ('nameassist' == $a_target) {
2285  $_GET["baseClass"] = 'ilStartUpGUI';
2286  $ilCtrl->setTargetScript('ilias.php');
2287  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), 'showUsernameAssistanceForm');
2288  } elseif ('pwassist' == $a_target) {
2289  $_GET["baseClass"] = 'ilStartUpGUI';
2290  $ilCtrl->setTargetScript('ilias.php');
2291  $ilCtrl->redirectByClass(array('ilStartUpGUI', 'ilPasswordAssistanceGUI'), '');
2292  } elseif ('agreement' == $a_target) {
2293  if ($ilUser->getId() > 0 && !$ilUser->isAnonymous()) {
2294  $ilCtrl->setTargetScript("ilias.php");
2295  $ilCtrl->initBaseClass("ilpersonaldesktopgui");
2296  $ilCtrl->redirectByClass(array("ilpersonaldesktopgui", "ilpersonalprofilegui"), "showUserAgreement");
2297  } else {
2298  $_GET["baseClass"] = 'ilStartUpGUI';
2299  $ilCtrl->setTargetScript('ilias.php');
2300  $ilCtrl->redirectByClass(array('ilStartUpGUI'), 'showTermsOfService');
2301  }
2302  }
2303 
2304  if (substr($a_target, 0, 1) == "n") {
2305  $a_target = ilObjUser::_lookupId(ilUtil::stripSlashes(substr($a_target, 1)));
2306  }
2307 
2308  if (strpos($a_target, 'contact_approved') !== false) {
2309  $_GET['cmd'] = 'approveContactRequest';
2310  } elseif (strpos($a_target, 'contact_ignored') !== false) {
2311  $_GET['cmd'] = 'ignoreContactRequest';
2312  } else {
2313  $_GET['cmd'] = 'view';
2314  }
2315 
2316  $_GET["user_id"] = (int) $a_target;
2317  $_GET["baseClass"] = "ilPublicUserProfileGUI";
2318  $_GET["cmdClass"] = "ilpublicuserprofilegui";
2319  include("ilias.php");
2320  exit;
2321  }
2322 
2331  protected function handleIgnoredRequiredFields()
2332  {
2333  $profileMaybeIncomplete = false;
2334 
2335  require_once 'Services/User/classes/class.ilUserProfile.php';
2336 
2337  foreach (ilUserProfile::getIgnorableRequiredSettings() as $fieldName) {
2338  $elm = $this->form_gui->getItemByPostVar($fieldName);
2339 
2340  if (!$elm) {
2341  continue;
2342  }
2343 
2344  if ($elm->getRequired()) {
2345  $profileMaybeIncomplete = true;
2346 
2347  // Flag as optional
2348  $elm->setRequired(false);
2349  }
2350  }
2351 
2352  include_once 'Services/User/classes/class.ilUserDefinedFields.php';
2353  $user_defined_fields = ilUserDefinedFields::_getInstance();
2354  foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
2355  $elm = $this->form_gui->getItemByPostVar('udf_' . $definition['field_id']);
2356 
2357  if (!$elm) {
2358  continue;
2359  }
2360 
2361  if ($elm->getRequired() && $definition['changeable'] && $definition['required'] && $definition['visible']) {
2362  $profileMaybeIncomplete = true;
2363 
2364  // Flag as optional
2365  $elm->setRequired(false);
2366  }
2367  }
2368 
2369  return $profileMaybeIncomplete;
2370  }
2371 
2375  protected function showAcceptedTermsOfService()
2376  {
2380  $agree_date = $this->form_gui->getItemByPostVar('agree_date');
2381  if ($agree_date && $agree_date->getValue()) {
2382  $this->lng->loadLanguageModule('tos');
2383  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
2387  $entity = ilTermsOfServiceHelper::getCurrentAcceptanceForUser($this->object);
2388  if ($entity->getId()) {
2389  $show_agreement_text = new ilCheckboxInputGUI($this->lng->txt('tos_show_signed_text'), 'tos_show_signed_text');
2390 
2391  $agreement_lang = new ilNonEditableValueGUI($this->lng->txt('language'), '');
2392  $agreement_lang->setValue($this->lng->txt('meta_l_' . $entity->getIso2LanguageCode()));
2393  $show_agreement_text->addSubItem($agreement_lang);
2394 
2395  require_once 'Services/TermsOfService/classes/form/class.ilTermsOfServiceSignedDocumentFormElementGUI.php';
2396  $agreement_document = new ilTermsOfServiceSignedDocumentFormElementGUI($this->lng->txt('tos_agreement_document'), '', $entity);
2397  $show_agreement_text->addSubItem($agreement_document);
2398  $agree_date->addSubItem($show_agreement_text);
2399  }
2400  } elseif ($agree_date) {
2401  $agree_date->setValue($this->lng->txt('tos_not_accepted_yet'));
2402  }
2403  }
2404 } // END class.ilObjUserGUI
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.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
getAdminTabs()
admin and normal tabs are equal for roles
addAdminLocatorItems($a_do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded) ...
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.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
createObject()
Display user create form.
const IL_CAL_DATETIME
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.
$action
This class represents a selection list property in a property form.
$_GET["client_id"]
loadValuesFromForm($a_mode='create')
This class represents a section header in a property form.
uploadUserPictureObject()
upload user image
removeUserPictureObject()
remove user image
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static MB2Bytes($a_value)
static _lookupPersonalWorkspaceDiskQuota($a_user_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
This class represents a user login property in a property form.
static _getLastHistoryDataByUserId($a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
static _lookupId($a_user_str)
Lookup id by login.
This class represents a checkbox property in a property form.
static getIgnorableRequiredSettings()
Returns an array of all ignorable profiel fields.
$from
static _getActiveAuthModes()
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
This class represents a email property in a property form.
const IL_CAL_UNIX
$keys
$req
Definition: getUserInfo.php:20
$records
Definition: simple_test.php:22
Class ilObjectOwnershipManagementGUI.
static _resetLoginAttempts($a_usr_id)
static _getAuthMode($a_auth_mode, $a_db_handler='')
static _getAuthModeName($a_auth_key)
static _getAssignUsersStatus($a_role_id)
static _getAllReferences($a_id)
get all reference ids of object
static _goto($a_target)
Goto user profile screen.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
static getExternalEmailsByUser(ilObjUser $user, ilMailOptions $mail_options=null)
__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.
$counter
$a_type
Definition: workflow.php:92
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.
prepareOutput($a_show_subobjects=true)
prepare output
static _enabledLearningProgress()
check wether learing progress is enabled or not
if($format !==null) $name
Definition: metadata.php:146
__checkUserDefinedRequiredFields()
display user create form
This class represents a property in a property form.
Class for single dates.
setUseStripSlashes($a_stat)
En/disable use of stripslashes.
static execConvert($args)
execute convert command
Class ilMimeMail.
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)
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
setValue($a_value)
Set Value.
static Bytes2MB($a_value)
setSize($a_size)
Set Size.
const UDF_TYPE_TEXT
This class represents a text property in a property form.
Date and time handling
This class represents a password property in a property form.
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
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
static _isExternalAccountEnabled()
Check if an external account name is required.
$old
setOptions($a_options)
Set Options.
const UDF_TYPE_WYSIWYG
static getFilesizeByOwner($a_owner_id)
Get current storage size for owner.
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
update($pash, $contents, Config $config)
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.
const IL_CAL_DATE
static _getFrame($a_class, $a_type='')
Get content frame name.
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.
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 $l
Definition: afr.php:30
Create new PHPExcel object
obj_idprivate
global $ilSetting
Definition: privfeed.php:17
static escapeShellArg($a_arg)
applyFilterObject()
Apply filter.
This class represents a text area property in a property form.
loadLanguageModule($a_module)
saveObject()
save user data public
Class ilAccountMail.
$i
Definition: disco.tpl.php:19
const USER_FOLDER_ID
Class ilObjUserFolder.
This class represents a text property in a property form.
language handling
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
__construct($a_data, $a_id, $a_call_by_reference=false, $a_prepare_output=true)
Constructor public.
setBackTarget($a_text, $a_link)
set back tab target
updateObject()
Update user.
static yn2tf($a_yn)
convert "y"/"n" to true/false
Class ilObjUserGUI.
$info
Definition: index.php:5
static getWebspaceDir($mode="filesystem")
get webspace directory
static _getInstance()
Get instance of ilSecuritySettings.
$key
Definition: croninfo.php:18
Class ilObjUserTrackingGUI.
$_POST["username"]
setRequired($a_required)
Set Required.
roleassignmentObject()
display roleassignment panel
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
static getFilesizeByTypeAndOwner($a_owner_id)
Get current storage size for owner (grouped by type)