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);
76 FROM ' . $this->dic->database()->quoteIdentifier(
'usr_data') .
78 self::createWhereStatement($arr_usr_ids, $options[
'filters']);
80 if ($options[
'count']) {
81 $result = $this->dic->database()->query($select);
83 return $this->dic->database()->numRows(
$result);
86 if ($options[
'sort']) {
87 $select .=
" ORDER BY " . $options[
'sort'][
'field'] .
" " . $options[
'sort'][
'direction'];
90 if (isset($options[
'limit'][
'start']) && isset($options[
'limit'][
'end'])) {
91 $select .=
" LIMIT " . $options[
'limit'][
'start'] .
"," . $options[
'limit'][
'end'];
94 $result = $this->dic->database()->query($select);
97 while ($user = $this->dic->database()->fetchAssoc(
$result)) {
99 $list_user->setUsrId($user[
'usr_id']);
100 $list_user->setGender($user[
'gender']);
101 $list_user->setTitle($user[
'title']);
102 $list_user->setInstitution($user[
'institution']);
103 $list_user->setDepartment($user[
'department']);
104 $list_user->setStreet($user[
'street']);
105 $list_user->setZipcode($user[
'zipcode']);
106 $list_user->setCity($user[
'city']);
107 $list_user->setCountry($user[
'country']);
108 $list_user->setSelCountry($user[
'sel_country']);
109 $list_user->setHobby($user[
'hobby']);
110 $list_user->setMatriculation($user[
'matriculation']);
111 $list_user->setActive($user[
'active']);
112 $list_user->setTimeLimitOwner($user[
'time_limit_owner']);
113 $list_user->setLogin($user[
'login']);
114 $list_user->setFirstname($user[
'firstname']);
115 $list_user->setLastname($user[
'lastname']);
116 $list_user->setEmail($user[
'email']);
117 $list_user->setPhone($user[
'phone_office']);
118 $list_user->setMobilePhone($user[
'phone_mobile']);
120 $user_data[] = $list_user;
139 $where[] = $this->dic->database()->in(
'usr_data.usr_id', $arr_usr_ids,
false,
'integer');
141 if (!empty($arr_filter[
'user'])) {
142 $where[] =
"(" . $this->dic->database()->like(
"usr_data.login",
"text",
"%" . $arr_filter[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
143 ->like(
"usr_data.firstname",
"text",
"%" . $arr_filter[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
144 ->like(
"usr_data.lastname",
"text",
"%" . $arr_filter[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
145 ->like(
"usr_data.email",
"text",
"%" . $arr_filter[
'user'] .
"%") .
") ";
148 if (!empty($arr_filter[
'org_unit'])) {
149 $where[] =
'usr_data.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' . $this->dic->database()
150 ->quote($arr_filter[
'org_unit'],
'integer') .
')';
153 if (!empty($arr_filter[
'lastname'])) {
154 $where[] =
'(lastname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'lastname']) .
'%',
'text') .
')';
157 if (!empty($arr_filter[
'firstname'])) {
158 $where[] =
'(firstname LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'firstname']) .
'%',
'text') .
')';
161 if (!empty($arr_filter[
'email'])) {
162 $where[] =
'(email LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'email']) .
'%',
'text') .
')';
165 if (!empty($arr_filter[
'title'])) {
166 $where[] =
'(title LIKE ' . $this->dic->database()->quote(
'%' . str_replace(
'*',
'%', $arr_filter[
'title']) .
'%',
'text') .
')';
169 if ($arr_filter[
'activation']) {
170 if ($arr_filter[
'activation'] ==
'active') {
171 $where[] =
'(active = "1")';
173 if ($arr_filter[
'activation'] ==
'inactive') {
174 $where[] =
'(active = "0")';
178 if (!empty($where)) {
179 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.