本文整理汇总了PHP中expand_trigger_description函数的典型用法代码示例。如果您正苦于以下问题:PHP expand_trigger_description函数的具体用法?PHP expand_trigger_description怎么用?PHP expand_trigger_description使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expand_trigger_description函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_report2_header
function show_report2_header($config, &$PAGE_GROUPS, &$PAGE_HOSTS)
{
global $USER_DETAILS;
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
// $available_groups = $PAGE_GROUPS['groupids'];
// $available_hosts = $PAGE_HOSTS['hostids'];
$r_form = new CForm();
$r_form->setMethod('get');
$cmbConf = new CComboBox('config', $config, 'submit()');
$cmbConf->addItem(0, S_BY_HOST);
$cmbConf->addItem(1, S_BY_TRIGGER_TEMPLATE);
$r_form->addItem(array(S_MODE . SPACE, $cmbConf, SPACE));
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
$cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
if (1 == $config) {
$cmbTrigs = new CComboBox('tpl_triggerid', get_request('tpl_triggerid', 0), 'submit()');
$cmbHGrps = new CComboBox('hostgroupid', get_request('hostgroupid', 0), 'submit()');
$cmbTrigs->addItem(0, S_ALL_SMALL);
$cmbHGrps->addItem(0, S_ALL_SMALL);
}
if (0 == $config) {
show_table_header(S_AVAILABILITY_REPORT_BIG, $r_form);
} else {
$sql_cond = ' AND h.hostid=ht.hostid ';
if ($_REQUEST['hostid'] > 0) {
$sql_cond .= ' AND ht.templateid=' . $_REQUEST['hostid'];
}
if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) {
$sql_cond .= ' AND t.templateid=' . $_REQUEST['tpl_triggerid'];
}
$result = DBselect('SELECT DISTINCT g.groupid,g.name ' . ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht, groups g, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond . ' ORDER BY g.name');
while ($row = DBfetch($result)) {
$cmbHGrps->addItem($row['groupid'], get_node_name_by_elid($row['groupid']) . $row['name']);
}
$sql_cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : ' AND ' . DBcondition('h.hostid', $available_hosts);
$sql = 'SELECT DISTINCT t.triggerid,t.description ' . ' FROM triggers t,hosts h,items i,functions f ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND h.status=' . HOST_STATUS_TEMPLATE . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . $sql_cond . ' ORDER BY t.description';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$cmbTrigs->addItem($row['triggerid'], get_node_name_by_elid($row['triggerid']) . expand_trigger_description($row['triggerid']));
}
$rr_form = new CForm();
$rr_form->setMethod('get');
$rr_form->addVar('config', $config);
$rr_form->addVar('groupid', $_REQUEST['groupid']);
$rr_form->addVar('hostid', $_REQUEST['hostid']);
$rr_form->addItem(array(S_TRIGGER . SPACE, $cmbTrigs, BR(), S_FILTER, SPACE, S_HOST_GROUP . SPACE, $cmbHGrps));
show_table_header(S_AVAILABILITY_REPORT_BIG, array($r_form, $rr_form));
}
}
示例2: calcTriggers
protected function calcTriggers()
{
$this->triggers = array();
if ($this->m_showTriggers != 1) {
return;
}
if ($this->num != 1) {
return;
}
// skip multiple graphs
$max = 3;
$cnt = 0;
$db_triggers = DBselect('SELECT distinct tr.triggerid,tr.expression,tr.priority ' . ' FROM triggers tr,functions f,items i' . ' WHERE tr.triggerid=f.triggerid ' . " AND f.function IN ('last','min','avg','max') " . ' AND tr.status=' . TRIGGER_STATUS_ENABLED . ' AND i.itemid=f.itemid ' . ' AND f.itemid=' . $this->items[0]['itemid'] . ' ORDER BY tr.priority');
while (($trigger = DBfetch($db_triggers)) && $cnt < $max) {
$db_fnc_cnt = DBselect('SELECT count(*) as cnt FROM functions f WHERE f.triggerid=' . $trigger['triggerid']);
$fnc_cnt = DBfetch($db_fnc_cnt);
if ($fnc_cnt['cnt'] != 1) {
continue;
}
if (!eregi('\\{([0-9]{1,})\\}([\\<\\>\\=]{1})([0-9\\.]{1,})([K|M|G]{0,1})', $trigger['expression'], $arr)) {
continue;
}
$val = $arr[3];
if (strcasecmp($arr[4], 'K') == 0) {
$val *= 1024;
} else {
if (strcasecmp($arr[4], 'M') == 0) {
$val *= 1048576;
} else {
if (strcasecmp($arr[4], 'G') == 0) {
$val *= 1073741824;
}
}
}
//1024*1024*1024;
$minY = $this->m_minY[$this->items[0]['axisside']];
$maxY = $this->m_maxY[$this->items[0]['axisside']];
if ($val <= $minY || $val >= $maxY) {
continue;
}
if ($trigger['priority'] == 5) {
$color = 'Priority Disaster';
} elseif ($trigger['priority'] == 4) {
$color = 'Priority Hight';
} elseif ($trigger['priority'] == 3) {
$color = 'Priority Average';
} else {
$color = 'Priority';
}
array_push($this->triggers, array('y' => $this->sizeY - ($val - $minY) / ($maxY - $minY) * $this->sizeY + $this->shiftY, 'color' => $color, 'description' => 'trigger: ' . expand_trigger_description($trigger['triggerid']) . ' [' . $arr[2] . ' ' . $arr[3] . $arr[4] . ']'));
++$cnt;
}
}
示例3: DBselect
$sql .= ' GROUP BY h.host, t.triggerid, t.description, t.expression, t.priority, t.status' . ' ORDER BY h.host,t.description';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$exp_desc = expand_trigger_description_by_data($row);
$description = new CSpan($exp_desc, 'link');
if ($multiselect) {
$js_action = 'add_selected_values("' . S_TRIGGERS . '", "' . $dstfrm . '", "' . $dstfld1 . '", "' . $dstact . '", "' . $row["triggerid"] . '");';
} else {
$js_action = 'add_value("' . $dstfld1 . '", "' . $dstfld2 . '", "' . $row["triggerid"] . '", "' . $exp_desc . '");';
}
$description->onClick($js_action);
if ($row['dep_count'] > 0) {
$description = array($description, BR(), BR(), bold(S_DEPENDS_ON), BR());
$deps = get_trigger_dependencies_by_triggerid($row["triggerid"]);
foreach ($deps as $val) {
$description[] = array(expand_trigger_description($val), BR());
}
}
switch ($row["status"]) {
case TRIGGER_STATUS_DISABLED:
$status = new CSpan(S_DISABLED, 'disabled');
break;
case TRIGGER_STATUS_UNKNOWN:
$status = new CSpan(S_UNKNOWN, 'unknown');
break;
case TRIGGER_STATUS_ENABLED:
$status = new CSpan(S_ENABLED, 'enabled');
break;
}
//if($row["status"] != TRIGGER_STATUS_UNKNOWN) $row["error"]=SPACE;
//if($row["error"]=="") $row["error"]=SPACE;
示例4: make_event_details
function make_event_details($eventid)
{
$config = select_config();
$event = get_tr_event_by_eventid($eventid);
$table = new CTableInfo();
$table->AddRow(array(S_EVENT, expand_trigger_description($event['triggerid'])));
$table->AddRow(array(S_TIME, zbx_date2str(S_EVENTS_EVENT_DETAILS_DATE_FORMAT, $event['clock'])));
$duration = zbx_date2age($event['clock']);
if ($next_event = get_next_event($event)) {
$duration = zbx_date2age($event['clock'], $next_event['clock']);
}
if ($event['value'] == TRIGGER_VALUE_FALSE) {
$value = new CCol(S_OK_BIG, 'off');
} elseif ($event['value'] == TRIGGER_VALUE_TRUE) {
$value = new CCol(S_PROBLEM_BIG, 'on');
} else {
$value = new CCol(S_UNKNOWN_BIG, 'unknown');
}
$table->addRow(array(S_STATUS, $value));
$table->addRow(array(S_DURATION, $duration));
if ($config['event_ack_enable']) {
global $page;
$backurl = urlencode(urlencode($page['file'] . '?eventid=' . $eventid . '&triggerid=' . $event['triggerid']));
if ($event['acknowledged'] == 1) {
$rows = 0;
$db_acks = get_acknowledges_by_eventid($event["eventid"]);
while ($a = DBfetch($db_acks)) {
$rows++;
}
$ack = array(new CLink(S_YES, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'off'), ' (' . $rows . ')');
} else {
$ack = array(new CLink(S_NO, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'on'));
}
$table->addRow(array(S_ACKNOWLEDGED, $ack));
}
return $table;
}
示例5: foreach
foreach ($trigger['dependencies'] as $dep) {
$dep_table->addRow(' - ' . expand_trigger_description($dep['triggerid']));
}
$img = new Cimg('images/general/down_icon.png', 'DEP_UP');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->setHint($dep_table);
$description = array($img, SPACE, $description);
}
$dependency = false;
$dep_table = new CTableInfo();
$dep_table->setAttribute('style', 'width: 200px;');
$dep_table->addRow(bold(S_DEPENDENT . ':'));
$sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $trigger['triggerid'];
$dep_res = DBselect($sql_dep);
while ($dep_row = DBfetch($dep_res)) {
$dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_down']));
$dependency = true;
}
if ($dependency) {
$img = new Cimg('images/general/up_icon.png', 'DEP_UP');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->setHint($dep_table);
$description = array($img, SPACE, $description);
}
unset($img, $dep_table, $dependency);
// }}} DEPENDENCIES
$tr_desc = new CSpan($description);
// host JS menu {{{
$hosts_list = array();
foreach ($trigger['hosts'] as $num => $trigger_host) {
$menus = '';
示例6: get_trigger_overview_cells
function get_trigger_overview_cells(&$table_row, &$trhosts, &$hostname)
{
$css_class = NULL;
unset($tr_ov_menu);
$ack = null;
if (isset($trhosts[$hostname])) {
unset($ack_menu);
switch ($trhosts[$hostname]['value']) {
case TRIGGER_VALUE_TRUE:
$css_class = get_severity_style($trhosts[$hostname]['priority']);
if ($ack = get_last_event_by_triggerid($trhosts[$hostname]['triggerid'])) {
$ack_menu = array(S_ACKNOWLEDGE, 'acknow.php?eventid=' . $ack['eventid'], array('tw' => '_blank'));
}
if (1 == $ack['acknowledged']) {
$ack = new CImg('images/general/tick.png', 'ack');
} else {
$ack = null;
}
break;
case TRIGGER_VALUE_FALSE:
$css_class = 'normal';
break;
default:
$css_class = 'unknown_trigger';
}
$style = 'cursor: pointer; ';
if (time(NULL) - $trhosts[$hostname]['lastchange'] < 300) {
$style .= 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;';
} else {
if (time(NULL) - $trhosts[$hostname]['lastchange'] < 900) {
$style .= 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;';
}
}
unset($item_menu);
$tr_ov_menu = array(array(S_TRIGGER, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_EVENTS, 'events.php?triggerid=' . $trhosts[$hostname]['triggerid'], array('tw' => '_blank')));
if (isset($ack_menu)) {
$tr_ov_menu[] = $ack_menu;
}
$db_items = DBselect('select distinct i.itemid, i.description, i.key_, i.value_type ' . ' from items i, functions f ' . ' where f.itemid=i.itemid and f.triggerid=' . $trhosts[$hostname]['triggerid']);
while ($item_data = DBfetch($db_items)) {
$description = item_description($item_data);
switch ($item_data['value_type']) {
case ITEM_VALUE_TYPE_UINT64:
case ITEM_VALUE_TYPE_FLOAT:
$action = 'showgraph';
$status_bar = S_SHOW_GRAPH_OF_ITEM . ' \'' . $description . '\'';
break;
case ITEM_VALUE_TYPE_LOG:
case ITEM_VALUE_TYPE_STR:
case ITEM_VALUE_TYPE_TEXT:
default:
$action = 'showlatest';
$status_bar = S_SHOW_VALUES_OF_ITEM . ' \'' . $description . '\'';
break;
}
if (strlen($description) > 25) {
$description = substr($description, 0, 22) . '...';
}
$item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item_data['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar));
}
if (isset($item_menu['showgraph'])) {
$tr_ov_menu[] = array(S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
$tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']);
}
if (isset($item_menu['showlatest'])) {
$tr_ov_menu[] = array(S_VALUES, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
$tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']);
}
unset($item_menu);
}
// dependency
// TRIGGERS ON WHICH DEPENDS THIS
$desc = array();
if (isset($trhosts[$hostname])) {
$triggerid = $trhosts[$hostname]['triggerid'];
$dependency = false;
$dep_table = new CTableInfo();
$dep_table->AddOption('style', 'width: 200px;');
$dep_table->addRow(bold(S_DEPENDS_ON . ':'));
$sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_down=' . $triggerid;
$dep_res = DBselect($sql_dep);
while ($dep_row = DBfetch($dep_res)) {
$dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_up']));
$dependency = true;
}
if ($dependency) {
$img = new Cimg('images/general/down_icon.png', 'DEP_DOWN');
$img->AddOption('style', 'vertical-align: middle; border: 0px;');
$img->SetHint($dep_table);
array_push($desc, $img);
}
unset($img, $dep_table, $dependency);
// TRIGGERS THAT DEPEND ON THIS
$dependency = false;
$dep_table = new CTableInfo();
$dep_table->AddOption('style', 'width: 200px;');
$dep_table->addRow(bold(S_DEPENDENT . ':'));
$sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $triggerid;
$dep_res = DBselect($sql_dep);
while ($dep_row = DBfetch($dep_res)) {
//.........这里部分代码省略.........
示例7: CDiv
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$events_wdgt->addHeader($numrows);
// }}} HEADER
// FILTER {{{
$filterForm = null;
if (EVENT_SOURCE_TRIGGERS == $source) {
$filterForm = new CFormTable(null, null, 'get');
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addVar('triggerid', get_request('triggerid'));
$filterForm->addVar('stime', get_request('stime'));
$filterForm->addVar('period', get_request('period'));
if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
$trigger = expand_trigger_description($_REQUEST['triggerid']);
} else {
$trigger = '';
}
$row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox('trigger', $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->getName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->addRow($row);
$filterForm->addVar('hide_unknown', $_REQUEST['hide_unknown']);
$unkcbx = new CCheckBox('hide_unk', $_REQUEST['hide_unknown'], null, '1');
$unkcbx->setAction('javascript: create_var("' . $filterForm->GetName() . '", "hide_unknown", (this.checked?1:0), 0); ');
$filterForm->addRow(S_HIDE_UNKNOWN, $unkcbx);
$reset = new CButton('filter_rst', S_RESET);
$reset->setType('button');
$reset->setAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
$filterForm->addItemToBottomRow(new CButton('filter_set', S_FILTER));
$filterForm->addItemToBottomRow($reset);
}
示例8: condition_value2str
function condition_value2str($conditiontype, $value)
{
switch ($conditiontype) {
case CONDITION_TYPE_HOST_GROUP:
$group = get_hostgroup_by_groupid($value);
$str_val = '';
if (id2nodeid($value) != get_current_nodeid()) {
$str_val = get_node_name_by_elid($value, true);
}
$str_val .= $group['name'];
break;
case CONDITION_TYPE_TRIGGER:
$str_val = expand_trigger_description($value);
break;
case CONDITION_TYPE_HOST:
case CONDITION_TYPE_HOST_TEMPLATE:
$host = get_host_by_hostid($value);
$str_val = '';
if (id2nodeid($value) != get_current_nodeid()) {
$str_val = get_node_name_by_elid($value, true);
}
$str_val .= $host['host'];
break;
case CONDITION_TYPE_TRIGGER_NAME:
$str_val = $value;
break;
case CONDITION_TYPE_TRIGGER_VALUE:
$str_val = trigger_value2str($value);
break;
case CONDITION_TYPE_TRIGGER_SEVERITY:
$str_val = get_severity_description($value);
break;
case CONDITION_TYPE_TIME_PERIOD:
$str_val = $value;
break;
case CONDITION_TYPE_MAINTENANCE:
$str_val = S_MAINTENANCE_SMALL;
break;
case CONDITION_TYPE_DHOST_IP:
$str_val = $value;
break;
case CONDITION_TYPE_DSERVICE_TYPE:
$str_val = discovery_check_type2str($value);
break;
case CONDITION_TYPE_DSERVICE_PORT:
$str_val = $value;
break;
case CONDITION_TYPE_DSTATUS:
$str_val = discovery_object_status2str($value);
break;
case CONDITION_TYPE_DUPTIME:
$str_val = $value;
break;
case CONDITION_TYPE_DVALUE:
$str_val = $value;
break;
case CONDITION_TYPE_EVENT_ACKNOWLEDGED:
$str_val = $value ? S_ACK : S_NOT_ACK;
break;
case CONDITION_TYPE_APPLICATION:
$str_val = $value;
break;
default:
return S_UNKNOWN;
break;
}
return '"' . $str_val . '"';
}
示例9: order_result
$links[$linkid]['label1'] = $labels[$row['selementid1']];
$links[$linkid]['label2'] = $labels[$row['selementid2']];
}
order_result($links, 'label1');
foreach ($links as $linkid => $row) {
$label1 = $row['label1'];
$label2 = $row['label2'];
/* prepare description */
$triggers = get_link_triggers($row['linkid']);
$description = array();
foreach ($triggers as $id => $trigger) {
if (isset($trigger['triggerid'])) {
if (!empty($description)) {
$description[] = BR();
}
$triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']);
}
$description[] = $triggers[$id]['description'];
}
if (empty($description)) {
$description = '-';
}
/* draw row */
$table->addRow(array(new CLink('link ' . $i++, 'sysmap.php?sysmapid=' . $_REQUEST['sysmapid'] . '&form=update&linkid=' . $row['linkid'], 'action'), $label1, $label2, $description));
}
$table->Show();
}
}
show_messages();
echo SBR;
$map = get_sysmap_by_sysmapid($_REQUEST['sysmapid']);
示例10: insert_trigger_form
//.........这里部分代码省略.........
$del_url->setAttribute('onclick', 'javascript: if(confirm("' . S_DELETE_EXPRESSION_Q . '")) {' . ' delete_expression(\'' . $e['id'] . '\');' . ' document.forms["config_triggers.php"].submit(); ' . '}');
$tgt_chk = new CCheckbox('expr_target_single', $i == 0 ? 'yes' : 'no', 'check_target(this);', $e['id']);
} else {
$tgt_chk = null;
}
if (!isset($e['expression']['levelErrors'])) {
$errorImg = new CImg('images/general/ok_icon.png', 'expression_no_errors');
$errorImg->setHint(S_EXPRESSION_PART_NO_ERROR, '', '', false);
} else {
$allowedTesting = false;
$errorImg = new CImg('images/general/error_icon.png', 'expression_errors');
$errorTexts = array();
if (is_array($e['expression']['levelErrors'])) {
foreach ($e['expression']['levelErrors'] as $expVal => $errTxt) {
if (count($errorTexts) > 0) {
array_push($errorTexts, BR());
}
array_push($errorTexts, $expVal, ':', $errTxt);
}
}
$errorImg->setHint($errorTexts, '', 'left', false);
}
//if it is a templated trigger
if ($limited == 'yes') {
//make all links inside inactive
for ($i = 0; $i < count($e['list']); $i++) {
if (gettype($e['list'][$i]) == 'object' && get_class($e['list'][$i]) == 'CSpan' && $e['list'][$i]->getAttribute('class') == 'link') {
$e['list'][$i]->setClass('');
$e['list'][$i]->setAttribute('onclick', '');
}
}
}
$errorCell = new CCol($errorImg, 'center');
$row = new CRow(array($tgt_chk, $e['list'], $errorCell, isset($del_url) ? $del_url : null));
$exp_table->addRow($row);
}
} else {
$allowedTesting = false;
$outline = '';
}
$frmTrig->addVar('remove_expression', '');
$btn_test = new CButton('test_expression', S_TEST, "openWinCentered(" . "'tr_testexpr.php?expression=' + encodeURIComponent(this.form.elements['expression'].value)" . ",'ExpressionTest'" . ",850,400" . ",'titlebar=no, resizable=yes, scrollbars=yes');" . "return false;");
if (!isset($allowedTesting) || !$allowedTesting) {
$btn_test->setAttribute('disabled', 'disabled');
}
if (empty($outline)) {
$btn_test->setAttribute('disabled', 'yes');
}
//SDI($outline);
$wrapOutline = new CSpan(array($outline));
$wrapOutline->addStyle('white-space: pre;');
$frmTrig->addRow(SPACE, array($wrapOutline, BR(), BR(), $exp_table, $btn_test));
}
// dependencies
foreach ($dependencies as $val) {
array_push($dep_el, array(new CCheckBox('rem_dependence[' . $val . ']', 'no', null, strval($val)), expand_trigger_description($val)), BR());
$frmTrig->addVar('dependencies[]', strval($val));
}
if (count($dep_el) == 0) {
array_push($dep_el, S_NO_DEPENDENCES_DEFINED);
} else {
array_push($dep_el, new CButton('del_dependence', S_DELETE_SELECTED));
}
$frmTrig->addRow(S_THE_TRIGGER_DEPENDS_ON, $dep_el);
/* end dependencies */
/* new dependency */
// $frmTrig->addVar('new_dependence','0');
// $txtCondVal = new CTextBox('trigger','',75,'yes');
$btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?srctbl=triggers" . '&srcfld1=triggerid' . '&reference=deptrigger' . '&multiselect=1' . "',1000,700);", 'T');
$frmTrig->addRow(S_NEW_DEPENDENCY, $btnSelect, 'new');
// end new dependency
$type_select = new CComboBox('type');
$type_select->additem(TRIGGER_MULT_EVENT_DISABLED, S_NORMAL, $type == TRIGGER_MULT_EVENT_ENABLED ? 'no' : 'yes');
$type_select->additem(TRIGGER_MULT_EVENT_ENABLED, S_NORMAL . SPACE . '+' . SPACE . S_MULTIPLE_PROBLEM_EVENTS, $type == TRIGGER_MULT_EVENT_ENABLED ? 'yes' : 'no');
$frmTrig->addRow(S_EVENT_GENERATION, $type_select);
$cmbPrior = new CComboBox('priority', $priority);
for ($i = 0; $i <= 5; $i++) {
$cmbPrior->addItem($i, get_severity_description($i));
}
$frmTrig->addRow(S_SEVERITY, $cmbPrior);
$frmTrig->addRow(S_COMMENTS, new CTextArea("comments", $comments, 90, 7));
$frmTrig->addRow(S_URL, new CTextBox("url", $url, 90));
$frmTrig->addRow(S_DISABLED, new CCheckBox("status", $status));
$frmTrig->addItemToBottomRow(new CButton("save", S_SAVE));
if (isset($_REQUEST["triggerid"])) {
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButton("clone", S_CLONE));
$frmTrig->addItemToBottomRow(SPACE);
if (!$limited) {
$frmTrig->addItemToBottomRow(new CButtonDelete(S_DELETE_TRIGGER_Q, url_param("form") . url_param('groupid') . url_param("hostid") . url_param("triggerid")));
}
}
$frmTrig->addItemToBottomRow(SPACE);
$frmTrig->addItemToBottomRow(new CButtonCancel(url_param('groupid') . url_param("hostid")));
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
$script = "function addPopupValues(list){\n\t\t\t\t\t\tif(!isset('object', list)) return false;\n\n\t\t\t\t\t\tif(list.object == 'deptrigger'){\n\t\t\t\t\t\t\tfor(var i=0; i < list.values.length; i++){\n\t\t\t\t\t\t\t\tcreate_var('" . $frmTrig->getName() . "', 'new_dependence['+i+']', list.values[i], false);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcreate_var('" . $frmTrig->getName() . "','add_dependence', 1, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}";
insert_js($script);
return $frmTrig;
}
示例11: CLink
$row['graph'] = new CLink(S_SHOW, 'srv_status.php?serviceid=' . $row['serviceid'] . '&showgraph=1' . url_param('path'));
if (isset($row['triggerid']) && !empty($row['triggerid'])) {
$url = new CLink(expand_trigger_description($row['triggerid']), 'events.php?source=' . EVENT_SOURCE_TRIGGERS . '&triggerid=' . $row['triggerid']);
$row['caption'] = array($row['caption'], ' [', $url, ']');
}
if ($row['status'] == 0 || isset($service) && bccomp($service['serviceid'], $row['serviceid']) == 0) {
$row['reason'] = '-';
} else {
$row['reason'] = '-';
$result2 = DBselect('SELECT s.triggerid,s.serviceid ' . ' FROM services s, triggers t ' . ' WHERE s.status>0 ' . ' AND s.triggerid is not NULL ' . ' AND t.triggerid=s.triggerid ' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND ' . DBin_node('s.serviceid') . ' ORDER BY s.status DESC, t.description');
while ($row2 = DBfetch($result2)) {
if (is_string($row['reason']) && $row['reason'] == '-') {
$row['reason'] = new CList(null, 'itservices');
}
if (does_service_depend_on_the_service($row['serviceid'], $row2['serviceid'])) {
$row['reason']->addItem(new CLink(expand_trigger_description($row2['triggerid']), 'events.php?source=' . EVENT_SOURCE_TRIGGERS . '&triggerid=' . $row2['triggerid']));
}
}
}
if ($row['showsla'] == 1) {
$stat = calculate_service_availability($row['serviceid'], $period_start, $period_end);
$p = min($stat['problem'], 20);
$sla_style = $row['goodsla'] > $stat['ok'] ? 'on' : 'off';
$sizeX = 160;
$sizeY = 15;
$sizeX_red = $sizeX * $p / 20;
$sizeX_green = $sizeX - $sizeX_red;
$sla_tab = new CTable(null, 'invisible');
$chart1 = null;
if ($sizeX_green > 0) {
$chart1 = new CDiv(null, 'sla_green');
示例12: make_event_details
function make_event_details($eventid)
{
$event = get_tr_event_by_eventid($eventid);
$table = new CTableInfo();
$table->AddRow(array(S_EVENT, expand_trigger_description($event['triggerid'])));
$table->AddRow(array(S_TIME, date('Y.M.d H:i:s', $event['clock'])));
$duration = zbx_date2age($event['clock']);
if ($next_event = get_next_event($event, 1)) {
$duration = zbx_date2age($event['clock'], $next_event['clock']);
}
if ($event["value"] == TRIGGER_VALUE_FALSE) {
$value = new CCol(S_OK_BIG, "off");
} elseif ($event["value"] == TRIGGER_VALUE_TRUE) {
$value = new CCol(S_PROBLEM_BIG, "on");
} else {
$value = new CCol(S_UNKNOWN_BIG, "unknown");
}
$ack = '-';
if ($event["value"] == 1 && $event["acknowledged"] == 1) {
$db_acks = get_acknowledges_by_eventid($event["eventid"]);
$rows = 0;
while ($a = DBfetch($db_acks)) {
$rows++;
}
$ack = array(new CLink(new CSpan(S_YES, 'off'), 'acknow.php?eventid=' . $event['eventid'], 'action'), SPACE . '(' . $rows . ')');
}
$table->AddRow(array(S_STATUS, $value));
$table->AddRow(array(S_DURATION, $duration));
$table->AddRow(array(S_ACKNOWLEDGED, $ack));
return $table;
}
示例13: array
$options = array('triggerids' => $result['triggerids'], 'output' => API_OUTPUT_EXTEND);
$db_triggers = CTrigger::get($options);
$result = true;
$db_triggers = reset($db_triggers);
$triggerid = $db_triggers['triggerid'];
} else {
$result = false;
}
}
$result = DBend($result);
// $result = $triggerid;
$audit_action = AUDIT_ACTION_ADD;
show_messages($triggerid, S_TRIGGER_ADDED, S_CANNOT_ADD_TRIGGER);
}
if ($result) {
add_audit($audit_action, AUDIT_RESOURCE_TRIGGER, S_TRIGGER . " [" . $triggerid . "] [" . expand_trigger_description($triggerid) . "] ");
unset($_REQUEST["sform"]);
zbx_add_post_js('closeform("items.php");');
include_once 'include/page_footer.php';
}
}
}
//------------------------ </ACTIONS> --------------------------
//------------------------ <FORM> ---------------------------
if (isset($_REQUEST['sform'])) {
$frmTRLog = new CFormTable(S_TRIGGER, 'tr_logform.php', 'POST', null, 'sform');
$frmTRLog->setHelp('web.triggerlog.service.php');
$frmTRLog->setTableClass('formlongtable formtable');
$frmTRLog->addVar('form_refresh', get_request('form_refresh', 1));
if (isset($_REQUEST['triggerid'])) {
$frmTRLog->addVar('triggerid', $_REQUEST['triggerid']);
示例14: foreach
foreach ($template_items as $inum => $titem) {
$item_description = item_description($titem);
$items_lbx->addItem($titem['itemid'], $item_description);
}
}
$template_tbl->addRow(array(S_ITEMS, $items_lbx));
// FORM ITEM : Template triggers
$trig_lbx = new CListBox('triggers', null, 8);
$trig_lbx->setAttribute('disabled', 'disabled');
$options = array('editable' => 1, 'hostids' => $templateid, 'extendoutput' => 1);
$template_triggers = CTrigger::get($options);
if (empty($template_triggers)) {
$trig_lbx->setAttribute('style', 'width: 200px;');
} else {
foreach ($template_triggers as $tnum => $ttrigger) {
$trigger_description = expand_trigger_description($ttrigger['triggerid']);
$trig_lbx->addItem($ttrigger['triggerid'], $trigger_description);
}
}
$template_tbl->addRow(array(S_TRIGGERS, $trig_lbx));
// FORM ITEM : Host graphs
$graphs_lbx = new CListBox('graphs', null, 8);
$graphs_lbx->setAttribute('disabled', 'disabled');
$options = array('editable' => 1, 'hostids' => $templateid, 'extendoutput' => 1);
$template_graphs = CGraph::get($options);
if (empty($template_graphs)) {
$graphs_lbx->setAttribute('style', 'width: 200px;');
} else {
foreach ($template_graphs as $tnum => $tgraph) {
$graphs_lbx->addItem($tgraph['graphid'], $tgraph['name']);
}
示例15: insert_map_link_form
function insert_map_link_form()
{
$frmCnct = new CFormTable('New connector', 'sysmap.php');
$frmCnct->SetHelp('web.sysmap.connector.php');
$frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']);
if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
$db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']);
$db_link = DBfetch($db_links);
$selementid1 = $db_link['selementid1'];
$selementid2 = $db_link['selementid2'];
$triggers = array();
$drawtype = $db_link['drawtype'];
$color = $db_link['color'];
$res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']);
while ($rows = DBfetch($res)) {
$triggers[] = $rows;
}
} else {
if (isset($_REQUEST['linkid'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
}
$selementid1 = get_request('selementid1', 0);
$selementid2 = get_request('selementid2', 0);
$triggers = get_request('triggers', array());
$drawtype = get_request('drawtype', 0);
$color = get_request('color', 0);
}
/* START comboboxes preparations */
$cmbElements1 = new CComboBox('selementid1', $selementid1);
$cmbElements2 = new CComboBox('selementid2', $selementid2);
$db_selements = DBselect('SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid']);
while ($db_selement = DBfetch($db_selements)) {
$label = $db_selement['label'];
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
$db_host = get_host_by_hostid($db_selement['elementid']);
$label .= ':' . $db_host['host'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) {
$db_map = get_sysmap_by_sysmapid($db_selement['elementid']);
$label .= ':' . $db_map['name'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) {
if ($db_selement['elementid'] > 0) {
$label .= ':' . expand_trigger_description($db_selement['elementid']);
}
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) {
if ($db_selement['elementid'] > 0) {
$db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid']));
$label .= ':' . $db_group['name'];
}
}
}
}
}
$cmbElements1->addItem($db_selement['selementid'], $label);
$cmbElements2->addItem($db_selement['selementid'], $label);
}
$cmbType = new CComboBox('drawtype', $drawtype);
foreach (map_link_drawtypes() as $i) {
$value = map_link_drawtype2str($i);
$cmbType->addItem($i, $value);
}
/* END preparation */
$frmCnct->addRow(S_ELEMENT_1, $cmbElements1);
$frmCnct->addRow(S_ELEMENT_2, $cmbElements2);
//trigger links
foreach ($triggers as $id => $trigger) {
if (isset($trigger['triggerid'])) {
$triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']);
}
}
$table = new CTable();
$table->SetClass('tableinfo');
$table->setOddRowClass('even_row');
$table->setEvenRowClass('even_row');
$table->options['cellpadding'] = 3;
$table->options['cellspacing'] = 1;
$table->headerClass = 'header';
$table->footerClass = 'footer';
$table->SetHeader(array(new CCheckBox('all_triggers', null, "CheckAll('" . $frmCnct->GetName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR));
$table->addOption('id', 'link_triggers');
foreach ($triggers as $id => $trigger) {
if (!isset($trigger['triggerid'])) {
continue;
}
$colorbox = new CSpan(SPACE . SPACE . SPACE);
$colorbox->addOption('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';');
$table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array(new CLink($trigger['description'], "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"), new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color']))));
}
$btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T');
$btnRemove = new CButton('btn1', S_REMOVE, "javascript: remove_childs('" . $frmCnct->GetName() . "','triggers','tr');", 'T');
$btnadd->SetType('button');
$frmCnct->addRow(S_LINK_STATUS_INDICATORS, array($table, BR(), $btnadd, $btnRemove));
//----------
$frmCnct->addRow(S_TYPE . ' (' . S_OK_BIG . ')', $cmbType);
$frmCnct->addRow(S_COLOR . ' (' . S_OK_BIG . ')', new CColor('color', $color));
$frmCnct->addItemToBottomRow(new CButton("save_link", S_SAVE));
if (isset($_REQUEST["linkid"])) {
//.........这里部分代码省略.........