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