30 return array(
"4.3.0",
"4.5.0",
"5.1.0",
"5.2.0",
"5.3.0");
33 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
35 return "https://www.ilias.de/xml/Services/User/" . $a_entity;
38 protected function getTypes(
string $a_entity,
string $a_version): array
41 if ($a_entity ==
"usr_profile") {
51 "Firstname" =>
"text",
56 "Institution" =>
"text",
57 "Department" =>
"text",
62 "SelCountry" =>
"text",
63 "PhoneOffice" =>
"text",
64 "PhoneHome" =>
"text",
65 "PhoneMobile" =>
"text",
68 "SecondEmail" =>
"text",
70 "ReferralComment" =>
"text",
71 "Matriculation" =>
"text",
73 "Longitude" =>
"text",
75 "Picture" =>
"directory" 80 if ($a_entity ==
"usr_setting") {
88 "UserId" =>
"integer",
95 if ($a_entity ==
"personal_data") {
108 if ($a_entity ==
"usr_multi") {
109 switch ($a_version) {
115 "UserId" =>
"integer",
124 public function getXmlRecord(
string $a_entity,
string $a_version, array $a_set): array
128 if ($a_entity ==
"usr_profile") {
143 $this->temp_picture_dirs[$a_set[
"Id"]] = $tmp_dir;
145 $a_set[
"Picture"] = $tmp_dir;
153 if ($a_entity ==
"usr_profile") {
155 $tmp_dir = $this->temp_picture_dirs[$a_set[
"Id"]];
156 if ($tmp_dir !=
"" && is_dir($tmp_dir)) {
162 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
166 $ilDB = $DIC[
'ilDB'];
168 if (!is_array($a_ids)) {
169 $a_ids = array($a_ids);
172 if ($a_entity ==
"personal_data") {
173 switch ($a_version) {
179 $this->data = array();
180 foreach ($a_ids as
$id) {
181 $this->data[] = array(
"Id" => $id);
187 if ($a_entity ==
"usr_profile") {
188 switch ($a_version) {
193 " title, birthday, gender, institution, department, street, city, zipcode, country, sel_country, " .
194 " phone_office, phone_home, phone_mobile, fax, email, hobby, referral_comment, matriculation, " .
195 " delicious, latitude, longitude, loc_zoom" .
196 " FROM usr_data u " .
198 $ilDB->in(
"u.usr_id", $a_ids,
false,
"integer"));
203 " title, birthday, gender, institution, department, street, city, zipcode, country, sel_country, " .
204 " phone_office, phone_home, phone_mobile, fax, email, hobby, referral_comment, matriculation, " .
205 " latitude, longitude, loc_zoom" .
206 " FROM usr_data u " .
208 $ilDB->in(
"u.usr_id", $a_ids,
false,
"integer"));
212 " title, birthday, gender, institution, department, street, city, zipcode, country, sel_country, " .
213 " phone_office, phone_home, phone_mobile, fax, email, second_email, hobby, referral_comment, matriculation, " .
214 " latitude, longitude, loc_zoom" .
215 " FROM usr_data u " .
217 $ilDB->in(
"u.usr_id", $a_ids,
false,
"integer"));
222 if ($a_entity ==
"usr_setting") {
223 switch ($a_version) {
230 $prefs = array(
"date_format",
"day_end",
"day_start",
"bs_allow_to_contact_me",
"chat_osc_accept_msg",
"hide_own_online_status",
"hits_per_page",
"language",
231 "public_birthday",
"puplic_city",
"public_country",
"public_delicious",
"public_department",
"public_email",
"public_second_email",
232 "public_fax",
"public_gender",
"public_hobby",
"public_im_aim",
"public_im_icq",
"public_im_jabber",
233 "public_im_msn",
"public_im_skype",
"public_im_voip",
"public_im_yahoo",
"public_institution",
"public_location",
234 "public_matriculation",
"public_phone_home",
"public_phone_mobile",
"public_phone_office",
235 "public_profile",
"public_sel_country",
"public_street",
"public_title",
"public_upload",
"public_zipcode",
236 "screen_reader_optimization",
"show_users_online",
237 "store_last_visited",
"time_format",
"user_tz",
"weekstart",
238 "session_reminder_enabled",
"session_reminder_lead_time",
"usr_starting_point",
239 "char_selector_availability",
"char_selector_definition",
"chat_broadcast_typing");
241 if (version_compare($a_version,
'5.2.0',
'>=')) {
243 $prefs[
'public_im_aim'], $prefs[
'public_im_icq'], $prefs[
'public_im_jabber'],
244 $prefs[
'public_im_msn'], $prefs[
'public_im_skype'], $prefs[
'public_im_voip'],
245 $prefs[
'public_im_yahoo'], $prefs[
'public_delicious']
249 $this->data = array();
250 $set =
$ilDB->query(
"SELECT * FROM usr_pref " .
251 " WHERE " .
$ilDB->in(
"keyword", $prefs,
false,
"text") .
252 " AND " .
$ilDB->in(
"usr_id", $a_ids,
false,
"integer"));
253 while ($rec =
$ilDB->fetchAssoc($set)) {
254 $this->data[] = array(
"UserId" => $rec[
"usr_id"],
"Keyword" => $rec[
"keyword"],
"Value" => $rec[
"value"]);
260 if ($a_entity ==
"usr_multi") {
261 switch ($a_version) {
266 $this->data = array();
267 $set =
$ilDB->query(
"SELECT * FROM usr_data_multi" .
268 " WHERE " .
$ilDB->in(
"usr_id", $a_ids,
false,
"integer"));
269 while ($rec =
$ilDB->fetchAssoc($set)) {
270 $this->data[] = array(
"UserId" => $rec[
"usr_id"],
"FieldId" => $rec[
"field_id"],
"Value" => $rec[
"value"]);
282 string $a_schema_version
290 case "personal_data":
297 $usr_id = $a_mapping->
getMapping(
"Services/User",
"usr", $a_rec[
"Id"]);
299 if (!isset($this->users[$usr_id])) {
300 $this->users[$usr_id] =
new ilObjUser($usr_id);
302 $user = $this->users[$usr_id];
304 $prof->skipField(
"username");
305 $prof->skipField(
"password");
306 $prof->skipField(
"roles");
307 $prof->skipGroup(
"settings");
308 $fields = $prof->getStandardFields();
309 foreach ($fields as $k =>
$f) {
313 !
$ilSetting->get(
"usr_settings_disable_" . $k) &&
314 (
$f[
"method"] ??
"") !=
"" && isset($a_rec[$up_k])) {
315 $set_method =
"set" . substr(
$f[
"method"], 3);
320 $user->setLatitude($a_rec[
"Latitude"] ?? null);
321 $user->setLongitude($a_rec[
"Longitude"] ?? null);
322 $zoom = isset($a_rec[
"LocZoom"]) ? (
int) $a_rec[
"LocZoom"] : null;
323 $user->setLocationZoom($zoom);
328 $pic_dir = $this->
getImportDirectory() .
"/" . str_replace(
"..",
"", $a_rec[
"Picture"]);
329 if ($pic_dir !=
"" && is_dir($pic_dir)) {
330 $upload_file = $pic_dir .
"/usr_" . $a_rec[
"Id"] .
".jpg";
331 if (!is_file($upload_file)) {
332 $upload_file = $pic_dir .
"/upload_" . $a_rec[
"Id"] .
"pic";
334 if (is_file($upload_file)) {
342 $usr_id = $a_mapping->
getMapping(
"Services/User",
"usr", $a_rec[
"UserId"]);
344 if (!isset($this->users[$usr_id])) {
345 $this->users[$usr_id] =
new ilObjUser($usr_id);
347 $user = $this->users[$usr_id];
353 $usr_id = $a_mapping->
getMapping(
"Services/User",
"usr", $a_rec[
"UserId"]);
static userSettingVisible(string $a_setting)
Checks whether user setting is visible.
static copyProfilePicturesToDirectory(int $a_user_id, string $a_dir)
convertToLeadingUpper(string $a_str)
Make xyz_abc a XyzAbc string.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
afterXmlRecordWriting(string $a_entity, string $a_version, array $a_set)
static secureString(string $a_str, bool $a_strip_html=true, string $a_allow="")
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
static _uploadPersonalPicture(string $tmp_file, int $obj_id)
Create a personal picture image file from a temporary image file.
readData(string $a_entity, string $a_version, array $a_ids)
getTypes(string $a_entity, string $a_version)
getXmlRecord(string $a_entity, string $a_version, array $a_set)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getXmlNamespace(string $a_entity, string $a_schema_version)
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...