Example #1
0
    /* SEARCH form
    		$search_form = new CForm('search.php');
    		$search_form->addItem(new CDiv(array(S_SEARCH_BIG.': ', new CTextBox('search','',20))));
    
    		$search_div = new CDiv($search_form);
    		$search_div->setAttribute('id','zbx_search');
    		$search_div->setAttribute('class','zbx_search');
    
    		$page_menu->addItem($search_div);
    //*/
    $page_menu->show();
}
//------------------------------------- <HISTORY> ---------------------------------------
if (isset($page['hist_arg']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
    $table = new CTable();
    $table->setClass('history');
    $table->setCellSpacing(0);
    $table->setCellPadding(0);
    $history = get_user_history();
    $tr = new CRow(new CCol('History:', 'caption'));
    $tr->addItem($history);
    $table->addRow($tr);
    $table->Show();
} else {
    if ($page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
        echo SBR;
    }
}
//------------------------------------ </HISTORY> ---------------------------------------
unset($ZBX_MENU);
unset($table, $top_page_row, $menu_table, $node_form);
Example #2
0
/**
* returns Ctable object with host header
*
* {@source}
* @access public
* @static
* @version 1
*
* @param string $hostid
* @param array $elemnts [items, triggers, graphs, applications]
* @return object
*/
function get_header_host_table($hostid, $elements)
{
    $header_host_opt = array('hostids' => $hostid, 'extendoutput' => 1, 'templated_hosts' => 1);
    if (str_in_array('items', $elements)) {
        $header_host_opt['select_items'] = 1;
    }
    if (str_in_array('triggers', $elements)) {
        $header_host_opt['select_triggers'] = 1;
    }
    if (str_in_array('graphs', $elements)) {
        $header_host_opt['select_graphs'] = 1;
    }
    if (str_in_array('applications', $elements)) {
        $header_host_opt['select_applications'] = 1;
    }
    $header_host = CHost::get($header_host_opt);
    $header_host = array_pop($header_host);
    $description = array();
    if ($header_host['proxy_hostid']) {
        $proxy = get_host_by_hostid($header_host['proxy_hostid']);
        $description[] = $proxy['host'] . ':';
    }
    $description[] = $header_host['host'];
    if (str_in_array('items', $elements)) {
        $items = array(new CLink(S_ITEMS, 'items.php?hostid=' . $header_host['hostid']), ' (' . count($header_host['items']) . ')');
    }
    if (str_in_array('triggers', $elements)) {
        $triggers = array(new CLink(S_TRIGGERS, 'triggers.php?hostid=' . $header_host['hostid']), ' (' . count($header_host['triggers']) . ')');
    }
    if (str_in_array('graphs', $elements)) {
        $graphs = array(new CLink(S_GRAPHS, 'graphs.php?hostid=' . $header_host['hostid']), ' (' . count($header_host['graphs']) . ')');
    }
    if (str_in_array('applications', $elements)) {
        $applications = array(new CLink(S_APPLICATIONS, 'applications.php?hostid=' . $header_host['hostid']), ' (' . count($header_host['applications']) . ')');
    }
    $tbl_header_host = new CTable();
    if ($header_host['status'] == HOST_STATUS_TEMPLATE) {
        $tbl_header_host->addRow(array(new CLink(bold(S_TEMPLATE_LIST), 'templates.php?templateid=' . $header_host['hostid'] . url_param('groupid')), str_in_array('applications', $elements) ? $applications : null, str_in_array('items', $elements) ? $items : null, str_in_array('triggers', $elements) ? $triggers : null, str_in_array('graphs', $elements) ? $graphs : null, array(bold(S_TEMPLATE . ': '), $description)));
    } else {
        $dns = empty($header_host['dns']) ? '-' : $header_host['dns'];
        $ip = empty($header_host['ip']) ? '-' : $header_host['ip'];
        $port = empty($header_host['port']) ? '-' : $header_host['port'];
        if (1 == $header_host['useip']) {
            $ip = bold($ip);
        } else {
            $dns = bold($dns);
        }
        switch ($header_host['status']) {
            case HOST_STATUS_MONITORED:
                $status = new CSpan(S_MONITORED, 'off');
                break;
            case HOST_STATUS_NOT_MONITORED:
                $status = new CSpan(S_NOT_MONITORED, 'off');
                break;
            default:
                $status = S_UNKNOWN;
        }
        if ($header_host['available'] == HOST_AVAILABLE_TRUE) {
            $available = new CSpan(S_AVAILABLE, 'off');
        } else {
            if ($header_host['available'] == HOST_AVAILABLE_FALSE) {
                $available = new CSpan(S_NOT_AVAILABLE, 'on');
            } else {
                if ($header_host['available'] == HOST_AVAILABLE_UNKNOWN) {
                    $available = new CSpan(S_UNKNOWN, 'unknown');
                }
            }
        }
        $tbl_header_host->addRow(array(new CLink(bold(S_HOST_LIST), 'hosts.php?hostid=' . $header_host['hostid'] . url_param('groupid')), str_in_array('applications', $elements) ? $applications : null, str_in_array('items', $elements) ? $items : null, str_in_array('triggers', $elements) ? $triggers : null, str_in_array('graphs', $elements) ? $graphs : null, array(bold(S_HOST . ': '), $description), array(bold(S_DNS . ': '), $dns), array(bold(S_IP . ': '), $ip), array(bold(S_PORT . ': '), $port), array(bold(S_STATUS . ': '), $status), array(bold(S_AVAILABILITY . ': '), $available)));
    }
    $tbl_header_host->setClass('infobox');
    return $tbl_header_host;
}
Example #3
0
 $frmService->AddRow(S_NAME, new CTextBox('name', $name, 60));
 //link
 //-------------------------------------------- <LINK> --------------------------------------------
 //parent link
 $ctb = new CTextBox('parent_name', $parentname, 60);
 $ctb->setAttribute('disabled', 'disabled');
 $frmService->AddVar('parentname', $parentname);
 $frmService->AddVar('parentid', $parentid);
 $cb = new CButton('select_parent', S_CHANGE);
 $cb->SetType('button');
 $cb->SetAction("javascript: openWinCentered('services_form.php?pservices=1" . url_param('serviceid') . "','ZBX_Services_List',740,420,'scrollbars=1, toolbar=0, menubar=0, resizable=1, dialog=0');");
 $frmService->AddRow('Parent Service', array($ctb, $cb));
 //----------
 //child links
 $table = new CTable();
 $table->setClass('tableinfo');
 $table->setOddRowClass('even_row');
 $table->setEvenRowClass('even_row');
 $table->attributes['cellpadding'] = 3;
 $table->attributes['cellspacing'] = 1;
 $table->headerClass = 'header';
 $table->footerClass = 'footer';
 $table->setHeader(array(new CCheckBox('all_child_services', null, "check_childs('" . $frmService->GetName() . "','childs','all_child_services');"), S_SERVICES, S_SOFT, S_TRIGGER));
 $table->setAttribute('id', 'service_childs');
 foreach ($childs as $id => $child) {
     $prefix = null;
     $trigger = '-';
     $description = new CLink($child['name'], 'services_form.php?sform=1&serviceid=' . $child['serviceid'], 'action');
     if (isset($child['triggerid']) && !empty($child['triggerid'])) {
         $trigger = expand_trigger_description($child['triggerid']);
     }
Example #4
0
             $status = S_UNKNOWN;
     }
     if ($header_host['available'] == HOST_AVAILABLE_TRUE) {
         $available = new CSpan(S_AVAILABLE, 'off');
     } else {
         if ($header_host['available'] == HOST_AVAILABLE_FALSE) {
             $available = new CSpan(S_NOT_AVAILABLE, 'on');
         } else {
             if ($header_host['available'] == HOST_AVAILABLE_UNKNOWN) {
                 $available = new CSpan(S_UNKNOWN, 'unknown');
             }
         }
     }
     $tbl_header_host = new CTable();
     $tbl_header_host->addRow(array(new CLink(bold(S_HOST_LIST), 'hosts.php?hostid=' . $header_host['hostid'] . url_param('groupid')), $triggers, $graphs, array(bold(S_HOST . ': '), $description), array(bold(S_DNS . ': '), $dns), array(bold(S_IP . ': '), $ip), array(bold(S_PORT . ': '), $port), array(bold(S_STATUS . ': '), $status), array(bold(S_AVAILABILITY . ': '), $available)));
     $tbl_header_host->setClass('infobox');
     $items_wdgt->addItem($tbl_header_host);
 }
 // --->>> SELECTED HOST HEADER INFORMATION <<<---
 if ($filter_enabled) {
     if (ZBX_DISTRIBUTED && isset($_REQUEST['filter_node'])) {
         $from_tables['n'] = 'nodes n';
         $where_case[] = 'n.nodeid=' . DBid2nodeid('i.itemid');
         $where_case[] = 'n.name like ' . zbx_dbstr('%' . $_REQUEST['filter_node'] . '%');
     }
     if (isset($_REQUEST['filter_group'])) {
         $from_tables['hg'] = 'hosts_groups hg';
         $from_tables['g'] = 'groups g';
         $where_case[] = 'i.hostid=hg.hostid';
         $where_case[] = 'g.groupid=hg.groupid';
         $where_case[] = 'g.name like ' . zbx_dbstr('%' . $_REQUEST['filter_group'] . '%');