ILIAS  release_7 Revision v7.30-3-g800a261c036
ilRegistrationSettingsGUI Class Reference

Class ilRegistrationSettingsGUI. More...

+ Collaboration diagram for ilRegistrationSettingsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 setSubTabs ($activeTab='registration_settings')
 set sub tabs More...
 
 initForm ()
 
 initFormValues ()
 
 view ()
 
 save ()
 
 editRoles ()
 
 updateRoles ()
 
 editEmailAssignments (ilPropertyFormGUI $form=null)
 
 initEmailAssignmentForm ()
 
 editRoleAccessLimitations (ilPropertyFormGUI $form=null)
 
 initRoleAccessForm ()
 
 saveAssignment ()
 
 saveRoleAccessLimitations ()
 
 __parseRoleList ($roles, $url)
 
 __prepareRoleList ()
 
 __prepareAutomaticRoleList ()
 
 __prepareAccessLimitationRoleList ()
 
 __initRoleAssignments ()
 
 __initRoleAccessLimitations ()
 
 listCodes ()
 
 initAddCodesForm ()
 
 getLocalRoleAutoComplete ()
 
 addCodes ()
 
 createCodes ()
 
 deleteCodes ()
 
 deleteConfirmation ()
 
 resetCodesFilter ()
 
 applyCodesFilter ()
 
 exportCodes ()
 

Data Fields

const CODE_TYPE_REGISTRATION = 1
 
const CODE_TYPE_EXTENSION = 2
 
 $ctrl
 
 $tpl
 
 $ref_id
 
 $rbacsystem
 

Protected Member Functions

 checkAccess ($a_permission)
 
 checkAccessBool ($a_permission)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRegistrationSettingsGUI::__construct ( )

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

47 {
48 global $DIC;
49
50 $this->tpl = $DIC['tpl'];
51 $this->ctrl = $DIC->ctrl();
52 $this->rbacsystem = $DIC->rbac();
53
54 $this->lng = $DIC->language();
55 $this->lng->loadLanguageModule('administration');
56 $this->lng->loadLanguageModule('registration');
57 $this->lng->loadLanguageModule('user');
58
59 $this->ref_id = (int) $_GET['ref_id'];
60
61 $this->registration_settings = new ilRegistrationSettings();
62 }
$_GET["client_id"]
Class ilObjAuthSettingsGUI.
global $DIC
Definition: goto.php:24

References $_GET, and $DIC.

Member Function Documentation

◆ __initRoleAccessLimitations()

ilRegistrationSettingsGUI::__initRoleAccessLimitations ( )

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

775 {
776 if (is_object($this->access_limitations_obj)) {
777 return true;
778 }
779
780 $this->access_limitations_obj = new ilRegistrationRoleAccessLimitations();
781 }

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

+ Here is the caller graph for this function:

◆ __initRoleAssignments()

ilRegistrationSettingsGUI::__initRoleAssignments ( )

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

766 {
767 if (is_object($this->assignments_obj)) {
768 return true;
769 }
770
771 $this->assignments_obj = new ilRegistrationRoleAssignments();
772 }

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

+ Here is the caller graph for this function:

◆ __parseRoleList()

ilRegistrationSettingsGUI::__parseRoleList (   $roles,
  $url 
)

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

661 {
662 $tpl = new ilTemplate('tpl.registration_roles.html', true, true, 'Services/Registration');
663
664 $tpl->setVariable("EDIT", $this->lng->txt("edit"));
665 $tpl->setVariable("LINK_EDIT", $url);
666
667 if (is_array($roles) && sizeof($roles)) {
668 foreach ($roles as $role) {
669 $tpl->setCurrentBlock("list_item");
670 $tpl->setVariable("LIST_ITEM_ITEM", $role);
671 $tpl->parseCurrentBlock();
672 }
673 } else {
674 $tpl->setVariable("NONE", $this->lng->txt('none'));
675 }
676
677 return $tpl->get();
678 }
special template class to simplify handling of ITX/PEAR
$url

References $tpl, and $url.

Referenced by initForm().

+ Here is the caller graph for this function:

◆ __prepareAccessLimitationRoleList()

ilRegistrationSettingsGUI::__prepareAccessLimitationRoleList ( )

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

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

References $DIC, __initRoleAccessLimitations(), ilObjRole\_lookupRegisterAllowed(), ilDatePresentation\formatDate(), and IL_CAL_UNIX.

Referenced by initForm().

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

◆ __prepareAutomaticRoleList()

ilRegistrationSettingsGUI::__prepareAutomaticRoleList ( )

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

691 {
692 $this->__initRoleAssignments();
693
694 $all = array();
695 foreach ($this->assignments_obj->getAssignments() as $assignment) {
696 if (strlen($assignment['domain']) and $assignment['role']) {
697 $all[] = $assignment['domain'] . ' -> ' . ilObjRole::_lookupTitle($assignment['role']);
698 }
699 }
700
701 if (strlen($this->assignments_obj->getDefaultRole())) {
702 $all[] = $this->lng->txt('reg_default') . ' -> ' . ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
703 }
704
705 return $all;
706 }
static _lookupTitle($a_id)
lookup object title

References __initRoleAssignments(), and ilObject\_lookupTitle().

Referenced by initForm().

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

◆ __prepareRoleList()

ilRegistrationSettingsGUI::__prepareRoleList ( )

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

681 {
682
683 $all = array();
684 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
685 $all[] = $role['title'];
686 }
687 return $all;
688 }

References ilObjRole\_lookupRegisterAllowed().

Referenced by initForm().

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

◆ addCodes()

ilRegistrationSettingsGUI::addCodes ( )

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

908 {
909 global $DIC;
910
911 $ilAccess = $DIC->access();
912 $ilErr = $DIC['ilErr'];
913
914 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
915 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
916 }
917
918 $this->setSubTabs('registration_codes');
919
920 $this->initAddCodesForm();
921
922 // default
923 $limit = $this->form_gui->getItemByPostVar("reg_limit");
924 $limit->setValue("none");
925
926 $this->tpl->setContent($this->form_gui->getHTML());
927 }
setSubTabs($activeTab='registration_settings')
set sub tabs
$ilErr
Definition: raiseError.php:18

References $DIC, $ilErr, initAddCodesForm(), and setSubTabs().

+ Here is the call graph for this function:

◆ applyCodesFilter()

ilRegistrationSettingsGUI::applyCodesFilter ( )

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

1070 {
1071 $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1072 $utab->resetOffset();
1073 $utab->writeFilterToSession();
1074
1075 $this->listCodes();
1076 }
TableGUI class for registration codes.

References listCodes().

+ Here is the call graph for this function:

◆ checkAccess()

ilRegistrationSettingsGUI::checkAccess (   $a_permission)
protected
Parameters
string$a_permission

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

83 {
84 global $DIC;
85
86 $ilErr = $DIC['ilErr'];
87
88 if (!$this->checkAccessBool($a_permission)) {
89 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
90 }
91 }

References $DIC, $ilErr, and checkAccessBool().

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

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

◆ checkAccessBool()

ilRegistrationSettingsGUI::checkAccessBool (   $a_permission)
protected
Parameters
string$a_permission
Returns
bool

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

98 {
99 global $DIC;
100
101 $access = $DIC->access();
102
103 return $access->checkAccess($a_permission, '', $this->ref_id);
104 }

References $DIC.

Referenced by checkAccess(), and listCodes().

+ Here is the caller graph for this function:

◆ createCodes()

ilRegistrationSettingsGUI::createCodes ( )

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

930 {
931 global $DIC;
932
933 $ilAccess = $DIC->access();
934 $ilErr = $DIC['ilErr'];
935 $rbacreview = $DIC->rbac()->review();
936
937 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
938 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
939 }
940
941 $this->setSubTabs('registration_codes');
942
943 $this->initAddCodesForm();
944 $valid = $this->form_gui->checkInput();
945 if ($valid) {
946 $number = $this->form_gui->getInput('reg_codes_number');
947 $role = $this->form_gui->getInput('reg_codes_role');
948 $local = $this->form_gui->getInput("reg_codes_local");
949
950 if (is_array($local)) {
951 $role_ids = array();
952 foreach (array_unique($local) as $item) {
953 if (trim($item)) {
954 $role_id = $rbacreview->roleExists($item);
955 if ($role_id) {
956 $role_ids[] = $role_id;
957 }
958 }
959 }
960 if (sizeof($role_ids)) {
961 $local = $role_ids;
962 }
963 }
964
965 $date = null;
966 $limit = $this->form_gui->getInput("reg_limit");
967 switch ($limit) {
968 case "absolute":
969 $date_input = $this->form_gui->getItemByPostVar("abs_date");
970 $date = $date_input->getDate()->get(IL_CAL_DATE);
971 if ($date < date("Y-m-d")) {
972 $date_input->setAlert($this->lng->txt("form_msg_wrong_date"));
973 $valid = false;
974 }
975 break;
976
977 case "relative":
978 $date = $this->form_gui->getInput("rel_date");
979 if (!array_sum($date)) {
980 $valid = false;
981 } else {
982 $date = array(
983 "d" => $date["dd"],
984 "m" => $date["MM"] % 12,
985 "y" => floor($date["MM"] / 12)
986 );
987 }
988 break;
989
990 case "none":
991 $limit = null;
992 break;
993 }
994 }
995
996 if ($valid) {
997
998 $stamp = time();
999 for ($loop = 1; $loop <= $number; $loop++) {
1000 $code_types = (array) $this->form_gui->getInput('code_type');
1001
1003 $role,
1004 $stamp,
1005 $local,
1006 $limit,
1007 $date,
1008 in_array(self::CODE_TYPE_REGISTRATION, $code_types) ? true : false,
1009 in_array(self::CODE_TYPE_EXTENSION, $code_types) ? true : false
1010 );
1011 }
1012
1013 ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
1014 $this->ctrl->redirect($this, "listCodes");
1015 } else {
1016 $this->form_gui->setValuesByPost();
1017 $this->tpl->setContent($this->form_gui->getHtml());
1018 }
1019 }
const IL_CAL_DATE
static create($role, $stamp, $local_roles, $limit, $limit_date, $reg_type, $ext_type)
$valid

References $DIC, $ilErr, $valid, ilRegistrationCode\create(), IL_CAL_DATE, initAddCodesForm(), and setSubTabs().

+ Here is the call graph for this function:

◆ deleteCodes()

ilRegistrationSettingsGUI::deleteCodes ( )

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

1022 {
1023 $this->checkAccess("write");
1024
1025 include_once './Services/Registration/classes/class.ilRegistrationCode.php';
1027
1028 ilUtil::sendSuccess($this->lng->txt('info_deleted'), true);
1029 $this->ctrl->redirect($this, "listCodes");
1030 }
$_POST["username"]
static deleteCodes(array $ids)

References $_POST, checkAccess(), and ilRegistrationCode\deleteCodes().

+ Here is the call graph for this function:

◆ deleteConfirmation()

ilRegistrationSettingsGUI::deleteConfirmation ( )

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

1033 {
1034 $this->checkAccess("write");
1035
1036 global $DIC;
1037
1038 $ilErr = $DIC['ilErr'];
1039
1040 if (!isset($_POST["id"])) {
1041 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1042 }
1043
1044 $this->setSubTabs('registration_codes');
1045
1046 $gui = new ilConfirmationGUI();
1047 $gui->setHeaderText($this->lng->txt("info_delete_sure"));
1048 $gui->setCancel($this->lng->txt("cancel"), "listCodes");
1049 $gui->setConfirm($this->lng->txt("confirm"), "deleteCodes");
1050 $gui->setFormAction($this->ctrl->getFormAction($this, "deleteCodes"));
1051
1053 foreach ($data as $code) {
1054 $gui->addItem("id[]", $code["code_id"], $code["code"]);
1055 }
1056
1057 $this->tpl->setContent($gui->getHTML());
1058 }
Confirmation screen class.
static loadCodesByIds(array $ids)
$data
Definition: storeScorm.php:23

References $_POST, $data, $DIC, $ilErr, checkAccess(), ilRegistrationCode\loadCodesByIds(), and setSubTabs().

+ Here is the call graph for this function:

◆ editEmailAssignments()

ilRegistrationSettingsGUI::editEmailAssignments ( ilPropertyFormGUI  $form = null)

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

418 {
419 global $DIC;
420
421 $ilAccess = $DIC->access();
422 $ilErr = $DIC['ilErr'];
423 $ilTabs = $DIC->tabs();
424 $ilCtrl = $DIC->ctrl();
425
426 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
427 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
428 }
429
430 $ilTabs->clearTargets();
431 $ilTabs->setBackTarget(
432 $this->lng->txt("registration_settings"),
433 $ilCtrl->getLinkTarget($this, "view")
434 );
435
436 $this->__initRoleAssignments();
437
438
439 $form = (empty($form)) ? $this->initEmailAssignmentForm() : $form;
440 $this->tpl->setContent($form->getHTML());
441 }

References $DIC, $ilErr, __initRoleAssignments(), and initEmailAssignmentForm().

Referenced by saveAssignment().

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

◆ editRoleAccessLimitations()

ilRegistrationSettingsGUI::editRoleAccessLimitations ( ilPropertyFormGUI  $form = null)

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

491 {
492 global $DIC;
493
494 $ilAccess = $DIC->access();
495 $ilErr = $DIC['ilErr'];
496 $ilTabs = $DIC->tabs();
497 $ilCtrl = $DIC->ctrl();
498
499 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
500 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
501 }
502
503 $ilTabs->clearTargets();
504 $ilTabs->setBackTarget(
505 $this->lng->txt("registration_settings"),
506 $ilCtrl->getLinkTarget($this, "view")
507 );
508
510
511 $form = $this->initRoleAccessForm();
512
513 $this->tpl->setContent($form->getHTML());
514 }

References $DIC, $ilErr, __initRoleAccessLimitations(), and initRoleAccessForm().

Referenced by saveRoleAccessLimitations().

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

◆ editRoles()

ilRegistrationSettingsGUI::editRoles ( )

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

335 {
336
337 global $DIC;
338
339 $ilAccess = $DIC->access();
340 $ilErr = $DIC['ilErr'];
341 $ilTabs = $DIC->tabs();
342 $ilCtrl = $DIC->ctrl();
343 $rbacreview = $DIC->rbac()->review();
344
345 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
346 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
347 }
348
349 $ilTabs->clearTargets();
350 $ilTabs->setBackTarget(
351 $this->lng->txt("registration_settings"),
352 $ilCtrl->getLinkTarget($this, "view")
353 );
354
355 $role_form = new ilPropertyFormGUI();
356 $role_form->setFormAction($this->ctrl->getFormAction($this, 'save'));
357 $role_form->setTitle($this->lng->txt('reg_selectable_roles'));
358
359 $roles = new \ilCheckboxGroupInputGUI($this->lng->txt('reg_available_roles'), 'roles');
360 $allowed_roles = array();
361 foreach ($rbacreview->getGlobalRoles() as $role) {
362 if ($role == SYSTEM_ROLE_ID or $role == ANONYMOUS_ROLE_ID) {
363 continue;
364 }
365 $role_option = new \ilCheckboxOption(ilObjRole::_lookupTitle($role));
366 $role_option->setValue($role);
367 $roles->addOption($role_option);
368
369 $allowed_roles[$role] = ilObjRole::_lookupAllowRegister($role);
370 }
371
372 $roles->setUseValuesAsKeys(true);
373 $roles->setValue($allowed_roles);
374 $role_form->addItem($roles);
375
376
377 if ($this->rbacsystem->system()->checkAccess("write", $this->ref_id)) {
378 $role_form->addCommandButton("updateRoles", $this->lng->txt("save"));
379 }
380 $role_form->addCommandButton("view", $this->lng->txt("cancel"));
381
382
383 $this->tpl->setContent($role_form->getHTML());
384 }
static _lookupAllowRegister($a_role_id)
check whether role is allowed in user registration or not
This class represents a property form user interface.
const SYSTEM_ROLE_ID
Definition: constants.php:27
const ANONYMOUS_ROLE_ID
Definition: constants.php:26

References $DIC, $ilErr, ilObjRole\_lookupAllowRegister(), ilObject\_lookupTitle(), ANONYMOUS_ROLE_ID, and SYSTEM_ROLE_ID.

Referenced by updateRoles().

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

◆ executeCommand()

ilRegistrationSettingsGUI::executeCommand ( )

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

65 {
66 $next_class = $this->ctrl->getNextClass($this);
67 $cmd = $this->ctrl->getCmd();
68 switch ($next_class) {
69 default:
70 if (!$cmd) {
71 $cmd = 'view';
72 }
73 $this->$cmd();
74 break;
75 }
76 return true;
77 }

◆ exportCodes()

ilRegistrationSettingsGUI::exportCodes ( )

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

1079 {
1080 global $DIC;
1081
1082 $ilAccess = $DIC->access();
1083 $ilErr = $DIC['ilErr'];
1084
1085 if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
1086 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
1087 }
1088
1089 $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1090
1091 $codes = ilRegistrationCode::getCodesForExport($utab->filter["code"], $utab->filter["role"], $utab->filter["generated"], $utab->filter["alimit"]);
1092
1093 if (sizeof($codes)) {
1094 ilUtil::deliverData(implode("\r\n", $codes), "ilias_registration_codes_" . date("d-m-Y") . ".txt", "text/plain");
1095 } else {
1096 ilUtil::sendFailure($this->lng->txt("registration_export_codes_no_data"));
1097 $this->listCodes();
1098 }
1099 }
static getCodesForExport($filter_code, $filter_role, $filter_generated, $filter_access_limitation)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.

References $DIC, $ilErr, ilUtil\deliverData(), ilRegistrationCode\getCodesForExport(), listCodes(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ getLocalRoleAutoComplete()

ilRegistrationSettingsGUI::getLocalRoleAutoComplete ( )

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

900 {
901 $q = $_REQUEST["term"];
902 $list = ilRoleAutoComplete::getList($q);
903 echo $list;
904 exit;
905 }
static getList($a_str)
Get completion list.
exit
Definition: login.php:29

References exit, and ilRoleAutoComplete\getList().

+ Here is the call graph for this function:

◆ initAddCodesForm()

ilRegistrationSettingsGUI::initAddCodesForm ( )

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

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

References $DIC, ANONYMOUS_ROLE_ID, and SYSTEM_ROLE_ID.

Referenced by addCodes(), and createCodes().

+ Here is the caller graph for this function:

◆ initEmailAssignmentForm()

ilRegistrationSettingsGUI::initEmailAssignmentForm ( )

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

444 {
445 global $DIC;
446
447 $rbacreview = $DIC->rbac()->review();
448
449 $role_assignment_form = new ilPropertyFormGUI();
450 $role_assignment_form->setFormAction($this->ctrl->getFormAction($this));
451 $role_assignment_form->setTitle($this->lng->txt('reg_email_role_assignment'));
452
453 $global_roles = ["" => $this->lng->txt("links_select_one")];
454 foreach ($rbacreview->getGlobalRoles() as $role_id) {
455 if ($role_id == ANONYMOUS_ROLE_ID) {
456 continue;
457 }
458
459 $global_roles[$role_id] = ilObjRole::_lookupTitle($role_id);
460 $role_assignments = new ilCheckboxInputGUI(ilObjRole::_lookupTitle($role_id), "role_assigned_$role_id");
461
462 $domains = $this->assignments_obj->getDomainsByRole($role_id);
463
464 $domain = new ilTextInputGUI($this->lng->txt('reg_domain'), "domain_$role_id");
465 $domain->setMulti(true);
466 $domain->setValidationRegexp("/^@.*\.[a-zA-Z]{1,4}$/");
467 if (!empty($domains)) {
468 $domain->setValue($domains[0]);
469 $domain->setMultiValues($domains);
470 $role_assignments->setChecked(true);
471 }
472
473 $role_assignments->addSubItem($domain);
474 $role_assignment_form->addItem($role_assignments);
475 }
476
477 $default_role = new ilSelectInputGUI($this->lng->txt('reg_default'));
478 $default_role->setPostVar("default_role");
479 $default_role->setOptions($global_roles);
480 $default_role->setValue($this->assignments_obj->getDefaultRole());
481 $default_role->setRequired(true);
482 $role_assignment_form->addItem($default_role);
483
484 $role_assignment_form->addCommandButton("saveAssignment", $this->lng->txt("save"));
485 $role_assignment_form->addCommandButton("view", $this->lng->txt("cancel"));
486
487 return $role_assignment_form;
488 }
This class represents a checkbox property in a property form.

References $DIC, ilObject\_lookupTitle(), and ANONYMOUS_ROLE_ID.

Referenced by editEmailAssignments(), and saveAssignment().

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

◆ initForm()

ilRegistrationSettingsGUI::initForm ( )

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

132 {
133 $this->form_gui = new ilPropertyFormGUI();
134 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
135 $this->form_gui->setTitle($this->lng->txt('reg_settings_header'));
136
137 $reg_type = new ilRadioGroupInputGUI($this->lng->txt('reg_type'), 'reg_type');
138 $reg_type->addOption(new ilRadioOption($this->lng->txt('reg_disabled'), IL_REG_DISABLED));
139 $option = new ilRadioOption($this->lng->txt('reg_direct'), IL_REG_DIRECT);
140 $option->setInfo($this->lng->txt('reg_direct_info'));
141 $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_DIRECT);
142 $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
143 $option->addSubItem($cd);
144 $reg_type->addOption($option);
145 $option = new ilRadioOption($this->lng->txt('reg_approve'), IL_REG_APPROVE);
146 $option->setInfo($this->lng->txt('reg_approve_info'));
147 $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_APPROVE);
148 $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
149 $option->addSubItem($cd);
150 $reg_type->addOption($option);
151 $option = new ilRadioOption($this->lng->txt('reg_type_confirmation'), IL_REG_ACTIVATION);
152 $option->setInfo($this->lng->txt('reg_type_confirmation_info'));
153 $lt = new ilNumberInputGUI($this->lng->txt('reg_confirmation_hash_life_time'), 'reg_hash_life_time');
154 $lt->setSize(6); // #8511
155 $lt->setMaxLength(6);
157 $lt->setRequired(true);
158 $lt->setInfo($this->lng->txt('reg_confirmation_hash_life_time_info'));
159 $lt->setSuffix($this->lng->txt('seconds'));
160 $option->addSubItem($lt);
161 $cd = new ilCheckboxInputGUI($this->lng->txt('reg_allow_codes'), 'reg_codes_' . IL_REG_ACTIVATION);
162 $cd->setInfo($this->lng->txt('reg_allow_codes_info'));
163 $option->addSubItem($cd);
164 $reg_type->addOption($option);
165 $option = new ilRadioOption($this->lng->txt('registration_reg_type_codes'), IL_REG_CODES);
166 $option->setInfo($this->lng->txt('registration_reg_type_codes_info'));
167 $reg_type->addOption($option);
168 $this->form_gui->addItem($reg_type);
169
170 $pwd_gen = new ilCheckboxInputGUI($this->lng->txt('passwd_generation'), 'reg_pwd');
171 $pwd_gen->setValue(1);
172 $pwd_gen->setInfo($this->lng->txt('reg_info_pwd'));
173 $this->form_gui->addItem($pwd_gen);
174
175 require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
176 $cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_anonymous_short'), 'activate_captcha_anonym');
177 $cap->setInfo($this->lng->txt('adm_captcha_anonymous_reg'));
178 $cap->setValue(1);
180 $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
181 }
182 $this->form_gui->addItem($cap);
183
184 $approver = new ilTextInputGUI($this->lng->txt('reg_notification'), 'reg_approver');
185 $approver->setSize(32);
186 $approver->setMaxLength(50);
187 $approver->setInfo($this->lng->txt('reg_notification_info'));
188 $this->form_gui->addItem($approver);
189
190 $roles = new ilRadioGroupInputGUI($this->lng->txt('reg_role_assignment'), 'reg_role_type');
191 $option = new ilRadioOption($this->lng->txt('reg_fixed'), IL_REG_ROLES_FIXED);
192 $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
193 $edit = $this->ctrl->getLinkTarget($this, 'editRoles');
194 $list->setHtml($this->__parseRoleList($this->__prepareRoleList(), $edit));
195 $option->addSubItem($list);
196 $roles->addOption($option);
197 $option = new ilRadioOption($this->lng->txt('reg_email'), IL_REG_ROLES_EMAIL);
198 $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
199 $edit = $this->ctrl->getLinkTarget($this, 'editEmailAssignments');
200 $list->setHtml($this->__parseRoleList($this->__prepareAutomaticRoleList(), $edit));
201 $option->addSubItem($list);
202 $roles->addOption($option);
203 $roles->setInfo($this->lng->txt('registration_codes_override_global_info'));
204 $this->form_gui->addItem($roles);
205
206 $limit = new ilCheckboxInputGUI($this->lng->txt('reg_access_limitations'), 'reg_access_limitation');
207 $limit->setValue(1);
208 $list = new ilCustomInputGUI($this->lng->txt('reg_available_roles'));
209 $edit = $this->ctrl->getLinkTarget($this, 'editRoleAccessLimitations');
210 $list->setHtml($this->__parseRoleList($this->__prepareAccessLimitationRoleList(), $edit));
211 $list->setInfo($this->lng->txt('registration_codes_override_global_info'));
212 $limit->addSubItem($list);
213 $this->form_gui->addItem($limit);
214
215 $domains = new ilTextInputGUI($this->lng->txt('reg_allowed_domains'), 'reg_allowed_domains');
216 $domains->setInfo($this->lng->txt('reg_allowed_domains_info'));
217 $this->form_gui->addItem($domains);
218
219 if ($this->rbacsystem->system()->checkAccess("write", $this->ref_id)) {
220 $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
221 }
222 }
const IL_REG_ACTIVATION
const IL_REG_ROLES_FIXED
const IL_REG_ROLES_EMAIL
static checkFreetype()
Check whether captcha support is active.
This class represents a custom property in a property form.

References __parseRoleList(), __prepareAccessLimitationRoleList(), __prepareAutomaticRoleList(), __prepareRoleList(), ilCaptchaUtil\checkFreetype(), IL_REG_ACTIVATION, IL_REG_APPROVE, IL_REG_CODES, IL_REG_DIRECT, IL_REG_DISABLED, IL_REG_ROLES_EMAIL, IL_REG_ROLES_FIXED, and ilRegistrationSettings\REG_HASH_LIFETIME_MIN_VALUE.

Referenced by view().

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

◆ initFormValues()

ilRegistrationSettingsGUI::initFormValues ( )

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

225 {
226 if ($this->registration_settings->roleSelectionEnabled()) {
227 $role_type = IL_REG_ROLES_FIXED;
228 } elseif ($this->registration_settings->automaticRoleAssignmentEnabled()) {
229 $role_type = IL_REG_ROLES_EMAIL;
230 }
231
232 require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
233 $values = array(
234 'reg_type' => $this->registration_settings->getRegistrationType(),
235 'reg_hash_life_time' => (int) $this->registration_settings->getRegistrationHashLifetime(),
236 'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
237 'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
238 'reg_role_type' => $role_type,
239 'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
240 'reg_allowed_domains' => implode(';', $this->registration_settings->getAllowedDomains()),
241 'activate_captcha_anonym' => ilCaptchaUtil::isActiveForRegistration()
242 );
243
244 $allow_codes = $this->registration_settings->getAllowCodes();
245 $reg_type = $this->registration_settings->getRegistrationType();
246 if ($allow_codes && in_array($reg_type, array(IL_REG_DIRECT, IL_REG_APPROVE, IL_REG_ACTIVATION))) {
247 $values['reg_codes_' . $reg_type] = true;
248 }
249
250 $this->form_gui->setValuesByArray($values);
251 }

References IL_REG_ACTIVATION, IL_REG_APPROVE, IL_REG_DIRECT, IL_REG_ROLES_EMAIL, and IL_REG_ROLES_FIXED.

Referenced by view().

+ Here is the caller graph for this function:

◆ initRoleAccessForm()

ilRegistrationSettingsGUI::initRoleAccessForm ( )

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

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

References ilObjRole\_lookupRegisterAllowed(), and IL_CAL_DATE.

Referenced by editRoleAccessLimitations(), and saveRoleAccessLimitations().

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

◆ listCodes()

ilRegistrationSettingsGUI::listCodes ( )

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

784 {
785 global $DIC;
786 $this->checkAccess("visible,read");
787
788 $this->setSubTabs('registration_codes');
789
790 if ($this->checkAccessBool("write")) {
791 $DIC->toolbar()->addButton(
792 $this->lng->txt("registration_codes_add"),
793 $this->ctrl->getLinkTarget($this, "addCodes")
794 );
795 }
796
797 $ctab = new ilRegistrationCodesTableGUI($this, "listCodes");
798 $this->tpl->setContent($ctab->getHTML());
799 }

References $DIC, checkAccess(), checkAccessBool(), and setSubTabs().

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

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

◆ resetCodesFilter()

ilRegistrationSettingsGUI::resetCodesFilter ( )

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

1061 {
1062 $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1063 $utab->resetOffset();
1064 $utab->resetFilter();
1065
1066 $this->listCodes();
1067 }

References listCodes().

+ Here is the call graph for this function:

◆ save()

ilRegistrationSettingsGUI::save ( )

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

278 {
279 global $DIC;
280
281 $ilAccess = $DIC->access();
282 $ilErr = $DIC['ilErr'];
283
284 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
285 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
286 }
287
288 $this->registration_settings->setRegistrationType((int) $_POST['reg_type']);
289 $this->registration_settings->setPasswordGenerationStatus((int) $_POST['reg_pwd']);
290 $this->registration_settings->setApproveRecipientLogins(ilUtil::stripSlashes($_POST['reg_approver']));
291 $this->registration_settings->setRoleType((int) $_POST['reg_role_type']);
292 $this->registration_settings->setAccessLimitation((int) $_POST['reg_access_limitation']);
293 $this->registration_settings->setAllowedDomains($_POST['reg_allowed_domains']);
294
295 $allow_codes = false;
296 if (in_array((int) $_POST['reg_type'], array(IL_REG_DIRECT, IL_REG_APPROVE, IL_REG_ACTIVATION))) {
297 $allow_codes = (bool) $_POST['reg_codes_' . (int) $_POST['reg_type']];
298 }
299 $this->registration_settings->setAllowCodes($allow_codes);
300
301 if (!preg_match('/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (int) $_POST['reg_hash_life_time'])) {
302 $this->registration_settings->setRegistrationHashLifetime(ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE);
303 } else {
304 $this->registration_settings->setRegistrationHashLifetime(max((int) $_POST['reg_hash_life_time'], ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE));
305 }
306
307 if ($error_code = $this->registration_settings->validate()) {
308 switch ($error_code) {
310
311 ilUtil::sendFailure($this->lng->txt('reg_unknown_recipients') . ' ' . $this->registration_settings->getUnknown());
312 $this->view();
313 return false;
314
316
317 ilUtil::sendFailure($this->lng->txt('reg_approve_needs_recipient') . ' ' . $this->registration_settings->getUnknown());
318 $this->view();
319 return false;
320
321 }
322 }
323
324 require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
325 ilCaptchaUtil::setActiveForRegistration((bool) $_POST['activate_captcha_anonym']);
326
327 $this->registration_settings->save();
328 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
329 $this->view();
330
331 return true;
332 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, $DIC, $ilErr, ilRegistrationSettings\ERR_MISSING_RCP, ilRegistrationSettings\ERR_UNKNOWN_RCP, IL_REG_ACTIVATION, IL_REG_APPROVE, IL_REG_DIRECT, ilRegistrationSettings\REG_HASH_LIFETIME_MIN_VALUE, ilUtil\sendFailure(), ilUtil\stripSlashes(), and view().

+ Here is the call graph for this function:

◆ saveAssignment()

ilRegistrationSettingsGUI::saveAssignment ( )

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

560 {
561 global $DIC;
562
563 $ilAccess = $DIC->access();
564 $ilErr = $DIC['ilErr'];
565 $rbacreview = $DIC->rbac()->review();
566
567 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
568 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
569 }
570
571 $this->__initRoleAssignments();
572
573 $form = $this->initEmailAssignmentForm();
574 if (!$form->checkInput()) {
575 $form->setValuesByPost();
576 $this->editEmailAssignments($form);
577 return false;
578 }
579
580 $this->assignments_obj->deleteAll();
581
582 $counter = 0;
583 foreach ($rbacreview->getGlobalRoles() as $role_id) {
584 if ($role_id == ANONYMOUS_ROLE_ID) {
585 continue;
586 }
587
588 $domain_input = $form->getInput("domain_$role_id");
589 $role_assigned_input = $form->getInput("role_assigned_$role_id");
590
591
592 if (!empty($role_assigned_input)) {
593 foreach ($domain_input as $domain) {
594 if (!empty($domain)) {
595 $this->assignments_obj->setDomain($counter, ilUtil::stripSlashes($domain));
596 $this->assignments_obj->setRole($counter, ilUtil::stripSlashes($role_id));
597 $counter++;
598 }
599 }
600 }
601 }
602
603 $default_role = $form->getInput("default_role");
604 $this->assignments_obj->setDefaultRole((int) $default_role);
605
606 $this->assignments_obj->save();
607 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
608 $this->view();
609 return true;
610 }
editEmailAssignments(ilPropertyFormGUI $form=null)

References $DIC, $ilErr, __initRoleAssignments(), ANONYMOUS_ROLE_ID, editEmailAssignments(), initEmailAssignmentForm(), ilUtil\stripSlashes(), and view().

+ Here is the call graph for this function:

◆ saveRoleAccessLimitations()

ilRegistrationSettingsGUI::saveRoleAccessLimitations ( )

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

613 {
614 global $DIC;
615
616 $ilAccess = $DIC->access();
617 $ilErr = $DIC['ilErr'];
618
619 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
620 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
621 }
622
624
625 $form = $this->initRoleAccessForm();
626 if(!$form->checkInput()) {
627 $form->setValuesByPost();
628 $this->editRoleAccessLimitations($form);
629 return false;
630 }
631
632 $this->access_limitations_obj->resetAccessLimitations();
633 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
634 $this->access_limitations_obj->setMode($form->getInput("role_access_" . $role['id']), $role['id']);
635 $this->access_limitations_obj->setAbsolute($form->getInput("absolute_date_" . $role['id']), $role['id']);
636 $this->access_limitations_obj->setRelative($form->getInput("duration_" . $role['id']), $role['id']);
637 }
638
639 if ($err = $this->access_limitations_obj->validate()) {
640 switch ($err) {
642 ilUtil::sendFailure($this->lng->txt('reg_access_limitation_missing_mode'));
643 break;
644
646 ilUtil::sendFailure($this->lng->txt('reg_access_limitation_out_of_date'));
647 break;
648 }
650 return false;
651 }
652
653
654 $this->access_limitations_obj->save();
655 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
656 $this->view();
657 return true;
658 }
editRoleAccessLimitations(ilPropertyFormGUI $form=null)
const IL_REG_ACCESS_LIMITATION_MISSING_MODE
Class class.ilRegistrationAccessLimitation.

References $DIC, $ilErr, __initRoleAccessLimitations(), ilObjRole\_lookupRegisterAllowed(), editRoleAccessLimitations(), IL_REG_ACCESS_LIMITATION_MISSING_MODE, IL_REG_ACCESS_LIMITATION_OUT_OF_DATE, initRoleAccessForm(), ilUtil\sendFailure(), and view().

+ Here is the call graph for this function:

◆ setSubTabs()

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

set sub tabs

Parameters
string$activeTab

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

111 {
112 global $DIC;
113
114 $ilTabs = $DIC->tabs();
115
116 $ilTabs->addSubTab(
117 "registration_settings",
118 $this->lng->txt("registration_tab_settings"),
119 $this->ctrl->getLinkTarget($this, 'view')
120 );
121
122 $ilTabs->addSubTab(
123 "registration_codes",
124 $this->lng->txt("registration_tab_codes"),
125 $this->ctrl->getLinkTarget($this, 'listCodes')
126 );
127
128 $ilTabs->activateSubTab($activeTab);
129 }

References $DIC.

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

+ Here is the caller graph for this function:

◆ updateRoles()

ilRegistrationSettingsGUI::updateRoles ( )

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

387 {
388 global $DIC;
389
390 $ilAccess = $DIC->access();
391 $ilErr = $DIC['ilErr'];
392 $rbacreview = $DIC->rbac()->review();
393
394 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
395 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
396 }
397 // Minimum one role
398 if (count($_POST['roles']) < 1) {
399 ilUtil::sendFailure($this->lng->txt('msg_last_role_for_registration'));
400 $this->editRoles();
401 return false;
402 }
403 // update allow register
404 foreach ($rbacreview->getGlobalRoles() as $role) {
405 if ($role_obj = ilObjectFactory::getInstanceByObjId($role, false)) {
406 $role_obj->setAllowRegister($_POST['roles'][$role] ? 1 : 0);
407 $role_obj->update();
408 }
409 }
410
411 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
412 $this->view();
413
414 return true;
415 }
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id

References $_POST, $DIC, $ilErr, editRoles(), ilObjectFactory\getInstanceByObjId(), ilUtil\sendFailure(), and view().

+ Here is the call graph for this function:

◆ view()

ilRegistrationSettingsGUI::view ( )

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

254 {
255 global $DIC;
256 if (!$DIC->rbac()->system()->checkAccess("visible,read", $this->ref_id)) {
257 $DIC['ilErr']->raiseError($this->lng->txt("msg_no_perm_read"), $DIC['ilErr']->MESSAGE);
258 }
259
260 $this->setSubTabs();
261
262 // edit new accout mail
263 $this->ctrl->setParameterByClass("ilobjuserfoldergui", "ref_id", USER_FOLDER_ID);
264 if ($DIC->rbac()->system()->checkAccess("write", $this->ref_id)) {
265 $DIC->toolbar()->addButton($this->lng->txt('registration_user_new_account_mail'), $this->ctrl->getLinkTargetByClass(array(
266 "iladministrationgui",
267 "ilobjuserfoldergui"
268 ), "newAccountMail"));
269 $this->ctrl->setParameterByClass("ilobjuserfoldergui", "ref_id", $_GET["ref_id"]);
270 }
271
272 $this->initForm();
273 $this->initFormValues();
274 $this->tpl->setContent($this->form_gui->getHTML());
275 }
const USER_FOLDER_ID
Definition: constants.php:31

References $_GET, $DIC, initForm(), initFormValues(), setSubTabs(), and USER_FOLDER_ID.

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

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

Field Documentation

◆ $ctrl

ilRegistrationSettingsGUI::$ctrl

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

◆ $rbacsystem

ilRegistrationSettingsGUI::$rbacsystem

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

◆ $ref_id

ilRegistrationSettingsGUI::$ref_id

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

◆ $tpl

ilRegistrationSettingsGUI::$tpl

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

Referenced by __parseRoleList().

◆ CODE_TYPE_EXTENSION

const ilRegistrationSettingsGUI::CODE_TYPE_EXTENSION = 2

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

◆ CODE_TYPE_REGISTRATION

const ilRegistrationSettingsGUI::CODE_TYPE_REGISTRATION = 1

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


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