= 0) //-1 = All $filter .= sprintf (" AND estado = %d", $estado); $grupo = (int) get_parameter ("grupo", 0); if ($grupo > 0) { $filter .= sprintf (" AND id_grupo = %d", $grupo); if (check_acl ($config['id_user'], $grupo, "IM") == 0) { db_pandora_audit("ACL Forbidden","User tried to read incidents from group without access"); include ("general/noaccess.php"); exit; } } $prioridad = (int) get_parameter ("prioridad", -1); if ($prioridad != -1) //-1 = All $filter .= sprintf (" AND prioridad = %d", $prioridad); $agent_search = (int) get_parameter("agent_search"); if ($agent_search != 0) { $filter .= sprintf(" AND id_agent = %d", $agent_search); } $offset = (int) get_parameter ("offset", 0); $groups = users_get_groups ($config["id_user"], "IR"); //Select incidencts where the user has access to ($groups from //get_user_groups), array_keys for the id, implode to pass to SQL switch ($config["dbtype"]) { case "mysql": $sql = "SELECT * FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($groups)).")".$filter." ORDER BY actualizacion DESC LIMIT ".$offset.",".$config["block_size"]; $count_sql = "SELECT count(*) FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($groups)).")".$filter." ORDER BY actualizacion DESC"; $total_sql = "SELECT count(*) FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($groups)).") ORDER BY actualizacion DESC"; break; case "postgresql": case "oracle": $sql = "SELECT * FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($groups)).")".$filter." ORDER BY actualizacion DESC OFFSET ".$offset." LIMIT ".$config["block_size"]; $count_sql = "SELECT count(*) FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($groups)).")".$filter; $total_sql = "SELECT count(*) FROM tincidencia WHERE id_grupo IN (".implode (",",array_keys ($groups)).")"; break; } $result = db_get_all_rows_sql ($sql); $count = db_get_value_sql ($count_sql); $count_total = db_get_value_sql ($total_sql); if (empty ($result)) { $result = array (); $count = 0; } if ($count_total >= 1) { echo '
'; } if ($count_total < 1) { require_once ($config['homedir'] . "/general/firts_task/incidents.php"); } else { // TOTAL incidents $url = "index.php?sec=workspace&sec2=operation/incidents/incident"; $estado = -1; // add form filter values for group, priority, state, and search fields: user and text if ($grupo != -1) $url .= "&grupo=".$grupo; if ($prioridad != -1) $url .= "&prioridad=".$prioridad; if ($estado != -1) $url .= "&estado=".$estado; if ($usuario != '') $url .= "&usuario=".$usuario; if ($texto != '') $url .= "&texto=".$texto; // Show pagination ui_pagination ($count, $url, $offset, 0, false); //($count + $offset) it's real count of incidents because it's use LIMIT $offset in query. echo '