ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLocalUser.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 /*
25 * Helper class for local user accounts (in categories)
26 *
27 * @author Stefan Meyer <smeyer@databay.de>
28 * @version $Id: class.ilLocalUser.php 15697 2008-01-08 20:04:33Z hschottm $
29 *
30 */
31 
33 {
34  var $db;
35 
37 
44  function ilLocalUser($a_parent_id)
45  {
46  global $ilDB;
47 
48  $this->db =& $ilDB;
49  $this->parent_id = $a_parent_id;
50 
51  }
52 
53  function setParentId($a_parent_id)
54  {
55  $this->parent_id = $a_parent_id;
56  }
57  function getParentId()
58  {
59  return $this->parent_id;
60  }
61 
62  // STATIC
63  function _getUserData($a_filter)
64  {
65  include_once './Services/User/classes/class.ilObjUser.php';
66 
67  $users_data = ilObjUser::_getAllUserData(array("login","firstname","lastname","time_limit_owner"),-1);
68 
69  foreach($users_data as $usr_data)
70  {
71  if(!$a_filter or $a_filter == $usr_data['time_limit_owner'])
72  {
73  $users[] = $usr_data;
74  }
75  }
76  return $users ? $users : array();
77  }
78 
79  function _getFolderIds()
80  {
81  global $ilDB,$rbacsystem;
82 
83  $query = "SELECT DISTINCT(time_limit_owner) as parent_id FROM usr_data ";
84 
85  $res = $ilDB->query($query);
86  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
87  {
88  if($rbacsystem->checkAccess('read_users',$row->parent_id) or $rbacsystem->checkAccess('cat_administrate_users',$row->parent_id))
89  {
90  if($row->parent_id)
91  {
92  $parent[] = $row->parent_id;
93  }
94  }
95  }
96  return $parent ? $parent : array();
97  }
98  function _getAllUserIds($a_filter = 0)
99  {
100  global $ilDB;
101  switch($a_filter)
102  {
103  case 0:
105  {
106  $where = "WHERE time_limit_owner IN ";
107  $where .= '(';
108  $where .= implode(",",ilUtil::quoteArray(ilLocalUser::_getFolderIds()));
109  $where .= ')';
110 
111  }
112  else
113  {
114  $where = "WHERE time_limit_owner IN ('')";
115  }
116 
117  break;
118 
119  default:
120  $where = "WHERE time_limit_owner = ".$ilDB->quote($a_filter)." ";
121 
122  break;
123  }
124 
125  $query = "SELECT usr_id FROM usr_data ".$where;
126  $res = $ilDB->query($query);
127 
128  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
129  {
130  $users[] = $row->usr_id;
131  }
132 
133  return $users ? $users : array();
134  }
135 
136  function _getUserFolderId()
137  {
138  return 7;
139  }
140 
141 
142 
143 
144 
145 } // CLASS ilLocalUser
146 ?>