Show
Ignore:
Timestamp:
07/23/08 19:44:14 (4 months ago)
Author:
jmathis
Message:

add view by hostgroup and service group.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/common/XmlTree/GetODSXmlTree.php

    r5437 r5861  
    1616 */ 
    1717 
    18  
    1918        $debugXML = 0; 
    2019        $buffer = ''; 
     
    4342         */ 
    4443         
    45  
    4644        /* Connect to oreon DB */ 
    4745        $dsn = array('phptype'  => 'mysql', 
     
    6563                        $lca = getLCASVC($lca); 
    6664                } 
    67         } else  
     65        } else { 
    6866                exit(); 
    69  
     67        } 
     68         
    7069        $normal_mode = 1; 
    7170        (isset($_GET["mode"])) ? $normal_mode = $_GET["mode"] : $normal_mode = 1; 
     
    9594                                        if (isset($lca["LcaHost"]) && isset($lca["LcaHost"][getMyHostName($host)]) && host_has_one_or_more_GraphService($host)) 
    9695                                        print("<item child='1' id='HH_".$host."_".$id."' text='".getMyHostName($host)."' im0='../16x16/server_network.gif' im1='../16x16/server_network.gif' im2='../16x16/server_network.gif'></item>"); 
     96                                } 
     97                        } 
     98                } else if ($type == "ST") { 
     99                        /* 
     100                         * Send Service/host list for a SG  
     101                         */ 
     102                        $data = getMyServiceGroupServices($id); 
     103                        foreach ($data as $key => $value){ 
     104                                $tab_value = split("_", $key); 
     105                                $host_name = getMyHostName($tab_value[0]); 
     106                                $service_description = getMyServiceName($tab_value[1], $tab_value[0]); 
     107                                if ($is_admin) { 
     108                                        print("<item child='0' id='HS_".$tab_value[1]."_".$tab_value[0]."' text='".$host_name." - ".$service_description."' im0='../16x16/gear.gif' im1='../16x16/gear.gif' im2='../16x16/gear.gif' ></item>");                                  
     109                                } else { 
     110                                        print("<item child='0' id='HS_".$tab_value[1]."_".$tab_value[0]."' text='".$host_name." - ".$service_description."' im0='../16x16/gear.gif' im1='../16x16/gear.gif' im2='../16x16/gear.gif' ></item>");                                  
    97111                                } 
    98112                        } 
     
    119133                        print("<item child='1' id='HH_".$host["host_id"]."' text='".$host["host_name"]."' im0='../16x16/clients.gif' im1='../16x16/server_network.gif' im2='../16x16/server_network.gif'></item>"); 
    120134                        } 
     135                } else if ($type == "RS") { 
     136                        /* 
     137                         * Send Service Group list 
     138                         */ 
     139                        $DBRESULT =& $pearDB->query("SELECT DISTINCT * FROM servicegroup ORDER BY `sg_name`"); 
     140                        if (PEAR::isError($DBRESULT)) 
     141                                print "Mysql Error : ".$DBRESULT->getDebugInfo(); 
     142                        while ($SG =& $DBRESULT->fetchRow()){ 
     143                            $i++; 
     144                                if ($is_admin){ 
     145                                        if (SGIsNotEmpty($SG["sg_id"])){ 
     146                                        print("<item child='1' id='ST_".$SG["sg_id"]."' text='".$SG["sg_name"]."' im0='../16x16/clients.gif' im1='../16x16/clients.gif' im2='../16x16/clients.gif' ></item>"); 
     147                                        }                                        
     148                                } else { 
     149                                        if (SGIsNotEmpty($SG["sg_id"]) /*&& isset($lca["LcaHostGroup"]) && isset($lca["LcaHostGroup"][$HG["hg_alias"]])*/){ 
     150                                        print("<item child='1' id='ST_".$SG["sg_id"]."' text='".$SG["sg_name"]."' im0='../16x16/clients.gif' im1='../16x16/clients.gif' im2='../16x16/clients.gif' ></item>"); 
     151                                        }                                        
     152                                } 
     153                        } 
     154                        $DBRESULT->free(); 
    121155                } else if ($type == "RR") { 
    122156                        $DBRESULT =& $pearDB->query("SELECT DISTINCT * FROM hostgroup ORDER BY `hg_name`"); 
     
    178212                        } 
    179213                } else { 
    180                         print("<item nocheckbox='1' open='1' call='1' select='1' child='1' id='RR_0' text='All Graphs' im0='../16x16/clients.gif' im1='../16x16/clients.gif' im2='../16x16/clients.gif' >"); 
     214                        print("<item nocheckbox='1' open='1' call='1' select='1' child='1' id='RR_0' text='HostGroups' im0='../16x16/clients.gif' im1='../16x16/clients.gif' im2='../16x16/clients.gif' >"); 
     215                        print("<itemtext>label</itemtext>"); 
     216                        print("</item>"); 
     217                        print("<item nocheckbox='1' open='1' call='1' select='1' child='1' id='RS_0' text='ServiceGroups' im0='../16x16/clients.gif' im1='../16x16/clients.gif' im2='../16x16/clients.gif' >"); 
    181218                        print("<itemtext>label</itemtext>"); 
    182219                        print("</item>");