Returns the WHERE Part for the Queries using parameter $user_ids AND local variable $filters.
119 {
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 }