Commit 15a78e42 authored by Richard Mansfield's avatar Richard Mansfield Committed by Nigel McNie
Browse files

Institution drop-down

parent a14c94a0
...@@ -37,6 +37,7 @@ require('searchlib.php'); ...@@ -37,6 +37,7 @@ require('searchlib.php');
$search = (object) array( $search = (object) array(
'query' => trim(param_variable('query', '')), 'query' => trim(param_variable('query', '')),
'sort' => param_alpha('sort', 'lastname'), 'sort' => param_alpha('sort', 'lastname'),
'institution' => param_alpha('institution', 'all'),
'f' => param_alpha('f', null), 'f' => param_alpha('f', null),
'l' => param_alpha('l', null), 'l' => param_alpha('l', null),
'offset' => param_integer('offset', 0), 'offset' => param_integer('offset', 0),
...@@ -46,6 +47,7 @@ $search = (object) array( ...@@ -46,6 +47,7 @@ $search = (object) array(
$smarty = smarty(array('usersearch')); $smarty = smarty(array('usersearch'));
$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('results', build_admin_user_search_results($search)); $smarty->assign('results', build_admin_user_search_results($search));
$smarty->display('admin/users/search.tpl'); $smarty->display('admin/users/search.tpl');
......
...@@ -153,7 +153,7 @@ function build_admin_user_search_results($search) { ...@@ -153,7 +153,7 @@ function build_admin_user_search_results($search) {
'string' => $search->l); 'string' => $search->l);
} }
} }
if (!empty($search->institution)) { if (!empty($search->institution) && $search->institution != 'all') {
$search->expr['and'][] = array('field' => 'institution', $search->expr['and'][] = array('field' => 'institution',
'type' => 'equals', 'type' => 'equals',
'string' => $search->institution); 'string' => $search->institution);
......
...@@ -35,8 +35,20 @@ ...@@ -35,8 +35,20 @@
<div class="searchform"> <div class="searchform">
<label>Query: <label>Query:
<input type="text" name="query" id="query"> <input type="text" name="query" id="query">
<button id="query-button" type="submit">{str tag="go"}</button>
</label> </label>
{if $USER->get('admin') && !empty($institutions)}
<span class="institutions">
<label>Institution:
<select name="institution">
<option value=all>{str tag=all}</option>
{foreach from=$institutions item=i}
<option value={$i->name}>{$i->displayname}</option>
{/foreach}
</select>
</label>
</span>
{/if}
<button id="query-button" type="submit">{str tag="go"}</button>
</div> </div>
<div id="results"> <div id="results">
{$results} {$results}
......
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