当前位置: 首页>>代码示例>>PHP>>正文


PHP CMacrosResolverHelper::resolveTriggerNameById方法代码示例

本文整理汇总了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;
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:tr_status.php

示例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;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:93,代码来源:triggers.inc.php

示例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;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:75,代码来源:triggers.inc.php


注:本文中的CMacrosResolverHelper::resolveTriggerNameById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。