5 include_once
"./Services/Xml/classes/class.ilXmlWriter.php";
6 include_once
'./Services/User/classes/class.ilObjUserFolder.php';
48 parent::__construct();
51 $this->user_id = $ilUser->getId();
52 $this->attachRoles =
false;
64 $this->attachRoles = $value == 1? true :
false;
75 if (!is_array($this->users)) {
82 include_once(
"./Services/User/classes/class.ilUserDefinedFields.php");
84 $udf_data->addToXML($this);
86 foreach ($this->users as $user) {
103 $this->
xmlSetDtdDef(
"<!DOCTYPE Users PUBLIC \"-//ILIAS//DTD UserImport//EN\" \"" . ILIAS_HTTP_PATH .
"/xml/ilias_user_5_1.dtd\">");
121 include_once(
'./Services/User/classes/class.ilObjUserFolder.php');
127 if (strlen(
$row[
"language"]) == 0) {
128 $row[
"language"] = $lng->getDefaultLanguage();
132 'Id' =>
"il_" . IL_INST_ID .
"_usr_" .
$row[
"usr_id"],
133 'Language' => $row[
"language"],
139 $this->
xmlElement(
"Login", null, $row[
"login"]);
141 if ($this->attachRoles ==
true) {
142 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
145 "SELECT object_data.title, object_data.description, rbac_fa.* " .
146 "FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s " .
147 "AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id",
148 $ilDB->quote($row[
"usr_id"],
'integer')
150 $rbacresult = $ilDB->query(
$query);
153 if ($rbacrow[
"assign"] !=
"y") {
159 if ($rbacrow[
"parent"] == ROLE_FOLDER_ID) {
168 "il_" . IL_INST_ID .
"_role_" . $rbacrow[
"rol_id"],
"Type" =>
$type),
179 if ($this->
canExport(
"PersonalPicture",
"upload")) {
182 $value = array_shift($imageData);
183 $this->
__addElement(
"PersonalPicture", $value, $imageData,
"upload");
190 $this->
__addElement(
"SecondEmail", $row[
"second_email"], null,
"second_email");
192 $this->
__addElement(
"Institution", $row[
"institution"]);
195 $this->
__addElement(
"PostalCode", $row[
"zipcode"], null,
"zipcode");
197 $this->
__addElement(
"SelCountry", $row[
"sel_country"], null,
"sel_country");
198 $this->
__addElement(
"PhoneOffice", $row[
"phone_office"], null,
"phone_office");
199 $this->
__addElement(
"PhoneHome", $row[
"phone_home"], null,
"phone_home");
200 $this->
__addElement(
"PhoneMobile", $row[
"phone_mobile"], null,
"phone_mobile");
204 $this->
__addElementMulti(
"GeneralInterest", $row[
"interests_general"], null,
"interests_general");
205 $this->
__addElementMulti(
"OfferingHelp", $row[
"interests_help_offered"], null,
"interests_help_offered");
206 $this->
__addElementMulti(
"LookingForHelp", $row[
"interests_help_looking"], null,
"interests_help_looking");
209 $this->
__addElement(
"Comment", $row[
"referral_comment"], null,
"referral_comment");
210 $this->
__addElement(
"Matriculation", $row[
"matriculation"]);
211 $this->
__addElement(
"Active", $row[
"active"] ?
"true":
"false");
212 $this->
__addElement(
"ClientIP", $row[
"client_ip"], null,
"client_ip");
213 $this->
__addElement(
"TimeLimitOwner", $row[
"time_limit_owner"], null,
"time_limit_owner");
214 $this->
__addElement(
"TimeLimitUnlimited", $row[
"time_limit_unlimited"], null,
"time_limit_unlimited");
215 $this->
__addElement(
"TimeLimitFrom", $row[
"time_limit_from"], null,
"time_limit_from");
216 $this->
__addElement(
"TimeLimitUntil", $row[
"time_limit_until"], null,
"time_limit_until");
217 $this->
__addElement(
"TimeLimitMessage", $row[
"time_limit_message"], null,
"time_limit_message");
218 $this->
__addElement(
"ApproveDate", $row[
"approve_date"], null,
"approve_date");
219 $this->
__addElement(
"AgreeDate", $row[
"agree_date"], null,
"agree_date");
221 if (strlen($row[
"auth_mode"])>0) {
222 $this->
__addElement(
"AuthMode", null,
array(
"type" => $row[
"auth_mode"]),
"auth_mode",
true);
225 if (strlen($row[
"ext_account"])>0) {
226 $this->
__addElement(
"ExternalAccount", $row[
"ext_account"], null,
"ext_account",
true);
229 if ($this->
canExport(
"Look",
"skin_style")) {
231 "Skin" => $prefs[
"skin"],
"Style" => $prefs[
"style"]
232 ),
"skin_style",
true);
236 $this->
__addElement(
"LastUpdate", $row[
"last_update"], null,
"last_update");
237 $this->
__addElement(
"LastLogin", $row[
"last_login"], null,
"last_login");
239 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
241 $udf_data->addToXML($this, $this->
settings);
243 $this->
__addElement(
"AccountInfo", $row[
"ext_account"],
array(
"Type" =>
"external"));
246 "longitude" => $row[
"longitude"],
247 "latitude" => $row[
"latitude"],
248 "zoom" => $row[
"loc_zoom"]));
252 if ($this->attachPreferences || $this->
canExport(
"prefs",
"preferences")) {
263 include_once(
"Services/Mail/classes/class.ilMailOptions.php");
265 $prefs[
"mail_incoming_type"] = $mailOptions->getIncomingType();
266 $prefs[
"mail_address_option"] = $mailOptions->getMailAddressOption();
267 $prefs[
"mail_signature"] = $mailOptions->getSignature();
268 $prefs[
"mail_linebreak"] = $mailOptions->getLinebreak();
271 foreach ($prefs as
$key => $value) {
280 public function __addElementMulti($tagname, $value, $attrs = null, $settingsname = null, $requiredTag =
false)
282 if (is_array($value) &&
sizeof($value)) {
283 foreach ($value as $idx => $item) {
284 $this->
__addElement($tagname, $item, $attrs, $settingsname, $requiredTag);
289 public function __addElement($tagname, $value, $attrs = null, $settingsname = null, $requiredTag =
false)
291 if ($this->
canExport($tagname, $settingsname)) {
292 if (strlen($value) > 0 || $requiredTag || (is_array($attrs) && count($attrs) > 0)) {
298 private function canExport($tagname, $settingsname = null)
300 return !is_array($this->
settings) ||
301 in_array(strtolower($tagname), $this->
settings) !==
false ||
302 in_array($settingsname, $this->
settings) !==
false;
325 "SELECT value FROM usr_pref WHERE usr_id = %s AND keyword = %s",
326 $ilDB->quote($usr_id,
"integer"),
327 $ilDB->quote(
'profile_image',
"text")
329 $r = $ilDB->query($q);
330 if ($ilDB->numRows($r) == 1) {
332 $personal_picture = $personal_picture_data[
"value"];
334 $image_file = $webspace_dir .
"/usr_images/" . $personal_picture;
335 if (@is_file($image_file)) {
336 $fh = fopen($image_file,
"rb");
338 $image_data = fread(
$fh, filesize($image_file));
340 $base64 = base64_encode($image_data);
341 $imagetype =
"image/jpeg";
342 if (preg_match(
"/.*\.(png|gif)$/", $personal_picture, $matches)) {
343 $imagetype =
"image/" . $matches[1];
347 "encoding" =>
"Base64",
348 "imagetype" => $imagetype
365 $this->attachPreferences = $attachPrefs;
381 'public_second_email',
384 'public_institution',
385 'public_matriculation',
388 'public_phone_mobile',
389 'public_phone_office',
396 'hide_own_online_status',
397 'bs_allow_to_contact_me',
398 'chat_osc_accept_msg',
401 'mail_incoming_type',
404 'public_interests_general',
405 'public_interests_help_offered',
406 'public_interests_help_looking' getPictureValue($usr_id)
return array with baseencoded picture data as key value, encoding type as encoding, and image type as key type.
Class ilMailOptions this class handles user mails.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlSetGenCmt($genCmt)
Sets generated comment.
static _getInstance()
Get instance.
__handlePreferences($prefs, $row)
__addElement($tagname, $value, $attrs=null, $settingsname=null, $requiredTag=false)
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlDumpMem($format=true)
Returns xml document from memory.
setSettings($settings)
write access to settings
static isPrefExportable($key)
returns wether a key from db is exportable or not
canExport($tagname, $settingsname=null)
xmlEndTag($tag)
Writes an endtag.
static getExportSettings()
getExport Settings
setAttachPreferences($attachPrefs)
if set to true, all preferences of a user will be set
redirection script todo: (a better solution should control the processing via a xml file) ...
xmlHeader()
Writes xml header public.
Create styles array
The data for the language used.
__addElementMulti($tagname, $value, $attrs=null, $settingsname=null, $requiredTag=false)
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static getExportablePreferences()
return exportable preference keys as found in db
static _getPreferences($user_id)
get preferences for user
static getWebspaceDir($mode="filesystem")
get webspace directory