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