1) { echo '
'; if ($search != ""){ $filter = array ("string" => '%'.$search.'%'); } else { $filter = array (); } $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $selected = 'border: 1px solid black;'; $selectNameUp = ''; $selectNameDown = ''; $selectOsUp = ''; $selectOsDown = ''; $selectIntervalUp = ''; $selectIntervalDown = ''; $selectGroupUp = ''; $selectGroupDown = ''; $selectLastContactUp = ''; $selectLastContactDown = ''; $order = null; switch ($sortField) { case 'name': switch ($sort) { case 'up': $selectNameUp = $selected; $order = array('field' => 'nombre', 'order' => 'ASC'); break; case 'down': $selectNameDown = $selected; $order = array('field' => 'nombre', 'order' => 'DESC'); break; } break; case 'os': switch ($sort) { case 'up': $selectOsUp = $selected; $order = array('field' => 'id_os', 'order' => 'ASC'); break; case 'down': $selectOsDown = $selected; $order = array('field' => 'id_os', 'order' => 'DESC'); break; } break; case 'interval': switch ($sort) { case 'up': $selectIntervalUp = $selected; $order = array('field' => 'intervalo', 'order' => 'ASC'); break; case 'down': $selectIntervalDown = $selected; $order = array('field' => 'intervalo', 'order' => 'DESC'); break; } break; case 'group': switch ($sort) { case 'up': $selectGroupUp = $selected; $order = array('field' => 'id_grupo', 'order' => 'ASC'); break; case 'down': $selectGroupDown = $selected; $order = array('field' => 'id_grupo', 'order' => 'DESC'); break; } break; case 'last_contact': switch ($sort) { case 'up': $selectLastContactUp = $selected; $order = array('field' => 'ultimo_contacto', 'order' => 'ASC'); break; case 'down': $selectLastContactDown = $selected; $order = array('field' => 'ultimo_contacto', 'order' => 'DESC'); break; } break; default: $selectNameUp = $selected; $selectNameDown = ''; $selectOsUp = ''; $selectOsDown = ''; $selectIntervalUp = ''; $selectIntervalDown = ''; $selectGroupUp = ''; $selectGroupDown = ''; $selectLastContactUp = ''; $selectLastContactDown = ''; $order = array('field' => 'nombre', 'order' => 'ASC'); break; } // Show only selected groups if ($group_id > 0) { $groups = $group_id; $agent_names = get_group_agents ($group_id, $filter, "upper"); // Not selected any specific group } else { $user_group = get_user_groups ($config["id_user"], "AR"); $groups = array_keys ($user_group); $agent_names = get_group_agents (array_keys ($user_group), $filter, "upper"); } $total_agents = 0; $agents = false; if (! empty ($agent_names)) { $total_agents = get_agents (array (//'id_agente' => array_keys ($agent_names), 'order' => 'nombre ASC', 'disabled' => 0, 'id_grupo' => $groups), array ('COUNT(*) as total')); $total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0; $agents = get_agents (array ('id_agente' => array_keys ($agent_names), 'order' => 'nombre ASC', 'id_grupo' => $groups, 'offset' => (int) get_parameter ('offset'), 'limit' => (int) $config['block_size']), array ('id_agente', 'id_grupo', 'id_os', 'ultimo_contacto', 'intervalo'), 'AR', $order); } if (empty ($agents)) { $agents = array (); } // Prepare pagination pagination ($total_agents, get_url_refresh (array ('group_id' => $group_id, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort))); // Show data. $table->cellpadding = 4; $table->cellspacing = 4; $table->width = "98%"; $table->class = "databox"; $table->head = array (); $table->head[0] = __('Agent'). ' ' . '