ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 69 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(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

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

Member Function Documentation

◆ addCodes()

ilRegistrationSettingsGUI::addCodes ( )

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

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

958  : void
959  {
960  $this->checkAccess('write');
961  $this->setSubTabs('registration_codes');
962  $this->initAddCodesForm();
963 
964  // default
965  $limit = $this->form_gui->getItemByPostVar("reg_limit");
966  $limit->setValue("none");
967  $this->tpl->setContent($this->form_gui->getHTML());
968  }
setSubTabs(string $activeTab='registration_settings')
+ Here is the call graph for this function:

◆ checkAccess()

ilRegistrationSettingsGUI::checkAccess ( string  $a_permission)
protected

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

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

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

131  : void
132  {
133  if (!$this->checkAccessBool($a_permission)) {
134  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->WARNING);
135  }
136  }
+ 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 138 of file class.ilRegistrationSettingsGUI.php.

References ILIAS\Repository\access().

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

138  : bool
139  {
140  return $this->access->checkAccess($a_permission, '', $this->ref_id);
141  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createCodes()

ilRegistrationSettingsGUI::createCodes ( )

Definition at line 970 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().

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

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

1052  : void
1053  {
1054  $this->checkAccess("write");
1055 
1056  $ids = [];
1057  if ($this->http->wrapper()->post()->has('id')) {
1058  $ids = $this->http->wrapper()->post()->retrieve(
1059  'id',
1060  $this->refinery->kindlyTo()->listOf(
1061  $this->refinery->kindlyTo()->int()
1062  )
1063  );
1064  }
1065  $this->code_repository->deleteCodes($ids);
1066  $this->tpl->setOnScreenMessage('success', $this->lng->txt('info_deleted'), true);
1067  $this->ctrl->redirect($this, "listCodes");
1068  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ deleteConfirmation()

ilRegistrationSettingsGUI::deleteConfirmation ( )

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

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

1070  : void
1071  {
1072  $this->checkAccess('write');
1073  $codes = [];
1074  if ($this->http->wrapper()->query()->has('registration_codes_code_ids')) {
1075  $ids = $this->http->wrapper()->query()->retrieve(
1076  'registration_codes_code_ids',
1077  $this->refinery->kindlyTo()->listOf(
1078  $this->refinery->kindlyTo()->string()
1079  )
1080  );
1081  if ($ids === ['ALL_OBJECTS']) {
1082  $codes = $this->code_repository->getCodesByFilter($this->getRegistrationFilter()->getFilterData());
1083  } else {
1084  $ids = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform($ids);
1085  $codes = $this->code_repository->loadCodesByIds($ids);
1086  }
1087  }
1088  if (!count($codes)) {
1089  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_select_one'), true);
1090  $this->ctrl->redirect($this, 'listCodes');
1091  }
1092  $this->setSubTabs('registration_codes');
1093 
1094  $gui = new ilConfirmationGUI();
1095  $gui->setHeaderText($this->lng->txt('info_delete_sure'));
1096  $gui->setCancel($this->lng->txt('cancel'), 'listCodes');
1097  $gui->setConfirm($this->lng->txt('confirm'), 'deleteCodes');
1098  $gui->setFormAction($this->ctrl->getFormAction($this, 'deleteCodes'));
1099 
1100  foreach ($codes as $code) {
1101  $gui->addItem('id[]', (string) $code['code_id'], $code['code']);
1102  }
1103  $this->tpl->setContent($gui->getHTML());
1104  }
static http()
Fetches the global http state from ILIAS.
setSubTabs(string $activeTab='registration_settings')
+ Here is the call graph for this function:

◆ editEmailAssignments()

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

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

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

Referenced by saveAssignment().

440  : void
441  {
442  $this->checkAccess('write');
443  $this->tabs->clearTargets();
444  $this->tabs->setBackTarget(
445  $this->lng->txt("registration_settings"),
446  $this->ctrl->getLinkTarget($this, "view")
447  );
448 
449  $this->initRoleAssignments();
450  $form = $form ?? $this->initEmailAssignmentForm();
451  $this->tpl->setContent($form->getHTML());
452  }
+ 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 497 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by saveRoleAccessLimitations().

497  : void
498  {
499  global $DIC;
500 
501  $this->checkAccess('write');
502  $this->tabs->clearTargets();
503  $this->tabs->setBackTarget(
504  $this->lng->txt("registration_settings"),
505  $this->ctrl->getLinkTarget($this, "view")
506  );
507  $this->initRoleAccessLimitations();
508  if (null === $form) {
509  $form = $this->initRoleAccessForm();
510  }
511  $this->tpl->setContent($form->getHTML());
512  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
+ 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 403 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by updateRoles().

403  : void
404  {
405  $this->checkAccess('write');
406  $this->tabs->clearTargets();
407  $this->tabs->setBackTarget(
408  $this->lng->txt("registration_settings"),
409  $this->ctrl->getLinkTarget($this, "view")
410  );
411  if (!$form instanceof ilPropertyFormGUI) {
412  $form = $this->initRolesForm();
413  }
414  $this->tpl->setContent($form->getHTML());
415  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilRegistrationSettingsGUI::executeCommand ( )

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

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

109  : void
110  {
111  $next_class = $this->ctrl->getNextClass($this);
112  $cmd = $this->ctrl->getCmd();
113 
114  if ($this->http->wrapper()->query()->has('registration_codes_table_action')) {
115  $cmd = $this->http->wrapper()->query()->retrieve(
116  'registration_codes_table_action',
117  $this->refinery->kindlyTo()->string()
118  );
119  }
120 
121  switch ($next_class) {
122  default:
123  if (!$cmd) {
124  $cmd = 'view';
125  }
126  $this->$cmd();
127  break;
128  }
129  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ exportCodes()

ilRegistrationSettingsGUI::exportCodes ( )

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

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

1106  : void
1107  {
1108  $codes = [];
1109  if ($this->http->wrapper()->query()->has('registration_codes_code_ids')) {
1110  $ids = $this->http->wrapper()->query()->retrieve(
1111  'registration_codes_code_ids',
1112  $this->refinery->kindlyTo()->listOf(
1113  $this->refinery->kindlyTo()->string()
1114  )
1115  );
1116  if ($ids === ['ALL_OBJECTS']) {
1117  $codes = $this->code_repository->getCodesByFilter($this->getRegistrationFilter()->getFilterData());
1118  } else {
1119  $ids = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform($ids);
1120  $codes = $this->code_repository->loadCodesByIds($ids);
1121  }
1122 
1123  $codes = array_filter(array_map(
1124  static fn($code) => (string) ($code['code'] ?? ''),
1125  $codes
1126  ));
1127  }
1128 
1129  if (count($codes)) {
1131  implode("\r\n", $codes),
1132  'ilias_registration_codes_' . date('d-m-Y') . '.txt',
1133  'text/plain'
1134  );
1135  } else {
1136  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('registration_export_codes_no_data'));
1137  $this->listCodes();
1138  }
1139  }
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getLocalRoleAutoComplete()

ilRegistrationSettingsGUI::getLocalRoleAutoComplete ( )

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

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

950  : void
951  {
952  $q = $_REQUEST["term"];
954  echo $list;
955  exit;
956  }
static getList(string $a_str)
Get completion list.
exit
$q
Definition: shib_logout.php:23
+ Here is the call graph for this function:

◆ getRegistrationCodeTable()

ilRegistrationSettingsGUI::getRegistrationCodeTable ( )

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

References $code_repository, $lng, $rbacreview, $registration_codes_table, $ui_factory, $user, checkAccessBool(), ILIAS\Repository\ctrl(), and ILIAS\FileDelivery\http().

Referenced by listCodes().

824  {
825  if (!isset($this->registration_codes_table)) {
826  $this->registration_codes_table = new RegistrationCodesTable(
827  $this->http->request(),
828  $this->lng,
830  new DataFactory(),
832  $this->ctrl->getLinkTarget($this, 'listCodes', '', true),
833  $this->user,
835  $this->checkAccessBool('write'),
836  );
837  }
838 
840  }
readonly RegistrationCodeRepository $code_repository
readonly RegistrationCodesTable $registration_codes_table
static http()
Fetches the global http state from ILIAS.
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:
+ Here is the caller graph for this function:

◆ getRegistrationFilter()

ilRegistrationSettingsGUI::getRegistrationFilter ( )

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

References $code_repository, $lng, $rbacreview, $registration_code_filter, $ui_factory, $ui_service, and ILIAS\Repository\ctrl().

Referenced by deleteConfirmation(), exportCodes(), and listCodes().

843  {
844  if (!isset($this->registration_code_filter)) {
845  $this->registration_code_filter = new RegistrationFilterComponent(
846  $this->ctrl->getLinkTarget($this, 'listCodes', '', true),
849  $this->lng,
852  );
853  }
854 
856  }
readonly RegistrationCodeRepository $code_repository
readonly RegistrationFilterComponent $registration_code_filter
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAddCodesForm()

ilRegistrationSettingsGUI::initAddCodesForm ( )

Definition at line 858 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().

859  {
860  $this->form_gui = new ilPropertyFormGUI();
861  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'createCodes'));
862  $this->form_gui->setTitle($this->lng->txt('registration_codes_edit_header'));
863 
864  $count = new ilNumberInputGUI($this->lng->txt('registration_codes_number'), 'reg_codes_number');
865  $count->setSize(4);
866  $count->setMaxLength(4);
867  $count->setMinValue(1);
868  $count->setMaxValue(1000);
869  $count->setRequired(true);
870  $this->form_gui->addItem($count);
871 
872  // type
873  $code_type = new ilCheckboxGroupInputGUI($this->lng->txt('registration_codes_type'), 'code_type');
874  $code_type->setRequired(true);
875 
876  $code_type->addOption(
877  new ilCheckboxOption(
878  $this->lng->txt('registration_codes_type_reg'),
879  (string) self::CODE_TYPE_REGISTRATION,
880  $this->lng->txt('registration_codes_type_reg_info')
881  )
882  );
883  $code_type->addOption(
884  new ilCheckboxOption(
885  $this->lng->txt('registration_codes_type_ext'),
886  (string) self::CODE_TYPE_EXTENSION,
887  $this->lng->txt('registration_codes_type_ext_info')
888  )
889  );
890  $this->form_gui->addItem($code_type);
891 
892  $sec = new ilFormSectionHeaderGUI();
893  $sec->setTitle($this->lng->txt('registration_codes_roles_title'));
894  $this->form_gui->addItem($sec);
895 
896  $options = ["" => $this->lng->txt('registration_codes_no_assigned_role')];
897  foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
898  if (!in_array($role_id, [SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID], true)) {
899  $options[$role_id] = ilObject::_lookupTitle($role_id);
900  }
901  }
902  $roles = new ilSelectInputGUI($this->lng->txt("registration_codes_roles"), "reg_codes_role");
903  $roles->setInfo($this->lng->txt("registration_codes_override_info"));
904  $roles->setOptions($options);
905  $this->form_gui->addItem($roles);
906 
907  $local = new ilTextInputGUI($this->lng->txt("registration_codes_roles_local"), "reg_codes_local");
908  $local->setMulti(true);
909  $local->setDataSource($this->ctrl->getLinkTarget($this, "getLocalRoleAutoComplete", "", true));
910  $this->form_gui->addItem($local);
911 
912  $sec = new ilFormSectionHeaderGUI();
913  $sec->setTitle($this->lng->txt('reg_access_limitations'));
914  $this->form_gui->addItem($sec);
915 
916  $limit = new ilRadioGroupInputGUI($this->lng->txt("reg_access_limitation_mode"), "reg_limit");
917  $limit->setInfo($this->lng->txt("registration_codes_override_info"));
918  $this->form_gui->addItem($limit);
919 
920  $opt = new ilRadioOption($this->lng->txt("registration_codes_roles_limitation_none"), "none");
921  $limit->addOption($opt);
922 
923  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_none"), "unlimited");
924  $limit->addOption($opt);
925 
926  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_absolute"), "absolute");
927  $limit->addOption($opt);
928 
929  $dt = new ilDateTimeInputGUI($this->lng->txt("reg_access_limitation_mode_absolute_target"), "abs_date");
930  $dt->setRequired(true);
931  $opt->addSubItem($dt);
932 
933  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_relative"), "relative");
934  $limit->addOption($opt);
935 
936  $dur = new ilDurationInputGUI($this->lng->txt("reg_access_limitation_mode_relative_target"), "rel_date");
937  $dur->setRequired(true);
938  $dur->setShowMonths(true);
939  $dur->setShowDays(true);
940  $dur->setShowHours(false);
941  $dur->setShowMinutes(false);
942  $opt->addSubItem($dur);
943 
944  $this->form_gui->addCommandButton('createCodes', $this->lng->txt('create'));
945  $this->form_gui->addCommandButton('listCodes', $this->lng->txt('cancel'));
946  return $this->form_gui;
947  }
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 454 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().

455  {
456  $role_assignment_form = new ilPropertyFormGUI();
457  $role_assignment_form->setFormAction($this->ctrl->getFormAction($this));
458  $role_assignment_form->setTitle($this->lng->txt('reg_email_role_assignment'));
459 
460  $global_roles = ["" => $this->lng->txt("links_select_one")];
461  foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
462  if ($role_id === ANONYMOUS_ROLE_ID) {
463  continue;
464  }
465 
466  $global_roles[$role_id] = ilObjRole::_lookupTitle($role_id);
467  $role_assignments = new ilCheckboxInputGUI(ilObjRole::_lookupTitle($role_id), "role_assigned_$role_id");
468 
469  $domains = $this->assignments_obj->getDomainsByRole($role_id);
470 
471  $domain = new ilTextInputGUI($this->lng->txt('reg_domain'), "domain_$role_id");
472  $domain->setMulti(true);
473  $domain->setValidationRegexp("/^@.*\.[a-zA-Z]{1,4}$/");
474  if (!empty($domains)) {
475  $domain->setValue($domains[0]);
476  $domain->setMultiValues($domains);
477  $role_assignments->setChecked(true);
478  }
479 
480  $role_assignments->addSubItem($domain);
481  $role_assignment_form->addItem($role_assignments);
482  }
483 
484  $default_role = new ilSelectInputGUI($this->lng->txt('reg_default'));
485  $default_role->setPostVar("default_role");
486  $default_role->setOptions($global_roles);
487  $default_role->setValue($this->assignments_obj->getDefaultRole());
488  $default_role->setRequired(true);
489  $role_assignment_form->addItem($default_role);
490 
491  $role_assignment_form->addCommandButton("saveAssignment", $this->lng->txt("save"));
492  $role_assignment_form->addCommandButton("view", $this->lng->txt("cancel"));
493 
494  return $role_assignment_form;
495  }
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 158 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().

159  {
161  $form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
162  $form_gui->setTitle($this->lng->txt('reg_settings_header'));
163 
164  $reg_type = new ilRadioGroupInputGUI($this->lng->txt('reg_type'), 'reg_type');
165  $reg_type->addOption(new ilRadioOption(
166  $this->lng->txt('reg_disabled'),
168  ));
169  $option = new ilRadioOption($this->lng->txt('reg_direct'), (string) ilRegistrationSettings::IL_REG_DIRECT);
170  $option->setInfo($this->lng->txt('reg_direct_info'));
171  $cd = new ilCheckboxInputGUI(
172  $this->lng->txt('reg_allow_codes'),
174  );
175  $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
176  $option->addSubItem($cd);
177  $reg_type->addOption($option);
178  $option = new ilRadioOption($this->lng->txt('reg_approve'), (string) ilRegistrationSettings::IL_REG_APPROVE);
179  $option->setInfo($this->lng->txt('reg_approve_info'));
180  $cd = new ilCheckboxInputGUI(
181  $this->lng->txt('reg_allow_codes'),
183  );
184  $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
185  $option->addSubItem($cd);
186  $reg_type->addOption($option);
187  $option = new ilRadioOption(
188  $this->lng->txt('reg_type_confirmation'),
190  );
191  $option->setInfo($this->lng->txt('reg_type_confirmation_info'));
192  $lt = new ilNumberInputGUI($this->lng->txt('reg_confirmation_hash_life_time'), 'reg_hash_life_time');
193  $lt->setSize(6); // #8511
194  $lt->setMaxLength(6);
196  $lt->setRequired(true);
197  $lt->setInfo($this->lng->txt('reg_confirmation_hash_life_time_info'));
198  $lt->setSuffix($this->lng->txt('seconds'));
199  $option->addSubItem($lt);
200  $cd = new ilCheckboxInputGUI(
201  $this->lng->txt('reg_allow_codes'),
203  );
204  $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
205  $option->addSubItem($cd);
206  $reg_type->addOption($option);
207  $option = new ilRadioOption(
208  $this->lng->txt('registration_reg_type_codes'),
210  );
211  $option->setInfo($this->lng->txt('registration_reg_type_codes_info'));
212  $reg_type->addOption($option);
213  $form_gui->addItem($reg_type);
214 
215  $pwd_gen = new ilCheckboxInputGUI($this->lng->txt('passwd_generation'), 'reg_pwd');
216  $pwd_gen->setValue('1');
217  $pwd_gen->setInfo($this->lng->txt('reg_info_pwd'));
218  $form_gui->addItem($pwd_gen);
219 
220  $approver = new ilTextInputGUI($this->lng->txt('reg_notification'), 'reg_approver');
221  $approver->setSize(32);
222  $approver->setMaxLength(50);
223  $approver->setInfo($this->lng->txt('reg_notification_info'));
224  $form_gui->addItem($approver);
225 
226  $roles = new ilRadioGroupInputGUI($this->lng->txt('reg_role_assignment'), 'reg_role_type');
227  $option = new ilRadioOption($this->lng->txt('reg_fixed'), (string) ilRegistrationSettings::IL_REG_ROLES_FIXED);
228  $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
229  $edit = $this->ctrl->getLinkTarget($this, 'editRoles');
230  $list->setHtml($this->parseRoleList($this->prepareRoleList(), $edit));
231  $option->addSubItem($list);
232  $roles->addOption($option);
233  $option = new ilRadioOption($this->lng->txt('reg_email'), (string) ilRegistrationSettings::IL_REG_ROLES_EMAIL);
234  $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
235  $edit = $this->ctrl->getLinkTarget($this, 'editEmailAssignments');
236  $list->setHtml($this->parseRoleList($this->prepareAutomaticRoleList(), $edit));
237  $option->addSubItem($list);
238  $roles->addOption($option);
239  $roles->setInfo($this->lng->txt('registration_codes_override_global_info'));
240  $form_gui->addItem($roles);
241 
242  $limit = new ilCheckboxInputGUI($this->lng->txt('reg_access_limitations'), 'reg_access_limitation');
243  $limit->setValue('1');
244  $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
245  $edit = $this->ctrl->getLinkTarget($this, 'editRoleAccessLimitations');
246  $list->setHtml($this->parseRoleList($this->prepareAccessLimitationRoleList(), $edit));
247  $list->setInfo($this->lng->txt('registration_codes_override_global_info'));
248  $limit->addSubItem($list);
249  $form_gui->addItem($limit);
250 
251  $domains = new ilTextInputGUI($this->lng->txt('reg_allowed_domains'), 'reg_allowed_domains');
252  $domains->setInfo($this->lng->txt('reg_allowed_domains_info'));
253  $form_gui->addItem($domains);
254 
255  if ($this->rbacsystem->checkAccess("write", $this->ref_id)) {
256  $form_gui->addCommandButton('save', $this->lng->txt('save'));
257  }
258  return $form_gui;
259  }
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 261 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().

261  : void
262  {
264  if ($this->registration_settings->roleSelectionEnabled()) {
266  } elseif ($this->registration_settings->automaticRoleAssignmentEnabled()) {
268  }
269 
271  $values = [
272  'reg_type' => $this->registration_settings->getRegistrationType(),
273  'reg_hash_life_time' => $this->registration_settings->getRegistrationHashLifetime(),
274  'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
275  'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
276  'reg_role_type' => $role_type,
277  'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
278  'reg_allowed_domains' => implode(';', $this->registration_settings->getAllowedDomains())
279  ];
280 
281  $allow_codes = $this->registration_settings->getAllowCodes();
282  $reg_type = $this->registration_settings->getRegistrationType();
283  if ($allow_codes && in_array($reg_type, [
287  ], true)) {
288  $values['reg_codes_' . $reg_type] = true;
289  }
290 
291  $formGUI->setValuesByArray($values);
292  }
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 98 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by __construct().

98  : int
99  {
100  if ($this->http->wrapper()->query()->has('ref_id')) {
101  return $this->http->wrapper()->query()->retrieve(
102  'ref_id',
103  $this->refinery->kindlyTo()->int()
104  );
105  }
106  return 0;
107  }
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 514 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().

515  {
516  $form = new ilPropertyFormGUI();
517  $form->setFormAction($this->ctrl->getFormAction($this));
518  $form->setTitle($this->lng->txt('reg_role_access_limitations'));
519  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
520  $role_access = new ilRadioGroupInputGUI($role['title'], "role_access_" . $role['id']);
521 
522  $op_unlimited = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_unlimited'), "unlimited");
523 
524  $op_absolute = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_absolute'), "absolute");
525  $absolute_date = new ilDateTime(
526  date("d.m.Y", $this->access_limitations_obj->getAbsolute($role['id'])),
528  );
529  $date = new ilDateTimeInputGUI("", "absolute_date_" . $role['id']);
530  $date->setDate($absolute_date);
531  $op_absolute->addSubItem($date);
532 
533  $op_relative = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_relative'), "relative");
534  $duration = new ilDurationInputGUI("", "duration_" . $role['id']);
535  $duration->setShowMinutes(false);
536  $duration->setShowHours(false);
537  $duration->setShowDays(true);
538  $duration->setShowMonths(true);
539  $duration->setDays($this->access_limitations_obj->getRelative($role['id'], 'd'));
540  $duration->setMonths($this->access_limitations_obj->getRelative($role['id'], 'm'));
541  $op_relative->addSubItem($duration);
542 
543  $role_access->addOption($op_unlimited);
544  $role_access->addOption($op_absolute);
545  $role_access->addOption($op_relative);
546  $role_access->setValue(
547  $this->access_limitations_obj->getMode(
548  $role['id']
549  ) === 'null' ? 'unlimited' : $this->access_limitations_obj->getMode($role['id'])
550  );
551 
552  $form->addItem($role_access);
553  }
554 
555  $form->addCommandButton("saveRoleAccessLimitations", $this->lng->txt("save"));
556  $form->addCommandButton("view", $this->lng->txt("cancel"));
557 
558  return $form;
559  }
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 800 of file class.ilRegistrationSettingsGUI.php.

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

800  : void
801  {
802  if (!$this->access_limitations_obj instanceof ilRegistrationRoleAccessLimitations) {
803  $this->access_limitations_obj = new ilRegistrationRoleAccessLimitations();
804  }
805  }
Class class.ilRegistrationAccessLimitation.
+ Here is the caller graph for this function:

◆ initRoleAssignments()

ilRegistrationSettingsGUI::initRoleAssignments ( )
private

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

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

793  : void
794  {
795  if (!$this->assignments_obj instanceof ilRegistrationRoleAssignments) {
796  $this->assignments_obj = new ilRegistrationRoleAssignments();
797  }
798  }
Class class.ilregistrationEmailRoleAssignments.
+ Here is the caller graph for this function:

◆ initRolesForm()

ilRegistrationSettingsGUI::initRolesForm ( )
protected

Definition at line 374 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().

375  {
376  $role_form = new ilPropertyFormGUI();
377  $role_form->setFormAction($this->ctrl->getFormAction($this, 'save'));
378  $role_form->setTitle($this->lng->txt('reg_selectable_roles'));
379 
380  $roles = new ilCheckboxGroupInputGUI($this->lng->txt('reg_available_roles'), 'roles');
381  $allowed_roles = [];
382  foreach ($this->rbacreview->getGlobalRoles() as $role) {
383  if ($role === SYSTEM_ROLE_ID || $role === ANONYMOUS_ROLE_ID) {
384  continue;
385  }
386  $role_option = new ilCheckboxOption(ilObjRole::_lookupTitle($role));
387  $role_option->setValue((string) $role);
388  $roles->addOption($role_option);
389  $allowed_roles[$role] = ilObjRole::_lookupAllowRegister($role);
390  }
391 
392  $roles->setUseValuesAsKeys(true);
393  $roles->setValue($allowed_roles);
394  $role_form->addItem($roles);
395 
396  if ($this->checkAccessBool('write')) {
397  $role_form->addCommandButton("updateRoles", $this->lng->txt("save"));
398  }
399  $role_form->addCommandButton("view", $this->lng->txt("cancel"));
400  return $role_form;
401  }
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 807 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by exportCodes().

807  : void
808  {
809  $this->checkAccess('visible,read');
810  $this->setSubTabs('registration_codes');
811  if ($this->checkAccessBool('write')) {
812  $this->toolbar->addButton(
813  $this->lng->txt('registration_codes_add'),
814  $this->ctrl->getLinkTarget($this, 'addCodes')
815  );
816  }
817  $this->tpl->setContent($this->ui_renderer->render([
818  $this->getRegistrationFilter()->getFilterComponent(),
819  $this->getRegistrationCodeTable()->getTableComponent($this->getRegistrationFilter())
820  ]));
821  }
setSubTabs(string $activeTab='registration_settings')
+ 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 686 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().

686  : string
687  {
688  $tpl = new ilTemplate('tpl.registration_roles.html', true, true, 'components/ILIAS/Registration');
689 
690  $tpl->setVariable("EDIT", $this->lng->txt("edit"));
691  $tpl->setVariable("LINK_EDIT", $url);
692 
693  if (is_array($roles) && count($roles)) {
694  foreach ($roles as $role) {
695  $tpl->setCurrentBlock("list_item");
696  $tpl->setVariable("LIST_ITEM_ITEM", $role);
698  }
699  } else {
700  $tpl->setVariable("NONE", $this->lng->txt('none'));
701  }
702  return $tpl->get();
703  }
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:68
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 738 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by initForm().

738  : array
739  {
740  $this->initRoleAccessLimitations();
741  $all = [];
742  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
743  switch ($this->access_limitations_obj->getMode((int) $role['id'])) {
744  case 'absolute':
745  $txt_access_value = $this->lng->txt('reg_access_limitation_limited_until');
746  $txt_access_value .= " " . ilDatePresentation::formatDate(
747  new ilDateTime($this->access_limitations_obj->getAbsolute((int) $role['id']), IL_CAL_UNIX)
748  );
749  break;
750 
751  case 'relative':
752  $months = $this->access_limitations_obj->getRelative($role['id'], 'm');
753  $days = $this->access_limitations_obj->getRelative($role['id'], 'd');
754 
755  $txt_access_value = $this->lng->txt('reg_access_limitation_limited_time') . " ";
756 
757  if ($months) {
758  if ($days) {
759  $txt_access_value .= ", ";
760  } else {
761  $txt_access_value .= " " . $this->lng->txt('and') . " ";
762  }
763  } elseif ($days) {
764  $txt_access_value .= " " . $this->lng->txt('and') . " ";
765  }
766 
767  if ($months) {
768  $txt_access_value .= $months . " ";
769  $txt_access_value .= ($months === 1) ? $this->lng->txt('month') : $this->lng->txt('months');
770 
771  if ($days) {
772  $txt_access_value .= " " . $this->lng->txt('and') . " ";
773  }
774  }
775 
776  if ($days) {
777  $txt_access_value .= $days . " ";
778  $txt_access_value .= ($days === 1) ? $this->lng->txt('day') : $this->lng->txt('days');
779  }
780  break;
781 
782  default:
783  $txt_access_value = $this->lng->txt('reg_access_limitation_none');
784  break;
785  }
786 
787  $all[] = $role['title'] . ' (' . $txt_access_value . ')';
788  }
789 
790  return $all;
791  }
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 721 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by initForm().

721  : array
722  {
723  $this->initRoleAssignments();
724  $all = [];
725  foreach ($this->assignments_obj->getAssignments() as $assignment) {
726  if ($assignment['domain'] !== '' && $assignment['role']) {
727  $all[] = $assignment['domain'] . ' -> ' . ilObjRole::_lookupTitle((int) $assignment['role']);
728  }
729  }
730 
731  if ((string) $this->assignments_obj->getDefaultRole() !== '') {
732  $all[] = $this->lng->txt('reg_default') . ' -> ' . ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
733  }
734 
735  return $all;
736  }
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 708 of file class.ilRegistrationSettingsGUI.php.

References ilObjRole\_lookupRegisterAllowed().

Referenced by initForm().

708  : array
709  {
710  $all = [];
711  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
712  $all[] = $role['title'];
713  }
714 
715  return $all;
716  }
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:

◆ save()

ilRegistrationSettingsGUI::save ( )

Definition at line 320 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().

320  : bool
321  {
322  $this->checkAccess('write');
323 
324  $form = $this->initForm();
325  $res = $form->checkInput();
326  $this->registration_settings->setRegistrationType((int) $form->getInput('reg_type'));
327  $this->registration_settings->setPasswordGenerationStatus((bool) $form->getInput('reg_pwd'));
328  $this->registration_settings->setApproveRecipientLogins($form->getInput('reg_approver'));
329  $this->registration_settings->setRoleType((int) $form->getInput('reg_role_type'));
330  $this->registration_settings->setAccessLimitation((bool) $form->getInput('reg_access_limitation'));
331  $this->registration_settings->setAllowedDomains((string) $form->getInput('reg_allowed_domains'));
332 
333  $allow_codes = false;
334  $reg_type = (int) $form->getInput('reg_type');
335  if (in_array($reg_type, [
339  ], true)) {
340  $allow_codes = (bool) $form->getInput('reg_codes_' . $reg_type);
341  }
342  $this->registration_settings->setAllowCodes($allow_codes);
343 
344  $hash_life_time = $form->getInput('reg_hash_life_time');
345  if (!preg_match('/^([0]|([1-9][0-9]*))([\.,][0-9]+)?$/', (string) $hash_life_time)) {
346  $this->registration_settings->setRegistrationHashLifetime(ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE);
347  } else {
348  $this->registration_settings->setRegistrationHashLifetime(max(
349  (int) $hash_life_time,
351  ));
352  }
353 
354  if ($error_code = $this->registration_settings->validate()) {
355  switch ($error_code) {
357  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_unknown_recipients') . ' ' . $this->registration_settings->getUnknown());
358  $this->view();
359  return false;
360 
362  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_approve_needs_recipient') . ' ' . $this->registration_settings->getUnknown());
363  $this->view();
364  return false;
365  }
366  }
367 
368  $this->registration_settings->save();
369  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
370  $this->view();
371  return true;
372  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ saveAssignment()

ilRegistrationSettingsGUI::saveAssignment ( )

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

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

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

635  : bool
636  {
637  $this->checkAccess('write');
638  $this->initRoleAccessLimitations();
639 
640  $form = $this->initRoleAccessForm();
641  if (!$form->checkInput()) {
642  $form->setValuesByPost();
643  $this->editRoleAccessLimitations($form);
644  return false;
645  }
646 
647  $this->access_limitations_obj->resetAccessLimitations();
648  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
649  $mode = $form->getInput('role_access_' . $role['id']);
650  $this->access_limitations_obj->setMode($mode, $role['id']);
651 
652  if ($mode === 'absolute') {
653  $this->access_limitations_obj->setAbsolute($form->getInput('absolute_date_' . $role['id']), $role['id']);
654  }
655 
656  if ($mode === 'relative') {
657  $this->access_limitations_obj->setRelative($form->getInput('duration_' . $role['id']), $role['id']);
658  }
659  }
660 
661  if ($err = $this->access_limitations_obj->validate()) {
662  switch ($err) {
664  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_access_limitation_missing_mode'));
665  break;
666 
668  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('reg_access_limitation_out_of_date'));
669  break;
670  }
671  $this->editRoleAccessLimitations();
672  return false;
673  }
674 
675  $this->access_limitations_obj->save();
676  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
677  $this->view();
678  return true;
679  }
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 143 of file class.ilRegistrationSettingsGUI.php.

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

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

143  : void
144  {
145  $this->tabs->addSubTab(
146  "registration_settings",
147  $this->lng->txt("registration_tab_settings"),
148  $this->ctrl->getLinkTarget($this, 'view')
149  );
150  $this->tabs->addSubTab(
151  "registration_codes",
152  $this->lng->txt("registration_tab_codes"),
153  $this->ctrl->getLinkTarget($this, 'listCodes')
154  );
155  $this->tabs->activateSubTab($activeTab);
156  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateRoles()

ilRegistrationSettingsGUI::updateRoles ( )

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

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

417  : bool
418  {
419  $this->checkAccess('write');
420  $form = $this->initRolesForm();
421  if ($form->checkInput()) {
422  $roles = (array) $form->getInput('roles');
423  if (count($roles) < 1) {
424  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_last_role_for_registration'));
425  $this->editRoles();
426  return false;
427  }
428  foreach ($this->rbacreview->getGlobalRoles() as $role) {
429  if ($role_obj = ilObjectFactory::getInstanceByObjId($role, false)) {
430  $role_obj->setAllowRegister(isset($roles[$role]) && (int) $roles[$role] === 1);
431  $role_obj->update();
432  }
433  }
434  }
435  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'));
436  $this->view();
437  return true;
438  }
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 294 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().

294  : void
295  {
296  $this->checkAccess('visible,read');
297  $this->setSubTabs();
298 
299  // edit new accout mail
300  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "ref_id", USER_FOLDER_ID);
301  if ($this->checkAccessBool('write')) {
302  $this->toolbar->addButton(
303  $this->lng->txt('registration_user_new_account_mail'),
304  $this->ctrl->getLinkTargetByClass(
305  [
306  ilAdministrationGUI::class,
307  ilObjUserFolderGUI::class
308  ],
309  'newAccountMail'
310  )
311  );
312  $this->ctrl->setParameterByClass(ilObjUserFolderGUI::class, 'ref_id', $_GET['ref_id']);
313  }
314 
315  $form = $this->initForm();
316  $this->initFormValues($form);
317  $this->tpl->setContent($form->getHTML());
318  }
$_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 49 of file class.ilRegistrationSettingsGUI.php.

◆ $access_limitations_obj

ilRegistrationRoleAccessLimitations ilRegistrationSettingsGUI::$access_limitations_obj = null
protected

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

◆ $assignments_obj

ilRegistrationRoleAssignments ilRegistrationSettingsGUI::$assignments_obj = null
protected

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

◆ $code_repository

readonly RegistrationCodeRepository ilRegistrationSettingsGUI::$code_repository
protected

◆ $ctrl

ilCtrlInterface ilRegistrationSettingsGUI::$ctrl
protected

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

◆ $error

ilErrorHandling ilRegistrationSettingsGUI::$error
protected

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

◆ $form_gui

ilPropertyFormGUI ilRegistrationSettingsGUI::$form_gui = null
protected

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

Referenced by initAddCodesForm(), and initForm().

◆ $http

readonly ILIAS HTTP Services ilRegistrationSettingsGUI::$http
protected

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

◆ $lng

ilLanguage ilRegistrationSettingsGUI::$lng
protected

◆ $rbacreview

ilRbacReview ilRegistrationSettingsGUI::$rbacreview
protected

◆ $rbacsystem

ilRbacSystem ilRegistrationSettingsGUI::$rbacsystem
protected

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

◆ $ref_id

int ilRegistrationSettingsGUI::$ref_id
Todo:
make private

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

◆ $refinery

readonly ILIAS Refinery Factory ilRegistrationSettingsGUI::$refinery
protected

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

◆ $registration_code_filter

readonly RegistrationFilterComponent ilRegistrationSettingsGUI::$registration_code_filter
protected

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

Referenced by getRegistrationFilter().

◆ $registration_codes_table

readonly RegistrationCodesTable ilRegistrationSettingsGUI::$registration_codes_table
protected

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

Referenced by getRegistrationCodeTable().

◆ $registration_settings

ilRegistrationSettings ilRegistrationSettingsGUI::$registration_settings
protected

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

◆ $tabs

ilTabsGUI ilRegistrationSettingsGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilRegistrationSettingsGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilRegistrationSettingsGUI::$tpl
protected

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

◆ $ui_factory

readonly Factory ilRegistrationSettingsGUI::$ui_factory
protected

◆ $ui_renderer

readonly UIRenderer ilRegistrationSettingsGUI::$ui_renderer
protected

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

◆ $ui_service

readonly ilUIService ilRegistrationSettingsGUI::$ui_service
protected

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

Referenced by getRegistrationFilter().

◆ $user

readonly ilObjUser ilRegistrationSettingsGUI::$user
protected

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

Referenced by getRegistrationCodeTable().

◆ CODE_TYPE_EXTENSION

const ilRegistrationSettingsGUI::CODE_TYPE_EXTENSION = 2

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

◆ CODE_TYPE_REGISTRATION

const ilRegistrationSettingsGUI::CODE_TYPE_REGISTRATION = 1

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


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