Add standard fields to form.
{
if(self::$mode == self::MODE_REGISTRATION)
{
include_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
self::$user_field["username"]["group"] = "login_data";
self::$user_field["password"]["group"] = "login_data";
self::$user_field["language"]["default"] = $lng->lang_key;
$roles = self::$user_field["roles"];
unset(self::$user_field["roles"]);
self::$user_field["roles"] = $roles;
self::$user_field["roles"]["group"] = "settings";
if($registration_settings->registrationCodeRequired() ||
$registration_settings->getAllowCodes())
{
include_once 'Services/Registration/classes/class.ilRegistrationCode.php';
$code = array(
"input" => "text",
"size" => 40,
"required" => (bool)$registration_settings->registrationCodeRequired(),
"group" => "login_data"
);
self::$user_field = array_merge(array("registration_code"=>$code), self::$user_field);
}
}
$current_group = "";
$custom_fields_done = false;
foreach ($fields as $f => $p)
{
if (($p["group"] != $current_group) &&
{
if (is_array($custom_fields) && !$custom_fields_done)
{
if($current_group == "other" || $p["group"] == "settings")
{
if($current_group != "other")
{
$sh->setTitle($lng->txt("other"));
$a_form->addItem($sh);
}
foreach($custom_fields as $custom_field)
{
$a_form->addItem($custom_field);
}
$custom_fields_done = true;
}
}
$sh->setTitle($lng->txt($p["group"]));
$a_form->addItem($sh);
$current_group = $p["group"];
}
$m = "";
if (isset($p["method"]))
{
$m = $p["method"];
}
$lv = (isset($p["lang_var"]) && $p["lang_var"] != "")
? $p["lang_var"]
: $f;
switch ($p["input"])
{
case "login":
{
if($a_user)
{
}
$val->setMaxLength(32);
$val->setSize(40);
$val->setRequired(true);
}
else
{
if($a_user)
{
}
}
$a_form->addItem($val);
break;
case "text":
{
if($a_user)
{
}
$ti->setMaxLength($p["maxlength"]);
$ti->setSize($p["size"]);
if($f == "registration_code")
{
$ti->setRequired($p['required']);
}
else
{
$ti->setRequired($ilSetting->get("require_".$f));
}
if(!$ti->getRequired() || $ti->getValue())
{
$ti->setDisabled($ilSetting->get("usr_settings_disable_".$f));
}
$a_form->addItem($ti);
}
break;
case "sel_country":
{
include_once("./Services/Form/classes/class.ilCountrySelectInputGUI.php");
if($a_user)
{
}
$ci->setRequired($ilSetting->get("require_".$f));
if(!$ci->getRequired() || $ci->getValue())
{
$ci->setDisabled($ilSetting->get("usr_settings_disable_".$f));
}
$a_form->addItem($ci);
}
break;
case "birthday":
{
include_once "./Services/Calendar/classes/class.ilDateTime.php";
$date = null;
if ($a_user && strlen($a_user->$m()))
{
}
$bi->setShowEmpty(true);
$bi->setStartYear(1900);
$bi->setRequired($ilSetting->get("require_".$f));
if(!$bi->getRequired() || $date)
{
$bi->setDisabled($ilSetting->get("usr_settings_disable_".$f));
}
$a_form->addItem($bi);
}
break;
case "radio":
{
if($a_user)
{
}
foreach ($p["values"] as $k => $v)
{
$rg->addOption($op);
}
$rg->setRequired($ilSetting->get("require_".$f));
if(!$rg->getRequired() || $rg->getValue())
{
$rg->
setDisabled($ilSetting->get(
"usr_settings_disable_".$f));
}
$a_form->addItem($rg);
}
break;
case "picture":
{
true);
$ii->setDisabled($ilSetting->get("usr_settings_disable_upload"));
if ($im != "")
{
$ii->setImage($im);
$ii->setAlt($lng->txt("personal_picture"));
}
$ilSetting->get("ilinc_active"))
{
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
if ($ilinc_user->id)
{
include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
$ilincAPI->uploadPicture($ilinc_user);
$response = $ilincAPI->sendRequest("uploadPicture");
$url = trim($response->data['url']['cdata']);
$desc =
$lng->txt("ilinc_upload_pic_text")." ".
'<a href="'.$url.'">'.$lng->txt("ilinc_upload_pic_linktext").'</a>';
$ii->setInfo($desc);
}
}
$a_form->addItem($ii);
}
break;
case "roles":
if(self::$mode == self::MODE_DESKTOP)
{
{
$global_roles = $rbacreview->getGlobalRoles();
foreach($global_roles as $role_id)
{
if (in_array($role_id,$rbacreview->assignedRoles($a_user->getId())))
{
$roleObj = $ilias->obj_factory->getInstanceByObjId($role_id);
$role_names .= $roleObj->getTitle().", ";
unset($roleObj);
}
}
$dr->
setValue(substr($role_names,0,-2));
$a_form->addItem($dr);
}
}
else if(self::$mode == self::MODE_REGISTRATION)
{
if($registration_settings->roleSelectionEnabled())
{
include_once("./Services/AccessControl/classes/class.ilObjRole.php");
$options = array();
{
$options[$role["id"]] = $role["title"];
}
$ta->setRequired($ilSetting->get("require_".$f));
if(!$ta->getRequired())
{
$ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
}
$a_form->addItem($ta);
}
}
break;
case "email":
{
if($a_user)
{
}
$em->setRequired($ilSetting->get("require_".$f));
if(!$em->getRequired() || $em->getValue())
{
$em->setDisabled($ilSetting->get("usr_settings_disable_".$f));
}
$a_form->addItem($em);
}
break;
case "textarea":
{
if($a_user)
{
}
$ta->setRows($p["rows"]);
$ta->setCols($p["cols"]);
$ta->setRequired($ilSetting->get("require_".$f));
if(!$ta->getRequired() || $ta->getValue())
{
$ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
}
$a_form->addItem($ta);
}
break;
case "messenger":
{
$im_arr = $p["types"];
foreach ($im_arr as $im_name)
{
$im =
new ilTextInputGUI($lng->txt(
"im_".$im_name),
"usr_im_".$im_name);
if($a_user)
{
$im->
setValue($a_user->getInstantMessengerId($im_name));
}
$im->setMaxLength($p["maxlength"]);
$im->
setRequired($ilSetting->get(
"require_".
"instant_messengers"));
{
$im->
setDisabled($ilSetting->get(
"usr_settings_disable_".
"instant_messengers"));
}
$a_form->addItem($im);
}
}
break;
case "password":
if (self::$mode == self::MODE_REGISTRATION)
{
if(!$registration_settings->passwordGenerationEnabled())
{
}
else
{
$ta->
setValue($lng->txt(
"reg_passwd_via_mail"));
}
$a_form->addItem($ta);
}
break;
case "language":
{
if($a_user)
{
}
$options = array();
foreach ($lng->getInstalledLanguages() as $lang_key)
{
$options[$lang_key] = $lng->txt("lang_".$lang_key);
}
$ta->setOptions($options);
$ta->setRequired($ilSetting->get("require_".$f));
if(!$ta->getRequired() || $ta->getValue())
{
$ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
}
$a_form->addItem($ta);
}
break;
}
}
if(is_array($custom_fields) && !$custom_fields_done)
{
if($current_group != "other")
{
$sh->setTitle($lng->txt("other"));
$a_form->addItem($sh);
}
foreach($custom_fields as $custom_field)
{
$a_form->addItem($custom_field);
}
}
}