ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 
 saveAssignment ()
 
 saveRoleAccessLimitations ()
 
 __parseRoleList ($roles, $url)
 
 __prepareRoleList ()
 
 __prepareAutomaticRoleList ()
 
 __prepareAccessLimitationRoleList ()
 
 __initRoleAssignments ()
 
 __initRoleAccessLimitations ()
 
 __buildAccessLimitationSelection ($a_role_id)
 
 __prepareDateSelect ($a_unix_time)
 
 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.
$DIC
Definition: xapitoken.php:46

References $_GET, and $DIC.

Member Function Documentation

◆ __buildAccessLimitationSelection()

ilRegistrationSettingsGUI::__buildAccessLimitationSelection (   $a_role_id)

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

781 {
782 global $DIC;
783
784 $lng = $DIC['lng'];
785
786 $options = array(
787 'null' => $lng->txt('please_choose'),
788 'unlimited' => $lng->txt('reg_access_limitation_mode_unlimited'),
789 'absolute' => $lng->txt('reg_access_limitation_mode_absolute'),
790 'relative' => $lng->txt('reg_access_limitation_mode_relative')
791 );
792
793 $attribs = array('onchange' => 'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_' . $a_role_id . ',' . $a_role_id . ')');
794
795 $selected = $this->access_limitations_obj->getMode($a_role_id);
796
797 return ilUtil::formSelect($selected, 'access_limitation_mode_' . $a_role_id, $options, false, true, 0, "", $attribs);
798 }
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$lng

References $DIC, $lng, and ilUtil\formSelect().

Referenced by editRoleAccessLimitations().

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

◆ __initRoleAccessLimitations()

ilRegistrationSettingsGUI::__initRoleAccessLimitations ( )

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

770 {
771 if (is_object($this->access_limitations_obj)) {
772 return true;
773 }
774
775 include_once 'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
776
777 $this->access_limitations_obj = new ilRegistrationRoleAccessLimitations();
778 }

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

+ Here is the caller graph for this function:

◆ __initRoleAssignments()

ilRegistrationSettingsGUI::__initRoleAssignments ( )

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

759 {
760 if (is_object($this->assignments_obj)) {
761 return true;
762 }
763
764 include_once 'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
765
766 $this->assignments_obj = new ilRegistrationRoleAssignments();
767 }

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

+ Here is the caller graph for this function:

◆ __parseRoleList()

ilRegistrationSettingsGUI::__parseRoleList (   $roles,
  $url 
)

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

643 {
644 $tpl = new ilTemplate('tpl.registration_roles.html', true, true, 'Services/Registration');
645
646 $tpl->setVariable("EDIT", $this->lng->txt("edit"));
647 $tpl->setVariable("LINK_EDIT", $url);
648
649 if (is_array($roles) && sizeof($roles)) {
650 foreach ($roles as $role) {
651 $tpl->setCurrentBlock("list_item");
652 $tpl->setVariable("LIST_ITEM_ITEM", $role);
653 $tpl->parseCurrentBlock();
654 }
655 } else {
656 $tpl->setVariable("NONE", $this->lng->txt('none'));
657 }
658
659 return $tpl->get();
660 }
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 692 of file class.ilRegistrationSettingsGUI.php.

693 {
694 global $DIC;
695
696 $lng = $DIC['lng'];
697
699
700 include_once './Services/AccessControl/classes/class.ilObjRole.php';
701
702 $all = array();
703 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
704 switch ($this->access_limitations_obj->getMode($role['id'])) {
705 case 'absolute':
706 $txt_access_value = $lng->txt('reg_access_limitation_limited_until');
707 $txt_access_value .= " " . ilDatePresentation::formatDate(new ilDateTime($this->access_limitations_obj->getAbsolute($role['id'], IL_CAL_UNIX)));
708 break;
709
710 case 'relative':
711 $years = $this->access_limitations_obj->getRelative($role['id'], 'y');
712 $months = $this->access_limitations_obj->getRelative($role['id'], 'm');
713 $days = $this->access_limitations_obj->getRelative($role['id'], 'd');
714
715 $txt_access_value = $lng->txt('reg_access_limitation_limited_time') . " ";
716
717 if ($years) {
718 $txt_access_value .= $years . " ";
719 $txt_access_value .= ($years == 1) ? $lng->txt('year') : $lng->txt('years');
720
721 if ($months) {
722 if ($days) {
723 $txt_access_value .= ", ";
724 } else {
725 $txt_access_value .= " " . $lng->txt('and') . " ";
726 }
727 } elseif ($days) {
728 $txt_access_value .= " " . $lng->txt('and') . " ";
729 }
730 }
731
732 if ($months) {
733 $txt_access_value .= $months . " ";
734 $txt_access_value .= ($months == 1) ? $lng->txt('month') : $lng->txt('months');
735
736 if ($days) {
737 $txt_access_value .= " " . $lng->txt('and') . " ";
738 }
739 }
740
741 if ($days) {
742 $txt_access_value .= $days . " ";
743 $txt_access_value .= ($days == 1) ? $lng->txt('day') : $lng->txt('days');
744 }
745 break;
746
747 default:
748 $txt_access_value = $lng->txt('reg_access_limitation_none');
749 break;
750 }
751
752 $all[] = $role['title'] . ' (' . $txt_access_value . ')';
753 }
754
755 return $all;
756 }
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, $lng, __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 673 of file class.ilRegistrationSettingsGUI.php.

674 {
675 include_once './Services/AccessControl/classes/class.ilObjRole.php';
676 $this->__initRoleAssignments();
677
678 $all = array();
679 foreach ($this->assignments_obj->getAssignments() as $assignment) {
680 if (strlen($assignment['domain']) and $assignment['role']) {
681 $all[] = $assignment['domain'] . ' -> ' . ilObjRole::_lookupTitle($assignment['role']);
682 }
683 }
684
685 if (strlen($this->assignments_obj->getDefaultRole())) {
686 $all[] = $this->lng->txt('reg_default') . ' -> ' . ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
687 }
688
689 return $all;
690 }
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:

◆ __prepareDateSelect()

ilRegistrationSettingsGUI::__prepareDateSelect (   $a_unix_time)

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

801 {
802 if (!$a_unix_time) {
803 $a_unix_time = time();
804 }
805
806 return array('y' => date('Y', $a_unix_time),
807 'm' => date('n', $a_unix_time),
808 'd' => date('d', $a_unix_time));
809 }

Referenced by editRoleAccessLimitations().

+ Here is the caller graph for this function:

◆ __prepareRoleList()

ilRegistrationSettingsGUI::__prepareRoleList ( )

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

663 {
664 include_once './Services/AccessControl/classes/class.ilObjRole.php';
665
666 $all = array();
667 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
668 $all[] = $role['title'];
669 }
670 return $all;
671 }

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

942 {
943 global $DIC;
944
945 $ilAccess = $DIC['ilAccess'];
946 $ilErr = $DIC['ilErr'];
947
948 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
949 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
950 }
951
952 $this->setSubTabs('registration_codes');
953
954 $this->initAddCodesForm();
955
956 // default
957 $limit = $this->form_gui->getItemByPostVar("reg_limit");
958 $limit->setValue("none");
959
960 $this->tpl->setContent($this->form_gui->getHTML());
961 }
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 1108 of file class.ilRegistrationSettingsGUI.php.

1109 {
1110 include_once("./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1111 $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1112 $utab->resetOffset();
1113 $utab->writeFilterToSession();
1114
1115 $this->listCodes();
1116 }
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 963 of file class.ilRegistrationSettingsGUI.php.

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

1057 {
1058 $this->checkAccess("write");
1059
1060 include_once './Services/Registration/classes/class.ilRegistrationCode.php';
1062
1063 ilUtil::sendSuccess($this->lng->txt('info_deleted'), true);
1064 $this->ctrl->redirect($this, "listCodes");
1065 }
$_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 1067 of file class.ilRegistrationSettingsGUI.php.

1068 {
1069 $this->checkAccess("write");
1070
1071 global $DIC;
1072
1073 $ilErr = $DIC['ilErr'];
1074 $ilias = $DIC['ilias'];
1075
1076 if (!isset($_POST["id"])) {
1077 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1078 }
1079
1080 $this->setSubTabs('registration_codes');
1081
1082 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
1083 $gui = new ilConfirmationGUI();
1084 $gui->setHeaderText($this->lng->txt("info_delete_sure"));
1085 $gui->setCancel($this->lng->txt("cancel"), "listCodes");
1086 $gui->setConfirm($this->lng->txt("confirm"), "deleteCodes");
1087 $gui->setFormAction($this->ctrl->getFormAction($this, "deleteCodes"));
1088
1089 include_once './Services/Registration/classes/class.ilRegistrationCode.php';
1091 foreach ($data as $code) {
1092 $gui->addItem("id[]", $code["code_id"], $code["code"]);
1093 }
1094
1095 $this->tpl->setContent($gui->getHTML());
1096 }
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 419 of file class.ilRegistrationSettingsGUI.php.

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

References $DIC, $ilCtrl, $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 ( )

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

493 {
494 global $DIC;
495
496 $lng = $DIC['lng'];
497 $ilAccess = $DIC['ilAccess'];
498 $ilErr = $DIC['ilErr'];
499 $rbacreview = $DIC['rbacreview'];
500
501 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
502 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
503 }
504
506
507 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.reg_role_access_limitations.html', 'Services/Registration');
508
509 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
510 $this->tpl->setVariable("TXT_REG_ROLE_ACCESS_LIMITATIONS", $lng->txt('reg_role_access_limitations'));
511 $this->tpl->setVariable("TXT_ROLE", $lng->txt('obj_role'));
512 $this->tpl->setVariable("TXT_ACCESS_LIMITATION_MODE", $lng->txt('reg_access_limitation_mode'));
513
514 $this->tpl->setVariable("BTN_SAVE", $lng->txt('save'));
515 $this->tpl->setVariable("BTN_CANCEL", $lng->txt('cancel'));
516
517 $counter = 0;
518 include_once './Services/AccessControl/classes/class.ilObjRole.php';
519
520 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
521 $this->tpl->setCurrentBlock("roles");
522 $this->tpl->setVariable("CSSROW", ilUtil::switchColor(++$counter, 'tblrow1', 'tblrow1'));
523 $this->tpl->setVariable("ROLE_ID", $role['id']);
524 $this->tpl->setVariable("ROLE_TITLE", $role['title']);
525 $this->tpl->setVariable("SEL_ACCESS_LIMITATION", $this->__buildAccessLimitationSelection($role['id']));
526 $this->tpl->setVariable("CSS_DISPLAY_ABSOLUTE", ($this->access_limitations_obj->getMode($role['id']) == 'absolute') ? 'inline' : 'none');
527 $this->tpl->setVariable("CSS_DISPLAY_RELATIVE", ($this->access_limitations_obj->getMode($role['id']) == 'relative') ? 'inline' : 'none');
528 $this->tpl->setVariable("CSS_DISPLAY_UNLIMITED", ($this->access_limitations_obj->getMode($role['id']) == 'unlimited') ? 'inline' : 'none');
529 $this->tpl->setVariable("TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt('reg_access_limitation_none'));
530
531 $date = $this->__prepareDateSelect($this->access_limitations_obj->getAbsolute($role['id']));
532 $this->tpl->setVariable("SEL_ACCESS_LIMITATION_ABSOLUTE", ilUtil::makeDateSelect('access_limitation_absolute_' . $role['id'], $date['y'], $date['m'], $date['d'], '2007'));
533
534 $this->tpl->setVariable("TXT_DAYS", $lng->txt('days'));
535 $this->tpl->setVariable("TXT_MONTHS", $lng->txt('months'));
536 $this->tpl->setVariable("TXT_YEARS", $lng->txt('years'));
537
538 $this->tpl->setVariable("DAYS", $this->access_limitations_obj->getRelative($role['id'], 'd'));
539 $this->tpl->setVariable("MONTHS", $this->access_limitations_obj->getRelative($role['id'], 'm'));
540 $this->tpl->setVariable("YEARS", $this->access_limitations_obj->getRelative($role['id'], 'y'));
541 $this->tpl->parseCurrentBlock();
542 }
543 }
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static makeDateSelect($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true, $a_further_options=array(), $emptyoption=false)
Creates a combination of HTML selects for date inputs.

References $DIC, $ilErr, $lng, __buildAccessLimitationSelection(), __initRoleAccessLimitations(), __prepareDateSelect(), ilObjRole\_lookupRegisterAllowed(), ilUtil\makeDateSelect(), and ilUtil\switchColor().

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

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

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

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

1119 {
1120 global $DIC;
1121
1122 $ilAccess = $DIC['ilAccess'];
1123 $ilErr = $DIC['ilErr'];
1124
1125 if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
1126 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
1127 }
1128
1129 include_once("./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1130 $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1131
1132 include_once './Services/Registration/classes/class.ilRegistrationCode.php';
1133 $codes = ilRegistrationCode::getCodesForExport($utab->filter["code"], $utab->filter["role"], $utab->filter["generated"], $utab->filter["alimit"]);
1134
1135 if (sizeof($codes)) {
1136 ilUtil::deliverData(implode("\r\n", $codes), "ilias_registration_codes_" . date("d-m-Y") . ".txt", "text/plain");
1137 } else {
1138 ilUtil::sendFailure($this->lng->txt("registration_export_codes_no_data"));
1139 $this->listCodes();
1140 }
1141 }
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 932 of file class.ilRegistrationSettingsGUI.php.

933 {
934 $q = $_REQUEST["term"];
935 include_once("./Services/AccessControl/classes/class.ilRoleAutoComplete.php");
936 $list = ilRoleAutoComplete::getList($q);
937 echo $list;
938 exit;
939 }
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 830 of file class.ilRegistrationSettingsGUI.php.

831 {
832 global $DIC;
833
834 $rbacreview = $DIC['rbacreview'];
835 $ilObjDataCache = $DIC['ilObjDataCache'];
836 $lng = $DIC['lng'];
837
838 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
839
840 $this->form_gui = new ilPropertyFormGUI();
841 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'createCodes'));
842 $this->form_gui->setTitle($this->lng->txt('registration_codes_edit_header'));
843
844 $count = new ilNumberInputGUI($this->lng->txt('registration_codes_number'), 'reg_codes_number');
845 $count->setSize(4);
846 $count->setMaxLength(4);
847 $count->setMinValue(1);
848 $count->setMaxValue(1000);
849 $count->setRequired(true);
850 $this->form_gui->addItem($count);
851
852 // type
853 $code_type = new ilCheckboxGroupInputGUI($this->lng->txt('registration_codes_type'), 'code_type');
854 $code_type->setRequired(true);
855
856 $code_type->addOption(
858 $this->lng->txt('registration_codes_type_reg'),
859 self::CODE_TYPE_REGISTRATION,
860 $this->lng->txt('registration_codes_type_reg_info')
861 )
862 );
863 $code_type->addOption(
865 $this->lng->txt('registration_codes_type_ext'),
866 self::CODE_TYPE_EXTENSION,
867 $this->lng->txt('registration_codes_type_ext_info')
868 )
869 );
870 $this->form_gui->addItem($code_type);
871
872
873 $sec = new ilFormSectionHeaderGUI();
874 $sec->setTitle($this->lng->txt('registration_codes_roles_title'));
875 $this->form_gui->addItem($sec);
876
877 include_once './Services/AccessControl/classes/class.ilObjRole.php';
878 $options = array("" => $this->lng->txt('registration_codes_no_assigned_role'));
879 foreach ($rbacreview->getGlobalRoles() as $role_id) {
880 if (!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID))) {
881 $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
882 }
883 }
884 $roles = new ilSelectInputGUI($this->lng->txt("registration_codes_roles"), "reg_codes_role");
885 $roles->setInfo($this->lng->txt("registration_codes_override_info"));
886 $roles->setOptions($options);
887 $this->form_gui->addItem($roles);
888
889 $local = new ilTextInputGUI($this->lng->txt("registration_codes_roles_local"), "reg_codes_local");
890 $local->setMulti(true);
891 $local->setDataSource($this->ctrl->getLinkTarget($this, "getLocalRoleAutoComplete", "", true));
892 $this->form_gui->addItem($local);
893
894
895 $sec = new ilFormSectionHeaderGUI();
896 $sec->setTitle($this->lng->txt('reg_access_limitations'));
897 $this->form_gui->addItem($sec);
898
899 $limit = new ilRadioGroupInputGUI($this->lng->txt("reg_access_limitation_mode"), "reg_limit");
900 $limit->setInfo($this->lng->txt("registration_codes_override_info"));
901 $this->form_gui->addItem($limit);
902
903 $opt = new ilRadioOption($this->lng->txt("registration_codes_roles_limitation_none"), "none");
904 $limit->addOption($opt);
905
906 $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_none"), "unlimited");
907 $limit->addOption($opt);
908
909 $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_absolute"), "absolute");
910 $limit->addOption($opt);
911
912 $dt = new ilDateTimeInputGUI($this->lng->txt("reg_access_limitation_mode_absolute_target"), "abs_date");
913 $dt->setRequired(true);
914 $opt->addSubItem($dt);
915
916 $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_relative"), "relative");
917 $limit->addOption($opt);
918
919 $dur = new ilDurationInputGUI($this->lng->txt("reg_access_limitation_mode_relative_target"), "rel_date");
920 $dur->setRequired(true);
921 $dur->setShowMonths(true);
922 $dur->setShowDays(true);
923 $dur->setShowHours(false);
924 $dur->setShowMinutes(false);
925 $opt->addSubItem($dur);
926
927 $this->form_gui->addCommandButton('createCodes', $this->lng->txt('create'));
928 $this->form_gui->addCommandButton('listCodes', $this->lng->txt('cancel'));
929 }
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, and $lng.

Referenced by addCodes(), and createCodes().

+ Here is the caller graph for this function:

◆ initEmailAssignmentForm()

ilRegistrationSettingsGUI::initEmailAssignmentForm ( )

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

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

References $DIC, and ilObject\_lookupTitle().

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

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

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

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:

◆ listCodes()

ilRegistrationSettingsGUI::listCodes ( )

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

812 {
813 global $DIC;
814 $this->checkAccess("visible,read");
815
816 $this->setSubTabs('registration_codes');
817
818 if ($this->checkAccessBool("write")) {
819 $DIC->toolbar()->addButton(
820 $this->lng->txt("registration_codes_add"),
821 $this->ctrl->getLinkTarget($this, "addCodes")
822 );
823 }
824
825 include_once("./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
826 $ctab = new ilRegistrationCodesTableGUI($this, "listCodes");
827 $this->tpl->setContent($ctab->getHTML());
828 }

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

1099 {
1100 include_once("./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
1101 $utab = new ilRegistrationCodesTableGUI($this, "listCodes");
1102 $utab->resetOffset();
1103 $utab->resetFilter();
1104
1105 $this->listCodes();
1106 }

References listCodes().

+ Here is the call graph for this function:

◆ save()

ilRegistrationSettingsGUI::save ( )

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

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

546 {
547 global $DIC;
548
549 $ilAccess = $DIC['ilAccess'];
550 $ilErr = $DIC['ilErr'];
551 $rbacreview = $DIC['rbacreview'];
552
553 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
554 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
555 }
556
557 $this->__initRoleAssignments();
558
559 $form = $this->initEmailAssignmentForm();
560 if (!$form->checkInput()) {
561 $form->setValuesByPost();
562 $this->editEmailAssignments($form);
563 return false;
564 }
565
566 $this->assignments_obj->deleteAll();
567
568 $counter = 0;
569 foreach ($rbacreview->getGlobalRoles() as $role_id) {
570 if ($role_id == ANONYMOUS_ROLE_ID) {
571 continue;
572 }
573
574 $domain_input = $form->getInput("domain_$role_id");
575 $role_assigned_input = $form->getInput("role_assigned_$role_id");
576
577
578 if (!empty($role_assigned_input)) {
579 foreach ($domain_input as $domain) {
580 if (!empty($domain)) {
581 $this->assignments_obj->setDomain($counter, ilUtil::stripSlashes($domain));
582 $this->assignments_obj->setRole($counter, ilUtil::stripSlashes($role_id));
583 $counter++;
584 }
585 }
586 }
587 }
588
589 $default_role = $form->getInput("default_role");
590 $this->assignments_obj->setDefaultRole((int) $default_role);
591
592 $this->assignments_obj->save();
593 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
594 $this->view();
595 return true;
596 }
editEmailAssignments(ilPropertyFormGUI $form=null)

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

+ Here is the call graph for this function:

◆ saveRoleAccessLimitations()

ilRegistrationSettingsGUI::saveRoleAccessLimitations ( )

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

599 {
600 global $DIC;
601
602 $ilAccess = $DIC['ilAccess'];
603 $ilErr = $DIC['ilErr'];
604 $rbacreview = $DIC['rbacreview'];
605
606 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
607 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
608 }
609
611
612 include_once './Services/AccessControl/classes/class.ilObjRole.php';
613
614 $this->access_limitations_obj->resetAccessLimitations();
615 foreach (ilObjRole::_lookupRegisterAllowed() as $role) {
616 $this->access_limitations_obj->setMode($_POST['access_limitation_mode_' . $role['id']], $role['id']);
617 $this->access_limitations_obj->setAbsolute($_POST['access_limitation_absolute_' . $role['id']], $role['id']);
618 $this->access_limitations_obj->setRelative($_POST['access_limitation_relative_' . $role['id']], $role['id']);
619 }
620
621 if ($err = $this->access_limitations_obj->validate()) {
622 switch ($err) {
624 ilUtil::sendFailure($this->lng->txt('reg_access_limitation_missing_mode'));
625 break;
626
628 ilUtil::sendFailure($this->lng->txt('reg_access_limitation_out_of_date'));
629 break;
630 }
632 return false;
633 }
634
635
636 $this->access_limitations_obj->save();
637 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
638 $this->view();
639 return true;
640 }
const IL_REG_ACCESS_LIMITATION_MISSING_MODE
Class class.ilRegistrationAccessLimitation.

References $_POST, $DIC, $ilErr, __initRoleAccessLimitations(), ilObjRole\_lookupRegisterAllowed(), editRoleAccessLimitations(), IL_REG_ACCESS_LIMITATION_MISSING_MODE, IL_REG_ACCESS_LIMITATION_OUT_OF_DATE, 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['ilTabs'];
115 $lng = $DIC['lng'];
116
117 $ilTabs->addSubTab(
118 "registration_settings",
119 $lng->txt("registration_tab_settings"),
120 $this->ctrl->getLinkTarget($this, 'view')
121 );
122
123 $ilTabs->addSubTab(
124 "registration_codes",
125 $lng->txt("registration_tab_codes"),
126 $this->ctrl->getLinkTarget($this, 'listCodes')
127 );
128
129 $ilTabs->activateSubTab($activeTab);
130 }

References $DIC, and $lng.

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

+ Here is the caller graph for this function:

◆ updateRoles()

ilRegistrationSettingsGUI::updateRoles ( )

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

389 {
390 global $DIC;
391
392 $ilAccess = $DIC['ilAccess'];
393 $ilErr = $DIC['ilErr'];
394 $rbacreview = $DIC['rbacreview'];
395
396 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
397 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
398 }
399 // Minimum one role
400 if (count($_POST['roles']) < 1) {
401 ilUtil::sendFailure($this->lng->txt('msg_last_role_for_registration'));
402 $this->editRoles();
403 return false;
404 }
405 // update allow register
406 foreach ($rbacreview->getGlobalRoles() as $role) {
407 if ($role_obj = ilObjectFactory::getInstanceByObjId($role, false)) {
408 $role_obj->setAllowRegister($_POST['roles'][$role] ? 1 : 0);
409 $role_obj->update();
410 }
411 }
412
413 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
414 $this->view();
415
416 return true;
417 }
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 254 of file class.ilRegistrationSettingsGUI.php.

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

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: