19 declare(strict_types=1);
44 $conversationIds = [];
46 $res = $this->db->queryF(
47 'SELECT DISTINCT(conversation_id) FROM osc_activity WHERE user_id = %s',
49 [$this->
user->getId()]
51 while ($row = $this->db->fetchAssoc(
$res)) {
52 $conversationIds[$row[
'conversation_id']] = $row[
'conversation_id'];
55 $res = $this->db->queryF(
56 'SELECT DISTINCT(conversation_id) FROM osc_messages WHERE user_id = %s',
58 [$this->
user->getId()]
60 while ($row = $this->db->fetchAssoc(
$res)) {
61 $conversationIds[$row[
'conversation_id']] = $row[
'conversation_id'];
64 if (0 === count($conversationIds)) {
70 $in = $this->db->in(
'id', $conversationIds,
false,
'text');
71 $res = $this->db->query(
'SELECT DISTINCT(participants) FROM osc_conversation WHERE ' . $in);
72 while ($row = $this->db->fetchAssoc(
$res)) {
73 $participants = json_decode((
string) $row[
'participants'],
true, 512, JSON_THROW_ON_ERROR);
75 if (is_array($participants)) {
76 $usrIds = array_unique(array_merge($usrIds, array_filter(array_map(
static function ($user):
int {
77 if (is_array($user) && isset($user[
'id'])) {
78 return (
int) $user[
'id'];
95 $usrIds = array_filter(array_map(
'intval', array_map(
'trim', $usrIds)));
104 foreach ($usrIds as $usr_id) {
105 $publicImage = $publicData[$usr_id][
'img'] ??
'';
108 if (isset($publicData[$usr_id])) {
110 if (isset($publicData[$usr_id][
'login'])) {
111 $publicName = $login = $publicData[$usr_id][
'login'];
114 if (isset($publicData[$usr_id][
'public_profile']) && $publicData[$usr_id][
'public_profile']) {
115 $publicName = implode(
' ', array_filter(array_map(
'trim', [
116 (
string) ($publicData[$usr_id][
'firstname'] ??
''),
117 (
string) ($publicData[$usr_id][
'lastname'] ??
''),
120 if ($publicName ===
'') {
121 $publicName = $login;
127 'public_name' => $publicName,
128 'profile_image' => $publicImage
__construct(protected ilDBInterface $db, protected ilObjUser $user)
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
getDataByUserIds(array $usrIds)
static getTokenMaxLifetimeInSeconds()
getInitialUserProfileData()