Add combox filter in search form, view: Manage Agents in Admistration

This commit is contained in:
m-lopez-f 2015-01-12 15:31:14 +01:00
parent cd85a998bb
commit 51d45f0db0
1 changed files with 25 additions and 2 deletions

View File

@ -23,6 +23,7 @@ $ag_group = get_parameter ("ag_group_refresh", -1);
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$recursion = get_parameter('recursion');
$disabled = get_parameter('disabled');
if ($ag_group == -1 )
$ag_group = (int) get_parameter ("ag_group", -1);
@ -139,6 +140,17 @@ else
$return_all_group = true;
html_print_select_groups(false, "AR", $return_all_group, "ag_group", $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false, 'width:100px;');
echo "<td>";
echo __('Show Agents') . '&nbsp;';
$fields = array(
"2" => "Everyone",
"1" => "Only disabled",
"0" => "Only enabled",
);
html_print_select($fields,"disabled",$disabled,'this.form.submit()');
echo "</td>";
echo "<td>";
echo __('Recursion') . '&nbsp;';
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
@ -247,6 +259,16 @@ if ($search != "") {
LIKE '%$search%' OR direccion LIKE '%$search%') ";
}
if ($disabled==1)
{
$search_sql = " AND disabled = ". $disabled . $search_sql;
}
else{
if ($disabled==0){
$search_sql = " AND disabled = 0" . $search_sql;
}
}
// Show only selected groups
if ($ag_group > 0) {
$sql = sprintf ('SELECT COUNT(*)
@ -385,6 +407,7 @@ else {
}
}
$agents = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function
@ -395,7 +418,7 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
}
// Prepare pagination
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort", $offset);
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
if ($agents !== false) {
@ -548,7 +571,7 @@ if ($agents !== false) {
echo "</td>";
}
echo "</table>";
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort", $offset);
ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset);
echo "<table width='98%'><tr><td align='right'>";
}
else {