ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ProviderMemberships.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\Awareness\User;
20
22
28{
29 protected \ilObjUser $user;
30 protected \ilLanguage $lng;
31 protected \ilDBInterface $db;
32
33 public function __construct(Container $DIC)
34 {
35 $this->db = $DIC->database();
36 $this->lng = $DIC->language();
37 $this->user = $DIC->user();
38 }
39
44 public function getProviderId(): string
45 {
46 return "mmbr_user_grpcrs";
47 }
48
53 public function getTitle(): string
54 {
55 $this->lng->loadLanguageModule("mmbr");
56 return $this->lng->txt("mmbr_awrn_my_groups_courses");
57 }
58
63 public function getInfo(): string
64 {
65 $this->lng->loadLanguageModule("crs");
66 return $this->lng->txt("mmbr_awrn_my_groups_courses_info");
67 }
68
74 public function getInitialUserSet(?array $user_ids = null): array
75 {
77
78 $groups_and_courses_of_user = \ilParticipants::_getMembershipByType(
79 $this->user->getId(),
80 ["grp", "crs"]
81 );
82
83 $set = $ilDB->query(
84 "SELECT DISTINCT usr_id FROM obj_members " .
85 " WHERE " . $ilDB->in("obj_id", $groups_and_courses_of_user, false, "integer") . ' ' .
86 'AND (admin > ' . $ilDB->quote(0, 'integer') . ' ' .
87 'OR tutor > ' . $ilDB->quote(0, 'integer') . ' ' .
88 'OR member > ' . $ilDB->quote(0, 'integer') . ")"
89 );
90 $ub = array();
91 while ($rec = $ilDB->fetchAssoc($set)) {
92 $ub[] = (int) $rec["usr_id"];
93 }
94
95 return $ub;
96 }
97
98 public function isHighlighted(): bool
99 {
100 return false;
101 }
102}
All members of the same courses/groups as the user.
getTitle()
Provider title (used in awareness overlay and in administration settings)
getInfo()
Provider info (used in administration settings)
getInitialUserSet(?array $user_ids=null)
Get initial set of users.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
user()
Get the current user.
Definition: Container.php:71
language()
Get interface to the i18n service.
Definition: Container.php:95
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26