ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilMailUserCache.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9
class
ilMailUserCache
10
{
15
protected
static
$user_instances
=
array
();
16
21
protected
static
$requested_usr_ids
=
array
();
22
27
protected
static
$requested_usr_ids_key_map
=
array
();
28
33
public
static
function
preloadUserObjects
(
array
$usr_ids)
34
{
35
global
$DIC
;
36
37
$usr_ids_to_request = array_diff($usr_ids, self::$requested_usr_ids);
38
self::$requested_usr_ids = array_merge(self::$requested_usr_ids, $usr_ids_to_request);
39
self::$requested_usr_ids_key_map = array_flip(self::$requested_usr_ids);
40
41
if
($usr_ids_to_request) {
42
$in
= $DIC->database()->in(
'ud.usr_id'
, $usr_ids_to_request,
false
,
'integer'
);
43
$query
=
"
44
SELECT ud.usr_id, login, firstname, lastname, title, gender, pprof.value public_profile,pup.value public_upload, pupgen.value public_gender
45
FROM usr_data ud
46
LEFT JOIN usr_pref pprof ON pprof.usr_id = ud.usr_id AND pprof.keyword = %s
47
LEFT JOIN usr_pref pupgen ON pupgen.usr_id = ud.usr_id AND pupgen.keyword = %s
48
LEFT JOIN usr_pref pup ON pup.usr_id = ud.usr_id AND pup.keyword = %s
49
WHERE $in
50
"
;
51
52
$res
= $DIC->database()->queryF(
53
$query
,
54
array
(
'text'
,
'text'
,
'text'
),
55
array
(
'public_profile'
,
'public_gender'
,
'public_upload'
)
56
);
57
58
while
(
$row
= $DIC->database()->fetchAssoc(
$res
)) {
59
$user =
new
ilObjUser
;
60
$user->
setId
(
$row
[
'usr_id'
]);
61
$user->setLogin(
$row
[
'login'
]);
62
$user->setGender(
$row
[
'gender'
]);
63
$user->setTitle(
$row
[
'title'
]);
64
$user->setFirstname(
$row
[
'firstname'
]);
65
$user->setLastname(
$row
[
'lastname'
]);
66
$user->setPref(
'public_profile'
,
$row
[
'public_profile'
]);
67
$user->setPref(
'public_upload'
,
$row
[
'public_upload'
]);
68
$user->setPref(
'public_gender'
,
$row
[
'public_gender'
]);
69
70
self::$user_instances[
$row
[
'usr_id'
]] = $user;
71
}
72
}
73
}
74
80
public
static
function
getUserObjectById
($usr_id)
81
{
82
if
(!$usr_id) {
83
return
null;
84
}
85
86
if
(!array_key_exists($usr_id, self::$requested_usr_ids_key_map)) {
87
self::preloadUserObjects(
array
($usr_id));
88
}
89
90
return
isset(self::$user_instances[$usr_id]) ? self::$user_instances[$usr_id] : null;
91
}
92
}
$DIC
global $DIC
Definition:
saml.php:7
ilMailUserCache\$requested_usr_ids
static $requested_usr_ids
Definition:
class.ilMailUserCache.php:21
ilObject\setId
setId($a_id)
set object id public
Definition:
class.ilObject.php:318
ilMailUserCache\$requested_usr_ids_key_map
static $requested_usr_ids_key_map
Definition:
class.ilMailUserCache.php:27
ilMailUserCache\$user_instances
static $user_instances
Definition:
class.ilMailUserCache.php:15
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilMailUserCache\preloadUserObjects
static preloadUserObjects(array $usr_ids)
Definition:
class.ilMailUserCache.php:33
ilMailUserCache\getUserObjectById
static getUserObjectById($usr_id)
Definition:
class.ilMailUserCache.php:80
ilMailUserCache
Definition:
class.ilMailUserCache.php:9
$query
$query
Definition:
proxy_ylocal.php:13
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
$in
if(php_sapi_name() !='cli') $in
Definition:
Utf8Test.php:37
ilObjUser
Definition:
class.ilObjUser.php:25
$row
$row
Definition:
10autofilter-selection-1.php:74
Services
Mail
classes
class.ilMailUserCache.php
Generated on Sat Jan 18 2025 19:01:33 for ILIAS by
1.8.13 (using
Doxyfile
)