Commit ed697bf1 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Split admin user search into query processing & display parts

parent 63b373c3
...@@ -117,7 +117,7 @@ function search_user($query_string, $limit, $offset = 0) { ...@@ -117,7 +117,7 @@ function search_user($query_string, $limit, $offset = 0) {
} }
function build_admin_user_search_results($search, $offset, $limit, $sortby, $sortdir) { function get_admin_user_search_results($search, $offset, $limit, $sortby, $sortdir) {
// In admin search, the search string is interpreted as either a // In admin search, the search string is interpreted as either a
// name search or an email search depending on its contents // name search or an email search depending on its contents
$queries = array(); $queries = array();
...@@ -147,9 +147,6 @@ function build_admin_user_search_results($search, $offset, $limit, $sortby, $sor ...@@ -147,9 +147,6 @@ function build_admin_user_search_results($search, $offset, $limit, $sortby, $sor
'string' => $search->l); 'string' => $search->l);
} }
// Filter by viewable institutions: // Filter by viewable institutions:
if (empty($search->institution)) {
$search->institution = 'all';
}
global $USER; global $USER;
if (!$USER->get('admin')) { if (!$USER->get('admin')) {
$allowed = $USER->get('admininstitutions'); $allowed = $USER->get('admininstitutions');
...@@ -168,7 +165,18 @@ function build_admin_user_search_results($search, $offset, $limit, $sortby, $sor ...@@ -168,7 +165,18 @@ function build_admin_user_search_results($search, $offset, $limit, $sortby, $sor
'string' => $search->institution); 'string' => $search->institution);
} }
$results = admin_user_search($queries, $constraints, $offset, $limit, $sortby, $sortdir); return admin_user_search($queries, $constraints, $offset, $limit, $sortby, $sortdir);
}
function build_admin_user_search_results($search, $offset, $limit, $sortby, $sortdir) {
global $USER;
if (empty($search->institution)) {
$search->institution = 'all';
}
$results = get_admin_user_search_results($search, $offset, $limit, $sortby, $sortdir);
$params = array(); $params = array();
foreach ($search as $k => $v) { foreach ($search as $k => $v) {
......
...@@ -272,6 +272,9 @@ class PluginSearchInternal extends PluginSearch { ...@@ -272,6 +272,9 @@ class PluginSearchInternal extends PluginSearch {
$where .= join(' OR ', $str) . ') '; $where .= join(' OR ', $str) . ') ';
} }
// @todo: Institution stuff is messy and will probably need to
// be rewritten when we get multiple institutions per user
$institutionsearch = ''; $institutionsearch = '';
if (!empty($constraints)) { if (!empty($constraints)) {
foreach ($constraints as $f) { foreach ($constraints as $f) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment