24 require_once 
'./Services/Registration/classes/class.ilRegistrationSettings.php';
 
   50                 $this->lng->loadLanguageModule(
'administration');
 
   51                 $this->lng->loadLanguageModule(
'registration');
 
   53                 $this->ref_id = (int) 
$_GET[
'ref_id'];
 
   60                 $next_class = $this->ctrl->getNextClass($this);
 
   61                 $cmd = $this->ctrl->getCmd();
 
   79         function setSubTabs($activeTab = 
'registration_settings')
 
   83                 $ilTabs->addSubTab(
"registration_settings",
 
   84                         $lng->txt(
"registration_tab_settings"),
 
   85                         $this->ctrl->getLinkTarget($this, 
'view'));
 
   87                 $ilTabs->addSubTab(
"registration_codes",
 
   88                         $lng->txt(
"registration_tab_codes"),
 
   89                         $this->ctrl->getLinkTarget($this, 
'listCodes'));
 
   91                 $ilTabs->activateSubTab($activeTab);
 
   96                 include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
   99                 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'save'));
 
  100                 $this->form_gui->setTitle($this->lng->txt(
'reg_settings_header'));
 
  105                         $option->
setInfo($this->lng->txt(
'reg_direct_info'));
 
  106                                 $cd = 
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'), 
'reg_codes_'.IL_REG_DIRECT);
 
  107                                 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
 
  108                                 $option->addSubItem($cd);
 
  109                         $reg_type->addOption($option);
 
  111                         $option->
setInfo($this->lng->txt(
'reg_approve_info'));
 
  112                                 $cd = 
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'), 
'reg_codes_'.IL_REG_APPROVE);
 
  113                                 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
 
  114                                 $option->addSubItem($cd);
 
  115                         $reg_type->addOption($option);
 
  117                         $option->
setInfo($this->lng->txt(
'reg_type_confirmation_info'));
 
  118                                 $lt = 
new ilNumberInputGUI($this->lng->txt(
'reg_confirmation_hash_life_time'), 
'reg_hash_life_time');
 
  120                                 $lt->setMaxLength(5);
 
  122                                 $lt->setRequired(
true);
 
  123                                 $lt->setInfo($this->lng->txt(
'reg_confirmation_hash_life_time_info'));
 
  124                                 $lt->setSuffix($this->lng->txt(
'seconds'));
 
  125                                 $option->addSubItem($lt);
 
  126                                 $cd = 
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'), 
'reg_codes_'.IL_REG_ACTIVATION);
 
  127                                 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
 
  128                                 $option->addSubItem($cd);
 
  129                         $reg_type->addOption($option);
 
  131                         $option->
setInfo($this->lng->txt(
'registration_reg_type_codes_info'));
 
  132                         $reg_type->addOption($option);
 
  133                 $this->form_gui->addItem($reg_type);
 
  137                 $pwd_gen->setInfo($this->lng->txt(
'reg_info_pwd'));
 
  138                 $this->form_gui->addItem($pwd_gen);
 
  140                 $approver = 
new ilTextInputGUI($this->lng->txt(
'reg_notification'), 
'reg_approver');
 
  142                 $approver->setMaxLength(50);
 
  143                 $approver->setInfo($this->lng->txt(
'reg_notification_info'));
 
  144                 $this->form_gui->addItem($approver);
 
  149                                 $edit = $this->ctrl->getLinkTarget($this,
'editRoles');
 
  152                         $roles->addOption($option);
 
  155                                 $edit = $this->ctrl->getLinkTarget($this,
'editEmailAssignments');
 
  158                         $roles->addOption($option);
 
  159                 $this->form_gui->addItem($roles);
 
  161                 $limit = 
new ilCheckboxInputGUI($this->lng->txt(
'reg_access_limitations'), 
'reg_access_limitation');
 
  164                         $edit = $this->ctrl->getLinkTarget($this,
'editRoleAccessLimitations');
 
  167                 $this->form_gui->addItem($limit);
 
  169                 $domains = 
new ilTextInputGUI($this->lng->txt(
'reg_allowed_domains'), 
'reg_allowed_domains');
 
  170                 $domains->
setInfo($this->lng->txt(
'reg_allowed_domains_info'));
 
  171                 $this->form_gui->addItem($domains);
 
  173                 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
 
  178                 if($this->registration_settings->roleSelectionEnabled())
 
  182                 else if ($this->registration_settings->automaticRoleAssignmentEnabled())
 
  188                         'reg_type' => $this->registration_settings->getRegistrationType(),
 
  189                         'reg_hash_life_time' => (int)$this->registration_settings->getRegistrationHashLifetime(),
 
  190                         'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
 
  191                         'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
 
  192                         'reg_role_type' => $role_type,
 
  193                         'reg_access_limitation' => $this->registration_settings->getAccessLimitation(),
 
  194                         'reg_allowed_domains' => implode(
';', $this->registration_settings->getAllowedDomains())
 
  197                 $allow_codes = $this->registration_settings->getAllowCodes();
 
  198                 $reg_type = $this->registration_settings->getRegistrationType();
 
  201                         $values[
'reg_codes_'.$reg_type] = 
true;
 
  204                 $this->form_gui->setValuesByArray($values);
 
  211                 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
 
  213                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
 
  219                 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui", 
"ref_id", 
USER_FOLDER_ID);
 
  220                 $ilToolbar->addButton($this->lng->txt(
'registration_user_new_account_mail'),
 
  221                         $ilCtrl->getLinkTargetByClass(array(
"iladministrationgui", 
"ilobjuserfoldergui"), 
"newAccountMail"));
 
  222                 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui", 
"ref_id", 
$_GET[
"ref_id"]);
 
  226                 $this->tpl->setContent($this->form_gui->getHTML());
 
  233                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  235                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  238                 $this->registration_settings->setRegistrationType((
int) 
$_POST[
'reg_type']);
 
  239                 $this->registration_settings->setPasswordGenerationStatus((
int) $_POST[
'reg_pwd']);
 
  240                 $this->registration_settings->setApproveRecipientLogins(
ilUtil::stripSlashes($_POST[
'reg_approver']));
 
  241                 $this->registration_settings->setRoleType((
int) $_POST[
'reg_role_type']);
 
  242                 $this->registration_settings->setAccessLimitation((
int) $_POST[
'reg_access_limitation']);
 
  243                 $this->registration_settings->setAllowedDomains($_POST[
'reg_allowed_domains']);
 
  245                 $allow_codes = 
false;
 
  248                         $allow_codes = (bool)$_POST[
'reg_codes_'.(
int)$_POST[
'reg_type']];
 
  250                 $this->registration_settings->setAllowCodes($allow_codes);
 
  252                 if(!preg_match(
'/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (
int)$_POST[
'reg_hash_life_time']))
 
  257                 if($error_code = $this->registration_settings->validate())
 
  263                                         ilUtil::sendFailure($this->lng->txt(
'reg_unknown_recipients').
' '.$this->registration_settings->getUnknown());
 
  269                                         ilUtil::sendFailure($this->lng->txt(
'reg_approve_needs_recipient').
' '.$this->registration_settings->getUnknown());
 
  276                 $this->registration_settings->save();
 
  285                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  287                 global $ilAccess,
$ilErr,$rbacreview;
 
  289                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  291                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  294                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.edit_roles.html',
'Services/Registration');
 
  296                 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
 
  297                 $this->tpl->setVariable(
"TXT_SELECTABLE_ROLES",$this->lng->txt(
'reg_selectable_roles'));
 
  299                 $this->tpl->setVariable(
"ACTIONS",$this->lng->txt(
'actions'));
 
  300                 $this->tpl->setVariable(
"UPDATE",$this->lng->txt(
'save'));
 
  301                 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
 
  304                 foreach($rbacreview->getGlobalRoles() as $role)
 
  306                         if($role == SYSTEM_ROLE_ID or $role == ANONYMOUS_ROLE_ID)
 
  310                         $this->tpl->setCurrentBlock(
"roles");
 
  316                         $this->tpl->parseCurrentBlock();
 
  323                 global $ilAccess,
$ilErr,$rbacreview;
 
  325                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  327                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  330                 if(count(
$_POST[
'roles']) < 1)
 
  337                 foreach($rbacreview->getGlobalRoles() as $role)
 
  341                                 $role_obj->setAllowRegister(
$_POST[
'roles'][$role] ? 1 : 0);
 
  354                 global $ilAccess,
$ilErr,$rbacreview;
 
  356                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  358                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  363                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_email_role_assignments.html',
'Services/Registration');
 
  364                 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
 
  365                 $this->tpl->setVariable(
"TXT_EMAIL_ROLE_ASSIGN",$this->lng->txt(
'reg_email_role_assignment'));
 
  366                 $this->tpl->setVariable(
"TXT_MAIL",$this->lng->txt(
'reg_email'));
 
  367                 $this->tpl->setVariable(
"TXT_ROLE",$this->lng->txt(
'obj_role'));
 
  368                 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'reg_default'));
 
  370                 $this->tpl->setVariable(
"TXT_DOMAIN",$this->lng->txt(
'reg_domain'));
 
  373                 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
 
  374                 $this->tpl->setVariable(
"BTN_SAVE",$this->lng->txt(
'save'));
 
  375                 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
'reg_add_assignment'));
 
  376                 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
 
  379                 foreach($this->assignments_obj->getAssignments() as $assignment)
 
  381                         $this->tpl->setCurrentBlock(
"roles");
 
  383                         $this->tpl->setVariable(
"ASSIGN_ID",$assignment[
'id']);
 
  384                         $this->tpl->setVariable(
"DOMAIN",$assignment[
'domain']);
 
  387                         $this->tpl->parseCurrentBlock();
 
  391                 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'default'));
 
  399                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  401                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  406                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_role_access_limitations.html',
'Services/Registration');
 
  408                 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
 
  409                 $this->tpl->setVariable(
"TXT_REG_ROLE_ACCESS_LIMITATIONS",$lng->txt(
'reg_role_access_limitations'));
 
  410                 $this->tpl->setVariable(
"TXT_ROLE",$lng->txt(
'obj_role'));
 
  411                 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_MODE",$lng->txt(
'reg_access_limitation_mode'));
 
  413                 $this->tpl->setVariable(
"BTN_SAVE",$lng->txt(
'save'));
 
  414                 $this->tpl->setVariable(
"BTN_CANCEL",$lng->txt(
'cancel'));
 
  417                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  421                         $this->tpl->setCurrentBlock(
"roles");
 
  423                         $this->tpl->setVariable(
"ROLE_ID",$role[
'id']);
 
  424                         $this->tpl->setVariable(
"ROLE_TITLE",$role[
'title']);
 
  426                         $this->tpl->setVariable(
"CSS_DISPLAY_ABSOLUTE",($this->access_limitations_obj->getMode($role[
'id']) == 
'absolute') ? 
'inline' : 
'none');
 
  427                         $this->tpl->setVariable(
"CSS_DISPLAY_RELATIVE",($this->access_limitations_obj->getMode($role[
'id']) == 
'relative') ? 
'inline' : 
'none');
 
  428                         $this->tpl->setVariable(
"CSS_DISPLAY_UNLIMITED",($this->access_limitations_obj->getMode($role[
'id']) == 
'unlimited') ? 
'inline' : 
'none');
 
  429                         $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt(
'reg_access_limitation_none'));
 
  431                         $date = $this->
__prepareDateSelect($this->access_limitations_obj->getAbsolute($role[
'id']));
 
  432                         $this->tpl->setVariable(
"SEL_ACCESS_LIMITATION_ABSOLUTE",
ilUtil::makeDateSelect(
'access_limitation_absolute_'.$role[
'id'],$date[
'y'],$date[
'm'],$date[
'd'],
'2007'));
 
  434                         $this->tpl->setVariable(
"TXT_DAYS",$lng->txt(
'days'));
 
  435                         $this->tpl->setVariable(
"TXT_MONTHS",$lng->txt(
'months'));
 
  436                         $this->tpl->setVariable(
"TXT_YEARS",$lng->txt(
'years'));
 
  438                         $this->tpl->setVariable(
"DAYS",$this->access_limitations_obj->getRelative($role[
'id'],
'd'));
 
  439                         $this->tpl->setVariable(
"MONTHS",$this->access_limitations_obj->getRelative($role[
'id'],
'm'));
 
  440                         $this->tpl->setVariable(
"YEARS",$this->access_limitations_obj->getRelative($role[
'id'],
'y'));
 
  441                         $this->tpl->parseCurrentBlock();                        
 
  447                 global $ilAccess,
$ilErr,$rbacreview;
 
  449                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  451                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  455                 $this->assignments_obj->add();
 
  465                 global $ilAccess,
$ilErr,$rbacreview;
 
  467                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  469                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  472                 if(!count(
$_POST[
'del_assign']))
 
  481                 foreach(
$_POST[
'del_assign'] as $assignment_id)
 
  483                         $this->assignments_obj->delete($assignment_id);
 
  494                 global $ilAccess,
$ilErr,$rbacreview;
 
  496                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  498                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  503                 if (!is_array(
$_POST[
'domain']))
 
  505                         $_POST[
'domain'] = array();
 
  513                 $this->assignments_obj->setDefaultRole((
int) 
$_POST[
'default_role']);
 
  515                 if($err = $this->assignments_obj->validate())
 
  532                 $this->assignments_obj->save();
 
  540                 global $ilAccess,
$ilErr,$rbacreview;
 
  542                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  544                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  549                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  553                         $this->access_limitations_obj->setMode(
$_POST[
'access_limitation_mode_'.$role[
'id']],$role[
'id']);
 
  554                         $this->access_limitations_obj->setAbsolute(
$_POST[
'access_limitation_absolute_'.$role[
'id']],$role[
'id']);
 
  555                         $this->access_limitations_obj->setRelative(
$_POST[
'access_limitation_relative_'.$role[
'id']],$role[
'id']);
 
  560                 if($err = $this->access_limitations_obj->validate())
 
  577                 $this->access_limitations_obj->save();
 
  585                 $tpl = 
new ilTemplate(
'tpl.registration_roles.html', 
true, 
true,
'Services/Registration');
 
  587                 $tpl->setVariable(
"EDIT", $this->lng->txt(
"edit"));
 
  588                 $tpl->setVariable(
"LINK_EDIT", $url);
 
  590                 if (is_array($roles) && 
sizeof($roles))
 
  592                         foreach($roles as $role)
 
  594                                 $tpl->setCurrentBlock(
"list_item");
 
  595                                 $tpl->setVariable(
"LIST_ITEM_ITEM", $role);
 
  596                                 $tpl->parseCurrentBlock();
 
  601                         $tpl->setVariable(
"NONE", $this->lng->txt(
'none'));
 
  609                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  614                         $all[] = $role[
'title'];
 
  621                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  625                 foreach($this->assignments_obj->getAssignments() as $assignment)
 
  627                         if(strlen($assignment[
'domain']) and $assignment[
'role'])
 
  633                 if(strlen($this->assignments_obj->getDefaultRole()))
 
  635                         $all[] = $this->lng->txt(
'reg_default').
' -> '.
ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
 
  647                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  652                         switch ($this->access_limitations_obj->getMode($role[
'id']))
 
  655                                         $txt_access_value = $lng->txt(
'reg_access_limitation_limited_until');
 
  656                                         $txt_access_value .= 
" ".ilDatePresentation::formatDate(
new ilDateTime($this->access_limitations_obj->getAbsolute($role[
'id'],
IL_CAL_UNIX)));
 
  660                                         $years = $this->access_limitations_obj->getRelative($role[
'id'],
'y');
 
  661                                         $months = $this->access_limitations_obj->getRelative($role[
'id'],
'm');
 
  662                                         $days = $this->access_limitations_obj->getRelative($role[
'id'],
'd');
 
  664                                         $txt_access_value = $lng->txt(
'reg_access_limitation_limited_time').
" ";
 
  668                                                 $txt_access_value .= $years.
" ";
 
  669                                                 $txt_access_value .= ($years == 1) ? $lng->txt(
'year') : $lng->txt(
'years');
 
  675                                                                 $txt_access_value .= 
", ";
 
  679                                                                 $txt_access_value .= 
" ".$lng->txt(
'and').
" ";
 
  684                                                         $txt_access_value .= 
" ".$lng->txt(
'and').
" ";
 
  690                                                 $txt_access_value .= $months.
" ";
 
  691                                                 $txt_access_value .= ($months == 1) ? $lng->txt(
'month') : $lng->txt(
'months');
 
  695                                                         $txt_access_value .= 
" ".$lng->txt(
'and').
" ";
 
  701                                                 $txt_access_value .= $days.
" ";
 
  702                                                 $txt_access_value .= ($days == 1) ? $lng->txt(
'day') : $lng->txt(
'days');
 
  707                                         $txt_access_value = $lng->txt(
'reg_access_limitation_none');
 
  711                         $all[] = $role[
'title'].
' ('.$txt_access_value.
')';
 
  719                 if(is_object($this->assignments_obj))
 
  724                 include_once 
'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
 
  731                 if(is_object($this->access_limitations_obj))
 
  736                 include_once 
'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
 
  743                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  747                 $assignments = $this->assignments_obj->getAssignments();
 
  748                 $selected = ($assignment_id > 0) ?
 
  749                         $assignments[$assignment_id][
'role'] :
 
  750                         $this->assignments_obj->getDefaultRole();
 
  754                         $roles[0] = $this->lng->txt(
'please_choose');
 
  757                 foreach($rbacreview->getGlobalRoles() as $role_id)
 
  759                         if($role_id == ANONYMOUS_ROLE_ID)
 
  766                 if($assignment_id > 0)
 
  769                                                                           "role[$assignment_id][role]",
 
  785                                                 'null'          => $lng->txt(
'please_choose'),
 
  786                                                 'unlimited' => $lng->txt(
'reg_access_limitation_mode_unlimited'),
 
  787                                                 'absolute'      => $lng->txt(
'reg_access_limitation_mode_absolute'),
 
  788                                                 'relative'      => $lng->txt(
'reg_access_limitation_mode_relative')
 
  791                 $attribs = array(
'onchange' => 
'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_'.$a_role_id.
','.$a_role_id.
')');
 
  793                 $selected = $this->access_limitations_obj->getMode($a_role_id);
 
  795                 return ilUtil::formSelect($selected,
'access_limitation_mode_'.$a_role_id,$options,
false,
true,0,
"",$attribs);
 
  803                         $a_unix_time = time();
 
  806                 return array(
'y' => date(
'Y',$a_unix_time),
 
  807                                          'm' => date(
'n',$a_unix_time),
 
  808                                          'd' => date(
'd',$a_unix_time));
 
  815                 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
 
  817                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
 
  822                 $ilToolbar->addButton($this->lng->txt(
"registration_codes_add"),
 
  823                         $this->ctrl->getLinkTarget($this, 
"addCodes"));
 
  825                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  827                 $this->tpl->setContent($ctab->getHTML());
 
  832                 global $rbacreview, $ilObjDataCache, 
$lng;
 
  834                 include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  837                 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'createCodes'));
 
  838                 $this->form_gui->setTitle($this->lng->txt(
'registration_codes_edit_header'));
 
  840                 $count = 
new ilNumberInputGUI($this->lng->txt(
'registration_codes_number'), 
'reg_codes_number');
 
  842                 $count->setMaxLength(4);
 
  843                 $count->setMinValue(1);
 
  844                 $count->setMaxValue(1000);
 
  845                 $count->setRequired(
true);
 
  846                 $this->form_gui->addItem($count);
 
  848                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  849                 $options = array(
"" => 
"");
 
  850                 foreach($rbacreview->getGlobalRoles() as $role_id)
 
  852                         if(!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID)))
 
  854                                 $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
 
  857                 $roles = 
new ilSelectInputGUI($this->lng->txt(
"registration_codes_roles"), 
"reg_codes_role");
 
  860                 $this->form_gui->addItem($roles);
 
  862                 $this->form_gui->addCommandButton(
'createCodes', $this->lng->txt(
'create'));
 
  869                 if(!$ilAccess->checkAccess(
'write', 
'', $this->ref_id))
 
  871                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
 
  877                 $this->tpl->setContent($this->form_gui->getHTML());
 
  884                 if(!$ilAccess->checkAccess(
'write', 
'', $this->ref_id))
 
  886                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
 
  892                 if($this->form_gui->checkInput())
 
  894                         $number = $this->form_gui->getInput(
'reg_codes_number');
 
  895                         $role = $this->form_gui->getInput(
'reg_codes_role');
 
  897                         include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  900                         for($loop = 1; $loop <= $number; $loop++)
 
  906                         $this->ctrl->redirect($this, 
"listCodes");
 
  910                         $this->form_gui->setValuesByPost();
 
  911                         $this->tpl->setContent($this->form_gui->getHtml());
 
  917                 include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  921                 $this->ctrl->redirect($this, 
"listCodes");
 
  930                         $ilErr->raiseError($this->lng->txt(
"no_checkbox"), $ilErr->MESSAGE);
 
  935                 include_once 
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  937                 $gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
 
  938                 $gui->setCancel($this->lng->txt(
"cancel"), 
"listCodes");
 
  939                 $gui->setConfirm($this->lng->txt(
"confirm"), 
"deleteCodes");
 
  940                 $gui->setFormAction($this->ctrl->getFormAction($this, 
"deleteCodes"));
 
  942                 include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  944                 foreach(
$data as $code)
 
  946                         $gui->addItem(
"id[]", $code[
"code_id"], $code[
"code"]);
 
  949                 $this->tpl->setContent($gui->getHTML());
 
  954                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  956                 $utab->resetOffset();
 
  957                 $utab->resetFilter();
 
  964                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  966                 $utab->resetOffset();
 
  967                 $utab->writeFilterToSession();
 
  976                 if(!$ilAccess->checkAccess(
'read', 
'', $this->ref_id))
 
  978                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"), $ilErr->MESSAGE);
 
  981                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  984                 include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  989                         ilUtil::deliverData(implode(
"\r\n", $codes), 
"ilias_registration_codes_".date(
"d-m-Y").
".txt",
"text/plain");