ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLocalUser.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 /*
5 * Helper class for local user accounts (in categories)
6 *
7 * @author Stefan Meyer <meyer@leifos.com>
8 * @version $Id: class.ilLocalUser.php 28578 2011-04-19 08:51:57Z smeyer $
9 *
10 */
11 
13 {
14  var $db;
15 
17 
24  function ilLocalUser($a_parent_id)
25  {
26  global $ilDB;
27 
28  $this->db =& $ilDB;
29  $this->parent_id = $a_parent_id;
30 
31  }
32 
33  function setParentId($a_parent_id)
34  {
35  $this->parent_id = $a_parent_id;
36  }
37  function getParentId()
38  {
39  return $this->parent_id;
40  }
41 
42  // STATIC
43  function _getUserData($a_filter)
44  {
45  include_once './Services/User/classes/class.ilObjUser.php';
46 
47  $users_data = ilObjUser::_getAllUserData(array("login","firstname","lastname","time_limit_owner"),-1);
48 
49  foreach($users_data as $usr_data)
50  {
51  if(!$a_filter or $a_filter == $usr_data['time_limit_owner'])
52  {
53  $users[] = $usr_data;
54  }
55  }
56  return $users ? $users : array();
57  }
58 
59  public static function _getFolderIds()
60  {
61  global $ilDB,$rbacsystem;
62 
63  $query = "SELECT DISTINCT(time_limit_owner) as parent_id FROM usr_data ";
64 
65  $res = $ilDB->query($query);
66  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
67  {
68  // Workaround for users with time limit owner "0".
69  if(!$row->parent_id)
70  {
71  if($rbacsystem->checkAccess('read_users',USER_FOLDER_ID))
72  {
73  $parent[] = $row->parent_id;
74  }
75  continue;
76  }
77 
78  if($rbacsystem->checkAccess('read_users',$row->parent_id) or $rbacsystem->checkAccess('cat_administrate_users',$row->parent_id))
79  {
80  if($row->parent_id)
81  {
82  $parent[] = $row->parent_id;
83  }
84  }
85  }
86  return $parent ? $parent : array();
87  }
88  function _getAllUserIds($a_filter = 0)
89  {
90  global $ilDB;
91  switch($a_filter)
92  {
93  case 0:
95  {
96  $where = "WHERE ".$ilDB->in("time_limit_owner", ilLocalUser::_getFolderIds(), false, "integer")." ";
97  //$where .= '(';
98  //$where .= implode(",",ilUtil::quoteArray(ilLocalUser::_getFolderIds()));
99  //$where .= ')';
100 
101  }
102  else
103  {
104  //$where = "WHERE time_limit_owner IN ('')";
105  return array();
106  }
107 
108  break;
109 
110  default:
111  $where = "WHERE time_limit_owner = ".$ilDB->quote($a_filter, "integer")." ";
112 
113  break;
114  }
115 
116  $query = "SELECT usr_id FROM usr_data ".$where;
117  $res = $ilDB->query($query);
118 
119  while($row = $ilDB->fetchObject($res))
120  {
121  $users[] = $row->usr_id;
122  }
123 
124  return $users ? $users : array();
125  }
126 
127  function _getUserFolderId()
128  {
129  return 7;
130  }
131 
132 
133 
134 
135 
136 } // CLASS ilLocalUser
137 ?>