本文整理汇总了PHP中CMacrosResolverHelper::resolveTriggerNameById方法的典型用法代码示例。如果您正苦于以下问题:PHP CMacrosResolverHelper::resolveTriggerNameById方法的具体用法?PHP CMacrosResolverHelper::resolveTriggerNameById怎么用?PHP CMacrosResolverHelper::resolveTriggerNameById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMacrosResolverHelper
的用法示例。
在下文中一共展示了CMacrosResolverHelper::resolveTriggerNameById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$triggerItems = array();
$trigger['items'] = CMacrosResolverHelper::resolveItemNames($trigger['items']);
foreach ($trigger['items'] as $item) {
$triggerItems[] = array('name' => $usedHostCount > 1 ? $usedHosts[$item['hostid']] . NAME_DELIMITER . $item['name_expanded'] : $item['name_expanded'], 'params' => array('itemid' => $item['itemid'], 'action' => in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues'));
}
$description = new CSpan($trigger['description'], 'link_menu');
$description->setMenuPopup(getMenuPopupTrigger($trigger, $triggerItems));
if ($_REQUEST['show_details']) {
$description = array($description, BR(), explode_exp($trigger['expression'], true, true));
}
if (!empty($trigger['dependencies'])) {
$dependenciesTable = new CTableInfo();
$dependenciesTable->setAttribute('style', 'width: 200px;');
$dependenciesTable->addRow(bold(_('Depends on') . NAME_DELIMITER));
foreach ($trigger['dependencies'] as $dependency) {
$dependenciesTable->addRow(' - ' . CMacrosResolverHelper::resolveTriggerNameById($dependency['triggerid']));
}
$img = new Cimg('images/general/arrow_down2.png', 'DEP_UP');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->setHint($dependenciesTable);
$description = array($img, SPACE, $description);
}
$dependency = false;
$dependenciesTable = new CTableInfo();
$dependenciesTable->setAttribute('style', 'width: 200px;');
$dependenciesTable->addRow(bold(_('Dependent') . NAME_DELIMITER));
if (!empty($triggerIdsDown[$trigger['triggerid']])) {
$depTriggers = CMacrosResolverHelper::resolveTriggerNameByIds($triggerIdsDown[$trigger['triggerid']]);
foreach ($depTriggers as $depTrigger) {
$dependenciesTable->addRow(SPACE . '-' . SPACE . $depTrigger['description']);
$dependency = true;
示例2: getTriggerOverviewCells
/**
* Creates and returns a trigger status cell for the trigger overview table.
*
* @see getTriggersOverview()
*
* @param array $trigger
* @param string $pageFile the page where the element is displayed
* @param string $screenId
*
* @return CCol
*/
function getTriggerOverviewCells($trigger, $pageFile, $screenId = null)
{
$ack = null;
$css = null;
$style = null;
$desc = array();
$config = select_config();
// for how long triggers should blink on status change (set by user in administration->general)
$menuPopup = array();
$triggerItems = array();
$acknowledge = array();
if ($trigger) {
$style = 'cursor: pointer; ';
// problem trigger
if ($trigger['value'] == TRIGGER_VALUE_TRUE) {
$css = getSeverityStyle($trigger['priority']);
$ack = null;
if ($config['event_ack_enable'] == 1) {
if ($event = get_last_event_by_triggerid($trigger['triggerid'])) {
if ($screenId) {
$acknowledge = array('eventid' => $event['eventid'], 'screenid' => $screenId, 'backurl' => $pageFile);
} else {
$acknowledge = array('eventid' => $event['eventid'], 'backurl' => 'overview.php');
}
if ($event['acknowledged'] == 1) {
$ack = new CImg('images/general/tick.png', 'ack');
}
}
}
} else {
$css = 'normal';
}
$dbItems = DBselect('SELECT DISTINCT i.itemid,i.name,i.key_,i.value_type' . ' FROM items i,functions f' . ' WHERE f.itemid=i.itemid' . ' AND f.triggerid=' . zbx_dbstr($trigger['triggerid']));
while ($item = DBfetch($dbItems)) {
$triggerItems[] = array('name' => itemName($item), 'params' => array('action' => in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showlatest', 'itemid' => $item['itemid'], 'period' => 3600));
}
// dependency: triggers on which depends this
$triggerId = empty($trigger['triggerid']) ? 0 : $trigger['triggerid'];
// trigger dependency DOWN
$dependencyTable = new CTableInfo();
$dependencyTable->setAttribute('style', 'width: 200px;');
$dependencyTable->addRow(bold(_('Depends on') . NAME_DELIMITER));
$isDependencyFound = false;
$dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . zbx_dbstr($triggerId));
while ($dbDependency = DBfetch($dbDependencies)) {
$dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_up']));
$isDependencyFound = true;
}
if ($isDependencyFound) {
$icon = new Cimg('images/general/arrow_down2.png', 'DEP_DOWN');
$icon->setAttribute('style', 'vertical-align: middle; border: 0px;');
$icon->setHint($dependencyTable, '', '', false);
$desc[] = $icon;
}
// trigger dependency UP
$dependencyTable = new CTableInfo();
$dependencyTable->setAttribute('style', 'width: 200px;');
$dependencyTable->addRow(bold(_('Dependent') . NAME_DELIMITER));
$isDependencyFound = false;
$dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . zbx_dbstr($triggerId));
while ($dbDependency = DBfetch($dbDependencies)) {
$dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_down']));
$isDependencyFound = true;
}
if ($isDependencyFound) {
$icon = new Cimg('images/general/arrow_up2.png', 'DEP_UP');
$icon->setAttribute('style', 'vertical-align: middle; border: none;');
$icon->setHint($dependencyTable, '', '', false);
$desc[] = $icon;
}
}
$column = is_array($desc) && count($desc) > 0 || $ack ? new CCol(array($desc, $ack), $css . ' hosts') : new CCol(SPACE, $css . ' hosts');
$column->setAttribute('style', $style);
if ($trigger && $config['blink_period'] > 0 && time() - $trigger['lastchange'] < $config['blink_period']) {
$column->addClass('blink');
$column->setAttribute('data-toggle-class', $css);
}
if ($trigger) {
$column->setMenuPopup(getMenuPopupTrigger($trigger, $triggerItems, $acknowledge));
}
return $column;
}
示例3: getTriggerOverviewCells
/**
* Creates and returns a trigger status cell for the trigger overview table.
*
* @see getTriggersOverview()
*
* @param array $trigger
* @param string $pageFile the page where the element is displayed
* @param string $screenid
*
* @return CCol
*/
function getTriggerOverviewCells($trigger, $pageFile, $screenid = null)
{
$ack = null;
$css = null;
$desc = [];
$acknowledge = [];
// for how long triggers should blink on status change (set by user in administration->general)
$config = select_config();
if ($trigger) {
$css = getSeverityStyle($trigger['priority'], $trigger['value'] == TRIGGER_VALUE_TRUE);
// problem trigger
if ($trigger['value'] == TRIGGER_VALUE_TRUE) {
$ack = null;
if ($config['event_ack_enable']) {
if ($event = get_last_event_by_triggerid($trigger['triggerid'])) {
if ($screenid !== null) {
$acknowledge = ['eventid' => $event['eventid'], 'backurl' => $pageFile . '?screenid=' . $screenid];
} else {
$acknowledge = ['eventid' => $event['eventid'], 'backurl' => $pageFile];
}
if ($event['acknowledged'] == 1) {
$ack = (new CSpan())->addClass(ZBX_STYLE_ICON_ACKN);
}
}
}
}
// dependency: triggers on which depends this
$triggerId = empty($trigger['triggerid']) ? 0 : $trigger['triggerid'];
// trigger dependency DOWN
$dependencyTable = (new CTableInfo())->setAttribute('style', 'width: 200px;')->addRow(bold(_('Depends on') . ':'));
$isDependencyFound = false;
$dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . zbx_dbstr($triggerId));
while ($dbDependency = DBfetch($dbDependencies)) {
$dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_up']));
$isDependencyFound = true;
}
if ($isDependencyFound) {
$desc[] = (new CSpan())->addClass(ZBX_STYLE_ICON_DEPEND_DOWN)->setHint($dependencyTable, '', false);
}
// trigger dependency UP
$dependencyTable = (new CTableInfo())->setAttribute('style', 'width: 200px;')->addRow(bold(_('Dependent') . ':'));
$isDependencyFound = false;
$dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . zbx_dbstr($triggerId));
while ($dbDependency = DBfetch($dbDependencies)) {
$dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_down']));
$isDependencyFound = true;
}
if ($isDependencyFound) {
$desc[] = (new CSpan())->addClass(ZBX_STYLE_ICON_DEPEND_UP)->setHint($dependencyTable, '', false);
}
}
$column = new CCol([$desc, $ack]);
if ($css !== null) {
$column->addClass($css)->addClass(ZBX_STYLE_CURSOR_POINTER);
}
if ($trigger && $config['blink_period'] > 0 && time() - $trigger['lastchange'] < $config['blink_period']) {
$column->addClass('blink');
$column->setAttribute('data-toggle-class', $css);
}
if ($trigger) {
$column->setMenuPopup(CMenuPopupHelper::getTrigger($trigger, $acknowledge));
}
return $column;
}