36 public function getData(array $arr_usr_ids = array(), array $options = array())
39 if (count($arr_usr_ids) == 0) {
40 if ($options[
'count']) {
53 $options = array_merge($_options, $options);
74 FROM ' . $this->dic->database()->quoteIdentifier(
'usr_data') .
76 self::createWhereStatement($arr_usr_ids, $options[
'filters']);
78 if ($options[
'count']) {
79 $result = $this->dic->database()->query($select);
81 return $this->dic->database()->numRows(
$result);
84 if ($options[
'sort']) {
85 $select .=
" ORDER BY " . $options[
'sort'][
'field'] .
" " . $options[
'sort'][
'direction'];
88 if (isset($options[
'limit'][
'start']) && isset($options[
'limit'][
'end'])) {
89 $select .=
" LIMIT " . $options[
'limit'][
'start'] .
"," . $options[
'limit'][
'end'];
92 $result = $this->dic->database()->query($select);
95 while ($user = $this->dic->database()->fetchAssoc(
$result)) {
97 $list_user->setUsrId($user[
'usr_id']);
98 $list_user->setGender($user[
'gender']);
99 $list_user->setTitle($user[
'title']);
100 $list_user->setInstitution($user[
'institution']);
101 $list_user->setDepartment($user[
'department']);
102 $list_user->setStreet($user[
'street']);
103 $list_user->setZipcode($user[
'zipcode']);
104 $list_user->setCity($user[
'city']);
105 $list_user->setCountry($user[
'country']);
106 $list_user->setSelCountry($user[
'sel_country']);
107 $list_user->setHobby($user[
'hobby']);
108 $list_user->setMatriculation($user[
'matriculation']);
109 $list_user->setActive($user[
'active']);
110 $list_user->setLogin($user[
'login']);
111 $list_user->setFirstname($user[
'firstname']);
112 $list_user->setLastname($user[
'lastname']);
113 $list_user->setEmail($user[
'email']);
114 $list_user->setSecondEmail($user[
'second_email']);
116 $user_data[] = $list_user;
135 $where[] = $this->dic->database()->in(
'usr_data.usr_id', $arr_usr_ids,
false,
'integer');
137 if (!empty($arr_filter[
'user'])) {
138 $where[] =
"(" . $this->dic->database()->like(
"usr_data.login",
"text",
"%" . $arr_filter[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
139 ->like(
"usr_data.firstname",
"text",
"%" . $arr_filter[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
140 ->like(
"usr_data.lastname",
"text",
"%" . $arr_filter[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
141 ->like(
"usr_data.email",
"text",
"%" . $arr_filter[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
142 ->like(
"usr_data.second_email",
"text",
"%" . $arr_filter[
'user'] .
"%") .
") ";
145 if (!empty($arr_filter[
'org_unit'])) {
146 $where[] =
'usr_data.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' . $this->dic->database()
147 ->quote($arr_filter[
'org_unit'],
'integer') .
')';
150 if (!empty($arr_filter[
'lastname'])) {
151 $where[] =
'(lastname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'lastname']) .
'%',
'text') .
')';
154 if (!empty($arr_filter[
'firstname'])) {
155 $where[] =
'(firstname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'firstname']) .
'%',
'text') .
')';
158 if (!empty($arr_filter[
'email'])) {
159 $where[] =
'(email LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'email']) .
'%',
'text') .
')';
162 if (!empty($arr_filter[
'second_email'])) {
163 $where[] =
'(second_email LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'second_email']) .
'%',
'text') .
')';
166 if (!empty($arr_filter[
'title'])) {
167 $where[] =
'(title LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'title']) .
'%',
'text') .
')';
170 if ($arr_filter[
'activation']) {
171 if ($arr_filter[
'activation'] ==
'active') {
172 $where[] =
'(active = "1")';
174 if ($arr_filter[
'activation'] ==
'inactive') {
175 $where[] =
'(active = "0")';
179 if (!empty($where)) {
180 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.