Changeset 6206

Show
Ignore:
Timestamp:
08/20/08 16:41:18 (5 months ago)
Author:
jmathis
Message:

bug #147

Location:
trunk/centreon/www/include/views/graphs
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/views/graphs/GetODSXmlGraph.php

    r5943 r6206  
    4848         */ 
    4949        function getMyHostIDService($svc_id = NULL)     { 
    50                 if (!$svc_id) return; 
    5150                global $pearDB; 
     51                 
     52                if (!$svc_id)  
     53                        return; 
     54                 
    5255                $DBRESULT =& $pearDB->query("SELECT host_id FROM host h, host_service_relation hs WHERE h.host_id = hs.host_host_id AND hs.service_service_id = '".$svc_id."'"); 
    5356                if (PEAR::isError($DBRESULT)) 
     
    121124  
    122125        $graphTs = array( NULL => NULL ); 
    123         $DBRESULT =& $pearDB->query("SELECT graph_id, name FROM giv_graphs_template ORDER BY name"); 
     126        $DBRESULT =& $pearDB->query("SELECT `graph_id`, `name` FROM `giv_graphs_template` ORDER BY `name`"); 
    124127        if (PEAR::isError($DBRESULT)) 
    125128                print "Mysql Error : ".$DBRESULT->getDebugInfo(); 
     
    142145                $tab_tmp = split(",", $openid); 
    143146         
     147                print_r($tab_tmp); 
     148         
    144149                foreach ($tab_tmp as $openid) { 
    145150                        $tab_tmp = split("_", $openid); 
    146151                        $id = $tab_tmp[1]; 
    147152                        $type = $tab_tmp[0]; 
     153                         
     154                        print "|$type|"; 
    148155                 
    149156                        if ($type == 'HG')      { 
     157                                 
    150158                                $hosts = getMyHostGroupHosts($id); 
    151159                                foreach ($hosts as $host)       { 
     
    166174                                 
    167175                        } else if ($type == 'HH')       { 
     176                                 
    168177                                $services = getMyHostServices($id); 
    169178                                foreach ($services as $svc_id => $svc_name)     { 
     
    177186                                        } 
    178187                                } 
     188                                 
    179189                        } else if ($type == 'ST')       { 
     190                                 
    180191                                $services = getMyServiceGroupServices($id); 
    181192                                foreach ($services as $svc_id => $svc_name)     {  
     
    186197                                        } 
    187198                                } 
     199                                 
    188200                        } else if ($type == 'MS')       { 
    189                                 array_push($tab_id,$openid); 
     201                                array_push($tab_id, $openid); 
    190202                        } else  { 
    191                                 $hosts = getMyServiceHosts($id); 
    192                                 if ($hosts)     { 
    193                                         $host_id = array_pop($hosts); 
    194                                         if (service_has_graph($host_id, $id) && (($is_admin) || (!$is_admin && isset($lca["LcaHost"][getMyHostName($id)]) && isset($lca["LcaHost"][getMyHostName($id)]["svc"][getMyServiceName($id)])))) 
    195                                                 array_push($tab_id, $openid); 
     203                                if (service_has_graph($tab_tmp[2], $tab_tmp[1])  
     204                                        && (($is_admin) ||  
     205                                                (!$is_admin && isset($lca["LcaHost"][getMyHostName($tab_tmp[2])])  
     206                                                && isset($lca["LcaHost"][getMyHostName($tab_tmp[2])]["svc"][getMyServiceName($tab_tmp[1])])))){ 
     207                                        array_push($tab_id, $openid); 
    196208                                } 
    197209                        }  
    198                          
    199210                } 
    200211        } 
     
    206217        $tab_id = array(); 
    207218        $tab_real_id = array(); 
    208          
     219 
    209220        if (count($tab_tmp)){ 
    210221                foreach ($tab_tmp as $openid)   { 
     
    228239         
    229240        $tab_class = array("1" => "list_one", "0" => "list_two"); 
    230  
     241         
    231242        foreach ($tab_real_id as $key => $openid) { 
    232243                $bad_value = 0;  
     
    434445                 
    435446                        if ($type == "SS"){ 
    436                                 print "|".$openid."|"; 
    437447                                $tab_tmp = split("_", $openid); 
    438448                                $DBRESULT2 =& $pearDBO->query("SELECT id, service_id, service_description, host_name, special FROM index_data WHERE `trashed` = '0' AND special = '0' AND host_id = '".$tab_tmp[2]."' AND service_id = '".$tab_tmp[1]."'"); 
  • trunk/centreon/www/include/views/graphs/GetODSXmlTree.php

    r6191 r6206  
    143143                         * get services for host 
    144144                         */ 
    145                         $services = getMyHostServices($id); 
     145                        $services = getMyHostActiveServices($id); 
    146146                        $graphList = getMyHostGraphs($id); 
    147147                    $host_name = getMyHostName($id);