ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAwarenessUserProviderCurrentCourse.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Awareness/classes/class.ilAwarenessUserProvider.php");
6
15{
19 protected $tree;
20
24 protected $access;
25
26
30 public function __construct()
31 {
32 global $DIC;
33
34 parent::__construct();
35
36 $this->db = $DIC->database();
37 $this->tree = $DIC->repositoryTree();
38 $this->access = $DIC->access();
39 $this->rbac = $DIC->rbac();
40 }
41
47 public function getProviderId()
48 {
49 return "crs_current";
50 }
51
57 public function getTitle()
58 {
59 $this->lng->loadLanguageModule("crs");
60 return $this->lng->txt("crs_awrn_current_course");
61 }
62
68 public function getInfo()
69 {
70 $this->lng->loadLanguageModule("crs");
71 return $this->lng->txt("crs_awrn_current_course_info");
72 }
73
79 public function getInitialUserSet()
80 {
83 $ilAccess = $this->access;
84 $rbacreview = $this->rbac->review();
85
86 $ub = array();
87
88 $awrn_logger = ilLoggerFactory::getLogger('awrn');
89
90 if ($this->getRefId() > 0) {
91 $path = $tree->getPathFull($this->getRefId());
92 if (is_array($path)) {
93 foreach ($path as $p) {
94 include_once("./Modules/Course/classes/class.ilObjCourse.php");
95 if ($p["type"] == "crs" &&
96 ($ilAccess->checkAccess("write", "", $p["child"]) ||
97 (ilObjCourse::lookupShowMembersEnabled($p["obj_id"]) && $ilAccess->checkAccess("read", "", $p["child"])))) {
98 $lrol = $rbacreview->getRolesOfRoleFolder($p["child"], false);
99 $set = $ilDB->query('SELECT DISTINCT(usr_id) FROM rbac_ua ' .
100 'WHERE ' . $ilDB->in('rol_id', $lrol, false, 'integer'));
101
102 //$set = $ilDB->query($q = "SELECT DISTINCT usr_id FROM obj_members ".
103 // " WHERE obj_id = ".$ilDB->quote($p["obj_id"], "integer"));
104 $ub = array();
105 while ($rec = $ilDB->fetchAssoc($set)) {
106 $ub[] = $rec["usr_id"];
107
108 $awrn_logger->debug("ilAwarenessUserProviderCurrentCourse: obj_id: " . $p["obj_id"] . ", " .
109 "Collected User: " . $rec["usr_id"]);
110 }
111 }
112 }
113 }
114 }
115 return $ub;
116 }
117}
$path
Definition: aliased.php:25
An exception for terminatinating execution or to throw for unit testing.
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)
A class that provides a collection of users for the awareness tool.
static getLogger($a_component_id)
Get component logger.
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
global $DIC
Definition: saml.php:7
global $ilDB