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