2008-09-02 Evi Vanoost <vanooste@rcbi.rochester.edu>
* reporting/fgraph.php: SQL passed wasn't being processed, so the graph was off for grafico_eventos_group. Updated that and the whole function. Simplified, it runs very fast now (practically no delay). * operation/events/events.php: Description wasn't being added to the audit log when deleting multiple items. Fixed git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1071 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
802bf1b359
commit
79d2010ae2
|
@ -1,3 +1,12 @@
|
|||
2008-09-02 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* reporting/fgraph.php: SQL passed wasn't being processed, so the graph
|
||||
was off for grafico_eventos_group. Updated that and the whole
|
||||
function. Simplified, it runs very fast now (practically no delay).
|
||||
|
||||
* operation/events/events.php: Description wasn't being added to the
|
||||
audit log when deleting multiple items. Fixed
|
||||
|
||||
2008-09-02 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions.php: Style correction.
|
||||
|
|
|
@ -120,15 +120,16 @@ if (isset ($_POST["deletebt"])){
|
|||
while ($count <= $config["block_size"]) {
|
||||
if (isset ($_POST["eventid".$count])) {
|
||||
$event_id = get_parameter_post ("eventid".$count);
|
||||
$descr = return_event_description ($event_id); //Get description before it gets deleted
|
||||
// Look for event_id following parameters: id_group.
|
||||
$id_group = gime_idgroup_from_idevent ($event_id);
|
||||
if (give_acl ($config['id_user'], $id_group, "IM")) {
|
||||
process_sql ("DELETE FROM tevento WHERE id_evento = ".$event_id);
|
||||
audit_db ($config['id_user'], $REMOTE_ADDR,
|
||||
"Event deleted","Deleted event: ".return_event_description ($event_id));
|
||||
"Event deleted","Deleted event: ".$descr);
|
||||
} else {
|
||||
audit_db ($config['id_user'], $REMOTE_ADDR,
|
||||
"ACL Violation","Trying to delete event ".return_event_description ($event_id));
|
||||
"ACL Violation","Trying to delete event: ".$descr);
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
|
|
|
@ -1374,54 +1374,40 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
|
|||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
|
||||
global $config;
|
||||
|
||||
$url = str_replace ( "\\" , "", $url);
|
||||
$url = rawurldecode ($url); //It was urlencoded, so we urldecode it
|
||||
$data = array();
|
||||
$legend = array();
|
||||
$sql1="SELECT * FROM tagente";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if (give_acl($config["id_user"], $row["id_grupo"], "AR") == 1) {
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE 1=1 $url AND id_agente = ".$row["id_agente"];
|
||||
if ($result2=mysql_query($sql1))
|
||||
$row2=mysql_fetch_array($result2);
|
||||
if ($row2[0] > 0) {
|
||||
$data[] = $row2[0];
|
||||
$legend[] = substr($row["nombre"],0,15)." ( $row2[0] )";
|
||||
}
|
||||
}
|
||||
}
|
||||
// System events
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE 1=1 $url AND id_agente = 0";
|
||||
if ($result2 = mysql_query($sql1))
|
||||
$row2=mysql_fetch_array($result2);
|
||||
if ($row2[0] > 0){
|
||||
$data[] = $row2[0];
|
||||
$legend[] = "SYSTEM"." ( $row2[0] )";
|
||||
}
|
||||
|
||||
//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
|
||||
$sql = "SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count FROM tevento WHERE 1=1 ".$url." GROUP BY id_agente";
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
if ($result === false)
|
||||
$result = array();
|
||||
|
||||
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
|
||||
// or much better, pay me to do a special version for you, highly optimized :-))))
|
||||
for ($i=0;$i < sizeof($data);$i++){
|
||||
for ($j=$i; $j <sizeof($data); $j++)
|
||||
if ($data[$j] > $data[$i]) {
|
||||
$temp = $data[$i];
|
||||
$temp_label = $legend[$i];
|
||||
$data[$i] = $data[$j];
|
||||
$legend[$i] = $legend[$j];
|
||||
$data[$j] = $temp;
|
||||
$legend[$j] = $temp_label;
|
||||
foreach ($result as $row) {
|
||||
if (give_acl ($config["id_user"], $row["id_grupo"], "AR") == 1) {
|
||||
$data[] = $row["count"];
|
||||
if ($row["id_agente"] == 0) {
|
||||
//System event
|
||||
$legend[] = "SYSTEM (".$row["count"].")";
|
||||
} else {
|
||||
//Other events
|
||||
$legend[] = substr (dame_nombre_agente ($row["id_agente"]), 0, 15)." (".$row["count"].")";
|
||||
}
|
||||
}
|
||||
$max_items = 6;
|
||||
// Take only the first x items
|
||||
if (sizeof($data) >= $max_items){
|
||||
for ($i = 0; $i < $max_items; $i++){
|
||||
$legend2[]= $legend[$i];
|
||||
$data2[] = $data[$i];
|
||||
}
|
||||
generic_pie_graph ($width, $height, $data2, $legend2);
|
||||
} else
|
||||
generic_pie_graph ($width, $height, $data, $legend);
|
||||
}
|
||||
|
||||
array_multisort ($legend, $data);
|
||||
|
||||
$max_items = 6; //Maximum items on the piegraph
|
||||
while (count($data) > $max_items) {
|
||||
//Pops an element off the array until the array is small enough
|
||||
array_pop ($data);
|
||||
}
|
||||
|
||||
generic_pie_graph ($width, $height, $data, $legend);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2083,6 +2069,7 @@ $stacked = get_parameter ("stacked", 0);
|
|||
$date = get_parameter ("date");
|
||||
$graphic_type = (string) get_parameter ('tipo');
|
||||
$mode = get_parameter ("mode", 1);
|
||||
$url = get_parameter ('url','');
|
||||
|
||||
if ($graphic_type) {
|
||||
switch ($graphic_type) {
|
||||
|
@ -2122,7 +2109,7 @@ if ($graphic_type) {
|
|||
graph_event_module ($width, $height, $id_agent);
|
||||
|
||||
case "group_events":
|
||||
grafico_eventos_grupo($width, $height);
|
||||
grafico_eventos_grupo($width, $height, $url);
|
||||
|
||||
break;
|
||||
case "user_events":
|
||||
|
|
Loading…
Reference in New Issue