5include_once 
"./Services/Xml/classes/class.ilXmlWriter.php";
 
    6include_once 
'./Services/User/classes/class.ilObjUserFolder.php';
 
   48                parent::ilXmlWriter();
 
   51                $this->user_id = 
$ilUser->getId();
 
   52                $this->attachRoles = 
false;
 
   64                $this->attachRoles = $value == 1? true : 
false;
 
   75                if (!is_array($this->users))
 
   81            include_once (
"./Services/User/classes/class.ilUserDefinedFields.php");
 
   83                $udf_data->addToXML($this);
 
   85                foreach ($this->users as $user)
 
  105                $this->
xmlSetDtdDef(
"<!DOCTYPE Users PUBLIC \"-//ILIAS//DTD UserImport//EN\" \"".ILIAS_HTTP_PATH.
"/xml/ilias_user_4_0.dtd\">");
 
  122                if (!is_array ($this->settings))  {
 
  123                        include_once (
'./Services/User/classes/class.ilObjUserFolder.php');
 
  129                if (strlen(
$row[
"language"]) == 0)
 
  131                        $row[
"language"] = 
$lng->getDefaultLanguage();
 
  136                        'Id' => 
"il_".IL_INST_ID.
"_usr_".
$row[
"usr_id"],
 
  137                        'Language' => 
$row[
"language"],
 
  145                if ($this->attachRoles == TRUE)
 
  147                        include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  149                        $query = sprintf(
"SELECT object_data.title, object_data.description,  rbac_fa.* ".
 
  150                                        "FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s ".
 
  151                                                        "AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id",
 
  158                                        if ($rbacrow[
"assign"] != 
"y")
 
  163                                        if ($rbacrow[
"parent"] == ROLE_FOLDER_ID)
 
  175                                                                "il_".IL_INST_ID.
"_role_".$rbacrow[
"rol_id"], 
"Type" => $type),
 
  186                if ($this->
canExport(
"PersonalPicture", 
"upload"))
 
  191                                $value = array_shift($imageData); 
 
  192                                $this->
__addElement (
"PersonalPicture", $value, $imageData, 
"upload");
 
  205                $this->
__addElement (
"PhoneOffice", 
$row[
"phone_office"], 
null, 
"phone_office");
 
  207                $this->
__addElement (
"PhoneMobile", 
$row[
"phone_mobile"],  
null, 
"phone_mobile");
 
  212                $this->
__addElementMulti (
"OfferingHelp", 
$row[
"interests_help_offered"], 
null, 
"interests_help_offered");
 
  213                $this->
__addElementMulti (
"LookingForHelp", 
$row[
"interests_help_looking"], 
null, 
"interests_help_looking");            
 
  216                $this->
__addElement (
"Comment", 
$row[
"referral_comment"], 
null, 
"referral_comment");
 
  220                $this->
__addElement (
"TimeLimitOwner", 
$row[
"time_limit_owner"], 
null, 
"time_limit_owner");
 
  221                $this->
__addElement (
"TimeLimitUnlimited", 
$row[
"time_limit_unlimited"], 
null, 
"time_limit_unlimited");
 
  222                $this->
__addElement (
"TimeLimitFrom", 
$row[
"time_limit_from"], 
null, 
"time_limit_from");
 
  223                $this->
__addElement (
"TimeLimitUntil", 
$row[
"time_limit_until"], 
null, 
"time_limit_until");
 
  224                $this->
__addElement (
"TimeLimitMessage", 
$row[
"time_limit_message"], 
null, 
"time_limit_message");
 
  225                $this->
__addElement (
"ApproveDate", 
$row[
"approve_date"], 
null, 
"approve_date");
 
  228                if (strlen(
$row[
"auth_mode"])>0)
 
  230                        $this->
__addElement (
"AuthMode", 
null, array (
"type" => 
$row[
"auth_mode"]),
"auth_mode", 
true);
 
  233                if (strlen(
$row[
"ext_account"])>0)
 
  235                        $this->
__addElement (
"ExternalAccount", 
$row[
"ext_account"], 
null, 
"ext_account", 
true);
 
  238            if ($this->
canExport(
"Look",
"skin_style"))
 
  241                        "Skin"  =>      $prefs[
"skin"], 
"Style" =>      $prefs[
"style"]
 
  242                ), 
"skin_style", 
true);
 
  247                $this->
__addElement (
"LastUpdate", 
$row[
"last_update"], 
null, 
"last_update");
 
  250                include_once (
"./Services/User/classes/class.ilUserDefinedData.php");
 
  252                $udf_data->addToXML($this, $this->settings);
 
  254                $msgrs = array (
"skype" => 
"im_skype", 
"yahoo" => 
"im_yahoo", 
"msn"=>
"im_msn", 
"aim"=>
"im_aim", 
"icq"=>
"im_icq", 
"delicious" => 
"delicious", 
"external" => 
"ext_account", 
"jabber" => 
"im_jabber", 
"voip" => 
"im_voip");
 
  255                foreach ($msgrs as $type => $fieldname) {
 
  256                        $this->
__addElement(
"AccountInfo", 
$row[$fieldname], array(
"Type" => $type), 
"instant_messengers");
 
  260                        "longitude" => 
$row[
"longitude"],
 
  261                        "latitude" => 
$row[
"latitude"],
 
  262                        "zoom" => 
$row[
"loc_zoom"]));
 
  266                if ($this->attachPreferences || $this->
canExport(
"prefs", 
"preferences"))
 
  276                include_once (
"Services/Mail/classes/class.ilMailOptions.php");
 
  278                $prefs[
"mail_incoming_type"] = $mailOptions->getIncomingType();         
 
  279                $prefs[
"mail_signature"] = $mailOptions->getSignature();
 
  280                $prefs[
"mail_linebreak"] = $mailOptions->getLinebreak();
 
  284                        foreach ($prefs as $key => $value) 
 
  287                                        $this->
xmlElement(
"Pref", array(
"key" => $key), $value);        
 
  293        function __addElementMulti ($tagname, $value, $attrs = 
null, $settingsname = 
null, $requiredTag = 
false)
 
  295                if(is_array($value) && 
sizeof($value))
 
  297                        foreach($value as $idx => $item)
 
  299                                $this->
__addElement ($tagname, $item, $attrs, $settingsname, $requiredTag);
 
  304        function __addElement ($tagname, $value, $attrs = 
null, $settingsname = 
null, $requiredTag = 
false)
 
  306                if ($this->
canExport($tagname, $settingsname))
 
  307                        if (strlen($value) > 0 || $requiredTag || (is_array($attrs) && count($attrs) > 0))
 
  312        private function canExport ($tagname, $settingsname = 
null)
 
  314                return !is_array($this->settings) ||
 
  315                           in_array(strtolower($tagname), $this->settings) !== FALSE ||
 
  316                           in_array($settingsname, $this->settings) !== FALSE;
 
  336                $q = sprintf(
"SELECT value FROM usr_pref WHERE usr_id = %s AND keyword = %s",
 
  337                        $ilDB->quote($usr_id, 
"integer"), 
$ilDB->quote(
'profile_image', 
"text"));
 
  338                $r = 
$ilDB->query($q);
 
  339                if (
$ilDB->numRows($r) == 1)
 
  342                        $personal_picture = $personal_picture_data[
"value"];
 
  344                        $image_file = $webspace_dir.
"/usr_images/".$personal_picture;
 
  345                        if (@is_file($image_file))
 
  347                                $fh = fopen($image_file, 
"rb");
 
  350                                        $image_data = fread($fh, filesize($image_file));
 
  352                                        $base64 = base64_encode($image_data);
 
  353                                        $imagetype = 
"image/jpeg";
 
  354                                        if (preg_match(
"/.*\.(png|gif)$/", $personal_picture, $matches))
 
  356                                                $imagetype = 
"image/".$matches[1];
 
  360                                                "encoding" => 
"Base64",
 
  361                                                "imagetype" => $imagetype
 
  378                $this->attachPreferences = $attachPrefs;
 
  395                                'public_institution',
 
  396                                'public_matriculation',
 
  399                                'public_phone_mobile',
 
  400                                'public_phone_office',
 
  407                                'hide_own_online_status',
 
  410                                'mail_incoming_type',
 
  413                                'public_interests_general',
 
  414                                'public_interests_help_offered',
 
  415                                'public_interests_help_looking' 
Class UserMail this class handles user mails.
static getExportSettings()
getExport Settings
static _getPreferences($user_id)
get preferences for user
static _getInstance()
Get instance.
setSettings($settings)
write access to settings
ilUserXMLWriter()
constructor
static isPrefExportable($key)
returns wether a key from db is exportable or not
__handlePreferences($prefs, $row)
static getExportablePreferences()
return exportable preference keys as found in db
__addElement($tagname, $value, $attrs=null, $settingsname=null, $requiredTag=false)
canExport($tagname, $settingsname=null)
setAttachPreferences($attachPrefs)
if set to true, all preferences of a user will be set
__addElementMulti($tagname, $value, $attrs=null, $settingsname=null, $requiredTag=false)
getPictureValue($usr_id)
return array with baseencoded picture data as key value, encoding type as encoding,...
static getWebspaceDir($mode="filesystem")
get webspace directory
xmlEndTag($tag)
Writes an endtag.
xmlDumpMem($format=TRUE)
Returns xml document from memory.
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlHeader()
Writes xml header @access public.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
redirection script todo: (a better solution should control the processing via a xml file)