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);
 
  121                                 $lt->setMinValue(60);
 
  122                                 $lt->setInfo($this->lng->txt(
'reg_confirmation_hash_life_time_info'));
 
  123                                 $option->addSubItem($lt);
 
  124                                 $cd = 
new ilCheckboxInputGUI($this->lng->txt(
'reg_allow_codes'), 
'reg_codes_'.IL_REG_ACTIVATION);
 
  125                                 $cd->
setInfo($this->lng->txt(
'reg_allow_codes_info'));
 
  126                                 $option->addSubItem($cd);
 
  127                         $reg_type->addOption($option);
 
  129                         $option->
setInfo($this->lng->txt(
'registration_reg_type_codes_info'));
 
  130                         $reg_type->addOption($option);
 
  131                 $this->form_gui->addItem($reg_type);
 
  135                 $pwd_gen->setInfo($this->lng->txt(
'reg_info_pwd'));
 
  136                 $this->form_gui->addItem($pwd_gen);
 
  138                 $approver = 
new ilTextInputGUI($this->lng->txt(
'reg_notification'), 
'reg_approver');
 
  140                 $approver->setMaxLength(50);
 
  141                 $approver->setInfo($this->lng->txt(
'reg_notification_info'));
 
  142                 $this->form_gui->addItem($approver);
 
  147                                 $edit = $this->ctrl->getLinkTarget($this,
'editRoles');
 
  150                         $roles->addOption($option);
 
  153                                 $edit = $this->ctrl->getLinkTarget($this,
'editEmailAssignments');
 
  156                         $roles->addOption($option);
 
  157                 $this->form_gui->addItem($roles);
 
  159                 $limit = 
new ilCheckboxInputGUI($this->lng->txt(
'reg_access_limitations'), 
'reg_access_limitation');
 
  162                         $edit = $this->ctrl->getLinkTarget($this,
'editRoleAccessLimitations');
 
  165                 $this->form_gui->addItem($limit);
 
  167                 $this->form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
 
  172                 if($this->registration_settings->roleSelectionEnabled())
 
  176                 else if ($this->registration_settings->automaticRoleAssignmentEnabled())
 
  182                         'reg_type' => $this->registration_settings->getRegistrationType(),
 
  183                         'reg_hash_life_time' => (int)$this->registration_settings->getRegistrationHashLifetime(),
 
  184                         'reg_pwd' => $this->registration_settings->passwordGenerationEnabled(),
 
  185                         'reg_approver' => $this->registration_settings->getApproveRecipientLogins(),
 
  186                         'reg_role_type' => $role_type,
 
  187                         'reg_access_limitation' => $this->registration_settings->getAccessLimitation()
 
  190                 $allow_codes = $this->registration_settings->getAllowCodes();
 
  191                 $reg_type = $this->registration_settings->getRegistrationType();
 
  194                         $values[
'reg_codes_'.$reg_type] = 
true;
 
  197                 $this->form_gui->setValuesByArray($values);
 
  204                 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
 
  206                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
 
  212                 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui", 
"ref_id", 
USER_FOLDER_ID);
 
  213                 $ilToolbar->addButton($this->lng->txt(
'registration_user_new_account_mail'),
 
  214                         $ilCtrl->getLinkTargetByClass(array(
"iladministrationgui", 
"ilobjuserfoldergui"), 
"newAccountMail"));
 
  215                 $ilCtrl->setParameterByClass(
"ilobjuserfoldergui", 
"ref_id", 
$_GET[
"ref_id"]);
 
  219                 $this->tpl->setContent($this->form_gui->getHTML());
 
  226                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  228                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  231                 $this->registration_settings->setRegistrationType((
int) 
$_POST[
'reg_type']);
 
  232                 $this->registration_settings->setPasswordGenerationStatus((
int) $_POST[
'reg_pwd']);
 
  233                 $this->registration_settings->setApproveRecipientLogins(
ilUtil::stripSlashes($_POST[
'reg_approver']));
 
  234                 $this->registration_settings->setRoleType((
int) $_POST[
'reg_role_type']);
 
  235                 $this->registration_settings->setAccessLimitation((
int) $_POST[
'reg_access_limitation']);
 
  237                 $allow_codes = 
false;
 
  240                         $allow_codes = (bool)$_POST[
'reg_codes_'.(
int)$_POST[
'reg_type']];
 
  242                 $this->registration_settings->setAllowCodes($allow_codes);
 
  244                 if(!preg_match(
'/^([0]|([1-9][0-9]*))([\.,][0-9][0-9]*)?$/', (
int)$_POST[
'reg_hash_life_time']))
 
  245                         $this->registration_settings->setRegistrationHashLifetime(0);
 
  247                         $this->registration_settings->setRegistrationHashLifetime((
int)$_POST[
'reg_hash_life_time']);
 
  249                 if($error_code = $this->registration_settings->validate())
 
  255                                         ilUtil::sendFailure($this->lng->txt(
'reg_unknown_recipients').
' '.$this->registration_settings->getUnknown());
 
  261                                         ilUtil::sendFailure($this->lng->txt(
'reg_approve_needs_recipient').
' '.$this->registration_settings->getUnknown());
 
  268                 $this->registration_settings->save();
 
  277                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  279                 global $ilAccess,
$ilErr,$rbacreview;
 
  281                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  283                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  286                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.edit_roles.html',
'Services/Registration');
 
  288                 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
 
  289                 $this->tpl->setVariable(
"TXT_SELECTABLE_ROLES",$this->lng->txt(
'reg_selectable_roles'));
 
  291                 $this->tpl->setVariable(
"ACTIONS",$this->lng->txt(
'actions'));
 
  292                 $this->tpl->setVariable(
"UPDATE",$this->lng->txt(
'save'));
 
  293                 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
 
  296                 foreach($rbacreview->getGlobalRoles() as $role)
 
  298                         if($role == SYSTEM_ROLE_ID or
 
  299                            $role == ANONYMOUS_ROLE_ID)
 
  303                         $this->tpl->setCurrentBlock(
"roles");
 
  309                         $this->tpl->parseCurrentBlock();
 
  316                 global $ilAccess,
$ilErr,$rbacreview;
 
  318                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  320                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  323                 if(count(
$_POST[
'roles']) < 1)
 
  330                 foreach($rbacreview->getGlobalRoles() as $role)
 
  334                                 $role_obj->setAllowRegister(
$_POST[
'roles'][$role] ? 1 : 0);
 
  347                 global $ilAccess,
$ilErr,$rbacreview;
 
  349                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  351                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  356                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_email_role_assignments.html',
'Services/Registration');
 
  357                 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
 
  358                 $this->tpl->setVariable(
"TXT_EMAIL_ROLE_ASSIGN",$this->lng->txt(
'reg_email_role_assignment'));
 
  359                 $this->tpl->setVariable(
"TXT_MAIL",$this->lng->txt(
'reg_email'));
 
  360                 $this->tpl->setVariable(
"TXT_ROLE",$this->lng->txt(
'obj_role'));
 
  361                 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'reg_default'));
 
  363                 $this->tpl->setVariable(
"TXT_DOMAIN",$this->lng->txt(
'reg_domain'));
 
  366                 $this->tpl->setVariable(
"BTN_DELETE",$this->lng->txt(
'delete'));
 
  367                 $this->tpl->setVariable(
"BTN_SAVE",$this->lng->txt(
'save'));
 
  368                 $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
'reg_add_assignment'));
 
  369                 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
'cancel'));
 
  372                 foreach($this->assignments_obj->getAssignments() as $assignment)
 
  374                         $this->tpl->setCurrentBlock(
"roles");
 
  376                         $this->tpl->setVariable(
"ASSIGN_ID",$assignment[
'id']);
 
  377                         $this->tpl->setVariable(
"DOMAIN",$assignment[
'domain']);
 
  380                         $this->tpl->parseCurrentBlock();
 
  384                 $this->tpl->setVariable(
"TXT_DEFAULT",$this->lng->txt(
'default'));
 
  392                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  394                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  399                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.reg_role_access_limitations.html',
'Services/Registration');
 
  401                 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
 
  402                 $this->tpl->setVariable(
"TXT_REG_ROLE_ACCESS_LIMITATIONS",$lng->txt(
'reg_role_access_limitations'));
 
  403                 $this->tpl->setVariable(
"TXT_ROLE",$lng->txt(
'obj_role'));
 
  404                 $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_MODE",$lng->txt(
'reg_access_limitation_mode'));
 
  406                 $this->tpl->setVariable(
"BTN_SAVE",$lng->txt(
'save'));
 
  407                 $this->tpl->setVariable(
"BTN_CANCEL",$lng->txt(
'cancel'));
 
  410                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  414                         $this->tpl->setCurrentBlock(
"roles");
 
  416                         $this->tpl->setVariable(
"ROLE_ID",$role[
'id']);
 
  417                         $this->tpl->setVariable(
"ROLE_TITLE",$role[
'title']);
 
  419                         $this->tpl->setVariable(
"CSS_DISPLAY_ABSOLUTE",($this->access_limitations_obj->getMode($role[
'id']) == 
'absolute') ? 
'inline' : 
'none');
 
  420                         $this->tpl->setVariable(
"CSS_DISPLAY_RELATIVE",($this->access_limitations_obj->getMode($role[
'id']) == 
'relative') ? 
'inline' : 
'none');
 
  421                         $this->tpl->setVariable(
"CSS_DISPLAY_UNLIMITED",($this->access_limitations_obj->getMode($role[
'id']) == 
'unlimited') ? 
'inline' : 
'none');
 
  422                         $this->tpl->setVariable(
"TXT_ACCESS_LIMITATION_UNLIMITED", $lng->txt(
'reg_access_limitation_none'));
 
  424                         $date = $this->
__prepareDateSelect($this->access_limitations_obj->getAbsolute($role[
'id']));
 
  425                         $this->tpl->setVariable(
"SEL_ACCESS_LIMITATION_ABSOLUTE",
ilUtil::makeDateSelect(
'access_limitation_absolute_'.$role[
'id'],$date[
'y'],$date[
'm'],$date[
'd'],
'2007'));
 
  427                         $this->tpl->setVariable(
"TXT_DAYS",$lng->txt(
'days'));
 
  428                         $this->tpl->setVariable(
"TXT_MONTHS",$lng->txt(
'months'));
 
  429                         $this->tpl->setVariable(
"TXT_YEARS",$lng->txt(
'years'));
 
  431                         $this->tpl->setVariable(
"DAYS",$this->access_limitations_obj->getRelative($role[
'id'],
'd'));
 
  432                         $this->tpl->setVariable(
"MONTHS",$this->access_limitations_obj->getRelative($role[
'id'],
'm'));
 
  433                         $this->tpl->setVariable(
"YEARS",$this->access_limitations_obj->getRelative($role[
'id'],
'y'));
 
  434                         $this->tpl->parseCurrentBlock();                        
 
  440                 global $ilAccess,
$ilErr,$rbacreview;
 
  442                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  444                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  448                 $this->assignments_obj->add();
 
  458                 global $ilAccess,
$ilErr,$rbacreview;
 
  460                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  462                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  465                 if(!count(
$_POST[
'del_assign']))
 
  474                 foreach(
$_POST[
'del_assign'] as $assignment_id)
 
  476                         $this->assignments_obj->delete($assignment_id);
 
  487                 global $ilAccess,
$ilErr,$rbacreview;
 
  489                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  491                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  496                 if (!is_array(
$_POST[
'domain']))
 
  498                         $_POST[
'domain'] = array();
 
  506                 $this->assignments_obj->setDefaultRole((
int) 
$_POST[
'default_role']);
 
  508                 if($err = $this->assignments_obj->validate())
 
  525                 $this->assignments_obj->save();
 
  533                 global $ilAccess,
$ilErr,$rbacreview;
 
  535                 if(!$ilAccess->checkAccess(
'write',
'',$this->ref_id))
 
  537                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"),$ilErr->MESSAGE);
 
  542                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  546                         $this->access_limitations_obj->setMode(
$_POST[
'access_limitation_mode_'.$role[
'id']],$role[
'id']);
 
  547                         $this->access_limitations_obj->setAbsolute(
$_POST[
'access_limitation_absolute_'.$role[
'id']],$role[
'id']);
 
  548                         $this->access_limitations_obj->setRelative(
$_POST[
'access_limitation_relative_'.$role[
'id']],$role[
'id']);
 
  553                 if($err = $this->access_limitations_obj->validate())
 
  570                 $this->access_limitations_obj->save();
 
  578                 $tpl = 
new ilTemplate(
'tpl.registration_roles.html', 
true, 
true,
'Services/Registration');
 
  580                 $tpl->setVariable(
"EDIT", $this->lng->txt(
"edit"));
 
  581                 $tpl->setVariable(
"LINK_EDIT", $url);
 
  583                 if (is_array($roles) && 
sizeof($roles))
 
  585                         foreach($roles as $role)
 
  587                                 $tpl->setCurrentBlock(
"list_item");
 
  588                                 $tpl->setVariable(
"LIST_ITEM_ITEM", $role);
 
  589                                 $tpl->parseCurrentBlock();
 
  594                         $tpl->setVariable(
"NONE", $this->lng->txt(
'none'));
 
  602                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  607                         $all[] = $role[
'title'];
 
  614                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  618                 foreach($this->assignments_obj->getAssignments() as $assignment)
 
  620                         if(strlen($assignment[
'domain']) and $assignment[
'role'])
 
  626                 if(strlen($this->assignments_obj->getDefaultRole()))
 
  628                         $all[] = $this->lng->txt(
'reg_default').
' -> '.
ilObjRole::_lookupTitle($this->assignments_obj->getDefaultRole());
 
  640                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  645                         switch ($this->access_limitations_obj->getMode($role[
'id']))
 
  648                                         $txt_access_value = $lng->txt(
'reg_access_limitation_limited_until');
 
  649                                         $txt_access_value .= 
" ".ilDatePresentation::formatDate(
new ilDateTime($this->access_limitations_obj->getAbsolute($role[
'id'],
IL_CAL_UNIX)));
 
  653                                         $years = $this->access_limitations_obj->getRelative($role[
'id'],
'y');
 
  654                                         $months = $this->access_limitations_obj->getRelative($role[
'id'],
'm');
 
  655                                         $days = $this->access_limitations_obj->getRelative($role[
'id'],
'd');
 
  657                                         $txt_access_value = $lng->txt(
'reg_access_limitation_limited_time').
" ";
 
  661                                                 $txt_access_value .= $years.
" ";
 
  662                                                 $txt_access_value .= ($years == 1) ? $lng->txt(
'year') : $lng->txt(
'years');
 
  668                                                                 $txt_access_value .= 
", ";
 
  672                                                                 $txt_access_value .= 
" ".$lng->txt(
'and').
" ";
 
  677                                                         $txt_access_value .= 
" ".$lng->txt(
'and').
" ";
 
  683                                                 $txt_access_value .= $months.
" ";
 
  684                                                 $txt_access_value .= ($months == 1) ? $lng->txt(
'month') : $lng->txt(
'months');
 
  688                                                         $txt_access_value .= 
" ".$lng->txt(
'and').
" ";
 
  694                                                 $txt_access_value .= $days.
" ";
 
  695                                                 $txt_access_value .= ($days == 1) ? $lng->txt(
'day') : $lng->txt(
'days');
 
  700                                         $txt_access_value = $lng->txt(
'reg_access_limitation_none');
 
  704                         $all[] = $role[
'title'].
' ('.$txt_access_value.
')';
 
  712                 if(is_object($this->assignments_obj))
 
  717                 include_once 
'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
 
  724                 if(is_object($this->access_limitations_obj))
 
  729                 include_once 
'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
 
  736                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  740                 $assignments = $this->assignments_obj->getAssignments();
 
  741                 $selected = ($assignment_id > 0) ?
 
  742                         $assignments[$assignment_id][
'role'] :
 
  743                         $this->assignments_obj->getDefaultRole();
 
  747                         $roles[0] = $this->lng->txt(
'please_choose');
 
  750                 foreach($rbacreview->getGlobalRoles() as $role_id)
 
  752                         if($role_id == SYSTEM_ROLE_ID or
 
  753                            $role_id == ANONYMOUS_ROLE_ID)
 
  760                 if($assignment_id > 0)
 
  763                                                                           "role[$assignment_id][role]",
 
  779                                                 'null'          => $lng->txt(
'please_choose'),
 
  780                                                 'unlimited' => $lng->txt(
'reg_access_limitation_mode_unlimited'),
 
  781                                                 'absolute'      => $lng->txt(
'reg_access_limitation_mode_absolute'),
 
  782                                                 'relative'      => $lng->txt(
'reg_access_limitation_mode_relative')
 
  785                 $attribs = array(
'onchange' => 
'displayAccessLimitationSelectionForm(document.cmd.access_limitation_mode_'.$a_role_id.
','.$a_role_id.
')');
 
  787                 $selected = $this->access_limitations_obj->getMode($a_role_id);
 
  789                 return ilUtil::formSelect($selected,
'access_limitation_mode_'.$a_role_id,$options,
false,
true,0,
"",$attribs);
 
  797                         $a_unix_time = time();
 
  800                 return array(
'y' => date(
'Y',$a_unix_time),
 
  801                                          'm' => date(
'n',$a_unix_time),
 
  802                                          'd' => date(
'd',$a_unix_time));
 
  809                 if(!$ilAccess->checkAccess(
'read',
'',$this->ref_id))
 
  811                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"),$ilErr->MESSAGE);
 
  816                 $ilToolbar->addButton($this->lng->txt(
"registration_codes_add"),
 
  817                         $this->ctrl->getLinkTarget($this, 
"addCodes"));
 
  819                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  821                 $this->tpl->setContent($ctab->getHTML());
 
  826                 global $rbacreview, $ilObjDataCache;
 
  828                 include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  831                 $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'createCodes'));
 
  832                 $this->form_gui->setTitle($this->lng->txt(
'registration_codes_edit_header'));
 
  834                 $count = 
new ilNumberInputGUI($this->lng->txt(
'registration_codes_number'), 
'reg_codes_number');
 
  836                 $count->setMaxLength(4);
 
  837                 $count->setMinValue(1);
 
  838                 $count->setMaxValue(1000);
 
  839                 $count->setRequired(
true);
 
  840                 $this->form_gui->addItem($count);
 
  842                 include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  844                 foreach($rbacreview->getGlobalRoles() as $role_id)
 
  846                         if(!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID)))
 
  848                                 $options[$role_id] = $ilObjDataCache->lookupTitle($role_id);
 
  851                 $roles = 
new ilSelectInputGUI($this->lng->txt(
"registration_codes_roles"), 
"reg_codes_role");
 
  853                 $roles->setRequired(
true);
 
  854                 $this->form_gui->addItem($roles);
 
  856                 $this->form_gui->addCommandButton(
'createCodes', $this->lng->txt(
'create'));
 
  863                 if(!$ilAccess->checkAccess(
'write', 
'', $this->ref_id))
 
  865                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
 
  871                 $this->tpl->setContent($this->form_gui->getHTML());
 
  878                 if(!$ilAccess->checkAccess(
'write', 
'', $this->ref_id))
 
  880                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"), $ilErr->MESSAGE);
 
  886                 if($this->form_gui->checkInput())
 
  888                         $number = $this->form_gui->getInput(
'reg_codes_number');
 
  889                         $role = $this->form_gui->getInput(
'reg_codes_role');
 
  891                         include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  894                         for($loop = 1; $loop <= $number; $loop++)
 
  900                         $this->ctrl->redirect($this, 
"listCodes");
 
  904                         $this->form_gui->setValuesByPost();
 
  905                         $this->tpl->setContent($this->form_gui->getHtml());
 
  911                 include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  915                 $this->ctrl->redirect($this, 
"listCodes");
 
  924                         $ilErr->raiseError($this->lng->txt(
"no_checkbox"), $ilErr->MESSAGE);
 
  929                 include_once 
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  931                 $gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
 
  932                 $gui->setCancel($this->lng->txt(
"cancel"), 
"listCodes");
 
  933                 $gui->setConfirm($this->lng->txt(
"confirm"), 
"deleteCodes");
 
  934                 $gui->setFormAction($this->ctrl->getFormAction($this, 
"deleteCodes"));
 
  936                 include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  938                 foreach(
$data as $code)
 
  940                         $gui->addItem(
"id[]", $code[
"code_id"], $code[
"code"]);
 
  943                 $this->tpl->setContent($gui->getHTML());
 
  948                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  950                 $utab->resetOffset();
 
  951                 $utab->resetFilter();
 
  958                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  960                 $utab->resetOffset();
 
  961                 $utab->writeFilterToSession();
 
  970                 if(!$ilAccess->checkAccess(
'read', 
'', $this->ref_id))
 
  972                         $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"), $ilErr->MESSAGE);
 
  975                 include_once(
"./Services/Registration/classes/class.ilRegistrationCodesTableGUI.php");
 
  978                 include_once 
'./Services/Registration/classes/class.ilRegistrationCode.php';
 
  983                         ilUtil::deliverData(implode(
"\r\n", $codes), 
"ilias_registration_codes_".date(
"d-m-Y").
".txt",
"text/plain");