ILIAS  trunk Revision v11.0_alpha-1862-g4e205cb56d4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilRegistrationSettingsGUI Class Reference

Class ilRegistrationSettingsGUI. More...

+ Collaboration diagram for ilRegistrationSettingsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 setSubTabs (string $activeTab='registration_settings')
 
 initForm ()
 
 initFormValues (ilPropertyFormGUI $formGUI)
 
 view ()
 
 save ()
 
 editRoles (?ilPropertyFormGUI $form=null)
 
 updateRoles ()
 
 editEmailAssignments (?ilPropertyFormGUI $form=null)
 
 initEmailAssignmentForm ()
 
 editRoleAccessLimitations (?ilPropertyFormGUI $form=null)
 
 initRoleAccessForm ()
 
 saveAssignment ()
 
 saveRoleAccessLimitations ()
 
 listCodes ()
 
 initAddCodesForm ()
 
 getLocalRoleAutoComplete ()
 
 addCodes ()
 
 createCodes ()
 
 deleteCodes ()
 
 deleteConfirmation ()
 
 resetCodesFilter ()
 
 applyCodesFilter ()
 
 exportCodes ()
 

Data Fields

const CODE_TYPE_REGISTRATION = 1
 
const CODE_TYPE_EXTENSION = 2
 
int $ref_id
 

Protected Member Functions

 initRefIdFromQuery ()
 
 checkAccess (string $a_permission)
 
 checkAccessBool (string $a_permission)
 
 initRolesForm ()
 

Protected Attributes

ilCtrlInterface $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilRbacSystem $rbacsystem
 
ilRbacReview $rbacreview
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilErrorHandling $error
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ilRegistrationSettings $registration_settings
 
ilRegistrationRoleAssignments $assignments_obj = null
 
ilRegistrationRoleAccessLimitations $access_limitations_obj = null
 
ilPropertyFormGUI $form_gui = null
 

Private Member Functions

 parseRoleList (array $roles, string $url)
 
 prepareRoleList ()
 
 prepareAutomaticRoleList ()
 
 prepareAccessLimitationRoleList ()
 
 initRoleAssignments ()
 
 initRoleAccessLimitations ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRegistrationSettingsGUI::__construct ( )

Definition at line 56 of file class.ilRegistrationSettingsGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initRefIdFromQuery(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

57  {
58  global $DIC;
59 
60  $this->tpl = $DIC->ui()->mainTemplate();
61  $this->ctrl = $DIC->ctrl();
62  $this->access = $DIC->access();
63  $this->rbacsystem = $DIC->rbac()->system();
64  $this->rbacreview = $DIC->rbac()->review();
65  $this->error = $DIC['ilErr'];
66  $this->tabs = $DIC->tabs();
67  $this->toolbar = $DIC->toolbar();
68 
69  $this->lng = $DIC->language();
70  $this->lng->loadLanguageModule('administration');
71  $this->lng->loadLanguageModule('registration');
72  $this->lng->loadLanguageModule('user');
73  $this->registration_settings = new ilRegistrationSettings();
74 
75  $this->http = $DIC->http();
76  $this->refinery = $DIC->refinery();
77  $this->ref_id = $this->initRefIdFromQuery();
78  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
Class ilObjAuthSettingsGUI.
+ Here is the call graph for this function:

Member Function Documentation

◆ addCodes()

ilRegistrationSettingsGUI::addCodes ( )

Definition at line 895 of file class.ilRegistrationSettingsGUI.php.

References checkAccess(), initAddCodesForm(), and setSubTabs().

895  : void
896  {
897  $this->checkAccess('write');
898  $this->setSubTabs('registration_codes');
899  $this->initAddCodesForm();
900 
901  // default
902  $limit = $this->form_gui->getItemByPostVar("reg_limit");
903  $limit->setValue("none");
904  $this->tpl->setContent($this->form_gui->getHTML());
905  }
setSubTabs(string $activeTab='registration_settings')
+ Here is the call graph for this function:

◆ applyCodesFilter()

ilRegistrationSettingsGUI::applyCodesFilter ( )

Definition at line 1048 of file class.ilRegistrationSettingsGUI.php.

References listCodes().

1048  : void
1049  {
1050  $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1051  $utab->resetOffset();
1052  $utab->writeFilterToSession();
1053 
1054  $this->listCodes();
1055  }
TableGUI class for registration codes.
+ Here is the call graph for this function:

◆ checkAccess()

ilRegistrationSettingsGUI::checkAccess ( string  $a_permission)
protected

Definition at line 105 of file class.ilRegistrationSettingsGUI.php.

References checkAccessBool(), and ILIAS\Repository\lng().

Referenced by addCodes(), createCodes(), deleteCodes(), deleteConfirmation(), editEmailAssignments(), editRoleAccessLimitations(), editRoles(), exportCodes(), listCodes(), save(), saveAssignment(), saveRoleAccessLimitations(), updateRoles(), and view().

105  : void
106  {
107  if (!$this->checkAccessBool($a_permission)) {
108  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->WARNING);
109  }
110  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessBool()

ilRegistrationSettingsGUI::checkAccessBool ( string  $a_permission)
protected

Definition at line 112 of file class.ilRegistrationSettingsGUI.php.

References ILIAS\Repository\access().

Referenced by checkAccess(), initRolesForm(), listCodes(), and view().

112  : bool
113  {
114  return $this->access->checkAccess($a_permission, '', $this->ref_id);
115  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createCodes()

ilRegistrationSettingsGUI::createCodes ( )

Definition at line 907 of file class.ilRegistrationSettingsGUI.php.

References $valid, checkAccess(), ilRegistrationCode\create(), ILIAS\Repository\ctrl(), IL_CAL_DATE, initAddCodesForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), null, and setSubTabs().

907  : void
908  {
909  $this->checkAccess('write');
910  $this->setSubTabs('registration_codes');
911 
912  $this->initAddCodesForm();
913  $valid = $this->form_gui->checkInput();
914  if ($valid) {
915  $number = $this->form_gui->getInput('reg_codes_number');
916  $role = (int) $this->form_gui->getInput('reg_codes_role');
917  $local = $this->form_gui->getInput("reg_codes_local");
918 
919  if (is_array($local)) {
920  $role_ids = [];
921  foreach (array_unique($local) as $item) {
922  if (trim($item)) {
923  $role_id = $this->rbacreview->roleExists($item);
924  if ($role_id) {
925  $role_ids[] = $role_id;
926  }
927  }
928  }
929  if (count($role_ids)) {
930  $local = $role_ids;
931  }
932  }
933 
934  $date = null;
935  $limit = $this->form_gui->getInput("reg_limit");
936  switch ($limit) {
937  case "absolute":
938  $date_input = $this->form_gui->getItemByPostVar("abs_date");
939  $date = $date_input->getDate()->get(IL_CAL_DATE);
940  if ($date < date("Y-m-d")) {
941  $date_input->setAlert($this->lng->txt("form_msg_wrong_date"));
942  $valid = false;
943  }
944  break;
945 
946  case "relative":
947  $date = $this->form_gui->getInput("rel_date");
948  if (!array_sum($date)) {
949  $valid = false;
950  } else {
951  $date = serialize([
952  "d" => $date["dd"],
953  "m" => $date["MM"] % 12,
954  "y" => (int) floor($date["MM"] / 12)
955  ]);
956  }
957  break;
958 
959  case "none":
960  $limit = null;
961  break;
962  }
963  }
964 
965  if ($valid) {
966  $stamp = time();
967  for ($loop = 1; $loop <= $number; $loop++) {
968  $code_types = (array) $this->form_gui->getInput('code_type');
969 
971  $role,
972  $stamp,
973  $local,
974  $limit,
975  $date,
976  in_array(self::CODE_TYPE_REGISTRATION, $code_types) ? true : false,
977  in_array(self::CODE_TYPE_EXTENSION, $code_types) ? true : false
978  );
979  }
980 
981  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
982  $this->ctrl->redirect($this, "listCodes");
983  } else {
984  $this->form_gui->setValuesByPost();
985  $this->tpl->setContent($this->form_gui->getHTML());
986  }
987  }
$valid
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setSubTabs(string $activeTab='registration_settings')
const IL_CAL_DATE
static create(int $role, int $stamp, array $local_roles, ?string $limit, ?string $limit_date, bool $reg_type, bool $ext_type)
+ Here is the call graph for this function:

◆ deleteCodes()

ilRegistrationSettingsGUI::deleteCodes ( )

Definition at line 989 of file class.ilRegistrationSettingsGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), ilRegistrationCode\deleteCodes(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

989  : void
990  {
991  $this->checkAccess("write");
992 
993  $ids = [];
994  if ($this->http->wrapper()->post()->has('id')) {
995  $ids = $this->http->wrapper()->post()->retrieve(
996  'id',
997  $this->refinery->kindlyTo()->listOf(
998  $this->refinery->kindlyTo()->int()
999  )
1000  );
1001  }
1003  $this->tpl->setOnScreenMessage('success', $this->lng->txt('info_deleted'), true);
1004  $this->ctrl->redirect($this, "listCodes");
1005  }
static deleteCodes(array $ids)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ deleteConfirmation()

ilRegistrationSettingsGUI::deleteConfirmation ( )

Definition at line 1007 of file class.ilRegistrationSettingsGUI.php.

References $data, checkAccess(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilRegistrationCode\loadCodesByIds(), ILIAS\Repository\refinery(), and setSubTabs().

1007  : void
1008  {
1009  $this->checkAccess("write");
1010 
1011  $ids = [];
1012  if ($this->http->wrapper()->post()->has('id')) {
1013  $ids = $this->http->wrapper()->post()->retrieve(
1014  'id',
1015  $this->refinery->kindlyTo()->listOf(
1016  $this->refinery->kindlyTo()->int()
1017  )
1018  );
1019  }
1020  if (!count($ids)) {
1021  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_select_one'), true);
1022  $this->ctrl->redirect($this, 'listCodes');
1023  }
1024  $this->setSubTabs('registration_codes');
1025 
1026  $gui = new ilConfirmationGUI();
1027  $gui->setHeaderText($this->lng->txt("info_delete_sure"));
1028  $gui->setCancel($this->lng->txt("cancel"), "listCodes");
1029  $gui->setConfirm($this->lng->txt("confirm"), "deleteCodes");
1030  $gui->setFormAction($this->ctrl->getFormAction($this, "deleteCodes"));
1031 
1033  foreach ($data as $code) {
1034  $gui->addItem("id[]", (string) $code["code_id"], $code["code"]);
1035  }
1036  $this->tpl->setContent($gui->getHTML());
1037  }
static http()
Fetches the global http state from ILIAS.
static loadCodesByIds(array $ids)
setSubTabs(string $activeTab='registration_settings')
+ Here is the call graph for this function:

◆ editEmailAssignments()

ilRegistrationSettingsGUI::editEmailAssignments ( ?ilPropertyFormGUI  $form = null)

Definition at line 414 of file class.ilRegistrationSettingsGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), initEmailAssignmentForm(), initRoleAssignments(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by saveAssignment().

414  : void
415  {
416  $this->checkAccess('write');
417  $this->tabs->clearTargets();
418  $this->tabs->setBackTarget(
419  $this->lng->txt("registration_settings"),
420  $this->ctrl->getLinkTarget($this, "view")
421  );
422 
423  $this->initRoleAssignments();
424  $form = $form ?? $this->initEmailAssignmentForm();
425  $this->tpl->setContent($form->getHTML());
426  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editRoleAccessLimitations()

ilRegistrationSettingsGUI::editRoleAccessLimitations ( ?ilPropertyFormGUI  $form = null)

Definition at line 471 of file class.ilRegistrationSettingsGUI.php.

References $DIC, checkAccess(), ILIAS\Repository\ctrl(), initRoleAccessForm(), initRoleAccessLimitations(), ILIAS\Repository\lng(), null, and ILIAS\Repository\tabs().

Referenced by saveRoleAccessLimitations().

471  : void
472  {
473  global $DIC;
474 
475  $this->checkAccess('write');
476  $this->tabs->clearTargets();
477  $this->tabs->setBackTarget(
478  $this->lng->txt("registration_settings"),
479  $this->ctrl->getLinkTarget($this, "view")
480  );
481  $this->initRoleAccessLimitations();
482  if (null === $form) {
483  $form = $this->initRoleAccessForm();
484  }
485  $this->tpl->setContent($form->getHTML());
486  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editRoles()

ilRegistrationSettingsGUI::editRoles ( ?ilPropertyFormGUI  $form = null)

Definition at line 377 of file class.ilRegistrationSettingsGUI.php.

References checkAccess(), ILIAS\Repository\ctrl(), initRolesForm(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by updateRoles().

377  : void
378  {
379  $this->checkAccess('write');
380  $this->tabs->clearTargets();
381  $this->tabs->setBackTarget(
382  $this->lng->txt("registration_settings"),
383  $this->ctrl->getLinkTarget($this, "view")
384  );
385  if (!$form instanceof ilPropertyFormGUI) {
386  $form = $this->initRolesForm();
387  }
388  $this->tpl->setContent($form->getHTML());
389  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilRegistrationSettingsGUI::executeCommand ( )

Definition at line 91 of file class.ilRegistrationSettingsGUI.php.

References ILIAS\Repository\ctrl().

91  : void
92  {
93  $next_class = $this->ctrl->getNextClass($this);
94  $cmd = $this->ctrl->getCmd();
95  switch ($next_class) {
96  default:
97  if (!$cmd) {
98  $cmd = 'view';
99  }
100  $this->$cmd();
101  break;
102  }
103  }
+ Here is the call graph for this function:

◆ exportCodes()

ilRegistrationSettingsGUI::exportCodes ( )

Definition at line 1057 of file class.ilRegistrationSettingsGUI.php.

References checkAccess(), ilUtil\deliverData(), ilRegistrationCode\getCodesForExport(), listCodes(), ILIAS\Repository\lng(), and null.

1057  : void
1058  {
1059  $this->checkAccess('read');
1060  $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1061 
1063  $utab->filter["code"],
1064  $utab->filter["role"] ? (int) $utab->filter["role"] : null,
1065  $utab->filter["generated"],
1066  $utab->filter["alimit"]
1067  );
1068 
1069  if (count($codes)) {
1071  implode("\r\n", $codes),
1072  "ilias_registration_codes_" . date("d-m-Y") . ".txt",
1073  "text/plain"
1074  );
1075  } else {
1076  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("registration_export_codes_no_data"));
1077  $this->listCodes();
1078  }
1079  }
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
TableGUI class for registration codes.
static getCodesForExport(string $filter_code, ?int $filter_role, string $filter_generated, string $filter_access_limitation)
+ Here is the call graph for this function:

◆ getLocalRoleAutoComplete()

ilRegistrationSettingsGUI::getLocalRoleAutoComplete ( )

Definition at line 887 of file class.ilRegistrationSettingsGUI.php.

References $q, exit, and ilRoleAutoComplete\getList().

887  : void
888  {
889  $q = $_REQUEST["term"];
891  echo $list;
892  exit;
893  }
static getList(string $a_str)
Get completion list.
$q
Definition: shib_logout.php:21
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ initAddCodesForm()

ilRegistrationSettingsGUI::initAddCodesForm ( )

Definition at line 795 of file class.ilRegistrationSettingsGUI.php.

References $form_gui, ilObject\_lookupTitle(), ANONYMOUS_ROLE_ID, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilNumberInputGUI\setSize(), and SYSTEM_ROLE_ID.

Referenced by addCodes(), and createCodes().

796  {
797  $this->form_gui = new ilPropertyFormGUI();
798  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'createCodes'));
799  $this->form_gui->setTitle($this->lng->txt('registration_codes_edit_header'));
800 
801  $count = new ilNumberInputGUI($this->lng->txt('registration_codes_number'), 'reg_codes_number');
802  $count->setSize(4);
803  $count->setMaxLength(4);
804  $count->setMinValue(1);
805  $count->setMaxValue(1000);
806  $count->setRequired(true);
807  $this->form_gui->addItem($count);
808 
809  // type
810  $code_type = new ilCheckboxGroupInputGUI($this->lng->txt('registration_codes_type'), 'code_type');
811  $code_type->setRequired(true);
812 
813  $code_type->addOption(
814  new ilCheckboxOption(
815  $this->lng->txt('registration_codes_type_reg'),
816  (string) self::CODE_TYPE_REGISTRATION,
817  $this->lng->txt('registration_codes_type_reg_info')
818  )
819  );
820  $code_type->addOption(
821  new ilCheckboxOption(
822  $this->lng->txt('registration_codes_type_ext'),
823  (string) self::CODE_TYPE_EXTENSION,
824  $this->lng->txt('registration_codes_type_ext_info')
825  )
826  );
827  $this->form_gui->addItem($code_type);
828 
829  $sec = new ilFormSectionHeaderGUI();
830  $sec->setTitle($this->lng->txt('registration_codes_roles_title'));
831  $this->form_gui->addItem($sec);
832 
833  $options = ["" => $this->lng->txt('registration_codes_no_assigned_role')];
834  foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
835  if (!in_array($role_id, [SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID], true)) {
836  $options[$role_id] = ilObject::_lookupTitle($role_id);
837  }
838  }
839  $roles = new ilSelectInputGUI($this->lng->txt("registration_codes_roles"), "reg_codes_role");
840  $roles->setInfo($this->lng->txt("registration_codes_override_info"));
841  $roles->setOptions($options);
842  $this->form_gui->addItem($roles);
843 
844  $local = new ilTextInputGUI($this->lng->txt("registration_codes_roles_local"), "reg_codes_local");
845  $local->setMulti(true);
846  $local->setDataSource($this->ctrl->getLinkTarget($this, "getLocalRoleAutoComplete", "", true));
847  $this->form_gui->addItem($local);
848 
849  $sec = new ilFormSectionHeaderGUI();
850  $sec->setTitle($this->lng->txt('reg_access_limitations'));
851  $this->form_gui->addItem($sec);
852 
853  $limit = new ilRadioGroupInputGUI($this->lng->txt("reg_access_limitation_mode"), "reg_limit");
854  $limit->setInfo($this->lng->txt("registration_codes_override_info"));
855  $this->form_gui->addItem($limit);
856 
857  $opt = new ilRadioOption($this->lng->txt("registration_codes_roles_limitation_none"), "none");
858  $limit->addOption($opt);
859 
860  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_none"), "unlimited");
861  $limit->addOption($opt);
862 
863  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_absolute"), "absolute");
864  $limit->addOption($opt);
865 
866  $dt = new ilDateTimeInputGUI($this->lng->txt("reg_access_limitation_mode_absolute_target"), "abs_date");
867  $dt->setRequired(true);
868  $opt->addSubItem($dt);
869 
870  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_relative"), "relative");
871  $limit->addOption($opt);
872 
873  $dur = new ilDurationInputGUI($this->lng->txt("reg_access_limitation_mode_relative_target"), "rel_date");
874  $dur->setRequired(true);
875  $dur->setShowMonths(true);
876  $dur->setShowDays(true);
877  $dur->setShowHours(false);
878  $dur->setShowMinutes(false);
879  $opt->addSubItem($dur);
880 
881  $this->form_gui->addCommandButton('createCodes', $this->lng->txt('create'));
882  $this->form_gui->addCommandButton('listCodes', $this->lng->txt('cancel'));
883  return $this->form_gui;
884  }
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents an option in a radio group.
This class represents an option in a checkbox group.
This class represents a selection list property in a property form.
const SYSTEM_ROLE_ID
Definition: constants.php:29
This class represents a date/time property in a property form.
This class represents a property in a property form.
static _lookupTitle(int $obj_id)
This class represents a number property in a property form.
This class represents a property in a property form.
setRequired(bool $a_required)
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initEmailAssignmentForm()

ilRegistrationSettingsGUI::initEmailAssignmentForm ( )

Definition at line 428 of file class.ilRegistrationSettingsGUI.php.

References ilObject\_lookupTitle(), ANONYMOUS_ROLE_ID, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setPostVar().

Referenced by editEmailAssignments(), and saveAssignment().

429  {
430  $role_assignment_form = new ilPropertyFormGUI();
431  $role_assignment_form->setFormAction($this->ctrl->getFormAction($this));
432  $role_assignment_form->setTitle($this->lng->txt('reg_email_role_assignment'));
433 
434  $global_roles = ["" => $this->lng->txt("links_select_one")];
435  foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
436  if ($role_id === ANONYMOUS_ROLE_ID) {
437  continue;
438  }
439 
440  $global_roles[$role_id] = ilObjRole::_lookupTitle($role_id);
441  $role_assignments = new ilCheckboxInputGUI(ilObjRole::_lookupTitle($role_id), "role_assigned_$role_id");
442 
443  $domains = $this->assignments_obj->getDomainsByRole($role_id);
444 
445  $domain = new ilTextInputGUI($this->lng->txt('reg_domain'), "domain_$role_id");
446  $domain->setMulti(true);
447  $domain->setValidationRegexp("/^@.*\.[a-zA-Z]{1,4}$/");
448  if (!empty($domains)) {
449  $domain->setValue($domains[0]);
450  $domain->setMultiValues($domains);
451  $role_assignments->setChecked(true);
452  }
453 
454  $role_assignments->addSubItem($domain);
455  $role_assignment_form->addItem($role_assignments);
456  }
457 
458  $default_role = new ilSelectInputGUI($this->lng->txt('reg_default'));
459  $default_role->setPostVar("default_role");
460  $default_role->setOptions($global_roles);
461  $default_role->setValue($this->assignments_obj->getDefaultRole());
462  $default_role->setRequired(true);
463  $role_assignment_form->addItem($default_role);
464 
465  $role_assignment_form->addCommandButton("saveAssignment", $this->lng->txt("save"));
466  $role_assignment_form->addCommandButton("view", $this->lng->txt("cancel"));
467 
468  return $role_assignment_form;
469  }
This class represents a selection list property in a property form.
setPostVar(string $a_postvar)
static _lookupTitle(int $obj_id)
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilRegistrationSettingsGUI::initForm ( )

Definition at line 132 of file class.ilRegistrationSettingsGUI.php.

References $form_gui, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilRadioGroupInputGUI\addOption(), ilSubEnabledFormPropertyGUI\addSubItem(), ILIAS\Repository\ctrl(), ilRegistrationSettings\IL_REG_ACTIVATION, ilRegistrationSettings\IL_REG_APPROVE, ilRegistrationSettings\IL_REG_CODES, ilRegistrationSettings\IL_REG_DIRECT, ilRegistrationSettings\IL_REG_DISABLED, ilRegistrationSettings\IL_REG_ROLES_EMAIL, ilRegistrationSettings\IL_REG_ROLES_FIXED, ILIAS\Repository\lng(), parseRoleList(), prepareAccessLimitationRoleList(), prepareAutomaticRoleList(), prepareRoleList(), ilRegistrationSettings\REG_HASH_LIFETIME_MIN_VALUE, ilFormGUI\setFormAction(), ilNumberInputGUI\setSize(), and ilPropertyFormGUI\setTitle().

Referenced by save(), and view().

133  {
135  $form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
136  $form_gui->setTitle($this->lng->txt('reg_settings_header'));
137 
138  $reg_type = new ilRadioGroupInputGUI($this->lng->txt('reg_type'), 'reg_type');
139  $reg_type->addOption(new ilRadioOption(
140  $this->lng->txt('reg_disabled'),
142  ));
143  $option = new ilRadioOption($this->lng->txt('reg_direct'), (string) ilRegistrationSettings::IL_REG_DIRECT);
144  $option->setInfo($this->lng->txt('reg_direct_info'));
145  $cd = new ilCheckboxInputGUI(
146  $this->lng->txt('reg_allow_codes'),
148  );
149  $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
150  $option->addSubItem($cd);
151  $reg_type->addOption($option);
152  $option = new ilRadioOption($this->lng->txt('reg_approve'), (string) ilRegistrationSettings::IL_REG_APPROVE);
153  $option->setInfo($this->lng->txt('reg_approve_info'));
154  $cd = new ilCheckboxInputGUI(
155  $this->lng->txt('reg_allow_codes'),
157  );
158  $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
159  $option->addSubItem($cd);
160  $reg_type->addOption($option);
161  $option = new ilRadioOption(
162  $this->lng->txt('reg_type_confirmation'),
164  );
165  $option->setInfo($this->lng->txt('reg_type_confirmation_info'));
166  $lt = new ilNumberInputGUI($this->lng->txt('reg_confirmation_hash_life_time'), 'reg_hash_life_time');
167  $lt->setSize(6); // #8511
168  $lt->setMaxLength(6);
170  $lt->setRequired(true);
171  $lt->setInfo($this->lng->txt('reg_confirmation_hash_life_time_info'));
172  $lt->setSuffix($this->lng->txt('seconds'));
173  $option->addSubItem($lt);
174  $cd = new ilCheckboxInputGUI(
175  $this->lng->txt('reg_allow_codes'),
177  );
178  $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
179  $option->addSubItem($cd);
180  $reg_type->addOption($option);
181  $option = new ilRadioOption(
182  $this->lng->txt('registration_reg_type_codes'),
184  );
185  $option->setInfo($this->lng->txt('registration_reg_type_codes_info'));
186  $reg_type->addOption($option);
187  $form_gui->addItem($reg_type);
188 
189  $pwd_gen = new ilCheckboxInputGUI($this->lng->txt('passwd_generation'), 'reg_pwd');
190  $pwd_gen->setValue('1');
191  $pwd_gen->setInfo($this->lng->txt('reg_info_pwd'));
192  $form_gui->addItem($pwd_gen);
193 
194  $approver = new ilTextInputGUI($this->lng->txt('reg_notification'), 'reg_approver');
195  $approver->setSize(32);
196  $approver->setMaxLength(50);
197  $approver->setInfo($this->lng->txt('reg_notification_info'));
198  $form_gui->addItem($approver);
199 
200  $roles = new ilRadioGroupInputGUI($this->lng->txt('reg_role_assignment'), 'reg_role_type');
201  $option = new ilRadioOption($this->lng->txt('reg_fixed'), (string) ilRegistrationSettings::IL_REG_ROLES_FIXED);
202  $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
203  $edit = $this->ctrl->getLinkTarget($this, 'editRoles');
204  $list->setHtml($this->parseRoleList($this->prepareRoleList(), $edit));
205  $option->addSubItem($list);
206  $roles->addOption($option);
207  $option = new ilRadioOption($this->lng->txt('reg_email'), (string) ilRegistrationSettings::IL_REG_ROLES_EMAIL);
208  $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
209  $edit = $this->ctrl->getLinkTarget($this, 'editEmailAssignments');
210  $list->setHtml($this->parseRoleList($this->prepareAutomaticRoleList(), $edit));
211  $option->addSubItem($list);
212  $roles->addOption($option);
213  $roles->setInfo($this->lng->txt('registration_codes_override_global_info'));
214  $form_gui->addItem($roles);
215 
216  $limit = new ilCheckboxInputGUI($this->lng->txt('reg_access_limitations'), 'reg_access_limitation');
217  $limit->setValue('1');
218  $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
219  $edit = $this->ctrl->getLinkTarget($this, 'editRoleAccessLimitations');
220  $list->setHtml($this->parseRoleList($this->prepareAccessLimitationRoleList(), $edit));
221  $list->setInfo($this->lng->txt('registration_codes_override_global_info'));
222  $limit->addSubItem($list);
223  $form_gui->addItem($limit);
224 
225  $domains = new ilTextInputGUI($this->lng->txt('reg_allowed_domains'), 'reg_allowed_domains');
226  $domains->setInfo($this->lng->txt('reg_allowed_domains_info'));
227  $form_gui->addItem($domains);
228 
229  if ($this->rbacsystem->checkAccess("write", $this->ref_id)) {
230  $form_gui->addCommandButton('save', $this->lng->txt('save'));
231  }
232  return $form_gui;
233  }
This class represents an option in a radio group.
parseRoleList(array $roles, string $url)
addOption(ilRadioOption $a_option)
This class represents a property in a property form.
setFormAction(string $a_formaction)
This class represents a number property in a property form.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormValues()

ilRegistrationSettingsGUI::initFormValues ( ilPropertyFormGUI  $formGUI)

PhpUndefinedMethodInspection

Definition at line 235 of file class.ilRegistrationSettingsGUI.php.

References ilRegistrationSettings\IL_REG_ACTIVATION, ilRegistrationSettings\IL_REG_APPROVE, ilRegistrationSettings\IL_REG_DIRECT, ilRegistrationSettings\IL_REG_ROLE_UNDEFINED, ilRegistrationSettings\IL_REG_ROLES_EMAIL, ilRegistrationSettings\IL_REG_ROLES_FIXED, and ilPropertyFormGUI\setValuesByArray().

Referenced by view().

235  : void
236  {
238  if ($this->registration_settings->roleSelectionEnabled()) {
240  } elseif ($this->registration_settings->automaticRoleAssignmentEnabled()) {
242  }
243 
245  $values = [
246  'reg_type' => $this->registration_settings->getRegistrationType(),
247  'reg_hash_life_time' => $this->registration_settings->getRegistrationHashLifetime(),
248  'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
249  'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
250  'reg_role_type' => $role_type,
251  'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
252  'reg_allowed_domains' => implode(';', $this->registration_settings->getAllowedDomains())
253  ];
254 
255  $allow_codes = $this->registration_settings->getAllowCodes();
256  $reg_type = $this->registration_settings->getRegistrationType();
257  if ($allow_codes && in_array($reg_type, [
261  ], true)) {
262  $values['reg_codes_' . $reg_type] = true;
263  }
264 
265  $formGUI->setValuesByArray($values);
266  }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRefIdFromQuery()

ilRegistrationSettingsGUI::initRefIdFromQuery ( )
protected

Definition at line 80 of file class.ilRegistrationSettingsGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __construct().

80  : int
81  {
82  if ($this->http->wrapper()->query()->has('ref_id')) {
83  return $this->http->wrapper()->query()->retrieve(
84  'ref_id',
85  $this->refinery->kindlyTo()->int()
86  );
87  }
88  return 0;
89  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleAccessForm()

ilRegistrationSettingsGUI::initRoleAccessForm ( )

Definition at line 488 of file class.ilRegistrationSettingsGUI.php.

References $duration, ilObjRole\_lookupRegisterAllowed(), ilRadioOption\addSubItem(), ILIAS\Repository\ctrl(), IL_CAL_DATE, and ILIAS\Repository\lng().

Referenced by editRoleAccessLimitations(), and saveRoleAccessLimitations().

489  {
490  $form = new ilPropertyFormGUI();
491  $form->setFormAction($this->ctrl->getFormAction($this));
492  $form->setTitle($this->lng->txt('reg_role_access_limitations'));
493  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
494  $role_access = new ilRadioGroupInputGUI($role['title'], "role_access_" . $role['id']);
495 
496  $op_unlimited = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_unlimited'), "unlimited");
497 
498  $op_absolute = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_absolute'), "absolute");
499  $absolute_date = new ilDateTime(
500  date("d.m.Y", $this->access_limitations_obj->getAbsolute($role['id'])),
502  );
503  $date = new ilDateTimeInputGUI("", "absolute_date_" . $role['id']);
504  $date->setDate($absolute_date);
505  $op_absolute->addSubItem($date);
506 
507  $op_relative = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_relative'), "relative");
508  $duration = new ilDurationInputGUI("", "duration_" . $role['id']);
509  $duration->setShowMinutes(false);
510  $duration->setShowHours(false);
511  $duration->setShowDays(true);
512  $duration->setShowMonths(true);
513  $duration->setDays($this->access_limitations_obj->getRelative($role['id'], 'd'));
514  $duration->setMonths($this->access_limitations_obj->getRelative($role['id'], 'm'));
515  $op_relative->addSubItem($duration);
516 
517  $role_access->addOption($op_unlimited);
518  $role_access->addOption($op_absolute);
519  $role_access->addOption($op_relative);
520  $role_access->setValue(
521  $this->access_limitations_obj->getMode(
522  $role['id']
523  ) === 'null' ? 'unlimited' : $this->access_limitations_obj->getMode($role['id'])
524  );
525 
526  $form->addItem($role_access);
527  }
528 
529  $form->addCommandButton("saveRoleAccessLimitations", $this->lng->txt("save"));
530  $form->addCommandButton("view", $this->lng->txt("cancel"));
531 
532  return $form;
533  }
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents an option in a radio group.
static _lookupRegisterAllowed()
get all roles that are activated in user registration
$duration
This class represents a date/time property in a property form.
This class represents a property in a property form.
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleAccessLimitations()

ilRegistrationSettingsGUI::initRoleAccessLimitations ( )
private

Definition at line 774 of file class.ilRegistrationSettingsGUI.php.

Referenced by editRoleAccessLimitations(), prepareAccessLimitationRoleList(), and saveRoleAccessLimitations().

774  : void
775  {
776  if (!$this->access_limitations_obj instanceof ilRegistrationRoleAccessLimitations) {
777  $this->access_limitations_obj = new ilRegistrationRoleAccessLimitations();
778  }
779  }
Class class.ilRegistrationAccessLimitation.
+ Here is the caller graph for this function:

◆ initRoleAssignments()

ilRegistrationSettingsGUI::initRoleAssignments ( )
private

Definition at line 767 of file class.ilRegistrationSettingsGUI.php.

Referenced by editEmailAssignments(), prepareAutomaticRoleList(), and saveAssignment().

767  : void
768  {
769  if (!$this->assignments_obj instanceof ilRegistrationRoleAssignments) {
770  $this->assignments_obj = new ilRegistrationRoleAssignments();
771  }
772  }
Class class.ilregistrationEmailRoleAssignments.
+ Here is the caller graph for this function:

◆ initRolesForm()

ilRegistrationSettingsGUI::initRolesForm ( )
protected

Definition at line 348 of file class.ilRegistrationSettingsGUI.php.

References ilObjRole\_lookupAllowRegister(), ilObject\_lookupTitle(), ANONYMOUS_ROLE_ID, checkAccessBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and SYSTEM_ROLE_ID.

Referenced by editRoles(), and updateRoles().

349  {
350  $role_form = new ilPropertyFormGUI();
351  $role_form->setFormAction($this->ctrl->getFormAction($this, 'save'));
352  $role_form->setTitle($this->lng->txt('reg_selectable_roles'));
353 
354  $roles = new ilCheckboxGroupInputGUI($this->lng->txt('reg_available_roles'), 'roles');
355  $allowed_roles = [];
356  foreach ($this->rbacreview->getGlobalRoles() as $role) {
357  if ($role === SYSTEM_ROLE_ID || $role === ANONYMOUS_ROLE_ID) {
358  continue;
359  }
360  $role_option = new ilCheckboxOption(ilObjRole::_lookupTitle($role));
361  $role_option->setValue((string) $role);
362  $roles->addOption($role_option);
363  $allowed_roles[$role] = ilObjRole::_lookupAllowRegister($role);
364  }
365 
366  $roles->setUseValuesAsKeys(true);
367  $roles->setValue($allowed_roles);
368  $role_form->addItem($roles);
369 
370  if ($this->checkAccessBool('write')) {
371  $role_form->addCommandButton("updateRoles", $this->lng->txt("save"));
372  }
373  $role_form->addCommandButton("view", $this->lng->txt("cancel"));
374  return $role_form;
375  }
This class represents an option in a checkbox group.
const SYSTEM_ROLE_ID
Definition: constants.php:29
static _lookupTitle(int $obj_id)
This class represents a property in a property form.
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
static _lookupAllowRegister(int $a_role_id)
check whether role is allowed in user registration or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listCodes()

ilRegistrationSettingsGUI::listCodes ( )

Definition at line 781 of file class.ilRegistrationSettingsGUI.php.

References checkAccess(), checkAccessBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), setSubTabs(), and ILIAS\Repository\toolbar().

Referenced by applyCodesFilter(), exportCodes(), and resetCodesFilter().

781  : void
782  {
783  $this->checkAccess("visible,read");
784  $this->setSubTabs('registration_codes');
785  if ($this->checkAccessBool("write")) {
786  $this->toolbar->addButton(
787  $this->lng->txt("registration_codes_add"),
788  $this->ctrl->getLinkTarget($this, "addCodes")
789  );
790  }
791  $ctab = new ilRegistrationCodesTableGUI($this, "listCodes");
792  $this->tpl->setContent($ctab->getHTML());
793  }
setSubTabs(string $activeTab='registration_settings')
TableGUI class for registration codes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRoleList()

ilRegistrationSettingsGUI::parseRoleList ( array  $roles,
string  $url 
)
private
Parameters
string[]$roles
string$url
Returns
string

Definition at line 660 of file class.ilRegistrationSettingsGUI.php.

References ILIAS\UICore\GlobalTemplate\get(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), and ILIAS\UICore\GlobalTemplate\setVariable().

Referenced by initForm().

660  : string
661  {
662  $tpl = new ilTemplate('tpl.registration_roles.html', true, true, 'components/ILIAS/Registration');
663 
664  $tpl->setVariable("EDIT", $this->lng->txt("edit"));
665  $tpl->setVariable("LINK_EDIT", $url);
666 
667  if (is_array($roles) && count($roles)) {
668  foreach ($roles as $role) {
669  $tpl->setCurrentBlock("list_item");
670  $tpl->setVariable("LIST_ITEM_ITEM", $role);
672  }
673  } else {
674  $tpl->setVariable("NONE", $this->lng->txt('none'));
675  }
676  return $tpl->get();
677  }
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
$url
Definition: shib_logout.php:66
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareAccessLimitationRoleList()

ilRegistrationSettingsGUI::prepareAccessLimitationRoleList ( )
private

Definition at line 712 of file class.ilRegistrationSettingsGUI.php.

References ilObjRole\_lookupRegisterAllowed(), ilDatePresentation\formatDate(), IL_CAL_UNIX, initRoleAccessLimitations(), and ILIAS\Repository\lng().

Referenced by initForm().

712  : array
713  {
714  $this->initRoleAccessLimitations();
715  $all = [];
716  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
717  switch ($this->access_limitations_obj->getMode((int) $role['id'])) {
718  case 'absolute':
719  $txt_access_value = $this->lng->txt('reg_access_limitation_limited_until');
720  $txt_access_value .= " " . ilDatePresentation::formatDate(
721  new ilDateTime($this->access_limitations_obj->getAbsolute((int) $role['id']), IL_CAL_UNIX)
722  );
723  break;
724 
725  case 'relative':
726  $months = $this->access_limitations_obj->getRelative($role['id'], 'm');
727  $days = $this->access_limitations_obj->getRelative($role['id'], 'd');
728 
729  $txt_access_value = $this->lng->txt('reg_access_limitation_limited_time') . " ";
730 
731  if ($months) {
732  if ($days) {
733  $txt_access_value .= ", ";
734  } else {
735  $txt_access_value .= " " . $this->lng->txt('and') . " ";
736  }
737  } elseif ($days) {
738  $txt_access_value .= " " . $this->lng->txt('and') . " ";
739  }
740 
741  if ($months) {
742  $txt_access_value .= $months . " ";
743  $txt_access_value .= ($months === 1) ? $this->lng->txt('month') : $this->lng->txt('months');
744 
745  if ($days) {
746  $txt_access_value .= " " . $this->lng->txt('and') . " ";
747  }
748  }
749 
750  if ($days) {
751  $txt_access_value .= $days . " ";
752  $txt_access_value .= ($days === 1) ? $this->lng->txt('day') : $this->lng->txt('days');
753  }
754  break;
755 
756  default:
757  $txt_access_value = $this->lng->txt('reg_access_limitation_none');
758  break;
759  }
760 
761  $all[] = $role['title'] . ' (' . $txt_access_value . ')';
762  }
763 
764  return $all;
765  }
static _lookupRegisterAllowed()
get all roles that are activated in user registration
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareAutomaticRoleList()

ilRegistrationSettingsGUI::prepareAutomaticRoleList ( )
private
Returns
string[]

Definition at line 695 of file class.ilRegistrationSettingsGUI.php.

References ilObject\_lookupTitle(), initRoleAssignments(), and ILIAS\Repository\lng().

Referenced by initForm().

695  : array
696  {
697  $this->initRoleAssignments();
698  $all = [];
699  foreach ($this->assignments_obj->getAssignments() as $assignment) {
700  if ($assignment['domain'] !== '' && $assignment['role']) {
701  $all[] = $assignment['domain'] . ' -> ' . ilObjRole::_lookupTitle((int) $assignment['role']);
702  }
703  }
704 
705  if ((string) $this->assignments_obj->getDefaultRole() !== '') {
706  $all[] = $this->lng->txt('reg_default') . ' -> ' . ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
707  }
708 
709  return $all;
710  }
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleList()

ilRegistrationSettingsGUI::prepareRoleList ( )
private

Definition at line 682 of file class.ilRegistrationSettingsGUI.php.

References ilObjRole\_lookupRegisterAllowed().

Referenced by initForm().

682  : array
683  {
684  $all = [];
685  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
686  $all[] = $role['title'];
687  }
688 
689  return $all;
690  }
static _lookupRegisterAllowed()
get all roles that are activated in user registration
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCodesFilter()

ilRegistrationSettingsGUI::resetCodesFilter ( )

Definition at line 1039 of file class.ilRegistrationSettingsGUI.php.

References listCodes().

1039  : void
1040  {
1041  $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1042  $utab->resetOffset();
1043  $utab->resetFilter();
1044 
1045  $this->listCodes();
1046  }
TableGUI class for registration codes.
+ Here is the call graph for this function:

◆ save()

ilRegistrationSettingsGUI::save ( )

Definition at line 294 of file class.ilRegistrationSettingsGUI.php.

References $res, checkAccess(), ilRegistrationSettings\ERR_MISSING_RCP, ilRegistrationSettings\ERR_UNKNOWN_RCP, ilRegistrationSettings\IL_REG_ACTIVATION, ilRegistrationSettings\IL_REG_APPROVE, ilRegistrationSettings\IL_REG_DIRECT, initForm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilRegistrationSettings\REG_HASH_LIFETIME_MIN_VALUE, and view().

294  : bool
295  {
296  $this->checkAccess('write');
297 
298  $form = $this->initForm();
299  $res = $form->checkInput();
300  $this->registration_settings->setRegistrationType((int) $form->getInput('reg_type'));
301  $this->registration_settings->setPasswordGenerationStatus((bool) $form->getInput('reg_pwd'));
302  $this->registration_settings->setApproveRecipientLogins($form->getInput('reg_approver'));
303  $this->registration_settings->setRoleType((int) $form->getInput('reg_role_type'));
304  $this->registration_settings->setAccessLimitation((bool) $form->getInput('reg_access_limitation'));
305  $this->registration_settings->setAllowedDomains((string) $form->getInput('reg_allowed_domains'));
306 
307  $allow_codes = false;
308  $reg_type = (int) $form->getInput('reg_type');
309  if (in_array($reg_type, [
313  ], true)) {
314  $allow_codes = (bool) $form->getInput('reg_codes_' . $reg_type);
315  }
316  $this->registration_settings->setAllowCodes($allow_codes);
317 
318  $hash_life_time = $form->getInput('reg_hash_life_time');
319  if (!preg_match('/^([0]|([1-9][0-9]*))([\.,][0-9]+)?$/', (string) $hash_life_time)) {
320  $this->registration_settings->setRegistrationHashLifetime(ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE);
321  } else {
322  $this->registration_settings->setRegistrationHashLifetime(max(
323  (int) $hash_life_time,
325  ));
326  }
327 
328  if ($error_code = $this->registration_settings->validate()) {
329  switch ($error_code) {
331  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_unknown_recipients') . ' ' . $this->registration_settings->getUnknown());
332  $this->view();
333  return false;
334 
336  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_approve_needs_recipient') . ' ' . $this->registration_settings->getUnknown());
337  $this->view();
338  return false;
339  }
340  }
341 
342  $this->registration_settings->save();
343  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
344  $this->view();
345  return true;
346  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ saveAssignment()

ilRegistrationSettingsGUI::saveAssignment ( )

Definition at line 535 of file class.ilRegistrationSettingsGUI.php.

References ANONYMOUS_ROLE_ID, checkAccess(), editEmailAssignments(), initEmailAssignmentForm(), initRoleAssignments(), ILIAS\Repository\lng(), and view().

535  : bool
536  {
537  $this->checkAccess('write');
538  $this->initRoleAssignments();
539  $form = $this->initEmailAssignmentForm();
540  $is_valid = $form->checkInput();
541  $form->setValuesByPost();
542  if (!$is_valid) {
543  $this->editEmailAssignments($form);
544  return false;
545  }
546 
547  $assignments_by_domain = [];
548  $problems_domains_by_field_id = [];
549  foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
550  if ($role_id === ANONYMOUS_ROLE_ID) {
551  continue;
552  }
553 
554  $role_assigned_input = $form->getInput("role_assigned_$role_id");
555  if (!$role_assigned_input) {
556  continue;
557  }
558 
559  $domain_input = $form->getInput("domain_$role_id");
560  foreach ($domain_input as $domain) {
561  if (!is_string($domain) || $domain === '') {
562  continue;
563  }
564 
565  if (isset($assignments_by_domain[$domain])) {
566  if (!isset($problems_domains_by_field_id["role_assigned_$role_id"])) {
567  $problems_domains_by_field_id["role_assigned_$role_id"] = [];
568  }
569 
570  $problems_domains_by_field_id["domain_$role_id"][$domain] = $domain;
571  continue;
572  }
573 
574  $assignments_by_domain[$domain] = $role_id;
575  }
576  }
577 
578  if ($problems_domains_by_field_id !== []) {
579  foreach ($problems_domains_by_field_id as $field_id => $domains) {
580  $domain_string = implode(', ', $domains);
581  $alert = sprintf($this->lng->txt('reg_domain_already_assigned_p'), $domain_string);
582  if (count($domains) === 1) {
583  $alert = sprintf($this->lng->txt('reg_domain_already_assigned_s'), $domain_string);
584  }
585  $form->getItemByPostVar($field_id)->setAlert($alert);
586  }
587 
588  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
589  $this->editEmailAssignments($form);
590  return false;
591  }
592 
593  $this->assignments_obj->deleteAll();
594 
595  $counter = 0;
596  foreach ($assignments_by_domain as $domain => $role_id) {
597  $this->assignments_obj->setDomain($counter, $domain);
598  $this->assignments_obj->setRole($counter, $role_id);
599  $counter++;
600  }
601  $default_role = $form->getInput("default_role");
602  $this->assignments_obj->setDefaultRole((int) $default_role);
603  $this->assignments_obj->save();
604  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
605  $this->view();
606  return true;
607  }
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
editEmailAssignments(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ saveRoleAccessLimitations()

ilRegistrationSettingsGUI::saveRoleAccessLimitations ( )

Definition at line 609 of file class.ilRegistrationSettingsGUI.php.

References ilObjRole\_lookupRegisterAllowed(), checkAccess(), editRoleAccessLimitations(), ilRegistrationRoleAccessLimitations\IL_REG_ACCESS_LIMITATION_MISSING_MODE, ilRegistrationRoleAccessLimitations\IL_REG_ACCESS_LIMITATION_OUT_OF_DATE, initRoleAccessForm(), initRoleAccessLimitations(), ILIAS\Repository\lng(), and view().

609  : bool
610  {
611  $this->checkAccess('write');
612  $this->initRoleAccessLimitations();
613 
614  $form = $this->initRoleAccessForm();
615  if (!$form->checkInput()) {
616  $form->setValuesByPost();
617  $this->editRoleAccessLimitations($form);
618  return false;
619  }
620 
621  $this->access_limitations_obj->resetAccessLimitations();
622  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
623  $mode = $form->getInput('role_access_' . $role['id']);
624  $this->access_limitations_obj->setMode($mode, $role['id']);
625 
626  if ($mode === 'absolute') {
627  $this->access_limitations_obj->setAbsolute($form->getInput('absolute_date_' . $role['id']), $role['id']);
628  }
629 
630  if ($mode === 'relative') {
631  $this->access_limitations_obj->setRelative($form->getInput('duration_' . $role['id']), $role['id']);
632  }
633  }
634 
635  if ($err = $this->access_limitations_obj->validate()) {
636  switch ($err) {
638  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_access_limitation_missing_mode'));
639  break;
640 
642  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_access_limitation_out_of_date'));
643  break;
644  }
645  $this->editRoleAccessLimitations();
646  return false;
647  }
648 
649  $this->access_limitations_obj->save();
650  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
651  $this->view();
652  return true;
653  }
static _lookupRegisterAllowed()
get all roles that are activated in user registration
editRoleAccessLimitations(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ setSubTabs()

ilRegistrationSettingsGUI::setSubTabs ( string  $activeTab = 'registration_settings')

Definition at line 117 of file class.ilRegistrationSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by addCodes(), createCodes(), deleteConfirmation(), listCodes(), and view().

117  : void
118  {
119  $this->tabs->addSubTab(
120  "registration_settings",
121  $this->lng->txt("registration_tab_settings"),
122  $this->ctrl->getLinkTarget($this, 'view')
123  );
124  $this->tabs->addSubTab(
125  "registration_codes",
126  $this->lng->txt("registration_tab_codes"),
127  $this->ctrl->getLinkTarget($this, 'listCodes')
128  );
129  $this->tabs->activateSubTab($activeTab);
130  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateRoles()

ilRegistrationSettingsGUI::updateRoles ( )

Definition at line 391 of file class.ilRegistrationSettingsGUI.php.

References checkAccess(), editRoles(), ilObjectFactory\getInstanceByObjId(), initRolesForm(), ILIAS\Repository\lng(), and view().

391  : bool
392  {
393  $this->checkAccess('write');
394  $form = $this->initRolesForm();
395  if ($form->checkInput()) {
396  $roles = (array) $form->getInput('roles');
397  if (count($roles) < 1) {
398  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_last_role_for_registration'));
399  $this->editRoles();
400  return false;
401  }
402  foreach ($this->rbacreview->getGlobalRoles() as $role) {
403  if ($role_obj = ilObjectFactory::getInstanceByObjId($role, false)) {
404  $role_obj->setAllowRegister(isset($roles[$role]) && (int) $roles[$role] === 1);
405  $role_obj->update();
406  }
407  }
408  }
409  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
410  $this->view();
411  return true;
412  }
editRoles(?ilPropertyFormGUI $form=null)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

◆ view()

ilRegistrationSettingsGUI::view ( )

Definition at line 268 of file class.ilRegistrationSettingsGUI.php.

References $_GET, checkAccess(), checkAccessBool(), ILIAS\Repository\ctrl(), initForm(), initFormValues(), ILIAS\Repository\lng(), setSubTabs(), ILIAS\Repository\toolbar(), and USER_FOLDER_ID.

Referenced by save(), saveAssignment(), saveRoleAccessLimitations(), and updateRoles().

268  : void
269  {
270  $this->checkAccess('visible,read');
271  $this->setSubTabs();
272 
273  // edit new accout mail
274  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "ref_id", USER_FOLDER_ID);
275  if ($this->checkAccessBool('write')) {
276  $this->toolbar->addButton(
277  $this->lng->txt('registration_user_new_account_mail'),
278  $this->ctrl->getLinkTargetByClass(
279  [
280  ilAdministrationGUI::class,
281  ilObjUserFolderGUI::class
282  ],
283  'newAccountMail'
284  )
285  );
286  $this->ctrl->setParameterByClass(ilObjUserFolderGUI::class, 'ref_id', $_GET['ref_id']);
287  }
288 
289  $form = $this->initForm();
290  $this->initFormValues($form);
291  $this->tpl->setContent($form->getHTML());
292  }
$_GET["client_id"]
Definition: webdav.php:30
const USER_FOLDER_ID
Definition: constants.php:33
initFormValues(ilPropertyFormGUI $formGUI)
setSubTabs(string $activeTab='registration_settings')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilRegistrationSettingsGUI::$access
protected

Definition at line 42 of file class.ilRegistrationSettingsGUI.php.

◆ $access_limitations_obj

ilRegistrationRoleAccessLimitations ilRegistrationSettingsGUI::$access_limitations_obj = null
protected

Definition at line 52 of file class.ilRegistrationSettingsGUI.php.

◆ $assignments_obj

ilRegistrationRoleAssignments ilRegistrationSettingsGUI::$assignments_obj = null
protected

Definition at line 51 of file class.ilRegistrationSettingsGUI.php.

◆ $ctrl

ilCtrlInterface ilRegistrationSettingsGUI::$ctrl
protected

Definition at line 38 of file class.ilRegistrationSettingsGUI.php.

◆ $error

ilErrorHandling ilRegistrationSettingsGUI::$error
protected

Definition at line 44 of file class.ilRegistrationSettingsGUI.php.

◆ $form_gui

ilPropertyFormGUI ilRegistrationSettingsGUI::$form_gui = null
protected

Definition at line 54 of file class.ilRegistrationSettingsGUI.php.

Referenced by initAddCodesForm(), and initForm().

◆ $http

ILIAS HTTP Services ilRegistrationSettingsGUI::$http
protected

Definition at line 47 of file class.ilRegistrationSettingsGUI.php.

◆ $lng

ilLanguage ilRegistrationSettingsGUI::$lng
protected

Definition at line 43 of file class.ilRegistrationSettingsGUI.php.

◆ $rbacreview

ilRbacReview ilRegistrationSettingsGUI::$rbacreview
protected

Definition at line 41 of file class.ilRegistrationSettingsGUI.php.

◆ $rbacsystem

ilRbacSystem ilRegistrationSettingsGUI::$rbacsystem
protected

Definition at line 40 of file class.ilRegistrationSettingsGUI.php.

◆ $ref_id

int ilRegistrationSettingsGUI::$ref_id
Todo:
make private

Definition at line 36 of file class.ilRegistrationSettingsGUI.php.

◆ $refinery

ILIAS Refinery Factory ilRegistrationSettingsGUI::$refinery
protected

Definition at line 48 of file class.ilRegistrationSettingsGUI.php.

◆ $registration_settings

ilRegistrationSettings ilRegistrationSettingsGUI::$registration_settings
protected

Definition at line 50 of file class.ilRegistrationSettingsGUI.php.

◆ $tabs

ilTabsGUI ilRegistrationSettingsGUI::$tabs
protected

Definition at line 45 of file class.ilRegistrationSettingsGUI.php.

◆ $toolbar

ilToolbarGUI ilRegistrationSettingsGUI::$toolbar
protected

Definition at line 46 of file class.ilRegistrationSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilRegistrationSettingsGUI::$tpl
protected

Definition at line 39 of file class.ilRegistrationSettingsGUI.php.

◆ CODE_TYPE_EXTENSION

const ilRegistrationSettingsGUI::CODE_TYPE_EXTENSION = 2

Definition at line 31 of file class.ilRegistrationSettingsGUI.php.

◆ CODE_TYPE_REGISTRATION

const ilRegistrationSettingsGUI::CODE_TYPE_REGISTRATION = 1

Definition at line 30 of file class.ilRegistrationSettingsGUI.php.


The documentation for this class was generated from the following file: