• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getSeverityStyle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getSeverityStyle函数的典型用法代码示例。如果您正苦于以下问题:PHP getSeverityStyle函数的具体用法?PHP getSeverityStyle怎么用?PHP getSeverityStyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getSeverityStyle函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

    /**
     * @param string $options['id']
     * @param string $options['name']
     * @param int    $options['value']
     */
    public function __construct(array $options = array())
    {
        parent::__construct('div', 'yes');
        $this->attr('id', isset($options['id']) ? $options['id'] : zbx_formatDomId($options['name']));
        $this->addClass('jqueryinputset control-severity');
        if (!isset($options['value'])) {
            $options['value'] = TRIGGER_SEVERITY_NOT_CLASSIFIED;
        }
        $items = array();
        $jsIds = '';
        $jsLabels = '';
        foreach (getSeverityCaption() as $severity => $caption) {
            $items[] = new CRadioButton($options['name'], $severity, null, $options['name'] . '_' . $severity, $options['value'] == $severity);
            $css = getSeverityStyle($severity);
            $label = new CLabel($caption, $options['name'] . '_' . $severity, $options['name'] . '_label_' . $severity);
            $label->attr('data-severity', $severity);
            $label->attr('data-severity-style', $css);
            if ($options['value'] == $severity) {
                $label->attr('aria-pressed', 'true');
                $label->addClass($css);
            } else {
                $label->attr('aria-pressed', 'false');
            }
            $items[] = $label;
            $jsIds .= ', #' . $options['name'] . '_' . $severity;
            $jsLabels .= ', #' . $options['name'] . '_label_' . $severity;
        }
        if ($jsIds) {
            $jsIds = substr($jsIds, 2);
            $jsLabels = substr($jsLabels, 2);
        }
        $this->addItem($items);
        insert_js('
			jQuery("' . $jsLabels . '").mouseenter(function() {
				jQuery("' . $jsLabels . '").each(function() {
					var obj = jQuery(this);

					if (obj.attr("aria-pressed") == "false") {
						obj.removeClass("ui-state-hover " + obj.data("severityStyle"));
					}
				});

				var obj = jQuery(this);

				obj.addClass(obj.data("severityStyle"));
			})
			.mouseleave(function() {
				jQuery("#' . $this->getAttribute('id') . ' [aria-pressed=\\"true\\"]").trigger("mouseenter");
			});

			jQuery("' . $jsIds . '").change(function() {
				jQuery("#' . $this->getAttribute('id') . ' [aria-pressed=\\"true\\"]").trigger("mouseenter");
			});', true);
    }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:59,代码来源:class.cseverity.php


示例2: makeCol

 /**
  * Returns a column object for the given row and field. Add additional service tree related formatting.
  *
  * @param $rowId
  * @param $colName
  *
  * @return CCol
  */
 protected function makeCol($rowId, $colName)
 {
     $class = null;
     if ($colName == 'status' && zbx_is_int($this->tree[$rowId][$colName]) && $this->tree[$rowId]['id'] > 0) {
         $status = $this->tree[$rowId][$colName];
         // do not show the severity for information and unclassified triggers
         if (in_array($status, array(TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_NOT_CLASSIFIED))) {
             $this->tree[$rowId][$colName] = new CSpan(_('OK'), 'green');
         } else {
             $this->tree[$rowId][$colName] = getSeverityCaption($status);
             $class = getSeverityStyle($status);
         }
     }
     $col = parent::makeCol($rowId, $colName);
     $col->addClass($class);
     return $col;
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:25,代码来源:CServiceTree.php


示例3: __construct

 /**
  * @param string $options['name']
  * @param int    $options['value']		(optional) Default: TRIGGER_SEVERITY_NOT_CLASSIFIED
  * @param bool   $options['all']		(optional)
  */
 public function __construct(array $options = [])
 {
     parent::__construct();
     $id = zbx_formatDomId($options['name']);
     $this->addClass(ZBX_STYLE_RADIO_SEGMENTED);
     $this->setId($id);
     if (!array_key_exists('value', $options)) {
         $options['value'] = TRIGGER_SEVERITY_NOT_CLASSIFIED;
     }
     $severity_from = array_key_exists('all', $options) && $options['all'] ? -1 : TRIGGER_SEVERITY_NOT_CLASSIFIED;
     $config = select_config();
     for ($severity = $severity_from; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
         $name = $severity == -1 ? _('all') : getSeverityName($severity, $config);
         $class = $severity == -1 ? null : getSeverityStyle($severity);
         $radio = (new CInput('radio', $options['name'], $severity))->setId(zbx_formatDomId($options['name'] . '_' . $severity));
         if ($severity === $options['value']) {
             $radio->setAttribute('checked', 'checked');
         }
         parent::addItem((new CListItem([$radio, new CLabel($name, $options['name'] . '_' . $severity)]))->addClass($class));
     }
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:26,代码来源:CSeverity.php


示例4: 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


示例5: CSpan

            if (++$popup_rows == ZBX_WIDGET_ROWS) {
                break;
            }
        }
        $problematic_count = (new CSpan($hosts_data[$group['groupid']]['problematic']))->addClass(ZBX_STYLE_LINK_ACTION)->setHint($table_inf);
    } else {
        $problematic_count = 0;
    }
    switch ($data['filter']['extAck']) {
        case EXTACK_OPTION_ALL:
            $group_row->addItem((new CCol($problematic_count))->addClass(getSeverityStyle($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic'])));
            $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']);
            break;
        case EXTACK_OPTION_UNACK:
            $group_row->addItem((new CCol($lastUnack_count))->addClass(getSeverityStyle(isset($highest_severity2[$group['groupid']]) ? $highest_severity2[$group['groupid']] : 0, $hosts_data[$group['groupid']]['lastUnack'])));
            $group_row->addItem($hosts_data[$group['groupid']]['lastUnack'] + $hosts_data[$group['groupid']]['ok']);
            break;
        case EXTACK_OPTION_BOTH:
            $unackspan = $lastUnack_count ? [$lastUnack_count, ' ' . _('of') . ' '] : null;
            $group_row->addItem((new CCol([$unackspan, $problematic_count]))->addClass(getSeverityStyle($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic'])));
            $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']);
            break;
    }
    $table->addRow($group_row);
}
$output = ['header' => _('Host status'), 'body' => (new CDiv([getMessages(), $table]))->toString(), 'footer' => (new CListItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS))))->toString()];
if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
    CProfiler::getInstance()->stop();
    $output['debug'] = CProfiler::getInstance()->make()->toString();
}
echo (new CJson())->encode($output);
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:monitoring.widget.hosts.view.php


示例6: zbx_add_post_js

**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
zbx_add_post_js('jqBlink.blink();');
// hint table
$help_hint = (new CList())->addClass(ZBX_STYLE_NOTIF_BODY)->addStyle('min-width: ' . ZBX_OVERVIEW_HELP_MIN_WIDTH . 'px')->addItem([(new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle(null, false)), new CTag('h4', true, _('OK')), (new CTag('p', true, ''))->addClass(ZBX_STYLE_GREY)]);
for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
    $help_hint->addItem([(new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle($severity)), new CTag('h4', true, getSeverityName($severity, $data['config'])), (new CTag('p', true, _('PROBLEM')))->addClass(ZBX_STYLE_GREY)]);
}
// blinking preview in help popup (only if blinking is enabled)
if ($data['config']['blink_period'] > 0) {
    $indic_container = (new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC_CONTAINER)->addItem((new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle(null, false))->addClass('blink'));
    for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
        $indic_container->addItem((new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle($severity))->addClass('blink'));
    }
    $indic_container->addItem((new CTag('p', true, _s('Age less than %s', convertUnitsS($data['config']['blink_period']))))->addClass(ZBX_STYLE_GREY));
    $help_hint->addItem($indic_container);
}
// header right
$help = get_icon('overviewhelp');
$help->setHint($help_hint);
$widget = (new CWidget())->setTitle(_('Overview'))->setControls((new CForm('get'))->cleanItems()->addItem((new CList())->addItem([_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB()])->addItem([_('Type'), SPACE, new CComboBox('type', $this->data['type'], 'submit()', [SHOW_TRIGGERS => _('Triggers'), SHOW_DATA => _('Data')])])->addItem([_('Hosts location'), SPACE, new CComboBox('view_style', $this->data['view_style'], 'submit()', [STYLE_TOP => _('Top'), STYLE_LEFT => _('Left')])])->addItem(get_icon('fullscreen', ['fullscreen' => $this->data['fullscreen']]))->addItem($help)));
// filter
$filter = $this->data['filter'];
$filterFormView = new CView('common.filter.trigger', ['overview' => true, 'filter' => ['filterid' => 'web.overview.filter.state', 'showTriggers' => $filter['showTriggers'], 'ackStatus' => $filter['ackStatus'], 'showSeverity' => $filter['showSeverity'], 'statusChange' => $filter['statusChange'], 'statusChangeDays' => $filter['statusChangeDays'], 'txtSelect' => $filter['txtSelect'], 'application' => $filter['application'], 'inventory' => $filter['inventory'], 'showMaintenance' => $filter['showMaintenance'], 'hostId' => $this->data['hostid'], 'groupId' => $this->data['groupid'], 'fullScreen' => $this->data['fullscreen']], 'config' => $data['config']]);
$filterForm = $filterFormView->render();
$widget->addItem($filterForm);
// data table
if ($data['pageFilter']->groupsSelected) {
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:monitoring.overview.triggers.php


示例7: getSeverityControl

/**
 * Create control for trigger severities.
 * It's mostly the same as usual button set, but background color is changed based on selected severiity.
 * Js file "/include/views/js/configuration.triggers.edit.js.php" is needed to make it work correcty.
 *
 * @param $selectedSeverity
 *
 * @return CDiv
 */
function getSeverityControl($selectedSeverity = TRIGGER_SEVERITY_NOT_CLASSIFIED)
{
    $controls = array();
    foreach (getSeverityCaption() as $severity => $caption) {
        $controls[] = new CRadioButton('priority', $severity, null, 'severity_' . $severity, $selectedSeverity == $severity);
        $label = new CLabel($caption, 'severity_' . $severity, 'severity_label_' . $severity);
        $label->attr('data-severity', $severity);
        $label->attr('data-severity-style', getSeverityStyle($severity));
        $controls[] = $label;
    }
    return new CDiv($controls, 'jqueryinputset control-severity');
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:21,代码来源:html.inc.php


示例8: getItemDataOverviewCells

function getItemDataOverviewCells($tableRow, $ithosts, $hostName)
{
    $css = '';
    $value = '-';
    $ack = null;
    if (isset($ithosts[$hostName])) {
        $item = $ithosts[$hostName];
        if ($item['tr_value'] == TRIGGER_VALUE_TRUE) {
            $css = getSeverityStyle($item['severity']);
            $ack = get_last_event_by_triggerid($item['triggerid']);
            $ack = $ack['acknowledged'] == 1 ? array(SPACE, new CImg('images/general/tick.png', 'ack')) : null;
        }
        $value = $item['value'] !== null ? formatHistoryValue($item['value'], $item) : UNKNOWN_VALUE;
    }
    if ($value != '-') {
        $value = new CSpan($value, 'link');
    }
    $column = new CCol(array($value, $ack), $css);
    if (isset($ithosts[$hostName])) {
        $column->setMenuPopup(getMenuPopupHistory($item));
    }
    $tableRow[] = $column;
    return $tableRow;
}
开发者ID:hujingguang,项目名称:work,代码行数:24,代码来源:items.inc.php


示例9: make_latest_issues


//.........这里部分代码省略.........
    $triggers = API::Trigger()->get(array_merge($options, ['output' => ['triggerid', 'expression', 'description', 'url', 'priority', 'lastchange', 'comments', 'error', 'state'], 'selectHosts' => ['hostid'], 'selectLastEvent' => ['eventid', 'acknowledged', 'objectid', 'clock', 'ns'], 'withLastEventUnacknowledged' => isset($filter['extAck']) && $filter['extAck'] == EXTACK_OPTION_UNACK ? true : null, 'skipDependent' => true, 'sortfield' => $sort_field, 'sortorder' => $sort_order, 'limit' => isset($filter['limit']) ? $filter['limit'] : DEFAULT_LATEST_ISSUES_CNT, 'preservekeys' => true, 'expandComment' => true]));
    $triggers = CMacrosResolverHelper::resolveTriggerUrls($triggers);
    // don't use withLastEventUnacknowledged and skipDependent because of performance issues
    $triggers_total_count = API::Trigger()->get(array_merge($options, ['countOutput' => true]));
    // get acknowledges
    $hostids = [];
    $eventids = [];
    foreach ($triggers as $trigger) {
        foreach ($trigger['hosts'] as $host) {
            $hostids[$host['hostid']] = true;
        }
        if ($trigger['lastEvent']) {
            $eventids[] = $trigger['lastEvent']['eventid'];
        }
    }
    $config = select_config();
    if ($config['event_ack_enable'] && $eventids) {
        $event_acknowledges = API::Event()->get(['output' => ['eventid'], 'eventids' => $eventids, 'select_acknowledges' => API_OUTPUT_EXTEND, 'preservekeys' => true]);
    }
    // actions
    $actions = makeEventsActions($eventids);
    // indicator of sort field
    if ($show_sort_indicator) {
        $sort_div = (new CDiv())->addClass($filter['sortorder'] === ZBX_SORT_DOWN ? ZBX_STYLE_ARROW_DOWN : ZBX_STYLE_ARROW_UP);
    }
    $table = (new CTableInfo())->setHeader([$show_sort_indicator && $filter['sortfield'] === 'hostname' ? [_('Host'), $sort_div] : _('Host'), $show_sort_indicator && $filter['sortfield'] === 'priority' ? [_('Issue'), $sort_div] : _('Issue'), $show_sort_indicator && $filter['sortfield'] === 'lastchange' ? [_('Last change'), $sort_div] : _('Last change'), _('Age'), _('Info'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions')]);
    $hostids = array_keys($hostids);
    $scripts = API::Script()->getScriptsByHosts($hostids);
    // get hosts
    $hosts = API::Host()->get(['hostids' => $hostids, 'output' => ['hostid', 'name', 'status', 'maintenance_status', 'maintenance_type', 'maintenanceid'], 'selectGraphs' => API_OUTPUT_COUNT, 'selectScreens' => API_OUTPUT_COUNT, 'preservekeys' => true]);
    $maintenanceids = [];
    foreach ($hosts as $host) {
        if ($host['maintenance_status'] == HOST_MAINTENANCE_STATUS_ON) {
            $maintenanceids[$host['maintenanceid']] = true;
        }
    }
    if ($maintenanceids) {
        $maintenances = API::Maintenance()->get(['maintenanceids' => array_keys($maintenanceids), 'output' => ['name', 'description'], 'preservekeys' => true]);
    }
    // triggers
    foreach ($triggers as $trigger) {
        $host_list = [];
        foreach ($trigger['hosts'] as $trigger_host) {
            $host = $hosts[$trigger_host['hostid']];
            $host_name = (new CSpan($host['name']))->addClass(ZBX_STYLE_LINK_ACTION)->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
            if ($host['maintenance_status'] == HOST_MAINTENANCE_STATUS_ON) {
                $maintenance_icon = (new CSpan())->addClass(ZBX_STYLE_ICON_MAINT)->addClass(ZBX_STYLE_CURSOR_POINTER);
                if (array_key_exists($host['maintenanceid'], $maintenances)) {
                    $maintenance = $maintenances[$host['maintenanceid']];
                    $hint = $maintenance['name'] . ' [' . ($host['maintenance_type'] ? _('Maintenance without data collection') : _('Maintenance with data collection')) . ']';
                    if ($maintenance['description']) {
                        $hint .= "\n" . $maintenance['description'];
                    }
                    $maintenance_icon->setHint($hint);
                }
                $host_name = (new CSpan([$host_name, $maintenance_icon]))->addClass(ZBX_STYLE_REL_CONTAINER);
            }
            $host_list[] = $host_name;
            $host_list[] = ', ';
        }
        array_pop($host_list);
        // unknown triggers
        $unknown = '';
        if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) {
            $unknown = makeUnknownIcon($trigger['error']);
        }
        // trigger has events
        if ($trigger['lastEvent']) {
            // description
            $description = CMacrosResolverHelper::resolveEventDescription(zbx_array_merge($trigger, ['clock' => $trigger['lastEvent']['clock'], 'ns' => $trigger['lastEvent']['ns']]));
        } else {
            // description
            $description = CMacrosResolverHelper::resolveEventDescription(zbx_array_merge($trigger, ['clock' => $trigger['lastchange'], 'ns' => '999999999']));
        }
        if ($config['event_ack_enable']) {
            if ($trigger['lastEvent']) {
                $trigger['lastEvent']['acknowledges'] = $event_acknowledges[$trigger['lastEvent']['eventid']]['acknowledges'];
                $ack = getEventAckState($trigger['lastEvent'], $backurl);
            } else {
                $ack = (new CSpan(_('No events')))->addClass(ZBX_STYLE_GREY);
            }
        } else {
            $ack = null;
        }
        // description
        if ($trigger['lastEvent'] || $trigger['comments'] !== '' || $trigger['url'] !== '') {
            $description = (new CSpan($description))->setHint(make_popup_eventlist($trigger, $backurl), '', true, 'max-width: 500px')->addClass(ZBX_STYLE_LINK_ACTION);
        }
        $description = (new CCol($description))->addClass(getSeverityStyle($trigger['priority']));
        // clock
        $clock = new CLink(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $trigger['lastchange']), 'events.php?filter_set=1&triggerid=' . $trigger['triggerid'] . '&period=' . ZBX_PERIOD_DEFAULT . '&stime=' . date(TIMESTAMP_FORMAT, $trigger['lastchange']));
        // actions
        $action_hint = $trigger['lastEvent'] && isset($actions[$trigger['lastEvent']['eventid']]) ? $actions[$trigger['lastEvent']['eventid']] : SPACE;
        $table->addRow([new CCol($host_list), $description, $clock, zbx_date2age($trigger['lastchange']), $unknown, $ack, (new CCol($action_hint))->addClass(ZBX_STYLE_NOWRAP)]);
    }
    // initialize blinking
    zbx_add_post_js('jqBlink.blink();');
    $info = _n('%1$d of %2$d issue is shown', '%1$d of %2$d issues are shown', count($triggers), $triggers_total_count);
    return [$table, $info];
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:101,代码来源:blocks.inc.php


示例10: 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


示例11: get_item_data_overview_cells

function get_item_data_overview_cells(&$table_row, &$ithosts, $hostname)
{
    $css_class = '';
    unset($it_ov_menu);
    $value = '-';
    $ack = null;
    if (isset($ithosts[$hostname])) {
        if ($ithosts[$hostname]['tr_value'] == TRIGGER_VALUE_TRUE) {
            $css_class = getSeverityStyle($ithosts[$hostname]['severity']);
            $ack = get_last_event_by_triggerid($ithosts[$hostname]['triggerid']);
            $ack = $ack['acknowledged'] == 1 ? array(SPACE, new CImg('images/general/tick.png', 'ack')) : null;
        }
        $value = formatItemValue($ithosts[$hostname]);
        $it_ov_menu = array(array(_('Values'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('500 latest values'), 'history.php?action=showlatest&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')));
        switch ($ithosts[$hostname]['value_type']) {
            case ITEM_VALUE_TYPE_UINT64:
            case ITEM_VALUE_TYPE_FLOAT:
                $it_ov_menu = array_merge(array(array(_('Graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Last hour graph'), 'history.php?period=3600&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(_('Last week graph'), 'history.php?period=604800&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(_('Last month graph'), 'history.php?period=2678400&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank'))), $it_ov_menu);
                break;
            default:
                break;
        }
    }
    if ($value != '-') {
        $value = new CSpan($value, 'link');
    }
    $value_col = new CCol(array($value, $ack), $css_class);
    if (isset($it_ov_menu)) {
        $it_ov_menu = new CPUMenu($it_ov_menu, 170);
        $value_col->onClick($it_ov_menu->getOnActionJS());
        unset($it_ov_menu);
    }
    array_push($table_row, $value_col);
    return $table_row;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:35,代码来源:items.inc.php


示例12: make_trigger_table

function make_trigger_table($triggers, $host_name)
{
    $table = new CTableInfo();
    $table->setHeader(array(_('Host'), _('Problem'), _('Age')));
    foreach ($triggers as $trigger) {
        $description = $trigger["description"];
        $r = new CRow();
        $r->addItem($host_name);
        $r->addItem(new CCol($description, getSeverityStyle($trigger['priority'])));
        $r->addItem(zbx_date2age($trigger['lastchange']));
        $table->addRow($r);
    }
    return $table;
}
开发者ID:sogaoh,项目名称:hyclops,代码行数:14,代码来源:additional_blocks_func.inc.php


示例13: CList

** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
// hint table
$help_hint = (new CList())->addClass(ZBX_STYLE_NOTIF_BODY)->addStyle('min-width: ' . ZBX_OVERVIEW_HELP_MIN_WIDTH . 'px');
for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
    $help_hint->addItem([(new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle($severity)), new CTag('h4', true, getSeverityName($severity, $data['config'])), (new CTag('p', true, _('PROBLEM')))->addClass(ZBX_STYLE_GREY)]);
}
// header right
$help = get_icon('overviewhelp');
$help->setHint($help_hint);
$widget = (new CWidget())->setTitle(_('Overview'))->setControls((new CForm('get'))->cleanItems()->addItem((new CList())->addItem([_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB()])->addItem([_('Type'), SPACE, new CComboBox('type', $this->data['type'], 'submit()', [SHOW_TRIGGERS => _('Triggers'), SHOW_DATA => _('Data')])])->addItem([_('Hosts location'), SPACE, new CComboBox('view_style', $this->data['view_style'], 'submit()', [STYLE_TOP => _('Top'), STYLE_LEFT => _('Left')])])->addItem(get_icon('fullscreen', ['fullscreen' => $this->data['fullscreen']]))->addItem($help)));
// filter
$filter = (new CFilter('web.overview.filter.state'))->addVar('fullscreen', $this->data['fullscreen']);
$column = new CFormList();
// application
$column->addRow(_('Filter by application'), [(new CTextBox('application', $this->data['filter']['application']))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH), (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), (new CButton('application_name', _('Select')))->addClass(ZBX_STYLE_BTN_GREY)->onClick('return PopUp("popup.php?srctbl=applications&srcfld1=name&real_hosts=1&dstfld1=application' . '&with_applications=1&dstfrm=zbx_filter");')]);
$filter->addColumn($column);
$widget->addItem($filter);
// data table
if ($data['pageFilter']->groupsSelected) {
    $dataTable = getItemsDataOverview(array_keys($this->data['pageFilter']->hosts), $this->data['applicationIds'], $this->data['view_style']);
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:monitoring.overview.items.php


示例14: get_trigger_overview_cells

/**
 * Creates and returns a trigger status cell for the trigger overview table.
 *
 * @see get_triggers_overview()
 *
 * @param array $triggerHosts	an array with the data about the trigger for each host
 * @param string $hostName		the name of the cells corresponding host
 * @param string $screenId
 *
 * @return CCol
 */
function get_trigger_overview_cells($triggerHosts, $hostName, $screenId = null)
{
    $ack = null;
    $css_class = null;
    $desc = array();
    $config = select_config();
    // for how long triggers should blink on status change (set by user in administration->general)
    if (isset($triggerHosts[$hostName])) {
        // problem trigger
        if ($triggerHosts[$hostName]['value'] == TRIGGER_VALUE_TRUE) {
            $css_class = getSeverityStyle($triggerHosts[$hostName]['priority']);
            $ack = null;
            if ($config['event_ack_enable'] == 1) {
                $event = get_last_event_by_triggerid($triggerHosts[$hostName]['triggerid']);
                if ($event) {
                    if ($screenId) {
                        global $page;
                        $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&screenid=' . $screenId . '&backurl=' . $page['file']);
                    } else {
                        $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&backurl=overview.php', array('tw' => '_blank'));
                    }
                    if ($event['acknowledged'] == 1) {
                        $ack = new CImg('images/general/tick.png', 'ack');
                    }
                }
            }
        } else {
            $css_class = 'normal';
        }
        $style = 'cursor: pointer; ';
        // set blinking gif as background if trigger age is less then $config['blink_period']
        if ($config['blink_period'] > 0 && time() - $triggerHosts[$hostName]['lastchange'] < $config['blink_period']) {
            $style .= 'background-image: url(images/gradients/blink.gif); background-position: top left; background-repeat: repeat;';
        }
        unset($item_menu);
        $tr_ov_menu = array(array(_('Trigger'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Events'), 'events.php?triggerid=' . $triggerHosts[$hostName]['triggerid'], array('tw' => '_blank')));
        if (isset($ack_menu)) {
            $tr_ov_menu[] = $ack_menu;
        }
        $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=' . $triggerHosts[$hostName]['triggerid']);
        while ($item = DBfetch($dbItems)) {
            $description = itemName($item);
            switch ($item['value_type']) {
                case ITEM_VALUE_TYPE_UINT64:
                case ITEM_VALUE_TYPE_FLOAT:
                    $action = 'showgraph';
                    $status_bar = _('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 = _('Show values of item') . ' \'' . $description . '\'';
                    break;
            }
            if (zbx_strlen($description) > 25) {
                $description = zbx_substr($description, 0, 22) . '...';
            }
            $item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar));
        }
        if (isset($item_menu['showgraph'])) {
            $tr_ov_menu[] = array(_('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(_('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
        $triggerid = !empty($triggerHosts[$hostName]['triggerid']) ? $triggerHosts[$hostName]['triggerid'] : 0;
        $dep_table = new CTableInfo();
        $dep_table->setAttribute('style', 'width: 200px;');
        $dep_table->addRow(bold(_('Depends on') . ':'));
        $dependency = false;
        $dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . $triggerid);
        while ($dep_row = DBfetch($dep_res)) {
            $dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_up']));
            $dependency = true;
        }
        if ($dependency) {
            $img = new Cimg('images/general/arrow_down2.png', 'DEP_DOWN');
            $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
            $img->setHint($dep_table, '', '', false);
            array_push($desc, $img);
        }
        unset($img, $dep_table, $dependency);
        // triggers that depend on this
//.........这里部分代码省略.........
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:triggers.inc.php


示例15: getItemDataOverviewCells

function getItemDataOverviewCells($tableRow, $ithosts, $hostName)
{
    $ack = null;
    $css = '';
    $value = UNKNOWN_VALUE;
    if (isset($ithosts[$hostName])) {
        $item = $ithosts[$hostName];
        if ($item['tr_value'] == TRIGGER_VALUE_TRUE) {
            $css = getSeverityStyle($item['severity']);
            // Display event acknowledgement.
            $config = select_config();
            if ($config['event_ack_enable']) {
                $ack = get_last_event_by_triggerid($item['triggerid']);
                $ack = $ack['acknowledged'] == 1 ? [SPACE, (new CSpan())->addClass(ZBX_STYLE_ICON_ACKN)] : null;
            }
        }
        if ($item['value'] !== null) {
            $value = formatHistoryValue($item['value'], $item);
        }
    }
    if ($value != UNKNOWN_VALUE) {
        $value = $value;
    }
    $column = (new CCol([$value, $ack]))->addClass($css);
    if (isset($ithosts[$hostName])) {
        $column->setMenuPopup(CMenuPopupHelper::getHistory($item))->addClass(ZBX_STYLE_CURSOR_POINTER)->addClass(ZBX_STYLE_NOWRAP);
    }
    $tableRow[] = $column;
    return $tableRow;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:30,代码来源:items.inc.php


示例16: CTableInfo

$hintTable = new CTableInfo();
$hintTable->setAttribute('style', 'width: 200px');
if ($this->data['type'] == SHOW_TRIGGERS) {
    $hintTable->addRow(array(new CCol(SPACE, 'normal'), _('OK')));
}
for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) {
    $hintTable->addRow(array(getSeverityCell($i), _('PROBLEM')));
}
$config = select_config();
if ($this->data['type'] == SHOW_TRIGGERS) {
    // blinking preview in help popup (only if blinking is enabled)
    if ($config['blink_period'] > 0) {
        $row = new CRow(null);
        $row->addItem(new CCol(SPACE, 'normal'));
        for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) {
            $row->addItem(new CCol(SPACE, getSeverityStyle($i)));
        }
        $col = new CTable('', 'blink overview-mon-severities');
        $col->addRow($row);
        // double div necassary for FireFox
        $col = new CCol(new CDiv(new CDiv($col), 'overview-mon-severities-container'));
        $hintTable->addRow(array($col, _s('Age less than %s', convertUnitsS($config['blink_period']))));
    }
    $hintTable->addRow(array(new CCol(SPACE), _('No trigger')));
} else {
    $hintTable->addRow(array(new CCol(SPACE), _('OK or no trigger')));
}
$help = new CHelp('web.view.php', 'right');
$help->setHint($hintTable, '', '', true, false);
// header right
$overviewWidget->addPageHeader(_('OVERVIEW'), array(get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])), SPACE, $help));
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:monitoring.overview.php


示例17: make_latest_issues


//.........这里部分代码省略.........
    foreach ($triggers as $tnum => $trigger) {
        // if trigger is lost (broken expression) we skip it
        if (empty($ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getSharedCalendarId函数代码示例发布时间:2022-05-15
下一篇:
PHP getSeverityCell函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap