$graphid = $graph['graphid'];
 $hostList = null;
 if (empty($this->data['hostid'])) {
     $hostList = array();
     foreach ($graph['hosts'] as $host) {
         $hostList[$host['name']] = $host['name'];
     }
     foreach ($graph['templates'] as $template) {
         $hostList[$template['name']] = $template['name'];
     }
     $hostList = implode(', ', $hostList);
 }
 $isCheckboxEnabled = true;
 $name = array();
 if (!empty($graph['templateid'])) {
     $realHosts = get_realhosts_by_graphid($graph['templateid']);
     $realHosts = DBfetch($realHosts);
     $name[] = new CLink($realHosts['name'], 'graphs.php?hostid=' . $realHosts['hostid'], 'unknown');
     $name[] = NAME_DELIMITER;
     $name[] = new CLink($graph['name'], 'graphs.php?' . 'form=update' . '&graphid=' . $graphid . url_param('parent_discoveryid') . '&hostid=' . $this->data['hostid']);
     $isCheckboxEnabled = false;
 } elseif (!empty($graph['discoveryRule']) && empty($this->data['parent_discoveryid'])) {
     $name[] = new CLink($graph['discoveryRule']['name'], 'host_discovery.php?form=update&itemid=' . $graph['discoveryRule']['itemid'], 'parent-discovery');
     $name[] = NAME_DELIMITER;
     $name[] = new CSpan($graph['name']);
     $isCheckboxEnabled = false;
 } else {
     $name[] = new CLink($graph['name'], 'graphs.php?' . 'form=update' . '&graphid=' . $graphid . url_param('parent_discoveryid') . '&hostid=' . $this->data['hostid']);
 }
 $checkBox = new CCheckBox('group_graphid[' . $graphid . ']', null, null, $graphid);
 $checkBox->setEnabled($isCheckboxEnabled);
Beispiel #2
0
function get_realhosts_by_graphid($graphid)
{
    $graph = get_graph_by_graphid($graphid);
    if ($graph["templateid"] != 0) {
        return get_realhosts_by_graphid($graph["templateid"]);
    }
    return get_hosts_by_graphid($graphid);
}
function get_realhosts_by_graphid($graphid)
{
    $graph = get_graph_by_graphid($graphid);
    if (!empty($graph['templateid'])) {
        return get_realhosts_by_graphid($graph['templateid']);
    }
    return get_hosts_by_graphid($graphid);
}
Beispiel #4
0
 $result = DBselect($sql);
 while ($row = DBfetch($result)) {
     if ($_REQUEST['hostid'] != 0) {
         $host_list = NULL;
     } else {
         $host_list = array();
         $db_hosts = get_hosts_by_graphid($row['graphid']);
         while ($db_host = DBfetch($db_hosts)) {
             array_push($host_list, $db_host['host']);
         }
         $host_list = implode(',', $host_list);
     }
     if ($row['templateid'] == 0) {
         $name = new CLink($row['name'], 'graphs.php?graphid=' . $row['graphid'] . '&form=update', 'action');
     } else {
         $real_hosts = get_realhosts_by_graphid($row['templateid']);
         $real_host = DBfetch($real_hosts);
         if ($real_host) {
             $name = array(new CLink($real_host['host'], 'graphs.php?' . 'hostid=' . $real_host['hostid'], 'action'), ':', $row['name']);
         } else {
             array_push($description, new CSpan('error', 'on'), ':', expand_trigger_description($row['triggerid']));
         }
     }
     $chkBox = new CCheckBox('group_graphid[' . $row['graphid'] . ']', NULL, NULL, $row['graphid']);
     if ($row['templateid'] > 0) {
         $chkBox->SetEnabled(false);
     }
     switch ($row['graphtype']) {
         case GRAPH_TYPE_STACKED:
             $graphtype = S_STACKED;
             break;