fixed contactgroups in usersearch
Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
Родитель
b39a24a705
Коммит
e13fddd571
|
@ -132,7 +132,7 @@ class Contact extends UserGroupClass {
|
|||
public static function search(string $query = '', $queryRange = ['FN', 'EMAIL', 'ORG', 'CATEGORIES']): array {
|
||||
$contacts = [];
|
||||
foreach (self::listRaw($query, $queryRange) as $contact) {
|
||||
$contacts[] = new Self($contact['UID']);
|
||||
$contacts[] = new self($contact['UID']);
|
||||
}
|
||||
return $contacts;
|
||||
}
|
||||
|
|
|
@ -79,18 +79,18 @@ class ContactGroup extends UserGroupClass {
|
|||
*/
|
||||
public static function search(string $query = ''): array {
|
||||
$contactGroups = [];
|
||||
$categories = [];
|
||||
if (self::isEnabled() && $query) {
|
||||
foreach (self::getContainer()->query(IContactsManager::class)->search($query, ['CATEGORIES']) as $contact) {
|
||||
// get all groups from the found contact and explode to array
|
||||
$temp = explode(',', $contact['CATEGORIES']);
|
||||
foreach ($temp as $contactGroup) {
|
||||
if (stripos($contactGroup, $query) === 0) {
|
||||
$contactGroups[] = $contactGroup;
|
||||
|
||||
foreach (explode(',', $contact['CATEGORIES']) as $category) {
|
||||
if (stripos($category, $query) === 0) {
|
||||
$categories[] = $category;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array_unique($contactGroups) as $contactGroup) {
|
||||
foreach (array_unique($categories) as $contactGroup) {
|
||||
$contactGroups[] = new self($contactGroup);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class Group extends UserGroupClass {
|
|||
|
||||
foreach (self::getContainer()->query(IGroupManager::class)->search($query) as $group) {
|
||||
if (!in_array($group->getGID(), $skip)) {
|
||||
$groups[] = new Self($group->getGID());
|
||||
$groups[] = new self($group->getGID());
|
||||
}
|
||||
}
|
||||
return $groups;
|
||||
|
|
|
@ -62,7 +62,7 @@ class User extends UserGroupClass {
|
|||
|
||||
foreach (self::getContainer()->query(IUserManager::class)->search($query) as $user) {
|
||||
if (!in_array($user->getUID(), $skip)) {
|
||||
$users[] = new Self($user->getUID());
|
||||
$users[] = new self($user->getUID());
|
||||
}
|
||||
}
|
||||
return $users;
|
||||
|
|
Загрузка…
Ссылка в новой задаче