ILIAS  release_7 Revision v7.30-3-g800a261c036
ilForumAuthorInformationCache Class Reference

ilForumAuthorInformationCache More...

+ Collaboration diagram for ilForumAuthorInformationCache:

Static Public Member Functions

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

Static Protected Attributes

static $user_instances = array()
 
static $requested_usr_ids = array()
 
static $requested_usr_ids_key_map = array()
 

Detailed Description

Member Function Documentation

◆ getUserObjectById()

static ilForumAuthorInformationCache::getUserObjectById (   $usr_id)
static
Parameters
int$usr_id
Returns
ilObjUser|null

Definition at line 84 of file class.ilForumAuthorInformationCache.php.

85 {
86 if (!$usr_id) {
87 return null;
88 }
89
90 if (!isset(self::$requested_usr_ids_key_map[$usr_id])) {
91 self::preloadUserObjects(array($usr_id));
92 }
93
94 return isset(self::$user_instances[$usr_id]) ? self::$user_instances[$usr_id] : null;
95 }

References preloadUserObjects().

Referenced by ilForumAuthorInformation\initUserInstance().

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

◆ preloadUserObjects()

static ilForumAuthorInformationCache::preloadUserObjects ( array  $usr_ids)
static
Parameters
array$usr_ids

Definition at line 34 of file class.ilForumAuthorInformationCache.php.

35 {
36 global $DIC;
37 $ilDB = $DIC->database();
38
39 $usr_ids_to_request = array_diff($usr_ids, self::$requested_usr_ids);
40 self::$requested_usr_ids = array_merge(self::$requested_usr_ids, $usr_ids_to_request);
41 self::$requested_usr_ids_key_map = array_flip(self::$requested_usr_ids);
42
43 if ($usr_ids_to_request) {
44 $in = $ilDB->in('ud.usr_id', $usr_ids_to_request, false, 'integer');
45 $query = "
46 SELECT ud.usr_id, od.create_date, login, firstname, lastname, ud.title, gender, pprof.value public_profile, pgen.value public_gender, pup.value public_upload
47 FROM usr_data ud
48 INNER JOIN object_data od ON od.obj_id = ud.usr_id
49 LEFT JOIN usr_pref pprof ON pprof.usr_id = ud.usr_id AND pprof.keyword = %s
50 LEFT JOIN usr_pref pgen ON pgen.usr_id = ud.usr_id AND pgen.keyword = %s
51 LEFT JOIN usr_pref pup ON pup.usr_id = ud.usr_id AND pup.keyword = %s
52 WHERE $in
53 ";
54
55 $res = $ilDB->queryF(
56 $query,
57 array('text', 'text', 'text'),
58 array('public_profile', 'public_gender', 'public_upload')
59 );
60
61 while ($row = $ilDB->fetchAssoc($res)) {
62 $user = new ilObjUser;
63 $user->setId($row['usr_id']);
64 $user->setLogin($row['login']);
65 $user->setGender($row['gender']);
66 $user->setTitle($row['title']);
67 $user->setFirstname($row['firstname']);
68 $user->setLastname($row['lastname']);
69 $user->create_date = $row['create_date']; // create_date is currently a public member, has to be changed in future evtl.
70 $user->setPref('public_profile', $row['public_profile']);
71 $user->setPref('public_gender', $row['public_gender']);
72 $user->setPref('public_upload', $row['public_upload']);
73
74 self::$user_instances[$row['usr_id']] = $user;
75 }
76 }
77 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
setId($a_id)
set object id @access public
global $DIC
Definition: goto.php:24
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $in, $query, $res, and ilObject\setId().

Referenced by ilForumTopic\getNestedSetPostChildren(), ilForumTopic\getPostTree(), getUserObjectById(), and ilForumCronNotification\sendCronForumNotification().

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

Field Documentation

◆ $requested_usr_ids

ilForumAuthorInformationCache::$requested_usr_ids = array()
staticprotected

Definition at line 22 of file class.ilForumAuthorInformationCache.php.

◆ $requested_usr_ids_key_map

ilForumAuthorInformationCache::$requested_usr_ids_key_map = array()
staticprotected

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

◆ $user_instances

ilForumAuthorInformationCache::$user_instances = array()
staticprotected

Definition at line 16 of file class.ilForumAuthorInformationCache.php.


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