24require_once 
'./Services/Registration/classes/class.ilRegistrationSettings.php';
 
   50        $this->tpl = 
$DIC[
'tpl'];
 
   51        $this->ctrl = 
$DIC->ctrl();
 
   52        $this->rbacsystem = 
$DIC->rbac();
 
   54        $this->lng = 
$DIC->language();
 
   55        $this->lng->loadLanguageModule(
'administration');
 
   56        $this->lng->loadLanguageModule(
'registration');
 
   57        $this->lng->loadLanguageModule(
'user');
 
   59        $this->ref_id = (int) 
$_GET[
'ref_id'];
 
   66        $next_class = $this->ctrl->getNextClass($this);
 
   67        $cmd = $this->ctrl->getCmd();
 
   68        switch ($next_class) {
 
   89            $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'), 
$ilErr->WARNING);
 
  101        $access = 
$DIC->access();
 
  103        return $access->checkAccess($a_permission, 
'', $this->ref_id);
 
  110    public function setSubTabs($activeTab = 
'registration_settings')
 
  114        $ilTabs = 
$DIC->tabs();
 
  117            "registration_settings",
 
  118            $this->lng->txt(
"registration_tab_settings"),
 
  119            $this->ctrl->getLinkTarget($this, 
'view')
 
  123            "registration_codes",
 
  124            $this->lng->txt(
"registration_tab_codes"),
 
  125            $this->ctrl->getLinkTarget($this, 
'listCodes')
 
  128        $ilTabs->activateSubTab($activeTab);
 
  134        $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'save'));
 
  135        $this->form_gui->setTitle($this->lng->txt(
'reg_settings_header'));
 
  140        $option->setInfo($this->lng->txt(
'reg_direct_info'));
 
  142        $cd->setInfo($this->lng->txt(
'reg_allow_codes_info'));
 
  143        $option->addSubItem($cd);
 
  144        $reg_type->addOption($option);
 
  146        $option->setInfo($this->lng->txt(
'reg_approve_info'));
 
  148        $cd->setInfo($this->lng->txt(
'reg_allow_codes_info'));
 
  149        $option->addSubItem($cd);
 
  150        $reg_type->addOption($option);
 
  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');
 
  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);
 
  162        $cd->setInfo($this->lng->txt(
'reg_allow_codes_info'));
 
  163        $option->addSubItem($cd);
 
  164        $reg_type->addOption($option);
 
  166        $option->setInfo($this->lng->txt(
'registration_reg_type_codes_info'));
 
  167        $reg_type->addOption($option);
 
  168        $this->form_gui->addItem($reg_type);
 
  171        $pwd_gen->setValue(1);
 
  172        $pwd_gen->setInfo($this->lng->txt(
'reg_info_pwd'));
 
  173        $this->form_gui->addItem($pwd_gen);
 
  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'));
 
  180            $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
 
  182        $this->form_gui->addItem($cap);
 
  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);
 
  193        $edit = $this->ctrl->getLinkTarget($this, 
'editRoles');
 
  195        $option->addSubItem($list);
 
  196        $roles->addOption($option);
 
  199        $edit = $this->ctrl->getLinkTarget($this, 
'editEmailAssignments');
 
  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);
 
  206        $limit = 
new ilCheckboxInputGUI($this->lng->txt(
'reg_access_limitations'), 
'reg_access_limitation');
 
  209        $edit = $this->ctrl->getLinkTarget($this, 
'editRoleAccessLimitations');
 
  211        $list->setInfo($this->lng->txt(
'registration_codes_override_global_info'));
 
  212        $limit->addSubItem($list);
 
  213        $this->form_gui->addItem($limit);
 
  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);
 
  219        if ($this->rbacsystem->system()->checkAccess(
"write", $this->ref_id)) {
 
  220            $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
 
  226        if ($this->registration_settings->roleSelectionEnabled()) {
 
  228        } elseif ($this->registration_settings->automaticRoleAssignmentEnabled()) {
 
  232        require_once 
'Services/Captcha/classes/class.ilCaptchaUtil.php';
 
  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()
 
  244        $allow_codes = $this->registration_settings->getAllowCodes();
 
  245        $reg_type = $this->registration_settings->getRegistrationType();
 
  247            $values[
'reg_codes_' . $reg_type] = 
true;
 
  250        $this->form_gui->setValuesByArray($values);
 
  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);
 
  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",
 
  268            ), 
"newAccountMail"));
 
  269            $this->ctrl->setParameterByClass(
"ilobjuserfoldergui", 
"ref_id", 
$_GET[
"ref_id"]);
 
  274        $this->tpl->setContent($this->form_gui->getHTML());
 
  281        $ilAccess = 
$DIC->access();
 
  284        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  285            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  288        $this->registration_settings->setRegistrationType((
int) 
$_POST[
'reg_type']);
 
  289        $this->registration_settings->setPasswordGenerationStatus((
int) 
$_POST[
'reg_pwd']);
 
  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']);
 
  295        $allow_codes = 
false;
 
  297            $allow_codes = (bool) 
$_POST[
'reg_codes_' . (
int) 
$_POST[
'reg_type']];
 
  299        $this->registration_settings->setAllowCodes($allow_codes);
 
  301        if (!preg_match(
'/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (
int) 
$_POST[
'reg_hash_life_time'])) {
 
  307        if ($error_code = $this->registration_settings->validate()) {
 
  308            switch ($error_code) {
 
  311                    ilUtil::sendFailure($this->lng->txt(
'reg_unknown_recipients') . 
' ' . $this->registration_settings->getUnknown());
 
  317                    ilUtil::sendFailure($this->lng->txt(
'reg_approve_needs_recipient') . 
' ' . $this->registration_settings->getUnknown());
 
  324        require_once 
'Services/Captcha/classes/class.ilCaptchaUtil.php';
 
  325        ilCaptchaUtil::setActiveForRegistration((
bool) 
$_POST[
'activate_captcha_anonym']);
 
  327        $this->registration_settings->save();
 
  328        ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
 
  339        $ilAccess = 
$DIC->access();
 
  341        $ilTabs = 
$DIC->tabs();
 
  342        $ilCtrl = 
$DIC->ctrl();
 
  343        $rbacreview = 
$DIC->rbac()->review();
 
  345        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  346            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  349        $ilTabs->clearTargets();
 
  350        $ilTabs->setBackTarget(
 
  351            $this->lng->txt(
"registration_settings"),
 
  352            $ilCtrl->getLinkTarget($this, 
"view")
 
  356        $role_form->setFormAction($this->ctrl->getFormAction($this, 
'save'));
 
  357        $role_form->setTitle($this->lng->txt(
'reg_selectable_roles'));
 
  359        $roles = new \ilCheckboxGroupInputGUI($this->lng->txt(
'reg_available_roles'), 
'roles');
 
  360        $allowed_roles = array();
 
  361        foreach ($rbacreview->getGlobalRoles() as $role) {
 
  366            $role_option->setValue($role);
 
  367            $roles->addOption($role_option);
 
  372        $roles->setUseValuesAsKeys(
true);
 
  373        $roles->setValue($allowed_roles);
 
  374        $role_form->addItem($roles);
 
  377        if ($this->rbacsystem->system()->checkAccess(
"write", $this->ref_id)) {
 
  378            $role_form->addCommandButton(
"updateRoles", $this->lng->txt(
"save"));
 
  380        $role_form->addCommandButton(
"view", $this->lng->txt(
"cancel"));
 
  383        $this->tpl->setContent($role_form->getHTML());
 
  390        $ilAccess = 
$DIC->access();
 
  392        $rbacreview = 
$DIC->rbac()->review();
 
  394        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  395            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  398        if (count(
$_POST[
'roles']) < 1) {
 
  404        foreach ($rbacreview->getGlobalRoles() as $role) {
 
  406                $role_obj->setAllowRegister(
$_POST[
'roles'][$role] ? 1 : 0);
 
  411        ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
 
  421        $ilAccess = 
$DIC->access();
 
  423        $ilTabs = 
$DIC->tabs();
 
  424        $ilCtrl = 
$DIC->ctrl();
 
  426        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  427            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  430        $ilTabs->clearTargets();
 
  431        $ilTabs->setBackTarget(
 
  432            $this->lng->txt(
"registration_settings"),
 
  433            $ilCtrl->getLinkTarget($this, 
"view")
 
  440        $this->tpl->setContent($form->getHTML());
 
  447        $rbacreview = 
$DIC->rbac()->review();
 
  450        $role_assignment_form->setFormAction($this->ctrl->getFormAction($this));
 
  451        $role_assignment_form->setTitle($this->lng->txt(
'reg_email_role_assignment'));
 
  453        $global_roles = [
"" => $this->lng->txt(
"links_select_one")];
 
  454        foreach ($rbacreview->getGlobalRoles() as $role_id) {
 
  462            $domains = $this->assignments_obj->getDomainsByRole($role_id);
 
  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);
 
  473            $role_assignments->addSubItem($domain);
 
  474            $role_assignment_form->addItem($role_assignments);
 
  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);
 
  484        $role_assignment_form->addCommandButton(
"saveAssignment", $this->lng->txt(
"save"));
 
  485        $role_assignment_form->addCommandButton(
"view", $this->lng->txt(
"cancel"));
 
  487        return $role_assignment_form;
 
  494        $ilAccess = 
$DIC->access();
 
  496        $ilTabs = 
$DIC->tabs();
 
  497        $ilCtrl = 
$DIC->ctrl();
 
  499        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  500            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  503        $ilTabs->clearTargets();
 
  504        $ilTabs->setBackTarget(
 
  505            $this->lng->txt(
"registration_settings"),
 
  506            $ilCtrl->getLinkTarget($this, 
"view")
 
  513        $this->tpl->setContent($form->getHTML());
 
  520        $form->setFormAction($this->ctrl->getFormAction($this));
 
  521        $form->setTitle($this->lng->txt(
'reg_role_access_limitations'));
 
  527            $op_unlimited = 
new ilRadioOption($this->lng->txt(
'reg_access_limitation_mode_unlimited'), 
"unlimited");
 
  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);
 
  532            $date->setDate($absolute_date);
 
  533            $op_absolute->addSubItem($date);
 
  535            $op_relative = 
new ilRadioOption($this->lng->txt(
'reg_access_limitation_mode_relative'), 
"relative");
 
  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);
 
  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);
 
  552        $form->addCommandButton(
"saveRoleAccessLimitations", $this->lng->txt(
"save"));
 
  553        $form->addCommandButton(
"view", $this->lng->txt(
"cancel"));
 
  563        $ilAccess = 
$DIC->access();
 
  565        $rbacreview = 
$DIC->rbac()->review();
 
  567        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  568            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  574        if (!$form->checkInput()) {
 
  575            $form->setValuesByPost();
 
  580        $this->assignments_obj->deleteAll();
 
  583        foreach ($rbacreview->getGlobalRoles() as $role_id) {
 
  588            $domain_input = $form->getInput(
"domain_$role_id");
 
  589            $role_assigned_input = $form->getInput(
"role_assigned_$role_id");
 
  592            if (!empty($role_assigned_input)) {
 
  593                foreach ($domain_input as $domain) {
 
  594                    if (!empty($domain)) {
 
  603        $default_role = $form->getInput(
"default_role");
 
  604        $this->assignments_obj->setDefaultRole((
int) $default_role);
 
  606        $this->assignments_obj->save();
 
  607        ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
 
  616        $ilAccess = 
$DIC->access();
 
  619        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  620            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  626        if(!$form->checkInput()) {
 
  627            $form->setValuesByPost();
 
  632        $this->access_limitations_obj->resetAccessLimitations();
 
  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']);
 
  639        if ($err = $this->access_limitations_obj->validate()) {
 
  654        $this->access_limitations_obj->save();
 
  655        ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
 
  662        $tpl = 
new ilTemplate(
'tpl.registration_roles.html', 
true, 
true, 
'Services/Registration');
 
  664        $tpl->setVariable(
"EDIT", $this->lng->txt(
"edit"));
 
  665        $tpl->setVariable(
"LINK_EDIT", 
$url);
 
  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();
 
  674            $tpl->setVariable(
"NONE", $this->lng->txt(
'none'));
 
  685            $all[] = $role[
'title'];
 
  695        foreach ($this->assignments_obj->getAssignments() as $assignment) {
 
  696            if (strlen($assignment[
'domain']) and $assignment[
'role']) {
 
  701        if (strlen($this->assignments_obj->getDefaultRole())) {
 
  702            $all[] = $this->lng->txt(
'reg_default') . 
' -> ' . 
ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
 
  717            switch ($this->access_limitations_obj->getMode($role[
'id'])) {
 
  719                    $txt_access_value = $this->lng->txt(
'reg_access_limitation_limited_until');
 
  724                    $months = $this->access_limitations_obj->getRelative($role[
'id'], 
'm');
 
  725                    $days = $this->access_limitations_obj->getRelative($role[
'id'], 
'd');
 
  727                    $txt_access_value = $this->lng->txt(
'reg_access_limitation_limited_time') . 
" ";
 
  731                                $txt_access_value .= 
", ";
 
  733                            $txt_access_value .= 
" " . $this->lng->txt(
'and') . 
" ";
 
  736                        $txt_access_value .= 
" " . $this->lng->txt(
'and') . 
" ";
 
  740                        $txt_access_value .= $months . 
" ";
 
  741                        $txt_access_value .= ($months == 1) ? $this->lng->txt(
'month') : $this->lng->txt(
'months');
 
  744                            $txt_access_value .= 
" " . $this->lng->txt(
'and') . 
" ";
 
  749                        $txt_access_value .= $days . 
" ";
 
  750                        $txt_access_value .= ($days == 1) ? $this->lng->txt(
'day') : $this->lng->txt(
'days');
 
  755                    $txt_access_value = $this->lng->txt(
'reg_access_limitation_none');
 
  759            $all[] = $role[
'title'] . 
' (' . $txt_access_value . 
')';
 
  767        if (is_object($this->assignments_obj)) {
 
  776        if (is_object($this->access_limitations_obj)) {
 
  791            $DIC->toolbar()->addButton(
 
  792                $this->lng->txt(
"registration_codes_add"),
 
  793                $this->ctrl->getLinkTarget($this, 
"addCodes")
 
  798        $this->tpl->setContent($ctab->getHTML());
 
  805        $rbacreview = 
$DIC->rbac()->review();
 
  806        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  809        $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'createCodes'));
 
  810        $this->form_gui->setTitle($this->lng->txt(
'registration_codes_edit_header'));
 
  812        $count = 
new ilNumberInputGUI($this->lng->txt(
'registration_codes_number'), 
'reg_codes_number');
 
  814        $count->setMaxLength(4);
 
  815        $count->setMinValue(1);
 
  816        $count->setMaxValue(1000);
 
  817        $count->setRequired(
true);
 
  818        $this->form_gui->addItem($count);
 
  822        $code_type->setRequired(
true);
 
  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')
 
  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')
 
  838        $this->form_gui->addItem($code_type);
 
  842        $sec->setTitle($this->lng->txt(
'registration_codes_roles_title'));
 
  843        $this->form_gui->addItem($sec);
 
  845        $options = array(
"" => $this->lng->txt(
'registration_codes_no_assigned_role'));
 
  846        foreach ($rbacreview->getGlobalRoles() as $role_id) {
 
  848                $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
 
  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);
 
  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);
 
  863        $sec->setTitle($this->lng->txt(
'reg_access_limitations'));
 
  864        $this->form_gui->addItem($sec);
 
  867        $limit->setInfo($this->lng->txt(
"registration_codes_override_info"));
 
  868        $this->form_gui->addItem($limit);
 
  870        $opt = 
new ilRadioOption($this->lng->txt(
"registration_codes_roles_limitation_none"), 
"none");
 
  871        $limit->addOption($opt);
 
  873        $opt = 
new ilRadioOption($this->lng->txt(
"reg_access_limitation_none"), 
"unlimited");
 
  874        $limit->addOption($opt);
 
  876        $opt = 
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_absolute"), 
"absolute");
 
  877        $limit->addOption($opt);
 
  879        $dt = 
new ilDateTimeInputGUI($this->lng->txt(
"reg_access_limitation_mode_absolute_target"), 
"abs_date");
 
  880        $dt->setRequired(
true);
 
  881        $opt->addSubItem($dt);
 
  883        $opt = 
new ilRadioOption($this->lng->txt(
"reg_access_limitation_mode_relative"), 
"relative");
 
  884        $limit->addOption($opt);
 
  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);
 
  894        $this->form_gui->addCommandButton(
'createCodes', $this->lng->txt(
'create'));
 
  895        $this->form_gui->addCommandButton(
'listCodes', $this->lng->txt(
'cancel'));
 
  901        $q = $_REQUEST[
"term"];
 
  911        $ilAccess = 
$DIC->access();
 
  914        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  915            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  923        $limit = $this->form_gui->getItemByPostVar(
"reg_limit");
 
  924        $limit->setValue(
"none");
 
  926        $this->tpl->setContent($this->form_gui->getHTML());
 
  933        $ilAccess = 
$DIC->access();
 
  935        $rbacreview = 
$DIC->rbac()->review();
 
  937        if (!$ilAccess->checkAccess(
'write', 
'', $this->ref_id)) {
 
  938            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), 
$ilErr->MESSAGE);
 
  944        $valid = $this->form_gui->checkInput();
 
  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");
 
  950            if (is_array($local)) {
 
  952                foreach (array_unique($local) as $item) {
 
  954                        $role_id = $rbacreview->roleExists($item);
 
  956                            $role_ids[] = $role_id;
 
  960                if (
sizeof($role_ids)) {
 
  966            $limit = $this->form_gui->getInput(
"reg_limit");
 
  969                    $date_input = $this->form_gui->getItemByPostVar(
"abs_date");
 
  971                    if ($date < date(
"Y-m-d")) {
 
  972                        $date_input->setAlert($this->lng->txt(
"form_msg_wrong_date"));
 
  978                    $date = $this->form_gui->getInput(
"rel_date");
 
  979                    if (!array_sum($date)) {
 
  984                            "m" => $date[
"MM"] % 12,
 
  985                            "y" => floor($date[
"MM"] / 12)
 
  999            for ($loop = 1; $loop <= $number; $loop++) {
 
 1000                $code_types = (array) $this->form_gui->getInput(
'code_type');
 
 1008                    in_array(self::CODE_TYPE_REGISTRATION, $code_types) ? 
true : 
false,
 
 1009                    in_array(self::CODE_TYPE_EXTENSION, $code_types) ? 
true : 
false 
 1013            ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'), 
true);
 
 1014            $this->ctrl->redirect($this, 
"listCodes");
 
 1016            $this->form_gui->setValuesByPost();
 
 1017            $this->tpl->setContent($this->form_gui->getHtml());
 
 1025        include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
 1028        ilUtil::sendSuccess($this->lng->txt(
'info_deleted'), 
true);
 
 1029        $this->ctrl->redirect($this, 
"listCodes");
 
 1040        if (!isset(
$_POST[
"id"])) {
 
 1041            $ilErr->raiseError($this->lng->txt(
"no_checkbox"), 
$ilErr->MESSAGE);
 
 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"));
 
 1053        foreach (
$data as $code) {
 
 1054            $gui->addItem(
"id[]", $code[
"code_id"], $code[
"code"]);
 
 1057        $this->tpl->setContent($gui->getHTML());
 
 1063        $utab->resetOffset();
 
 1064        $utab->resetFilter();
 
 1072        $utab->resetOffset();
 
 1073        $utab->writeFilterToSession();
 
 1082        $ilAccess = 
$DIC->access();
 
 1085        if (!$ilAccess->checkAccess(
'read', 
'', $this->ref_id)) {
 
 1086            $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"), 
$ilErr->MESSAGE);
 
 1093        if (
sizeof($codes)) {
 
 1094            ilUtil::deliverData(implode(
"\r\n", $codes), 
"ilias_registration_codes_" . date(
"d-m-Y") . 
".txt", 
"text/plain");
 
An exception for terminatinating execution or to throw for unit testing.
const IL_REG_ACCESS_LIMITATION_OUT_OF_DATE
static checkFreetype()
Check whether captcha support is active.
This class represents an option in a checkbox group.
Confirmation screen class.
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 _lookupAllowRegister($a_role_id)
check whether role is allowed in user registration or not
static _lookupRegisterAllowed()
get all roles that are activated in user registration
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupTitle($a_id)
lookup object title
This class represents an option in a radio group.
static deleteCodes(array $ids)
static getCodesForExport($filter_code, $filter_role, $filter_generated, $filter_access_limitation)
static create($role, $stamp, $local_roles, $limit, $limit_date, $reg_type, $ext_type)
static loadCodesByIds(array $ids)
TableGUI class for registration codes.
Class ilRegistrationSettingsGUI.
__prepareAccessLimitationRoleList()
saveRoleAccessLimitations()
checkAccessBool($a_permission)
editRoleAccessLimitations(ilPropertyFormGUI $form=null)
const CODE_TYPE_EXTENSION
initEmailAssignmentForm()
getLocalRoleAutoComplete()
setSubTabs($activeTab='registration_settings')
set sub tabs
__initRoleAccessLimitations()
editEmailAssignments(ilPropertyFormGUI $form=null)
__parseRoleList($roles, $url)
__prepareAutomaticRoleList()
const CODE_TYPE_REGISTRATION
checkAccess($a_permission)
Class ilObjAuthSettingsGUI.
const REG_HASH_LIFETIME_MIN_VALUE
static getList($a_str)
Get completion list.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
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.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const IL_REG_ACCESS_LIMITATION_MISSING_MODE
Class class.ilRegistrationAccessLimitation.