ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilRegistrationSettingsGUI Class Reference

Class ilRegistrationSettingsGUI. More...

+ Collaboration diagram for ilRegistrationSettingsGUI:

Public Member Functions

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

Data Fields

const CODE_TYPE_REGISTRATION = 1
 
const CODE_TYPE_EXTENSION = 2
 
int $ref_id
 

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRegistrationSettingsGUI::__construct ( )

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

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

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

Member Function Documentation

◆ addCodes()

ilRegistrationSettingsGUI::addCodes ( )

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

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

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

◆ applyCodesFilter()

ilRegistrationSettingsGUI::applyCodesFilter ( )

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

References listCodes().

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

◆ checkAccess()

ilRegistrationSettingsGUI::checkAccess ( string  $a_permission)
protected

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

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

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

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

◆ checkAccessBool()

ilRegistrationSettingsGUI::checkAccessBool ( string  $a_permission)
protected

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

References ILIAS\Repository\access().

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

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

◆ createCodes()

ilRegistrationSettingsGUI::createCodes ( )

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

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

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

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

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

◆ deleteConfirmation()

ilRegistrationSettingsGUI::deleteConfirmation ( )

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

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

1008  : void
1009  {
1010  $this->checkAccess("write");
1011 
1012  global $DIC;
1013 
1014  $ilErr = $DIC['ilErr'];
1015  $ids = [];
1016  if ($this->http->wrapper()->post()->has('id')) {
1017  $ids = $this->http->wrapper()->post()->retrieve(
1018  'id',
1019  $this->refinery->kindlyTo()->listOf(
1020  $this->refinery->kindlyTo()->int()
1021  )
1022  );
1023  }
1024  if (!count($ids)) {
1025  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_select_one'), true);
1026  $this->ctrl->redirect($this, 'listCodes');
1027  }
1028  $this->setSubTabs('registration_codes');
1029 
1030  $gui = new ilConfirmationGUI();
1031  $gui->setHeaderText($this->lng->txt("info_delete_sure"));
1032  $gui->setCancel($this->lng->txt("cancel"), "listCodes");
1033  $gui->setConfirm($this->lng->txt("confirm"), "deleteCodes");
1034  $gui->setFormAction($this->ctrl->getFormAction($this, "deleteCodes"));
1035 
1037  foreach ($data as $code) {
1038  $gui->addItem("id[]", $code["code_id"], $code["code"]);
1039  }
1040  $this->tpl->setContent($gui->getHTML());
1041  }
$ilErr
Definition: raiseError.php:17
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
static loadCodesByIds(array $ids)
setSubTabs(string $activeTab='registration_settings')
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:

◆ editEmailAssignments()

ilRegistrationSettingsGUI::editEmailAssignments ( ilPropertyFormGUI  $form = null)

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

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

Referenced by saveAssignment().

415  : void
416  {
417  $this->checkAccess('write');
418  $this->tabs->clearTargets();
419  $this->tabs->setBackTarget(
420  $this->lng->txt("registration_settings"),
421  $this->ctrl->getLinkTarget($this, "view")
422  );
423 
424  $this->initRoleAssignments();
425  $form = $form ?? $this->initEmailAssignmentForm();
426  $this->tpl->setContent($form->getHTML());
427  }
+ 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 472 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by saveRoleAccessLimitations().

472  : void
473  {
474  global $DIC;
475 
476  $this->checkAccess('write');
477  $this->tabs->clearTargets();
478  $this->tabs->setBackTarget(
479  $this->lng->txt("registration_settings"),
480  $this->ctrl->getLinkTarget($this, "view")
481  );
482  $this->initRoleAccessLimitations();
483  if (null === $form) {
484  $form = $this->initRoleAccessForm();
485  }
486  $this->tpl->setContent($form->getHTML());
487  }
global $DIC
Definition: feed.php:28
+ 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 378 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by updateRoles().

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

◆ executeCommand()

ilRegistrationSettingsGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

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

◆ exportCodes()

ilRegistrationSettingsGUI::exportCodes ( )

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

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

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

◆ getLocalRoleAutoComplete()

ilRegistrationSettingsGUI::getLocalRoleAutoComplete ( )

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

References exit, and ilRoleAutoComplete\getList().

888  : void
889  {
890  $q = $_REQUEST["term"];
891  $list = ilRoleAutoComplete::getList($q);
892  echo $list;
893  exit;
894  }
exit
Definition: login.php:28
static getList(string $a_str)
Get completion list.
+ Here is the call graph for this function:

◆ initAddCodesForm()

ilRegistrationSettingsGUI::initAddCodesForm ( )

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

797  {
798  $this->form_gui = new ilPropertyFormGUI();
799  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'createCodes'));
800  $this->form_gui->setTitle($this->lng->txt('registration_codes_edit_header'));
801 
802  $count = new ilNumberInputGUI($this->lng->txt('registration_codes_number'), 'reg_codes_number');
803  $count->setSize(4);
804  $count->setMaxLength(4);
805  $count->setMinValue(1);
806  $count->setMaxValue(1000);
807  $count->setRequired(true);
808  $this->form_gui->addItem($count);
809 
810  // type
811  $code_type = new ilCheckboxGroupInputGUI($this->lng->txt('registration_codes_type'), 'code_type');
812  $code_type->setRequired(true);
813 
814  $code_type->addOption(
815  new ilCheckboxOption(
816  $this->lng->txt('registration_codes_type_reg'),
817  (string) self::CODE_TYPE_REGISTRATION,
818  $this->lng->txt('registration_codes_type_reg_info')
819  )
820  );
821  $code_type->addOption(
822  new ilCheckboxOption(
823  $this->lng->txt('registration_codes_type_ext'),
824  (string) self::CODE_TYPE_EXTENSION,
825  $this->lng->txt('registration_codes_type_ext_info')
826  )
827  );
828  $this->form_gui->addItem($code_type);
829 
830  $sec = new ilFormSectionHeaderGUI();
831  $sec->setTitle($this->lng->txt('registration_codes_roles_title'));
832  $this->form_gui->addItem($sec);
833 
834  $options = ["" => $this->lng->txt('registration_codes_no_assigned_role')];
835  foreach ($this->rbacreview->getGlobalRoles() as $role_id) {
836  if (!in_array($role_id, [SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID], true)) {
837  $options[$role_id] = ilObject::_lookupTitle($role_id);
838  }
839  }
840  $roles = new ilSelectInputGUI($this->lng->txt("registration_codes_roles"), "reg_codes_role");
841  $roles->setInfo($this->lng->txt("registration_codes_override_info"));
842  $roles->setOptions($options);
843  $this->form_gui->addItem($roles);
844 
845  $local = new ilTextInputGUI($this->lng->txt("registration_codes_roles_local"), "reg_codes_local");
846  $local->setMulti(true);
847  $local->setDataSource($this->ctrl->getLinkTarget($this, "getLocalRoleAutoComplete", "", true));
848  $this->form_gui->addItem($local);
849 
850  $sec = new ilFormSectionHeaderGUI();
851  $sec->setTitle($this->lng->txt('reg_access_limitations'));
852  $this->form_gui->addItem($sec);
853 
854  $limit = new ilRadioGroupInputGUI($this->lng->txt("reg_access_limitation_mode"), "reg_limit");
855  $limit->setInfo($this->lng->txt("registration_codes_override_info"));
856  $this->form_gui->addItem($limit);
857 
858  $opt = new ilRadioOption($this->lng->txt("registration_codes_roles_limitation_none"), "none");
859  $limit->addOption($opt);
860 
861  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_none"), "unlimited");
862  $limit->addOption($opt);
863 
864  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_absolute"), "absolute");
865  $limit->addOption($opt);
866 
867  $dt = new ilDateTimeInputGUI($this->lng->txt("reg_access_limitation_mode_absolute_target"), "abs_date");
868  $dt->setRequired(true);
869  $opt->addSubItem($dt);
870 
871  $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_relative"), "relative");
872  $limit->addOption($opt);
873 
874  $dur = new ilDurationInputGUI($this->lng->txt("reg_access_limitation_mode_relative_target"), "rel_date");
875  $dur->setRequired(true);
876  $dur->setShowMonths(true);
877  $dur->setShowDays(true);
878  $dur->setShowHours(false);
879  $dur->setShowMinutes(false);
880  $opt->addSubItem($dur);
881 
882  $this->form_gui->addCommandButton('createCodes', $this->lng->txt('create'));
883  $this->form_gui->addCommandButton('listCodes', $this->lng->txt('cancel'));
884  return $this->form_gui;
885  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SYSTEM_ROLE_ID
Definition: constants.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 429 of file class.ilRegistrationSettingsGUI.php.

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

Referenced by editEmailAssignments(), and saveAssignment().

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

◆ initForm()

ilRegistrationSettingsGUI::initForm ( )

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

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

Referenced by save(), and view().

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

◆ initFormValues()

ilRegistrationSettingsGUI::initFormValues ( ilPropertyFormGUI  $formGUI)

PhpUndefinedMethodInspection

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

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

Referenced by view().

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

◆ initRefIdFromQuery()

ilRegistrationSettingsGUI::initRefIdFromQuery ( )
protected

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

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

Referenced by __construct().

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

◆ initRoleAccessForm()

ilRegistrationSettingsGUI::initRoleAccessForm ( )

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

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

Referenced by editRoleAccessLimitations(), and saveRoleAccessLimitations().

490  {
491  $form = new ilPropertyFormGUI();
492  $form->setFormAction($this->ctrl->getFormAction($this));
493  $form->setTitle($this->lng->txt('reg_role_access_limitations'));
494  foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
495  $role_access = new ilRadioGroupInputGUI($role['title'], "role_access_" . $role['id']);
496 
497  $op_unlimited = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_unlimited'), "unlimited");
498 
499  $op_absolute = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_absolute'), "absolute");
500  $absolute_date = new ilDateTime(
501  date("d.m.Y", $this->access_limitations_obj->getAbsolute($role['id'])),
503  );
504  $date = new ilDateTimeInputGUI("", "absolute_date_" . $role['id']);
505  $date->setDate($absolute_date);
506  $op_absolute->addSubItem($date);
507 
508  $op_relative = new ilRadioOption($this->lng->txt('reg_access_limitation_mode_relative'), "relative");
509  $duration = new ilDurationInputGUI("", "duration_" . $role['id']);
510  $duration->setShowMinutes(false);
511  $duration->setShowHours(false);
512  $duration->setShowDays(true);
513  $duration->setShowMonths(true);
514  $duration->setDays($this->access_limitations_obj->getRelative($role['id'], 'd'));
515  $duration->setMonths($this->access_limitations_obj->getRelative($role['id'], 'm'));
516  $op_relative->addSubItem($duration);
517 
518  $role_access->addOption($op_unlimited);
519  $role_access->addOption($op_absolute);
520  $role_access->addOption($op_relative);
521  $role_access->setValue(
522  $this->access_limitations_obj->getMode(
523  $role['id']
524  ) === 'null' ? 'unlimited' : $this->access_limitations_obj->getMode($role['id'])
525  );
526 
527  $form->addItem($role_access);
528  }
529 
530  $form->addCommandButton("saveRoleAccessLimitations", $this->lng->txt("save"));
531  $form->addCommandButton("view", $this->lng->txt("cancel"));
532 
533  return $form;
534  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupRegisterAllowed()
get all roles that are activated in user registration
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 775 of file class.ilRegistrationSettingsGUI.php.

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

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

◆ initRoleAssignments()

ilRegistrationSettingsGUI::initRoleAssignments ( )
private

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

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

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

◆ initRolesForm()

ilRegistrationSettingsGUI::initRolesForm ( )
protected

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

350  {
351  $role_form = new ilPropertyFormGUI();
352  $role_form->setFormAction($this->ctrl->getFormAction($this, 'save'));
353  $role_form->setTitle($this->lng->txt('reg_selectable_roles'));
354 
355  $roles = new ilCheckboxGroupInputGUI($this->lng->txt('reg_available_roles'), 'roles');
356  $allowed_roles = [];
357  foreach ($this->rbacreview->getGlobalRoles() as $role) {
358  if ($role === SYSTEM_ROLE_ID || $role === ANONYMOUS_ROLE_ID) {
359  continue;
360  }
361  $role_option = new ilCheckboxOption(ilObjRole::_lookupTitle($role));
362  $role_option->setValue((string) $role);
363  $roles->addOption($role_option);
364  $allowed_roles[$role] = ilObjRole::_lookupAllowRegister($role);
365  }
366 
367  $roles->setUseValuesAsKeys(true);
368  $roles->setValue($allowed_roles);
369  $role_form->addItem($roles);
370 
371  if ($this->checkAccessBool('write')) {
372  $role_form->addCommandButton("updateRoles", $this->lng->txt("save"));
373  }
374  $role_form->addCommandButton("view", $this->lng->txt("cancel"));
375  return $role_form;
376  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SYSTEM_ROLE_ID
Definition: constants.php:29
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 782 of file class.ilRegistrationSettingsGUI.php.

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

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

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

◆ parseRoleList()

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

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

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

Referenced by initForm().

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

◆ prepareAccessLimitationRoleList()

ilRegistrationSettingsGUI::prepareAccessLimitationRoleList ( )
private

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

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

Referenced by initForm().

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

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

Referenced by initForm().

696  : array
697  {
698  $this->initRoleAssignments();
699  $all = [];
700  foreach ($this->assignments_obj->getAssignments() as $assignment) {
701  if ($assignment['domain'] !== '' && $assignment['role']) {
702  $all[] = $assignment['domain'] . ' -> ' . ilObjRole::_lookupTitle((int) $assignment['role']);
703  }
704  }
705 
706  if ((string) $this->assignments_obj->getDefaultRole() !== '') {
707  $all[] = $this->lng->txt('reg_default') . ' -> ' . ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
708  }
709 
710  return $all;
711  }
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 683 of file class.ilRegistrationSettingsGUI.php.

References ilObjRole\_lookupRegisterAllowed().

Referenced by initForm().

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

◆ resetCodesFilter()

ilRegistrationSettingsGUI::resetCodesFilter ( )

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

References listCodes().

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

◆ save()

ilRegistrationSettingsGUI::save ( )

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

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

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

◆ saveAssignment()

ilRegistrationSettingsGUI::saveAssignment ( )

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

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

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

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

◆ setSubTabs()

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

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

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

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

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

◆ updateRoles()

ilRegistrationSettingsGUI::updateRoles ( )

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

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

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

◆ view()

ilRegistrationSettingsGUI::view ( )

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

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

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

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

Field Documentation

◆ $access

ilAccessHandler ilRegistrationSettingsGUI::$access
protected

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

◆ $access_limitations_obj

ilRegistrationRoleAccessLimitations ilRegistrationSettingsGUI::$access_limitations_obj = null
protected

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

◆ $assignments_obj

ilRegistrationRoleAssignments ilRegistrationSettingsGUI::$assignments_obj = null
protected

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

◆ $ctrl

ilCtrlInterface ilRegistrationSettingsGUI::$ctrl
protected

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

◆ $error

ilErrorHandling ilRegistrationSettingsGUI::$error
protected

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

◆ $form_gui

ilPropertyFormGUI ilRegistrationSettingsGUI::$form_gui = null
protected

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

Referenced by initAddCodesForm(), and initForm().

◆ $http

ILIAS HTTP Services ilRegistrationSettingsGUI::$http
protected

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

◆ $lng

ilLanguage ilRegistrationSettingsGUI::$lng
protected

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

◆ $rbacreview

ilRbacReview ilRegistrationSettingsGUI::$rbacreview
protected

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

◆ $rbacsystem

ilRbacSystem ilRegistrationSettingsGUI::$rbacsystem
protected

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

◆ $ref_id

int ilRegistrationSettingsGUI::$ref_id
Todo:
make private

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

◆ $refinery

ILIAS Refinery Factory ilRegistrationSettingsGUI::$refinery
protected

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

◆ $registration_settings

ilRegistrationSettings ilRegistrationSettingsGUI::$registration_settings
protected

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

◆ $tabs

ilTabsGUI ilRegistrationSettingsGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilRegistrationSettingsGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilRegistrationSettingsGUI::$tpl
protected

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

◆ CODE_TYPE_EXTENSION

const ilRegistrationSettingsGUI::CODE_TYPE_EXTENSION = 2

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

◆ CODE_TYPE_REGISTRATION

const ilRegistrationSettingsGUI::CODE_TYPE_REGISTRATION = 1

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


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