ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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$
9*
10*/
11
13{
14 var $db;
15
17
24 function __construct($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 function _getUserData($a_filter)
43 {
44 include_once './Services/User/classes/class.ilObjUser.php';
45
46 $users_data = ilObjUser::_getAllUserData(array("login","firstname","lastname","time_limit_owner"),-1);
47
48 foreach($users_data as $usr_data)
49 {
50 if(!$a_filter or $a_filter == $usr_data['time_limit_owner'])
51 {
52 $users[] = $usr_data;
53 }
54 }
55 return $users ? $users : array();
56 }
57
58 public static function _getFolderIds()
59 {
60 global $ilDB,$rbacsystem;
61
62 $query = "SELECT DISTINCT(time_limit_owner) as parent_id FROM usr_data ";
63
64 $res = $ilDB->query($query);
65 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
66 {
67 // Workaround for users with time limit owner "0".
68 if(!$row->parent_id)
69 {
70 if($rbacsystem->checkAccess('read_users',USER_FOLDER_ID))
71 {
72 $parent[] = $row->parent_id;
73 }
74 continue;
75 }
76
77 if($rbacsystem->checkAccess('read_users',$row->parent_id) or $rbacsystem->checkAccess('cat_administrate_users',$row->parent_id))
78 {
79 if($row->parent_id)
80 {
81 $parent[] = $row->parent_id;
82 }
83 }
84 }
85 return $parent ? $parent : array();
86 }
87
88 static 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 static function _getUserFolderId()
128 {
129 return 7;
130 }
131
132
133
134
135
136} // CLASS ilLocalUser
137?>
An exception for terminatinating execution or to throw for unit testing.
const USER_FOLDER_ID
Class ilObjUserFolder.
static _getUserFolderId()
static _getAllUserIds($a_filter=0)
setParentId($a_parent_id)
static _getUserData($a_filter)
__construct($a_parent_id)
Constructor @access public.
static _getFolderIds()
static _getAllUserData($a_fields=NULL, $active=-1)
STATIC METHOD get all user data.
global $ilDB