ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMailUserCache Class Reference
+ Collaboration diagram for ilMailUserCache:

Static Public Member Functions

static preloadUserObjects (array $usr_ids)
 
static getUserObjectById (int $usr_id)
 

Static Protected Attributes

static array $user_instances = []
 
static array $requested_usr_ids = []
 
static array $requested_usr_ids_key_map = []
 

Detailed Description

Definition at line 21 of file class.ilMailUserCache.php.

Member Function Documentation

◆ getUserObjectById()

static ilMailUserCache::getUserObjectById ( int  $usr_id)
static

Definition at line 76 of file class.ilMailUserCache.php.

76 : ?ilObjUser
77 {
78 if ($usr_id < 1) {
79 return null;
80 }
81
82 if (!array_key_exists($usr_id, self::$requested_usr_ids_key_map)) {
83 self::preloadUserObjects([$usr_id]);
84 }
85
86 return self::$user_instances[$usr_id] ?? null;
87 }
static preloadUserObjects(array $usr_ids)
User class.

References preloadUserObjects().

Referenced by ilMailFolderGUI\executeTableAction(), ILIAS\Mail\Folder\MailFolderTableUI\getAvatar(), ilPDMailBlockGUI\getListItemForData(), and ILIAS\Mail\Folder\MailFolderTableUI\getSender().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preloadUserObjects()

static ilMailUserCache::preloadUserObjects ( array  $usr_ids)
static
Parameters
int[]$usr_ids

Definition at line 33 of file class.ilMailUserCache.php.

33 : void
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,
45 pprof.value public_profile,pup.value public_upload, pupgen.value public_gender
46 FROM usr_data ud
47 LEFT JOIN usr_pref pprof ON pprof.usr_id = ud.usr_id AND pprof.keyword = %s
48 LEFT JOIN usr_pref pupgen ON pupgen.usr_id = ud.usr_id AND pupgen.keyword = %s
49 LEFT JOIN usr_pref pup ON pup.usr_id = ud.usr_id AND pup.keyword = %s
50 WHERE $in
51 ";
52
53 $res = $DIC->database()->queryF(
54 $query,
55 ['text', 'text', 'text'],
56 ['public_profile', 'public_gender', 'public_upload']
57 );
58
59 while ($row = $DIC->database()->fetchAssoc($res)) {
60 $user = new ilObjUser();
61 $user->setId((int) $row['usr_id']);
62 $user->setLogin((string) $row['login']);
63 $user->setGender((string) $row['gender']);
64 $user->setTitle((string) $row['title']);
65 $user->setFirstname((string) $row['firstname']);
66 $user->setLastname((string) $row['lastname']);
67 $user->setPref('public_profile', $row['public_profile']);
68 $user->setPref('public_upload', $row['public_upload']);
69 $user->setPref('public_gender', $row['public_gender']);
70
71 self::$user_instances[(int) $row['usr_id']] = $user;
72 }
73 }
74 }
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26

References $DIC, $res, and ILIAS\Repository\int().

Referenced by ILIAS\Mail\Folder\MailFolderTableUI\getRows(), getUserObjectById(), and ilPDMailBlockGUI\preloadData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $requested_usr_ids

array ilMailUserCache::$requested_usr_ids = []
staticprotected

Definition at line 26 of file class.ilMailUserCache.php.

◆ $requested_usr_ids_key_map

array ilMailUserCache::$requested_usr_ids_key_map = []
staticprotected

Definition at line 28 of file class.ilMailUserCache.php.

◆ $user_instances

array ilMailUserCache::$user_instances = []
staticprotected

Definition at line 24 of file class.ilMailUserCache.php.


The documentation for this class was generated from the following file: