ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
24 include_once('./Services/Membership/classes/class.ilParticipants.php');
25 
37 {
38  protected static $instances = array();
39 
46  protected function __construct($a_obj_id)
47  {
48  $this->type = 'grp';
49  parent::__construct($a_obj_id);
50  }
51 
61  public static function _getInstanceByObjId($a_obj_id)
62  {
63  if(isset(self::$instances[$a_obj_id]) and self::$instances[$a_obj_id])
64  {
65  return self::$instances[$a_obj_id];
66  }
67  return self::$instances[$a_obj_id] = new ilGroupParticipants($a_obj_id);
68  }
69 
78  public static function _isParticipant($a_ref_id,$a_usr_id)
79  {
80  global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
81 
82  $rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
83  if(!isset($rolf['ref_id']) or !$rolf['ref_id'])
84  {
85  $title = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($a_ref_id));
86  $ilLog->write(__METHOD__.': Found object without role folder. Ref_id: '.$a_ref_id.', title: '.$title);
87  $ilLog->logStack();
88 
89  return false;
90  }
91  $local_roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
92  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
93  }
94 
101  public function sendNotification($a_type,$a_usr_id)
102  {
103  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
104  switch($a_type)
105  {
107 
108  $mail = new ilGroupMembershipMailNotification();
110  $mail->setRefId($this->ref_id);
111  $mail->setRecipients(array($a_usr_id));
112  $mail->send();
113  break;
114 
116 
117  $mail = new ilGroupMembershipMailNotification();
119  $mail->setRefId($this->ref_id);
120  $mail->setRecipients(array($a_usr_id));
121  $mail->send();
122  break;
123 
125 
126  $mail = new ilGroupMembershipMailNotification();
128  $mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
129  $mail->setRefId($this->ref_id);
130  $mail->setRecipients($this->getNotificationRecipients());
131  $mail->send();
132  break;
133 
135 
136  $mail = new ilGroupMembershipMailNotification();
138  $mail->setRefId($this->ref_id);
139  $mail->setRecipients(array($a_usr_id));
140  $mail->send();
141  break;
142 
144 
145  $mail = new ilGroupMembershipMailNotification();
147  $mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
148  $mail->setRefId($this->ref_id);
149  $mail->setRecipients($this->getNotificationRecipients());
150  $mail->send();
151  break;
152 
154 
155  $mail = new ilGroupMembershipMailNotification();
157  $mail->setRefId($this->ref_id);
158  $mail->setRecipients(array($a_usr_id));
159  $mail->send();
160  break;
161 
163 
164  $mail = new ilGroupMembershipMailNotification();
166  $mail->setAdditionalInformation(array('usr_id' => $a_usr_id));
167  $mail->setRefId($this->ref_id);
168  $mail->setRecipients($this->getNotificationRecipients());
169  $mail->send();
170  break;
171 
173 
174  $mail = new ilGroupMembershipMailNotification();
176  $mail->setRefId($this->ref_id);
177  $mail->setRecipients(array($a_usr_id));
178  $mail->send();
179  break;
180 
182 
183  $mail = new ilGroupMembershipMailNotification();
185  $mail->setRefId($this->ref_id);
186  $mail->setRecipients(array($a_usr_id));
187  $mail->send();
188  break;
189 
191 
192  include_once('./Modules/Group/classes/class.ilGroupWaitingList.php');
193  $wl = new ilGroupWaitingList($this->obj_id);
194  $pos = $wl->getPosition($a_usr_id);
195 
196  $mail = new ilGroupMembershipMailNotification();
198  $mail->setRefId($this->ref_id);
199  $mail->setRecipients(array($a_usr_id));
200  $mail->setAdditionalInformation(array('position' => $pos));
201  $mail->send();
202  break;
203 
205 
206  $mail = new ilGroupMembershipMailNotification();
208  $mail->setRefId($this->ref_id);
209  $mail->setRecipients(array($a_usr_id));
210  $mail->send();
211  break;
212 
213 
214  }
215  return true;
216  }
217 
218 
219 }
220 ?>