本文整理汇总了PHP中CTableInfo::SetHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP CTableInfo::SetHeader方法的具体用法?PHP CTableInfo::SetHeader怎么用?PHP CTableInfo::SetHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTableInfo
的用法示例。
在下文中一共展示了CTableInfo::SetHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_acktab_by_eventid
function make_acktab_by_eventid($eventid)
{
$table = new CTableInfo();
$table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
$acks = get_acknowledges_by_eventid($eventid);
while ($ack = DBfetch($acks)) {
$user = get_user_by_userid($ack['userid']);
$table->AddRow(array(date('d-m-Y h:i:s A', $ack['clock']), $user['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
return $table;
}
示例2: make_acktab_by_eventid
function make_acktab_by_eventid($eventid)
{
$table = new CTableInfo();
$table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
$acks = get_acknowledges_by_eventid($eventid);
while ($ack = DBfetch($acks)) {
//$users = CUser::get(array('userids' => $ack['userid'], 'output' => API_OUTPUT_EXTEND));
//$user = reset($users);
$table->addRow(array(zbx_date2str(S_ACKNOWINC_BY_EVENTS_DATE_FORMAT, $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
return $table;
}
示例3: DBcondition
$triggers[$rowz['triggerid']] = $rowz;
$triggerids[$rowz['triggerid']] = $rowz['triggerid'];
}
$sql = 'SELECT f.triggerid, i.* ' . ' FROM functions f, items i ' . ' WHERE ' . DBcondition('f.triggerid', $triggerids) . ' AND i.itemid=f.itemid';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$item['itemid'] = $row['itemid'];
$item['action'] = str_in_array($row['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues';
$item['description'] = item_description($row);
$triggers[$row['triggerid']]['items'][$row['itemid']] = $item;
}
$sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
$sql_cond .= ' AND e.clock>' . $start;
$sql_cond .= ' AND e.clock<' . $end;
$table = new CTableInfo(S_NO_EVENTS_FOUND);
$table->SetHeader(array(make_sorting_link(S_TIME, 'e.clock'), is_show_subnodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 ? S_HOST : null, S_DESCRIPTION, S_STATUS, S_SEVERITY, S_DURATION, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
if (!empty($triggers)) {
$col = 0;
$sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE ' . DBcondition('e.objectid', $triggerids) . ' AND (e.object+0)=' . EVENT_OBJECT_TRIGGER . $sql_cond . order_by('e.clock');
//SDI($sql);
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$value = new CCol(trigger_value2str($row['value']), get_trigger_value_style($row['value']));
$row = array_merge($triggers[$row['triggerid']], $row);
if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
continue;
}
$duration = zbx_date2age($row['clock']);
if ($next_event = get_next_event($row, $show_unknown)) {
$duration = zbx_date2age($row['clock'], $next_event['clock']);
}
示例4: CScript
$fs_icon->AddAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
$p_elements[] = get_table_header($text, $r_form);
//-------------
$services = array();
$db_dservices = DBselect('SELECT s.type,s.port,s.key_ FROM dservices s,dhosts h' . ' WHERE ' . DBin_node('s.dserviceid') . ' AND s.dhostid=h.dhostid' . ($druleid > 0 ? ' AND h.druleid=' . $druleid : ''));
while ($dservice = DBfetch($db_dservices)) {
$service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . (empty($dservice['key_']) ? '' : ':' . $dservice['key_']);
$services[$service_name] = 1;
}
ksort($services);
$header = array(is_show_subnodes() ? new CCol(S_NODE, 'center') : null, new CCol(make_sorting_link(S_HOST, 'ip'), 'center'), new CCol(array(S_UPTIME . '/', S_DOWNTIME), 'center'));
foreach ($services as $name => $foo) {
$header[] = new CImg('vtext.php?text=' . $name);
}
$table = new CTableInfo();
$table->SetHeader($header, 'vertical_header');
$db_drules = DBselect('select distinct druleid,name from drules where ' . DBin_node('druleid') . ($druleid > 0 ? ' and druleid=' . $druleid : '') . ' order by name');
while ($drule = DBfetch($db_drules)) {
$discovery_info = array();
$db_dhosts = DBselect('SELECT dhostid,druleid,ip,status,lastup,lastdown ' . ' FROM dhosts WHERE ' . DBin_node('dhostid') . ' AND druleid=' . $drule['druleid'] . order_by('ip', 'dhostid,status'));
while ($dhost = DBfetch($db_dhosts)) {
$class = 'enabled';
$time = 'lastup';
if (DHOST_STATUS_DISABLED == $dhost['status']) {
$class = 'disabled';
$time = 'lastdown';
}
$discovery_info[$dhost['ip']] = array('class' => $class, 'time' => $dhost[$time], 'druleid' => $dhost['druleid']);
$db_dservices = DBselect('SELECT type,port,key_,status,lastup,lastdown FROM dservices ' . ' WHERE dhostid=' . $dhost['dhostid'] . ' order by status,type,port');
while ($dservice = DBfetch($db_dservices)) {
$class = 'active';
示例5: get_screen
//.........这里部分代码省略.........
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_DATA_OVERVIEW) {
$hostids = array();
$res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid);
while ($tmp_host = DBfetch($res)) {
$hostids[$tmp_host['hostid']] = $tmp_host['hostid'];
}
$item = array(get_items_data_overview($hostids, $style));
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_URL) {
$item = array(new CIFrame($url, $width, $height, "auto"));
if ($editmode == 1) {
array_push($item, BR(), new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_ACTIONS) {
$item = array(get_history_of_actions($elements));
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_EVENTS) {
$options = array('monitored' => 1, 'value' => array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE), 'limit' => $elements);
$hide_unknown = CProfile::get('web.events.filter.hide_unknown', 0);
if ($hide_unknown) {
$options['value'] = array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE);
}
$item = new CTableInfo(S_NO_EVENTS_FOUND);
$item->SetHeader(array(S_TIME, is_show_all_nodes() ? S_NODE : null, S_HOST, S_DESCRIPTION, S_VALUE, S_SEVERITY));
$events = getLastEvents($options);
foreach ($events as $enum => $event) {
$trigger = $event['trigger'];
$host = $event['host'];
$value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value']));
// $row = zbx_array_merge($triggers[$row['triggerid']],$row);
// if((1 == $hide_unknown) && (!event_initial_time($row,$hide_unknown))) continue;
$item->addRow(array(zbx_date2str(S_EVENTS_TRIGGERS_EVENTS_HISTORY_LIST_DATE_FORMAT, $event['clock']), get_node_name_by_elid($event['objectid']), $host['host'], new CLink($trigger['description'], 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']), $value, new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority']))));
}
$item = array($item);
if ($editmode == 1) {
array_push($item, new CLink(S_CHANGE, $action));
}
} else {
$item = array(SPACE);
if ($editmode == 1) {
array_push($item, BR(), new CLink(S_CHANGE, $action));
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
示例6: get_triggers_overview
function get_triggers_overview($hostids, $view_style = null)
{
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids);
if (is_null($view_style)) {
$view_style = get_profile('web.overview.view.style', STYLE_TOP);
}
$table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
$result = DBselect('SELECT DISTINCT t.triggerid,t.description,t.expression,t.value,t.priority,t.lastchange,h.hostid,h.host' . ' FROM hosts h,items i,triggers t, functions f ' . ' WHERE h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' ORDER BY t.description');
unset($triggers);
unset($hosts);
$triggers = array();
while ($row = DBfetch($result)) {
if (trigger_dependent($row['triggerid'])) {
continue;
}
$row['host'] = get_node_name_by_elid($row['hostid']) . $row['host'];
$row['description'] = expand_trigger_description_constants($row['description'], $row);
$hosts[strtolower($row['host'])] = $row['host'];
// A little tricky check for attempt to overwrite active trigger (value=1) with
// inactive or active trigger with lower priority.
if (!isset($triggers[$row['description']][$row['host']]) || ($triggers[$row['description']][$row['host']]['value'] == TRIGGER_VALUE_FALSE && $row['value'] == TRIGGER_VALUE_TRUE || ($triggers[$row['description']][$row['host']]['value'] == TRIGGER_VALUE_FALSE || $row['value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $triggers[$row['description']][$row['host']]['priority'])) {
$triggers[$row['description']][$row['host']] = array('hostid' => $row['hostid'], 'triggerid' => $row['triggerid'], 'value' => $row['value'], 'lastchange' => $row['lastchange'], 'priority' => $row['priority']);
}
}
if (!isset($hosts)) {
return $table;
}
ksort($hosts);
if ($view_style == STYLE_TOP) {
$header = array(new CCol(S_TRIGGERS, 'center'));
foreach ($hosts as $hostname) {
$header = array_merge($header, array(new CImg('vtext.php?text=' . $hostname)));
}
$table->setHeader($header, 'vertical_header');
foreach ($triggers as $descr => $trhosts) {
$table_row = array(nbsp($descr));
foreach ($hosts as $hostname) {
$table_row = get_trigger_overview_cells($table_row, $trhosts, $hostname);
}
$table->AddRow($table_row);
}
} else {
$header = array(new CCol(S_HOSTS, 'center'));
foreach ($triggers as $descr => $trhosts) {
$descr = array(new CImg('vtext.php?text=' . $descr));
array_push($header, $descr);
}
$table->SetHeader($header, 'vertical_header');
foreach ($hosts as $hostname) {
$table_row = array(nbsp($hostname));
foreach ($triggers as $descr => $trhosts) {
$table_row = get_trigger_overview_cells($table_row, $trhosts, $hostname);
}
$table->AddRow($table_row);
}
}
return $table;
}
示例7: DBselect
$sec_600[$row['proxy_hostid']]++;
} else {
$sec_rest[$row['proxy_hostid']]++;
}
}
}
}
}
}
$table->setHeader(array(S_PROXY, S_5_SECONDS, S_10_SECONDS, S_30_SECONDS, S_1_MINUTE, S_5_MINUTES, S_MORE_THAN_10_MINUTES));
$db_proxies = DBselect('select hostid,host from hosts where status=' . HOST_STATUS_PROXY . ' order by host');
while (null != ($db_proxy = DBfetch($db_proxies))) {
$elements = array($db_proxy['host'], new CCol($sec_10[$db_proxy['hostid']], $sec_10[$db_proxy['hostid']] ? "unknown_trigger" : "normal"), new CCol($sec_30[$db_proxy['hostid']], $sec_30[$db_proxy['hostid']] ? "information" : "normal"), new CCol($sec_60[$db_proxy['hostid']], $sec_60[$db_proxy['hostid']] ? "warning" : "normal"), new CCol($sec_300[$db_proxy['hostid']], $sec_300[$db_proxy['hostid']] ? "average" : "normal"), new CCol($sec_600[$db_proxy['hostid']], $sec_600[$db_proxy['hostid']] ? "high" : "normal"), new CCol($sec_rest[$db_proxy['hostid']], $sec_rest[$db_proxy['hostid']] ? "disaster" : "normal"));
$table->addRow($elements);
}
$elements = array(new CCol(S_SERVER, 'bold'), new CCol($sec_10[0], $sec_10[0] ? 'unknown_trigger' : 'normal'), new CCol($sec_30[0], $sec_30[0] ? 'information' : 'normal'), new CCol($sec_60[0], $sec_60[0] ? 'warning' : 'normal'), new CCol($sec_300[0], $sec_300[0] ? 'average' : 'normal'), new CCol($sec_600[0], $sec_600[0] ? 'high' : 'normal'), new CCol($sec_rest[0], $sec_rest[0] ? 'disaster' : 'normal'));
$table->addRow($elements);
} else {
if ($_REQUEST["show"] == 2) {
$table->SetHeader(array(S_NEXT_CHECK, is_show_subnodes() ? S_NODE : null, S_HOST, S_DESCRIPTION));
while ($row = DBfetch($result)) {
$table->AddRow(array(date("m.d.Y H:i:s", $row["nextcheck"]), get_node_name_by_elid($row['hostid']), $row['host'], item_description($row)));
}
}
}
}
$table->Show();
if ($_REQUEST["show"] != 0) {
show_table_header(S_TOTAL . ": " . $table->GetNumRows());
}
include_once "include/page_footer.php";
示例8: CComboBox
$form->SetMethod('get');
$cmbSource = new CComboBox('eventsource', $_REQUEST['eventsource'], 'submit()');
$cmbSource->addItem(EVENT_SOURCE_TRIGGERS, S_TRIGGERS);
$cmbSource->addItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY);
$form->addItem(array(S_EVENT_SOURCE, SPACE, $cmbSource));
$row_count = 0;
$numrows = new CSpan(null, 'info');
$numrows->addOption('name', 'numrows');
$header = get_table_header(array(S_ACTIONS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header, $form);
unset($form, $cmbSource);
/* table */
$form = new CForm();
$form->SetName('actions');
$tblActions = new CTableInfo(S_NO_ACTIONS_DEFINED);
$tblActions->SetHeader(array(array(new CCheckBox('all_items', null, 'CheckAll("' . $form->GetName() . '","all_items");'), make_sorting_link(S_NAME, 'a.name')), S_CONDITIONS, S_OPERATIONS, make_sorting_link(S_STATUS, 'a.status')));
$db_actions = DBselect('SELECT a.* ' . ' FROM actions a' . ' WHERE a.eventsource=' . $_REQUEST['eventsource'] . ' AND ' . DBin_node('actionid') . order_by('a.name,a.status', 'a.actionid'));
while ($action_data = DBfetch($db_actions)) {
if (!action_accessible($action_data['actionid'], PERM_READ_WRITE)) {
continue;
}
$conditions = array();
$db_conditions = DBselect('select * from conditions where actionid=' . $action_data['actionid'] . ' order by conditiontype,conditionid');
while ($condition_data = DBfetch($db_conditions)) {
array_push($conditions, array(get_condition_desc($condition_data['conditiontype'], $condition_data['operator'], $condition_data['value']), BR()));
}
unset($db_conditions, $condition_data);
$operations = array();
$db_operations = DBselect('select * from operations where actionid=' . $action_data['actionid'] . ' order by operationtype,operationid');
while ($operation_data = DBfetch($db_operations)) {
array_push($operations, array(get_operation_desc(SHORT_DESCRITION, $operation_data), BR()));
示例9: CComboBox
$cmbTimeZone = new CComboBox('timezone', $timezone);
for ($i = -12; $i <= 13; $i++) {
$cmbTimeZone->addItem($i, 'GMT' . sprintf('%+03d:00', $i));
}
$frmNode->addRow(S_TIME_ZONE, $cmbTimeZone);
$frmNode->addRow(S_IP, new CTextBox('ip', $ip, 15));
$frmNode->addRow(S_PORT, new CNumericBox('port', $port, 5));
$frmNode->addRow(S_DO_NOT_KEEP_HISTORY_OLDER_THAN, new CNumericBox('slave_history', $slave_history, 6));
$frmNode->addRow(S_DO_NOT_KEEP_TRENDS_OLDER_THAN, new CNumericBox('slave_trends', $slave_trends, 6));
$frmNode->addItemToBottomRow(new CButton('save', S_SAVE));
if (isset($_REQUEST['nodeid']) && $node_type != ZBX_NODE_LOCAL) {
$frmNode->addItemToBottomRow(SPACE);
$frmNode->addItemToBottomRow(new CButtonDelete('Delete selected node?', url_param('form') . url_param('nodeid')));
}
$frmNode->addItemToBottomRow(SPACE);
$frmNode->addItemToBottomRow(new CButtonCancel(url_param('config')));
$frmNode->Show();
} else {
show_table_header(S_NODES_BIG);
$table = new CTableInfo(S_NO_NODES_DEFINED);
$table->SetHeader(array(make_sorting_link(S_ID, 'n.nodeid'), make_sorting_link(S_NAME, 'n.name'), make_sorting_link(S_TYPE, 'n.nodetype'), make_sorting_link(S_TIME_ZONE, 'n.timezone'), make_sorting_link(S_IP . ':' . S_PORT, 'n.ip')));
$sql = 'SELECT n.* ' . ' FROM nodes n' . ' WHERE ' . DBcondition('n.nodeid', $available_nodes) . order_by('n.nodeid,n.name,n.nodetype,n.timezone,n.ip', 'n.masterid');
$db_nodes = DBselect($sql);
while ($row = DBfetch($db_nodes)) {
$node_type = detect_node_type($row);
$node_type_name = node_type2str($node_type);
$table->AddRow(array($row['nodeid'], array(get_node_path($row['masterid']), new CLink($row['nodetype'] ? new CSpan($row['name'], 'bold') : $row['name'], '?&form=update&nodeid=' . $row['nodeid'], 'action')), $node_type == ZBX_NODE_LOCAL ? new CSpan($node_type_name, 'bold') : $node_type_name, new CSpan('GMT' . sprintf('%+03d:00', $row['timezone']), $row['nodetype'] ? 'bold' : null), new CSpan($row['ip'] . ':' . $row['port'], $row['nodetype'] ? 'bold' : null)));
}
$table->Show();
}
include_once 'include/page_footer.php';
示例10: DBselect
}
}
}
}
$table->setHeader(array(S_PROXY, S_5_SECONDS, S_10_SECONDS, S_30_SECONDS, S_1_MINUTE, S_5_MINUTES, S_MORE_THAN_10_MINUTES));
$db_proxies = DBselect('select hostid,host from hosts where status=' . HOST_STATUS_PROXY . ' order by host');
while (null != ($db_proxy = DBfetch($db_proxies))) {
$elements = array($db_proxy['host'], new CCol($sec_10[$db_proxy['hostid']], $sec_10[$db_proxy['hostid']] ? "unknown_trigger" : "normal"), new CCol($sec_30[$db_proxy['hostid']], $sec_30[$db_proxy['hostid']] ? "information" : "normal"), new CCol($sec_60[$db_proxy['hostid']], $sec_60[$db_proxy['hostid']] ? "warning" : "normal"), new CCol($sec_300[$db_proxy['hostid']], $sec_300[$db_proxy['hostid']] ? "average" : "normal"), new CCol($sec_600[$db_proxy['hostid']], $sec_600[$db_proxy['hostid']] ? "high" : "normal"), new CCol($sec_rest[$db_proxy['hostid']], $sec_rest[$db_proxy['hostid']] ? "disaster" : "normal"));
$table->addRow($elements);
}
$elements = array(new CCol(S_SERVER, 'bold'), new CCol($sec_10[0], $sec_10[0] ? 'unknown_trigger' : 'normal'), new CCol($sec_30[0], $sec_30[0] ? 'information' : 'normal'), new CCol($sec_60[0], $sec_60[0] ? 'warning' : 'normal'), new CCol($sec_300[0], $sec_300[0] ? 'average' : 'normal'), new CCol($sec_600[0], $sec_600[0] ? 'high' : 'normal'), new CCol($sec_rest[0], $sec_rest[0] ? 'disaster' : 'normal'));
$table->addRow($elements);
} else {
if ($_REQUEST["config"] == 2) {
$arr = array();
$table->SetHeader(array(S_NEXT_CHECK, S_DELAYED_BY, is_show_all_nodes() ? S_NODE : null, S_HOST, S_DESCRIPTION));
while ($row = DBfetch($result)) {
$res = calculate_item_nextcheck($row['itemid'], $row['type'], $row['delay'], $row['delay_flex'], $row['lastclock']);
if (0 != $row['proxy_hostid']) {
$res['nextcheck'] = $row['lastclock'] + $res['delay'];
}
$diff = $now - $res['nextcheck'];
if ($diff <= 5) {
continue;
}
array_push($arr, array($res['nextcheck'], $row['hostid'], $row['host'], item_description($row)));
}
$rows = 0;
sort($arr);
foreach ($arr as $r) {
$rows++;
示例11: foreach
echo $dstfrm;
?>
'];
<!--
<?php
foreach ($new_group as $id => $name) {
echo 'add_var_to_opener_obj(form,"new_group[' . $id . ']","' . $name . '")' . "\r";
}
?>
if(form)
{
form.submit();
close_window();
}
-->
</script>
<?php
}
$form = new CForm();
$form->AddVar('dstfrm', $dstfrm);
$form->SetName('groups');
$table = new CTableInfo(S_NO_GROUPS_DEFINED);
$table->SetHeader(array(array(new CCheckBox("all_groups", NULL, "CheckAll('" . $form->GetName() . "','all_groups');"), S_NAME)));
$result = DBselect('select * from usrgrp where ' . DBin_node('usrgrpid') . ' order by name');
while ($row = DBfetch($result)) {
$table->AddRow(array(array(new CCheckBox('new_group[' . $row['usrgrpid'] . ']', isset($new_group[$row['usrgrpid']]), NULL, $row['name']), $row['name'])));
}
$table->SetFooter(new CButton('select', S_SELECT));
$form->AddItem($table);
$form->Show();
include_once "include/page_footer.php";
示例12: get_items_data_overview
function get_items_data_overview($hostids, $view_style = null)
{
if (is_null($view_style)) {
$view_style = get_profile('web.overview.view.style', STYLE_TOP);
}
$table = new CTableInfo(S_NO_ITEMS_DEFINED);
COpt::profiling_start('prepare data');
$result = DBselect('SELECT DISTINCT h.hostid, h.host,i.itemid, i.key_, i.value_type, i.lastvalue, i.units, ' . ' i.description, t.priority, i.valuemapid, t.value as tr_value, t.triggerid ' . ' FROM hosts h, items i ' . ' LEFT JOIN functions f on f.itemid=i.itemid ' . ' LEFT JOIN triggers t on t.triggerid=f.triggerid ' . ' WHERE ' . DBcondition('h.hostid', $hostids) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' ORDER BY i.description,i.itemid');
unset($items);
unset($hosts);
// get rid of warnings about $triggers undefined
$items = array();
while ($row = DBfetch($result)) {
$descr = item_description($row);
$row['host'] = get_node_name_by_elid($row['hostid']) . $row['host'];
$hosts[strtolower($row['host'])] = $row['host'];
// A little tricky check for attempt to overwrite active trigger (value=1) with
// inactive or active trigger with lower priority.
if (!isset($items[$descr][$row['host']]) || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE && $row['tr_value'] == TRIGGER_VALUE_TRUE || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE || $row['tr_value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $items[$descr][$row['host']]['severity'])) {
$items[$descr][$row['host']] = array('itemid' => $row['itemid'], 'value_type' => $row['value_type'], 'lastvalue' => $row['lastvalue'], 'units' => $row['units'], 'description' => $row['description'], 'valuemapid' => $row['valuemapid'], 'severity' => $row['priority'], 'tr_value' => $row['tr_value'], 'triggerid' => $row['triggerid']);
}
}
if (!isset($hosts)) {
return $table;
}
ksort($hosts);
COpt::profiling_stop('prepare data');
COpt::profiling_start('prepare table');
if ($view_style == STYLE_TOP) {
$header = array(new CCol(S_ITEMS, 'center'));
foreach ($hosts as $hostname) {
$header = array_merge($header, array(new CImg('vtext.php?text=' . $hostname)));
}
$table->SetHeader($header, 'vertical_header');
$curr_rime = time();
foreach ($items as $descr => $ithosts) {
$table_row = array(nbsp($descr));
foreach ($hosts as $hostname) {
$table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
}
$table->AddRow($table_row);
}
} else {
$header = array(new CCol(S_HOSTS, 'center'));
foreach ($items as $descr => $ithosts) {
$header = array_merge($header, array(new CImg('vtext.php?text=' . $descr)));
}
$table->SetHeader($header, 'vertical_header');
$curr_rime = time();
foreach ($hosts as $hostname) {
$table_row = array(nbsp($hostname));
foreach ($items as $descr => $ithosts) {
$table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
}
$table->AddRow($table_row);
}
}
COpt::profiling_stop('prepare table');
return $table;
}
示例13: CForm
}
//-------------------------------------------- </PARENT SERVICES LIST> --------------------------------------------
//---------------------------------------------- <CHILD SERVICES LIST> --------------------------------------------
if (isset($_REQUEST['cservices'])) {
if (isset($service)) {
$service = get_service_by_serviceid($service['serviceid']);
}
// update date after ACTIONS
show_table_header(S_IT_SERVICES_BIG);
$form = new CForm();
$form->SetName("services");
if (isset($service)) {
$form->AddVar("serviceid", $service['serviceid']);
}
$table = new CTableInfo();
$table->SetHeader(array(S_SERVICE, S_STATUS_CALCULATION, S_TRIGGER));
if (isset($service)) {
$childs = get_service_childs($service['serviceid'], 1);
$childs_str = implode(',', $childs);
!empty($childs_str) ? $childs_str .= ',' : '';
$query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' AND s.serviceid NOT IN (' . $childs_str . $service['serviceid'] . ') ' . ' ORDER BY s.sortorder,s.name';
} else {
$query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder,s.name';
}
$db_services = DBselect($query);
while ($db_service_data = DBfetch($db_services)) {
$prefix = null;
$trigger = "-";
$description = $db_service_data["name"];
if (isset($db_service_data["triggerid"])) {
$trigger = expand_trigger_description($db_service_data["triggerid"]);
示例14: CComboBox
if (ZBX_DISTRIBUTED) {
$available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY);
$cmbResourceNode = new CComboBox('nodeid', $nodeid, 'submit();');
$cmbResourceNode->AddItem(0, S_ALL_S);
$sql = 'SELECT name,nodeid FROM nodes WHERE ' . DBcondition('nodeid', $available_nodes);
$db_nodes = DBselect($sql);
while ($node = DBfetch($db_nodes)) {
$cmbResourceNode->AddItem($node['nodeid'], $node['name']);
}
$frmTitle->AddItem(array(S_NODE, SPACE, $cmbResourceNode));
}
show_table_header(permission2str($permission), $frmTitle);
$form = new CForm();
$form->addOption('id', 'groups');
$table = new CTableInfo(S_NO_RESOURCES_DEFINED);
$table->SetHeader(new CCol(array(new CCheckBox("all_groups", NULL, 'check_all(this.checked)'), S_NAME)));
$result = DBselect('SELECT n.name as node_name, g.name as name, g.groupid as id' . ' FROM groups g ' . ' LEFT JOIN nodes n on ' . DBid2nodeid('g.groupid') . '=n.nodeid ' . ($nodeid ? ' WHERE nodeid=' . $nodeid : '') . ' ORDER BY n.name, g.name');
$grouplist = array();
while ($row = DBfetch($result)) {
if (isset($row['node_name'])) {
$row['name'] = $row['node_name'] . ':' . $row['name'];
}
$grouplist[$row['id']] = array('name' => $row['name'], 'permission' => $permission);
$table->addRow(new CCol(array(new CCheckBox('groups[' . $row['id'] . ']', NULL, NULL, $row['id']), $row['name'])));
}
insert_js('var grouplist = ' . zbx_jsvalue($grouplist) . ';');
$button = new CButton('select', S_SELECT, 'add_groups("' . $dstfrm . '")');
$button->setType('button');
$table->setFooter(new CCol($button, 'right'));
$form->addItem($table);
$form->show();
示例15: array
CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
$options = array('groups' => array('real_hosts' => true, 'with_httptests' => true), 'hosts' => array('with_monitored_items' => true, 'with_httptests' => true), 'hostid' => getRequest('hostid'), 'groupid' => getRequest('groupid'));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$r_form = new CForm('get');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB()));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB()));
$httpmon_wdgt = new CWidget();
$httpmon_wdgt->addPageHeader(_('STATUS OF WEB MONITORING'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$httpmon_wdgt->addHeader(_('Web scenarios'), $r_form);
$httpmon_wdgt->addHeaderRowNumber();
// TABLE
$table = new CTableInfo(_('No web scenarios found.'));
$table->SetHeader(array($_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname', $sortField, $sortOrder) : null, make_sorting_header(_('Name'), 'name', $sortField, $sortOrder), _('Number of steps'), _('Last check'), _('Status')));
$paging = null;
if ($pageFilter->hostsSelected) {
$options = array('output' => array('httptestid', 'name', 'hostid'), 'selectHosts' => array('name', 'status'), 'selectSteps' => API_OUTPUT_COUNT, 'templated' => false, 'preservekeys' => true, 'filter' => array('status' => HTTPTEST_STATUS_ACTIVE), 'limit' => $config['search_limit'] + 1);
if ($pageFilter->hostid > 0) {
$options['hostids'] = $pageFilter->hostid;
} elseif ($pageFilter->groupid > 0) {
$options['groupids'] = $pageFilter->groupid;
}
$httpTests = API::HttpTest()->get($options);
foreach ($httpTests as &$httpTest) {
$httpTest['host'] = reset($httpTest['hosts']);
$httpTest['hostname'] = $httpTest['host']['name'];
unset($httpTest['hosts']);
}
unset($httpTest);