From 91b03f2aed0f5b939d0380dcee621da53433c5b2 Mon Sep 17 00:00:00 2001 From: slerena Date: Thu, 21 Jun 2007 18:58:35 +0000 Subject: [PATCH] 2007-06-21 Sancho Lerena * include/languages/language_en.php: More strings. * include/functions.php: entrada_limpia() should work fine in UTF8. * operation/incidents/incident.php: Fixed many ugly things. * operation/incidents/incident_detail.php: Fixed many ugly things. * operation/incidents/incident_note.php: Fixed many ugly things. * operation/events/event_statistics.php: Fixed graphs. * operation/events/events.php: Fixed some legend position and header. * operation/agentes/tactical.php: Fixed divzero error. * operation/menu.php: SNMP Alert not shown to normal users anymore. * reporting/Image/Canvas/GD.php: Added errorlevel setting to 0 (disable warnings for graphs). * reporting/fgraph.php: MANY graphs migrated from jpgraph to peargraph. * general/header.php: More width for header information. * godmode/admin_access_logs.php: Added graph to header. * godmode/reporting/map_builder.php: Removed debug stuff git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@531 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 29 + pandora_console/general/header.php | 2 +- pandora_console/godmode/admin_access_logs.php | 7 + .../godmode/reporting/map_builder.php | 2 - pandora_console/include/functions.php | 13 +- .../include/languages/language_en.php | 3 + .../operation/agentes/tactical.php | 16 +- .../operation/events/event_statistics.php | 6 +- pandora_console/operation/events/events.php | 49 +- .../operation/incidents/incident.php | 22 +- .../operation/incidents/incident_detail.php | 193 ++--- .../operation/incidents/incident_note.php | 2 +- pandora_console/operation/menu.php | 18 +- pandora_console/reporting/Image/Canvas/GD.php | 2 + pandora_console/reporting/fgraph.php | 666 +++++++----------- 15 files changed, 477 insertions(+), 553 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b742eb82c2..79f16ec9c1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,5 +1,34 @@ 2007-06-21 Sancho Lerena + * include/languages/language_en.php: More strings. + + * include/functions.php: entrada_limpia() should work fine in UTF8. + + * operation/incidents/incident.php: Fixed many ugly things. + + * operation/incidents/incident_detail.php: Fixed many ugly things. + + * operation/incidents/incident_note.php: Fixed many ugly things. + + * operation/events/event_statistics.php: Fixed graphs. + + * operation/events/events.php: Fixed some legend position and header. + + * operation/agentes/tactical.php: Fixed divzero error. + + * operation/menu.php: SNMP Alert not shown to normal users anymore. + + * reporting/Image/Canvas/GD.php: Added errorlevel setting to 0 + (disable warnings for graphs). + + * reporting/fgraph.php: MANY graphs migrated from jpgraph to peargraph. + + * general/header.php: More width for header information. + + * godmode/admin_access_logs.php: Added graph to header. + + * godmode/reporting/map_builder.php: Removed debug stuff + * images/op*.gif, god*.gif: deleted. Also deleted several other GIF files. diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 182b13cc96..463f92a967 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -29,7 +29,7 @@ echo ' '; echo "
"; -echo " +echo "
"; if (isset ($_SESSION["id_usuario"])){ echo "
"; diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 5246e999de..75aa1c1dc9 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -39,6 +39,9 @@ else $offset=0; + echo ""; + echo "
"; + // Manage GET/POST parameter for subselect on action type. POST parameter are proccessed before GET parameter (if passed) if (isset($_GET["tipo_log"])){ $tipo_log = $_GET["tipo_log"]; @@ -83,6 +86,10 @@ echo ""; echo "
"; + echo "
"; + echo ""; + echo "
"; + $sql2="SELECT COUNT(*) FROM tsesion ".$tipo_log_select." ORDER BY fecha DESC"; $result2=mysql_query($sql2); $row2=mysql_fetch_array($result2); diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 2122057d3d..0973d30476 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -110,7 +110,6 @@ if (isset($_GET["update_module"])){ $result = "

".$lang_label["modify_ok"]."

"; else { $result = "

".$lang_label["modify_no"]."

"; - echo $sql; echo "

"; } echo $result; @@ -158,7 +157,6 @@ if (isset($_POST["createmode"])){ $map_background = entrada_limpia($_POST["map_background"]); $map_width = entrada_limpia($_POST["map_width"]); $map_height = entrada_limpia($_POST["map_height"]); - // INSERT REPORT DATA if ($createmode == 1){ diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f48b0d3482..cf492b0a09 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -84,16 +84,9 @@ function output_clean_strict ($string){ // --------------------------------------------------------------- function entrada_limpia ($texto){ - // OJO: MagicQuotes en la configuracion de php.ini deberia estar activado y esta funcion solo deberiamos - // llamarla al entrar datos para escribir datos en la base MYSQL no al reves. - // $str = "A 'quote' is bold"; - // Outputs: A 'quote' is <b>bold</b> - // $filtro0 = utf8_decode($texto); - $filtro1 = htmlentities($texto, ENT_QUOTES); // Primero evitamos el problema de las dobles comillas, comillas sueltas, etc. - $filtro2 = $filtro1; - // Sustituimos los caracteres siguientes ( ) : & - // $filtro2 = strtr($filtro1, array('&' => '&',':' => '58', '(' => '(', ')' => ')')); - return $filtro2; + $filtro0 = utf8_decode($texto); + $filtro1 = htmlentities($filtro0, ENT_QUOTES); + return $filtro1; } // --------------------------------------------------------------- diff --git a/pandora_console/include/languages/language_en.php b/pandora_console/include/languages/language_en.php index d925c135ea..b19f31b526 100644 --- a/pandora_console/include/languages/language_en.php +++ b/pandora_console/include/languages/language_en.php @@ -873,6 +873,9 @@ $lang_label["time_to"]="Time to"; $lang_label["time"]="Time"; $lang_label["module_graph"] = "Module graph"; $lang_label["map_item_add"] = "Add map item"; +$lang_label["graph_event_total"] = "Event graph"; +$lang_label["graph_event_group"] = "Event graph by group"; +$lang_label["graph_event_user"] = "Event graph by user"; global $lang_label; global $help_label; ?> diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index 41b51f74da..b4eb4674b4 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -218,9 +218,19 @@ // Odometer Graph // ~~~~~~~~~~~~~~~ - $monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown)/ $monitor_checks) * 100,1); - $data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);; - $global_health = format_numeric( ((($monitor_ok -$monitor_alert - $monitor_unknown )+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1); + if ($monitor_checks > 0){ + $monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown)/ $monitor_checks) * 100,1); + } else + $monitor_health = 100; + if ($data_checks > 0){ + $data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);; + } else + $data_health = 100; + if (($data_checks == 0) && ($data_checks == 0)){ + $global_health = format_numeric( ((($monitor_ok -$monitor_alert - $monitor_unknown )+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1); + } else + $global_health = 100; + echo "

".$lang_label["tactical_indicator"]."

"; echo ""; diff --git a/pandora_console/operation/events/event_statistics.php b/pandora_console/operation/events/event_statistics.php index 738fb8d91d..3395bafc69 100644 --- a/pandora_console/operation/events/event_statistics.php +++ b/pandora_console/operation/events/event_statistics.php @@ -25,11 +25,15 @@ if (comprueba_login() == 0) { if (give_acl($id_usuario, 0, "AR")==1) { echo "

".$lang_label["events"]." > "; echo $lang_label["event_statistics"]." ".$lang_label["help"]."

"; + echo "

"; + echo "

".$lang_label["graph_event_total"]."

"; echo ''; echo "

"; + echo "

".$lang_label["graph_event_user"]."

"; echo ''; echo "

"; - echo ''; + echo "

".$lang_label["graph_event_group"]."

"; + echo ''; echo "

"; } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access event viewer"); diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 79f97e6785..eccc4368e7 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -160,27 +160,14 @@ if (isset($_POST["event"])) $event = entrada_limpia($_POST["event"]); echo "

".$lang_label["events"]." > ".$lang_label["event_main_view"]." ".$lang_label["help"]."

"; -echo ""; -echo ""; +echo "
"; +echo "
"; +echo ""; echo ""; -echo ""; -echo ""; +echo ""; echo ""; -echo ""; +echo ""; echo ""; +echo ""; echo "
"; echo "

".$lang_label["filter"]."

"; -echo "
"; -echo "

".$lang_label["status"]."

"; -echo " - ".$lang_label["validated_event"]; -echo "
"; -echo " - ".$lang_label["not_validated_event"]; -echo "
"; -echo "

".$lang_label["action"]."

"; -echo " - ".$lang_label["validate_event"]; -echo "
"; -echo " - ".$lang_label["delete_event"]; -echo "
"; -echo " - ".$lang_label["create_incident"]; -echo "
".$lang_label["group"]."".$lang_label["group"].""; echo ""; echo ""; echo ""; echo ""; -echo "
"; +echo "
"; +echo ""; +echo "
"; +echo ""; +echo "
"; + +echo "
"; + echo "
"; // How many events do I have in total ? @@ -326,5 +321,21 @@ if ($total_events > 0){ echo ""; } echo ""; +echo ""; +echo ""; +echo ""; +echo "
"; +echo "

".$lang_label["status"]."

"; +echo " - ".$lang_label["validated_event"]; +echo "
"; +echo " - ".$lang_label["not_validated_event"]; +echo "
"; +echo "

".$lang_label["action"]."

"; +echo " - ".$lang_label["validate_event"]; +echo "
"; +echo " - ".$lang_label["delete_event"]; +echo "
"; +echo " - ".$lang_label["create_incident"]; +echo "
"; } // no events to show ?> \ No newline at end of file diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index a878b23d0a..be19cc4416 100644 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -363,12 +363,12 @@ if ($row2_count[0] <= 0 ) { echo ""; echo "ID"; echo "".$lang_label["status"].""; - echo "".$lang_label["incident"].""; - echo "".$lang_label["priority"].""; + echo "".$lang_label["incident"].""; + echo "".$lang_label["priority"].""; echo "".$lang_label["group"].""; - echo "".$lang_label["updated_at"].""; + echo "".$lang_label["updated_at"].""; echo "".$lang_label["source"].""; - echo "".$lang_label["in_openedby"].""; + echo "".$lang_label["in_openedby"].""; echo "".$lang_label["delete"].""; $color = 1; @@ -418,8 +418,8 @@ if ($row2_count[0] <= 0 ) { case 13: echo ""; break; } - echo "".substr(salida_limpia($row2["titulo"]),0,25); - echo ""; + echo "".substr(salida_limpia($row2["titulo"]),0,45); + echo ""; switch ( $row2["prioridad"] ){ case 0: echo ""."".""; break; case 1: echo ""."".""; break; @@ -436,10 +436,14 @@ if ($row2_count[0] <= 0 ) { case 4: echo $lang_label["very_serious"]; break; case 10: echo $lang_label["maintenance"]; break; */ - echo "".dame_nombre_grupo($row2["id_grupo"]); - echo "".$row2["actualizacion"]; + echo ""; + $id_grupo = $row2["id_grupo"]; + echo ''; + + + echo "".human_time_comparation($row2["actualizacion"]); echo "".$row2["origen"]; - echo " ".dame_nombre_real($row2["id_usuario"])."".substr($row2["id_usuario"], 0, 8).""; + echo "".$row2["id_usuario"].""; $id_author_inc = $row2["id_usuario"]; if ((give_acl($id_usuario, $id_group, "IM") ==1) OR ($_SESSION["id_usuario"] == $id_author_inc) ){ // Only incident owners or incident manager diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index 061eff23c1..1fa8a7fb11 100644 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -19,6 +19,19 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Load global vars +?> + +Creator if ((give_acl($iduser_temp, $id_grupo, "IM")==1) OR ($usuario == $iduser_temp)) { echo ' - "; -echo ''; +echo '
'; echo "
"; // Only if user is the used who opened incident or (s)he is admin @@ -360,7 +372,7 @@ if ($creacion_incidente == 0){ echo ""; if ($creacion_incidente == 0){ - echo "
"; + echo "
"; echo '
@@ -370,11 +382,95 @@ if ($creacion_incidente == 0){ echo "

"; if ($creacion_incidente == 0){ -// Upload control + + // ******************************************************************** + // Notes + // ******************************************************************** + $cabecera=0; + $sql4='SELECT * FROM tnota_inc WHERE id_incidencia = '.$id_inc; + $res4=mysql_query($sql4); + while ($row2=mysql_fetch_array($res4)){ + if ($cabecera == 0) { // Show head only one time + echo "

".$lang_label["in_notas_t1"]."

"; + echo ""; + echo "'; + echo '
"; + $cabecera = 1; + } + + $sql3='SELECT * FROM tnota WHERE id_nota = '.$row2["id_nota"].' ORDER BY timestamp DESC'; + $res3=mysql_query($sql3); + while ($row3=mysql_fetch_array($res3)){ + $timestamp = $row3["timestamp"]; + $nota = $row3["nota"]; + $id_usuario_nota = $row3["id_usuario"]; + // Show data + echo '
'.$lang_label["author"].': '; + $usuario = $id_usuario_nota; + $nombre_real = dame_nombre_real($usuario); + echo $usuario." - (".$nombre_real.")"; + + // Delete comment, only for admins + if ((give_acl($iduser_temp, $id_grupo, "IM")==1) OR ($usuario == $iduser_temp)) { + $myurl="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id=".$id_inc."&id_nota=".$row2["id_nota"]."&id_nota_inc=".$row2["id_nota_inc"]; + echo ''; + } + echo '
'.$lang_label["date"].': '.$timestamp.'
'; + echo ''; + echo '"; + echo '
'; + echo salida_limpia ($nota); + echo "
'; + } + } + if ($cabecera == 1){ + echo "
"; // note table + } + echo ""; + + // ************************************************************ + // Files attached to this incident + // ************************************************************ + + // Attach head if there's attach for this incident + $att_fil=mysql_query("SELECT * FROM tattachment WHERE id_incidencia = ".$id_inc); + + if (mysql_num_rows($att_fil)){ + echo "

".$lang_label["attached_files"]."

"; + echo ""; + echo " + + + + "; + + while ($row=mysql_fetch_array($att_fil)){ + echo "
".$lang_label["filename"]."".$lang_label["description"]."".$lang_label["size"]."".$lang_label["delete"]."
  ".$row["filename"].""; + echo "".$row["description"]; + echo "".$row["size"]; + + if (give_acl($iduser_temp, $id_grupo, "IM")==1){ // Delete attachment + echo ''; + } + + } + echo "
"; + } + // ************************************************************ + // Upload control + // ************************************************************ + + // Upload control if (give_acl($iduser_temp, $id_grupo, "IW")==1){ - echo ' -

'.$lang_label["attachfile"].'

- + echo "

".$lang_label["attachfile"]; + ?> + + "; + echo "

"; + echo "
'.$lang_label["filename"].'
@@ -389,83 +485,10 @@ if ($creacion_incidente == 0){

'; + echo "
"; } - // ************************************************************ - // Files attached to this incident - // ************************************************************ - // Attach head if there's attach for this incident - $att_fil=mysql_query("SELECT * FROM tattachment WHERE id_incidencia = ".$id_inc); - - if (mysql_num_rows($att_fil)) - { - echo ""; - echo "
"; - echo "

".$lang_label["attached_files"]."

"; - echo "
"; - echo " - - - - "; - - while ($row=mysql_fetch_array($att_fil)){ - echo "
".$lang_label["filename"]."".$lang_label["description"]."".$lang_label["size"]."".$lang_label["delete"]."
".$row["filename"].""; - echo "".$row["description"]; - echo "".$row["size"]; - - if (give_acl($iduser_temp, $id_grupo, "IM")==1){ // Delete attachment - echo ''; - } - - } - echo "

"; - } - // ******************************************************************** - // Notes - // ******************************************************************** - $cabecera=0; - $sql4='SELECT * FROM tnota_inc WHERE id_incidencia = '.$id_inc; - $res4=mysql_query($sql4); - while ($row2=mysql_fetch_array($res4)){ - if ($cabecera == 0) { // Show head only one time - echo ""; - echo "
"; - echo "

".$lang_label["in_notas_t1"]."

"; - echo ""; - echo "'; - echo ''; - } - } - if ($cabecera == 1){ - echo "
"; - $cabecera = 1; - } - - $sql3='SELECT * FROM tnota WHERE id_nota = '.$row2["id_nota"].' ORDER BY timestamp DESC'; - $res3=mysql_query($sql3); - while ($row3=mysql_fetch_array($res3)){ - $timestamp = $row3["timestamp"]; - $nota = $row3["nota"]; - $id_usuario_nota = $row3["id_usuario"]; - // Show data - echo '
'.$lang_label["author"].': '; - $usuario = $id_usuario_nota; - $nombre_real = dame_nombre_real($usuario); - echo $usuario." - (".$nombre_real.")"; - - // Delete comment, only for admins - if ((give_acl($iduser_temp, $id_grupo, "IM")==1) OR ($usuario == $iduser_temp)) { - $myurl="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id=".$id_inc."&id_nota=".$row2["id_nota"]."&id_nota_inc=".$row2["id_nota_inc"]; - echo ' '.$lang_label["delete"].''; - } - echo '
'.$lang_label["date"].': '.$timestamp.'
'; - echo '
'; - echo salida_limpia($nota); - echo '
'; - echo '
"; // note table - } - echo "
"; + } // create mode ?> diff --git a/pandora_console/operation/incidents/incident_note.php b/pandora_console/operation/incidents/incident_note.php index 1d998f329b..65af1c46cb 100644 --- a/pandora_console/operation/incidents/incident_note.php +++ b/pandora_console/operation/incidents/incident_note.php @@ -35,7 +35,7 @@ if (comprueba_login() == 0) { echo "".$now.""; echo ""; echo ""; - echo ''; echo ''; echo ''; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 21d72c510a..7b7951ee91 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -210,16 +210,18 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) { } echo ''; - // SNMP Console alert (submenu) - if (isset($_GET["sec"]) && $_GET["sec"] == "snmpconsole"){ - if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_alert") { - echo "
"; - } else { - echo "
"; + if ((give_acl($_SESSION["id_usuario"], 0, "AW")==1)){ + // SNMP Console alert (submenu) + if (isset($_GET["sec"]) && $_GET["sec"] == "snmpconsole"){ + if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_alert") { + echo "
"; + } else { + echo ""; } - echo "
"; } - + // Messages if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/messages/message" && !isset($_GET["nuevo_g"])) { echo '
'; diff --git a/pandora_console/reporting/Image/Canvas/GD.php b/pandora_console/reporting/Image/Canvas/GD.php index 4439194713..50b5a575be 100644 --- a/pandora_console/reporting/Image/Canvas/GD.php +++ b/pandora_console/reporting/Image/Canvas/GD.php @@ -1,5 +1,7 @@ 0){ + // create the graph + $driver=& Image_Canvas::factory('png',array('width'=>$width,'height'=>$height,'antialias' => 'native')); + $Graph = & Image_Graph::factory('graph', $driver); + // add a TrueType font + $Font =& $Graph->addNew('font', $config_fontpath); + // set the font size to 7 pixels + $Font->setSize(7); + $Graph->setFont($Font); + // create the plotarea + $Graph->add( + Image_Graph::horizontal( + $Plotarea = Image_Graph::factory('plotarea'), + $Legend = Image_Graph::factory('legend'), + 50 + ) + ); + $Legend->setPlotarea($Plotarea); + // Create the dataset + // Merge data into a dataset object (sancho) + $Dataset1 =& Image_Graph::factory('dataset'); + for ($a=0;$a < sizeof($data); $a++){ + $Dataset1->addPoint($legend[$a], $data[$a]); + } + $Plot =& $Plotarea->addNew('pie', $Dataset1); + $Plotarea->hideAxis(); + // create a Y data value marker + $Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_PCT_Y_TOTAL); + // create a pin-point marker type + $PointingMarker =& $Plot->addNew('Image_Graph_Marker_Pointing_Angular', array(1, &$Marker)); + // and use the marker on the 1st plot + $Plot->setMarker($PointingMarker); + // format value marker labels as percentage values + $Marker->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%0.1f%%')); + $Plot->Radius = 15; + $FillArray =& Image_Graph::factory('Image_Graph_Fill_Array'); + $Plot->setFillStyle($FillArray); + + $FillArray->addColor('green@0.7'); + $FillArray->addColor('yellow@0.7'); + $FillArray->addColor('red@0.7'); + $FillArray->addColor('orange@0.7'); + $FillArray->addColor('blue@0.7'); + $FillArray->addColor('purple@0.7'); + $FillArray->addColor('lightgreen@0.7'); + $FillArray->addColor('lightblue@0.7'); + $FillArray->addColor('lightred@0.7'); + $FillArray->addColor('grey@0.6', 'rest'); + $Plot->explode(6); + $Plot->setStartingAngle(0); + // output the Graph + $Graph->done(); + } else + graphic_error (); +} + + function graphic_agentmodules($id_agent, $width, $height) { include ("../include/config.php"); require_once 'Image/Graph.php'; @@ -659,67 +720,10 @@ function graphic_agentmodules($id_agent, $width, $height) { $bx++; } } + generic_pie_graph ($width, $height, $data2, $data_label2); - - if ($cx > 0){ - // create the graph - $driver=& Image_Canvas::factory('png',array('width'=>$width,'height'=>$height,'antialias' => 'native')); - $Graph = & Image_Graph::factory('graph', $driver); - - //$Graph =& Image_Graph::factory('graph', array($width, $height)); - // add a TrueType font - $Font =& $Graph->addNew('font', $config_fontpath); - // set the font size to 7 pixels - $Font->setSize(7); - $Graph->setFont($Font); - // create the plotarea - $Graph->add( - Image_Graph::horizontal( - $Plotarea = Image_Graph::factory('plotarea'), - $Legend = Image_Graph::factory('legend'), - 50 - ) - ); - $Legend->setPlotarea($Plotarea); - // Create the dataset - // Merge data into a dataset object (sancho) - $Dataset1 =& Image_Graph::factory('dataset'); - for ($a=0;$a < sizeof($data2); $a++){ - $Dataset1->addPoint($data_label2[$a], $data2[$a]); - } - $Plot =& $Plotarea->addNew('pie', $Dataset1); - $Plotarea->hideAxis(); - // create a Y data value marker - $Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_PCT_Y_TOTAL); - // create a pin-point marker type - $PointingMarker =& $Plot->addNew('Image_Graph_Marker_Pointing_Angular', array(1, &$Marker)); - // and use the marker on the 1st plot - $Plot->setMarker($PointingMarker); - // format value marker labels as percentage values - $Marker->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%0.1f%%')); - $Plot->Radius = 15; - $FillArray =& Image_Graph::factory('Image_Graph_Fill_Array'); - $Plot->setFillStyle($FillArray); - - $FillArray->addColor('green@0.7'); - $FillArray->addColor('yellow@0.7'); - $FillArray->addColor('red@0.7'); - $FillArray->addColor('orange@0.7'); - $FillArray->addColor('blue@0.7'); - $FillArray->addColor('purple@0.7'); - $FillArray->addColor('lightgreen@0.7'); - $FillArray->addColor('lightblue@0.7'); - $FillArray->addColor('lightred@0.7'); - $FillArray->addColor('grey@0.6', 'rest'); - $Plot->explode(6); - $Plot->setStartingAngle(145); - // output the Graph - $Graph->done(); - } else - graphic_error (); } - function graphic_agentaccess($id_agent, $periodo, $width, $height){ include ("../include/config.php"); require_once 'Image/Graph.php'; @@ -814,12 +818,8 @@ function graphic_agentaccess($id_agent, $periodo, $width, $height){ $Graph->done(); } - function grafico_incidente_estados() { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); $data = array(0,0,0,0); @@ -840,35 +840,19 @@ function grafico_incidente_estados() { $data[3]=$data[3]+1; } $mayor = 0; - $mayor_data =0; - for ($a=0;$a < sizeof($data); $a++) - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } - $graph = new PieGraph(370,180,"auto"); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["incident_status"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->setShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.4); - $p1->SetCenter(0.3); + $mayor_data =0; + for ($a=0;$a < sizeof($data); $a++){ + if ($data[$a] > $mayor_data){ + $mayor = $a; + $mayor_data = $data[$a]; + } + } $legend = array ("Open Incident", "Closed Incident", "Outdated", "Invalid"); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + generic_pie_graph (370, 180,$data, $legend); } function grafico_incidente_prioridad() { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); $data = array(0,0,0,0,0,0); @@ -894,95 +878,57 @@ function grafico_incidente_prioridad() { } $mayor = 0; - $mayor_data =0; - for ($a=0;$a < sizeof($data); $a++) - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } - - - $graph = new PieGraph(370,180,"auto"); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["incident_priority"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.4); - $p1->SetCenter(0.3); - $legend = array ("Informative","Low","Medium","Serious", "Very serious", "Maintance"); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + $mayor_data =0; + for ($a=0;$a < sizeof($data); $a++) + if ($data[$a] > $mayor_data){ + $mayor = $a; + $mayor_data = $data[$a]; + } + $legend = array ("Informative","Low","Medium","Serious", "Very serious", "Maintance"); + generic_pie_graph (320, 200, $data, $legend); } function graphic_incident_group() { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); - $data = array(); - $legend = array(); - $sql1="SELECT distinct id_grupo FROM tincidencia "; - $result=mysql_query($sql1); - while ($row=mysql_fetch_array($result)){ - $sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_grupo = ".$row[0]; - $result2=mysql_query($sql1); - $row2=mysql_fetch_array($result2); - $data[] = $row2[0]; - $legend[] = dame_nombre_grupo($row[0])."(".$row2[0].")"; - } - // 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 ($a=0;$a < sizeof($data);$a++){ - for ($b=$a; $b $data[$a]){ - $temp = $data[$a]; - $temp_label = $legend[$a]; - $data[$a] = $data[$b]; - $legend[$a] = $legend[$b]; - $data[$b] = $temp; - $legend[$b] = $temp_label; - } - } - $mayor = 0; - $mayor_data =0; - for ($a=0;$a < sizeof($data); $a++){ - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } + $data = array(); + $legend = array(); + $sql1="SELECT distinct id_grupo FROM tincidencia "; + $result=mysql_query($sql1); + while ($row=mysql_fetch_array($result)){ + $sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_grupo = ".$row[0]; + $result2=mysql_query($sql1); + $row2=mysql_fetch_array($result2); + $data[] = $row2[0]; + $legend[] = dame_nombre_grupo($row[0])."(".$row2[0].")"; } - - $ajuste_altura = sizeof($data) * 20; - $graph = new PieGraph(370,80+$ajuste_altura,'auto'); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["incident_group"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.25); - $p1->SetCenter(0.3); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); +// 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 ($a=0;$a < sizeof($data);$a++){ + for ($b=$a; $b $data[$a]){ + $temp = $data[$a]; + $temp_label = $legend[$a]; + $data[$a] = $data[$b]; + $legend[$a] = $legend[$b]; + $data[$b] = $temp; + $legend[$b] = $temp_label; + } + } + $mayor = 0; + $mayor_data =0; + for ($a=0;$a < sizeof($data); $a++){ + if ($data[$a] > $mayor_data){ + $mayor = $a; + $mayor_data = $data[$a]; + } + } + generic_pie_graph (320, 200, $data, $legend); } function graphic_incident_user() { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); $data = array(); @@ -990,57 +936,38 @@ function graphic_incident_user() { $sql1="SELECT distinct id_usuario FROM tincidencia "; $result=mysql_query($sql1); while ($row=mysql_fetch_array($result)){ - $sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_usuario = '".$row[0]."'"; - $result2=mysql_query($sql1); - $row2=mysql_fetch_array($result2); - $data[] = $row2[0]; - $legend[] = $row[0]."(".$row2[0].")"; + $sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_usuario = '".$row[0]."'"; + $result2=mysql_query($sql1); + $row2=mysql_fetch_array($result2); + $data[] = $row2[0]; + $legend[] = $row[0]."(".$row2[0].")"; } // 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 ($a=0;$a < sizeof($data);$a++){ - for ($b=$a; $b $data[$a]){ - $temp = $data[$a]; - $temp_label = $legend[$a]; - $data[$a] = $data[$b]; - $legend[$a] = $legend[$b]; - $data[$b] = $temp; - $legend[$b] = $temp_label; - } - } - $mayor = 0; - $mayor_data =0; - for ($a=0;$a < sizeof($data); $a++){ - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } - } - - $ajuste_altura = sizeof($data) * 20; - $graph = new PieGraph(370,80+$ajuste_altura,'auto'); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["incident_user"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.25); - $p1->SetCenter(0.3); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + // or much better, pay me to do a special version for you, highly optimized :-)))) + for ($a=0;$a < sizeof($data);$a++){ + for ($b=$a; $b $data[$a]){ + $temp = $data[$a]; + $temp_label = $legend[$a]; + $data[$a] = $data[$b]; + $legend[$a] = $legend[$b]; + $data[$b] = $temp; + $legend[$b] = $temp_label; + } + } + $mayor = 0; + $mayor_data =0; + for ($a=0;$a < sizeof($data); $a++){ + if ($data[$a] > $mayor_data){ + $mayor = $a; + $mayor_data = $data[$a]; + } + } + generic_pie_graph (320, 200, $data, $legend); } -function graphic_user_activity() { +function graphic_user_activity($width=300, $height=200) { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); $data = array(); @@ -1048,12 +975,12 @@ function graphic_user_activity() { $sql1="SELECT DISTINCT ID_usuario FROM tsesion "; $result=mysql_query($sql1); while ($row=mysql_fetch_array($result)){ - $entrada= entrada_limpia($row[0]); - $sql1='SELECT COUNT(ID_usuario) FROM tsesion WHERE ID_usuario = "'.$entrada.'"'; - $result2=mysql_query($sql1); - $row2=mysql_fetch_array($result2); - $data[] = $row2[0]; - $legend[] = substr($row[0],0,16)."(".$row2[0].")"; + $entrada= entrada_limpia($row[0]); + $sql1='SELECT COUNT(ID_usuario) FROM tsesion WHERE ID_usuario = "'.$entrada.'"'; + $result2=mysql_query($sql1); + $row2=mysql_fetch_array($result2); + $data[] = $row2[0]; + $legend[] = substr($row[0],0,16)."(".$row2[0].")"; } // Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) @@ -1070,91 +997,56 @@ function graphic_user_activity() { } } - $mayor = 0; - $mayor_data =0; - for ($a=0;$a < sizeof($data); $a++){ - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } - } - - $ajuste_altura = sizeof($data) * 20; - $graph = new PieGraph(500,80+$ajuste_altura,'auto'); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["users_statistics"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.25); - $p1->SetCenter(0.3); - $p1->SetLegends($legend); - $graph->legend->Pos(0.05,0.49,"right","center"); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + // Take only the first 5 items + if (sizeof($data) >= 5){ + for ($a=0;$a < 5;$a++){ + $legend2[]= $legend[$a]; + $data2[] = $data[$a]; + } + generic_pie_graph ($width, $height, $data2, $legend2); + } else + generic_pie_graph ($width, $height, $data, $legend); } -function graphic_incident_source() { +function graphic_incident_source ($width=320, $height=200) { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); - $data = array(); - $legend = array(); - $sql1="SELECT DISTINCT origen FROM tincidencia"; - $result=mysql_query($sql1); - while ($row=mysql_fetch_array($result)){ - $sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE origen = '".$row[0]."'"; - $result2=mysql_query($sql1); - $row2=mysql_fetch_array($result2); - $data[] = $row2[0]; - $legend[] = $row[0]."(".$row2[0].")"; - } - // 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 ($a=0;$a < sizeof($data);$a++){ - for ($b=$a; $b $data[$a]){ - $temp = $data[$a]; - $temp_label = $legend[$a]; - $data[$a] = $data[$b]; - $legend[$a] = $legend[$b]; - $data[$b] = $temp; - $legend[$b] = $temp_label; - } - } - $mayor = 0; - $mayor_data =0; - for ($a=0;$a < sizeof($data); $a++){ - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } - } - - $ajuste_altura = sizeof($data) * 20; - $graph = new PieGraph(370,80+$ajuste_altura,'auto'); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["incident_source"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.25); - $p1->SetCenter(0.3); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + $data = array(); + $legend = array(); + $sql1="SELECT DISTINCT origen FROM tincidencia"; + $result=mysql_query($sql1); + while ($row=mysql_fetch_array($result)){ + $sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE origen = '".$row[0]."'"; + $result2=mysql_query($sql1); + $row2=mysql_fetch_array($result2); + $data[] = $row2[0]; + $legend[] = $row[0]."(".$row2[0].")"; + } +// 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 ($a=0;$a < sizeof($data);$a++){ + for ($b=$a; $b $data[$a]){ + $temp = $data[$a]; + $temp_label = $legend[$a]; + $data[$a] = $data[$b]; + $legend[$a] = $legend[$b]; + $data[$b] = $temp; + $legend[$b] = $temp_label; + } + } + // Take only the first 5 items + if (sizeof($data) >= 5){ + for ($a=0;$a < 5;$a++){ + $legend2[]= $legend[$a]; + $data2[] = $data[$a]; + } + generic_pie_graph ($width, $height, $data2, $legend2); + } else + generic_pie_graph ($width, $height, $data, $legend); } + function grafico_db_agentes_modulos() { include ("../include/config.php"); include ("jpgraph/jpgraph.php"); @@ -1222,11 +1114,8 @@ function grafico_db_agentes_modulos() { } -function grafico_eventos_usuario() { +function grafico_eventos_usuario( $width=320, $height=200) { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); $data = array(); @@ -1243,49 +1132,31 @@ function grafico_eventos_usuario() { } } // 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 ($a=0;$a < sizeof($data);$a++){ - for ($b=$a; $b $data[$a]){ - $temp = $data[$a]; - $temp_label = $legend[$a]; - $data[$a] = $data[$b]; - $legend[$a] = $legend[$b]; - $data[$b] = $temp; - $legend[$b] = $temp_label; - } - } - $mayor = 0; - $mayor_data =0; - for ($a=0;$a < sizeof($data); $a++) - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; + // or much better, pay me to do a special version for you, highly optimized :-)))) + for ($a=0;$a < sizeof($data);$a++){ + for ($b=$a; $b $data[$a]){ + $temp = $data[$a]; + $temp_label = $legend[$a]; + $data[$a] = $data[$b]; + $legend[$a] = $legend[$b]; + $data[$b] = $temp; + $legend[$b] = $temp_label; + } } - - $ajuste_altura = sizeof($data) * 17; - $graph = new PieGraph(430,170+$ajuste_altura,"auto"); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["events_per_user"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.2); - $p1->SetCenter(0.3); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + // Take only the first 5 items + if (sizeof($data) >= 5){ + for ($a=0;$a < 5;$a++){ + $legend2[]= $legend[$a]; + $data2[] = $data[$a]; + } + generic_pie_graph ($width, $height, $data2, $legend2); + } else + generic_pie_graph ($width, $height, $data, $legend); } function grafico_eventos_total() { - include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); + require ("../include/config.php"); require ("../include/languages/language_".$language_code.".php"); $data = array(); @@ -1307,47 +1178,29 @@ function grafico_eventos_total() { $legend[] = "Not Revised ( $row[0] )"; // 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 ($a=0;$a < sizeof($data);$a++){ - for ($b=$a; $b $data[$a]){ - $temp = $data[$a]; - $temp_label = $legend[$a]; - $data[$a] = $data[$b]; - $legend[$a] = $legend[$b]; - $data[$b] = $temp; - $legend[$b] = $temp_label; - } - } + // or much better, pay me to do a special version for you, highly optimized :-)))) + for ($a=0;$a < sizeof($data);$a++){ + for ($b=$a; $b $data[$a]){ + $temp = $data[$a]; + $temp_label = $legend[$a]; + $data[$a] = $data[$b]; + $legend[$a] = $legend[$b]; + $data[$b] = $temp; + $legend[$b] = $temp_label; + } + } $mayor=0; $mayor_data=0; - for ($a=0;$a < sizeof($data); $a++) - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } - - $graph = new PieGraph(430,200,"auto"); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["event_total"]." ( $total )"); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.4); - $p1->SetCenter(0.28); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + for ($a=0;$a < sizeof($data); $a++) + if ($data[$a] > $mayor_data){ + $mayor = $a; + $mayor_data = $data[$a]; + } + generic_pie_graph (320, 200, $data, $legend); } -function grafico_eventos_grupo() { +function grafico_eventos_grupo ($width = 300, $height = 200 ) { include ("../include/config.php"); - include ("jpgraph/jpgraph.php"); - include ("jpgraph/jpgraph_pie.php"); - include ("jpgraph/jpgraph_pie3d.php"); require ("../include/languages/language_".$language_code.".php"); $data = array(); @@ -1364,42 +1217,27 @@ function grafico_eventos_grupo() { } } // 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 ($a=0;$a < sizeof($data);$a++){ - for ($b=$a; $b $data[$a]){ - $temp = $data[$a]; - $temp_label = $legend[$a]; - $data[$a] = $data[$b]; - $legend[$a] = $legend[$b]; - $data[$b] = $temp; - $legend[$b] = $temp_label; - } - } - $mayor=0; $mayor_data=0; - for ($a=0;$a < sizeof($data); $a++) - if ($data[$a] > $mayor_data){ - $mayor = $a; - $mayor_data = $data[$a]; - } - $total_grupos = sizeof($data); - $ajuste_altura = $total_grupos * 10; - - $graph = new PieGraph(430,150+$ajuste_altura,"auto"); - $graph->SetMarginColor('white@0.2'); - $graph->title->Set($lang_label["events_per_group"]); - $graph->title->SetFont(FF_FONT1,FS_BOLD); - $graph->SetShadow(); - $graph->SetAlphaBlending(); - $graph->SetFrame(true); - $p1 = new PiePlot3D($data); - $p1->ExplodeSlice($mayor); - $p1->SetSize(0.35); - $p1->SetCenter(0.28); - $p1->SetLegends($legend); - $graph->Add($p1); - $graph->img->SetAntiAliasing(); - $graph->Stroke(); + // or much better, pay me to do a special version for you, highly optimized :-)))) + for ($a=0;$a < sizeof($data);$a++){ + for ($b=$a; $b $data[$a]){ + $temp = $data[$a]; + $temp_label = $legend[$a]; + $data[$a] = $data[$b]; + $legend[$a] = $legend[$b]; + $data[$b] = $temp; + $legend[$b] = $temp_label; + } + } +// Take only the first x items + if (sizeof($data) >= 7){ + for ($a=0;$a < 7;$a++){ + $legend2[]= $legend[$a]; + $data2[] = $data[$a]; + } + generic_pie_graph ($width, $height, $data2, $legend2); + } else + generic_pie_graph ($width, $height, $data, $legend); } function grafico_db_agentes_paquetes() { @@ -1456,7 +1294,7 @@ function grafico_db_agentes_paquetes() { $graph->xaxis->SetLabelMargin(5); $graph->Set90AndMargin(100,20,50,30); $p1 = new BarPlot($data); - $p1->value->SetFormat('%.0f '); + $p1->value->SetFormat('%.0f '); $p1->value->Show(); $p1->value->SetAlign('left','center'); $p1->SetFillColor("#0000fd"); @@ -1968,7 +1806,7 @@ if (isset($_GET["tipo"])){ elseif ($_GET["tipo"] =="db_agente_purge") grafico_db_agentes_purge(-1, $width, $height); elseif ($_GET["tipo"] =="group_events") - grafico_eventos_grupo(); + grafico_eventos_grupo($width, $height); elseif ($_GET["tipo"] =="user_events") grafico_eventos_usuario(); elseif ($_GET["tipo"] =="total_events") @@ -1980,7 +1818,7 @@ if (isset($_GET["tipo"])){ elseif ($_GET["tipo"] =="source_incident") graphic_incident_source(); elseif ($_GET["tipo"] =="user_activity") - graphic_user_activity(); + graphic_user_activity($width,$height); elseif ($_GET["tipo"] == "agentaccess") graphic_agentaccess($_GET["id"], $_GET["periodo"], $width, $height); elseif ($_GET["tipo"] == "agentmodules")