ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 ()
 
 getRegistrationCodeTable ()
 
 getRegistrationFilter ()
 
 initAddCodesForm ()
 
 getLocalRoleAutoComplete ()
 
 addCodes ()
 
 createCodes ()
 
 deleteCodes ()
 
 deleteConfirmation ()
 
 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
 
readonly ILIAS HTTP Services $http
 
readonly ILIAS Refinery Factory $refinery
 
readonly Factory $ui_factory
 
readonly UIRenderer $ui_renderer
 
readonly ilUIService $ui_service
 
readonly ilObjUser $user
 
readonly RegistrationCodeRepository $code_repository
 
readonly RegistrationFilterComponent $registration_code_filter
 
readonly RegistrationCodesTable $registration_codes_table
 
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 70 of file class.ilRegistrationSettingsGUI.php.

71 {
72 global $DIC;
73
74 $this->tpl = $DIC->ui()->mainTemplate();
75 $this->ctrl = $DIC->ctrl();
76 $this->access = $DIC->access();
77 $this->rbacsystem = $DIC->rbac()->system();
78 $this->rbacreview = $DIC->rbac()->review();
79 $this->error = $DIC['ilErr'];
80 $this->tabs = $DIC->tabs();
81 $this->toolbar = $DIC->toolbar();
82
83 $this->lng = $DIC->language();
84 $this->lng->loadLanguageModule('administration');
85 $this->lng->loadLanguageModule('registration');
86 $this->lng->loadLanguageModule('user');
87 $this->registration_settings = new ilRegistrationSettings();
88
89 $this->http = $DIC->http();
90 $this->refinery = $DIC->refinery();
91 $this->ref_id = $this->initRefIdFromQuery();
92 $this->ui_factory = $DIC->ui()->factory();
93 $this->ui_renderer = $DIC->ui()->renderer();
94 $this->ui_service = $DIC->uiService();
95 $this->user = $DIC->user();
96 $this->code_repository = new RegistrationCodeRepository($DIC->database());
97 }
error(string $a_errmsg)
Class ilObjAuthSettingsGUI.
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addCodes()

ilRegistrationSettingsGUI::addCodes ( )

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

969 : void
970 {
971 $this->checkAccess('write');
972 $this->setSubTabs('registration_codes');
973 $this->initAddCodesForm();
974
975 // default
976 $limit = $this->form_gui->getItemByPostVar("reg_limit");
977 $limit->setValue("none");
978 $this->tpl->setContent($this->form_gui->getHTML());
979 }
setSubTabs(string $activeTab='registration_settings')

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

+ Here is the call graph for this function:

◆ checkAccess()

ilRegistrationSettingsGUI::checkAccess ( string  $a_permission)
protected

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

132 : void
133 {
134 if (!$this->checkAccessBool($a_permission)) {
135 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->WARNING);
136 }
137 }

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

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

+ 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 139 of file class.ilRegistrationSettingsGUI.php.

139 : bool
140 {
141 return $this->access->checkAccess($a_permission, '', $this->ref_id);
142 }

References ILIAS\Repository\access().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createCodes()

ilRegistrationSettingsGUI::createCodes ( )

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

981 : void
982 {
983 $this->checkAccess('write');
984 $this->setSubTabs('registration_codes');
985
986 $this->initAddCodesForm();
987 $valid = $this->form_gui->checkInput();
988 if ($valid) {
989 $number = $this->form_gui->getInput('reg_codes_number');
990 $role = (int) $this->form_gui->getInput('reg_codes_role');
991 $local = $this->form_gui->getInput("reg_codes_local");
992
993 if (is_array($local)) {
994 $role_ids = [];
995 foreach (array_unique($local) as $item) {
996 if (trim($item)) {
997 $role_id = $this->rbacreview->roleExists($item);
998 if ($role_id) {
999 $role_ids[] = $role_id;
1000 }
1001 }
1002 }
1003 if (count($role_ids)) {
1004 $local = $role_ids;
1005 }
1006 }
1007
1008 $date = null;
1009 $limit = $this->form_gui->getInput("reg_limit");
1010 switch ($limit) {
1011 case "absolute":
1012 $date_input = $this->form_gui->getItemByPostVar("abs_date");
1013 $date = $date_input->getDate()->get(IL_CAL_DATE);
1014 if ($date < date("Y-m-d")) {
1015 $date_input->setAlert($this->lng->txt("form_msg_wrong_date"));
1016 $valid = false;
1017 }
1018 break;
1019
1020 case "relative":
1021 $date = $this->form_gui->getInput("rel_date");
1022 if (!array_sum($date)) {
1023 $valid = false;
1024 } else {
1025 $date = serialize([
1026 "d" => $date["dd"],
1027 "m" => $date["MM"] % 12,
1028 "y" => (int) floor($date["MM"] / 12)
1029 ]);
1030 }
1031 break;
1032
1033 case "none":
1034 $limit = null;
1035 break;
1036 }
1037 }
1038
1039 if ($valid) {
1040 $stamp = time();
1041 for ($loop = 1; $loop <= $number; $loop++) {
1042 $code_types = (array) $this->form_gui->getInput('code_type');
1043
1045 $role,
1046 $stamp,
1047 $local,
1048 $limit,
1049 $date,
1050 in_array(self::CODE_TYPE_REGISTRATION, $code_types) ? true : false,
1051 in_array(self::CODE_TYPE_EXTENSION, $code_types) ? true : false
1052 );
1053 }
1054
1055 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
1056 $this->ctrl->redirect($this, "listCodes");
1057 } else {
1058 $this->form_gui->setValuesByPost();
1059 $this->tpl->setContent($this->form_gui->getHTML());
1060 }
1061 }
const IL_CAL_DATE
static create(int $role, int $stamp, array $local_roles, ?string $limit, ?string $limit_date, bool $reg_type, bool $ext_type)
$valid

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

+ Here is the call graph for this function:

◆ deleteCodes()

ilRegistrationSettingsGUI::deleteCodes ( )

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

1063 : void
1064 {
1065 $this->checkAccess("write");
1066
1067 $ids = [];
1068 if ($this->http->wrapper()->post()->has('id')) {
1069 $ids = $this->http->wrapper()->post()->retrieve(
1070 'id',
1071 $this->refinery->kindlyTo()->listOf(
1072 $this->refinery->kindlyTo()->int()
1073 )
1074 );
1075 }
1076 $this->code_repository->deleteCodes($ids);
1077 $this->tpl->setOnScreenMessage('success', $this->lng->txt('info_deleted'), true);
1078 $this->ctrl->redirect($this, "listCodes");
1079 }

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

+ Here is the call graph for this function:

◆ deleteConfirmation()

ilRegistrationSettingsGUI::deleteConfirmation ( )

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

1081 : void
1082 {
1083 $this->checkAccess('write');
1084 $codes = [];
1085 if ($this->http->wrapper()->query()->has('registration_codes_code_ids')) {
1086 $ids = $this->http->wrapper()->query()->retrieve(
1087 'registration_codes_code_ids',
1088 $this->refinery->kindlyTo()->listOf(
1089 $this->refinery->kindlyTo()->string()
1090 )
1091 );
1092 if ($ids === ['ALL_OBJECTS']) {
1093 $codes = $this->code_repository->getCodesByFilter($this->getRegistrationFilter()->getFilterData());
1094 } else {
1095 $ids = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform($ids);
1096 $codes = $this->code_repository->loadCodesByIds($ids);
1097 }
1098 }
1099 if (!count($codes)) {
1100 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_select_one'), true);
1101 $this->ctrl->redirect($this, 'listCodes');
1102 }
1103 $this->setSubTabs('registration_codes');
1104
1105 $gui = new ilConfirmationGUI();
1106 $gui->setHeaderText($this->lng->txt('info_delete_sure'));
1107 $gui->setCancel($this->lng->txt('cancel'), 'listCodes');
1108 $gui->setConfirm($this->lng->txt('confirm'), 'deleteCodes');
1109 $gui->setFormAction($this->ctrl->getFormAction($this, 'deleteCodes'));
1110
1111 foreach ($codes as $code) {
1112 $gui->addItem('id[]', (string) $code['code_id'], $code['code']);
1113 }
1114 $this->tpl->setContent($gui->getHTML());
1115 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References checkAccess(), ILIAS\Repository\ctrl(), getRegistrationFilter(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and setSubTabs().

+ Here is the call graph for this function:

◆ editEmailAssignments()

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

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

451 : void
452 {
453 $this->checkAccess('write');
454 $this->tabs->clearTargets();
455 $this->tabs->setBackTarget(
456 $this->lng->txt("registration_settings"),
457 $this->ctrl->getLinkTarget($this, "view")
458 );
459
460 $this->initRoleAssignments();
461 $form = $form ?? $this->initEmailAssignmentForm();
462 $this->tpl->setContent($form->getHTML());
463 }

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

Referenced by saveAssignment().

+ 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 508 of file class.ilRegistrationSettingsGUI.php.

508 : void
509 {
510 global $DIC;
511
512 $this->checkAccess('write');
513 $this->tabs->clearTargets();
514 $this->tabs->setBackTarget(
515 $this->lng->txt("registration_settings"),
516 $this->ctrl->getLinkTarget($this, "view")
517 );
519 if (null === $form) {
520 $form = $this->initRoleAccessForm();
521 }
522 $this->tpl->setContent($form->getHTML());
523 }

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

Referenced by saveRoleAccessLimitations().

+ 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 414 of file class.ilRegistrationSettingsGUI.php.

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 if (!$form instanceof ilPropertyFormGUI) {
423 $form = $this->initRolesForm();
424 }
425 $this->tpl->setContent($form->getHTML());
426 }
This class represents a property form user interface.

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

Referenced by updateRoles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilRegistrationSettingsGUI::executeCommand ( )

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

110 : void
111 {
112 $next_class = $this->ctrl->getNextClass($this);
113 $cmd = $this->ctrl->getCmd();
114
115 if ($this->http->wrapper()->query()->has('registration_codes_table_action')) {
116 $cmd = $this->http->wrapper()->query()->retrieve(
117 'registration_codes_table_action',
118 $this->refinery->kindlyTo()->string()
119 );
120 }
121
122 switch ($next_class) {
123 default:
124 if (!$cmd) {
125 $cmd = 'view';
126 }
127 $this->$cmd();
128 break;
129 }
130 }

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

+ Here is the call graph for this function:

◆ exportCodes()

ilRegistrationSettingsGUI::exportCodes ( )

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

1117 : void
1118 {
1119 $codes = [];
1120 if ($this->http->wrapper()->query()->has('registration_codes_code_ids')) {
1121 $ids = $this->http->wrapper()->query()->retrieve(
1122 'registration_codes_code_ids',
1123 $this->refinery->kindlyTo()->listOf(
1124 $this->refinery->kindlyTo()->string()
1125 )
1126 );
1127 if ($ids === ['ALL_OBJECTS']) {
1128 $codes = $this->code_repository->getCodesByFilter($this->getRegistrationFilter()->getFilterData());
1129 } else {
1130 $ids = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform($ids);
1131 $codes = $this->code_repository->loadCodesByIds($ids);
1132 }
1133
1134 $codes = array_filter(array_map(
1135 static fn($code) => (string) ($code['code'] ?? ''),
1136 $codes
1137 ));
1138 }
1139
1140 if (count($codes)) {
1142 implode("\r\n", $codes),
1143 'ilias_registration_codes_' . date('d-m-Y') . '.txt',
1144 'text/plain'
1145 );
1146 } else {
1147 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('registration_export_codes_no_data'));
1148 $this->listCodes();
1149 }
1150 }
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")

References ilUtil\deliverData(), getRegistrationFilter(), ILIAS\FileDelivery\http(), listCodes(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getLocalRoleAutoComplete()

ilRegistrationSettingsGUI::getLocalRoleAutoComplete ( )

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

961 : void
962 {
963 $q = $_REQUEST["term"];
965 echo $list;
966 exit;
967 }
static getList(string $a_str)
Get completion list.
exit
$q
Definition: shib_logout.php:25

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

+ Here is the call graph for this function:

◆ getRegistrationCodeTable()

ilRegistrationSettingsGUI::getRegistrationCodeTable ( )

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

835 {
836 if (!isset($this->registration_codes_table)) {
837 $this->registration_codes_table = new RegistrationCodesTable(
838 $this->http->request(),
839 $this->lng,
840 $this->ui_factory,
841 new DataFactory(),
842 $this->rbacreview,
843 $this->ctrl->getLinkTarget($this, 'listCodes', '', true),
844 $this->user,
845 $this->code_repository,
846 $this->checkAccessBool('write'),
847 );
848 }
849
851 }
readonly RegistrationCodesTable $registration_codes_table

References $registration_codes_table, ILIAS\Repository\ctrl(), and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getRegistrationFilter()

ilRegistrationSettingsGUI::getRegistrationFilter ( )

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

854 {
855 if (!isset($this->registration_code_filter)) {
856 $this->registration_code_filter = new RegistrationFilterComponent(
857 $this->ctrl->getLinkTarget($this, 'listCodes', '', true),
858 $this->ui_factory,
859 $this->ui_service,
860 $this->lng,
861 $this->rbacreview,
862 $this->code_repository
863 );
864 }
865
867 }
readonly RegistrationFilterComponent $registration_code_filter

References $registration_code_filter, and ILIAS\Repository\ctrl().

Referenced by deleteConfirmation(), and exportCodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAddCodesForm()

ilRegistrationSettingsGUI::initAddCodesForm ( )

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

870 {
871 $this->form_gui = new ilPropertyFormGUI();
872 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'createCodes'));
873 $this->form_gui->setTitle($this->lng->txt('registration_codes_edit_header'));
874
875 $count = new ilNumberInputGUI($this->lng->txt('registration_codes_number'), 'reg_codes_number');
876 $count->setSize(4);
877 $count->setMaxLength(4);
878 $count->setMinValue(1);
879 $count->setMaxValue(1000);
880 $count->setRequired(true);
881 $this->form_gui->addItem($count);
882
883 // type
884 $code_type = new ilCheckboxGroupInputGUI($this->lng->txt('registration_codes_type'), 'code_type');
885 $code_type->setRequired(true);
886
887 $code_type->addOption(
889 $this->lng->txt('registration_codes_type_reg'),
890 (string) self::CODE_TYPE_REGISTRATION,
891 $this->lng->txt('registration_codes_type_reg_info')
892 )
893 );
894 $code_type->addOption(
896 $this->lng->txt('registration_codes_type_ext'),
897 (string) self::CODE_TYPE_EXTENSION,
898 $this->lng->txt('registration_codes_type_ext_info')
899 )
900 );
901 $this->form_gui->addItem($code_type);
902
903 $sec = new ilFormSectionHeaderGUI();
904 $sec->setTitle($this->lng->txt('registration_codes_roles_title'));
905 $this->form_gui->addItem($sec);
906
907 $options = ["" => $this->lng->txt('registration_codes_no_assigned_role')];
908 foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
909 if (!in_array($role_id, [SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID], true)) {
910 $options[$role_id] = ilObject::_lookupTitle($role_id);
911 }
912 }
913 $roles = new ilSelectInputGUI($this->lng->txt("registration_codes_roles"), "reg_codes_role");
914 $roles->setInfo($this->lng->txt("registration_codes_override_info"));
915 $roles->setOptions($options);
916 $this->form_gui->addItem($roles);
917
918 $local = new ilTextInputGUI($this->lng->txt("registration_codes_roles_local"), "reg_codes_local");
919 $local->setMulti(true);
920 $local->setDataSource($this->ctrl->getLinkTarget($this, "getLocalRoleAutoComplete", "", true));
921 $this->form_gui->addItem($local);
922
923 $sec = new ilFormSectionHeaderGUI();
924 $sec->setTitle($this->lng->txt('reg_access_limitations'));
925 $this->form_gui->addItem($sec);
926
927 $limit = new ilRadioGroupInputGUI($this->lng->txt("reg_access_limitation_mode"), "reg_limit");
928 $limit->setInfo($this->lng->txt("registration_codes_override_info"));
929 $this->form_gui->addItem($limit);
930
931 $opt = new ilRadioOption($this->lng->txt("registration_codes_roles_limitation_none"), "none");
932 $limit->addOption($opt);
933
934 $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_none"), "unlimited");
935 $limit->addOption($opt);
936
937 $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_absolute"), "absolute");
938 $limit->addOption($opt);
939
940 $dt = new ilDateTimeInputGUI($this->lng->txt("reg_access_limitation_mode_absolute_target"), "abs_date");
941 $dt->setRequired(true);
942 $opt->addSubItem($dt);
943
944 $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_relative"), "relative");
945 $limit->addOption($opt);
946
947 $dur = new ilDurationInputGUI($this->lng->txt("reg_access_limitation_mode_relative_target"), "rel_date");
948 $dur->setRequired(true);
949 $dur->setShowMonths(true);
950 $dur->setShowDays(true);
951 $dur->setShowHours(false);
952 $dur->setShowMinutes(false);
953 $opt->addSubItem($dur);
954
955 $this->form_gui->addCommandButton('createCodes', $this->lng->txt('create'));
956 $this->form_gui->addCommandButton('listCodes', $this->lng->txt('cancel'));
957 return $this->form_gui;
958 }
This class represents a property in a property form.
This class represents an option in a checkbox group.
This class represents a date/time property in a property form.
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents a section header in a property form.
This class represents a number property in a property form.
static _lookupTitle(int $obj_id)
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
This class represents a text property in a property form.
const SYSTEM_ROLE_ID
Definition: constants.php:29
const ANONYMOUS_ROLE_ID
Definition: constants.php:28

References $form_gui, ILIAS\UI\Implementation\Component\Input\Field\$options, ilObject\_lookupTitle(), ANONYMOUS_ROLE_ID, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and SYSTEM_ROLE_ID.

Referenced by addCodes(), and createCodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initEmailAssignmentForm()

ilRegistrationSettingsGUI::initEmailAssignmentForm ( )

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

466 {
467 $role_assignment_form = new ilPropertyFormGUI();
468 $role_assignment_form->setFormAction($this->ctrl->getFormAction($this));
469 $role_assignment_form->setTitle($this->lng->txt('reg_email_role_assignment'));
470
471 $global_roles = ["" => $this->lng->txt("links_select_one")];
472 foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
473 if ($role_id === ANONYMOUS_ROLE_ID) {
474 continue;
475 }
476
477 $global_roles[$role_id] = ilObjRole::_lookupTitle($role_id);
478 $role_assignments = new ilCheckboxInputGUI(ilObjRole::_lookupTitle($role_id), "role_assigned_$role_id");
479
480 $domains = $this->assignments_obj->getDomainsByRole($role_id);
481
482 $domain = new ilTextInputGUI($this->lng->txt('reg_domain'), "domain_$role_id");
483 $domain->setMulti(true);
484 $domain->setValidationRegexp("/^@.*\.[a-zA-Z]{1,4}$/");
485 if (!empty($domains)) {
486 $domain->setValue($domains[0]);
487 $domain->setMultiValues($domains);
488 $role_assignments->setChecked(true);
489 }
490
491 $role_assignments->addSubItem($domain);
492 $role_assignment_form->addItem($role_assignments);
493 }
494
495 $default_role = new ilSelectInputGUI($this->lng->txt('reg_default'));
496 $default_role->setPostVar("default_role");
497 $default_role->setOptions($global_roles);
498 $default_role->setValue($this->assignments_obj->getDefaultRole());
499 $default_role->setRequired(true);
500 $role_assignment_form->addItem($default_role);
501
502 $role_assignment_form->addCommandButton("saveAssignment", $this->lng->txt("save"));
503 $role_assignment_form->addCommandButton("view", $this->lng->txt("cancel"));
504
505 return $role_assignment_form;
506 }
This class represents a checkbox property in a property form.

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

Referenced by editEmailAssignments(), and saveAssignment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilRegistrationSettingsGUI::initForm ( )

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

160 {
162 $form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
163 $form_gui->setTitle($this->lng->txt('reg_settings_header'));
164
165 $reg_type = new ilRadioGroupInputGUI($this->lng->txt('reg_type'), 'reg_type');
166 $reg_type->addOption(new ilRadioOption(
167 $this->lng->txt('reg_disabled'),
169 ));
170 $option = new ilRadioOption($this->lng->txt('reg_direct'), (string) ilRegistrationSettings::IL_REG_DIRECT);
171 $option->setInfo($this->lng->txt('reg_direct_info'));
172 $cd = new ilCheckboxInputGUI(
173 $this->lng->txt('reg_allow_codes'),
175 );
176 $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
177 $option->addSubItem($cd);
178 $reg_type->addOption($option);
179 $option = new ilRadioOption($this->lng->txt('reg_approve'), (string) ilRegistrationSettings::IL_REG_APPROVE);
180 $option->setInfo($this->lng->txt('reg_approve_info'));
181 $cd = new ilCheckboxInputGUI(
182 $this->lng->txt('reg_allow_codes'),
184 );
185 $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
186 $option->addSubItem($cd);
187 $reg_type->addOption($option);
188 $option = new ilRadioOption(
189 $this->lng->txt('reg_type_confirmation'),
191 );
192 $option->setInfo($this->lng->txt('reg_type_confirmation_info'));
193 $lt = new ilNumberInputGUI($this->lng->txt('reg_confirmation_hash_life_time'), 'reg_hash_life_time');
194 $lt->setSize(6); // #8511
195 $lt->setMaxLength(6);
197 $lt->setRequired(true);
198 $lt->setInfo($this->lng->txt('reg_confirmation_hash_life_time_info'));
199 $lt->setSuffix($this->lng->txt('seconds'));
200 $option->addSubItem($lt);
201 $cd = new ilCheckboxInputGUI(
202 $this->lng->txt('reg_allow_codes'),
204 );
205 $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
206 $option->addSubItem($cd);
207 $reg_type->addOption($option);
208 $option = new ilRadioOption(
209 $this->lng->txt('registration_reg_type_codes'),
211 );
212 $option->setInfo($this->lng->txt('registration_reg_type_codes_info'));
213 $reg_type->addOption($option);
214 $form_gui->addItem($reg_type);
215
216 $pwd_gen = new ilCheckboxInputGUI($this->lng->txt('passwd_generation'), 'reg_pwd');
217 $pwd_gen->setValue('1');
218 $pwd_gen->setInfo($this->lng->txt('reg_info_pwd'));
219 $form_gui->addItem($pwd_gen);
220
221 $approver = new ilTextInputGUI($this->lng->txt('reg_notification'), 'reg_approver');
222 $approver->setSize(32);
223 $approver->setMaxLength(50);
224 $approver->setInfo($this->lng->txt('reg_notification_info'));
225 $form_gui->addItem($approver);
226
227 $roles = new ilRadioGroupInputGUI($this->lng->txt('reg_role_assignment'), 'reg_role_type');
228 $option = new ilRadioOption($this->lng->txt('reg_fixed'), (string) ilRegistrationSettings::IL_REG_ROLES_FIXED);
229 $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
230 $edit = $this->ctrl->getLinkTarget($this, 'editRoles');
231 $list->setHtml($this->parseRoleList($this->prepareRoleList(), $edit));
232 $option->addSubItem($list);
233 $roles->addOption($option);
234 $option = new ilRadioOption($this->lng->txt('reg_email'), (string) ilRegistrationSettings::IL_REG_ROLES_EMAIL);
235 $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
236 $edit = $this->ctrl->getLinkTarget($this, 'editEmailAssignments');
237 $list->setHtml($this->parseRoleList($this->prepareAutomaticRoleList(), $edit));
238 $option->addSubItem($list);
239 $roles->addOption($option);
240 $roles->setInfo($this->lng->txt('registration_codes_override_global_info'));
241 $form_gui->addItem($roles);
242
243 $limit = new ilCheckboxInputGUI($this->lng->txt('reg_access_limitations'), 'reg_access_limitation');
244 $limit->setValue('1');
245 $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
246 $edit = $this->ctrl->getLinkTarget($this, 'editRoleAccessLimitations');
247 $list->setHtml($this->parseRoleList($this->prepareAccessLimitationRoleList(), $edit));
248 $list->setInfo($this->lng->txt('registration_codes_override_global_info'));
249 $limit->addSubItem($list);
250 $form_gui->addItem($limit);
251
252 $domains = new ilTextInputGUI($this->lng->txt('reg_allowed_domains'), 'reg_allowed_domains');
253 $domains->setInfo($this->lng->txt('reg_allowed_domains_info'));
254 $form_gui->addItem($domains);
255
256 if ($this->rbacsystem->checkAccess("write", $this->ref_id)) {
257 $form_gui->addCommandButton('save', $this->lng->txt('save'));
258 } else {
259 foreach ($form_gui->getItems() as $item) {
260 if ($item instanceof ilFormSectionHeaderGUI) {
261 continue;
262 }
263
264 $item->setDisabled(true);
265 }
266 }
267 return $form_gui;
268 }
This class represents a custom property in a property form.
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
parseRoleList(array $roles, string $url)

References $form_gui, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getItems(), 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(), and ilPropertyFormGUI\setTitle().

Referenced by save(), and view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormValues()

ilRegistrationSettingsGUI::initFormValues ( ilPropertyFormGUI  $formGUI)

@noinspection PhpUndefinedMethodInspection

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

270 : void
271 {
273 if ($this->registration_settings->roleSelectionEnabled()) {
275 } elseif ($this->registration_settings->automaticRoleAssignmentEnabled()) {
277 }
278
280 $values = [
281 'reg_type' => $this->registration_settings->getRegistrationType(),
282 'reg_hash_life_time' => $this->registration_settings->getRegistrationHashLifetime(),
283 'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
284 'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
285 'reg_role_type' => $role_type,
286 'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
287 'reg_allowed_domains' => implode(';', $this->registration_settings->getAllowedDomains())
288 ];
289
290 $allow_codes = $this->registration_settings->getAllowCodes();
291 $reg_type = $this->registration_settings->getRegistrationType();
292 if ($allow_codes && in_array($reg_type, [
296 ], true)) {
297 $values['reg_codes_' . $reg_type] = true;
298 }
299
300 $formGUI->setValuesByArray($values);
301 }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRefIdFromQuery()

ilRegistrationSettingsGUI::initRefIdFromQuery ( )
protected

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

99 : int
100 {
101 if ($this->http->wrapper()->query()->has('ref_id')) {
102 return $this->http->wrapper()->query()->retrieve(
103 'ref_id',
104 $this->refinery->kindlyTo()->int()
105 );
106 }
107 return 0;
108 }

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleAccessForm()

ilRegistrationSettingsGUI::initRoleAccessForm ( )

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

526 {
527 $form = new ilPropertyFormGUI();
528 $form->setFormAction($this->ctrl->getFormAction($this));
529 $form->setTitle($this->lng->txt('reg_role_access_limitations'));
530 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
531 $role_access = new ilRadioGroupInputGUI($role['title'], "role_access_" . $role['id']);
532
533 $op_unlimited = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_unlimited'), "unlimited");
534
535 $op_absolute = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_absolute'), "absolute");
536 $absolute_date = new ilDateTime(
537 date("d.m.Y", $this->access_limitations_obj->getAbsolute($role['id'])),
539 );
540 $date = new ilDateTimeInputGUI("", "absolute_date_" . $role['id']);
541 $date->setDate($absolute_date);
542 $op_absolute->addSubItem($date);
543
544 $op_relative = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_relative'), "relative");
545 $duration = new ilDurationInputGUI("", "duration_" . $role['id']);
546 $duration->setShowMinutes(false);
547 $duration->setShowHours(false);
548 $duration->setShowDays(true);
549 $duration->setShowMonths(true);
550 $duration->setDays($this->access_limitations_obj->getRelative($role['id'], 'd'));
551 $duration->setMonths($this->access_limitations_obj->getRelative($role['id'], 'm'));
552 $op_relative->addSubItem($duration);
553
554 $role_access->addOption($op_unlimited);
555 $role_access->addOption($op_absolute);
556 $role_access->addOption($op_relative);
557 $role_access->setValue(
558 $this->access_limitations_obj->getMode(
559 $role['id']
560 ) === 'null' ? 'unlimited' : $this->access_limitations_obj->getMode($role['id'])
561 );
562
563 $form->addItem($role_access);
564 }
565
566 $form->addCommandButton("saveRoleAccessLimitations", $this->lng->txt("save"));
567 $form->addCommandButton("view", $this->lng->txt("cancel"));
568
569 return $form;
570 }
$duration
@classDescription Date and time handling
static _lookupRegisterAllowed()
get all roles that are activated in user registration

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

Referenced by editRoleAccessLimitations(), and saveRoleAccessLimitations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRoleAccessLimitations()

ilRegistrationSettingsGUI::initRoleAccessLimitations ( )
private

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

811 : void
812 {
813 if (!$this->access_limitations_obj instanceof ilRegistrationRoleAccessLimitations) {
814 $this->access_limitations_obj = new ilRegistrationRoleAccessLimitations();
815 }
816 }

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

+ Here is the caller graph for this function:

◆ initRoleAssignments()

ilRegistrationSettingsGUI::initRoleAssignments ( )
private

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

804 : void
805 {
806 if (!$this->assignments_obj instanceof ilRegistrationRoleAssignments) {
807 $this->assignments_obj = new ilRegistrationRoleAssignments();
808 }
809 }
Class class.ilregistrationEmailRoleAssignments.

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

+ Here is the caller graph for this function:

◆ initRolesForm()

ilRegistrationSettingsGUI::initRolesForm ( )
protected

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

386 {
387 $role_form = new ilPropertyFormGUI();
388 $role_form->setFormAction($this->ctrl->getFormAction($this, 'save'));
389 $role_form->setTitle($this->lng->txt('reg_selectable_roles'));
390
391 $roles = new ilCheckboxGroupInputGUI($this->lng->txt('reg_available_roles'), 'roles');
392 $allowed_roles = [];
393 foreach ($this->rbacreview->getGlobalRoles() as $role) {
394 if ($role === SYSTEM_ROLE_ID || $role === ANONYMOUS_ROLE_ID) {
395 continue;
396 }
397 $role_option = new ilCheckboxOption(ilObjRole::_lookupTitle($role));
398 $role_option->setValue((string) $role);
399 $roles->addOption($role_option);
400 $allowed_roles[$role] = ilObjRole::_lookupAllowRegister($role);
401 }
402
403 $roles->setUseValuesAsKeys(true);
404 $roles->setValue($allowed_roles);
405 $role_form->addItem($roles);
406
407 if ($this->checkAccessBool('write')) {
408 $role_form->addCommandButton("updateRoles", $this->lng->txt("save"));
409 }
410 $role_form->addCommandButton("view", $this->lng->txt("cancel"));
411 return $role_form;
412 }
static _lookupAllowRegister(int $a_role_id)
check whether role is allowed in user registration or not

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

Referenced by editRoles(), and updateRoles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listCodes()

ilRegistrationSettingsGUI::listCodes ( )

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

818 : void
819 {
820 $this->checkAccess('read');
821 $this->setSubTabs('registration_codes');
822 if ($this->checkAccessBool('write')) {
823 $this->toolbar->addButton(
824 $this->lng->txt('registration_codes_add'),
825 $this->ctrl->getLinkTarget($this, 'addCodes')
826 );
827 }
828 $this->tpl->setContent($this->ui_renderer->render([
829 $this->getRegistrationFilter()->getFilterComponent(),
830 $this->getRegistrationCodeTable()->getTableComponent($this->getRegistrationFilter())
831 ]));
832 }

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

Referenced by exportCodes().

+ 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 697 of file class.ilRegistrationSettingsGUI.php.

697 : string
698 {
699 $tpl = new ilTemplate('tpl.registration_roles.html', true, true, 'components/ILIAS/Registration');
700
701 $tpl->setVariable("EDIT", $this->lng->txt("edit"));
702 $tpl->setVariable("LINK_EDIT", $url);
703
704 if (is_array($roles) && count($roles)) {
705 foreach ($roles as $role) {
706 $tpl->setCurrentBlock("list_item");
707 $tpl->setVariable("LIST_ITEM_ITEM", $role);
709 }
710 } else {
711 $tpl->setVariable("NONE", $this->lng->txt('none'));
712 }
713 return $tpl->get();
714 }
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$url
Definition: shib_logout.php:70

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

Referenced by initForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareAccessLimitationRoleList()

ilRegistrationSettingsGUI::prepareAccessLimitationRoleList ( )
private

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

749 : array
750 {
752 $all = [];
753 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
754 switch ($this->access_limitations_obj->getMode((int) $role['id'])) {
755 case 'absolute':
756 $txt_access_value = $this->lng->txt('reg_access_limitation_limited_until');
757 $txt_access_value .= " " . ilDatePresentation::formatDate(
758 new ilDateTime($this->access_limitations_obj->getAbsolute((int) $role['id']), IL_CAL_UNIX)
759 );
760 break;
761
762 case 'relative':
763 $months = $this->access_limitations_obj->getRelative($role['id'], 'm');
764 $days = $this->access_limitations_obj->getRelative($role['id'], 'd');
765
766 $txt_access_value = $this->lng->txt('reg_access_limitation_limited_time') . " ";
767
768 if ($months) {
769 if ($days) {
770 $txt_access_value .= ", ";
771 } else {
772 $txt_access_value .= " " . $this->lng->txt('and') . " ";
773 }
774 } elseif ($days) {
775 $txt_access_value .= " " . $this->lng->txt('and') . " ";
776 }
777
778 if ($months) {
779 $txt_access_value .= $months . " ";
780 $txt_access_value .= ($months === 1) ? $this->lng->txt('month') : $this->lng->txt('months');
781
782 if ($days) {
783 $txt_access_value .= " " . $this->lng->txt('and') . " ";
784 }
785 }
786
787 if ($days) {
788 $txt_access_value .= $days . " ";
789 $txt_access_value .= ($days === 1) ? $this->lng->txt('day') : $this->lng->txt('days');
790 }
791 break;
792
793 default:
794 $txt_access_value = $this->lng->txt('reg_access_limitation_none');
795 break;
796 }
797
798 $all[] = $role['title'] . ' (' . $txt_access_value . ')';
799 }
800
801 return $all;
802 }
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,)

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

Referenced by initForm().

+ 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 732 of file class.ilRegistrationSettingsGUI.php.

732 : array
733 {
734 $this->initRoleAssignments();
735 $all = [];
736 foreach ($this->assignments_obj->getAssignments() as $assignment) {
737 if ($assignment['domain'] !== '' && $assignment['role']) {
738 $all[] = $assignment['domain'] . ' -> ' . ilObjRole::_lookupTitle((int) $assignment['role']);
739 }
740 }
741
742 if ((string) $this->assignments_obj->getDefaultRole() !== '') {
743 $all[] = $this->lng->txt('reg_default') . ' -> ' . ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
744 }
745
746 return $all;
747 }

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

Referenced by initForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleList()

ilRegistrationSettingsGUI::prepareRoleList ( )
private

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

719 : array
720 {
721 $all = [];
722 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
723 $all[] = $role['title'];
724 }
725
726 return $all;
727 }

References ilObjRole\_lookupRegisterAllowed().

Referenced by initForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilRegistrationSettingsGUI::save ( )

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

331 : bool
332 {
333 $this->checkAccess('write');
334
335 $form = $this->initForm();
336 $res = $form->checkInput();
337 $this->registration_settings->setRegistrationType((int) $form->getInput('reg_type'));
338 $this->registration_settings->setPasswordGenerationStatus((bool) $form->getInput('reg_pwd'));
339 $this->registration_settings->setApproveRecipientLogins($form->getInput('reg_approver'));
340 $this->registration_settings->setRoleType((int) $form->getInput('reg_role_type'));
341 $this->registration_settings->setAccessLimitation((bool) $form->getInput('reg_access_limitation'));
342 $this->registration_settings->setAllowedDomains((string) $form->getInput('reg_allowed_domains'));
343
344 $allow_codes = false;
345 $reg_type = (int) $form->getInput('reg_type');
346 if (in_array($reg_type, [
350 ], true)) {
351 $allow_codes = (bool) $form->getInput('reg_codes_' . $reg_type);
352 }
353 $this->registration_settings->setAllowCodes($allow_codes);
354
355 $hash_life_time = $form->getInput('reg_hash_life_time');
356 if (!preg_match('/^([0]|([1-9][0-9]*))([\.,][0-9]+)?$/', (string) $hash_life_time)) {
357 $this->registration_settings->setRegistrationHashLifetime(ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE);
358 } else {
359 $this->registration_settings->setRegistrationHashLifetime(max(
360 (int) $hash_life_time,
362 ));
363 }
364
365 if ($error_code = $this->registration_settings->validate()) {
366 switch ($error_code) {
368 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_unknown_recipients') . ' ' . $this->registration_settings->getUnknown());
369 $this->view();
370 return false;
371
373 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_approve_needs_recipient') . ' ' . $this->registration_settings->getUnknown());
374 $this->view();
375 return false;
376 }
377 }
378
379 $this->registration_settings->save();
380 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
381 $this->view();
382 return true;
383 }
$res
Definition: ltiservices.php:69

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().

+ Here is the call graph for this function:

◆ saveAssignment()

ilRegistrationSettingsGUI::saveAssignment ( )

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

572 : bool
573 {
574 $this->checkAccess('write');
575 $this->initRoleAssignments();
576 $form = $this->initEmailAssignmentForm();
577 $is_valid = $form->checkInput();
578 $form->setValuesByPost();
579 if (!$is_valid) {
580 $this->editEmailAssignments($form);
581 return false;
582 }
583
584 $assignments_by_domain = [];
585 $problems_domains_by_field_id = [];
586 foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
587 if ($role_id === ANONYMOUS_ROLE_ID) {
588 continue;
589 }
590
591 $role_assigned_input = $form->getInput("role_assigned_$role_id");
592 if (!$role_assigned_input) {
593 continue;
594 }
595
596 $domain_input = $form->getInput("domain_$role_id");
597 foreach ($domain_input as $domain) {
598 if (!is_string($domain) || $domain === '') {
599 continue;
600 }
601
602 if (isset($assignments_by_domain[$domain])) {
603 if (!isset($problems_domains_by_field_id["role_assigned_$role_id"])) {
604 $problems_domains_by_field_id["role_assigned_$role_id"] = [];
605 }
606
607 $problems_domains_by_field_id["domain_$role_id"][$domain] = $domain;
608 continue;
609 }
610
611 $assignments_by_domain[$domain] = $role_id;
612 }
613 }
614
615 if ($problems_domains_by_field_id !== []) {
616 foreach ($problems_domains_by_field_id as $field_id => $domains) {
617 $domain_string = implode(', ', $domains);
618 $alert = sprintf($this->lng->txt('reg_domain_already_assigned_p'), $domain_string);
619 if (count($domains) === 1) {
620 $alert = sprintf($this->lng->txt('reg_domain_already_assigned_s'), $domain_string);
621 }
622 $form->getItemByPostVar($field_id)->setAlert($alert);
623 }
624
625 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
626 $this->editEmailAssignments($form);
627 return false;
628 }
629
630 $this->assignments_obj->deleteAll();
631
632 $counter = 0;
633 foreach ($assignments_by_domain as $domain => $role_id) {
634 $this->assignments_obj->setDomain($counter, $domain);
635 $this->assignments_obj->setRole($counter, $role_id);
636 $counter++;
637 }
638 $default_role = $form->getInput("default_role");
639 $this->assignments_obj->setDefaultRole((int) $default_role);
640 $this->assignments_obj->save();
641 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
642 $this->view();
643 return true;
644 }
editEmailAssignments(?ilPropertyFormGUI $form=null)
$counter

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

+ Here is the call graph for this function:

◆ saveRoleAccessLimitations()

ilRegistrationSettingsGUI::saveRoleAccessLimitations ( )

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

646 : bool
647 {
648 $this->checkAccess('write');
650
651 $form = $this->initRoleAccessForm();
652 if (!$form->checkInput()) {
653 $form->setValuesByPost();
654 $this->editRoleAccessLimitations($form);
655 return false;
656 }
657
658 $this->access_limitations_obj->resetAccessLimitations();
659 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
660 $mode = $form->getInput('role_access_' . $role['id']);
661 $this->access_limitations_obj->setMode($mode, $role['id']);
662
663 if ($mode === 'absolute') {
664 $this->access_limitations_obj->setAbsolute($form->getInput('absolute_date_' . $role['id']), $role['id']);
665 }
666
667 if ($mode === 'relative') {
668 $this->access_limitations_obj->setRelative($form->getInput('duration_' . $role['id']), $role['id']);
669 }
670 }
671
672 if ($err = $this->access_limitations_obj->validate()) {
673 switch ($err) {
675 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_access_limitation_missing_mode'));
676 break;
677
679 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_access_limitation_out_of_date'));
680 break;
681 }
683 return false;
684 }
685
686 $this->access_limitations_obj->save();
687 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
688 $this->view();
689 return true;
690 }
editRoleAccessLimitations(?ilPropertyFormGUI $form=null)

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().

+ Here is the call graph for this function:

◆ setSubTabs()

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

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

144 : void
145 {
146 $this->tabs->addSubTab(
147 "registration_settings",
148 $this->lng->txt("registration_tab_settings"),
149 $this->ctrl->getLinkTarget($this, 'view')
150 );
151 $this->tabs->addSubTab(
152 "registration_codes",
153 $this->lng->txt("registration_tab_codes"),
154 $this->ctrl->getLinkTarget($this, 'listCodes')
155 );
156 $this->tabs->activateSubTab($activeTab);
157 }

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateRoles()

ilRegistrationSettingsGUI::updateRoles ( )

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

428 : bool
429 {
430 $this->checkAccess('write');
431 $form = $this->initRolesForm();
432 if ($form->checkInput()) {
433 $roles = (array) $form->getInput('roles');
434 if (count($roles) < 1) {
435 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_last_role_for_registration'));
436 $this->editRoles();
437 return false;
438 }
439 foreach ($this->rbacreview->getGlobalRoles() as $role) {
440 if ($role_obj = ilObjectFactory::getInstanceByObjId($role, false)) {
441 $role_obj->setAllowRegister(isset($roles[$role]) && (int) $roles[$role] === 1);
442 $role_obj->update();
443 }
444 }
445 }
446 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
447 $this->view();
448 return true;
449 }
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
editRoles(?ilPropertyFormGUI $form=null)

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

+ Here is the call graph for this function:

◆ view()

ilRegistrationSettingsGUI::view ( )

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

303 : void
304 {
305 $this->checkAccess('read');
306 $this->setSubTabs();
307
308 // edit new accout mail
309 $this->ctrl->setParameterByClass("ilobjuserfoldergui", "ref_id", USER_FOLDER_ID);
310 if ($this->checkAccessBool('write')) {
311 $this->toolbar->addButton(
312 $this->lng->txt('registration_user_new_account_mail'),
313 $this->ctrl->getLinkTargetByClass(
314 [
315 ilAdministrationGUI::class,
316 ilObjUserFolderGUI::class,
317 NewAccountMailSettingsGUI::class
318
319 ],
320 'show'
321 )
322 );
323 $this->ctrl->setParameterByClass(ilObjUserFolderGUI::class, 'ref_id', $_GET['ref_id']);
324 }
325
326 $form = $this->initForm();
327 $this->initFormValues($form);
328 $this->tpl->setContent($form->getHTML());
329 }
initFormValues(ilPropertyFormGUI $formGUI)
const USER_FOLDER_ID
Definition: constants.php:33
$_GET['cmd']
Definition: lti.php:26

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().

+ 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 50 of file class.ilRegistrationSettingsGUI.php.

◆ $access_limitations_obj

ilRegistrationRoleAccessLimitations ilRegistrationSettingsGUI::$access_limitations_obj = null
protected

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

◆ $assignments_obj

ilRegistrationRoleAssignments ilRegistrationSettingsGUI::$assignments_obj = null
protected

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

◆ $code_repository

readonly RegistrationCodeRepository ilRegistrationSettingsGUI::$code_repository
protected

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

◆ $ctrl

ilCtrlInterface ilRegistrationSettingsGUI::$ctrl
protected

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

◆ $error

ilErrorHandling ilRegistrationSettingsGUI::$error
protected

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

◆ $form_gui

ilPropertyFormGUI ilRegistrationSettingsGUI::$form_gui = null
protected

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

Referenced by initAddCodesForm(), and initForm().

◆ $http

readonly ILIAS HTTP Services ilRegistrationSettingsGUI::$http
protected

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

◆ $lng

ilLanguage ilRegistrationSettingsGUI::$lng
protected

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

◆ $rbacreview

ilRbacReview ilRegistrationSettingsGUI::$rbacreview
protected

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

◆ $rbacsystem

ilRbacSystem ilRegistrationSettingsGUI::$rbacsystem
protected

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

◆ $ref_id

int ilRegistrationSettingsGUI::$ref_id
Todo:
make private

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

◆ $refinery

readonly ILIAS Refinery Factory ilRegistrationSettingsGUI::$refinery
protected

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

◆ $registration_code_filter

readonly RegistrationFilterComponent ilRegistrationSettingsGUI::$registration_code_filter
protected

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

Referenced by getRegistrationFilter().

◆ $registration_codes_table

readonly RegistrationCodesTable ilRegistrationSettingsGUI::$registration_codes_table
protected

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

Referenced by getRegistrationCodeTable().

◆ $registration_settings

ilRegistrationSettings ilRegistrationSettingsGUI::$registration_settings
protected

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

◆ $tabs

ilTabsGUI ilRegistrationSettingsGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilRegistrationSettingsGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilRegistrationSettingsGUI::$tpl
protected

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

Referenced by parseRoleList().

◆ $ui_factory

readonly Factory ilRegistrationSettingsGUI::$ui_factory
protected

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

◆ $ui_renderer

readonly UIRenderer ilRegistrationSettingsGUI::$ui_renderer
protected

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

◆ $ui_service

readonly ilUIService ilRegistrationSettingsGUI::$ui_service
protected

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

◆ $user

readonly ilObjUser ilRegistrationSettingsGUI::$user
protected

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

◆ CODE_TYPE_EXTENSION

const ilRegistrationSettingsGUI::CODE_TYPE_EXTENSION = 2

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

◆ CODE_TYPE_REGISTRATION

const ilRegistrationSettingsGUI::CODE_TYPE_REGISTRATION = 1

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


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