ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjUserFolderGUI.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
20{
21 var $ctrl;
22
27 function ilObjUserFolderGUI($a_data,$a_id,$a_call_by_reference, $a_prepare_output = true)
28 {
29 global $ilCtrl;
30
31 // TODO: move this to class.ilias.php
32 define('USER_FOLDER_ID',7);
33
34 $this->type = "usrf";
35 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
36
37 $this->lng->loadLanguageModule('search');
38 $this->lng->loadLanguageModule("user");
39
40 $ilCtrl->saveParameter($this, "letter");
41 }
42
43 function setUserOwnerId($a_id)
44 {
45 $this->user_owner_id = $a_id;
46 }
47 function getUserOwnerId()
48 {
49 return $this->user_owner_id ? $this->user_owner_id : USER_FOLDER_ID;
50 }
51
52 function &executeCommand()
53 {
54 global $ilTabs;
55
56 $next_class = $this->ctrl->getNextClass($this);
57 $cmd = $this->ctrl->getCmd();
58 $this->prepareOutput();
59
60 switch($next_class)
61 {
62 case 'ilusertablegui':
63 include_once("./Services/User/classes/class.ilUserTableGUI.php");
64 $u_table = new ilUserTableGUI($this, "view");
65 $u_table->initFilter();
66 $this->ctrl->setReturn($this,'view');
67 $this->ctrl->forwardCommand($u_table);
68 break;
69
70 case 'ilpermissiongui':
71 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
72 $perm_gui =& new ilPermissionGUI($this);
73 $ret =& $this->ctrl->forwardCommand($perm_gui);
74 break;
75
76 case 'ilrepositorysearchgui':
77 include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
78 $user_search =& new ilRepositorySearchGUI();
79 $user_search->setTitle($this->lng->txt("search_user_extended")); // #17502
80 $user_search->enableSearchableCheck(false);
81 $user_search->setUserLimitations(false);
82 $user_search->setCallback(
83 $this,
84 'searchResultHandler',
85 $this->getUserMultiCommands(true)
86 );
87 $this->tabs_gui->setTabActive('search_user_extended');
88 $this->ctrl->setReturn($this,'view');
89 $ret =& $this->ctrl->forwardCommand($user_search);
90 break;
91
92 case 'ilaccountcodesgui':
93 $this->tabs_gui->setTabActive('settings');
94 $this->setSubTabs("settings");
95 $ilTabs->activateSubTab("account_codes");
96 include_once("./Services/User/classes/class.ilAccountCodesGUI.php");
97 $acc = new ilAccountCodesGUI($this->ref_id);
98 $this->ctrl->forwardCommand($acc);
99 break;
100
101 case 'ilcustomuserfieldsgui':
102 $this->tabs_gui->setTabActive('settings');
103 $this->setSubTabs("settings");
104 $ilTabs->activateSubTab("user_defined_fields");
105 include_once("./Services/User/classes/class.ilCustomUserFieldsGUI.php");
106 $cf = new ilCustomUserFieldsGUI();
107 $this->ctrl->forwardCommand($cf);
108 break;
109
110 default:
111 if(!$cmd)
112 {
113 $cmd = "view";
114 }
115 $cmd .= "Object";
116
117 $this->$cmd();
118
119 break;
120 }
121 return true;
122 }
123
125 {
126 global $rbacsystem, $tpl;
127
128 // deprecated JF 27 May 2013
129 exit();
130
131 if (!$rbacsystem->checkAccess("read",$this->object->getRefId()) ||
134 {
135 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
136 }
137
138 include_once "Services/User/classes/class.ilUserLPTableGUI.php";
139 $tbl = new ilUserLPTableGUI($this, "learningProgress", $this->object->getRefId());
140
141 $tpl->setContent($tbl->getHTML());
142 }
143
149 {
150 include_once("./Services/User/classes/class.ilUserTableGUI.php");
151 $utab = new ilUserTableGUI($this, "view");
152 $utab->resetOffset();
153 $utab->resetFilter();
154
155 // from "old" implementation
156 $this->viewObject(TRUE);
157 }
158
162 function addUserObject()
163 {
164 global $ilCtrl;
165
166 $ilCtrl->setParameterByClass("ilobjusergui", "new_type", "usr");
167 $ilCtrl->redirectByClass(array("iladministrationgui", "ilobjusergui"), "create");
168 }
169
170
175 {
176 global $ilTabs;
177
178 include_once("./Services/User/classes/class.ilUserTableGUI.php");
179 $utab = new ilUserTableGUI($this, "view");
180 $utab->resetOffset();
181 $utab->writeFilterToSession();
182 $this->viewObject();
183 $ilTabs->activateTab("usrf");
184 }
185
191 function viewObject($reset_filter = FALSE)
192 {
193 global $rbacsystem, $ilUser, $ilToolbar, $tpl, $ilSetting, $lng;
194
195 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
196
197 if ($rbacsystem->checkAccess('create_usr', $this->object->getRefId()) ||
198 $rbacsystem->checkAccess('cat_administrate_users', $this->object->getRefId()))
199 {
200 $button = ilLinkButton::getInstance();
201 $button->setCaption("usr_add");
202 $button->setUrl($this->ctrl->getLinkTarget($this, "addUser"));
203 $ilToolbar->addButtonInstance($button);
204
205 $button = ilLinkButton::getInstance();
206 $button->setCaption("import_users");
207 $button->setUrl($this->ctrl->getLinkTarget($this, "importUserForm"));
208 $ilToolbar->addButtonInstance($button);
209 }
210
211 // alphabetical navigation
212 include_once './Services/User/classes/class.ilUserAccountSettings.php';
214 if ((int) $ilSetting->get('user_adm_alpha_nav'))
215 {
216 $ilToolbar->addSeparator();
217
218 // alphabetical navigation
219 include_once("./Services/Form/classes/class.ilAlphabetInputGUI.php");
220 $ai = new ilAlphabetInputGUI("", "first");
221 include_once("./Services/User/classes/class.ilObjUser.php");
222 $ai->setLetters(ilObjUser::getFirstLettersOfLastnames());
223 /*$ai->setLetters(array("A","B","C","D","E","F","G","H","I","J",
224 "K","L","M","N","O","P","Q","R","S","T",
225 "U","V","W","X","Y","Z","1","2","3","4","_",
226 "Ä","Ü","Ö",":",";","+","*","#","§","%","&"));*/
227 $ai->setParentCommand($this, "chooseLetter");
228 $ai->setHighlighted($_GET["letter"]);
229 $ilToolbar->addInputItem($ai, true);
230
231 }
232
233 include_once("./Services/User/classes/class.ilUserTableGUI.php");
234 $utab = new ilUserTableGUI($this, "view");
235 $tpl->setContent($utab->getHTML());
236 }
237
241 protected function addUserAutoCompleteObject()
242 {
243 include_once './Services/User/classes/class.ilUserAutoComplete.php';
244 $auto = new ilUserAutoComplete();
245 $auto->setSearchFields(array('login','firstname','lastname','email'));
246 $auto->enableFieldSearchableCheck(false);
247 $auto->setMoreLinkAvailable(true);
248
249 if(($_REQUEST['fetchall']))
250 {
251 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
252 }
253
254 echo $auto->getList($_REQUEST['term']);
255 exit();
256 }
257
265 {
266 global $ilCtrl;
267
268 $ilCtrl->redirect($this, "view");
269 }
270
271
278 function showActions($with_subobjects = false)
279 {
280 global $rbacsystem;
281
282 $operations = array();
283//var_dump($this->actions);
284 if ($this->actions == "")
285 {
286 $d = array(
287 "delete" => array("name" => "delete", "lng" => "delete"),
288 "activate" => array("name" => "activate", "lng" => "activate"),
289 "deactivate" => array("name" => "deactivate", "lng" => "deactivate"),
290 "accessRestrict" => array("name" => "accessRestrict", "lng" => "accessRestrict"),
291 "accessFree" => array("name" => "accessFree", "lng" => "accessFree"),
292 "export" => array("name" => "export", "lng" => "export")
293 );
294 }
295 else
296 {
298 }
299 foreach ($d as $row)
300 {
301 if ($rbacsystem->checkAccess($row["name"],$this->object->getRefId()))
302 {
303 $operations[] = $row;
304 }
305 }
306
307 if (count($operations) > 0)
308 {
309 $select = "<select name=\"selectedAction\">\n";
310 foreach ($operations as $val)
311 {
312 $select .= "<option value=\"" . $val["name"] . "\"";
313 if (strcmp($_POST["selectedAction"], $val["name"]) == 0)
314 {
315 $select .= " selected=\"selected\"";
316 }
317 $select .= ">";
318 $select .= $this->lng->txt($val["lng"]);
319 $select .= "</option>";
320 }
321 $select .= "</select>";
322 $this->tpl->setCurrentBlock("tbl_action_select");
323 $this->tpl->setVariable("SELECT_ACTION", $select);
324 $this->tpl->setVariable("BTN_NAME", "userAction");
325 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("submit"));
326 $this->tpl->parseCurrentBlock();
327 }
328
329 if ($with_subobjects === true)
330 {
331 $subobjs = $this->showPossibleSubObjects();
332 }
333
334 if ((count($operations) > 0) or $subobjs === true)
335 {
336 $this->tpl->setCurrentBlock("tbl_action_row");
337 $this->tpl->setVariable("COLUMN_COUNTS",count($this->data["cols"]));
338 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
339 $this->tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
340 $this->tpl->parseCurrentBlock();
341 }
342 }
343
351 {
352 global $rbacsystem;
353
354 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
355
356 if (!$rbacsystem->checkAccess('create_usr',$this->object->getRefId()))
357 {
358 unset($d["usr"]);
359 }
360
361 if (count($d) > 0)
362 {
363 foreach ($d as $row)
364 {
365 $count = 0;
366 if ($row["max"] > 0)
367 {
368 //how many elements are present?
369 for ($i=0; $i<count($this->data["ctrl"]); $i++)
370 {
371 if ($this->data["ctrl"][$i]["type"] == $row["name"])
372 {
373 $count++;
374 }
375 }
376 }
377 if ($row["max"] == "" || $count < $row["max"])
378 {
379 $subobj[] = $row["name"];
380 }
381 }
382 }
383
384 if (is_array($subobj))
385 {
386 //build form
387 $opts = ilUtil::formSelect(12,"new_type",$subobj);
388 $this->tpl->setCurrentBlock("add_object");
389 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
390 $this->tpl->setVariable("BTN_NAME", "create");
391 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
392 $this->tpl->parseCurrentBlock();
393
394 return true;
395 }
396
397 return false;
398 }
399
401 {
402 $this->ctrl->redirect($this, 'view');
403 }
404
406 {
407 $this->ctrl->redirectByClass('ilrepositorysearchgui', 'showSearchResults');
408 }
409
416 {
417 global $rbacsystem, $ilUser;
418
419 // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
420 if (!$rbacsystem->checkAccess('write',$this->object->getRefId()))
421 {
422 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->WARNING);
423 }
424
425 // FOR ALL SELECTED OBJECTS
426 foreach ($_POST["id"] as $id)
427 {
428 // instatiate correct object class (usr)
429 $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);
430 $obj->setActive(TRUE, $ilUser->getId());
431 $obj->update();
432 }
433
434 ilUtil::sendSuccess($this->lng->txt("user_activated"),true);
435
436 if ($_POST["frsrch"])
437 {
438 $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
439 }
440 else
441 {
442 $this->ctrl->redirect($this, "view");
443 }
444 }
445
452 {
453 global $rbacsystem, $ilUser;
454
455 // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
456 if (!$rbacsystem->checkAccess('write',$this->object->getRefId()))
457 {
458 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->WARNING);
459 }
460
461 // FOR ALL SELECTED OBJECTS
462 foreach ($_POST["id"] as $id)
463 {
464 // instatiate correct object class (usr)
465 $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);
466 $obj->setActive(FALSE, $ilUser->getId());
467 $obj->update();
468 }
469
470 // Feedback
471 ilUtil::sendSuccess($this->lng->txt("user_deactivated"),true);
472
473 if ($_POST["frsrch"])
474 {
475 $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
476 }
477 else
478 {
479 $this->ctrl->redirect($this, "view");
480 }
481 }
482
484 {
485 global $rbacsystem, $ilUser;
486
487 // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
488 if (!$rbacsystem->checkAccess('write',$this->object->getRefId()))
489 {
490 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->WARNING);
491 }
492
493 // FOR ALL SELECTED OBJECTS
494 foreach ($_POST["id"] as $id)
495 {
496 // instatiate correct object class (usr)
497 $obj = $this->ilias->obj_factory->getInstanceByObjId($id);
498 $obj->setTimeLimitUnlimited(1);
499 $obj->setTimeLimitFrom("");
500 $obj->setTimeLimitUntil("");
501 $obj->setTimeLimitMessage(0);
502 $obj->update();
503 }
504
505 // Feedback
506 ilUtil::sendSuccess($this->lng->txt("access_free_granted"),true);
507
508 if ($_POST["frsrch"])
509 {
510 $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
511 }
512 else
513 {
514 $this->ctrl->redirect($this, "view");
515 }
516 }
517
518 function setAccessRestrictionObject($a_form = null, $a_from_search = false)
519 {
520 if(!$a_form)
521 {
522 $a_form = $this->initAccessRestrictionForm($a_from_search);
523 }
524 $this->tpl->setContent($a_form->getHTML());
525
526 // #10963
527 return true;
528 }
529
530 protected function initAccessRestrictionForm($a_from_search = false)
531 {
532 $user_ids = $this->getActionUserIds();
533 if(!$user_ids)
534 {
535 ilUtil::sendFailure($this->lng->txt('select_one'));
536 return $this->viewObject();
537 }
538
539 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
540 $form = new ilPropertyFormGUI();
541 $form->setTitle($this->lng->txt("time_limit_add_time_limit_for_selected"));
542 $form->setFormAction($this->ctrl->getFormAction($this, "confirmaccessRestrict"));
543
544 $from = new ilDateTimeInputGUI($this->lng->txt("access_from"), "from");
545 $from->setShowTime(true);
546 $from->setRequired(true);
547 $form->addItem($from);
548
549 $to = new ilDateTimeInputGUI($this->lng->txt("access_until"), "to");
550 $to->setRequired(true);
551 $to->setShowTime(true);
552 $form->addItem($to);
553
554 $form->addCommandButton("confirmaccessRestrict", $this->lng->txt("confirm"));
555 $form->addCommandButton("view", $this->lng->txt("cancel"));
556
557 foreach($user_ids as $user_id)
558 {
559 $ufield = new ilHiddenInputGUI("id[]");
560 $ufield->setValue($user_id);
561 $form->addItem($ufield);
562 }
563
564 // return to search?
565 if($a_from_search || $_POST["frsrch"])
566 {
567 $field = new ilHiddenInputGUI("frsrch");
568 $field->setValue(1);
569 $form->addItem($field);
570 }
571
572 return $form;
573 }
574
576 {
577 $form = $this->initAccessRestrictionForm();
578 if(!$form->checkInput())
579 {
580 return $this->setAccessRestrictionObject($form);
581 }
582
583 $timefrom = $form->getItemByPostVar("from")->getDate()->get(IL_CAL_UNIX);
584 $timeuntil = $form->getItemByPostVar("to")->getDate()->get(IL_CAL_UNIX);
585 if ($timeuntil <= $timefrom)
586 {
587 ilUtil::sendFailure($this->lng->txt("time_limit_not_valid"));
588 return $this->setAccessRestrictionObject($form);
589 }
590
591 global $rbacsystem, $ilUser;
592
593 // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
594 if (!$rbacsystem->checkAccess('write',$this->object->getRefId()))
595 {
596 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->WARNING);
597 }
598
599 // FOR ALL SELECTED OBJECTS
600 foreach ($_POST["id"] as $id)
601 {
602 // instatiate correct object class (usr)
603 $obj = $this->ilias->obj_factory->getInstanceByObjId($id);
604 $obj->setTimeLimitUnlimited(0);
605 $obj->setTimeLimitFrom($timefrom);
606 $obj->setTimeLimitUntil($timeuntil);
607 $obj->setTimeLimitMessage(0);
608 $obj->update();
609 }
610
611 // Feedback
612 ilUtil::sendSuccess($this->lng->txt("access_restricted"),true);
613
614 if ($_POST["frsrch"])
615 {
616 $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
617 }
618 else
619 {
620 $this->ctrl->redirect($this, "view");
621 }
622 }
623
630 {
631 global $rbacsystem, $ilCtrl, $ilUser;
632
633 // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
634 if (!$rbacsystem->checkAccess('delete',$this->object->getRefId()))
635 {
636 ilUtil::sendFailure($this->lng->txt("msg_no_perm_delete"), true);
637 $ilCtrl->redirect($this, "view");
638 }
639
640 if (in_array($ilUser->getId(), $_POST["id"]))
641 {
642 $this->ilias->raiseError($this->lng->txt("msg_no_delete_yourself"),$this->ilias->error_obj->WARNING);
643 }
644
645 // FOR ALL SELECTED OBJECTS
646 foreach ($_POST["id"] as $id)
647 {
648 // instatiate correct object class (usr)
649 $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);
650 $obj->delete();
651 }
652
653 // Feedback
654 ilUtil::sendSuccess($this->lng->txt("user_deleted"),true);
655
656 if ($_POST["frsrch"])
657 {
658 $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
659 }
660 else
661 {
662 $this->ctrl->redirect($this, "view");
663 }
664 }
665
671 protected function getActionUserIds()
672 {
673 if($_POST["select_cmd_all"])
674 {
675 include_once("./Services/User/classes/class.ilUserTableGUI.php");
676 $utab = new ilUserTableGUI($this, "view", ilUserTableGUI::MODE_USER_FOLDER, false);
677 return $utab->getUserIdsForFilter();
678 }
679 else
680 {
681 return $_POST["id"];
682 }
683 }
684
688 function showActionConfirmation($action, $a_from_search = false)
689 {
690 global $ilTabs;
691
692 $user_ids = $this->getActionUserIds();
693 if(!$user_ids)
694 {
695 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
696 }
697
698 if(!$a_from_search)
699 {
700 $ilTabs->activateTab("obj_usrf");
701 }
702 else
703 {
704 $ilTabs->activateTab("search_user_extended");
705 }
706
707 if (strcmp($action, "accessRestrict") == 0)
708 {
709 return $this->setAccessRestrictionObject(null, $a_from_search);
710 }
711 if (strcmp($action, "mail") == 0)
712 {
713 return $this->mailObject();
714 }
715
716 unset($this->data);
717
718 if(!$a_from_search)
719 {
720 $cancel = "cancelUserFolderAction";
721 }
722 else
723 {
724 $cancel = "cancelSearchAction";
725 }
726
727 // display confirmation message
728 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
729 $cgui = new ilConfirmationGUI();
730 $cgui->setFormAction($this->ctrl->getFormAction($this));
731 $cgui->setHeaderText($this->lng->txt("info_" . $action . "_sure"));
732 $cgui->setCancel($this->lng->txt("cancel"), $cancel);
733 $cgui->setConfirm($this->lng->txt("confirm"), "confirm" . $action);
734
735 if($a_from_search)
736 {
737 $cgui->addHiddenItem("frsrch", 1);
738 }
739
740 foreach($user_ids as $id)
741 {
742 $user = new ilObjUser($id);
743
744 $login = $user->getLastLogin();
745 if(!$login)
746 {
747 $login = $this->lng->txt("never");
748 }
749 else
750 {
752 }
753
754 $caption = $user->getFullname()." (".$user->getLogin().")".", ".
755 $user->getEmail()." - ".$this->lng->txt("last_login").": ".$login;
756
757 $cgui->addItem("id[]", $id, $caption);
758 }
759
760 $this->tpl->setContent($cgui->getHTML());
761
762 return true;
763 }
764
769 {
770 $_POST["selectedAction"] = "delete";
771 $this->showActionConfirmation($_POST["selectedAction"]);
772 }
773
778 {
779 $_POST["selectedAction"] = "activate";
780 $this->showActionConfirmation($_POST["selectedAction"]);
781 }
782
787 {
788 $_POST["selectedAction"] = "deactivate";
789 $this->showActionConfirmation($_POST["selectedAction"]);
790 }
791
796 {
797 $_POST["selectedAction"] = "accessRestrict";
798 $this->showActionConfirmation($_POST["selectedAction"]);
799 }
800
805 {
806 $_POST["selectedAction"] = "accessFree";
807 $this->showActionConfirmation($_POST["selectedAction"]);
808 }
809
811 {
812 $this->showActionConfirmation($_POST["selectedAction"]);
813 }
814
819 {
820 global $tpl, $rbacsystem;
821
822 // Blind out tabs for local user import
823 if ($_GET["baseClass"] == 'ilRepositoryGUI')
824 {
825 $this->tabs_gui->clearTargets();
826 }
827
828 if (!$rbacsystem->checkAccess("write", $this->object->getRefId()))
829 {
830 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
831 }
832
833 $this->initUserImportForm();
834 $tpl->setContent($this->form->getHTML());
835 }
836
842 public function initUserImportForm()
843 {
844 global $lng, $ilCtrl;
845
846 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
847 $this->form = new ilPropertyFormGUI();
848
849 // Import File
850 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
851 $fi = new ilFileInputGUI($lng->txt("import_file"), "importFile");
852 $fi->setSuffixes(array("xml", "zip"));
853 //$fi->enableFileNameSelection();
854 //$fi->setInfo($lng->txt(""));
855 $this->form->addItem($fi);
856
857 $this->form->addCommandButton("importUserRoleAssignment", $lng->txt("import"));
858 $this->form->addCommandButton("importCancelled", $lng->txt("cancel"));
859
860 $this->form->setTitle($lng->txt("import_users"));
861 $this->form->setFormAction($ilCtrl->getFormAction($this));
862
863 }
864
871 {
872 // purge user import directory
873 $import_dir = $this->getImportDir();
874 if (@is_dir($import_dir))
875 {
876 ilUtil::delDir($import_dir);
877 }
878
879 if (strtolower($_GET["baseClass"]) == 'iladministrationgui')
880 {
881 $this->ctrl->redirect($this, "view");
882 //ilUtil::redirect($this->ctrl->getLinkTarget($this,$return_location));
883 }
884 else
885 {
886 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
887 }
888 }
889
893 function getImportDir()
894 {
895 // For each user session a different directory must be used to prevent
896 // that one user session overwrites the import data that another session
897 // is currently importing.
898 global $ilUser;
899 $importDir = ilUtil::getDataDir().'/user_import/usr_'.$ilUser->getId().'_'.session_id();
900 ilUtil::makeDirParents($importDir);
901 return $importDir;
902 }
903
908 {
909 global $ilUser,$rbacreview, $tpl, $lng, $ilCtrl;;
910
911 // Blind out tabs for local user import
912 if ($_GET["baseClass"] == 'ilRepositoryGUI')
913 {
914 $this->tabs_gui->clearTargets();
915 }
916
917 $this->initUserImportForm();
918 if ($this->form->checkInput())
919 {
920 include_once './Services/AccessControl/classes/class.ilObjRole.php';
921 include_once './Services/User/classes/class.ilUserImportParser.php';
922
923 global $rbacreview, $rbacsystem, $tree, $lng;
924
925
926 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.usr_import_roles.html", "Services/User");
927
928 $import_dir = $this->getImportDir();
929
930 // recreate user import directory
931 if (@is_dir($import_dir))
932 {
933 ilUtil::delDir($import_dir);
934 }
935 ilUtil::makeDir($import_dir);
936
937 // move uploaded file to user import directory
938 $file_name = $_FILES["importFile"]["name"];
939 $parts = pathinfo($file_name);
940 $full_path = $import_dir."/".$file_name;
941
942 // check if import file exists
943 if (!is_file($_FILES["importFile"]["tmp_name"]))
944 {
945 ilUtil::delDir($import_dir);
946 $this->ilias->raiseError($this->lng->txt("no_import_file_found")
947 , $this->ilias->error_obj->MESSAGE);
948 }
949 ilUtil::moveUploadedFile($_FILES["importFile"]["tmp_name"],
950 $_FILES["importFile"]["name"], $full_path);
951
952 // handle zip file
953 if (strtolower($parts["extension"]) == "zip")
954 {
955 // unzip file
956 ilUtil::unzip($full_path);
957
958 $xml_file = null;
959 $file_list = ilUtil::getDir($import_dir);
960 foreach ($file_list as $a_file)
961 {
962 if (substr($a_file['entry'],-4) == '.xml')
963 {
964 $xml_file = $import_dir."/".$a_file['entry'];
965 break;
966 }
967 }
968 if (is_null($xml_file))
969 {
970 $subdir = basename($parts["basename"],".".$parts["extension"]);
971 $xml_file = $import_dir."/".$subdir."/".$subdir.".xml";
972 }
973 }
974 // handle xml file
975 else
976 {
977 $xml_file = $full_path;
978 }
979
980 // check xml file
981 if (!is_file($xml_file))
982 {
983 ilUtil::delDir($import_dir);
984 $this->ilias->raiseError($this->lng->txt("no_xml_file_found_in_zip")
985 ." ".$subdir."/".$subdir.".xml", $this->ilias->error_obj->MESSAGE);
986 }
987
988 require_once("./Services/User/classes/class.ilUserImportParser.php");
989
990 // Verify the data
991 // ---------------
992 $importParser = new ilUserImportParser($xml_file, IL_VERIFY);
993 $importParser->startParsing();
994 switch ($importParser->getErrorLevel())
995 {
996 case IL_IMPORT_SUCCESS :
997 break;
998 case IL_IMPORT_WARNING :
999 $this->tpl->setVariable("IMPORT_LOG", $importParser->getProtocolAsHTML($lng->txt("verification_warning_log")));
1000 break;
1001 case IL_IMPORT_FAILURE :
1002 ilUtil::delDir($import_dir);
1003 $this->ilias->raiseError(
1004 $lng->txt("verification_failed").$importParser->getProtocolAsHTML($lng->txt("verification_failure_log")),
1005 $this->ilias->error_obj->MESSAGE
1006 );
1007 return;
1008 }
1009
1010 // Create the role selection form
1011 // ------------------------------
1012 $this->tpl->setCurrentBlock("role_selection_form");
1013 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1014 $this->tpl->setVariable("TXT_IMPORT_USERS", $this->lng->txt("import_users"));
1015 $this->tpl->setVariable("TXT_IMPORT_FILE", $this->lng->txt("import_file"));
1016 $this->tpl->setVariable("IMPORT_FILE", $file_name);
1017 $this->tpl->setVariable("TXT_USER_ELEMENT_COUNT", $this->lng->txt("num_users"));
1018 $this->tpl->setVariable("USER_ELEMENT_COUNT", $importParser->getUserCount());
1019 $this->tpl->setVariable("TXT_ROLE_ASSIGNMENT", $this->lng->txt("role_assignment"));
1020 $this->tpl->setVariable("BTN_IMPORT", $this->lng->txt("import"));
1021 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
1022 $this->tpl->setVariable("XML_FILE_NAME", $xml_file);
1023
1024 // Extract the roles
1025 $importParser = new ilUserImportParser($xml_file, IL_EXTRACT_ROLES);
1026 $importParser->startParsing();
1027 $roles = $importParser->getCollectedRoles();
1028
1029 // get global roles
1030 $all_gl_roles = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
1031 $gl_roles = array();
1032 $roles_of_user = $rbacreview->assignedRoles($ilUser->getId());
1033 foreach ($all_gl_roles as $obj_data)
1034 {
1035 // check assignment permission if called from local admin
1036 if($this->object->getRefId() != USER_FOLDER_ID)
1037 {
1038 if(!in_array(SYSTEM_ROLE_ID,$roles_of_user) && !ilObjRole::_getAssignUsersStatus($obj_data['obj_id']))
1039 {
1040 continue;
1041 }
1042 }
1043 // exclude anonymous role from list
1044 if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID)
1045 {
1046 // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
1047 if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID,$roles_of_user))
1048 {
1049 $gl_roles[$obj_data["obj_id"]] = $obj_data["title"];
1050 }
1051 }
1052 }
1053
1054 // global roles
1055 $got_globals = false;
1056 foreach($roles as $role_id => $role)
1057 {
1058 if ($role["type"] == "Global")
1059 {
1060 if (! $got_globals)
1061 {
1062 $got_globals = true;
1063
1064 $this->tpl->setCurrentBlock("global_role_section");
1065 $this->tpl->setVariable("TXT_GLOBAL_ROLES_IMPORT", $this->lng->txt("roles_of_import_global"));
1066 $this->tpl->setVariable("TXT_GLOBAL_ROLES", $this->lng->txt("assign_global_role"));
1067 }
1068
1069 // pre selection for role
1070 $pre_select = array_search($role[name], $gl_roles);
1071 if (! $pre_select)
1072 {
1073 switch($role["name"])
1074 {
1075 case "Administrator": // ILIAS 2/3 Administrator
1076 $pre_select = array_search("Administrator", $gl_roles);
1077 break;
1078
1079 case "Autor": // ILIAS 2 Author
1080 $pre_select = array_search("User", $gl_roles);
1081 break;
1082
1083 case "Lerner": // ILIAS 2 Learner
1084 $pre_select = array_search("User", $gl_roles);
1085 break;
1086
1087 case "Gast": // ILIAS 2 Guest
1088 $pre_select = array_search("Guest", $gl_roles);
1089 break;
1090
1091 default:
1092 $pre_select = array_search("User", $gl_roles);
1093 break;
1094 }
1095 }
1096 $this->tpl->setCurrentBlock("global_role");
1097 $role_select = ilUtil::formSelect($pre_select, "role_assign[".$role_id."]", $gl_roles, false, true);
1098 $this->tpl->setVariable("TXT_IMPORT_GLOBAL_ROLE", $role["name"]." [".$role_id."]");
1099 $this->tpl->setVariable("SELECT_GLOBAL_ROLE", $role_select);
1100 $this->tpl->parseCurrentBlock();
1101 }
1102 }
1103
1104 // Check if local roles need to be assigned
1105 $got_locals = false;
1106 foreach($roles as $role_id => $role)
1107 {
1108 if ($role["type"] == "Local")
1109 {
1110 $got_locals = true;
1111 break;
1112 }
1113 }
1114
1115 if ($got_locals)
1116 {
1117 $this->tpl->setCurrentBlock("local_role_section");
1118 $this->tpl->setVariable("TXT_LOCAL_ROLES_IMPORT", $this->lng->txt("roles_of_import_local"));
1119 $this->tpl->setVariable("TXT_LOCAL_ROLES", $this->lng->txt("assign_local_role"));
1120
1121
1122 // get local roles
1123 if ($this->object->getRefId() == USER_FOLDER_ID)
1124 {
1125 // The import function has been invoked from the user folder
1126 // object. In this case, we show only matching roles,
1127 // because the user folder object is considered the parent of all
1128 // local roles and may contains thousands of roles on large ILIAS
1129 // installations.
1130 $loc_roles = array();
1131 foreach($roles as $role_id => $role)
1132 {
1133 if ($role["type"] == "Local")
1134 {
1135 $searchName = (substr($role['name'],0,1) == '#') ? $role['name'] : '#'.$role['name'];
1136 $matching_role_ids = $rbacreview->searchRolesByMailboxAddressList($searchName);
1137 foreach ($matching_role_ids as $mid) {
1138 if (! in_array($mid, $loc_roles)) {
1139 $loc_roles[] = $mid;
1140 }
1141 }
1142 }
1143 }
1144 } else {
1145 // The import function has been invoked from a locally
1146 // administrated category. In this case, we show all roles
1147 // contained in the subtree of the category.
1148 $loc_roles = $rbacreview->getAssignableRolesInSubtree($this->object->getRefId());
1149 }
1150 $l_roles = array();
1151
1152 // create a search array with .
1153 $l_roles_mailbox_searcharray = array();
1154 foreach ($loc_roles as $key => $loc_role)
1155 {
1156 // fetch context path of role
1157 $rolf = $rbacreview->getFoldersAssignedToRole($loc_role,true);
1158
1159 // only process role folders that are not set to status "deleted"
1160 // and for which the user has write permissions.
1161 // We also don't show the roles which are in the ROLE_FOLDER_ID folder.
1162 // (The ROLE_FOLDER_ID folder contains the global roles).
1163 if (
1164 !$rbacreview->isDeleted($rolf[0]) &&
1165 $rbacsystem->checkAccess('write',$rolf[0]) &&
1166 $rolf[0] != ROLE_FOLDER_ID
1167 )
1168 {
1169 // A local role is only displayed, if it is contained in the subtree of
1170 // the localy administrated category. If the import function has been
1171 // invoked from the user folder object, we show all local roles, because
1172 // the user folder object is considered the parent of all local roles.
1173 // Thus, if we start from the user folder object, we initialize the
1174 // isInSubtree variable with true. In all other cases it is initialized
1175 // with false, and only set to true if we find the object id of the
1176 // locally administrated category in the tree path to the local role.
1177 $isInSubtree = $this->object->getRefId() == USER_FOLDER_ID;
1178
1179 $path_array = array();
1180 if ($this->tree->isInTree($rolf[0]))
1181 {
1182 // Create path. Paths which have more than 4 segments
1183 // are truncated in the middle.
1184 $tmpPath = $this->tree->getPathFull($rolf[0]);
1185 $tmpPath[] = $rolf[0];//adds target item to list
1186
1187 for ($i = 1, $n = count($tmpPath) - 1; $i < $n; $i++)
1188 {
1189 if ($i < 3 || $i > $n - 3)
1190 {
1191 $path_array[] = $tmpPath[$i]['title'];
1192 }
1193 else if ($i == 3 || $i == $n - 3)
1194 {
1195 $path_array[] = '...';
1196 }
1197
1198 $isInSubtree |= $tmpPath[$i]['obj_id'] == $this->object->getId();
1199 }
1200 //revert this path for a better readability in dropdowns #18306
1201 $path = implode(" < ", array_reverse($path_array));
1202
1203 }
1204 else
1205 {
1206 $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$loc_role.")</b>";
1207 }
1208 $roleMailboxAddress = $rbacreview->getRoleMailboxAddress($loc_role);
1209 $l_roles[$loc_role] = $roleMailboxAddress.', '.$path;
1210 }
1211 } //foreach role
1212
1213 $l_roles[""] = "";
1214 natcasesort($l_roles);
1215 $l_roles[""] = $this->lng->txt("usrimport_ignore_role");
1216 foreach($roles as $role_id => $role)
1217 {
1218 if ($role["type"] == "Local")
1219 {
1220 $this->tpl->setCurrentBlock("local_role");
1221 $this->tpl->setVariable("TXT_IMPORT_LOCAL_ROLE", $role["name"]);
1222 $searchName = (substr($role['name'],0,1) == '#') ? $role['name'] : '#'.$role['name'];
1223 $matching_role_ids = $rbacreview->searchRolesByMailboxAddressList($searchName);
1224 $pre_select = count($matching_role_ids) == 1 ? $matching_role_ids[0] : "";
1225 if ($this->object->getRefId() == USER_FOLDER_ID) {
1226 // There are too many roles in a large ILIAS installation
1227 // that's why whe show only a choice with the the option "ignore",
1228 // and the matching roles.
1229 $selectable_roles = array();
1230 $selectable_roles[""] = $this->lng->txt("usrimport_ignore_role");
1231 foreach ($matching_role_ids as $id)
1232 {
1233 $selectable_roles[$id] = $l_roles[$id];
1234 }
1235 $role_select = ilUtil::formSelect($pre_select, "role_assign[".$role_id."]", $selectable_roles, false, true);
1236 } else {
1237 $role_select = ilUtil::formSelect($pre_select, "role_assign[".$role_id."]", $l_roles, false, true);
1238 }
1239 $this->tpl->setVariable("SELECT_LOCAL_ROLE", $role_select);
1240 $this->tpl->parseCurrentBlock();
1241 }
1242 }
1243 }
1244 //
1245
1246 $this->tpl->setVariable("TXT_CONFLICT_HANDLING", $lng->txt("conflict_handling"));
1247 $handlers = array(
1248 IL_IGNORE_ON_CONFLICT => "ignore_on_conflict",
1249 IL_UPDATE_ON_CONFLICT => "update_on_conflict"
1250 );
1251 $this->tpl->setVariable("TXT_CONFLICT_HANDLING_INFO", str_replace('\n','<br>',$this->lng->txt("usrimport_conflict_handling_info")));
1252 $this->tpl->setVariable("TXT_CONFLICT_CHOICE", $lng->txt("conflict_handling"));
1253 $this->tpl->setVariable("SELECT_CONFLICT", ilUtil::formSelect(IL_IGNORE_ON_CONFLICT, "conflict_handling_choice", $handlers, false, false));
1254
1255 // new account mail
1256 $this->lng->loadLanguageModule("mail");
1257 include_once './Services/User/classes/class.ilObjUserFolder.php';
1258 $amail = ilObjUserFolder::_lookupNewAccountMail($this->lng->getDefaultLanguage());
1259 if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
1260 {
1261 $this->tpl->setCurrentBlock("inform_user");
1262 $this->tpl->setVariable("TXT_ACCOUNT_MAIL", $lng->txt("mail_account_mail"));
1263 if (true)
1264 {
1265 $this->tpl->setVariable("SEND_MAIL", " checked=\"checked\"");
1266 }
1267 $this->tpl->setVariable("TXT_INFORM_USER_MAIL",
1268 $this->lng->txt("user_send_new_account_mail"));
1269 $this->tpl->parseCurrentBlock();
1270 }
1271 }
1272 else
1273 {
1274 $this->form->setValuesByPost();
1275 $tpl->setContent($this->form->getHtml());
1276 }
1277 }
1278
1283 {
1284 global $rbacreview,$ilUser;
1285
1286 // Blind out tabs for local user import
1287 if ($_GET["baseClass"] == 'ilRepositoryGUI')
1288 {
1289 $this->tabs_gui->clearTargets();
1290 }
1291
1292 include_once './Services/AccessControl/classes/class.ilObjRole.php';
1293 include_once './Services/User/classes/class.ilUserImportParser.php';
1294
1295 global $rbacreview, $rbacsystem, $tree, $lng;
1296
1297 switch ($_POST["conflict_handling_choice"])
1298 {
1299 case "update_on_conflict" :
1300 $rule = IL_UPDATE_ON_CONFLICT;
1301 break;
1302 case "ignore_on_conflict" :
1303 default :
1304 $rule = IL_IGNORE_ON_CONFLICT;
1305 break;
1306 }
1307 $importParser = new ilUserImportParser($_POST["xml_file"], IL_USER_IMPORT, $rule);
1308 $importParser->setFolderId($this->getUserOwnerId());
1309 $import_dir = $this->getImportDir();
1310
1311 // Catch hack attempts
1312 // We check here again, if the role folders are in the tree, and if the
1313 // user has permission on the roles.
1314 if ($_POST["role_assign"])
1315 {
1316 $global_roles = $rbacreview->getGlobalRoles();
1317 $roles_of_user = $rbacreview->assignedRoles($ilUser->getId());
1318 foreach ($_POST["role_assign"] as $role_id)
1319 {
1320 if ($role_id != "")
1321 {
1322 if (in_array($role_id, $global_roles))
1323 {
1324 if(!in_array(SYSTEM_ROLE_ID,$roles_of_user))
1325 {
1326 if ($role_id == SYSTEM_ROLE_ID && ! in_array(SYSTEM_ROLE_ID,$roles_of_user)
1327 || ($this->object->getRefId() != USER_FOLDER_ID
1328 && ! ilObjRole::_getAssignUsersStatus($role_id))
1329 )
1330 {
1331 ilUtil::delDir($import_dir);
1332 $this->ilias->raiseError($this->lng->txt("usrimport_with_specified_role_not_permitted"),
1333 $this->ilias->error_obj->MESSAGE);
1334 }
1335 }
1336 }
1337 else
1338 {
1339 $rolf = $rbacreview->getFoldersAssignedToRole($role_id,true);
1340 if ($rbacreview->isDeleted($rolf[0])
1341 || ! $rbacsystem->checkAccess('write',$rolf[0]))
1342 {
1343 ilUtil::delDir($import_dir);
1344 $this->ilias->raiseError($this->lng->txt("usrimport_with_specified_role_not_permitted"),
1345 $this->ilias->error_obj->MESSAGE);
1346 return;
1347 }
1348 }
1349 }
1350 }
1351 }
1352
1353 $importParser->setRoleAssignment($_POST["role_assign"]);
1354 $importParser->startParsing();
1355
1356 // purge user import directory
1357 ilUtil::delDir($import_dir);
1358
1359 switch ($importParser->getErrorLevel())
1360 {
1361 case IL_IMPORT_SUCCESS :
1362 ilUtil::sendSuccess($this->lng->txt("user_imported"), true);
1363 break;
1364 case IL_IMPORT_WARNING :
1365 ilUtil::sendInfo($this->lng->txt("user_imported_with_warnings").$importParser->getProtocolAsHTML($lng->txt("import_warning_log")), true);
1366 break;
1367 case IL_IMPORT_FAILURE :
1368 $this->ilias->raiseError(
1369 $this->lng->txt("user_import_failed")
1370 .$importParser->getProtocolAsHTML($lng->txt("import_failure_log")),
1371 $this->ilias->error_obj->MESSAGE
1372 );
1373 break;
1374 }
1375
1376 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
1377 {
1378 $this->ctrl->redirect($this, "view");
1379 //ilUtil::redirect($this->ctrl->getLinkTarget($this));
1380 }
1381 else
1382 {
1383 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
1384 }
1385 }
1386
1387
1389 {
1390 global $rbacsystem,$ilias;
1391
1392 unset($_SESSION['applied_users']);
1393
1394 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
1395 {
1396 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
1397 }
1398
1399 if(!count($app_users =& $ilias->account->getAppliedUsers()))
1400 {
1401 ilUtil::sendFailure($this->lng->txt('no_users_applied'));
1402
1403 return false;
1404 }
1405
1406 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_applied_users.html", "Services/User");
1407 $this->lng->loadLanguageModule('crs');
1408
1409 $counter = 0;
1410 foreach($app_users as $usr_id)
1411 {
1412 $tmp_user =& ilObjectFactory::getInstanceByObjId($usr_id);
1413
1414 $f_result[$counter][] = ilUtil::formCheckbox(0,"users[]",$usr_id);
1415 $f_result[$counter][] = $tmp_user->getLogin();
1416 $f_result[$counter][] = $tmp_user->getFirstname();
1417 $f_result[$counter][] = $tmp_user->getLastname();
1418
1419 if($tmp_user->getTimeLimitUnlimited())
1420 {
1421 $f_result[$counter][] = "<b>".$this->lng->txt('crs_unlimited')."</b>";
1422 }
1423 else
1424 {
1425 $limit = "<b>".$this->lng->txt('crs_from').'</b> '.strftime("%Y-%m-%d %R",$tmp_user->getTimeLimitFrom()).'<br />';
1426 $limit .= "<b>".$this->lng->txt('crs_to').'</b> '.strftime("%Y-%m-%d %R",$tmp_user->getTimeLimitUntil());
1427
1428 $f_result[$counter][] = $limit;
1429 }
1430 ++$counter;
1431 }
1432
1433 $this->__showAppliedUsersTable($f_result);
1434
1435 return true;
1436 }
1437
1439 {
1440 global $rbacsystem;
1441
1442 if(!$rbacsystem->checkAccess("write", $this->ref_id))
1443 {
1444 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
1445 }
1446
1447 $this->lng->loadLanguageModule('crs');
1448
1449 $_POST['users'] = $_SESSION['applied_users'] = ($_SESSION['applied_users'] ? $_SESSION['applied_users'] : $_POST['users']);
1450
1451 if(!isset($_SESSION['error_post_vars']))
1452 {
1453 ilUtil::sendInfo($this->lng->txt('time_limit_add_time_limit_for_selected'));
1454 }
1455
1456 if(!count($_POST["users"]))
1457 {
1458 ilUtil::sendFailure($this->lng->txt("time_limit_no_users_selected"));
1459 $this->appliedUsersObject();
1460
1461 return false;
1462 }
1463
1464 $counter = 0;
1465 foreach($_POST['users'] as $usr_id)
1466 {
1467 if($counter)
1468 {
1469 $title .= ', ';
1470 }
1471 $tmp_user =& ilObjectFactory::getInstanceByObjId($usr_id);
1472 $title .= $tmp_user->getLogin();
1473 ++$counter;
1474 }
1475 if(strlen($title) > 79)
1476 {
1477 $title = substr($title,0,80);
1478 $title .= '...';
1479 }
1480
1481
1482 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_edit_applied_users.html", "Services/User");
1483 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1484
1485 // LOAD SAVED DATA IN CASE OF ERROR
1486 $time_limit_unlimited = $_SESSION["error_post_vars"]["au"]["time_limit_unlimited"] ?
1487 1 : 0;
1488
1489 $time_limit_start = $_SESSION["error_post_vars"]["au"]["time_limit_start"] ?
1490 $this->__toUnix($_SESSION["error_post_vars"]["au"]["time_limit_start"]) :
1491 time();
1492 $time_limit_end = $_SESSION["error_post_vars"]["au"]["time_limit_end"] ?
1493 $this->__toUnix($_SESSION["error_post_vars"]["au"]["time_limit_end"]) :
1494 time();
1495
1496
1497 // SET TEXT VARIABLES
1498 $this->tpl->setVariable("ALT_IMG",$this->lng->txt("obj_usr"));
1499 $this->tpl->setVariable("TYPE_IMG",ilObject::_getIcon("", "", "usr"));
1500 $this->tpl->setVariable("TITLE",$title);
1501 $this->tpl->setVariable("TXT_TIME_LIMIT",$this->lng->txt("time_limit"));
1502 $this->tpl->setVariable("TXT_TIME_LIMIT_START",$this->lng->txt("crs_start"));
1503 $this->tpl->setVariable("TXT_TIME_LIMIT_END",$this->lng->txt("crs_end"));
1504 $this->tpl->setVariable("CMD_SUBMIT","updateAppliedUsers");
1505 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt("cancel"));
1506 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt("submit"));
1507
1508
1509
1510 $this->tpl->setVariable("SELECT_TIME_LIMIT_START_DAY",$this->__getDateSelect("day","au[time_limit_start][day]",
1511 date("d",$time_limit_start)));
1512 $this->tpl->setVariable("SELECT_TIME_LIMIT_START_MONTH",$this->__getDateSelect("month","au[time_limit_start][month]",
1513 date("m",$time_limit_start)));
1514 $this->tpl->setVariable("SELECT_TIME_LIMIT_START_YEAR",$this->__getDateSelect("year","au[time_limit_start][year]",
1515 date("Y",$time_limit_start)));
1516 $this->tpl->setVariable("SELECT_TIME_LIMIT_START_HOUR",$this->__getDateSelect("hour","au[time_limit_start][hour]",
1517 date("G",$time_limit_start)));
1518 $this->tpl->setVariable("SELECT_TIME_LIMIT_START_MINUTE",$this->__getDateSelect("minute","au[time_limit_start][minute]",
1519 date("i",$time_limit_start)));
1520 $this->tpl->setVariable("SELECT_TIME_LIMIT_END_DAY",$this->__getDateSelect("day","au[time_limit_end][day]",
1521 date("d",$time_limit_end)));
1522 $this->tpl->setVariable("SELECT_TIME_LIMIT_END_MONTH",$this->__getDateSelect("month","au[time_limit_end][month]",
1523 date("m",$time_limit_end)));
1524 $this->tpl->setVariable("SELECT_TIME_LIMIT_END_YEAR",$this->__getDateSelect("year","au[time_limit_end][year]",
1525 date("Y",$time_limit_end)));
1526 $this->tpl->setVariable("SELECT_TIME_LIMIT_END_HOUR",$this->__getDateSelect("hour","au[time_limit_end][hour]",
1527 date("G",$time_limit_end)));
1528 $this->tpl->setVariable("SELECT_TIME_LIMIT_END_MINUTE",$this->__getDateSelect("minute","au[time_limit_end][minute]",
1529 date("i",$time_limit_end)));
1530 if($this->ilias->account->getTimeLimitUnlimited())
1531 {
1532 $this->tpl->setVariable("ROWSPAN",3);
1533 $this->tpl->setCurrentBlock("unlimited");
1534 $this->tpl->setVariable("TXT_TIME_LIMIT_UNLIMITED",$this->lng->txt("crs_unlimited"));
1535 $this->tpl->setVariable("TIME_LIMIT_UNLIMITED",ilUtil::formCheckbox($time_limit_unlimited,"au[time_limit_unlimited]",1));
1536 $this->tpl->parseCurrentBlock();
1537 }
1538 else
1539 {
1540 $this->tpl->setVariable("ROWSPAN",2);
1541 }
1542 }
1543
1545 {
1546 global $rbacsystem;
1547
1548 if(!$rbacsystem->checkAccess("write", $this->ref_id))
1549 {
1550 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
1551 }
1552
1553 $start = $this->__toUnix($_POST['au']['time_limit_start']);
1554 $end = $this->__toUnix($_POST['au']['time_limit_end']);
1555
1556 if(!$_POST['au']['time_limit_unlimited'])
1557 {
1558 if($start > $end)
1559 {
1560 $_SESSION['error_post_vars'] = $_POST;
1561 ilUtil::sendFailure($this->lng->txt('time_limit_not_valid'));
1562 $this->editAppliedUsersObject();
1563
1564 return false;
1565 }
1566 }
1567 #if(!$this->ilias->account->getTimeLimitUnlimited())
1568 #{
1569 # if($start < $this->ilias->account->getTimeLimitFrom() or
1570 # $end > $this->ilias->account->getTimeLimitUntil())
1571 # {
1572 # $_SESSION['error_post_vars'] = $_POST;
1573 # ilUtil::sendInfo($this->lng->txt('time_limit_not_within_owners'));
1574 # $this->editAppliedUsersObject();
1575
1576 # return false;
1577 # }
1578 #}
1579
1580 foreach($_SESSION['applied_users'] as $usr_id)
1581 {
1582 $tmp_user =& ilObjectFactory::getInstanceByObjId($usr_id);
1583
1584 $tmp_user->setTimeLimitUnlimited((int) $_POST['au']['time_limit_unlimited']);
1585 $tmp_user->setTimeLimitFrom($start);
1586 $tmp_user->setTimeLimitUntil($end);
1587 $tmp_user->setTimeLimitMessage(0);
1588 $tmp_user->update();
1589
1590 unset($tmp_user);
1591 }
1592
1593 unset($_SESSION['applied_users']);
1594 ilUtil::sendSuccess($this->lng->txt('time_limit_users_updated'));
1595 $this->appliedUsersObject();
1596
1597 return true;
1598 }
1599
1600 function __showAppliedUsersTable($a_result_set)
1601 {
1602 $tbl =& $this->__initTableGUI();
1603 $tpl =& $tbl->getTemplateObject();
1604
1605 // SET FORMAACTION
1606 $tpl->setCurrentBlock("tbl_form_header");
1607
1608 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1609 $tpl->parseCurrentBlock();
1610
1611 $tpl->setCurrentBlock("tbl_action_btn");
1612 $tpl->setVariable("BTN_NAME",'editAppliedUsers');
1613 $tpl->setVariable("BTN_VALUE",$this->lng->txt('edit'));
1614 $tpl->parseCurrentBlock();
1615
1616 $tpl->setCurrentBlock("tbl_action_row");
1617 $tpl->setVariable("COLUMN_COUNTS",5);
1618 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1619 $tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
1620 $tpl->parseCurrentBlock();
1621
1622
1623
1624 $tbl->setTitle($this->lng->txt("time_limit_applied_users"),"",$this->lng->txt("users"));
1625 $tbl->setHeaderNames(array('',
1626 $this->lng->txt("login"),
1627 $this->lng->txt("firstname"),
1628 $this->lng->txt("lastname"),
1629 $this->lng->txt("time_limits")));
1630 $header_params = $this->ctrl->getParameterArray($this, "appliedUsers");
1631 $tbl->setHeaderVars(array("",
1632 "login",
1633 "firstname",
1634 "lastname",
1635 "time_limit"),
1636 array($header_params));
1637 $tbl->setColumnWidth(array("3%","19%","19%","19%","40%"));
1638
1639
1640 $this->__setTableGUIBasicData($tbl,$a_result_set);
1641 $tbl->render();
1642
1643 $this->tpl->setVariable("APPLIED_USERS",$tbl->tpl->get());
1644
1645 return true;
1646 }
1647
1648 function &__initTableGUI()
1649 {
1650 include_once "./Services/Table/classes/class.ilTableGUI.php";
1651
1652 return new ilTableGUI(0,false);
1653 }
1654
1655 function __setTableGUIBasicData(&$tbl,&$result_set,$from = "")
1656 {
1657 $offset = $_GET["offset"];
1658 $order = $_GET["sort_by"];
1659 $direction = $_GET["sort_order"];
1660
1661 //$tbl->enable("hits");
1662 $tbl->setOrderColumn($order);
1663 $tbl->setOrderDirection($direction);
1664 $tbl->setOffset($offset);
1665 $tbl->setLimit($_GET["limit"]);
1666 $tbl->setMaxCount(count($result_set));
1667 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1668 $tbl->setData($result_set);
1669 }
1670
1671 function __getDateSelect($a_type,$a_varname,$a_selected)
1672 {
1673 switch($a_type)
1674 {
1675 case "minute":
1676 for($i=0;$i<=60;$i++)
1677 {
1678 $days[$i] = $i < 10 ? "0".$i : $i;
1679 }
1680 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
1681
1682 case "hour":
1683 for($i=0;$i<24;$i++)
1684 {
1685 $days[$i] = $i < 10 ? "0".$i : $i;
1686 }
1687 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
1688
1689 case "day":
1690 for($i=1;$i<32;$i++)
1691 {
1692 $days[$i] = $i < 10 ? "0".$i : $i;
1693 }
1694 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
1695
1696 case "month":
1697 for($i=1;$i<13;$i++)
1698 {
1699 $month[$i] = $i < 10 ? "0".$i : $i;
1700 }
1701 return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
1702
1703 case "year":
1704 for($i = date("Y",time());$i < date("Y",time()) + 3;++$i)
1705 {
1706 $year[$i] = $i;
1707 }
1708 return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
1709 }
1710 }
1711 function __toUnix($a_time_arr)
1712 {
1713 return mktime($a_time_arr["hour"],
1714 $a_time_arr["minute"],
1715 $a_time_arr["second"],
1716 $a_time_arr["month"],
1717 $a_time_arr["day"],
1718 $a_time_arr["year"]);
1719 }
1720
1722 {
1723 parent::hitsperpageObject();
1724 $this->viewObject();
1725 }
1726
1731 protected function generalSettingsObject()
1732 {
1733 global $ilSetting;
1734
1735 $this->initFormGeneralSettings();
1736
1737 include_once './Services/User/classes/class.ilUserAccountSettings.php';
1739
1740 $show_blocking_time_in_days = $ilSetting->get('loginname_change_blocking_time') / 86400;
1741 $show_blocking_time_in_days = (float)$show_blocking_time_in_days;
1742
1743 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1745
1746 $this->form->setValuesByArray(
1747 array(
1748 'lua' => $aset->isLocalUserAdministrationEnabled(),
1749 'lrua' => $aset->isUserAccessRestricted(),
1750 'allow_change_loginname' => (bool)$ilSetting->get('allow_change_loginname'),
1751 'create_history_loginname' => (bool)$ilSetting->get('create_history_loginname'),
1752 'reuse_of_loginnames' => (bool)$ilSetting->get('reuse_of_loginnames'),
1753 'loginname_change_blocking_time' => (float)$show_blocking_time_in_days,
1754 'user_adm_alpha_nav' => (int)$ilSetting->get('user_adm_alpha_nav'),
1755 // 'user_ext_profiles' => (int)$ilSetting->get('user_ext_profiles')
1756 'user_reactivate_code' => (int)$ilSetting->get('user_reactivate_code'),
1757 'user_own_account' => (int)$ilSetting->get('user_delete_own_account'),
1758 'user_own_account_email' => $ilSetting->get('user_delete_own_account_email'),
1759
1760 'session_handling_type' => $ilSetting->get('session_handling_type', ilSession::SESSION_HANDLING_FIXED),
1761 'session_reminder_enabled' => $ilSetting->get('session_reminder_enabled'),
1762 'session_max_count' => $ilSetting->get('session_max_count', ilSessionControl::DEFAULT_MAX_COUNT),
1763 'session_min_idle' => $ilSetting->get('session_min_idle', ilSessionControl::DEFAULT_MIN_IDLE),
1764 'session_max_idle' => $ilSetting->get('session_max_idle', ilSessionControl::DEFAULT_MAX_IDLE),
1765 'session_max_idle_after_first_request' => $ilSetting->get('session_max_idle_after_first_request', ilSessionControl::DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST),
1766
1767 'passwd_auto_generate' => (bool)$ilSetting->get("passwd_auto_generate"),
1768 'password_change_on_first_login_enabled' => $security->isPasswordChangeOnFirstLoginEnabled() ? 1 : 0,
1769 'password_must_not_contain_loginame' => $security->getPasswordMustNotContainLoginnameStatus() ? 1 : 0,
1770 'password_chars_and_numbers_enabled' => $security->isPasswordCharsAndNumbersEnabled() ? 1 : 0,
1771 'password_special_chars_enabled' => $security->isPasswordSpecialCharsEnabled() ? 1 : 0 ,
1772 'password_min_length' => $security->getPasswordMinLength(),
1773 'password_max_length' => $security->getPasswordMaxLength(),
1774 'password_ucase_chars_num' => $security->getPasswordNumberOfUppercaseChars(),
1775 'password_lowercase_chars_num' => $security->getPasswordNumberOfLowercaseChars(),
1776 'password_max_age' => $security->getPasswordMaxAge(),
1777
1778 'login_max_attempts' => $security->getLoginMaxAttempts(),
1779 'ps_prevent_simultaneous_logins' => (int)$security->isPreventionOfSimultaneousLoginsEnabled(),
1780 'password_assistance' => (bool)$ilSetting->get("password_assistance")
1781 )
1782 );
1783
1784 $this->tpl->setContent($this->form->getHTML());
1785 }
1786
1787
1793 {
1794 global $ilUser, $ilSetting;
1795
1796 $this->initFormGeneralSettings();
1797 if($this->form->checkInput())
1798 {
1799 $valid = true;
1800
1801 if(!strlen($this->form->getInput('loginname_change_blocking_time')))
1802 {
1803 $valid = false;
1804 $this->form->getItemByPostVar('loginname_change_blocking_time')
1805 ->setAlert($this->lng->txt('loginname_change_blocking_time_invalidity_info'));
1806 }
1807
1808 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1810
1811 // account security settings
1812 $security->setPasswordCharsAndNumbersEnabled((bool) $_POST["password_chars_and_numbers_enabled"]);
1813 $security->setPasswordSpecialCharsEnabled((bool) $_POST["password_special_chars_enabled"]);
1814 $security->setPasswordMinLength((int) $_POST["password_min_length"]);
1815 $security->setPasswordMaxLength((int) $_POST["password_max_length"]);
1816 $security->setPasswordNumberOfUppercaseChars((int) $_POST['password_ucase_chars_num']);
1817 $security->setPasswordNumberOfLowercaseChars((int) $_POST['password_lowercase_chars_num']);
1818 $security->setPasswordMaxAge((int) $_POST["password_max_age"]);
1819 $security->setLoginMaxAttempts((int) $_POST["login_max_attempts"]);
1820 $security->setPreventionOfSimultaneousLogins((bool)$_POST['ps_prevent_simultaneous_logins']);
1821 $security->setPasswordChangeOnFirstLoginEnabled((bool) $_POST['password_change_on_first_login_enabled']);
1822 $security->setPasswordMustNotContainLoginnameStatus((int) $_POST['password_must_not_contain_loginame']);
1823
1824 if(!$security->validate($this->form))
1825 {
1826 $valid = false;
1827 }
1828
1829 if($valid)
1830 {
1831 $security->save();
1832
1833 include_once './Services/User/classes/class.ilUserAccountSettings.php';
1834 ilUserAccountSettings::getInstance()->enableLocalUserAdministration($this->form->getInput('lua'));
1835 ilUserAccountSettings::getInstance()->restrictUserAccess($this->form->getInput('lrua'));
1837
1838 $ilSetting->set('allow_change_loginname', (int)$this->form->getInput('allow_change_loginname'));
1839 $ilSetting->set('create_history_loginname', (int)$this->form->getInput('create_history_loginname'));
1840 $ilSetting->set('reuse_of_loginnames', (int)$this->form->getInput('reuse_of_loginnames'));
1841 $save_blocking_time_in_seconds = (int)($this->form->getInput('loginname_change_blocking_time') * 86400);
1842 $ilSetting->set('loginname_change_blocking_time', (int)$save_blocking_time_in_seconds);
1843 $ilSetting->set('user_adm_alpha_nav', (int)$this->form->getInput('user_adm_alpha_nav'));
1844 $ilSetting->set('user_reactivate_code', (int)$this->form->getInput('user_reactivate_code'));
1845
1846 $ilSetting->set('user_delete_own_account', (int)$this->form->getInput('user_own_account'));
1847 $ilSetting->set('user_delete_own_account_email', $this->form->getInput('user_own_account_email'));
1848
1849 $ilSetting->set("passwd_auto_generate", $this->form->getInput("passwd_auto_generate"));
1850 $ilSetting->set("password_assistance", $this->form->getInput("password_assistance"));
1851
1852 // BEGIN SESSION SETTINGS
1853 $ilSetting->set('session_handling_type',
1854 (int)$this->form->getInput('session_handling_type'));
1855
1856 if( $this->form->getInput('session_handling_type') == ilSession::SESSION_HANDLING_FIXED )
1857 {
1858 $ilSetting->set('session_reminder_enabled',
1859 $this->form->getInput('session_reminder_enabled'));
1860 }
1861 else if( $this->form->getInput('session_handling_type') == ilSession::SESSION_HANDLING_LOAD_DEPENDENT )
1862 {
1863 require_once 'Services/Authentication/classes/class.ilSessionControl.php';
1864 if(
1865 $ilSetting->get('session_allow_client_maintenance',
1867 )
1868 {
1869 // has to be done BEFORE updating the setting!
1870 include_once "Services/Authentication/classes/class.ilSessionStatistics.php";
1871 ilSessionStatistics::updateLimitLog((int)$this->form->getInput('session_max_count'));
1872
1873 $ilSetting->set('session_max_count',
1874 (int)$this->form->getInput('session_max_count'));
1875 $ilSetting->set('session_min_idle',
1876 (int)$this->form->getInput('session_min_idle'));
1877 $ilSetting->set('session_max_idle',
1878 (int)$this->form->getInput('session_max_idle'));
1879 $ilSetting->set('session_max_idle_after_first_request',
1880 (int)$this->form->getInput('session_max_idle_after_first_request'));
1881 }
1882 }
1883 // END SESSION SETTINGS
1884
1885 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
1886 }
1887 else
1888 {
1889 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
1890 }
1891 }
1892 else
1893 {
1894 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
1895 }
1896 $this->form->setValuesByPost();
1897 $this->tpl->setContent($this->form->getHTML());
1898 }
1899
1900
1905 protected function initFormGeneralSettings()
1906 {
1907 global $ilSetting;
1908
1909 $this->setSubTabs('settings');
1910 $this->tabs_gui->setTabActive('settings');
1911 $this->tabs_gui->setSubTabActive('general_settings');
1912
1913 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1914 $this->form = new ilPropertyFormGUI();
1915 $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings'));
1916
1917 $this->form->setTitle($this->lng->txt('general_settings'));
1918
1919 $lua = new ilCheckboxInputGUI($this->lng->txt('enable_local_user_administration'),'lua');
1920 $lua->setInfo($this->lng->txt('enable_local_user_administration_info'));
1921 $lua->setValue(1);
1922 $this->form->addItem($lua);
1923
1924 $lrua = new ilCheckboxInputGUI($this->lng->txt('restrict_user_access'),'lrua');
1925 $lrua->setInfo($this->lng->txt('restrict_user_access_info'));
1926 $lrua->setValue(1);
1927 $this->form->addItem($lrua);
1928
1929 // enable alphabetical navigation in user administration
1930 $alph = new ilCheckboxInputGUI($this->lng->txt('user_adm_enable_alpha_nav'), 'user_adm_alpha_nav');
1931 //$alph->setInfo($this->lng->txt('restrict_user_access_info'));
1932 $alph->setValue(1);
1933 $this->form->addItem($alph);
1934
1935 // account codes
1936 $code = new ilCheckboxInputGUI($this->lng->txt("user_account_code_setting"), "user_reactivate_code");
1937 $code->setInfo($this->lng->txt('user_account_code_setting_info'));
1938 $this->form->addItem($code);
1939
1940 // delete own account
1941 $own = new ilCheckboxInputGUI($this->lng->txt("user_allow_delete_own_account"), "user_own_account");
1942 $this->form->addItem($own);
1943 $own_email = new ilEMailInputGUI($this->lng->txt("user_delete_own_account_notification_email"), "user_own_account_email");
1944 $own->addSubItem($own_email);
1945
1946
1947 // BEGIN SESSION SETTINGS
1948
1949 // create session handling radio group
1950 $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type');
1951
1952 // first option, fixed session duration
1953 $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED);
1954
1955 // create session reminder subform
1956 $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled");
1958 $time = ilFormat::_secondsToString($expires, true);
1959 $cb->setInfo($this->lng->txt("session_reminder_info")."<br />".
1960 sprintf($this->lng->txt('session_reminder_session_duration'), $time));
1961 $fixed->addSubItem($cb);
1962
1963 // add session handling to radio group
1964 $ssettings->addOption($fixed);
1965
1966 // second option, session control
1967 $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT);
1968
1969 // add session control subform
1970 require_once('Services/Authentication/classes/class.ilSessionControl.php');
1971
1972 // this is the max count of active sessions
1973 // that are getting started simlutanously
1974 $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count');
1975 $sub_ti->setMaxLength(5);
1976 $sub_ti->setSize(5);
1977 $sub_ti->setInfo($this->lng->txt('session_max_count_info'));
1978 if( !$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE) )
1979 $sub_ti->setDisabled(true);
1980 $ldsh->addSubItem($sub_ti);
1981
1982 // after this (min) idle time the session can be deleted,
1983 // if there are further requests for new sessions,
1984 // but max session count is reached yet
1985 $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle');
1986 $sub_ti->setMaxLength(5);
1987 $sub_ti->setSize(5);
1988 $sub_ti->setInfo($this->lng->txt('session_min_idle_info'));
1989 if( !$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE) )
1990 $sub_ti->setDisabled(true);
1991 $ldsh->addSubItem($sub_ti);
1992
1993 // after this (max) idle timeout the session expires
1994 // and become invalid, so it is not considered anymore
1995 // when calculating current count of active sessions
1996 $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle');
1997 $sub_ti->setMaxLength(5);
1998 $sub_ti->setSize(5);
1999 $sub_ti->setInfo($this->lng->txt('session_max_idle_info'));
2000 if( !$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE) )
2001 $sub_ti->setDisabled(true);
2002 $ldsh->addSubItem($sub_ti);
2003
2004 // this is the max duration that can elapse between the first and the secnd
2005 // request to the system before the session is immidietly deleted
2006 $sub_ti = new ilTextInputGUI(
2007 $this->lng->txt('session_max_idle_after_first_request'),
2008 'session_max_idle_after_first_request'
2009 );
2010 $sub_ti->setMaxLength(5);
2011 $sub_ti->setSize(5);
2012 $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info'));
2013 if( !$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE) )
2014 $sub_ti->setDisabled(true);
2015 $ldsh->addSubItem($sub_ti);
2016
2017 // add session control to radio group
2018 $ssettings->addOption($ldsh);
2019
2020 // add radio group to form
2021 if( $ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE) )
2022 {
2023 // just shows the status wether the session
2024 //setting maintenance is allowed by setup
2025 $this->form->addItem($ssettings);
2026 }
2027 else
2028 {
2029 // just shows the status wether the session
2030 //setting maintenance is allowed by setup
2031 $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config");
2032 $ti->setValue($this->lng->txt('session_config_maintenance_disabled'));
2033 $ssettings->setDisabled(true);
2034 $ti->addSubItem($ssettings);
2035 $this->form->addItem($ti);
2036 }
2037
2038 // END SESSION SETTINGS
2039
2040
2041 $this->lng->loadLanguageModule('ps');
2042
2044 $pass->setTitle($this->lng->txt('ps_password_settings'));
2045 $this->form->addItem($pass);
2046
2047 // password generation
2048 $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation_pre"), "passwd_auto_generate");
2049 $cb->setChecked($ilSetting->get("passwd_auto_generate"));
2050 $cb->setInfo($this->lng->txt("passwd_generation_info"));
2051 $this->form->addItem($cb);
2052
2053 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'),'password_change_on_first_login_enabled');
2054 $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info'));
2055 $this->form->addItem($check);
2056
2057 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2058
2059 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_must_not_contain_loginame'),'password_must_not_contain_loginame');
2060 $check->setInfo($this->lng->txt('ps_password_must_not_contain_loginame_info'));
2061 $this->form->addItem($check);
2062
2063 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'),'password_chars_and_numbers_enabled');
2064 //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled'));
2065 $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info'));
2066 $this->form->addItem($check);
2067
2068 $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'),'password_special_chars_enabled');
2069 //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled'));
2070 $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info'));
2071 $this->form->addItem($check);
2072
2073 $text = new ilNumberInputGUI($this->lng->txt('ps_password_min_length'),'password_min_length');
2074 $text->setInfo($this->lng->txt('ps_password_min_length_info'));
2075 $text->setSize(1);
2076 $text->setMaxLength(2);
2077 $this->form->addItem($text);
2078
2079 $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_length'),'password_max_length');
2080 $text->setInfo($this->lng->txt('ps_password_max_length_info'));
2081 $text->setSize(2);
2082 $text->setMaxLength(3);
2083 $this->form->addItem($text);
2084
2085 $text = new ilNumberInputGUI($this->lng->txt('ps_password_uppercase_chars_num'), 'password_ucase_chars_num');
2086 $text->setInfo($this->lng->txt('ps_password_uppercase_chars_num_info'));
2087 $text->setMinValue(0);
2088 $text->setSize(2);
2089 $text->setMaxLength(3);
2090 $this->form->addItem($text);
2091
2092 $text = new ilNumberInputGUI($this->lng->txt('ps_password_lowercase_chars_num'), 'password_lowercase_chars_num');
2093 $text->setInfo($this->lng->txt('ps_password_lowercase_chars_num_info'));
2094 $text->setMinValue(0);
2095 $text->setSize(2);
2096 $text->setMaxLength(3);
2097 $this->form->addItem($text);
2098
2099 $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_age'),'password_max_age');
2100 $text->setInfo($this->lng->txt('ps_password_max_age_info'));
2101 $text->setSize(2);
2102 $text->setMaxLength(3);
2103 $this->form->addItem($text);
2104
2105 // password assistance
2106 $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance");
2107 $cb->setInfo($this->lng->txt("password_assistance_info"));
2108 $this->form->addItem($cb);
2109
2111 $pass->setTitle($this->lng->txt('ps_security_protection'));
2112 $this->form->addItem($pass);
2113
2114 $text = new ilNumberInputGUI($this->lng->txt('ps_login_max_attempts'),'login_max_attempts');
2115 $text->setInfo($this->lng->txt('ps_login_max_attempts_info'));
2116 $text->setSize(1);
2117 $text->setMaxLength(2);
2118 $this->form->addItem($text);
2119
2120 // prevent login from multiple pcs at the same time
2121 $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins');
2122 $objCb->setValue(1);
2123 $objCb->setInfo($this->lng->txt('ps_prevent_simultaneous_logins_info'));
2124 $this->form->addItem($objCb);
2125
2126
2127
2128
2130 $log->setTitle($this->lng->txt('loginname_settings'));
2131 $this->form->addItem($log);
2132
2133 $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname');
2134 $chbChangeLogin->setValue(1);
2135 $this->form->addItem($chbChangeLogin);
2136 $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname');
2137 $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info'));
2138 $chbCreateHistory->setValue(1);
2139
2140 $chbChangeLogin->addSubItem($chbCreateHistory);
2141 $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames');
2142 $chbReuseLoginnames->setValue(1);
2143 $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info'));
2144
2145 $chbChangeLogin->addSubItem($chbReuseLoginnames);
2146 $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time');
2147 $chbChangeBlockingTime->allowDecimals(true);
2148 $chbChangeBlockingTime->setSuffix($this->lng->txt('days'));
2149 $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info'));
2150 $chbChangeBlockingTime->setSize(10);
2151 $chbChangeBlockingTime->setMaxLength(10);
2152 $chbChangeLogin->addSubItem($chbChangeBlockingTime);
2153
2154 $this->form->addCommandButton('saveGeneralSettings', $this->lng->txt('save'));
2155 }
2156
2157
2158
2159
2171 {
2172 global $tpl, $lng, $ilias, $ilTabs;
2173
2174 include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
2175 $lng->loadLanguageModule("administration");
2176 $lng->loadLanguageModule("mail");
2177 $this->setSubTabs('settings');
2178 $ilTabs->activateTab('settings');
2179 $ilTabs->activateSubTab('standard_fields');
2180
2181 include_once("./Services/User/classes/class.ilUserFieldSettingsTableGUI.php");
2182 $tab = new ilUserFieldSettingsTableGUI($this, "settings");
2183 if($this->confirm_change) $tab->setConfirmChange();
2184 $tpl->setContent($tab->getHTML());
2185 }
2186
2188 {
2189 $this->saveGlobalUserSettingsObject("save");
2190 }
2191
2192 function saveGlobalUserSettingsObject($action = "")
2193 {
2194 include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
2195 include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
2196
2197 global $ilias,$ilSetting;
2198
2199 // see ilUserFieldSettingsTableGUI
2200 include_once("./Services/User/classes/class.ilUserProfile.php");
2201 $up = new ilUserProfile();
2202 $up->skipField("username");
2203 $field_properties = $up->getStandardFields();
2204 $profile_fields = array_keys($field_properties);
2205
2206 $valid = true;
2207 foreach ($profile_fields as $field)
2208 {
2209 if ( $_POST["chb"]["required_".$field] &&
2210 !(int)$_POST['chb']['visib_reg_' . $field]
2211 ){
2212 $valid = false;
2213 break;
2214 }
2215 }
2216
2217 if(!$valid)
2218 {
2219 global $lng;
2220 ilUtil::sendFailure($lng->txt('invalid_visible_required_options_selected'));
2221 $this->confirm_change = 1;
2222 $this->settingsObject();
2223 return;
2224 }
2225
2226 // For the following fields, the required state can not be changed
2227 $fixed_required_fields = array(
2228 "firstname" => 1,
2229 "lastname" => 1,
2230 "upload" => 0,
2231 "password" => 0,
2232 "language" => 0,
2233 "skin_style" => 0,
2234 "hits_per_page" => 0,
2235 /*"show_users_online" => 0,*/
2236 "hide_own_online_status" => 0
2237 );
2238
2239 // check if a course export state of any field has been added
2241 if ($privacy->enabledCourseExport() == true &&
2242 $privacy->courseConfirmationRequired() == true &&
2243 $action != "save")
2244 {
2245 foreach ($profile_fields as $field)
2246 {
2247 if (! $ilias->getSetting("usr_settings_course_export_" . $field) && $_POST["chb"]["course_export_" . $field] == "1")
2248 {
2249 #ilUtil::sendQuestion($this->lng->txt('confirm_message_course_export'));
2250 #$this->confirm_change = 1;
2251 #$this->settingsObject();
2252 #return;
2253 }
2254 }
2255 }
2256 // Reset user confirmation
2257 if($action == 'save')
2258 {
2259 include_once('Services/Membership/classes/class.ilMemberAgreement.php');
2261 }
2262
2263 foreach ($profile_fields as $field)
2264 {
2265 // Enable disable searchable
2267 {
2268 ilUserSearchOptions::_saveStatus($field,(bool) $_POST['chb']['searchable_'.$field]);
2269 }
2270
2271 if (!$_POST["chb"]["visible_".$field] && !$field_properties[$field]["visible_hide"])
2272 {
2273 $ilias->setSetting("usr_settings_hide_".$field, "1");
2274 }
2275 else
2276 {
2277 $ilias->deleteSetting("usr_settings_hide_".$field);
2278 }
2279
2280 if (!$_POST["chb"]["changeable_" . $field] && !$field_properties[$field]["changeable_hide"])
2281 {
2282 $ilias->setSetting("usr_settings_disable_".$field, "1");
2283 }
2284 else
2285 {
2286 $ilias->deleteSetting("usr_settings_disable_".$field);
2287 }
2288
2289 // registration visible
2290 if ((int)$_POST['chb']['visib_reg_' . $field] && !$field_properties[$field]["visib_reg_hide"])
2291 {
2292 $ilSetting->set('usr_settings_visib_reg_'.$field, '1');
2293 }
2294 else
2295 {
2296 $ilSetting->set('usr_settings_visib_reg_'.$field, '0');
2297 }
2298
2299 if ((int)$_POST['chb']['visib_lua_' . $field])
2300 {
2301
2302 $ilSetting->set('usr_settings_visib_lua_'.$field, '1');
2303 }
2304 else
2305 {
2306 $ilSetting->set('usr_settings_visib_lua_'.$field, '0');
2307 }
2308
2309 if ((int)$_POST['chb']['changeable_lua_' . $field])
2310 {
2311
2312 $ilSetting->set('usr_settings_changeable_lua_'.$field, '1');
2313 }
2314 else
2315 {
2316 $ilSetting->set('usr_settings_changeable_lua_'.$field, '0');
2317 }
2318
2319 if ($_POST["chb"]["export_" . $field] && !$field_properties[$field]["export_hide"])
2320 {
2321 $ilias->setSetting("usr_settings_export_".$field, "1");
2322 }
2323 else
2324 {
2325 $ilias->deleteSetting("usr_settings_export_".$field);
2326 }
2327
2328 // Course export/visibility
2329 if ($_POST["chb"]["course_export_" . $field] && !$field_properties[$field]["course_export_hide"])
2330 {
2331 $ilias->setSetting("usr_settings_course_export_".$field, "1");
2332 }
2333 else
2334 {
2335 $ilias->deleteSetting("usr_settings_course_export_".$field);
2336 }
2337
2338 // Group export/visibility
2339 if ($_POST["chb"]["group_export_" . $field] && !$field_properties[$field]["group_export_hide"])
2340 {
2341 $ilias->setSetting("usr_settings_group_export_".$field, "1");
2342 }
2343 else
2344 {
2345 $ilias->deleteSetting("usr_settings_group_export_".$field);
2346 }
2347
2348 $is_fixed = array_key_exists($field, $fixed_required_fields);
2349 if ($is_fixed && $fixed_required_fields[$field] || ! $is_fixed && $_POST["chb"]["required_".$field])
2350 {
2351 $ilias->setSetting("require_".$field, "1");
2352 }
2353 else
2354 {
2355 $ilias->deleteSetting("require_" . $field);
2356 }
2357 }
2358
2359 if ($_POST["select"]["default_hits_per_page"])
2360 {
2361 $ilias->setSetting("hits_per_page",$_POST["select"]["default_hits_per_page"]);
2362 }
2363
2364 /*if ($_POST["select"]["default_show_users_online"])
2365 {
2366 $ilias->setSetting("show_users_online",$_POST["select"]["default_show_users_online"]);
2367 }*/
2368
2369 if ($_POST["chb"]["export_preferences"])
2370 {
2371 $ilias->setSetting("usr_settings_export_preferences",$_POST["chb"]["export_preferences"]);
2372 } else {
2373 $ilias->deleteSetting("usr_settings_export_preferences");
2374 }
2375
2376 $ilias->setSetting('mail_incoming_mail', (int)$_POST['select']['default_mail_incoming_mail']);
2377
2378 ilUtil::sendSuccess($this->lng->txt("usr_settings_saved"));
2379 $this->settingsObject();
2380 }
2381
2382
2387 {
2388 $action[-1] = $this->lng->txt('all_users');
2389 $action[1] = $this->lng->txt('usr_active_only');
2390 $action[0] = $this->lng->txt('usr_inactive_only');
2391 $action[2] = $this->lng->txt('usr_limited_access_only');
2392 $action[3] = $this->lng->txt('usr_without_courses');
2393 $action[4] = $this->lng->txt('usr_filter_lastlogin');
2394 $action[5] = $this->lng->txt("usr_filter_coursemember");
2395 $action[6] = $this->lng->txt("usr_filter_groupmember");
2396 $action[7] = $this->lng->txt("usr_filter_role");
2397
2398 return ilUtil::formSelect($_SESSION['user_filter'],"user_filter",$action,false,true);
2399 }
2400
2408 {
2409 if(!isset($_POST["file"]))
2410 {
2411 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2412 }
2413
2414 if (count($_POST["file"]) > 1)
2415 {
2416 $this->ilias->raiseError($this->lng->txt("select_max_one_item"),$this->ilias->error_obj->MESSAGE);
2417 }
2418
2419 $file = basename($_POST["file"][0]);
2420
2421 $export_dir = $this->object->getExportDirectory();
2422 ilUtil::deliverFile($export_dir."/".$file, $file);
2423 }
2424
2429 {
2430 if(!isset($_POST["file"]))
2431 {
2432 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2433 }
2434
2435 // display confirmation message
2436 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2437 $cgui = new ilConfirmationGUI();
2438 $cgui->setFormAction($this->ctrl->getFormAction($this));
2439 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
2440 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteExportFile");
2441 $cgui->setConfirm($this->lng->txt("confirm"), "deleteExportFile");
2442
2443 // BEGIN TABLE DATA
2444 foreach($_POST["file"] as $file)
2445 {
2446 $cgui->addItem("file[]", $file, $file, ilObject::_getIcon($this->object->getId()), $this->lng->txt("obj_usrf"));
2447 }
2448
2449 $this->tpl->setContent($cgui->getHTML());
2450 }
2451
2452
2457 {
2458 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
2459 }
2460
2461
2466 {
2467 $export_dir = $this->object->getExportDirectory();
2468 foreach($_POST["file"] as $file)
2469 {
2470 $file = basename($file);
2471
2472 $exp_file = $export_dir."/".$file;
2473 if (@is_file($exp_file))
2474 {
2475 unlink($exp_file);
2476 }
2477 }
2478 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
2479 }
2480
2491 function exportObject()
2492 {
2493 global $ilias, $ilCtrl;
2494
2495 if ($_POST["cmd"]["export"])
2496 {
2497 $this->object->buildExportFile($_POST["export_type"]);
2498 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
2499 exit;
2500 }
2501
2502 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.usr_export.html','Services/User');
2503
2504 $export_types = array(
2505 "userfolder_export_excel_x86",
2506 "userfolder_export_csv",
2507 "userfolder_export_xml"
2508 );
2509
2510 // create table
2511 include_once("./Services/Table/classes/class.ilTableGUI.php");
2512 $tbl = new ilTableGUI();
2513
2514 // load files templates
2515 $this->tpl->addBlockfile("EXPORT_FILES", "export_files", "tpl.table.html");
2516
2517 // load template for table content data
2518 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.usr_export_file_row.html", "Services/User");
2519
2520 $num = 0;
2521
2522 $tbl->setTitle($this->lng->txt("userfolder_export_files"));
2523
2524 $tbl->setHeaderNames(array("", $this->lng->txt("userfolder_export_file"),
2525 $this->lng->txt("userfolder_export_file_size"), $this->lng->txt("date") ));
2526 $tbl->setHeaderVars(array(), $ilCtrl->getParameterArray($this, "export"));
2527
2528 $tbl->enabled["sort"] = false;
2529 $tbl->setColumnWidth(array("1%", "49%", "25%", "25%"));
2530
2531 // control
2532 $tbl->setOrderColumn($_GET["sort_by"]);
2533 $tbl->setOrderDirection($_GET["sort_order"]);
2534 $tbl->setLimit($_GET["limit"]);
2535 $tbl->setOffset($_GET["offset"]);
2536 $tbl->setMaxCount($this->maxcount); // ???
2537
2538
2539 $this->tpl->setVariable("COLUMN_COUNTS", 4);
2540
2541 // delete button
2542 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
2543 $this->tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
2544 $this->tpl->setCurrentBlock("tbl_action_btn");
2545 $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
2546 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
2547 $this->tpl->parseCurrentBlock();
2548
2549 $this->tpl->setCurrentBlock("tbl_action_btn");
2550 $this->tpl->setVariable("BTN_NAME", "downloadExportFile");
2551 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
2552 $this->tpl->parseCurrentBlock();
2553
2554 // footer
2555 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
2556 //$tbl->disable("footer");
2557
2558 $export_files = $this->object->getExportFiles();
2559
2560 $tbl->setMaxCount(count($export_files));
2561 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
2562
2563 $tbl->render();
2564
2565 if(count($export_files) > 0)
2566 {
2567 $i=0;
2568 foreach($export_files as $exp_file)
2569 {
2570 $this->tpl->setCurrentBlock("tbl_content");
2571 $this->tpl->setVariable("TXT_FILENAME", $exp_file["filename"]);
2572
2573 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
2574 $this->tpl->setVariable("CSS_ROW", $css_row);
2575
2576 $this->tpl->setVariable("TXT_SIZE", $exp_file["filesize"]);
2577 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["filename"]);
2578
2579 $file_arr = explode("__", $exp_file["filename"]);
2580 $this->tpl->setVariable('TXT_DATE',ilDatePresentation::formatDate(new ilDateTime($file_arr[0],IL_CAL_UNIX)));
2581
2582 $this->tpl->parseCurrentBlock();
2583 }
2584
2585 $this->tpl->setCurrentBlock("selectall");
2586 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
2587 $this->tpl->setVariable("CSS_ROW", $css_row);
2588 $this->tpl->parseCurrentBlock();
2589 } //if is_array
2590 /*
2591 else
2592
2593 {
2594 $this->tpl->setCurrentBlock("notfound");
2595 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
2596 $this->tpl->setVariable("NUM_COLS", 3);
2597 $this->tpl->parseCurrentBlock();
2598 }
2599 */
2600
2601 $this->tpl->parseCurrentBlock();
2602
2603
2604 foreach ($export_types as $export_type)
2605 {
2606 $this->tpl->setCurrentBlock("option");
2607 $this->tpl->setVariable("OPTION_VALUE", $export_type);
2608 $this->tpl->setVariable("OPTION_TEXT", $this->lng->txt($export_type));
2609 $this->tpl->parseCurrentBlock();
2610 }
2611
2612 $this->tpl->setVariable("EXPORT_BUTTON", $this->lng->txt("create_export_file"));
2613 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2614 }
2615
2616 protected function initNewAccountMailForm()
2617 {
2618 global $lng, $ilCtrl;
2619
2620 $lng->loadLanguageModule("meta");
2621 $lng->loadLanguageModule("mail");
2622
2623 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
2624 $form = new ilPropertyFormGUI();
2625 $form->setFormAction($ilCtrl->getFormAction($this));
2626
2627 $form->setTitleIcon(ilUtil::getImagePath("icon_mail.svg"));
2628 $form->setTitle($lng->txt("user_new_account_mail"));
2629 $form->setDescription($lng->txt("user_new_account_mail_desc"));
2630
2631 $langs = $lng->getInstalledLanguages();
2632 foreach($langs as $lang_key)
2633 {
2634 $amail = $this->object->_lookupNewAccountMail($lang_key);
2635
2636 $title = $lng->txt("meta_l_".$lang_key);
2637 if ($lang_key == $lng->getDefaultLanguage())
2638 {
2639 $title .= " (".$lng->txt("default").")";
2640 }
2641
2643 $header->setTitle($title);
2644 $form->addItem($header);
2645
2646 $subj = new ilTextInputGUI($lng->txt("subject"), "subject_".$lang_key);
2647 // $subj->setRequired(true);
2648 $subj->setValue($amail["subject"]);
2649 $form->addItem($subj);
2650
2651 $salg = new ilTextInputGUI($lng->txt("mail_salutation_general"), "sal_g_".$lang_key);
2652 // $salg->setRequired(true);
2653 $salg->setValue($amail["sal_g"]);
2654 $form->addItem($salg);
2655
2656 $salf = new ilTextInputGUI($lng->txt("mail_salutation_female"), "sal_f_".$lang_key);
2657 // $salf->setRequired(true);
2658 $salf->setValue($amail["sal_f"]);
2659 $form->addItem($salf);
2660
2661 $salm = new ilTextInputGUI($lng->txt("mail_salutation_male"), "sal_m_".$lang_key);
2662 // $salm->setRequired(true);
2663 $salm->setValue($amail["sal_m"]);
2664 $form->addItem($salm);
2665
2666 $body = new ilTextAreaInputGUI($lng->txt("message_content"), "body_".$lang_key);
2667 // $body->setRequired(true);
2668 $body->setValue($amail["body"]);
2669 $body->setRows(10);
2670 $body->setCols(100);
2671 $form->addItem($body);
2672
2673 $att = new ilFileInputGUI($lng->txt("attachment"), "att_".$lang_key);
2674 $att->setAllowDeletion(true);
2675 if($amail["att_file"])
2676 {
2677 $att->setValue($amail["att_file"]);
2678 }
2679 $form->addItem($att);
2680 }
2681
2682 $form->addCommandButton("saveNewAccountMail", $lng->txt("save"));
2683 $form->addCommandButton("cancelNewAccountMail", $lng->txt("cancel"));
2684
2685 return $form;
2686 }
2687
2692 {
2693 global $lng;
2694
2695 $this->setSubTabs('settings');
2696 $this->tabs_gui->setTabActive('settings');
2697 $this->tabs_gui->setSubTabActive('user_new_account_mail');
2698
2699 $form = $this->initNewAccountMailForm();
2700
2701 $ftpl = new ilTemplate('tpl.usrf_new_account_mail.html', true, true, 'Services/User');
2702 $ftpl->setVariable("FORM", $form->getHTML());
2703 unset($form);
2704
2705 // placeholder help text
2706 $ftpl->setVariable("TXT_USE_PLACEHOLDERS", $lng->txt("mail_nacc_use_placeholder"));
2707 $ftpl->setVariable("TXT_MAIL_SALUTATION", $lng->txt("mail_nacc_salutation"));
2708 $ftpl->setVariable("TXT_FIRST_NAME", $lng->txt("firstname"));
2709 $ftpl->setVariable("TXT_LAST_NAME", $lng->txt("lastname"));
2710 $ftpl->setVariable("TXT_EMAIL", $lng->txt("email"));
2711 $ftpl->setVariable("TXT_LOGIN", $lng->txt("mail_nacc_login"));
2712 $ftpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
2713 $ftpl->setVariable("TXT_PASSWORD_BLOCK", $lng->txt("mail_nacc_pw_block"));
2714 $ftpl->setVariable("TXT_NOPASSWORD_BLOCK", $lng->txt("mail_nacc_no_pw_block"));
2715 $ftpl->setVariable("TXT_ADMIN_MAIL", $lng->txt("mail_nacc_admin_mail"));
2716 $ftpl->setVariable("TXT_ILIAS_URL", $lng->txt("mail_nacc_ilias_url"));
2717 $ftpl->setVariable("TXT_CLIENT_NAME", $lng->txt("mail_nacc_client_name"));
2718 $ftpl->setVariable("TXT_TARGET", $lng->txt("mail_nacc_target"));
2719 $ftpl->setVariable("TXT_TARGET_TITLE", $lng->txt("mail_nacc_target_title"));
2720 $ftpl->setVariable("TXT_TARGET_TYPE", $lng->txt("mail_nacc_target_type"));
2721 $ftpl->setVariable("TXT_TARGET_BLOCK", $lng->txt("mail_nacc_target_block"));
2722 $ftpl->setVariable("TXT_IF_TIMELIMIT", $lng->txt("mail_nacc_if_timelimit"));
2723 $ftpl->setVariable("TXT_TIMELIMIT", $lng->txt("mail_nacc_timelimit"));
2724
2725 $this->tpl->setContent($ftpl->get());
2726 }
2727
2729 {
2730 $this->ctrl->redirect($this, "settings");
2731 }
2732
2734 {
2735 global $lng;
2736
2737 $langs = $lng->getInstalledLanguages();
2738 foreach($langs as $lang_key)
2739 {
2740 $this->object->_writeNewAccountMail($lang_key,
2741 ilUtil::stripSlashes($_POST["subject_".$lang_key]),
2742 ilUtil::stripSlashes($_POST["sal_g_".$lang_key]),
2743 ilUtil::stripSlashes($_POST["sal_f_".$lang_key]),
2744 ilUtil::stripSlashes($_POST["sal_m_".$lang_key]),
2745 ilUtil::stripSlashes($_POST["body_".$lang_key]));
2746
2747 if($_FILES["att_".$lang_key]["tmp_name"])
2748 {
2749 $this->object->_updateAccountMailAttachment($lang_key,
2750 $_FILES["att_".$lang_key]["tmp_name"],
2751 $_FILES["att_".$lang_key]["name"]);
2752 }
2753
2754 if ($_POST["att_".$lang_key."_delete"])
2755 {
2756 $this->object->_deleteAccountMailAttachment($lang_key);
2757 }
2758 }
2759
2760 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2761 $this->ctrl->redirect($this, "newAccountMail");
2762 }
2763
2764 function getAdminTabs(&$tabs_gui)
2765 {
2766 $this->getTabs($tabs_gui);
2767 }
2768
2774 function getTabs(&$tabs_gui)
2775 {
2776 include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
2777
2778 global $rbacsystem;
2779
2780 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
2781 {
2782 $tabs_gui->addTarget("usrf",
2783 $this->ctrl->getLinkTarget($this, "view"), array("view","delete","resetFilter", "userAction", ""), "", "");
2784
2785 $tabs_gui->addTarget(
2786 "search_user_extended",
2787 $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI',''),
2788 array(),
2789 "ilrepositorysearchgui",
2790 ""
2791 );
2792 }
2793
2794 if ($rbacsystem->checkAccess("write",$this->object->getRefId()))
2795 {
2796 $tabs_gui->addTarget("settings",
2797 $this->ctrl->getLinkTarget($this, "generalSettings"),array('settings','generalSettings','listUserDefinedField','newAccountMail'));
2798
2799 $tabs_gui->addTarget("export",
2800 $this->ctrl->getLinkTarget($this, "export"), "export", "", "");
2801
2802 /* deprecated, JF 27 May 2013
2803 if(ilObjUserTracking::_enabledLearningProgress() &&
2804 ilObjUserTracking::_enabledUserRelatedData())
2805 {
2806 $tabs_gui->addTarget("learning_progress",
2807 $this->ctrl->getLinkTarget($this, "learningProgress"), "learningProgress", "", "");
2808 }
2809 */
2810 }
2811
2812 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
2813 {
2814 $tabs_gui->addTarget("perm_settings",
2815 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
2816 array("perm","info","owner"), 'ilpermissiongui');
2817 }
2818 }
2819
2820
2824 function setSubTabs($a_tab)
2825 {
2826 global $rbacsystem,$ilUser;
2827
2828 switch($a_tab)
2829 {
2830 case "settings":
2831 $this->tabs_gui->addSubTabTarget(
2832 'general_settings',
2833 $this->ctrl->getLinkTarget($this, 'generalSettings'), 'generalSettings', get_class($this));
2834 $this->tabs_gui->addSubTabTarget("standard_fields",
2835 $this->ctrl->getLinkTarget($this,'settings'),
2836 array("settings", "saveGlobalUserSettings"), get_class($this));
2837 $this->tabs_gui->addSubTabTarget("user_defined_fields",
2838 $this->ctrl->getLinkTargetByClass("ilcustomuserfieldsgui", "listUserDefinedFields"),
2839 "listUserDefinedFields",get_class($this));
2840 $this->tabs_gui->addSubTabTarget("user_new_account_mail",
2841 $this->ctrl->getLinkTarget($this,'newAccountMail'),
2842 "newAccountMail",get_class($this));
2843 #$this->tabs_gui->addSubTab("account_codes", $this->lng->txt("user_account_codes"),
2844 # $this->ctrl->getLinkTargetByClass("ilaccountcodesgui"));
2845 break;
2846 }
2847 }
2848
2850 {
2851 global $ilSetting;
2852
2853 $show_blocking_time_in_days = (int)$ilSetting->get('loginname_change_blocking_time') / 86400;
2854
2855 $this->initLoginSettingsForm();
2856 $this->loginSettingsForm->setValuesByArray(array(
2857 'allow_change_loginname' => (bool)$ilSetting->get('allow_change_loginname'),
2858 'create_history_loginname' => (bool)$ilSetting->get('create_history_loginname'),
2859 'reuse_of_loginnames' => (bool)$ilSetting->get('reuse_of_loginnames'),
2860 'loginname_change_blocking_time' => (float)$show_blocking_time_in_days
2861 ));
2862
2863 $this->tpl->setVariable('ADM_CONTENT', $this->loginSettingsForm->getHTML());
2864 }
2865
2866 private function initLoginSettingsForm()
2867 {
2868 $this->setSubTabs('settings');
2869 $this->tabs_gui->setTabActive('settings');
2870 $this->tabs_gui->setSubTabActive('loginname_settings');
2871
2872 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
2873 $this->loginSettingsForm = new ilPropertyFormGUI;
2874 $this->loginSettingsForm->setFormAction($this->ctrl->getFormAction($this, 'saveLoginnameSettings'));
2875 $this->loginSettingsForm->setTitle($this->lng->txt('loginname_settings'));
2876
2877 $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname');
2878 $chbChangeLogin->setValue(1);
2879 $this->loginSettingsForm->addItem($chbChangeLogin);
2880 $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname');
2881 $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info'));
2882 $chbCreateHistory->setValue(1);
2883 $chbChangeLogin->addSubItem($chbCreateHistory);
2884 $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames');
2885 $chbReuseLoginnames->setValue(1);
2886 $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info'));
2887 $chbChangeLogin->addSubItem($chbReuseLoginnames);
2888 $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time');
2889 $chbChangeBlockingTime->allowDecimals(true);
2890 $chbChangeBlockingTime->setSuffix($this->lng->txt('days'));
2891 $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info'));
2892 $chbChangeBlockingTime->setSize(10);
2893 $chbChangeBlockingTime->setMaxLength(10);
2894 $chbChangeLogin->addSubItem($chbChangeBlockingTime);
2895
2896 $this->loginSettingsForm->addCommandButton('saveLoginnameSettings', $this->lng->txt('save'));
2897 }
2898
2900 {
2901 global $ilUser, $ilSetting;
2902
2903 $this->initLoginSettingsForm();
2904 if($this->loginSettingsForm->checkInput())
2905 {
2906 $valid = true;
2907
2908 if(!strlen($this->loginSettingsForm->getInput('loginname_change_blocking_time')))
2909 {
2910 $valid = false;
2911 $this->loginSettingsForm->getItemByPostVar('loginname_change_blocking_time')
2912 ->setAlert($this->lng->txt('loginname_change_blocking_time_invalidity_info'));
2913 }
2914
2915 if($valid)
2916 {
2917 $save_blocking_time_in_seconds = (int)$this->loginSettingsForm->getInput('loginname_change_blocking_time') * 86400;
2918
2919 $ilSetting->set('allow_change_loginname', (int)$this->loginSettingsForm->getInput('allow_change_loginname'));
2920 $ilSetting->set('create_history_loginname', (int)$this->loginSettingsForm->getInput('create_history_loginname'));
2921 $ilSetting->set('reuse_of_loginnames', (int)$this->loginSettingsForm->getInput('reuse_of_loginnames'));
2922 $ilSetting->set('loginname_change_blocking_time', (int)$save_blocking_time_in_seconds);
2923
2924 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
2925 }
2926 else
2927 {
2928 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
2929 }
2930 }
2931 else
2932 {
2933 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
2934 }
2935 $this->loginSettingsForm->setValuesByPost();
2936
2937 $this->tpl->setVariable('ADM_CONTENT', $this->loginSettingsForm->getHTML());
2938 }
2939
2943 public static function _goto($a_user)
2944 {
2945 global $ilAccess, $ilErr, $lng;
2946
2947 $a_target = USER_FOLDER_ID;
2948
2949 if ($ilAccess->checkAccess("read", "", $a_target))
2950 {
2951 ilUtil::redirect("ilias.php?baseClass=ilAdministrationGUI&ref_id=".$a_target."&jmpToUser=".$a_user);
2952 exit;
2953 }
2954 else
2955 {
2956 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
2957 {
2958 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
2961 }
2962 }
2963 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2964 }
2965
2970 {
2971 global $ilCtrl;
2972
2973 if (((int) $_GET["jmpToUser"]) > 0 && ilObject::_lookupType((int)$_GET["jmpToUser"]) == "usr")
2974 {
2975 $ilCtrl->setParameterByClass("ilobjusergui", "obj_id", (int) $_GET["jmpToUser"]);
2976 $ilCtrl->redirectByClass("ilobjusergui", "view");
2977 }
2978 }
2979
2983 public function searchResultHandler($a_usr_ids,$a_cmd)
2984 {
2985 if(!count((array) $a_usr_ids))
2986 {
2987 ilUtil::sendFailure($this->lng->txt('select_one'));
2988 return false;
2989 }
2990
2991 $_POST['id'] = $a_usr_ids;
2992
2993 // no real confirmation here
2994 if(stristr($a_cmd, "export"))
2995 {
2996 $cmd = $a_cmd."Object";
2997 return $this->$cmd();
2998 }
2999
3000 $_POST['selectedAction'] = $a_cmd;
3001 return $this->showActionConfirmation($a_cmd, true);
3002 }
3003
3004 public function getUserMultiCommands($a_search_form = false)
3005 {
3006 global $rbacsystem, $ilUser;
3007
3008 // see searchResultHandler()
3009 if($a_search_form)
3010 {
3011 $cmds = array(
3012 'activate' => $this->lng->txt('activate'),
3013 'deactivate' => $this->lng->txt('deactivate'),
3014 'accessRestrict' => $this->lng->txt('accessRestrict'),
3015 'accessFree' => $this->lng->txt('accessFree')
3016 );
3017
3018 if ($rbacsystem->checkAccess('delete', $this->object->getRefId()))
3019 {
3020 $cmds["delete"] = $this->lng->txt("delete");
3021 }
3022 }
3023 // show confirmation
3024 else
3025 {
3026 $cmds = array(
3027 'activateUsers' => $this->lng->txt('activate'),
3028 'deactivateUsers' => $this->lng->txt('deactivate'),
3029 'restrictAccess' => $this->lng->txt('accessRestrict'),
3030 'freeAccess' => $this->lng->txt('accessFree')
3031 );
3032
3033 if ($rbacsystem->checkAccess('delete', $this->object->getRefId()))
3034 {
3035 $cmds["deleteUsers"] = $this->lng->txt("delete");
3036 }
3037 }
3038
3039 // no confirmation needed
3040 $export_types = array("userfolder_export_excel_x86", "userfolder_export_csv", "userfolder_export_xml");
3041 foreach ($export_types as $type)
3042 {
3043 $cmd = explode("_", $type);
3044 $cmd = array_pop($cmd);
3045 $cmds['usrExport'.ucfirst($cmd)] = $this->lng->txt('export').' - '.
3046 $this->lng->txt($type);
3047 }
3048
3049 // check if current user may send mails
3050 include_once "Services/Mail/classes/class.ilMail.php";
3051 $mail = new ilMail($ilUser->getId());
3052 if($rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId()))
3053 {
3054 $cmds["mail"] = $this->lng->txt("send_mail");
3055 }
3056
3057 return $cmds;
3058 }
3059
3061 {
3062 $user_ids = $this->getActionUserIds();
3063 if(!$user_ids)
3064 {
3065 ilUtil::sendFailure($this->lng->txt('select_one'));
3066 return $this->viewObject();
3067 }
3068 $this->object->buildExportFile("userfolder_export_excel_x86", $user_ids);
3069 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
3070 }
3071
3073 {
3074 $user_ids = $this->getActionUserIds();
3075 if(!$user_ids)
3076 {
3077 ilUtil::sendFailure($this->lng->txt('select_one'));
3078 return $this->viewObject();
3079 }
3080 $this->object->buildExportFile("userfolder_export_csv", $user_ids);
3081 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
3082 }
3083
3085 {
3086 $user_ids = $this->getActionUserIds();
3087 if(!$user_ids)
3088 {
3089 ilUtil::sendFailure($this->lng->txt('select_one'));
3090 return $this->viewObject();
3091 }
3092 $this->object->buildExportFile("userfolder_export_xml", $user_ids);
3093 $this->ctrl->redirectByClass("ilobjuserfoldergui", "export");
3094 }
3095
3096 function mailObject()
3097 {
3098 global $ilUser;
3099
3100 $user_ids = $this->getActionUserIds();
3101 if(!$user_ids)
3102 {
3103 ilUtil::sendFailure($this->lng->txt('select_one'));
3104 return $this->viewObject();
3105 }
3106
3107 // remove existing (temporary) lists
3108 include_once "Services/Contact/classes/class.ilMailingLists.php";
3109 $list = new ilMailingLists($ilUser);
3110 $list->deleteTemporaryLists();
3111
3112 // create (temporary) mailing list
3113 include_once "Services/Contact/classes/class.ilMailingList.php";
3114 $list = new ilMailingList($ilUser);
3115 $list->setMode(ilMailingList::MODE_TEMPORARY);
3116 $list->setTitle("-TEMPORARY SYSTEM LIST-");
3117 $list->setDescription("-USER ACCOUNTS MAIL-");
3118 $list->setCreateDate(date("Y-m-d H:i:s"));
3119 $list->insert();
3120 $list_id = $list->getId();
3121
3122 // after list has been saved...
3123 foreach($user_ids as $user_id)
3124 {
3125 $list->assignUser($user_id);
3126 }
3127
3128 include_once "Services/Mail/classes/class.ilFormatMail.php";
3129 $umail = new ilFormatMail($ilUser->getId());
3130 $mail_data = $umail->getSavedData();
3131
3132 if(!is_array($mail_data))
3133 {
3134 $mail_data = array("user_id" => $ilUser->getId());
3135 }
3136
3137 // ???
3138 // $mail_data = $umail->appendSearchResult(array('#il_ml_'.$list_id), 'to');
3139
3140 $umail->savePostData(
3141 $mail_data['user_id'],
3142 $mail_data['attachments'],
3143 '#il_ml_'.$list_id, // $mail_data['rcp_to'],
3144 $mail_data['rcp_cc'],
3145 $mail_data['rcp_bcc'],
3146 $mail_data['m_type'],
3147 $mail_data['m_email'],
3148 $mail_data['m_subject'],
3149 $mail_data['m_message'],
3150 $mail_data['use_placeholders'],
3151 $mail_data['tpl_ctx_id'],
3152 $mail_data['tpl_ctx_params']
3153 );
3154
3155 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
3158 $this,
3159 '',
3160 array(),
3161 array(
3162 'type' => 'search_res'
3163 )
3164 )
3165 );
3166 }
3167
3168 public function addToExternalSettingsForm($a_form_id)
3169 {
3170 switch($a_form_id)
3171 {
3173
3174 include_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
3176
3177 $fields = array();
3178
3179 $subitems = array(
3180 'ps_password_change_on_first_login_enabled' => array($security->isPasswordChangeOnFirstLoginEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3181 'ps_password_must_not_contain_loginame' => array((bool)$security->getPasswordMustNotContainLoginnameStatus(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3182 'ps_password_chars_and_numbers_enabled' => array($security->isPasswordCharsAndNumbersEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3183 'ps_password_special_chars_enabled' => array($security->isPasswordSpecialCharsEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL),
3184 'ps_password_min_length' => (int)$security->getPasswordMinLength(),
3185 'ps_password_max_length' => (int)$security->getPasswordMaxLength(),
3186 'ps_password_uppercase_chars_num' => (int)$security->getPasswordNumberOfUppercaseChars(),
3187 'ps_password_lowercase_chars_num' => (int)$security->getPasswordNumberOfLowercaseChars(),
3188 'ps_password_max_age' => (int)$security->getPasswordMaxAge()
3189 );
3190 $fields['ps_password_settings'] = array(null, null, $subitems);
3191
3192 $subitems = array(
3193 'ps_login_max_attempts' => (int)$security->getLoginMaxAttempts(),
3194 'ps_prevent_simultaneous_logins' => array($security->isPreventionOfSimultaneousLoginsEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL)
3195 );
3196 $fields['ps_security_protection'] = array(null, null, $subitems);
3197
3198 return array(array("generalSettings", $fields));
3199 }
3200 }
3201
3202} // END class.ilObjUserFolderGUI
3203?>
print $file
$n
Definition: RandomTest.php:80
$_GET["client_id"]
$_SESSION["AccountId"]
const IL_CAL_UNIX
const IL_CAL_DATETIME
const USER_FOLDER_ID
Class ilObjUserFolder.
const IL_IMPORT_FAILURE
const IL_UPDATE_ON_CONFLICT
const IL_EXTRACT_ROLES
const IL_IMPORT_SUCCESS
const IL_USER_IMPORT
const IL_VERIFY
const IL_IGNORE_ON_CONFLICT
const IL_IMPORT_WARNING
GUI class for account codes.
This class represents a text property in a property form.
This class represents a checkbox property in a property form.
Confirmation screen class.
Class ilCustomUserFieldsGUI.
static formatDate(ilDateTime $date)
Format a date @access public.
This class represents a date/time property in a property form.
@classDescription Date and time handling
This class represents a email property in a property form.
This class represents a file property in a property form.
setFormAction($a_formaction)
Set FormAction.
This class represents a section header in a property form.
Class UserMail this class handles user mails.
_secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
This class represents a hidden form property in a property form.
static getInstance()
Factory.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
Class Mail this class handles base functions for mail handling.
static _reset()
Reset all.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
_getAssignUsersStatus($a_role_id)
Class ilObjUserFolderGUI.
deactivateUsersObject()
Deactivate users.
importCancelledObject()
import cancelled
getTabs(&$tabs_gui)
get tabs @access public
resetFilterObject()
Reset filter (note: this function existed before data table filter has been introduced.
saveGeneralSettingsObject()
Save user account settings.
addUserAutoCompleteObject()
Show auto complete results.
confirmdeactivateObject()
Set the selected users inactive.
restrictAccessObject()
Restrict access.
newAccountMailObject()
new account mail administration
showPossibleSubObjects()
show possible subobjects (pulldown menu) overwritten to prevent displaying of role templates in local...
__getDateSelect($a_type, $a_varname, $a_selected)
initUserImportForm()
Init user import form.
& executeCommand()
execute command
activateUsersObject()
Activate users.
confirmdeleteObject()
confirm delete Object
initFormGeneralSettings()
init general settings form
getUserMultiCommands($a_search_form=false)
setAccessRestrictionObject($a_form=null, $a_from_search=false)
viewObject($reset_filter=FALSE)
list users
importUserFormObject()
display form for user import
importUserRoleAssignmentObject()
display form for user import
exportObject()
Global user settings.
jumpToUserObject()
Jump to edit screen for user.
__buildUserFilterSelect()
build select form to distinguish between active and non-active users
initAccessRestrictionForm($a_from_search=false)
getActionUserIds()
Get selected items for table action.
cancelDeleteExportFileObject()
cancel deletion of export files
searchResultHandler($a_usr_ids, $a_cmd)
Handles multi command from repository search gui.
downloadExportFileObject()
Download selected export files.
confirmDeleteExportFileObject()
confirmation screen for export file deletion
getAdminTabs(&$tabs_gui)
administration tabs show only permissions and trash folder
settingsObject()
Global user settings.
static _goto($a_user)
goto target group
getImportDir()
get user import directory name
showActionConfirmation($action, $a_from_search=false)
display activation confirmation screen
showActions($with_subobjects=false)
show possible action (form buttons)
setSubTabs($a_tab)
set sub tabs
__setTableGUIBasicData(&$tbl, &$result_set, $from="")
standard implementation for tables use 'from' variable use different initial setting of table
ilObjUserFolderGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor @access public.
deleteExportFileObject()
delete export files
generalSettingsObject()
Show user account general settings.
__showAppliedUsersTable($a_result_set)
confirmactivateObject()
Set the selected users active.
chooseLetterObject()
Choose first letter.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static getFirstLettersOfLastnames()
Get first letters of all lastnames.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjectGUI Basic methods of all Output classes.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
viewObject()
list childs of current object
prepareOutput()
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilPrivacySettings.
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.
static _getInstance()
Get instance of ilSecuritySettings.
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet
static updateLimitLog($a_new_value)
Log max session setting.
const SESSION_HANDLING_LOAD_DEPENDENT
const SESSION_HANDLING_FIXED
static getSessionExpireValue()
Returns the session expiration value.
Class ilTableGUI.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getInstance()
Singelton get instance.
Auto completion class for user lists.
Learning progress account list for user administration.
Class ilUserProfile.
static _saveStatus($a_key, $a_enabled)
TableGUI class for user administration.
static getDataDir()
get data directory (outside webspace)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
$_POST['username']
Definition: cron.php:12
$valid
$header
$text
$tbl
Definition: example_048.php:81
$code
Definition: example_050.php:99
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
$path
Definition: index.php:22
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15