5include_once 
"./Services/Xml/classes/class.ilXmlWriter.php";
 
    6include_once 
'./Services/User/classes/class.ilObjUserFolder.php';
 
   54        $this->user_id = 
$ilUser->getId();
 
   55        $this->attachRoles = 
false;
 
   67        $this->attachRoles = $value == 1? true : 
false;
 
   78        if (!is_array($this->users)) {
 
   85        include_once(
"./Services/User/classes/class.ilUserDefinedFields.php");
 
   87        $udf_data->addToXML($this);
 
   89        foreach ($this->users as $user) {
 
  106        $this->
xmlSetDtdDef(
"<!DOCTYPE Users PUBLIC \"-//ILIAS//DTD UserImport//EN\" \"" . 
ILIAS_HTTP_PATH . 
"/xml/ilias_user_5_1.dtd\">");
 
  127            include_once(
'./Services/User/classes/class.ilObjUserFolder.php');
 
  133        if (strlen($row[
"language"]) == 0) {
 
  134            $row[
"language"] = 
$lng->getDefaultLanguage();
 
  138            'Id' => 
"il_" . IL_INST_ID . 
"_usr_" . $row[
"usr_id"],
 
  139            'Language' => $row[
"language"],
 
  145        $this->
xmlElement(
"Login", 
null, $row[
"login"]);
 
  147        if ($this->attachRoles == 
true) {
 
  148            include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  151                "SELECT object_data.title, object_data.description,  rbac_fa.* " .
 
  152                            "FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s " .
 
  153                            "AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id",
 
  154                $ilDB->quote($row[
"usr_id"], 
'integer')
 
  159                if ($rbacrow[
"assign"] != 
"y") {
 
  165                if ($rbacrow[
"parent"] == ROLE_FOLDER_ID) {
 
  174                                "il_" . IL_INST_ID . 
"_role_" . $rbacrow[
"rol_id"], 
"Type" => 
$type),
 
  185        if ($this->
canExport(
"PersonalPicture", 
"upload")) {
 
  188                $value = array_shift($imageData); 
 
  189                $this->
__addElement(
"PersonalPicture", $value, $imageData, 
"upload");
 
  196        $this->
__addElement(
"SecondEmail", $row[
"second_email"], 
null, 
"second_email");
 
  198        $this->
__addElement(
"Institution", $row[
"institution"]);
 
  201        $this->
__addElement(
"PostalCode", $row[
"zipcode"], 
null, 
"zipcode");
 
  203        $this->
__addElement(
"SelCountry", $row[
"sel_country"], 
null, 
"sel_country");
 
  204        $this->
__addElement(
"PhoneOffice", $row[
"phone_office"], 
null, 
"phone_office");
 
  205        $this->
__addElement(
"PhoneHome", $row[
"phone_home"], 
null, 
"phone_home");
 
  206        $this->
__addElement(
"PhoneMobile", $row[
"phone_mobile"], 
null, 
"phone_mobile");
 
  210        $this->
__addElementMulti(
"GeneralInterest", $row[
"interests_general"], 
null, 
"interests_general");
 
  211        $this->
__addElementMulti(
"OfferingHelp", $row[
"interests_help_offered"], 
null, 
"interests_help_offered");
 
  212        $this->
__addElementMulti(
"LookingForHelp", $row[
"interests_help_looking"], 
null, 
"interests_help_looking");
 
  215        $this->
__addElement(
"Comment", $row[
"referral_comment"], 
null, 
"referral_comment");
 
  216        $this->
__addElement(
"Matriculation", $row[
"matriculation"]);
 
  217        $this->
__addElement(
"Active", $row[
"active"] ? 
"true":
"false");
 
  218        $this->
__addElement(
"ClientIP", $row[
"client_ip"], 
null, 
"client_ip");
 
  219        $this->
__addElement(
"TimeLimitOwner", $row[
"time_limit_owner"], 
null, 
"time_limit_owner");
 
  220        $this->
__addElement(
"TimeLimitUnlimited", $row[
"time_limit_unlimited"], 
null, 
"time_limit_unlimited");
 
  221        $this->
__addElement(
"TimeLimitFrom", $row[
"time_limit_from"], 
null, 
"time_limit_from");
 
  222        $this->
__addElement(
"TimeLimitUntil", $row[
"time_limit_until"], 
null, 
"time_limit_until");
 
  223        $this->
__addElement(
"TimeLimitMessage", $row[
"time_limit_message"], 
null, 
"time_limit_message");
 
  224        $this->
__addElement(
"ApproveDate", $row[
"approve_date"], 
null, 
"approve_date");
 
  225        $this->
__addElement(
"AgreeDate", $row[
"agree_date"], 
null, 
"agree_date");
 
  227        if (strlen($row[
"auth_mode"]) > 0) {
 
  228            $this->
__addElement(
"AuthMode", 
null, array(
"type" => $row[
"auth_mode"]), 
"auth_mode", 
true);
 
  231        if (strlen($row[
"ext_account"]) > 0) {
 
  232            $this->
__addElement(
"ExternalAccount", $row[
"ext_account"], 
null, 
"ext_account", 
true);
 
  235        if ($this->
canExport(
"Look", 
"skin_style")) {
 
  237                "Skin" => $prefs[
"skin"], 
"Style" => $prefs[
"style"]
 
  238            ), 
"skin_style", 
true);
 
  242        $this->
__addElement(
"LastUpdate", $row[
"last_update"], 
null, 
"last_update");
 
  243        $this->
__addElement(
"LastLogin", $row[
"last_login"], 
null, 
"last_login");
 
  245        include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
 
  247        $udf_data->addToXML($this, $this->
settings);
 
  249        $this->
__addElement(
"AccountInfo", $row[
"ext_account"], array(
"Type" => 
"external"));
 
  252            "longitude" => $row[
"longitude"],
 
  253            "latitude" => $row[
"latitude"],
 
  254            "zoom" => $row[
"loc_zoom"]));
 
  258        if ($this->attachPreferences || $this->
canExport(
"prefs", 
"preferences")) {
 
  269        include_once(
"Services/Mail/classes/class.ilMailOptions.php");
 
  271        $prefs[
"mail_incoming_type"] = $mailOptions->getIncomingType();
 
  272        $prefs[
"mail_address_option"] = $mailOptions->getEmailAddressMode();
 
  273        $prefs[
"mail_signature"] = $mailOptions->getSignature();
 
  274        $prefs[
"mail_linebreak"] = $mailOptions->getLinebreak();
 
  277            foreach ($prefs as $key => $value) {
 
  279                    $this->
xmlElement(
"Pref", array(
"key" => $key), $value);
 
  286    public function __addElementMulti($tagname, $value, $attrs = 
null, $settingsname = 
null, $requiredTag = 
false)
 
  288        if (is_array($value) && 
sizeof($value)) {
 
  289            foreach ($value as $idx => $item) {
 
  290                $this->
__addElement($tagname, $item, $attrs, $settingsname, $requiredTag);
 
  295    public function __addElement($tagname, $value, $attrs = 
null, $settingsname = 
null, $requiredTag = 
false)
 
  297        if ($this->
canExport($tagname, $settingsname)) {
 
  298            if (strlen($value) > 0 || $requiredTag || (is_array($attrs) && count($attrs) > 0)) {
 
  304    private function canExport($tagname, $settingsname = 
null)
 
  306        return !is_array($this->
settings) ||
 
  307               in_array(strtolower($tagname), $this->
settings) !== 
false ||
 
  308               in_array($settingsname, $this->
settings) !== 
false;
 
  333            "SELECT value FROM usr_pref WHERE usr_id = %s AND keyword = %s",
 
  334            $ilDB->quote($usr_id, 
"integer"),
 
  335            $ilDB->quote(
'profile_image', 
"text")
 
  337        $r = 
$ilDB->query($q);
 
  338        if (
$ilDB->numRows($r) == 1) {
 
  340            $personal_picture = $personal_picture_data[
"value"];
 
  342            $image_file = $webspace_dir . 
"/usr_images/" . $personal_picture;
 
  343            if (@is_file($image_file)) {
 
  344                $fh = fopen($image_file, 
"rb");
 
  346                    $image_data = fread($fh, filesize($image_file));
 
  348                    $base64 = base64_encode($image_data);
 
  349                    $imagetype = 
"image/jpeg";
 
  350                    if (preg_match(
"/.*\.(png|gif)$/", $personal_picture, $matches)) {
 
  351                        $imagetype = 
"image/" . $matches[1];
 
  355                        "encoding" => 
"Base64",
 
  356                        "imagetype" => $imagetype
 
  373        $this->attachPreferences = $attachPrefs;
 
  389                'public_second_email',
 
  392                'public_institution',
 
  393                'public_matriculation',
 
  396                'public_phone_mobile',
 
  397                'public_phone_office',
 
  404                'hide_own_online_status',
 
  405                'bs_allow_to_contact_me',
 
  406                'chat_osc_accept_msg',
 
  409                'mail_incoming_type',
 
  412                'public_interests_general',
 
  413                'public_interests_help_offered',
 
  414                'public_interests_help_looking' 
An exception for terminatinating execution or to throw for unit testing.
Class ilMailOptions 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
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.
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlDumpMem($format=true)
Returns xml document from memory.
xmlHeader()
Writes xml header @access public.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)