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