From 03323225d53251b65fca60ed2eca6f27ff25ba99 Mon Sep 17 00:00:00 2001 From: Moritz Strohm Date: Thu, 26 Feb 2026 18:17:27 +0100 Subject: began writing UserSearch search type --- lib/classes/searchtypes/UserSearch.php | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 lib/classes/searchtypes/UserSearch.php diff --git a/lib/classes/searchtypes/UserSearch.php b/lib/classes/searchtypes/UserSearch.php new file mode 100644 index 0000000..02420e5 --- /dev/null +++ b/lib/classes/searchtypes/UserSearch.php @@ -0,0 +1,69 @@ +title = $title ?? _('Person suchen'); + $this->avatarLike = 'user_id'; + } + + /** + * Adds a SimpleORMap object as filter. The user account must be associated + * to the object in order to be included in the result set. + * + * @param SimpleORMap $object The object to be used as filter. + * + * @return bool True, if the object can be used as filter, false otherwise. + */ + public function addObjectAsFilter(SimpleORMap $object) : bool + { + if ($object instanceof Institute) { + //TODO: activate JOIN institute + } elseif ($object instanceof Course) { + //TODO: activate JOIN seminar_user + } else { + //Unsupported object. + return false; + } + } + + /** + * @inheritDoc + */ + public function getResults($input, $contextual_data, $limit = PHP_INT_MAX, $offset = 0) + { + + } + + /** + * Searches for user accounts and returns User objects instead of an associative array. + * + * @param string $search_keyword The keyword(s) for finding user accounts. + * + * @param int $limit The maximum amount of user accounts to find. + * + * @param int $offset The offset from which to start finding user accounts. + * + * @return User[] An array with found user accounts. + */ + public function search(string $search_keyword, int $limit = PHP_INT_MAX, int $offset = 0) : array + { + + } +} -- cgit v1.0