ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ProviderCurrentCourse.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\Awareness\User;
20
22
29{
30 protected \ilLanguage $lng;
31 protected \ILIAS\Awareness\StandardGUIRequest $request;
32 protected \ILIAS\DI\RBACServices $rbac;
33 protected \ilDBInterface $db;
34 protected \ilTree $tree;
35 protected \ilAccessHandler $access;
36
37 public function __construct(Container $DIC)
38 {
39 $this->db = $DIC->database();
40 $this->tree = $DIC->repositoryTree();
41 $this->access = $DIC->access();
42 $this->rbac = $DIC->rbac();
43 $this->lng = $DIC->language();
44 $this->request = $DIC->awareness()
45 ->internal()
46 ->gui()
47 ->standardRequest();
48 }
49
54 public function getProviderId(): string
55 {
56 return "crs_current";
57 }
58
63 public function getTitle(): string
64 {
65 $this->lng->loadLanguageModule("crs");
66 return $this->lng->txt("crs_awrn_current_course");
67 }
68
73 public function getInfo(): string
74 {
75 $this->lng->loadLanguageModule("crs");
76 return $this->lng->txt("crs_awrn_current_course_info");
77 }
78
84 public function getInitialUserSet(?array $user_ids = null): array
85 {
88 $ilAccess = $this->access;
89 $rbacreview = $this->rbac->review();
90
91 $ub = array();
92
93 $awrn_logger = \ilLoggerFactory::getLogger('awrn');
94
95 $ref_id = $this->request->getRefId();
96 if ($ref_id > 0) {
98 foreach ($path as $p) {
99 if ($p["type"] == "crs" &&
100 ($ilAccess->checkAccess("write", "", $p["child"]) ||
101 (\ilObjCourse::lookupShowMembersEnabled($p["obj_id"]) && $ilAccess->checkAccess("read", "", $p["child"])))) {
102 $lrol = $rbacreview->getRolesOfRoleFolder($p["child"], false);
103 $set = $ilDB->query('SELECT DISTINCT(usr_id) FROM rbac_ua ' .
104 'WHERE ' . $ilDB->in('rol_id', $lrol, false, 'integer'));
105
106 //$set = $ilDB->query($q = "SELECT DISTINCT usr_id FROM obj_members ".
107 // " WHERE obj_id = ".$ilDB->quote($p["obj_id"], "integer"));
108 $ub = array();
109 while ($rec = $ilDB->fetchAssoc($set)) {
110 $ub[] = $rec["usr_id"];
111
112 $awrn_logger->debug("ilAwarenessUserProviderCurrentCourse: obj_id: " . $p["obj_id"] . ", " .
113 "Collected User: " . $rec["usr_id"]);
114 }
115 }
116 }
117 }
118 return $ub;
119 }
120
121 public function isHighlighted(): bool
122 {
123 return false;
124 }
125}
All members of the same courses/groups as the user.
getInfo()
Provider info (used in administration settings)
getTitle()
Provider title (used in awareness overlay and in administration settings)
getInitialUserSet(?array $user_ids=null)
Get initial set of users.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
access()
Get interface for access checks.
Definition: Container.php:79
language()
Get interface to the i18n service.
Definition: Container.php:95
rbac()
Get interface to get interfaces to all things rbac.
Definition: Container.php:55
static getLogger(string $a_component_id)
Get component logger.
static lookupShowMembersEnabled(int $a_obj_id)
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
$ref_id
Definition: ltiauth.php:66
$path
Definition: ltiservices.php:30
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