2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php: deleted a repeat function. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4217 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
df79ce4208
commit
f2d020dffa
|
@ -1,3 +1,7 @@
|
|||
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_graph.php: deleted a repeat function.
|
||||
|
||||
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_graph.php, include/functions_reporting.php,
|
||||
|
|
|
@ -1223,73 +1223,4 @@ function grafico_eventos_usuario2 ($width, $height) {
|
|||
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a pie graph with events data of group
|
||||
*
|
||||
* @param integer width pie graph width
|
||||
* @param integer height pie graph height
|
||||
* @param string url
|
||||
*/
|
||||
function grafico_eventos_grupo2 ($width = 300, $height = 200, $url = "") {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
$url = html_entity_decode (rawurldecode ($url), ENT_QUOTES); //It was urlencoded, so we urldecode it
|
||||
$data = array ();
|
||||
$loop = 0;
|
||||
define ('NUM_PIECES_PIE', 6);
|
||||
|
||||
$badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT ", "EXEC");
|
||||
//remove bad strings from the query so queries like ; DELETE FROM don't pass
|
||||
$url = str_ireplace ($badstrings, "", $url);
|
||||
|
||||
//This will give the distinct id_agente, give the id_grupo that goes
|
||||
//with it and then the number of times it occured. GROUP BY statement
|
||||
//is required if both DISTINCT() and COUNT() are in the statement
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count
|
||||
FROM tevento WHERE 1=1 %s
|
||||
GROUP BY id_agente ORDER BY count DESC', $url);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count
|
||||
FROM tevento WHERE 1=1 %s
|
||||
GROUP BY id_agente, id_grupo ORDER BY count DESC', $url);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
if ($result === false) {
|
||||
$result = array();
|
||||
}
|
||||
|
||||
foreach ($result as $row) {
|
||||
if (!check_acl ($config["id_user"], $row["id_grupo"], "AR") == 1)
|
||||
continue;
|
||||
|
||||
if ($loop >= NUM_PIECES_PIE) {
|
||||
if (!isset ($data[__('Other')]))
|
||||
$data[__('Other')] = 0;
|
||||
$data[__('Other')] += $row["count"];
|
||||
} else {
|
||||
if ($row["id_agente"] == 0) {
|
||||
$name = __('SYSTEM')." (".$row["count"].")";
|
||||
} else {
|
||||
$name = mb_substr (get_agent_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
|
||||
}
|
||||
$data[$name] = $row["count"];
|
||||
}
|
||||
$loop++;
|
||||
}
|
||||
|
||||
if (! $graphic_type) {
|
||||
return fs_3d_pie_chart ($data, $width, $height);
|
||||
}
|
||||
|
||||
error_reporting (0);
|
||||
generic_pie_graph ($width, $height, $data, array ('show_legend' => false));
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue