ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRegistrationGUI Class Reference

Base class for Course and Group registration. More...

+ Inheritance diagram for ilRegistrationGUI:
+ Collaboration diagram for ilRegistrationGUI:

Public Member Functions

 __construct ($a_container)
 Constructor.
 cancel ()
 cancel subscription
 show ()
 show registration form
 join ()
 join
 ilRegistrationGUI ()
 executeCommand ()
 login ()
 displayForm ()
 showUserDefinedFields ()
 checkUserDefinedRequiredFields ()
 saveForm ()
 __validateRole ()
 __assignRole ()
 __showRoleSelection ()
 __distributeMails ()

Protected Member Functions

 isRegistrationPossible ()
 check if registration is possible
 enableRegistration ($a_status)
 set registration disabled
 initParticipants ()
 Init participants object (course or group participants)
 getFormTitle ()
 Get title for property form.
 fillInformations ()
 fill informations
 fillRegistrationPeriod ()
 show informations about the registration period
 fillMaxMembers ()
 show informations about the maximum number of user.
 fillRegistrationType ()
 show informations about registration procedure
 fillMembershipLimitation ()
 Show membership limitations.
 fillAgreement ()
 Show user agreement.
 validate ()
 validate join request
 initForm ()
 init registration form

Protected Attributes

 $container = null
 $ref_id
 $obj_id
 $participants
 $form
 $registration_possible = true
 $join_error = ''
 $tpl
 $lng
 $ctrl

Detailed Description

Base class for Course and Group registration.

Class ilRegistrationGUI.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$
Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilRegistrationGUI.php 17847 2008-11-06 13:57:15Z akill

ilRegistrationGUI:

Definition at line 33 of file class.ilRegistrationGUI.php.

Constructor & Destructor Documentation

ilRegistrationGUI::__construct (   $a_container)

Constructor.

public

Parameters
objectCourse or Group object
Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Definition at line 57 of file class.ilRegistrationGUI.php.

References $ilCtrl, $lng, $tpl, ilObject\_lookupObjId(), ilObject\_lookupType(), and initParticipants().

{
global $lng,$ilCtrl,$tpl;
$this->lng = $lng;
$this->lng->loadLanguageModule('crs');
$this->lng->loadLanguageModule('grp');
$this->ctrl = $ilCtrl;
$this->tpl = $tpl;
$this->container = $a_container;
$this->ref_id = $this->container->getRefId();
$this->obj_id = ilObject::_lookupObjId($this->ref_id);
$this->type = ilObject::_lookupType($this->obj_id);
// Init participants
$this->initParticipants();
}

+ Here is the call graph for this function:

Member Function Documentation

ilRegistrationGUI::__assignRole ( )

Definition at line 621 of file class.ilRegistrationGUI.php.

Referenced by saveForm().

{
global $rbacadmin;
// Assign chosen role
if($this->registration_settings->roleSelectionEnabled())
{
return $rbacadmin->assignUser((int) $_POST['user']['default_role'],
$this->userObj->getId(),true);
}
// Assign by email
include_once 'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
$registration_role_assignments = new ilRegistrationRoleAssignments();
return $rbacadmin->assignUser((int) $registration_role_assignments->getRoleByEmail($this->userObj->getEmail()),
$this->userObj->getId(),
true);
}

+ Here is the caller graph for this function:

ilRegistrationGUI::__distributeMails ( )

Definition at line 670 of file class.ilRegistrationGUI.php.

References $GLOBALS, $lng, ilObjUser\_lookupLanguage(), ilObjUser\_lookupLogin(), ilObjUserFolder\_lookupNewAccountMail(), and IL_REG_APPROVE.

Referenced by saveForm().

{
global $ilias;
include_once './Services/Language/classes/class.ilLanguage.php';
include_once './Services/User/classes/class.ilObjUser.php';
include_once "Services/Mail/classes/class.ilFormatMail.php";
$settings = $ilias->getAllSettings();
// Always send mail to approvers
#if($this->registration_settings->getRegistrationType() == IL_REG_APPROVE)
{
// Send mail to approvers
foreach($this->registration_settings->getApproveRecipients() as $recipient)
{
$lng->loadLanguageModule('registration');
#$umail = new ilFormatMail(6); // Send as system administrator
$umail = new ilFormatMail($this->userObj->getId());
$umail->enableSoap(false);
$subject = $lng->txt("client_id") . " " . $ilias->client_id . ": " . $lng->txt("usr_new");
// build body
$body = $lng->txt('reg_mail_new_user_body')."\n\n";
$body .= $lng->txt('reg_mail_body_profile')."\n\n";
$body .= $this->userObj->getProfileAsString($lng);
$umail->sendMail(ilObjUser::_lookupLogin($recipient),"","",$subject,$body,array(),array("normal"));
}
}
// Send mail to new user
// try individual account mail in user administration
include_once("Services/Mail/classes/class.ilAccountMail.php");
include_once './Services/User/classes/class.ilObjUserFolder.php';
$amail = ilObjUserFolder::_lookupNewAccountMail($GLOBALS["lng"]->getDefaultLanguage());
if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
{
$acc_mail = new ilAccountMail();
$acc_mail->setUser($this->userObj);
if ($this->registration_settings->passwordGenerationEnabled())
{
$acc_mail->setUserPassword($_POST["user"]["passwd"]);
}
$acc_mail->send();
}
else // do default mail
{
include_once "Services/Mail/classes/class.ilMimeMail.php";
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From($settings["admin_email"]);
$mmail->To($this->userObj->getEmail());
// mail subject
$subject = $this->lng->txt("reg_mail_subject");
// mail body
$body = $this->lng->txt("reg_mail_body_salutation")." ".$this->userObj->getFullname().",\n\n".
$this->lng->txt("reg_mail_body_text1")."\n\n".
$this->lng->txt("reg_mail_body_text2")."\n".
ILIAS_HTTP_PATH."/login.php?client_id=".$ilias->client_id."\n".
$this->lng->txt("login").": ".$this->userObj->getLogin()."\n";
if ($this->registration_settings->passwordGenerationEnabled())
{
$body.= $this->lng->txt("passwd").": ".$_POST["user"]["passwd"]."\n";
}
$body.= "\n";
// Info about necessary approvement
if($this->registration_settings->getRegistrationType() == IL_REG_APPROVE)
{
$body .= ($this->lng->txt('reg_mail_body_pwd_generation')."\n\n");
}
$body .= ($this->lng->txt("reg_mail_body_text3")."\n\r");
$body .= $this->userObj->getProfileAsString($this->lng);
$mmail->Subject($subject);
$mmail->Body($body);
$mmail->Send();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::__showRoleSelection ( )

Definition at line 643 of file class.ilRegistrationGUI.php.

References ilObjRole\_lookupRegisterAllowed(), and ilUtil\formSelect().

Referenced by displayForm().

{
if(!$this->registration_settings->roleSelectionEnabled())
{
return true;
}
// TODO put query in a function
include_once("./Services/AccessControl/classes/class.ilObjRole.php");
$rol = array();
foreach ($reg_roles as $role)
{
$rol[$role["id"]] = $role["title"];
}
$this->tpl->setCurrentBlock("role");
$this->tpl->setVariable("TXT_DEFAULT_ROLE",$this->lng->txt('default_role'));
$this->tpl->setVariable("DEFAULT_ROLE",ilUtil::formSelect($_POST["user"]["default_role"],
"user[default_role]",
$rol,false,true));
$this->tpl->parseCurrentBlock();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::__validateRole ( )

Definition at line 605 of file class.ilRegistrationGUI.php.

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

Referenced by saveForm().

{
global $ilDB,$ilias,$ilErr,$lng;
// validate role
include_once("./Services/AccessControl/classes/class.ilObjRole.php");
if ($this->registration_settings->roleSelectionEnabled() and
!ilObjRole::_lookupAllowRegister($_POST["user"]["default_role"]))
{
$ilias->raiseError("Invalid role selection in registration: ".
ilObject::_lookupTitle($_POST["user"]["default_role"])." [".$_POST["user"]["default_role"]."]".
", IP: ".$_SERVER["REMOTE_ADDR"],$ilias->error_obj->FATAL);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::cancel ( )

cancel subscription

public

Definition at line 221 of file class.ilRegistrationGUI.php.

{
$this->ctrl->returnToParent($this);
}
ilRegistrationGUI::checkUserDefinedRequiredFields ( )

Definition at line 359 of file class.ilRegistrationGUI.php.

References ilUserDefinedFields\_getInstance().

Referenced by saveForm().

{
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$user_defined_fields =& ilUserDefinedFields::_getInstance();
foreach($user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
{
if($definition['required'] and !strlen($_POST['udf'][$field_id]))
{
return false;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::displayForm ( )

Definition at line 125 of file class.ilRegistrationGUI.php.

References $data, $lng, __showRoleSelection(), ilUserAgreement\_getText(), ilLanguage\_lookupEntry(), ilUtil\formCheckbox(), ilUtil\getImagePath(), ilUtil\prepareFormOutput(), and showUserDefinedFields().

Referenced by executeCommand(), and saveForm().

{
global $ilias,$lng,$ObjDefinition;
$this->tpl->addBlockFile("CONTENT", "content", "tpl.usr_registration.html");
$this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
//load ILIAS settings
$settings = $ilias->getAllSettings();
$data = array();
$data["fields"] = array();
$data["fields"]["login"] = "";
if (!$this->registration_settings->passwordGenerationEnabled())
{
$data["fields"]["passwd"] = "";
$data["fields"]["passwd2"] = "";
}
$data["fields"]["title"] = "";
$data["fields"]["gender"] = "";
$data["fields"]["firstname"] = "";
$data["fields"]["lastname"] = "";
$data["fields"]["institution"] = "";
$data["fields"]["department"] = "";
$data["fields"]["street"] = "";
$data["fields"]["city"] = "";
$data["fields"]["zipcode"] = "";
$data["fields"]["country"] = "";
$data["fields"]["phone_office"] = "";
$data["fields"]["phone_home"] = "";
$data["fields"]["phone_mobile"] = "";
$data["fields"]["fax"] = "";
$data["fields"]["email"] = "";
$data["fields"]["hobby"] = "";
$data["fields"]["referral_comment"] = "";
$data["fields"]["matriculation"] = "";
// fill presets
foreach ($data["fields"] as $key => $val)
{
$str = $lng->txt($key);
if ($key == "title")
{
$str = $lng->txt("person_title");
}
if (!in_array($key, array("login", "passwd", "passwd2",
"firstname", "lastname", "gender")))
{
if ($settings["usr_settings_hide_".$key] != 1)
{
$this->tpl->setCurrentBlock($key."_section");
}
else
{
continue;
}
}
// check to see if dynamically required
if (isset($settings["require_" . $key]) && $settings["require_" . $key] ||
($key == "email" && $this->registration_settings->passwordGenerationEnabled()))
{
$str = $str . '<span class="asterisk">*</span>';
}
$this->tpl->setVariable("TXT_".strtoupper($key), $str);
$this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($_POST['user'][$key],true));
if (!in_array($key, array("login", "passwd", "passwd2",
"firstname", "lastname", "gender")))
{
$this->tpl->parseCurrentBlock();
}
}
if (!$this->registration_settings->passwordGenerationEnabled())
{
// text label for passwd2 is nonstandard
$str = $lng->txt("retype_password");
if (isset($settings["require_passwd2"]) && $settings["require_passwd2"])
{
$str = $str . '<span class="asterisk">*</span>';
}
$this->tpl->setVariable("TXT_PASSWD2", $str);
}
else
{
$this->tpl->setVariable("TXT_PASSWD_SELECT", $lng->txt("passwd"));
$this->tpl->setVariable("TXT_PASSWD_VIA_MAIL", $lng->txt("reg_passwd_via_mail"));
}
$this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
$this->tpl->setVariable("TXT_SAVE", $lng->txt("register"));
$this->tpl->setVariable("TXT_REQUIRED_FIELDS", $lng->txt("required_field"));
$this->tpl->setVariable("TXT_LOGIN_DATA", $lng->txt("login_data"));
$this->tpl->setVariable("TXT_PERSONAL_DATA", $lng->txt("personal_data"));
$this->tpl->setVariable("TXT_CONTACT_DATA", $lng->txt("contact_data"));
$this->tpl->setVariable("TXT_SETTINGS", $lng->txt("settings"));
$this->tpl->setVariable("TXT_OTHER", $lng->txt("user_profile_other"));
$this->tpl->setVariable("TXT_LANGUAGE",$lng->txt("language"));
$this->tpl->setVariable("TXT_GENDER_F",$lng->txt("gender_f"));
$this->tpl->setVariable("TXT_GENDER_M",$lng->txt("gender_m"));
$this->tpl->setVariable("TXT_OK",$lng->txt("ok"));
$this->tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
$this->tpl->setVariable("REG_LANG_FORMACTION",
$this->ctrl->getFormAction($this));
// language selection
$languages = $lng->getInstalledLanguages();
$count = (int) round(count($languages) / 2);
$num = 1;
foreach ($languages as $lang_key)
{
/*
if ($num === $count)
{
$this->tpl->touchBlock("lng_new_row");
}
*/
$this->tpl->setCurrentBlock("languages");
$this->tpl->setVariable("LINK_LANG",$this->ctrl->getLinkTarget($this,'displayForm'));
$this->tpl->setVariable("LANG_NAME",
ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
$this->tpl->setVariable("LANG_ICON", $lang_key);
$this->tpl->setVariable("BORDER", 0);
$this->tpl->setVariable("VSPACE", 0);
$this->tpl->parseCurrentBlock();
$num++;
}
// preselect previous chosen language otherwise default language
$selected_lang = (isset($_POST["user"]["language"])) ?
$_POST["user"]["language"] : $lng->lang_key;
foreach ($languages as $lang_key)
{
$this->tpl->setCurrentBlock("language_selection");
$this->tpl->setVariable("LANG", $lng->txt("lang_".$lang_key));
$this->tpl->setVariable("LANGSHORT", $lang_key);
if ($selected_lang == $lang_key)
{
$this->tpl->setVariable("SELECTED_LANG", "selected=\"selected\"");
}
$this->tpl->parseCurrentBlock();
} // END language selection
// FILL SAVED VALUES IN CASE OF ERROR
if (isset($_POST["user"]))
{
// gender selection
$gender = strtoupper($_POST["user"]["gender"]);
if (!empty($gender))
{
$this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
}
}
$this->tpl->setVariable("IMG_USER",
ilUtil::getImagePath("icon_usr_b.gif"));
$this->tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("registration"));
$this->tpl->setVariable("TXT_PAGETITLE", "ILIAS3 - ".$lng->txt("registration"));
$this->tpl->setVariable("TXT_REGISTER_INFO", $lng->txt("register_info"));
$this->tpl->setVariable("AGREEMENT", ilUserAgreement::_getText());
$this->tpl->setVariable("ACCEPT_CHECKBOX", ilUtil::formCheckbox(0, "status", "accepted"));
$this->tpl->setVariable("ACCEPT_AGREEMENT", $lng->txt("accept_usr_agreement") . '<span class="asterisk">*</span>');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::enableRegistration (   $a_status)
protected
ilRegistrationGUI::executeCommand ( )

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Definition at line 61 of file class.ilRegistrationGUI.php.

References $cmd, $ilErr, $tpl, displayForm(), and IL_REG_DISABLED.

{
global $ilErr, $tpl;
if($this->registration_settings->getRegistrationType() == IL_REG_DISABLED)
{
$ilErr->raiseError($this->lng->txt('reg_disabled'),$ilErr->FATAL);
}
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
if($cmd)
{
$this->$cmd();
}
else
{
$this->displayForm();
}
break;
}
$tpl->show();
return true;
}

+ Here is the call graph for this function:

ilRegistrationGUI::fillAgreement ( )
protected

Show user agreement.

protected

Returns

Reimplemented in ilCourseRegistrationGUI.

Definition at line 210 of file class.ilRegistrationGUI.php.

Referenced by initForm().

{
return true;
}

+ Here is the caller graph for this function:

ilRegistrationGUI::fillInformations ( )
abstractprotected

fill informations

protected

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::fillMaxMembers ( )
abstractprotected

show informations about the maximum number of user.

protected

Parameters
@return

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::fillMembershipLimitation ( )
protected

Show membership limitations.

protected

Returns

Definition at line 156 of file class.ilRegistrationGUI.php.

References $obj_id, $ref_id, $title, $tpl, ilObjCourseGrouping\_checkGroupingDependencies(), ilObjCourseGrouping\_getGroupingItems(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), enableRegistration(), ilUtil\getTypeIconPath(), and ilCustomInputGUI\setHtml().

Referenced by initForm().

{
global $ilAccess;
include_once('Modules/Course/classes/class.ilObjCourseGrouping.php');
if(!$items = ilObjCourseGrouping::_getGroupingItems($this->container))
{
return true;
}
$mem = new ilCustomInputGUI($this->lng->txt('groupings'));
$tpl = new ilTemplate('tpl.membership_limitation_form.html',true,true,'Services/Membership');
$tpl->setVariable('LIMIT_INTRO',$this->lng->txt($this->type.'_grp_info_reg'));
foreach($items as $ref_id)
{
if($ilAccess->checkAccess('visible','',$ref_id,$type))
{
include_once('./classes/class.ilLink.php');
$tpl->setVariable('LINK_ITEM','repository.php?ref_id='.$ref_id);
$tpl->setVariable('ITEM_LINKED_TITLE',$title);
}
else
{
$tpl->setVariable('ITEM_TITLE');
}
$tpl->setCurrentBlock('items');
$tpl->setVariable('TYPE_ICON',ilUtil::getTypeIconPath($type,$obj_id,'tiny'));
$tpl->setVariable('ALT_ICON',$this->lng->txt('obj_'.$type));
$tpl->parseCurrentBlock();
}
$mem->setHtml($tpl->get());
{
$mem->setAlert($this->container->getMessage());
$this->enableRegistration(false);
}
$this->form->addItem($mem);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::fillRegistrationPeriod ( )
abstractprotected

show informations about the registration period

protected

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::fillRegistrationType ( )
abstractprotected

show informations about registration procedure

protected

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::getFormTitle ( )
abstractprotected

Get title for property form.

protected

Returns
string title

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::ilRegistrationGUI ( )

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

References $ilCtrl, $lng, and $tpl.

{
global $ilCtrl,$tpl,$lng;
$this->tpl =& $tpl;
$this->ctrl =& $ilCtrl;
$this->ctrl->saveParameter($this,'lang');
$this->lng =& $lng;
$this->lng->loadLanguageModule('registration');
$this->registration_settings = new ilRegistrationSettings();
}
ilRegistrationGUI::initForm ( )
protected

init registration form

protected

Returns

Definition at line 279 of file class.ilRegistrationGUI.php.

References fillAgreement(), fillInformations(), fillMaxMembers(), fillMembershipLimitation(), fillRegistrationPeriod(), fillRegistrationType(), getFormTitle(), and isRegistrationPossible().

Referenced by join(), and show().

{
if(is_object($this->form))
{
return true;
}
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this,'join'));
$this->form->setTitle($this->getFormTitle());
$this->fillInformations();
{
}
{
$this->fillMaxMembers();
}
{
}
{
$this->fillAgreement();
}
{
$this->form->addCommandButton('join',$this->lng->txt('join'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::initParticipants ( )
abstractprotected

Init participants object (course or group participants)

protected

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by __construct().

+ Here is the caller graph for this function:

ilRegistrationGUI::isRegistrationPossible ( )
protected

check if registration is possible

protected

Returns
bool

Definition at line 83 of file class.ilRegistrationGUI.php.

References $registration_possible.

Referenced by ilCourseRegistrationGUI\fillAgreement(), initForm(), ilGroupRegistrationGUI\validate(), and ilCourseRegistrationGUI\validate().

{
}

+ Here is the caller graph for this function:

ilRegistrationGUI::join ( )

join

public

Parameters
@return

Definition at line 247 of file class.ilRegistrationGUI.php.

References initForm(), ilUtil\sendInfo(), show(), and validate().

{
$this->initForm();
if(!$this->validate())
{
ilUtil::sendInfo($this->join_error);
$this->show();
return false;
}
$this->add();
}

+ Here is the call graph for this function:

ilRegistrationGUI::login ( )

Definition at line 90 of file class.ilRegistrationGUI.php.

References $_GET, $ilLog, $lng, ilUtil\getImagePath(), IL_REG_APPROVE, and IL_REG_DIRECT.

Referenced by saveForm().

{
global $ilias,$lng,$ilLog;
$ilLog->write("Entered login");
$this->tpl->addBlockFile("CONTENT", "content", "tpl.usr_registered.html");
$this->tpl->setVariable("IMG_USER",
ilUtil::getImagePath("icon_usr_b.gif"));
$this->tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("registration"));
$this->tpl->setVariable("TXT_WELCOME", $lng->txt("welcome").", ".$this->userObj->getTitle()."!");
if ($this->registration_settings->getRegistrationType() == IL_REG_DIRECT and
!$this->registration_settings->passwordGenerationEnabled())
{
$this->tpl->setCurrentBlock("activation");
$this->tpl->setVariable("TXT_REGISTERED", $lng->txt("txt_registered"));
$this->tpl->setVariable("FORMACTION", "login.php?cmd=post&target=".$_GET["target"]);
$this->tpl->setVariable("TARGET","target=\"_parent\"");
$this->tpl->setVariable("TXT_LOGIN", $lng->txt("login_to_ilias"));
$this->tpl->setVariable("USERNAME",$this->userObj->getLogin());
$this->tpl->setVariable("PASSWORD",$_POST["user"]['passwd']);
$this->tpl->parseCurrentBlock();
}
else if ($this->registration_settings->getRegistrationType() == IL_REG_APPROVE)
{
$this->tpl->setVariable("TXT_REGISTERED", $lng->txt("txt_submitted"));
}
else
{
$this->tpl->setVariable("TXT_REGISTERED", $lng->txt("txt_registered_passw_gen"));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::saveForm ( )

Definition at line 375 of file class.ilRegistrationGUI.php.

References $ilErr, $lng, __assignRole(), __distributeMails(), __validateRole(), ilObjUser\_loginExists(), checkUserDefinedRequiredFields(), displayForm(), ilUtil\generatePasswords(), IL_PASSWD_PLAIN, IL_REG_DIRECT, ilUtil\is_email(), ilUtil\isLogin(), ilUtil\isPassword(), login(), and ilUtil\sendInfo().

{
global $ilias, $lng, $rbacadmin, $ilDB, $ilErr;
//load ILIAS settings
$settings = $ilias->getAllSettings();
//check, whether user-agreement has been accepted
if ($_POST["status"] != "accepted")
{
ilUtil::sendInfo($lng->txt("force_accept_usr_agreement"),true);
$this->displayForm();
return false;
}
// check dynamically required fields
foreach ($settings as $key => $val)
{
if (substr($key,0,8) == "require_")
{
if ($this->registration_settings->passwordGenerationEnabled() and
($key == "require_passwd" or $key == "require_passwd2"))
{
continue;
}
if($key == 'require_default_role')
{
continue;
}
$require_keys[] = substr($key,8);
}
}
foreach ($require_keys as $key => $val)
{
if (isset($settings["require_" . $val]) && $settings["require_" . $val])
{
if (empty($_POST["user"][$val]))
{
ilUtil::sendInfo($lng->txt("fill_out_all_required_fields") . ": " . $lng->txt($val),true);
$this->displayForm();
return false;
}
}
}
{
ilUtil::sendInfo($lng->txt("fill_out_all_required_fields"),true);
$this->displayForm();
return false;
}
// validate username
if (!ilUtil::isLogin($_POST["user"]["login"]))
{
ilUtil::sendInfo($lng->txt("login_invalid"),true);
$this->displayForm();
return false;
}
// check loginname
if (ilObjUser::_loginExists($_POST["user"]["login"]))
{
ilUtil::sendInfo($lng->txt("login_exists"),true);
$this->displayForm();
return false;
}
if (!$this->registration_settings->passwordGenerationEnabled())
{
// check passwords
if ($_POST["user"]["passwd"] != $_POST["user"]["passwd2"])
{
ilUtil::sendInfo($lng->txt("passwd_not_match"),true);
$this->displayForm();
return false;
}
// validate password
if (!ilUtil::isPassword($_POST["user"]["passwd"],$custom_error))
{
if($custom_error != '') ilUtil::sendInfo($custom_error,true);
else ilUtil::sendInfo($lng->txt("passwd_invalid"),true);
$this->displayForm();
return false;
}
}
else
{
$_POST["user"]["passwd"] = $passwd[0];
}
// The password type is not passed in the post data. Therefore we
// append it here manually.
require_once './Services/User/classes/class.ilObjUser.php';
$_POST["user"]["passwd_type"] = IL_PASSWD_PLAIN;
// validate email
if (!ilUtil::is_email($_POST["user"]["email"]) &&
($settings["require_email"] || $this->registration_settings->passwordGenerationEnabled()))
{
ilUtil::sendInfo($lng->txt("email_not_valid"),true);
$this->displayForm();
return false;
}
// Do some Radius checks
$this->__validateRole();
// TODO: check if login or passwd already exists
// TODO: check length of login and passwd
// checks passed. save user
$this->userObj = new ilObjUser();
$this->userObj->assignData($_POST["user"]);
$this->userObj->setTitle($this->userObj->getFullname());
$this->userObj->setDescription($this->userObj->getEmail());
// Time limit
$this->userObj->setTimeLimitOwner(7);
if ($this->registration_settings->getAccessLimitation())
{
include_once 'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
$access_limitations_obj = new ilRegistrationRoleAccessLimitations();
if ($this->registration_settings->roleSelectionEnabled())
{
$default_role = $_POST['user']['default_role'];
}
else
{
// Assign by email
include_once 'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
$registration_role_assignments = new ilRegistrationRoleAssignments();
$default_role = $registration_role_assignments->getRoleByEmail($this->userObj->getEmail());
}
$access_limit_mode = $access_limitations_obj->getMode($default_role);
if ($access_limit_mode == 'absolute')
{
$access_limit = $access_limitations_obj->getAbsolute($default_role);
$this->userObj->setTimeLimitUnlimited(0);
$this->userObj->setTimeLimitUntil($access_limit);
}
elseif ($access_limit_mode == 'relative')
{
$rel_d = (int) $access_limitations_obj->getRelative($default_role,'d');
$rel_m = (int) $access_limitations_obj->getRelative($default_role,'m');
$rel_y = (int) $access_limitations_obj->getRelative($default_role,'y');
$access_limit = $rel_d * 86400 + $rel_m * 2592000 + $rel_y * 31536000 + time();
$this->userObj->setTimeLimitUnlimited(0);
$this->userObj->setTimeLimitUntil($access_limit);
}
else
{
$this->userObj->setTimeLimitUnlimited(1);
$this->userObj->setTimeLimitUntil(time());
}
}
else
{
$this->userObj->setTimeLimitUnlimited(1);
$this->userObj->setTimeLimitUntil(time());
}
$this->userObj->setTimeLimitFrom(time());
$this->userObj->setUserDefinedData($_POST['udf']);
$this->userObj->create();
if($this->registration_settings->getRegistrationType() == IL_REG_DIRECT)
{
$this->userObj->setActive(1);
}
else
{
$this->userObj->setActive(0,0);
}
$this->userObj->updateOwner();
// set a timestamp for last_password_change
// this ts is needed by the ACCOUNT_SECURITY_MODE_CUSTOMIZED
// in ilSecuritySettings
$this->userObj->setLastPasswordChangeTS( time() );
//insert user data in table user_data
$this->userObj->saveAsNew();
// store acceptance of user agreement
$this->userObj->writeAccepted();
// setup user preferences
$this->userObj->setLanguage($_POST["user"]["language"]);
$hits_per_page = $ilias->getSetting("hits_per_page");
if ($hits_per_page < 10)
{
$hits_per_page = 10;
}
$this->userObj->setPref("hits_per_page", $ilias->getSetting("hits_per_page"));
$show_online = $ilias->getSetting("show_users_online");
if ($show_online == "")
{
$show_online = "y";
}
$this->userObj->setPref("show_users_online", $show_online);
$this->userObj->writePrefs();
// Assign role (depends on settings in administration)
$this->__assignRole();
// Distribute mails
$this->login();
return true;
}

+ Here is the call graph for this function:

ilRegistrationGUI::show ( )

show registration form

public

Parameters
@return

Definition at line 233 of file class.ilRegistrationGUI.php.

References initForm().

Referenced by join().

{
$this->initForm();
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::showUserDefinedFields ( )

Definition at line 308 of file class.ilRegistrationGUI.php.

References ilUserDefinedFields\_getInstance(), ilUtil\formSelect(), ilUtil\prepareFormOutput(), and UDF_TYPE_TEXT.

Referenced by displayForm().

{
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$user_defined_fields =& ilUserDefinedFields::_getInstance();
#$user_defined_data = $ilUser->getUserDefinedData();
foreach($user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
{
if($definition['field_type'] == UDF_TYPE_TEXT)
{
$old = isset($_POST["udf"][$field_id]) ?
$_POST["udf"][$field_id] : '';
$this->tpl->setCurrentBlock("field_text");
$this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
$this->tpl->setVariable("FIELD_VALUE",ilUtil::prepareFormOutput($old));
if(!$definition['changeable'])
{
$this->tpl->setVariable("DISABLED_FIELD",'disabled=\"disabled\"');
}
$this->tpl->parseCurrentBlock();
}
else
{
$this->tpl->setCurrentBlock("field_select");
$this->tpl->setVariable("SELECT_BOX",ilUtil::formSelect($_POST['udf']["$definition[field_id]"],
'udf['.$definition['field_id'].']',
$user_defined_fields->fieldValuesToSelectArray(
$definition['field_values']),
false,
true));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("user_defined");
if($definition['required'])
{
$name = $definition['field_name']."<span class=\"asterisk\">*</span>";
}
else
{
$name = $definition['field_name'];
}
$this->tpl->setVariable("TXT_FIELD_NAME",$name);
$this->tpl->parseCurrentBlock();
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::validate ( )
protected

validate join request

protected

Returns
bool

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Definition at line 268 of file class.ilRegistrationGUI.php.

Referenced by join().

{
return true;
}

+ Here is the caller graph for this function:

Field Documentation

ilRegistrationGUI::$container = null
protected

Definition at line 35 of file class.ilRegistrationGUI.php.

ilRegistrationGUI::$ctrl
protected

Definition at line 48 of file class.ilRegistrationGUI.php.

ilRegistrationGUI::$form
protected

Definition at line 40 of file class.ilRegistrationGUI.php.

ilRegistrationGUI::$join_error = ''
protected

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

ilRegistrationGUI::$obj_id
protected

Definition at line 37 of file class.ilRegistrationGUI.php.

Referenced by fillMembershipLimitation().

ilRegistrationGUI::$participants
protected

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

ilRegistrationGUI::$ref_id
protected

Definition at line 36 of file class.ilRegistrationGUI.php.

Referenced by fillMembershipLimitation().

ilRegistrationGUI::$registration_possible = true
protected

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

Referenced by isRegistrationPossible().


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