ILIAS  Release_3_10_x_branch Revision 61812
 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 
60  public static function _getInstanceByObjId($a_obj_id)
61  {
62  if(isset(self::$instances[$a_obj_id]) and self::$instances[$a_obj_id])
63  {
64  return self::$instances[$a_obj_id];
65  }
66  return self::$instances[$a_obj_id] = new ilGroupParticipants($a_obj_id);
67  }
68 
77  public static function _isParticipant($a_ref_id,$a_usr_id)
78  {
79  global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
80 
81  $rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
82  if(!isset($rolf['ref_id']) or !$rolf['ref_id'])
83  {
84  $title = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($a_ref_id));
85  $ilLog->write(__METHOD__.': Found object without role folder. Ref_id: '.$a_ref_id.', title: '.$title);
86  $ilLog->logStack();
87 
88  return false;
89  }
90  $local_roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
91 
92  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
93  }
94 
95 
96 }
97 ?>