ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMStListUsers Class Reference

Class ilListUser. More...

+ Collaboration diagram for ilMStListUsers:

Static Public Member Functions

static getData (array $arr_usr_ids=array(), array $options=array())
 

Static Private Member Functions

static createWhereStatement (array $arr_usr_ids, array $arr_filter)
 Returns the WHERE Part for the Queries using parameter $user_ids AND local variable $filters. More...
 

Detailed Description

Class ilListUser.

Author
Martin Studer ms@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 8 of file class.ilMStListUsers.php.

Member Function Documentation

◆ createWhereStatement()

static ilMStListUsers::createWhereStatement ( array  $arr_usr_ids,
array  $arr_filter 
)
staticprivate

Returns the WHERE Part for the Queries using parameter $user_ids AND local variable $filters.

Parameters
array$arr_usr_ids
array$arr_filter
Returns
string

Definition at line 118 of file class.ilMStListUsers.php.

119 {
120 global $DIC;
121
122 $where = array();
123
124 $where[] = $DIC->database()->in('usr_data.usr_id', $arr_usr_ids, false, 'integer');
125
126 if (!empty($arr_filter['user'])) {
127 $where[] = "(" . $DIC->database()->like("usr_data.login", "text", "%" . $arr_filter['user'] . "%") . " " . "OR " . $DIC->database()
128 ->like("usr_data.firstname", "text", "%" . $arr_filter['user'] . "%") . " " . "OR " . $DIC->database()
129 ->like("usr_data.lastname", "text", "%" . $arr_filter['user'] . "%") . " " . "OR " . $DIC->database()
130 ->like("usr_data.email", "text", "%" . $arr_filter['user'] . "%") . ") ";
131 }
132
133 if (!empty($arr_filter['org_unit'])) {
134 $where[] = 'usr_data.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' . $DIC->database()
135 ->quote($arr_filter['org_unit'], 'integer') . ')';
136 }
137
138 if (!empty($arr_filter['lastname'])) {
139 $where[] = '(lastname LIKE ' . $DIC->database()->quote('%' . str_replace('*', '%', $arr_filter['lastname']) . '%', 'text') . ')';
140 }
141
142 if (!empty($arr_filter['firstname'])) {
143 $where[] = '(firstname LIKE ' . $DIC->database()->quote('%' . str_replace('*', '%', $arr_filter['firstname']) . '%', 'text') . ')';
144 }
145
146 if (!empty($arr_filter['email'])) {
147 $where[] = '(email LIKE ' . $DIC->database()->quote('%' . str_replace('*', '%', $arr_filter['email']) . '%', 'text') . ')';
148 }
149
150 if (!empty($arr_filter['title'])) {
151 $where[] = '(title LIKE ' . $DIC->database()->quote('%' . str_replace('*', '%', $arr_filter['title']) . '%', 'text') . ')';
152 }
153
154 if ($arr_filter['activation']) {
155 if ($arr_filter['activation'] == 'active') {
156 $where[] = '(active = "1")';
157 }
158 if ($arr_filter['activation'] == 'inactive') {
159 $where[] = '(active = "0")';
160 }
161 }
162
163 if (!empty($where)) {
164 return ' WHERE ' . implode(' AND ', $where) . ' ';
165 } else {
166 return '';
167 }
168 }
global $DIC
Definition: saml.php:7

References $DIC.

Referenced by getData().

+ Here is the caller graph for this function:

◆ getData()

static ilMStListUsers::getData ( array  $arr_usr_ids = array(),
array  $options = array() 
)
static
Parameters
array$arr_usr_ids
array$options
Returns
array|int

Definition at line 17 of file class.ilMStListUsers.php.

18 {
19 global $DIC;
20
21 //Permissions
22 if (count($arr_usr_ids) == 0) {
23 if ($options['count']) {
24 return 0;
25 } else {
26 return array();
27 }
28 }
29
30 $_options = array(
31 'filters' => array(),
32 'sort' => array(),
33 'limit' => array(),
34 'count' => false,
35 );
36 $options = array_merge($_options, $options);
37
38 $select = 'SELECT
39 usr_id,
40 time_limit_owner,
41 login,
42 gender,
43 firstname,
44 lastname,
45 title,
46 institution,
47 department,
48 street,
49 zipcode,
50 city,
51 country,
52 sel_country,
53 hobby,
54 email,
55 matriculation,
56 phone_office,
57 phone_mobile,
58 active
59 FROM ' . $DIC->database()->quoteIdentifier('usr_data') .
60
61 self::createWhereStatement($arr_usr_ids, $options['filters']);
62
63 if ($options['count']) {
64 $result = $DIC->database()->query($select);
65
66 return $DIC->database()->numRows($result);
67 }
68
69 if ($options['sort']) {
70 $select .= " ORDER BY " . $options['sort']['field'] . " " . $options['sort']['direction'];
71 }
72
73 if (isset($options['limit']['start']) && isset($options['limit']['end'])) {
74 $select .= " LIMIT " . $options['limit']['start'] . "," . $options['limit']['end'];
75 }
76
77 $result = $DIC->database()->query($select);
78 $user_data = array();
79
80 while ($user = $DIC->database()->fetchAssoc($result)) {
81 $list_user = new ilMStListUser();
82 $list_user->setUsrId($user['usr_id']);
83 $list_user->setGender($user['gender']);
84 $list_user->setTitle($user['title']);
85 $list_user->setInstitution($user['institution']);
86 $list_user->setDepartment($user['department']);
87 $list_user->setStreet($user['street']);
88 $list_user->setZipcode($user['zipcode']);
89 $list_user->setCity($user['city']);
90 $list_user->setCountry($user['country']);
91 $list_user->setSelCountry($user['sel_country']);
92 $list_user->setHobby($user['hobby']);
93 $list_user->setMatriculation($user['matriculation']);
94 $list_user->setActive($user['active']);
95 $list_user->setTimeLimitOwner($user['time_limit_owner']);
96 $list_user->setLogin($user['login']);
97 $list_user->setFirstname($user['firstname']);
98 $list_user->setLastname($user['lastname']);
99 $list_user->setEmail($user['email']);
100 $list_user->setPhone($user['phone_office']);
101 $list_user->setMobilePhone($user['phone_mobile']);
102
103 $user_data[] = $list_user;
104 }
105
106 return $user_data;
107 }
$result
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
Class ilMStListUser.
static createWhereStatement(array $arr_usr_ids, array $arr_filter)
Returns the WHERE Part for the Queries using parameter $user_ids AND local variable $filters.

References $DIC, $options, $result, and createWhereStatement().

Referenced by ilMStListUsersTableGUI\parseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: