18 declare(strict_types=1);
45 if (count($arr_usr_ids) == 0) {
55 $options = array_merge($_options, $options);
76 FROM ' . $this->dic->database()->quoteIdentifier(
'usr_data') .
78 self::createWhereStatement($arr_usr_ids, $options[
'filters']);
80 $result = $this->dic->database()->query($select);
81 $numRows = $this->dic->database()->numRows($result);
83 if ($options[
'sort']) {
84 $select .=
" ORDER BY " . $options[
'sort'][
'field'] .
" " . $options[
'sort'][
'direction'];
87 if (isset($options[
'limit'][
'start']) && isset($options[
'limit'][
'end'])) {
88 $select .=
" LIMIT " . $options[
'limit'][
'start'] .
"," . $options[
'limit'][
'end'];
91 $result = $this->dic->database()->query($select);
94 while ($user = $this->dic->database()->fetchAssoc($result)) {
96 $list_user->setUsrId(intval($user[
'usr_id']));
97 $list_user->setGender($user[
'gender'] ??
"");
98 $list_user->setTitle($user[
'title'] ??
"");
99 $list_user->setInstitution($user[
'institution'] ??
"");
100 $list_user->setDepartment($user[
'department'] ??
"");
101 $list_user->setStreet($user[
'street'] ??
"");
102 $list_user->setZipcode($user[
'zipcode'] ??
"");
103 $list_user->setCity($user[
'city'] ??
"");
104 $list_user->setCountry($user[
'country'] ??
"");
105 $list_user->setSelCountry($user[
'sel_country'] ??
"");
106 $list_user->setHobby($user[
'hobby'] ??
"");
107 $list_user->setMatriculation($user[
'matriculation'] ??
"");
108 $list_user->setActive(intval($user[
'active']));
109 $list_user->setLogin($user[
'login']);
110 $list_user->setFirstname($user[
'firstname']);
111 $list_user->setLastname($user[
'lastname']);
112 $list_user->setEmail($user[
'email'] ??
"");
113 $list_user->setSecondEmail($user[
'second_email'] ??
"");
115 $user_data[] = $list_user;
128 $where[] = $this->dic->database()->in(
'usr_data.usr_id', $arr_usr_ids,
false,
'integer');
130 if (!empty($arr_filter[
'user'])) {
131 $where[] =
"(" . $this->dic->database()
135 "%" . $arr_filter[
'user'] .
"%" 136 ) .
" " .
"OR " . $this->dic->database()
138 "usr_data.firstname",
140 "%" . $arr_filter[
'user'] .
"%" 141 ) .
" " .
"OR " . $this->dic->database()
145 "%" . $arr_filter[
'user'] .
"%" 146 ) .
" " .
"OR " . $this->dic->database()
150 "%" . $arr_filter[
'user'] .
"%" 151 ) .
" " .
"OR " . $this->dic->database()
153 "usr_data.second_email",
155 "%" . $arr_filter[
'user'] .
"%" 159 if (!empty($arr_filter[
'org_unit'])) {
160 $where[] =
'usr_data.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' . $this->dic->database()
162 $arr_filter[
'org_unit'],
167 if (!empty($arr_filter[
'lastname'])) {
168 $where[] =
'(lastname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
171 $arr_filter[
'lastname']
172 ) .
'%',
'text') .
')';
175 if (!empty($arr_filter[
'firstname'])) {
176 $where[] =
'(firstname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
179 $arr_filter[
'firstname']
180 ) .
'%',
'text') .
')';
183 if (!empty($arr_filter[
'email'])) {
184 $where[] =
'(email LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
188 ) .
'%',
'text') .
')';
191 if (!empty($arr_filter[
'second_email'])) {
192 $where[] =
'(second_email LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
195 $arr_filter[
'second_email']
196 ) .
'%',
'text') .
')';
199 if (!empty($arr_filter[
'title'])) {
200 $where[] =
'(title LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
204 ) .
'%',
'text') .
')';
207 if ($arr_filter[
'activation'] ??
false) {
208 if ($arr_filter[
'activation'] ==
'active') {
209 $where[] =
'(active = "1")';
211 if ($arr_filter[
'activation'] ==
'inactive') {
212 $where[] =
'(active = "0")';
216 if (!empty($where)) {
217 return ' WHERE ' . implode(
' AND ', $where) .
' ';
createWhereStatement(array $arr_usr_ids, array $arr_filter)
Returns the WHERE Part for the Queries using parameter $user_ids AND local variable $filters...
Customizing of pimple-DIC for ILIAS.
getData(array $arr_usr_ids=array(), array $options=array())
__construct(Container $dic)
ilMStListUsers constructor.