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

Filter drop-down institution list for institutional admins

parent b67fd0c2
...@@ -46,10 +46,16 @@ $sortdir = param_alpha('sortdir', 'asc'); ...@@ -46,10 +46,16 @@ $sortdir = param_alpha('sortdir', 'asc');
$offset = param_integer('offset', 0); $offset = param_integer('offset', 0);
$limit = param_integer('limit', 10); $limit = param_integer('limit', 10);
if ($USER->get('admin')) {
$institutions = get_records_array('institution');
} else {
$institutions = get_records_select_array('institution', "name IN ('" . join("','", array_keys($USER->get('admininstitutions'))) . "')");
}
$smarty = smarty(array('adminusersearch')); $smarty = smarty(array('adminusersearch'));
$smarty->assign('search', $search); $smarty->assign('search', $search);
$smarty->assign('alphabet', explode(',', get_string('alphabet'))); $smarty->assign('alphabet', explode(',', get_string('alphabet')));
$smarty->assign('institutions', get_records_array('institution')); $smarty->assign('institutions', $institutions);
$smarty->assign('results', build_admin_user_search_results($search, $offset, $limit, $sortby, $sortdir)); $smarty->assign('results', build_admin_user_search_results($search, $offset, $limit, $sortby, $sortdir));
$smarty->display('admin/users/search.tpl'); $smarty->display('admin/users/search.tpl');
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<label>Query: <label>Query:
<input type="text" name="query" id="query"{if !empty($search->query)} value="{$search->query}"{/if}> <input type="text" name="query" id="query"{if !empty($search->query)} value="{$search->query}"{/if}>
</label> </label>
{if $USER->get('admin') && count($institutions) > 1} {if count($institutions) > 1}
<span class="institutions"> <span class="institutions">
<label>Institution: <label>Institution:
<select name="institution" id="institution"> <select name="institution" id="institution">
......
Supports Markdown
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