本文整理汇总了PHP中item_description函数的典型用法代码示例。如果您正苦于以下问题:PHP item_description函数的具体用法?PHP item_description怎么用?PHP item_description使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了item_description函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addItem
public function addItem($itemid, $calc_fnc = CALC_FNC_AVG, $color = null, $type = null, $periods_cnt = null)
{
$this->items[$this->num] = get_item_by_itemid($itemid);
$this->items[$this->num]['description'] = item_description($this->items[$this->num]);
$host = get_host_by_hostid($this->items[$this->num]['hostid']);
$this->items[$this->num]['host'] = $host['host'];
$this->items[$this->num]['color'] = is_null($color) ? 'Dark Green' : $color;
$this->items[$this->num]['calc_fnc'] = is_null($calc_fnc) ? CALC_FNC_AVG : $calc_fnc;
$this->items[$this->num]['calc_type'] = is_null($type) ? GRAPH_ITEM_SIMPLE : $type;
$this->items[$this->num]['periods_cnt'] = is_null($periods_cnt) ? 0 : $periods_cnt;
$this->num++;
}
示例2: addItem
public function addItem($itemid, $axis = GRAPH_YAXIS_SIDE_RIGHT, $calc_fnc = CALC_FNC_AVG, $color = null, $drawtype = null, $type = null, $periods_cnt = null)
{
if ($this->type == GRAPH_TYPE_STACKED) {
$drawtype = GRAPH_ITEM_DRAWTYPE_FILLED_REGION;
}
$this->items[$this->num] = get_item_by_itemid($itemid);
$this->items[$this->num]['description'] = item_description($this->items[$this->num]);
$host = get_host_by_hostid($this->items[$this->num]['hostid']);
$this->items[$this->num]['host'] = $host['host'];
$this->items[$this->num]['color'] = is_null($color) ? 'Dark Green' : $color;
$this->items[$this->num]['drawtype'] = is_null($drawtype) ? GRAPH_ITEM_DRAWTYPE_LINE : $drawtype;
$this->items[$this->num]['axisside'] = is_null($axis) ? GRAPH_YAXIS_SIDE_RIGHT : $axis;
$this->items[$this->num]['calc_fnc'] = is_null($calc_fnc) ? CALC_FNC_AVG : $calc_fnc;
$this->items[$this->num]['calc_type'] = is_null($type) ? GRAPH_ITEM_SIMPLE : $type;
$this->items[$this->num]['periods_cnt'] = is_null($periods_cnt) ? 0 : $periods_cnt;
if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
$this->yaxisleft = 1;
}
if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_RIGHT) {
$this->yaxisright = 1;
}
// SDI($this->items);
$this->num++;
}
示例3: get_request
$priority = get_request('priority', 0);
$comments = get_request('comments', '');
$url = get_request('url', '');
$status = get_request('status', 0);
}
$keys = get_request('keys', array());
//sdi('<pre>'.print_r($expressions, true).'</pre>');
$frmTRLog->addRow(S_DESCRIPTION, new CTextBox('description', $description, 80));
$item = '';
$db_items = DBselect('SELECT DISTINCT * FROM items WHERE itemid=' . $itemid);
while ($db_item = DBfetch($db_items)) {
if ($db_item['templateid']) {
$template_host = get_realhost_by_itemid($db_item['templateid']);
$item = $template_host['host'] . ':';
}
$item .= item_description($db_item, $db_item['key_']);
}
$ctb = new CTextBox('item', $item, 80);
$ctb->setAttribute('id', 'item');
$ctb->setAttribute('disabled', 'disabled');
$script = "javascript: return PopUp('popup.php?dstfrm=" . $frmTRLog->getName() . "&dstfld1=itemid&dstfld2=item&srctbl=items&srcfld1=itemid&srcfld2=description',800,450);";
$cbtn = new CButton('select_item', S_SELECT, $script);
$frmTRLog->addRow(S_ITEM, array($ctb, $cbtn));
$frmTRLog->addVar('itemid', $itemid);
$exp_select = new CComboBox('expr_type');
$exp_select->setAttribute('id', 'expr_type');
$exp_select->addItem(REGEXP_INCLUDE, S_INCLUDE_S);
$exp_select->addItem(REGEXP_EXCLUDE, S_EXCLUDE);
$ctb = new CTextBox('expression', '', 80);
$ctb->setAttribute('id', 'logexpr');
$cb = new CButton('add_exp', S_ADD, 'javascript: add_logexpr();');
示例4: addItem
public function addItem($itemid, $axis = GRAPH_YAXIS_SIDE_DEFAULT, $calc_fnc = CALC_FNC_AVG, $color = null, $drawtype = null, $type = null, $periods_cnt = null)
{
if ($this->type == GRAPH_TYPE_STACKED) {
$drawtype = GRAPH_ITEM_DRAWTYPE_FILLED_REGION;
}
$item = get_item_by_itemid($itemid);
$this->items[$this->num] = $item;
$this->items[$this->num]['description'] = item_description($item);
$this->items[$this->num]['delay'] = getItemDelay($item['delay'], $item['delay_flex']);
if (strpos($item['units'], ',') !== false) {
list($this->items[$this->num]['units'], $this->items[$this->num]['unitsLong']) = explode(',', $item['units']);
} else {
$this->items[$this->num]['unitsLong'] = '';
}
$host = get_host_by_hostid($item['hostid']);
$this->items[$this->num]['host'] = $host['host'];
$this->items[$this->num]['color'] = is_null($color) ? 'Dark Green' : $color;
$this->items[$this->num]['drawtype'] = is_null($drawtype) ? GRAPH_ITEM_DRAWTYPE_LINE : $drawtype;
$this->items[$this->num]['axisside'] = is_null($axis) ? GRAPH_YAXIS_SIDE_DEFAULT : $axis;
$this->items[$this->num]['calc_fnc'] = is_null($calc_fnc) ? CALC_FNC_AVG : $calc_fnc;
$this->items[$this->num]['calc_type'] = is_null($type) ? GRAPH_ITEM_SIMPLE : $type;
$this->items[$this->num]['periods_cnt'] = is_null($periods_cnt) ? 0 : $periods_cnt;
if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
$this->yaxisleft = 1;
}
if ($this->items[$this->num]['axisside'] == GRAPH_YAXIS_SIDE_RIGHT) {
$this->yaxisright = 1;
}
$this->num++;
}
示例5: make_graph_submenu
function make_graph_submenu()
{
$graphids = array();
$fav_graphs = get_favorites('web.favorite.graphids');
foreach ($fav_graphs as $key => $favorite) {
$source = $favorite['source'];
$sourceid = $favorite['value'];
if ('itemid' == $source) {
if (!($item = get_item_by_itemid($sourceid))) {
continue;
}
$item_added = true;
$host = get_host_by_itemid($sourceid);
$item["description"] = item_description($item);
$graphids[] = array('name' => $host['host'] . ':' . $item['description'], 'favobj' => 'itemid', 'favid' => $sourceid, 'action' => 'remove');
} else {
if (!($graph = get_graph_by_graphid($sourceid))) {
continue;
}
$graph_added = true;
$result = get_hosts_by_graphid($sourceid);
$ghost = DBFetch($result);
$graphids[] = array('name' => $ghost['host'] . ':' . $graph['name'], 'favobj' => 'graphid', 'favid' => $sourceid, 'action' => 'remove');
}
}
if (isset($graph_added)) {
$graphids[] = array('name' => S_REMOVE . SPACE . S_ALL_S . SPACE . S_GRAPHS, 'favobj' => 'graphid', 'favid' => 0, 'action' => 'remove');
}
if (isset($item_added)) {
$graphids[] = array('name' => S_REMOVE . SPACE . S_ALL_S . SPACE . S_SIMPLE_GRAPHS, 'favobj' => 'itemid', 'favid' => 0, 'action' => 'remove');
}
return $graphids;
}
示例6: delete_application
function delete_application($applicationids)
{
$applicationids = zbx_toHash($applicationids);
$apps = array();
$sql = 'SELECT a.applicationid, h.host, a.name, a.templateid ' . ' FROM applications a, hosts h ' . ' WHERE ' . DBcondition('a.applicationid', $applicationids) . ' AND h.hostid=a.hostid';
$res = DBselect($sql);
while ($db_app = DBfetch($res)) {
$apps[$db_app['applicationid']] = $db_app;
}
// first delete child applications
$tmp_appids = array();
$sql = 'SELECT a.applicationid ' . ' FROM applications a ' . ' WHERE ' . DBcondition('a.templateid', $applicationids);
$db_applications = DBselect($sql);
while ($db_app = DBfetch($db_applications)) {
$tmp_appids[$db_app['applicationid']] = $db_app['applicationid'];
}
if (!empty($tmp_appids)) {
// recursion!!!
if (!delete_application($tmp_appids)) {
return false;
}
}
$unlink_apps = array();
//check if app is used by web scenario
$sql = 'SELECT ht.name, ht.applicationid ' . ' FROM httptest ht ' . ' WHERE ' . DBcondition('ht.applicationid', $applicationids);
$res = DBselect($sql);
while ($info = DBfetch($res)) {
if ($apps[$info['applicationid']]['templateid'] > 0) {
$unlink_apps[$info['applicationid']] = $info['applicationid'];
unset($applicationids[$info['applicationid']]);
} else {
error(S_APPLICATION . ' [' . $apps[$info['applicationid']]['host'] . ':' . $apps[$info['applicationid']]['name'] . '] ' . S_USED_IN_WEB_SCENARIO);
return false;
}
}
$sql = 'SELECT i.itemid, i.key_, i.description, ia.applicationid ' . ' FROM items_applications ia, items i ' . ' WHERE i.type=' . ITEM_TYPE_HTTPTEST . ' AND i.itemid=ia.itemid ' . ' AND ' . DBcondition('ia.applicationid', $applicationids);
$res = DBselect($sql);
if ($info = DBfetch($res)) {
error(S_APPLICATION . ' [' . $apps[$info['applicationid']]['host'] . ':' . $apps[$info['applicationid']]['name'] . '] ' . S_USED_BY_ITEM_SMALL . ' [' . item_description($info) . ']');
return false;
}
$result = DBexecute('UPDATE applications SET templateid=0 WHERE ' . DBcondition('applicationid', $unlink_apps));
$result &= DBexecute('DELETE FROM items_applications WHERE ' . DBcondition('applicationid', $applicationids));
$result &= DBexecute('DELETE FROM applications WHERE ' . DBcondition('applicationid', $applicationids));
if ($result) {
foreach ($apps as $appid => $app) {
if (isset($unlink_apps[$appid])) {
info(S_APPLICATION . ' [' . $app['host'] . ':' . $app['name'] . '] ' . S_USED_IN_WEB_SCENARIO . ' (' . S_UNLINKED_SMALL . ')');
} else {
info(S_APPLICATION . ' [' . $app['host'] . ':' . $app['name'] . '] ' . S_DELETED_SMALL);
}
}
}
return $result;
}
示例7: array
}
// OTHER ITEMS (which doesn't linked to application)
$db_hosts = array();
$db_hostids = array();
$sql = 'SELECT DISTINCT h.host,h.hostid ' . ' FROM hosts h' . $sql_from . ', items i ' . ' LEFT JOIN items_applications ia ON ia.itemid=i.itemid' . ' WHERE ia.itemid is NULL ' . $sql_where . ' AND h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host';
$db_host_res = DBselect($sql);
while ($db_host = DBfetch($db_host_res)) {
$db_host['item_cnt'] = 0;
$db_hosts[$db_host['hostid']] = $db_host;
$db_hostids[$db_host['hostid']] = $db_host['hostid'];
}
$tab_rows = array();
$sql = 'SELECT DISTINCT h.host,h.hostid,i.* ' . ' FROM hosts h' . $sql_from . ', items i ' . ' LEFT JOIN items_applications ia ON ia.itemid=i.itemid' . ' WHERE ia.itemid is NULL ' . $sql_where . ' AND h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('h.hostid', $db_hostids) . ' ORDER BY i.description,i.itemid';
$db_items = DBselect($sql);
while ($db_item = DBfetch($db_items)) {
$description = item_description($db_item);
if (!empty($_REQUEST['select']) && !zbx_stristr($description, $_REQUEST['select'])) {
continue;
}
$db_host =& $db_hosts[$db_item['hostid']];
if (!isset($tab_rows[$db_host['hostid']])) {
$tab_rows[$db_host['hostid']] = array();
}
$app_rows =& $tab_rows[$db_host['hostid']];
$db_host['item_cnt']++;
if (!uint_in_array(0, $_REQUEST['applications']) && !isset($show_all_apps)) {
continue;
}
if (isset($db_item['lastclock'])) {
$lastclock = zbx_date2str(S_DATE_FORMAT_YMDHMS, $db_item['lastclock']);
} else {
示例8: ltrim
$_REQUEST['param'] = ltrim($_REQUEST['param'], '#');
}
$operator = $expr_res[count($expr_res) - 2];
$_REQUEST['expr_type'] = $expr_res[ZBX_SIMPLE_EXPRESSION_FUNCTION_NAME_ID] . '[' . $operator . ']';
$_REQUEST['value'] = $expr_res[count($expr_res) - 1];
}
}
unset($expr_res);
$dstfrm = get_request("dstfrm", 0);
// destination form
$dstfld1 = get_request("dstfld1", '');
// destination field
$itemid = get_request("itemid", 0);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
if ($item_data = DBfetch(DBselect('SELECT DISTINCT h.host,i.* ' . ' FROM hosts h,items i ' . ' WHERE h.hostid=i.hostid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND i.itemid=' . $itemid))) {
$description = $item_data['host'] . ':' . item_description($item_data);
} else {
$itemid = 0;
$description = '';
}
$expr_type = get_request("expr_type", 'last[=]');
if (eregi('^([a-z]{1,})\\[([' . implode('', array_keys($operators)) . '])\\]$', $expr_type, $expr_res)) {
$function = $expr_res[1];
$operator = $expr_res[2];
if (!str_in_array($function, array_keys($functions))) {
unset($function);
}
}
unset($expr_res);
if (!isset($function)) {
$function = 'last';
示例9: array
if (!($row = get_row_for_nofalseforb($row, $event_sql))) {
continue;
}
}
$triggers_num++;
$row['events'] = array();
$row['items'] = array();
$triggers[$row['triggerid']] = $row;
$triggerids[$row['triggerid']] = $row['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;
}
$event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type ' . ' FROM events e, triggers t ' . ' WHERE e.object=0 ' . ' AND ' . DBcondition('e.objectid', $triggerids) . ' AND t.triggerid=e.objectid ' . $event_cond . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
$res_events = DBSelect($event_sql, $config['event_show_max'] * 100);
while ($row_event = DBfetch($res_events)) {
if ($show_events == EVENTS_OPTION_NOFALSEFORB) {
if (EVENTS_NOFALSEFORB_STATUS_FALSE == $show_events_status && $row_event['value'] != TRIGGER_VALUE_FALSE) {
continue;
}
if (EVENTS_NOFALSEFORB_STATUS_TRUE == $show_events_status && $row_event['value'] != TRIGGER_VALUE_TRUE) {
continue;
}
if ($row_event['value'] == TRIGGER_VALUE_FALSE && !event_initial_time($row_event)) {
continue;
}
示例10: 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;
}
示例11: insert_template_form
//.........这里部分代码省略.........
$frmHost->addVar('clear_templates', $clear_templates);
if ($_REQUEST['hostid'] > 0) {
$frmHost->addVar('hostid', $_REQUEST['hostid']);
}
if ($_REQUEST['groupid'] > 0) {
$frmHost->addVar('groupid', $_REQUEST['groupid']);
}
$frmHost->addRow(S_NAME, new CTextBox('host', $host, 54));
$grp_tb = new CTweenBox($frmHost, 'groups', $groups, 10);
$db_groups = DBselect('SELECT DISTINCT groupid,name ' . ' FROM groups ' . ' WHERE ' . DBcondition('groupid', $available_groups) . ' ORDER BY name');
while ($db_group = DBfetch($db_groups)) {
$grp_tb->addItem($db_group['groupid'], $db_group['name']);
}
$frmHost->addRow(S_GROUPS, $grp_tb->get(S_IN . SPACE . S_GROUPS, S_OTHER . SPACE . S_GROUPS));
$frmHost->addRow(S_NEW_GROUP, new CTextBox('newgroup', $newgroup), 'new');
// onchange does not work on some browsers: MacOS, KDE browser
$frmHost->addVar('useip', 0);
$frmHost->addVar('ip', '0.0.0.0');
$frmHost->addVar('dns', '');
$port = '10050';
$status = HOST_STATUS_TEMPLATE;
$frmHost->addVar('port', $port);
$frmHost->addVar('status', $status);
$template_table = new CTable();
$template_table->SetCellPadding(0);
$template_table->SetCellSpacing(0);
foreach ($templates as $id => $temp_name) {
$frmHost->addVar('templates[' . $id . ']', $temp_name);
$template_table->addRow(array($temp_name, new CButton('unlink[' . $id . ']', S_UNLINK), isset($original_templates[$id]) ? new CButton('unlink_and_clear[' . $id . ']', S_UNLINK_AND_CLEAR) : SPACE));
}
$frmHost->addRow(S_LINK_WITH_TEMPLATE, array($template_table, new CButton('add_template', S_ADD, "return PopUp('popup.php?dstfrm=" . $frmHost->GetName() . "&dstfld1=new_template&srctbl=templates&srcfld1=hostid&srcfld2=host" . url_param($templates, false, 'existed_templates') . "',450,450)", 'T')));
$frmHost->addVar('useipmi', $useipmi);
$frmHost->addVar('ipmi_ip', $ipmi_ip);
$frmHost->addVar('ipmi_port', $ipmi_port);
$frmHost->addVar('ipmi_authtype', $ipmi_authtype);
$frmHost->addVar('ipmi_privilege', $ipmi_privilege);
$frmHost->addVar('ipmi_username', $ipmi_username);
$frmHost->addVar('ipmi_password', $ipmi_password);
$useprofile = 'no';
$frmHost->addVar('useprofile', $useprofile);
$useprofile_ext = 'no';
$frmHost->addVar('useprofile_ext', $useprofile_ext);
if ($_REQUEST['form'] == 'full_clone') {
// Host items
$items_lbx = new CListBox('items', null, 8);
$items_lbx->setAttribute('disabled', 'disabled');
$sql = 'SELECT * ' . ' FROM items ' . ' WHERE hostid=' . $_REQUEST['hostid'] . ' AND templateid=0 ' . ' ORDER BY description';
$host_items_res = DBselect($sql);
while ($host_item = DBfetch($host_items_res)) {
$item_description = item_description($host_item);
$items_lbx->addItem($host_item['itemid'], $item_description);
}
if ($items_lbx->ItemsCount() < 1) {
$items_lbx->setAttribute('style', 'width: 200px;');
}
$frmHost->addRow(S_ITEMS, $items_lbx);
// Host triggers
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array($_REQUEST['hostid']), PERM_RES_IDS_ARRAY);
$trig_lbx = new CListBox('triggers', null, 8);
$trig_lbx->setAttribute('disabled', 'disabled');
$sql = 'SELECT DISTINCT t.* ' . ' FROM triggers t, items i, functions f' . ' WHERE i.hostid=' . $_REQUEST['hostid'] . ' AND f.itemid=i.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.templateid=0 ' . ' ORDER BY t.description';
$host_trig_res = DBselect($sql);
while ($host_trig = DBfetch($host_trig_res)) {
$trig_description = expand_trigger_description($host_trig["triggerid"]);
$trig_lbx->addItem($host_trig['triggerid'], $trig_description);
}
if ($trig_lbx->ItemsCount() < 1) {
$trig_lbx->setAttribute('style', 'width: 200px;');
}
$frmHost->addRow(S_TRIGGERS, $trig_lbx);
// Host graphs
$available_graphs = get_accessible_graphs(PERM_READ_ONLY, array($_REQUEST['hostid']), PERM_RES_IDS_ARRAY);
$graphs_lbx = new CListBox('graphs', null, 8);
$graphs_lbx->setAttribute('disabled', 'disabled');
$def_items = array();
$sql = 'SELECT DISTINCT g.* ' . ' FROM graphs g, graphs_items gi,items i ' . ' WHERE ' . DBcondition('g.graphid', $available_graphs) . ' AND gi.graphid=g.graphid ' . ' AND g.templateid=0 ' . ' AND i.itemid=gi.itemid ' . ' AND i.hostid=' . $_REQUEST['hostid'] . ' ORDER BY g.name';
$host_graph_res = DBselect($sql);
while ($host_graph = DBfetch($host_graph_res)) {
$graphs_lbx->addItem($host_graph['graphid'], $host_graph['name']);
}
if ($graphs_lbx->ItemsCount() < 1) {
$graphs_lbx->setAttribute('style', 'width: 200px;');
}
$frmHost->addRow(S_GRAPHS, $graphs_lbx);
}
$frmHost->addItemToBottomRow(new CButton("save", S_SAVE));
if ($_REQUEST['hostid'] > 0 && $_REQUEST['form'] != 'full_clone') {
$frmHost->addItemToBottomRow(SPACE);
$frmHost->addItemToBottomRow(new CButton("clone", S_CLONE));
$frmHost->addItemToBottomRow(SPACE);
$frmHost->addItemToBottomRow(new CButton("full_clone", S_FULL_CLONE));
$frmHost->addItemToBottomRow(SPACE);
$frmHost->addItemToBottomRow(new CButtonDelete(S_DELETE_SELECTED_HOST_Q, url_param("form") . url_param("config") . url_param("hostid") . url_param('groupid')));
$frmHost->addItemToBottomRow(SPACE);
$frmHost->addItemToBottomRow(new CButtonQMessage('delete_and_clear', 'Delete AND clear', S_DELETE_SELECTED_HOSTS_Q, url_param("form") . url_param("config") . url_param("hostid") . url_param('groupid')));
}
$frmHost->addItemToBottomRow(SPACE);
$frmHost->addItemToBottomRow(new CButtonCancel(url_param("config") . url_param('groupid')));
$frmHost->show();
}
示例12: get_request
$paramtype = get_request('paramtype');
if (!isset($function)) {
$function = 'last';
}
if (!isset($functions[$function]['operators'][$operator])) {
$operator = '=';
}
$expr_type = $function . '[' . $operator . ']';
if ($itemid) {
$options = array('output' => API_OUTPUT_EXTEND, 'itemids' => $itemid, 'webitems' => 1, 'select_hosts' => API_OUTPUT_EXTEND);
$item_data = CItem::get($options);
$item_data = reset($item_data);
$item_key = $item_data['key_'];
$item_host = reset($item_data['hosts']);
$item_host = $item_host['host'];
$description = $item_host . ':' . item_description($item_data);
} else {
$item_key = $item_host = $description = '';
}
if (is_null($paramtype) && isset($functions[$function]['params']['M'])) {
$paramtype = is_array($functions[$function]['params']['M']) ? reset($functions[$function]['params']['M']) : $functions[$function]['params']['M'];
} else {
if (is_null($paramtype)) {
$paramtype = PARAM_TYPE_SECONDS;
}
}
if (!is_array($param)) {
if (isset($functions[$function]['params'])) {
$param = explode(',', $param, count($functions[$function]['params']));
} else {
$param = array($param);
示例13: insert_host_form
//.........这里部分代码省略.........
$cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_NONE, S_AUTHTYPE_NONE);
$cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_MD2, S_AUTHTYPE_MD2);
$cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_MD5, S_AUTHTYPE_MD5);
$cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_STRAIGHT, S_AUTHTYPE_STRAIGHT);
$cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_OEM, S_AUTHTYPE_OEM);
$cmbIPMIAuthtype->addItem(IPMI_AUTHTYPE_RMCP_PLUS, S_AUTHTYPE_RMCP_PLUS);
$host_tbl->addRow(array(S_IPMI_AUTHTYPE, $cmbIPMIAuthtype));
$cmbIPMIPrivilege = new CComboBox('ipmi_privilege', $ipmi_privilege);
$cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_CALLBACK, S_PRIVILEGE_CALLBACK);
$cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_USER, S_PRIVILEGE_USER);
$cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_OPERATOR, S_PRIVILEGE_OPERATOR);
$cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_ADMIN, S_PRIVILEGE_ADMIN);
$cmbIPMIPrivilege->addItem(IPMI_PRIVILEGE_OEM, S_PRIVILEGE_OEM);
$host_tbl->addRow(array(S_IPMI_PRIVILEGE, $cmbIPMIPrivilege));
$host_tbl->addRow(array(S_IPMI_USERNAME, new CTextBox('ipmi_username', $ipmi_username, 16)));
$host_tbl->addRow(array(S_IPMI_PASSWORD, new CTextBox('ipmi_password', $ipmi_password, 20)));
} else {
$frmHost->addVar('ipmi_ip', $ipmi_ip);
$frmHost->addVar('ipmi_port', $ipmi_port);
$frmHost->addVar('ipmi_authtype', $ipmi_authtype);
$frmHost->addVar('ipmi_privilege', $ipmi_privilege);
$frmHost->addVar('ipmi_username', $ipmi_username);
$frmHost->addVar('ipmi_password', $ipmi_password);
}
if ($_REQUEST['form'] == 'full_clone') {
// Host items
$options = array('inherited' => 0, 'hostids' => $_REQUEST['hostid'], 'output' => API_OUTPUT_EXTEND, 'webitems' => 1);
$host_items = CItem::get($options);
if (!empty($host_items)) {
$items_lbx = new CListBox('items', null, 8);
$items_lbx->setAttribute('disabled', 'disabled');
order_result($host_items, 'description');
foreach ($host_items as $hitem) {
$items_lbx->addItem($hitem['itemid'], item_description($hitem));
}
$host_tbl->addRow(array(S_ITEMS, $items_lbx));
}
// Host triggers
$options = array('inherited' => 0, 'hostids' => $_REQUEST['hostid'], 'output' => API_OUTPUT_EXTEND, 'expandDescription' => true);
$host_triggers = CTrigger::get($options);
if (!empty($host_triggers)) {
$trig_lbx = new CListBox('triggers', null, 8);
$trig_lbx->setAttribute('disabled', 'disabled');
order_result($host_triggers, 'description');
foreach ($host_triggers as $htrigger) {
$trig_lbx->addItem($htrigger['triggerid'], $htrigger['description']);
}
$host_tbl->addRow(array(S_TRIGGERS, $trig_lbx));
}
// Host graphs
$options = array('inherited' => 0, 'hostids' => $_REQUEST['hostid'], 'select_hosts' => API_OUTPUT_REFER, 'output' => API_OUTPUT_EXTEND);
$host_graphs = CGraph::get($options);
if (!empty($host_graphs)) {
$graphs_lbx = new CListBox('graphs', null, 8);
$graphs_lbx->setAttribute('disabled', 'disabled');
order_result($host_graphs, 'name');
foreach ($host_graphs as $hgraph) {
if (count($hgraph['hosts']) > 1) {
continue;
}
$graphs_lbx->addItem($hgraph['graphid'], $hgraph['name']);
}
if ($graphs_lbx->ItemsCount() > 1) {
$host_tbl->addRow(array(S_GRAPHS, $graphs_lbx));
}
}
示例14: implode
//*/
//*
$sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, i.* ' . ' FROM ' . implode(',', $from_tables) . ' LEFT JOIN items ti ON i.templateid=ti.itemid ' . ' LEFT JOIN hosts th ON ti.hostid=th.hostid ' . ' WHERE ' . implode(' and ', $where_case) . order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status', 'i.itemid');
//*/
$db_items = DBselect($sql);
while ($db_item = DBfetch($db_items)) {
$description = array();
$item_description = item_description($db_item);
if (isset($_REQUEST['filter_description']) && !zbx_stristr($item_description, $_REQUEST['filter_description'])) {
continue;
}
if ($db_item['templateid']) {
$template_host = get_realhost_by_itemid($db_item['templateid']);
array_push($description, new CLink($template_host['host'], '?' . 'hostid=' . $template_host['hostid'], 'unknown'), ':');
}
array_push($description, new CLink(item_description($db_item), '?form=update&itemid=' . $db_item['itemid'] . '&hostid=' . $db_item['hostid']));
$status = new CCol(new CLink(item_status2str($db_item['status']), '?group_itemid%5B%5D=' . $db_item['itemid'] . '&go=' . ($db_item['status'] ? 'activate' : 'disable'), item_status2style($db_item['status'])));
if (!zbx_empty($db_item['error'])) {
$error = new CDiv(SPACE, 'error_icon');
$error->setHint($db_item['error'], '', 'on');
} else {
$error = new CDiv(SPACE, 'ok_icon');
}
$applications = $show_applications ? implode(', ', get_applications_by_itemid($db_item['itemid'], 'name')) : null;
if (!is_null($applications) && empty($applications)) {
$applications = ' - ';
}
$applications = new CCol($applications, 'wraptext');
$table->addRow(array(new CCheckBox('group_itemid[' . $db_item['itemid'] . ']', null, null, $db_item['itemid']), $show_host ? $db_item['host'] : null, $description, $db_item['key_'], $db_item['delay'], $db_item['history'], $db_item['trends'], item_type2str($db_item['type']), $status, $applications, $error));
$row_count++;
}
示例15: switch
}
switch ($color_style) {
case MARK_COLOR_RED:
$color_style = "mark_as_red";
break;
case MARK_COLOR_GREEN:
$color_style = "mark_as_green";
break;
case MARK_COLOR_BLUE:
$color_style = "mark_as_blue";
break;
}
}
$new_row = array(nbsp(date("[Y.M.d H:i:s]", $row["clock"])));
if ($item_cout > 1) {
array_push($new_row, $row["host"] . ":" . item_description($row));
}
if ($row["timestamp"] == 0) {
array_push($new_row, new CCol("-", "center"));
} else {
array_push($new_row, date("Y.M.d H:i:s", $row["timestamp"]));
}
if ($row["source"] == "") {
array_push($new_row, new CCol("-", "center"));
} else {
array_push($new_row, $row["source"]);
}
array_push($new_row, new CCol(get_severity_description($row["severity"]), get_severity_style($row["severity"])));
$row["value"] = trim($row["value"], "\r\n");
// array_push($new_row,htmlspecialchars($row["value"]));
array_push($new_row, encode_log($row["value"]));