ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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->setTitle($this->lng->txt("search_user_extended")); // #17502
80  $user_search->enableSearchableCheck(false);
81  $user_search->setCallback(
82  $this,
83  'searchResultHandler',
84  $this->getUserMultiCommands(true)
85  );
86  $this->tabs_gui->setTabActive('search_user_extended');
87  $this->ctrl->setReturn($this,'view');
88  $ret =& $this->ctrl->forwardCommand($user_search);
89  break;
90 
91  case 'ilaccountcodesgui':
92  $this->tabs_gui->setTabActive('settings');
93  $this->setSubTabs("settings");
94  $ilTabs->activateSubTab("account_codes");
95  include_once("./Services/User/classes/class.ilAccountCodesGUI.php");
96  $acc = new ilAccountCodesGUI($this->ref_id);
97  $this->ctrl->forwardCommand($acc);
98  break;
99 
100  case 'ilcustomuserfieldsgui':
101  $this->tabs_gui->setTabActive('settings');
102  $this->setSubTabs("settings");
103  $ilTabs->activateSubTab("user_defined_fields");
104  include_once("./Services/User/classes/class.ilCustomUserFieldsGUI.php");
105  $cf = new ilCustomUserFieldsGUI();
106  $this->ctrl->forwardCommand($cf);
107  break;
108 
109  default:
110  if(!$cmd)
111  {
112  $cmd = "view";
113  }
114  $cmd .= "Object";
115 
116  $this->$cmd();
117 
118  break;
119  }
120  return true;
121  }
122 
124  {
125  global $rbacsystem, $tpl;
126 
127  // deprecated JF 27 May 2013
128  exit();
129 
130  if (!$rbacsystem->checkAccess("read",$this->object->getRefId()) ||
133  {
134  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
135  }
136 
137  include_once "Services/User/classes/class.ilUserLPTableGUI.php";
138  $tbl = new ilUserLPTableGUI($this, "learningProgress", $this->object->getRefId());
139 
140  $tpl->setContent($tbl->getHTML());
141  }
142 
147  function resetFilterObject()
148  {
149  include_once("./Services/User/classes/class.ilUserTableGUI.php");
150  $utab = new ilUserTableGUI($this, "view");
151  $utab->resetOffset();
152  $utab->resetFilter();
153 
154  // from "old" implementation
155  $this->viewObject(TRUE);
156  }
157 
161  function addUserObject()
162  {
163  global $ilCtrl;
164 
165  $ilCtrl->setParameterByClass("ilobjusergui", "new_type", "usr");
166  $ilCtrl->redirectByClass(array("iladministrationgui", "ilobjusergui"), "create");
167  }
168 
169 
173  function applyFilterObject()
174  {
175  global $ilTabs;
176 
177  include_once("./Services/User/classes/class.ilUserTableGUI.php");
178  $utab = new ilUserTableGUI($this, "view");
179  $utab->resetOffset();
180  $utab->writeFilterToSession();
181  $this->viewObject();
182  $ilTabs->activateTab("usrf");
183  }
184 
190  function viewObject($reset_filter = FALSE)
191  {
192  global $rbacsystem, $ilUser, $ilToolbar, $tpl, $ilSetting, $lng;
193 
194  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
195 
196  if ($rbacsystem->checkAccess('create_usr', $this->object->getRefId()) ||
197  $rbacsystem->checkAccess('cat_administrate_users', $this->object->getRefId()))
198  {
199  $button = ilLinkButton::getInstance();
200  $button->setCaption("usr_add");
201  $button->setUrl($this->ctrl->getLinkTarget($this, "addUser"));
202  $ilToolbar->addButtonInstance($button);
203 
204  $button = ilLinkButton::getInstance();
205  $button->setCaption("import_users");
206  $button->setUrl($this->ctrl->getLinkTarget($this, "importUserForm"));
207  $ilToolbar->addButtonInstance($button);
208  }
209 
210  // alphabetical navigation
211  include_once './Services/User/classes/class.ilUserAccountSettings.php';
213  if ((int) $ilSetting->get('user_adm_alpha_nav'))
214  {
215  $ilToolbar->addSeparator();
216 
217  // alphabetical navigation
218  include_once("./Services/Form/classes/class.ilAlphabetInputGUI.php");
219  $ai = new ilAlphabetInputGUI("", "first");
220  include_once("./Services/User/classes/class.ilObjUser.php");
221  $ai->setLetters(ilObjUser::getFirstLettersOfLastnames());
222  /*$ai->setLetters(array("A","B","C","D","E","F","G","H","I","J",
223  "K","L","M","N","O","P","Q","R","S","T",
224  "U","V","W","X","Y","Z","1","2","3","4","_",
225  "Ä","Ü","Ö",":",";","+","*","#","§","%","&"));*/
226  $ai->setParentCommand($this, "chooseLetter");
227  $ai->setHighlighted($_GET["letter"]);
228  $ilToolbar->addInputItem($ai, true);
229 
230  }
231 
232  include_once("./Services/User/classes/class.ilUserTableGUI.php");
233  $utab = new ilUserTableGUI($this, "view");
234  $tpl->setContent($utab->getHTML());
235  }
236 
240  protected function addUserAutoCompleteObject()
241  {
242  include_once './Services/User/classes/class.ilUserAutoComplete.php';
243  $auto = new ilUserAutoComplete();
244  $auto->setSearchFields(array('login','firstname','lastname','email'));
245  $auto->enableFieldSearchableCheck(false);
246  $auto->setMoreLinkAvailable(true);
247 
248  if(($_REQUEST['fetchall']))
249  {
250  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
251  }
252 
253  echo $auto->getList($_REQUEST['term']);
254  exit();
255  }
256 
264  {
265  global $ilCtrl;
266 
267  $ilCtrl->redirect($this, "view");
268  }
269 
270 
277  function showActions($with_subobjects = false)
278  {
279  global $rbacsystem;
280 
281  $operations = array();
282 //var_dump($this->actions);
283  if ($this->actions == "")
284  {
285  $d = array(
286  "delete" => array("name" => "delete", "lng" => "delete"),
287  "activate" => array("name" => "activate", "lng" => "activate"),
288  "deactivate" => array("name" => "deactivate", "lng" => "deactivate"),
289  "accessRestrict" => array("name" => "accessRestrict", "lng" => "accessRestrict"),
290  "accessFree" => array("name" => "accessFree", "lng" => "accessFree"),
291  "export" => array("name" => "export", "lng" => "export")
292  );
293  }
294  else
295  {
296  $d = $this->actions;
297  }
298  foreach ($d as $row)
299  {
300  if ($rbacsystem->checkAccess($row["name"],$this->object->getRefId()))
301  {
302  $operations[] = $row;
303  }
304  }
305 
306  if (count($operations) > 0)
307  {
308  $select = "<select name=\"selectedAction\">\n";
309  foreach ($operations as $val)
310  {
311  $select .= "<option value=\"" . $val["name"] . "\"";
312  if (strcmp($_POST["selectedAction"], $val["name"]) == 0)
313  {
314  $select .= " selected=\"selected\"";
315  }
316  $select .= ">";
317  $select .= $this->lng->txt($val["lng"]);
318  $select .= "</option>";
319  }
320  $select .= "</select>";
321  $this->tpl->setCurrentBlock("tbl_action_select");
322  $this->tpl->setVariable("SELECT_ACTION", $select);
323  $this->tpl->setVariable("BTN_NAME", "userAction");
324  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("submit"));
325  $this->tpl->parseCurrentBlock();
326  }
327 
328  if ($with_subobjects === true)
329  {
330  $subobjs = $this->showPossibleSubObjects();
331  }
332 
333  if ((count($operations) > 0) or $subobjs === true)
334  {
335  $this->tpl->setCurrentBlock("tbl_action_row");
336  $this->tpl->setVariable("COLUMN_COUNTS",count($this->data["cols"]));
337  $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
338  $this->tpl->setVariable("ALT_ARROW", $this->lng->txt("actions"));
339  $this->tpl->parseCurrentBlock();
340  }
341  }
342 
350  {
351  global $rbacsystem;
352 
353  $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
354 
355  if (!$rbacsystem->checkAccess('create_usr',$this->object->getRefId()))
356  {
357  unset($d["usr"]);
358  }
359 
360  if (count($d) > 0)
361  {
362  foreach ($d as $row)
363  {
364  $count = 0;
365  if ($row["max"] > 0)
366  {
367  //how many elements are present?
368  for ($i=0; $i<count($this->data["ctrl"]); $i++)
369  {
370  if ($this->data["ctrl"][$i]["type"] == $row["name"])
371  {
372  $count++;
373  }
374  }
375  }
376  if ($row["max"] == "" || $count < $row["max"])
377  {
378  $subobj[] = $row["name"];
379  }
380  }
381  }
382 
383  if (is_array($subobj))
384  {
385  //build form
386  $opts = ilUtil::formSelect(12,"new_type",$subobj);
387  $this->tpl->setCurrentBlock("add_object");
388  $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
389  $this->tpl->setVariable("BTN_NAME", "create");
390  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
391  $this->tpl->parseCurrentBlock();
392 
393  return true;
394  }
395 
396  return false;
397  }
398 
400  {
401  $this->ctrl->redirect($this, 'view');
402  }
403 
405  {
406  $this->ctrl->redirectByClass('ilrepositorysearchgui', 'showSearchResults');
407  }
408 
415  {
416  global $rbacsystem, $ilUser;
417 
418  // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
419  if (!$rbacsystem->checkAccess('write',$this->object->getRefId()))
420  {
421  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->WARNING);
422  }
423 
424  // FOR ALL SELECTED OBJECTS
425  foreach ($_POST["id"] as $id)
426  {
427  // instatiate correct object class (usr)
428  $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);
429  $obj->setActive(TRUE, $ilUser->getId());
430  $obj->update();
431  }
432 
433  ilUtil::sendSuccess($this->lng->txt("user_activated"),true);
434 
435  if ($_POST["frsrch"])
436  {
437  $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
438  }
439  else
440  {
441  $this->ctrl->redirect($this, "view");
442  }
443  }
444 
451  {
452  global $rbacsystem, $ilUser;
453 
454  // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
455  if (!$rbacsystem->checkAccess('write',$this->object->getRefId()))
456  {
457  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->WARNING);
458  }
459 
460  // FOR ALL SELECTED OBJECTS
461  foreach ($_POST["id"] as $id)
462  {
463  // instatiate correct object class (usr)
464  $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);
465  $obj->setActive(FALSE, $ilUser->getId());
466  $obj->update();
467  }
468 
469  // Feedback
470  ilUtil::sendSuccess($this->lng->txt("user_deactivated"),true);
471 
472  if ($_POST["frsrch"])
473  {
474  $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
475  }
476  else
477  {
478  $this->ctrl->redirect($this, "view");
479  }
480  }
481 
483  {
484  global $rbacsystem, $ilUser;
485 
486  // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
487  if (!$rbacsystem->checkAccess('write',$this->object->getRefId()))
488  {
489  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->WARNING);
490  }
491 
492  // FOR ALL SELECTED OBJECTS
493  foreach ($_POST["id"] as $id)
494  {
495  // instatiate correct object class (usr)
496  $obj = $this->ilias->obj_factory->getInstanceByObjId($id);
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->setTimeLimitUnlimited(0);
604  $obj->setTimeLimitFrom($timefrom);
605  $obj->setTimeLimitUntil($timeuntil);
606  $obj->setTimeLimitMessage(0);
607  $obj->update();
608  }
609 
610  // Feedback
611  ilUtil::sendSuccess($this->lng->txt("access_restricted"),true);
612 
613  if ($_POST["frsrch"])
614  {
615  $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
616  }
617  else
618  {
619  $this->ctrl->redirect($this, "view");
620  }
621  }
622 
629  {
630  global $rbacsystem, $ilCtrl, $ilUser;
631 
632  // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
633  if (!$rbacsystem->checkAccess('delete',$this->object->getRefId()))
634  {
635  ilUtil::sendFailure($this->lng->txt("msg_no_perm_delete"), true);
636  $ilCtrl->redirect($this, "view");
637  }
638 
639  if (in_array($ilUser->getId(), $_POST["id"]))
640  {
641  $this->ilias->raiseError($this->lng->txt("msg_no_delete_yourself"),$this->ilias->error_obj->WARNING);
642  }
643 
644  // FOR ALL SELECTED OBJECTS
645  foreach ($_POST["id"] as $id)
646  {
647  // instatiate correct object class (usr)
648  $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);
649  $obj->delete();
650  }
651 
652  // Feedback
653  ilUtil::sendSuccess($this->lng->txt("user_deleted"),true);
654 
655  if ($_POST["frsrch"])
656  {
657  $this->ctrl->redirectByClass('ilRepositorySearchGUI','show');
658  }
659  else
660  {
661  $this->ctrl->redirect($this, "view");
662  }
663  }
664 
670  protected function getActionUserIds()
671  {
672  if($_POST["select_cmd_all"])
673  {
674  include_once("./Services/User/classes/class.ilUserTableGUI.php");
675  $utab = new ilUserTableGUI($this, "view", ilUserTableGUI::MODE_USER_FOLDER, false);
676  return $utab->getUserIdsForFilter();
677  }
678  else
679  {
680  return $_POST["id"];
681  }
682  }
683 
687  function showActionConfirmation($action, $a_from_search = false)
688  {
689  global $ilTabs;
690 
691  $user_ids = $this->getActionUserIds();
692  if(!$user_ids)
693  {
694  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
695  }
696 
697  if(!$a_from_search)
698  {
699  $ilTabs->activateTab("obj_usrf");
700  }
701  else
702  {
703  $ilTabs->activateTab("search_user_extended");
704  }
705 
706  if (strcmp($action, "accessRestrict") == 0)
707  {
708  return $this->setAccessRestrictionObject(null, $a_from_search);
709  }
710  if (strcmp($action, "mail") == 0)
711  {
712  return $this->mailObject();
713  }
714 
715  unset($this->data);
716 
717  if(!$a_from_search)
718  {
719  $cancel = "cancelUserFolderAction";
720  }
721  else
722  {
723  $cancel = "cancelSearchAction";
724  }
725 
726  // display confirmation message
727  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
728  $cgui = new ilConfirmationGUI();
729  $cgui->setFormAction($this->ctrl->getFormAction($this));
730  $cgui->setHeaderText($this->lng->txt("info_" . $action . "_sure"));
731  $cgui->setCancel($this->lng->txt("cancel"), $cancel);
732  $cgui->setConfirm($this->lng->txt("confirm"), "confirm" . $action);
733 
734  if($a_from_search)
735  {
736  $cgui->addHiddenItem("frsrch", 1);
737  }
738 
739  foreach($user_ids as $id)
740  {
741  $user = new ilObjUser($id);
742 
743  $login = $user->getLastLogin();
744  if(!$login)
745  {
746  $login = $this->lng->txt("never");
747  }
748  else
749  {
751  }
752 
753  $caption = $user->getFullname()." (".$user->getLogin().")".", ".
754  $user->getEmail()." - ".$this->lng->txt("last_login").": ".$login;
755 
756  $cgui->addItem("id[]", $id, $caption);
757  }
758 
759  $this->tpl->setContent($cgui->getHTML());
760 
761  return true;
762  }
763 
767  function deleteUsersObject()
768  {
769  $_POST["selectedAction"] = "delete";
770  $this->showActionConfirmation($_POST["selectedAction"]);
771  }
772 
777  {
778  $_POST["selectedAction"] = "activate";
779  $this->showActionConfirmation($_POST["selectedAction"]);
780  }
781 
786  {
787  $_POST["selectedAction"] = "deactivate";
788  $this->showActionConfirmation($_POST["selectedAction"]);
789  }
790 
795  {
796  $_POST["selectedAction"] = "accessRestrict";
797  $this->showActionConfirmation($_POST["selectedAction"]);
798  }
799 
803  function freeAccessObject()
804  {
805  $_POST["selectedAction"] = "accessFree";
806  $this->showActionConfirmation($_POST["selectedAction"]);
807  }
808 
809  function userActionObject()
810  {
811  $this->showActionConfirmation($_POST["selectedAction"]);
812  }
813 
818  {
819  global $tpl, $rbacsystem;
820 
821  // Blind out tabs for local user import
822  if ($_GET["baseClass"] == 'ilRepositoryGUI')
823  {
824  $this->tabs_gui->clearTargets();
825  }
826 
827  if (!$rbacsystem->checkAccess("write", $this->object->getRefId()))
828  {
829  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
830  }
831 
832  $this->initUserImportForm();
833  $tpl->setContent($this->form->getHTML());
834  }
835 
841  public function initUserImportForm()
842  {
843  global $lng, $ilCtrl;
844 
845  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
846  $this->form = new ilPropertyFormGUI();
847 
848  // Import File
849  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
850  $fi = new ilFileInputGUI($lng->txt("import_file"), "importFile");
851  $fi->setSuffixes(array("xml", "zip"));
852  //$fi->enableFileNameSelection();
853  //$fi->setInfo($lng->txt(""));
854  $this->form->addItem($fi);
855 
856  $this->form->addCommandButton("importUserRoleAssignment", $lng->txt("import"));
857  $this->form->addCommandButton("importCancelled", $lng->txt("cancel"));
858 
859  $this->form->setTitle($lng->txt("import_users"));
860  $this->form->setFormAction($ilCtrl->getFormAction($this));
861 
862  }
863 
870  {
871  // purge user import directory
872  $import_dir = $this->getImportDir();
873  if (@is_dir($import_dir))
874  {
875  ilUtil::delDir($import_dir);
876  }
877 
878  if (strtolower($_GET["baseClass"]) == 'iladministrationgui')
879  {
880  $this->ctrl->redirect($this, "view");
881  //ilUtil::redirect($this->ctrl->getLinkTarget($this,$return_location));
882  }
883  else
884  {
885  $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
886  }
887  }
888 
892  function getImportDir()
893  {
894  // For each user session a different directory must be used to prevent
895  // that one user session overwrites the import data that another session
896  // is currently importing.
897  global $ilUser;
898  $importDir = ilUtil::getDataDir().'/user_import/usr_'.$ilUser->getId().'_'.session_id();
899  ilUtil::makeDirParents($importDir);
900  return $importDir;
901  }
902 
907  {
908  global $ilUser,$rbacreview, $tpl, $lng, $ilCtrl;;
909 
910  // Blind out tabs for local user import
911  if ($_GET["baseClass"] == 'ilRepositoryGUI')
912  {
913  $this->tabs_gui->clearTargets();
914  }
915 
916  $this->initUserImportForm();
917  if ($this->form->checkInput())
918  {
919  include_once './Services/AccessControl/classes/class.ilObjRole.php';
920  include_once './Services/User/classes/class.ilUserImportParser.php';
921 
922  global $rbacreview, $rbacsystem, $tree, $lng;
923 
924 
925  $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.usr_import_roles.html", "Services/User");
926 
927  $import_dir = $this->getImportDir();
928 
929  // recreate user import directory
930  if (@is_dir($import_dir))
931  {
932  ilUtil::delDir($import_dir);
933  }
934  ilUtil::makeDir($import_dir);
935 
936  // move uploaded file to user import directory
937  $file_name = $_FILES["importFile"]["name"];
938  $parts = pathinfo($file_name);
939  $full_path = $import_dir."/".$file_name;
940 
941  // check if import file exists
942  if (!is_file($_FILES["importFile"]["tmp_name"]))
943  {
944  ilUtil::delDir($import_dir);
945  $this->ilias->raiseError($this->lng->txt("no_import_file_found")
946  , $this->ilias->error_obj->MESSAGE);
947  }
948  ilUtil::moveUploadedFile($_FILES["importFile"]["tmp_name"],
949  $_FILES["importFile"]["name"], $full_path);
950 
951  // handle zip file
952  if (strtolower($parts["extension"]) == "zip")
953  {
954  // unzip file
955  ilUtil::unzip($full_path);
956 
957  $xml_file = null;
958  $file_list = ilUtil::getDir($import_dir);
959  foreach ($file_list as $a_file)
960  {
961  if (substr($a_file['entry'],-4) == '.xml')
962  {
963  $xml_file = $import_dir."/".$a_file['entry'];
964  break;
965  }
966  }
967  if (is_null($xml_file))
968  {
969  $subdir = basename($parts["basename"],".".$parts["extension"]);
970  $xml_file = $import_dir."/".$subdir."/".$subdir.".xml";
971  }
972  }
973  // handle xml file
974  else
975  {
976  $xml_file = $full_path;
977  }
978 
979  // check xml file
980  if (!is_file($xml_file))
981  {
982  ilUtil::delDir($import_dir);
983  $this->ilias->raiseError($this->lng->txt("no_xml_file_found_in_zip")
984  ." ".$subdir."/".$subdir.".xml", $this->ilias->error_obj->MESSAGE);
985  }
986 
987  require_once("./Services/User/classes/class.ilUserImportParser.php");
988 
989  // Verify the data
990  // ---------------
991  $importParser = new ilUserImportParser($xml_file, IL_VERIFY);
992  $importParser->startParsing();
993  switch ($importParser->getErrorLevel())
994  {
995  case IL_IMPORT_SUCCESS :
996  break;
997  case IL_IMPORT_WARNING :
998  $this->tpl->setVariable("IMPORT_LOG", $importParser->getProtocolAsHTML($lng->txt("verification_warning_log")));
999  break;
1000  case IL_IMPORT_FAILURE :
1001  ilUtil::delDir($import_dir);
1002  $this->ilias->raiseError(
1003  $lng->txt("verification_failed").$importParser->getProtocolAsHTML($lng->txt("verification_failure_log")),
1004  $this->ilias->error_obj->MESSAGE
1005  );
1006  return;
1007  }
1008 
1009  // Create the role selection form
1010  // ------------------------------
1011  $this->tpl->setCurrentBlock("role_selection_form");
1012  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1013  $this->tpl->setVariable("TXT_IMPORT_USERS", $this->lng->txt("import_users"));
1014  $this->tpl->setVariable("TXT_IMPORT_FILE", $this->lng->txt("import_file"));
1015  $this->tpl->setVariable("IMPORT_FILE", $file_name);
1016  $this->tpl->setVariable("TXT_USER_ELEMENT_COUNT", $this->lng->txt("num_users"));
1017  $this->tpl->setVariable("USER_ELEMENT_COUNT", $importParser->getUserCount());
1018  $this->tpl->setVariable("TXT_ROLE_ASSIGNMENT", $this->lng->txt("role_assignment"));
1019  $this->tpl->setVariable("BTN_IMPORT", $this->lng->txt("import"));
1020  $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
1021  $this->tpl->setVariable("XML_FILE_NAME", $xml_file);
1022 
1023  // Extract the roles
1024  $importParser = new ilUserImportParser($xml_file, IL_EXTRACT_ROLES);
1025  $importParser->startParsing();
1026  $roles = $importParser->getCollectedRoles();
1027 
1028  // get global roles
1029  $all_gl_roles = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
1030  $gl_roles = array();
1031  $roles_of_user = $rbacreview->assignedRoles($ilUser->getId());
1032  foreach ($all_gl_roles as $obj_data)
1033  {
1034  // check assignment permission if called from local admin
1035  if($this->object->getRefId() != USER_FOLDER_ID)
1036  {
1037  if(!in_array(SYSTEM_ROLE_ID,$roles_of_user) && !ilObjRole::_getAssignUsersStatus($obj_data['obj_id']))
1038  {
1039  continue;
1040  }
1041  }
1042  // exclude anonymous role from list
1043  if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID)
1044  {
1045  // do not allow to assign users to administrator role if current user does not has SYSTEM_ROLE_ID
1046  if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID,$roles_of_user))
1047  {
1048  $gl_roles[$obj_data["obj_id"]] = $obj_data["title"];
1049  }
1050  }
1051  }
1052 
1053  // global roles
1054  $got_globals = false;
1055  foreach($roles as $role_id => $role)
1056  {
1057  if ($role["type"] == "Global")
1058  {
1059  if (! $got_globals)
1060  {
1061  $got_globals = true;
1062 
1063  $this->tpl->setCurrentBlock("global_role_section");
1064  $this->tpl->setVariable("TXT_GLOBAL_ROLES_IMPORT", $this->lng->txt("roles_of_import_global"));
1065  $this->tpl->setVariable("TXT_GLOBAL_ROLES", $this->lng->txt("assign_global_role"));
1066  }
1067 
1068  // pre selection for role
1069  $pre_select = array_search($role[name], $gl_roles);
1070  if (! $pre_select)
1071  {
1072  switch($role["name"])
1073  {
1074  case "Administrator": // ILIAS 2/3 Administrator
1075  $pre_select = array_search("Administrator", $gl_roles);
1076  break;
1077 
1078  case "Autor": // ILIAS 2 Author
1079  $pre_select = array_search("User", $gl_roles);
1080  break;
1081 
1082  case "Lerner": // ILIAS 2 Learner
1083  $pre_select = array_search("User", $gl_roles);
1084  break;
1085 
1086  case "Gast": // ILIAS 2 Guest
1087  $pre_select = array_search("Guest", $gl_roles);
1088  break;
1089 
1090  default:
1091  $pre_select = array_search("User", $gl_roles);
1092  break;
1093  }
1094  }
1095  $this->tpl->setCurrentBlock("global_role");
1096  $role_select = ilUtil::formSelect($pre_select, "role_assign[".$role_id."]", $gl_roles, false, true);
1097  $this->tpl->setVariable("TXT_IMPORT_GLOBAL_ROLE", $role["name"]." [".$role_id."]");
1098  $this->tpl->setVariable("SELECT_GLOBAL_ROLE", $role_select);
1099  $this->tpl->parseCurrentBlock();
1100  }
1101  }
1102 
1103  // Check if local roles need to be assigned
1104  $got_locals = false;
1105  foreach($roles as $role_id => $role)
1106  {
1107  if ($role["type"] == "Local")
1108  {
1109  $got_locals = true;
1110  break;
1111  }
1112  }
1113 
1114  if ($got_locals)
1115  {
1116  $this->tpl->setCurrentBlock("local_role_section");
1117  $this->tpl->setVariable("TXT_LOCAL_ROLES_IMPORT", $this->lng->txt("roles_of_import_local"));
1118  $this->tpl->setVariable("TXT_LOCAL_ROLES", $this->lng->txt("assign_local_role"));
1119 
1120 
1121  // get local roles
1122  if ($this->object->getRefId() == USER_FOLDER_ID)
1123  {
1124  // The import function has been invoked from the user folder
1125  // object. In this case, we show only matching roles,
1126  // because the user folder object is considered the parent of all
1127  // local roles and may contains thousands of roles on large ILIAS
1128  // installations.
1129  $loc_roles = array();
1130  foreach($roles as $role_id => $role)
1131  {
1132  if ($role["type"] == "Local")
1133  {
1134  $searchName = (substr($role['name'],0,1) == '#') ? $role['name'] : '#'.$role['name'];
1135  $matching_role_ids = $rbacreview->searchRolesByMailboxAddressList($searchName);
1136  foreach ($matching_role_ids as $mid) {
1137  if (! in_array($mid, $loc_roles)) {
1138  $loc_roles[] = $mid;
1139  }
1140  }
1141  }
1142  }
1143  } else {
1144  // The import function has been invoked from a locally
1145  // administrated category. In this case, we show all roles
1146  // contained in the subtree of the category.
1147  $loc_roles = $rbacreview->getAssignableRolesInSubtree($this->object->getRefId());
1148  }
1149  $l_roles = array();
1150 
1151  // create a search array with .
1152  $l_roles_mailbox_searcharray = array();
1153  foreach ($loc_roles as $key => $loc_role)
1154  {
1155  // fetch context path of role
1156  $rolf = $rbacreview->getFoldersAssignedToRole($loc_role,true);
1157 
1158  // only process role folders that are not set to status "deleted"
1159  // and for which the user has write permissions.
1160  // We also don't show the roles which are in the ROLE_FOLDER_ID folder.
1161  // (The ROLE_FOLDER_ID folder contains the global roles).
1162  if (
1163  !$rbacreview->isDeleted($rolf[0]) &&
1164  $rbacsystem->checkAccess('write',$rolf[0]) &&
1165  $rolf[0] != ROLE_FOLDER_ID
1166  )
1167  {
1168  // A local role is only displayed, if it is contained in the subtree of
1169  // the localy administrated category. If the import function has been
1170  // invoked from the user folder object, we show all local roles, because
1171  // the user folder object is considered the parent of all local roles.
1172  // Thus, if we start from the user folder object, we initialize the
1173  // isInSubtree variable with true. In all other cases it is initialized
1174  // with false, and only set to true if we find the object id of the
1175  // locally administrated category in the tree path to the local role.
1176  $isInSubtree = $this->object->getRefId() == USER_FOLDER_ID;
1177 
1178  $path_array = array();
1179  if ($this->tree->isInTree($rolf[0]))
1180  {
1181  // Create path. Paths which have more than 4 segments
1182  // are truncated in the middle.
1183  $tmpPath = $this->tree->getPathFull($rolf[0]);
1184  $tmpPath[] = $rolf[0];//adds target item to list
1185 
1186  for ($i = 1, $n = count($tmpPath) - 1; $i < $n; $i++)
1187  {
1188  if ($i < 3 || $i > $n - 3)
1189  {
1190  $path_array[] = $tmpPath[$i]['title'];
1191  }
1192  else if ($i == 3 || $i == $n - 3)
1193  {
1194  $path_array[] = '...';
1195  }
1196 
1197  $isInSubtree |= $tmpPath[$i]['obj_id'] == $this->object->getId();
1198  }
1199  //revert this path for a better readability in dropdowns #18306
1200  $path = implode(" < ", array_reverse($path_array));
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  {
1722  parent::hitsperpageObject();
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 ?>
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet ...
setSubTabs($a_tab)
set sub tabs
static makeDirParents($a_dir)
Create a new directory and all parent directories.
This class represents an option in a radio group.
GUI class for account codes.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
print $file
exit
Definition: login.php:54
__buildUserFilterSelect()
build select form to distinguish between active and non-active users
$_POST['username']
Definition: cron.php:12
showActionConfirmation($action, $a_from_search=false)
display activation confirmation screen
const IL_CAL_DATETIME
__setTableGUIBasicData(&$tbl, &$result_set, $from="")
getSavedData()
get saved data public
getImportDir()
get user import directory name
This class represents a property form user interface.
$_GET["client_id"]
const IL_USER_IMPORT
static _goto($a_user)
goto target group
This class represents a section header in a property form.
This class represents a file property in a property form.
confirmdeleteObject()
confirm delete Object
const IL_IMPORT_FAILURE
This class represents a text property in a property form.
importUserRoleAssignmentObject()
display form for user import
$valid
$cmd
Definition: sahs_server.php:35
setValue($a_value)
Set Value.
activateUsersObject()
Activate users.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
initFormGeneralSettings()
init general settings form
Class ilUserProfile.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
chooseLetterObject()
Choose first letter.
settingsObject()
Global user settings.
Learning progress account list for user administration.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
This class represents a checkbox property in a property form.
setFormAction($a_formaction)
Set FormAction.
const IL_EXTRACT_ROLES
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static _lookupTitle($a_id)
lookup object title
const IL_IMPORT_WARNING
viewObject()
list childs of current object
Class ilTableGUI.
exportObject()
Global user settings.
This class represents a email property in a property form.
const SESSION_HANDLING_FIXED
const IL_CAL_UNIX
_secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
setInfo($a_info)
Set Info.
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static _reset()
Reset all.
importCancelledObject()
import cancelled
importUserFormObject()
display form for user import
generalSettingsObject()
Show user account general settings.
Auto completion class for user lists.
restrictAccessObject()
Restrict access.
This class represents a date/time property in a property form.
getTabs(&$tabs_gui)
get tabs public
global $ilCtrl
Definition: ilias.php:18
allowDecimals($a_value)
Toggle Decimals.
getActionUserIds()
Get selected items for table action.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
viewObject($reset_filter=FALSE)
list users
setValue($a_value)
Set Value.
const IL_IMPORT_SUCCESS
resetFilterObject()
Reset filter (note: this function existed before data table filter has been introduced.
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
TableGUI class for user administration.
static updateLimitLog($a_new_value)
Log max session setting.
This class represents a hidden form property in a property form.
static _enabledLearningProgress()
check wether learing progress is enabled or not
Class ilCustomUserFieldsGUI.
This class represents a property in a property form.
deactivateUsersObject()
Deactivate users.
Class UserMail this class handles user mails.
static _saveStatus($a_key, $a_enabled)
saveGeneralSettingsObject()
Save user account settings.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
confirmDeleteExportFileObject()
confirmation screen for export file deletion
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
Class Mail this class handles base functions for mail handling.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
cancelDeleteExportFileObject()
cancel deletion of export files
deleteExportFileObject()
delete export files
setValue($a_value)
Set Value.
getUserMultiCommands($a_search_form=false)
special template class to simplify handling of ITX/PEAR
ilObjUserFolderGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor public.
This class represents a text property in a property form.
__getDateSelect($a_type, $a_varname, $a_selected)
static formatDate(ilDateTime $date)
Format a date public.
showActions($with_subobjects=false)
show possible action (form buttons)
Date and time handling
redirection script todo: (a better solution should control the processing via a xml file) ...
newAccountMailObject()
new account mail administration
setMaxLength($a_maxlength)
Set Max Length.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$n
Definition: RandomTest.php:80
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
confirmdeactivateObject()
Set the selected users inactive.
jumpToUserObject()
Jump to edit screen for user.
prepareOutput()
prepare output
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
downloadExportFileObject()
Download selected export files.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
showPossibleSubObjects()
show possible subobjects (pulldown menu) overwritten to prevent displaying of role templates in local...
initAccessRestrictionForm($a_from_search=false)
const IL_VERIFY
static getDataDir()
get data directory (outside webspace)
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
_getAssignUsersStatus($a_role_id)
static getInstance()
Singelton get instance.
$path
Definition: index.php:22
This class represents a text area property in a property form.
static getFirstLettersOfLastnames()
Get first letters of all lastnames.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
searchResultHandler($a_usr_ids, $a_cmd)
Handles multi command from repository search gui.
Class ilObjUserFolderGUI.
const USER_FOLDER_ID
Class ilObjUserFolder.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
const SESSION_HANDLING_LOAD_DEPENDENT
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static _getInstance()
Get instance of ilPrivacySettings.
setValue($a_value)
Set Value.
static redirect($a_script)
http redirect to other script
static getSessionExpireValue()
Returns the session expiration value.
initUserImportForm()
Init user import form.
confirmactivateObject()
Set the selected users active.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static _getInstance()
Get instance of ilSecuritySettings.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
const IL_UPDATE_ON_CONFLICT
setRequired($a_required)
Set Required.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
setShowTime($a_showtime)
Set Show Time Information.
const IL_IGNORE_ON_CONFLICT
__showAppliedUsersTable($a_result_set)
setAccessRestrictionObject($a_form=null, $a_from_search=false)
Confirmation screen class.
addUserAutoCompleteObject()
Show auto complete results.
savePostData($a_user_id, $a_attachments, $a_rcp_to, $a_rcp_cc, $a_rcp_bcc, $a_m_type, $a_m_email, $a_m_subject, $a_m_message, $a_use_placeholders)
save post data in table public