ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserProfile Class Reference

Class ilUserProfile. More...

+ Collaboration diagram for ilUserProfile:

Public Member Functions

 __construct ()
 Constructor.
 getStandardFields ()
 Get standard user fields array.
 skipGroup ($a_group)
 Skip a group.
 skipField ($a_field)
 Skip a field.
 addStandardFieldsToForm ($a_form, $a_user)
 Add standard fields to form.

Static Public Member Functions

static userSettingVisible ($a_setting)
 Checks whether user setting is visible.

Static Private Attributes

static $user_field

Detailed Description

Class ilUserProfile.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 15 of file class.ilUserProfile.php.

Constructor & Destructor Documentation

ilUserProfile::__construct ( )

Constructor.

Definition at line 275 of file class.ilUserProfile.php.

{
$this->skip_groups = array();
$this->skip_fields = array();
}

Member Function Documentation

ilUserProfile::addStandardFieldsToForm (   $a_form,
  $a_user 
)

Add standard fields to form.

Definition at line 319 of file class.ilUserProfile.php.

References $desc, $f, $ilSetting, $lng, ilObjUser\_getPersonalPicturePath(), getStandardFields(), IL_CAL_DATE, ilDateTime\setDate(), ilRadioOption\setDisabled(), ilTextInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), ilTextAreaInputGUI\setValue(), and userSettingVisible().

{
global $ilSetting, $lng, $rbacreview, $ilias;
$fields = $this->getStandardFields();
$current_group = "";
foreach ($fields as $f => $p)
{
//var_dump($p);
// next group? -> diplay subheader
if (($p["group"] != $current_group) &&
{
// contact data
$sh->setTitle($lng->txt($p["group"]));
$a_form->addItem($sh);
$current_group = $p["group"];
}
$m = $p["method"];
$lv = ($p["lang_var"] != "")
? $p["lang_var"]
: $f;
switch ($p["input"])
{
case "login":
if ((int)$ilSetting->get('allow_change_loginname'))
{
$val = new ilTextInputGUI($lng->txt('username'),'username');
$val->setValue($a_user->getLogin());
$val->setMaxLength(32);
$val->setSize(40);
$val->setRequired(true);
}
else
{
// user account name
$val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un');
$val->setValue($a_user->getLogin());
}
$a_form->addItem($val);
break;
case "text":
{
$ti = new ilTextInputGUI($lng->txt($lv), "usr_".$f);
$ti->setValue($a_user->$m());
$ti->setMaxLength($p["maxlength"]);
$ti->setSize($p["size"]);
$ti->setDisabled($ilSetting->get("usr_settings_disable_".$f));
$ti->setRequired($ilSetting->get("require_".$f));
$a_form->addItem($ti);
}
break;
case "birthday":
{
$bi = new ilBirthdayInputGUI($lng->txt($lv), "usr_".$f);
include_once "./Services/Calendar/classes/class.ilDateTime.php";
if (strlen($a_user->$m()))
{
$date = new ilDateTime($a_user->$m(), IL_CAL_DATE);
$bi->setDate($date);
}
$bi->setShowEmpty(true);
$bi->setStartYear(1900);
$bi->setDisabled($ilSetting->get("usr_settings_disable_".$f));
$bi->setRequired($ilSetting->get("require_".$f));
$a_form->addItem($bi);
}
break;
case "radio":
{
$rg = new ilRadioGroupInputGUI($lng->txt($lv), "usr_".$f);
$rg->setValue($a_user->$m());
foreach ($p["values"] as $k => $v)
{
$op = new ilRadioOption($lng->txt($v), $k);
$rg->addOption($op);
}
$rg->setDisabled($ilSetting->get("usr_settings_disable_".$f));
$rg->setRequired($ilSetting->get("require_".$f));
$a_form->addItem($rg);
}
break;
case "picture":
{
$ii = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
$im = ilObjUser::_getPersonalPicturePath($a_user->getId(), "small", true,
true);
$ii->setDisabled($ilSetting->get("usr_settings_disable_upload"));
if ($im != "")
{
$ii->setImage($im);
$ii->setAlt($lng->txt("personal_picture"));
}
// ilinc link as info
$ilSetting->get("ilinc_active"))
{
include_once ('./Modules/ILinc/classes/class.ilObjiLincUser.php');
$ilinc_user = new ilObjiLincUser($a_user);
if ($ilinc_user->id)
{
include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
$ilincAPI = new ilnetucateXMLAPI();
$ilincAPI->uploadPicture($ilinc_user);
$response = $ilincAPI->sendRequest("uploadPicture");
// return URL to user's personal page
$url = trim($response->data['url']['cdata']);
$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":
$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 = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr");
$dr->setValue(substr($role_names,0,-2));
$a_form->addItem($dr);
break;
case "email":
{
$em = new ilTextInputGUI($lng->txt($lv), "usr_".$f);
$em->setValue($a_user->$m());
$em->setMaxLength($p["maxlength"]);
$em->setSize($p["size"]);
$em->setDisabled($ilSetting->get("usr_settings_disable_".$f));
$em->setRequired($ilSetting->get("require_".$f));
$a_form->addItem($em);
}
break;
case "textarea":
{
$ta = new ilTextAreaInputGUI($lng->txt($lv), "usr_".$f);
$ta->setValue($a_user->$m());
$ta->setRows($p["rows"]);
$ta->setCols($p["cols"]);
$ta->setDisabled($ilSetting->get("usr_settings_disable_".$f));
$ta->setRequired($ilSetting->get("require_".$f));
$a_form->addItem($ta);
}
break;
case "messenger":
if (ilUserProfile::userSettingVisible("instant_messengers"))
{
$im_arr = $p["types"];
foreach ($im_arr as $im_name)
{
$im = new ilTextInputGUI($lng->txt("im_".$im_name), "usr_im_".$im_name);
$im->setValue($a_user->getInstantMessengerId($im_name));
$im->setMaxLength($p["maxlength"]);
$im->setSize($p["size"]);
$im->setDisabled($ilSetting->get("usr_settings_disable_"."instant_messengers"));
$im->setRequired($ilSetting->get("require_"."instant_messengers"));
$a_form->addItem($im);
}
}
break;
case "password":
// todo
break;
}
}
}

+ Here is the call graph for this function:

ilUserProfile::getStandardFields ( )

Get standard user fields array.

Definition at line 284 of file class.ilUserProfile.php.

References $f.

Referenced by addStandardFieldsToForm().

{
$fields = array();
foreach (self::$user_field as $f => $p)
{
// skip hidden groups
if (in_array($p["group"], $this->skip_groups) ||
in_array($f, $this->skip_fields))
{
continue;
}
$fields[$f] = $p;
}
return $fields;
}

+ Here is the caller graph for this function:

ilUserProfile::skipField (   $a_field)

Skip a field.

Definition at line 311 of file class.ilUserProfile.php.

{
$this->skip_fields[] = $a_field;
}
ilUserProfile::skipGroup (   $a_group)

Skip a group.

Definition at line 303 of file class.ilUserProfile.php.

{
$this->skip_groups[] = $a_group;
}
static ilUserProfile::userSettingVisible (   $a_setting)
static

Checks whether user setting is visible.

Definition at line 522 of file class.ilUserProfile.php.

References $ilSetting.

Referenced by addStandardFieldsToForm().

{
global $ilSetting;
return ($ilSetting->get("usr_settings_hide_".$a_setting) != 1);
}

+ Here is the caller graph for this function:

Field Documentation

ilUserProfile::$user_field
staticprivate

Definition at line 41 of file class.ilUserProfile.php.


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