ILIAS  Release_4_0_x_branch Revision 61816
 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 <smeyer@databay.de>
8 * @version $Id: class.ilLocalUser.php 20152 2009-06-08 18:41:37Z akill $
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  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  if($rbacsystem->checkAccess('read_users',$row->parent_id) or $rbacsystem->checkAccess('cat_administrate_users',$row->parent_id))
69  {
70  if($row->parent_id)
71  {
72  $parent[] = $row->parent_id;
73  }
74  }
75  }
76  return $parent ? $parent : array();
77  }
78  function _getAllUserIds($a_filter = 0)
79  {
80  global $ilDB;
81  switch($a_filter)
82  {
83  case 0:
85  {
86  $where = "WHERE ".$ilDB->in("time_limit_owner", ilLocalUser::_getFolderIds(), false, "integer")." ";
87  //$where .= '(';
88  //$where .= implode(",",ilUtil::quoteArray(ilLocalUser::_getFolderIds()));
89  //$where .= ')';
90 
91  }
92  else
93  {
94  //$where = "WHERE time_limit_owner IN ('')";
95  return array();
96  }
97 
98  break;
99 
100  default:
101  $where = "WHERE time_limit_owner = ".$ilDB->quote($a_filter, "integer")." ";
102 
103  break;
104  }
105 
106  $query = "SELECT usr_id FROM usr_data ".$where;
107  $res = $ilDB->query($query);
108 
109  while($row = $ilDB->fetchObject($res))
110  {
111  $users[] = $row->usr_id;
112  }
113 
114  return $users ? $users : array();
115  }
116 
117  function _getUserFolderId()
118  {
119  return 7;
120  }
121 
122 
123 
124 
125 
126 } // CLASS ilLocalUser
127 ?>