ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilGroupParticipants.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once('./Services/Membership/classes/class.ilParticipants.php');
25
37{
38 const COMPONENT_NAME = 'Modules/Group';
39
40 protected static $instances = array();
41
48 public function __construct($a_obj_id)
49 {
50 $this->type = 'grp';
51 parent::__construct(self::COMPONENT_NAME,$a_obj_id);
52 }
53
63 public static function _getInstanceByObjId($a_obj_id)
64 {
65 if(isset(self::$instances[$a_obj_id]) and self::$instances[$a_obj_id])
66 {
67 return self::$instances[$a_obj_id];
68 }
69 return self::$instances[$a_obj_id] = new ilGroupParticipants($a_obj_id);
70 }
71
76 public static function getMemberRoles($a_ref_id)
77 {
78 global $rbacreview;
79
80 $lrol = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
81
82 $roles = array();
83 foreach($lrol as $role)
84 {
85 $title = ilObject::_lookupTitle($role);
86 switch(substr($title,0,8))
87 {
88 case 'il_grp_a':
89 case 'il_grp_m':
90 continue;
91
92 default:
93 $roles[$role] = $role;
94 }
95 }
96 return $roles;
97 }
98
99 public function addSubscriber($a_usr_id)
100 {
101 global $ilAppEventHandler, $ilLog;
102
103 parent::addSubscriber($a_usr_id);
104
105 $ilLog->write(__METHOD__.': Raise new event: Modules/Group addSubscriber');
106 $ilAppEventHandler->raise(
107 "Modules/Group",
108 'addSubscriber',
109 array(
110 'obj_id' => $this->getObjId(),
111 'usr_id' => $a_usr_id
112 )
113 );
114 }
115
116
117
126 public static function _isParticipant($a_ref_id,$a_usr_id)
127 {
128 global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
129
130 $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
131 return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
132 }
133
140 public function sendNotification($a_type,$a_usr_id)
141 {
142 include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
143 switch($a_type)
144 {
146
149 $mail->setRefId($this->ref_id);
150 $mail->setRecipients(array($a_usr_id));
151 $mail->send();
152 break;
153
155
158 $mail->setRefId($this->ref_id);
159 $mail->setRecipients(array($a_usr_id));
160 $mail->send();
161 break;
162
164
167 $mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
168 $mail->setRefId($this->ref_id);
169 $mail->setRecipients($this->getNotificationRecipients());
170 $mail->send();
171 break;
172
174
177 $mail->setRefId($this->ref_id);
178 $mail->setRecipients(array($a_usr_id));
179 $mail->send();
180 break;
181
183
186 $mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
187 $mail->setRefId($this->ref_id);
188 $mail->setRecipients($this->getNotificationRecipients());
189 $mail->send();
190 break;
191
193
196 $mail->setRefId($this->ref_id);
197 $mail->setRecipients(array($a_usr_id));
198 $mail->send();
199 break;
200
202
205 $mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
206 $mail->setRefId($this->ref_id);
207 $mail->setRecipients($this->getNotificationRecipients());
208 $mail->send();
209 break;
210
212
215 $mail->setRefId($this->ref_id);
216 $mail->setRecipients(array($a_usr_id));
217 $mail->send();
218 break;
219
221
224 $mail->setRefId($this->ref_id);
225 $mail->setRecipients(array($a_usr_id));
226 $mail->send();
227 break;
228
230
231 include_once('./Modules/Group/classes/class.ilGroupWaitingList.php');
232 $wl = new ilGroupWaitingList($this->obj_id);
233 $pos = $wl->getPosition($a_usr_id);
234
237 $mail->setRefId($this->ref_id);
238 $mail->setRecipients(array($a_usr_id));
239 $mail->setAdditionalInformation(array('position' => $pos));
240 $mail->send();
241 break;
242
244
247 $mail->setRefId($this->ref_id);
248 $mail->setRecipients(array($a_usr_id));
249 $mail->send();
250 break;
251
252
253 }
254 return true;
255 }
256
257
258}
259?>
static getMemberRoles($a_ref_id)
Get member roles (not auto generated)
addSubscriber($a_usr_id)
Add subscriber.
__construct($a_obj_id)
Constructor.
sendNotification($a_type, $a_usr_id)
Send notification mail.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
Waiting list for groups.
static _lookupTitle($a_id)
lookup object title
getNotificationRecipients()
Get admin, tutor which have notification enabled.
getObjId()
get current obj_id