19declare(strict_types=1);
46 if (count($arr_usr_ids) == 0) {
76 FROM ' . $this->dic->database()->quoteIdentifier(
'usr_data') .
80 $result = $this->dic->database()->query($select);
81 $numRows = $this->dic->database()->numRows($result);
88 $sort_field = (string) (
$options[
'sort'][
'field'] ??
'');
90 $select .=
" ORDER BY " . $this->dic->database()->quoteIdentifier($sort_field) .
" " . $sort_direction;
94 $select .=
" LIMIT " . (
int)
$options[
'limit'][
'start'] .
"," . (
int)
$options[
'limit'][
'end'];
97 $result = $this->dic->database()->query($select);
100 while ($user = $this->dic->database()->fetchAssoc($result)) {
102 $list_user->setUsrId(intval($user[
'usr_id']));
103 $list_user->setGender($user[
'gender'] ??
"");
104 $list_user->setTitle($user[
'title'] ??
"");
105 $list_user->setInstitution($user[
'institution'] ??
"");
106 $list_user->setDepartment($user[
'department'] ??
"");
107 $list_user->setStreet($user[
'street'] ??
"");
108 $list_user->setZipcode($user[
'zipcode'] ??
"");
109 $list_user->setCity($user[
'city'] ??
"");
110 $list_user->setCountry($user[
'country'] ??
"");
111 $list_user->setHobby($user[
'hobby'] ??
"");
112 $list_user->setMatriculation($user[
'matriculation'] ??
"");
113 $list_user->setActive(intval($user[
'active']));
114 $list_user->setLogin($user[
'login']);
115 $list_user->setFirstname($user[
'firstname']);
116 $list_user->setLastname($user[
'lastname']);
117 $list_user->setEmail($user[
'email'] ??
"");
118 $list_user->setSecondEmail($user[
'second_email'] ??
"");
120 $user_data[] = $list_user;
133 $where[] = $this->dic->database()->in(
'usr_data.usr_id', $arr_usr_ids,
false,
'integer');
135 if (!empty($arr_filter[
'user'])) {
136 $where[] =
"(" . $this->dic->database()
140 "%" . $arr_filter[
'user'] .
"%"
141 ) .
" " .
"OR " . $this->dic->database()
143 "usr_data.firstname",
145 "%" . $arr_filter[
'user'] .
"%"
146 ) .
" " .
"OR " . $this->dic->database()
150 "%" . $arr_filter[
'user'] .
"%"
151 ) .
" " .
"OR " . $this->dic->database()
155 "%" . $arr_filter[
'user'] .
"%"
156 ) .
" " .
"OR " . $this->dic->database()
158 "usr_data.second_email",
160 "%" . $arr_filter[
'user'] .
"%"
164 if (!empty($arr_filter[
'org_unit'])) {
165 $where[] =
'usr_data.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' . $this->dic->database()
167 $arr_filter[
'org_unit'],
172 if (!empty($arr_filter[
'lastname'])) {
173 $where[] =
'(lastname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
176 $arr_filter[
'lastname']
177 ) .
'%',
'text') .
')';
180 if (!empty($arr_filter[
'firstname'])) {
181 $where[] =
'(firstname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
184 $arr_filter[
'firstname']
185 ) .
'%',
'text') .
')';
188 if (!empty($arr_filter[
'email'])) {
189 $where[] =
'(email LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
193 ) .
'%',
'text') .
')';
196 if (!empty($arr_filter[
'second_email'])) {
197 $where[] =
'(second_email LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
200 $arr_filter[
'second_email']
201 ) .
'%',
'text') .
')';
204 if (!empty($arr_filter[
'title'])) {
205 $where[] =
'(title LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
209 ) .
'%',
'text') .
')';
212 if ($arr_filter[
'activation'] ??
false) {
213 if ($arr_filter[
'activation'] ==
'active') {
214 $where[] =
'(active = "1")';
216 if ($arr_filter[
'activation'] ==
'inactive') {
217 $where[] =
'(active = "0")';
221 if (!empty($where)) {
222 return ' WHERE ' . implode(
' AND ', $where) .
' ';
230 return strtolower($sort_direction) ===
'asc'
Customizing of pimple-DIC for ILIAS.
getSafeSortDirection(string $sort_direction)
createWhereStatement(array $arr_usr_ids, array $arr_filter)
Returns the WHERE Part for the Queries using parameter $user_ids AND local variable $filters.
getData(array $arr_usr_ids=array(), array $options=array())
__construct(Container $dic)
ilMStListUsers constructor.