Changeset 6219

Show
Ignore:
Timestamp:
08/21/08 12:17:58 (5 months ago)
Author:
dduponchelle
Message:

Errors and Warnings in apache resolved during pie chart generation in reporting interface.
Comments has been added and the code normalized.
One file deleted because doesn't use.

Location:
trunk/centreon/www/include/reporting/dashboard/imagesGenerations
Files:
1 removed
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/reporting/dashboard/imagesGenerations/pie-charts.php

    r5995 r6219  
    1616 */ 
    1717 
    18         include_once("@CENTREON_ETC@/centreon.conf.php"); 
    19          
    20         require_once ($centreon_path."www/class/Session.class.php"); 
    21         require_once ($centreon_path."www/class/Oreon.class.php"); 
     18/** 
     19 * This script drawing pie chart of host or service on the reporting interface. 
     20 * 
     21 * PHP version 5 
     22 * 
     23 * @package pie-charts.php 
     24 * @author Damien Duponchelle dduponchelle@merethis.com 
     25 * @version $Id: $ 
     26 * @copyright (c) 2007-2008 Centreon 
     27 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
     28 */ 
    2229 
     30        // Including files and dependences 
     31        include_once '@CENTREON_ETC@/centreon.conf.php'; 
     32        require_once $centreon_path.'www/class/Session.class.php'; 
     33        require_once $centreon_path.'www/class/Oreon.class.php'; 
     34 
     35        // Session Variables 
    2336        Session::start(); 
    2437        $oreon =& $_SESSION["oreon"]; 
     38        $value =& $_GET["value"]; 
     39 
     40        if(isset($value) == true) { 
     41                foreach ($value as $key => $val) { 
     42                        if (isset($val) == true) { 
     43                                if (isset($oreon->optGen["color_".strtolower($key)]) == false) { 
     44                                                $color[] = $oreon->optGen["color_unknown"]; 
     45                                                $data[] = $val; 
     46                                                $legend[] = "Undetermined"; 
     47                                        } else { 
     48                                                $color[] = $oreon->optGen["color_".strtolower($key)];            
     49                                                $data[] = $val; 
     50                                                $legend[] = $key; 
     51                                } 
     52                        } 
     53                } 
     54        } 
    2555         
     56        include_once($centreon_path . '/www/lib/ofc-library/open-flash-chart.php' ); 
    2657 
    27         // ----------------------------------------------------- 
    28         $value =& $_GET["value"]; 
    29          
    30         foreach ($value as $key => $val)        { 
    31                 if ($val) 
    32                         if (!isset($oreon->optGen["color_".strtolower($key)])) { 
    33                                 $color[] = $oreon->optGen["color_unknown"]; 
    34                                 $data[] = $val; 
    35                                 $legend[] = "Undetermined"; 
    36                         } else { 
    37                                 $color[] = $oreon->optGen["color_".strtolower($key)];            
    38                                 $data[] = $val; 
    39                                 $legend[] =$key; 
    40                         } 
    41         } 
    42         include_once($centreon_path . '/www/lib/ofc-library/open-flash-chart.php' ); 
     58        // Declaring a new pie chart with a white background 
    4359        $g = new graph(); 
    44         $g->bg_colour = '#F3F6F6'; 
    45         // 
    46         // PIE chart, 60% alpha 
    47         // 
    48         $g->pie(60,'#505050','#000000'); 
    49         // 
    50         // pass in two arrays, one of data, the other data labels 
    51         // 
    52          
    53         $g->pie_values( $data, $legend ); 
    54         // 
     60        $g->bg_colour = '#F3F6F6'; // Declaring white background for the pie chart. 
     61        $g->pie(60,'#505050','#000000'); // Initializing properties with a grey color and 60% (alpha) 
     62    
     63    // Insert datas on the pie chart 
     64    if(isset($data) == true && isset($legend) == true) {         
     65        $g->pie_values($data,$legend); 
     66    } 
     67 
    5568        // Colours for each slice, in this case some of the colours 
    5669        // will be re-used (3 colurs for 5 slices means the last two 
    5770        // slices will have colours colour[0] and colour[1]): 
    58         // 
     71        $g->pie_slice_colours($color); 
     72        $g->set_tool_tip( '#val#%' ); 
    5973         
    60         $g->pie_slice_colours($color); 
    61  
    62         $g->set_tool_tip( '#val#%' ); 
    63         if (isset($_GET["service_name"]) && isset($_GET["host_name"])) 
     74        // Initializing title of pie chart. 
     75        if (isset($_GET["service_name"]) == true && isset($_GET["host_name"]) == true) { 
     76                // Title for a service displayed like "Service on Host". 
    6477                $g->title( $_GET["service_name"] . " on " . $_GET["host_name"], '{font-size:15px; color: #424242}' ); 
    65         else if (isset($_GET["host_name"])) 
     78        } else if (isset($_GET["host_name"]) == true) { 
     79                // Title for a host.             
    6680                $g->title( $_GET["host_name"], '{font-size:18px; color: #424242}' ); 
     81        } 
     82         
     83        // Apply the current pie chart 
    6784        echo $g->render(); 
    68  
    6985?>