ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public $db;
15
16 public $parent_id;
17
24 public function __construct($a_parent_id)
25 {
26 global $ilDB;
27
28 $this->db = $ilDB;
29 $this->parent_id = $a_parent_id;
30 }
31
32 public function setParentId($a_parent_id)
33 {
34 $this->parent_id = $a_parent_id;
35 }
36 public function getParentId()
37 {
38 return $this->parent_id;
39 }
40
41 public static function _getUserData($a_filter)
42 {
43 include_once './Services/User/classes/class.ilObjUser.php';
44
45 $users_data = ilObjUser::_getAllUserData(array("login","firstname","lastname","time_limit_owner"), -1);
46
47 foreach ($users_data as $usr_data) {
48 if (!$a_filter or $a_filter == $usr_data['time_limit_owner']) {
49 $users[] = $usr_data;
50 }
51 }
52 return $users ? $users : array();
53 }
54
55 public static function _getFolderIds()
56 {
57 global $ilDB,$rbacsystem;
58
59 $query = "SELECT DISTINCT(time_limit_owner) as parent_id FROM usr_data ";
60
61 $res = $ilDB->query($query);
62 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
63 // Workaround for users with time limit owner "0".
64 if (!$row->parent_id) {
65 if ($rbacsystem->checkAccess('read_users', USER_FOLDER_ID)) {
66 $parent[] = $row->parent_id;
67 }
68 continue;
69 }
70
71 if ($rbacsystem->checkAccess('read_users', $row->parent_id) or $rbacsystem->checkAccess('cat_administrate_users', $row->parent_id)) {
72 if ($row->parent_id) {
73 $parent[] = $row->parent_id;
74 }
75 }
76 }
77 return $parent ? $parent : array();
78 }
79
80 public static function _getAllUserIds($a_filter = 0)
81 {
82 global $ilDB;
83 switch ($a_filter) {
84 case 0:
86 $where = "WHERE " . $ilDB->in("time_limit_owner", ilLocalUser::_getFolderIds(), false, "integer") . " ";
87 //$where .= '(';
88 //$where .= implode(",",ilUtil::quoteArray(ilLocalUser::_getFolderIds()));
89 //$where .= ')';
90 } else {
91 //$where = "WHERE time_limit_owner IN ('')";
92 return array();
93 }
94
95 break;
96
97 default:
98 $where = "WHERE time_limit_owner = " . $ilDB->quote($a_filter, "integer") . " ";
99
100 break;
101 }
102
103 $query = "SELECT usr_id FROM usr_data " . $where;
104 $res = $ilDB->query($query);
105
106 while ($row = $ilDB->fetchObject($res)) {
107 $users[] = $row->usr_id;
108 }
109
110 return $users ? $users : array();
111 }
112
113 public static function _getUserFolderId()
114 {
115 return 7;
116 }
117} // CLASS ilLocalUser
$users
Definition: authpage.php:44
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.
$query
foreach($_POST as $key=> $value) $res
global $ilDB