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


PHP CSpan::setHint方法代码示例

本文整理汇总了PHP中CSpan::setHint方法的典型用法代码示例。如果您正苦于以下问题:PHP CSpan::setHint方法的具体用法?PHP CSpan::setHint怎么用?PHP CSpan::setHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSpan的用法示例。


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

示例1: make_hoststat_summary


//.........这里部分代码省略.........
            }
            if (!isset($problematic_host_list[$host['hostid']])) {
                $hosts_data[$group['groupid']]['ok']++;
            }
        }
    }
    foreach ($groups as $group) {
        if (!isset($hosts_data[$group['groupid']])) {
            continue;
        }
        $group_row = new CRow();
        if (is_show_all_nodes()) {
            $group_row->addItem($group['nodename']);
        }
        $name = new CLink($group['name'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=0&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE);
        $group_row->addItem($name);
        $group_row->addItem(new CCol($hosts_data[$group['groupid']]['ok'], 'normal'));
        if ($filter['extAck']) {
            if ($hosts_data[$group['groupid']]['lastUnack']) {
                $table_inf = new CTableInfo();
                $table_inf->setAttribute('style', 'width: 400px;');
                $table_inf->setHeader(array(_('Host'), is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_DISASTER]) ? getSeverityCaption(TRIGGER_SEVERITY_DISASTER) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_HIGH]) ? getSeverityCaption(TRIGGER_SEVERITY_HIGH) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_AVERAGE]) ? getSeverityCaption(TRIGGER_SEVERITY_AVERAGE) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_WARNING]) ? getSeverityCaption(TRIGGER_SEVERITY_WARNING) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_INFORMATION]) ? getSeverityCaption(TRIGGER_SEVERITY_INFORMATION) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_NOT_CLASSIFIED]) ? getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED) : null));
                $popup_rows = 0;
                foreach ($group['hosts'] as $host) {
                    $hostid = $host['hostid'];
                    if (!isset($lastUnack_host_list[$hostid])) {
                        continue;
                    }
                    if ($popup_rows >= ZBX_WIDGET_ROWS) {
                        break;
                    }
                    $popup_rows++;
                    $host_data = $lastUnack_host_list[$hostid];
                    $r = new CRow();
                    $r->addItem(new CLink($host_data['host'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=' . $hostid . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE));
                    foreach ($lastUnack_host_list[$host['hostid']]['severities'] as $severity => $trigger_count) {
                        if (!is_null($filter['severity']) && !isset($filter['severity'][$severity])) {
                            continue;
                        }
                        $r->addItem(new CCol($trigger_count, getSeverityStyle($severity, $trigger_count)));
                    }
                    $table_inf->addRow($r);
                }
                $lastUnack_count = new CSpan($hosts_data[$group['groupid']]['lastUnack'], 'pointer red bold');
                $lastUnack_count->setHint($table_inf);
            } else {
                $lastUnack_count = 0;
            }
        }
        // if hostgroup contains problematic hosts, hint should be built
        if ($hosts_data[$group['groupid']]['problematic']) {
            $table_inf = new CTableInfo();
            $table_inf->setAttribute('style', 'width: 400px;');
            $table_inf->setHeader(array(_('Host'), is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_DISASTER]) ? getSeverityCaption(TRIGGER_SEVERITY_DISASTER) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_HIGH]) ? getSeverityCaption(TRIGGER_SEVERITY_HIGH) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_AVERAGE]) ? getSeverityCaption(TRIGGER_SEVERITY_AVERAGE) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_WARNING]) ? getSeverityCaption(TRIGGER_SEVERITY_WARNING) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_INFORMATION]) ? getSeverityCaption(TRIGGER_SEVERITY_INFORMATION) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_NOT_CLASSIFIED]) ? getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED) : null));
            $popup_rows = 0;
            foreach ($group['hosts'] as $host) {
                $hostid = $host['hostid'];
                if (!isset($problematic_host_list[$hostid])) {
                    continue;
                }
                if ($popup_rows >= ZBX_WIDGET_ROWS) {
                    break;
                }
                $popup_rows++;
                $host_data = $problematic_host_list[$hostid];
                $r = new CRow();
                $r->addItem(new CLink($host_data['host'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=' . $hostid . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE));
                foreach ($problematic_host_list[$host['hostid']]['severities'] as $severity => $trigger_count) {
                    if (!is_null($filter['severity']) && !isset($filter['severity'][$severity])) {
                        continue;
                    }
                    $r->addItem(new CCol($trigger_count, getSeverityStyle($severity, $trigger_count)));
                }
                $table_inf->addRow($r);
            }
            $problematic_count = new CSpan($hosts_data[$group['groupid']]['problematic'], 'pointer');
            $problematic_count->setHint($table_inf);
        } else {
            $problematic_count = 0;
        }
        switch ($filter['extAck']) {
            case EXTACK_OPTION_ALL:
                $group_row->addItem(new CCol($problematic_count, 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, 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 ? new CSpan(array($lastUnack_count, SPACE . _('of') . SPACE)) : null;
                $group_row->addItem(new CCol(array($unackspan, $problematic_count), 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);
    }
    $script = new CJSScript(get_js("jQuery('#hat_hoststat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
    return new CDiv(array($table, $script));
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:101,代码来源:blocks.inc.php

示例2: redirect

         $menus = "[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus;
     }
     $menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
     $menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?hostid=" . $trigger_host['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
     $menus = rtrim($menus, ',');
     $menus = 'show_popup_menu(event,[' . $menus . '],180);';
     $maint_span = null;
     if ($trigger_host['maintenance_status']) {
         $text = $trigger_host['maintenance_type'] ? S_NO_DATA_MAINTENANCE : S_NORMAL_MAINTENANCE;
         $text = ' [' . $text . ']';
         $maint_span = new CSpan($text, 'orange pointer');
         $maintenanceOptions = array('maintenanceids' => $trigger_host['maintenanceid'], 'output' => API_OUTPUT_EXTEND);
         $maintenances = CMaintenance::get($maintenanceOptions);
         $maintenance = reset($maintenances);
         $maint_hint = new CSpan($maintenance['name'] . ($maintenance['description'] == '' ? '' : ': ' . $maintenance['description']));
         $maint_span->setHint($maint_hint);
     }
     $hosts_span = new CSpan($trigger_host['host'], 'link_menu');
     $hosts_span->setAttribute('onclick', 'javascript: ' . $menus);
     $hosts_list[] = $hosts_span;
     $hosts_list[] = $maint_span;
     $hosts_list[] = ', ';
 }
 array_pop($hosts_list);
 $host = new CCol($hosts_list);
 $host->addStyle('white-space: normal;');
 // }}} host JS menu
 $status = new CSpan(trigger_value2str($trigger['value']), get_trigger_value_style($trigger['value']));
 if (time() - $trigger['lastchange'] < TRIGGER_BLINK_PERIOD) {
     $status->setAttribute('name', 'blink');
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_status.php

示例3: make_system_summary

function make_system_summary($args = array())
{
    global $USER_DETAILS;
    $config = select_config();
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
    $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY);
    if (isset($args['hosts']) && !empty($args['hosts'])) {
        $available_hosts = zbx_uint_array_intersect($args['hosts'], $available_hosts);
    }
    if (isset($args['groups']) && !empty($args['groups'])) {
        $available_groups = zbx_uint_array_intersect($args['groups'], $available_groups);
    }
    $sql_where = '';
    if (isset($args['severity']) && ctype_digit($args['severity'])) {
        $sql_where = ' AND t.priority>=' . $args['severity'];
    }
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST_GROUP, S_DISASTER, S_HIGH, S_AVERAGE, S_WARNING, S_INFORMATION, S_NOT_CLASSIFIED));
    $sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g, hosts_groups hg, hosts h, items i, functions f, triggers t ' . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBcondition('g.groupid', $available_groups) . ' AND hg.groupid=g.groupid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' ORDER BY g.name';
    $gr_result = DBselect($sql);
    while ($group = DBFetch($gr_result)) {
        $group_row = new CRow();
        if (is_show_all_nodes()) {
            $group_row->addItem(get_node_name_by_elid($group['groupid']));
        }
        $name = new CLink($group['name'], 'tr_status.php?groupid=' . $group['groupid'] . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE);
        $name->setTarget('blank');
        $group_row->addItem($name);
        $tab_priority[TRIGGER_SEVERITY_DISASTER] = 0;
        $tab_priority[TRIGGER_SEVERITY_HIGH] = 0;
        $tab_priority[TRIGGER_SEVERITY_AVERAGE] = 0;
        $tab_priority[TRIGGER_SEVERITY_WARNING] = 0;
        $tab_priority[TRIGGER_SEVERITY_INFORMATION] = 0;
        $tab_priority[TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0;
        $sql = 'SELECT count(DISTINCT t.triggerid) as tr_cnt,t.priority ' . ' FROM hosts h,items i,hosts_groups hg, functions f, triggers t ' . ' WHERE h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND hg.groupid=' . $group['groupid'] . ' AND hg.hostid=h.hostid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.value=' . TRIGGER_VALUE_TRUE . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' GROUP BY t.priority';
        //SDI($sql);
        $tr_result = DBSelect($sql);
        while ($group_stat = DBFetch($tr_result)) {
            $tab_priority[$group_stat['priority']] = $group_stat['tr_cnt'];
        }
        foreach ($tab_priority as $key => $value) {
            $tr_count = 0;
            if ($value) {
                //* trigger list
                $table_inf = new CTableInfo();
                $table_inf->setAttribute('style', 'width: 400px;');
                $table_inf->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST, S_ISSUE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
                $sql = 'SELECT DISTINCT t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.value,h.host,h.hostid ' . ' FROM triggers t,hosts h,items i,functions f, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND hg.groupid=' . $group['groupid'] . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND t.value=' . TRIGGER_VALUE_TRUE . ' AND t.priority=' . $key . ' ORDER BY t.lastchange DESC';
                $result = DBselect($sql);
                while ($row_inf = DBfetch($result)) {
                    // Check for dependencies
                    if (trigger_dependent($row_inf["triggerid"])) {
                        continue;
                    }
                    $tr_count++;
                    if ($tr_count > 30) {
                        continue;
                    }
                    $host = new CSpan($row_inf['host']);
                    $event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type ' . ' FROM events e, triggers t ' . ' WHERE e.object=' . EVENT_SOURCE_TRIGGERS . ' AND e.objectid=' . $row_inf['triggerid'] . ' AND t.triggerid=e.objectid ' . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
                    if ($row_inf_event = DBfetch(DBselect($event_sql, 1))) {
                        if ($config['event_ack_enable']) {
                            if ($row_inf_event['acknowledged'] == 1) {
                                $ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_inf_event['eventid'], 'action');
                            } else {
                                $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_inf_event['eventid'], 'on');
                            }
                        }
                        $description = expand_trigger_description_by_data(array_merge($row_inf, array('clock' => $row_inf_event['clock'])), ZBX_FLAG_EVENT);
                        //actions
                        $actions = get_event_actions_status($row_inf_event['eventid']);
                        //--------
                    } else {
                        $description = expand_trigger_description_by_data($row_inf, ZBX_FLAG_EVENT);
                        $ack = '-';
                        $actions = S_NO_DATA_SMALL;
                        $row_inf_event['clock'] = $row_inf['clock'];
                    }
                    $table_inf->addRow(array(get_node_name_by_elid($row_inf['triggerid']), $host, new CCol($description, get_severity_style($row_inf['priority'])), zbx_date2age($row_inf_event['clock']), $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, $actions));
                    unset($row_inf, $description, $actions);
                }
                $value = new CSpan($tr_count, 'pointer');
                $value->setHint($table_inf);
                //-------------*/
            }
            $group_row->AddItem(new CCol($value, get_severity_style($key, $tr_count)));
            unset($table_inf);
        }
        $table->addRow($group_row);
    }
    $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time())));
    return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:94,代码来源:blocks.inc.php

示例4: array

    $delay = count_operations_delay($this->data['action']['operations'], $this->data['action']['esc_period']);
} else {
    $operationsTable->setHeader(array(_('Details'), _('Action')));
}
foreach ($this->data['action']['operations'] as $operationid => $operation) {
    if (!str_in_array($operation['operationtype'], $this->data['allowedOperations'])) {
        continue;
    }
    if (!isset($operation['opconditions'])) {
        $operation['opconditions'] = array();
    }
    if (!isset($operation['mediatypeid'])) {
        $operation['mediatypeid'] = 0;
    }
    $details = new CSpan(get_operation_descr(SHORT_DESCRIPTION, $operation));
    $details->setHint(get_operation_descr(LONG_DESCRIPTION, $operation));
    if ($this->data['eventsource'] == EVENT_SOURCE_TRIGGERS || $this->data['eventsource'] == EVENT_SOURCE_INTERNAL) {
        $esc_steps_txt = null;
        $esc_period_txt = null;
        $esc_delay_txt = null;
        if ($operation['esc_step_from'] < 1) {
            $operation['esc_step_from'] = 1;
        }
        $esc_steps_txt = $operation['esc_step_from'] . ' - ' . $operation['esc_step_to'];
        // display N-N as N
        $esc_steps_txt = $operation['esc_step_from'] == $operation['esc_step_to'] ? $operation['esc_step_from'] : $operation['esc_step_from'] . ' - ' . $operation['esc_step_to'];
        $esc_period_txt = $operation['esc_period'] ? $operation['esc_period'] : _('Default');
        $esc_delay_txt = $delay[$operation['esc_step_from']] ? convert_units(array('value' => $delay[$operation['esc_step_from']], 'units' => 'uptime')) : _('Immediately');
        $operationRow = array($esc_steps_txt, $details, $esc_delay_txt, $esc_period_txt, array(new CSubmit('edit_operationid[' . $operationid . ']', _('Edit'), null, 'link_menu'), SPACE, SPACE, SPACE, array(new CButton('remove', _('Remove'), 'javascript: removeOperation(' . $operationid . ');', 'link_menu'), new CVar('operations[' . $operationid . ']', $operation))));
    } else {
        $operationRow = array($details, array(new CSubmit('edit_operationid[' . $operationid . ']', _('Edit'), null, 'link_menu'), SPACE, SPACE, SPACE, array(new CButton('remove', _('Remove'), 'javascript: removeOperation(' . $operationid . ');', 'link_menu'), new CVar('operations[' . $operationid . ']', $operation))));
开发者ID:itnihao,项目名称:Zabbix_,代码行数:31,代码来源:configuration.action.edit.php

示例5: CTable

 function stage2()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $finalResult = FrontendSetup::CHECK_OK;
     $table->addRow(array(SPACE, new CCol(_('Current value'), 'header'), new CCol(_('Required'), 'header')));
     $frontendSetup = new FrontendSetup();
     $reqs = $frontendSetup->checkRequirements();
     foreach ($reqs as $req) {
         $result = null;
         // OK
         if ($req['result'] == FrontendSetup::CHECK_OK) {
             $rowClass = '';
             $result = new CSpan(_('OK'), 'ok');
         } elseif ($req['result'] == FrontendSetup::CHECK_WARNING) {
             $rowClass = 'notice';
             $result = new CSpan(_x('Warning', 'setup'), 'link_menu notice');
             $result->setHint($req['error']);
         } else {
             $rowClass = 'fail';
             $result = new CSpan(_('Fail'), 'link_menu fail');
             $result->setHint($req['error']);
         }
         $table->addRow(array(new CCol($req['name'], 'header'), $req['current'], $req['required'] ? $req['required'] : SPACE, $result), $rowClass);
         $finalResult = max($finalResult, $req['result']);
     }
     // fatal error
     if ($finalResult == FrontendSetup::CHECK_FATAL) {
         $this->DISABLE_NEXT_BUTTON = true;
         $message = array(_('Please correct all issues and press "Retry" button'), BR(), new CSubmit('retry', _('Retry')));
     } else {
         $this->DISABLE_NEXT_BUTTON = false;
         $message = array(new CSpan(_('OK'), 'ok'));
         // add a warning message
         if ($finalResult == FrontendSetup::CHECK_WARNING) {
             $message[] = BR();
             $message[] = _('(with warnings)');
         }
     }
     return array(new CDiv(array(BR(), $table, BR()), 'table_wraper'), new CDiv($message, 'info_bar'));
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:41,代码来源:setup.inc.php

示例6: getEventActionsStatHints

function getEventActionsStatHints($eventIds)
{
    if (empty($eventIds)) {
        return array();
    }
    $actions = array();
    $alerts = DBselect('SELECT a.eventid,a.status,COUNT(a.alertid) AS cnt' . ' FROM alerts a' . ' WHERE a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND ' . dbConditionInt('a.eventid', $eventIds) . ' GROUP BY eventid,status');
    while ($alert = DBfetch($alerts)) {
        if ($alert['cnt'] > 0) {
            if ($alert['status'] == ALERT_STATUS_SENT) {
                $color = 'green';
            } elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
                $color = 'orange';
            } else {
                $color = 'red';
            }
            $hint = new CSpan($alert['cnt'], $color);
            $hint->setHint(get_actions_hint_by_eventid($alert['eventid'], $alert['status']));
            $actions[$alert['eventid']][$alert['status']] = $hint;
        }
    }
    foreach ($actions as $eventId => $action) {
        $actions[$eventId] = new CDiv(null, 'event-action-cont');
        $actions[$eventId]->addItem(array(new CDiv(isset($action[ALERT_STATUS_SENT]) ? $action[ALERT_STATUS_SENT] : SPACE), new CDiv(isset($action[ALERT_STATUS_NOT_SENT]) ? $action[ALERT_STATUS_NOT_SENT] : SPACE), new CDiv(isset($action[ALERT_STATUS_FAILED]) ? $action[ALERT_STATUS_FAILED] : SPACE)));
    }
    return $actions;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:27,代码来源:actions.inc.php

示例7: get_event_actions_stat_hints

function get_event_actions_stat_hints($eventid)
{
    $actions = new CTable(' - ');
    $sql = 'SELECT COUNT(a.alertid) as cnt ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')';
    $alerts = DBfetch(DBselect($sql));
    if (isset($alerts['cnt']) && $alerts['cnt'] > 0) {
        $sql = 'SELECT COUNT(a.alertid) as sent ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_SENT;
        $alerts = DBfetch(DBselect($sql));
        $alert_cnt = new CSpan($alerts['sent'], 'green');
        if ($alerts['sent']) {
            $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_SENT);
            $alert_cnt->SetHint($hint);
        }
        $tdl = new CCol($alerts['sent'] ? $alert_cnt : SPACE);
        $tdl->addOption('width', '10');
        $sql = 'SELECT COUNT(a.alertid) as inprogress ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_NOT_SENT;
        $alerts = DBfetch(DBselect($sql));
        $alert_cnt = new CSpan($alerts['inprogress'], 'orange');
        if ($alerts['inprogress']) {
            $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_NOT_SENT);
            $alert_cnt->setHint($hint);
        }
        $tdc = new CCol($alerts['inprogress'] ? $alert_cnt : SPACE);
        $tdc->addOption('width', '10');
        $sql = 'SELECT COUNT(a.alertid) as failed ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_FAILED;
        $alerts = DBfetch(DBselect($sql));
        $alert_cnt = new CSpan($alerts['failed'], 'red');
        if ($alerts['failed']) {
            $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_FAILED);
            $alert_cnt->setHint($hint);
        }
        $tdr = new CCol($alerts['failed'] ? $alert_cnt : SPACE);
        $tdr->addOption('width', '10');
        $actions->addRow(array($tdl, $tdc, $tdr));
    }
    return $actions;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:37,代码来源:actions.inc.php

示例8: CSpan

        $step['url'] = '';
    }
    if (!isset($step['posts'])) {
        $step['posts'] = '';
    }
    if (!isset($step['required'])) {
        $step['required'] = '';
    }
    $numSpan = new CSpan($i++ . ':');
    $numSpan->addClass('rowNum');
    $numSpan->setAttribute('id', 'current_step_' . $stepid);
    $name = new CSpan($step['name'], 'link');
    $name->setAttributes(array('id' => 'name_' . $stepid, 'name_step' => $stepid));
    if (zbx_strlen($step['url']) > 70) {
        $url = new CSpan(substr($step['url'], 0, 35) . SPACE . '...' . SPACE . substr($step['url'], zbx_strlen($step['url']) - 25, 25));
        $url->setHint($step['url']);
    } else {
        $url = $step['url'];
    }
    if ($this->data['templated']) {
        $removeButton = SPACE;
        $dragHandler = SPACE;
    } else {
        $removeButton = new CButton('remove_' . $stepid, _('Remove'), 'javascript: removeStep(this);', 'link_menu');
        $removeButton->setAttribute('remove_step', $stepid);
        $dragHandler = new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move');
    }
    $row = new CRow(array($dragHandler, $numSpan, $name, $step['timeout'] . SPACE . _('sec'), $url, htmlspecialchars($step['required']), $step['status_codes'], $removeButton), 'sortable', 'steps_' . $stepid);
    $stepsTable->addRow($row);
}
if (!$this->data['templated']) {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:configuration.httpconf.edit.php

示例9: CSpan

         $triggerDescription[] = new CSpan(CHtml::encode($trigger['description']));
     } else {
         $triggerDescription[] = new CLink(CHtml::encode($trigger['description']), 'triggers.php?form=update&hostid=' . key($trigger['hosts']) . '&triggerid=' . $trigger['triggerid']);
     }
     if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) {
         $trigger['error'] = '';
     }
     $trigger['items'] = zbx_toHash($trigger['items'], 'itemid');
     $trigger['functions'] = zbx_toHash($trigger['functions'], 'functionid');
     $triggerHintTable->addRow(array(getSeverityCell($trigger['priority']), $triggerDescription, triggerExpression($trigger, true), new CSpan(triggerIndicator($trigger['status'], $trigger['state']), triggerIndicatorStyle($trigger['status'], $trigger['state']))));
     $item['triggers'][$num] = $trigger;
 }
 unset($trigger);
 if (!empty($item['triggers'])) {
     $triggerInfo = new CSpan(_('Triggers'), 'link_menu');
     $triggerInfo->setHint($triggerHintTable);
     $triggerInfo = array($triggerInfo);
     $triggerInfo[] = ' (' . count($item['triggers']) . ')';
     $triggerHintTable = array();
 } else {
     $triggerInfo = SPACE;
 }
 // if item type is 'Log' we must show log menu
 if (in_array($item['value_type'], array(ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_TEXT))) {
     $triggers = array();
     foreach ($item['triggers'] as $trigger) {
         foreach ($trigger['functions'] as $function) {
             if (!str_in_array($function['function'], array('regexp', 'iregexp'))) {
                 continue 2;
             }
         }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:configuration.item.list.php

示例10: make_hint_row

function make_hint_row($type, $instance)
{
    $state = $instance['state'];
    if ($type == "other" && $instance["stuck_state"] == 1) {
        $state = "stuck";
    }
    $r = new CRow();
    if (in_array($type, array("poweron", "poweroff", "suspend"))) {
        $r->addItem(new CCheckBox("hostids[]", null, null, $instance['hostid']));
    }
    $hostScripts = API::Script()->getScriptsByHosts(zbx_objectValues(array($instance['host']), 'hostid'));
    $hostSpan = new CSpan(nbsp($instance['name']), 'link_menu menu-host');
    $hostSpan->setAttribute('data-menu', hostMenuData($instance['host'], $hostScripts[$instance['hostid']]));
    $r->addItem($hostSpan);
    $r->addItem(new CCol($state, get_item_level($state)));
    $r->addItem($instance['cpu']);
    $r->addItem($instance['memory']);
    $r->addItem($instance['main_interface']);
    if ($type == "other" && $instance["stuck_state"] == 1) {
        $question = $instance['stuck_question'];
        $json = new CJSON();
        $choiceinfos = $json->decode($instance['stuck_choices'], true);
        $answer_form = new CForm();
        $answer_form->setAction('#');
        $answer_form->setAttribute('id', "answer");
        $answer_form->addVar("driver", "vsphere");
        $answer_form->addVar("hostids[]", $instance['hostid']);
        $instancename = $instance['host']['host'];
        $answer_button = new CButton('answer', _('Answer'), "return checkAnswer('answer', 'choice', '{$instancename}', 'Execute');");
        $choice_table = new CTableInfo();
        foreach ($choiceinfos as $choice) {
            $radio = new CRadioButton('choice', $choice['key']);
            $label = new CLabel($choice['label']);
            $choice_table->addRow(new CRow(array($radio, $label)));
        }
        $answer_form->addItem($choice_table);
        $answer_form->addItem($answer_button);
        $question_span = new CSpan($question);
        $question_span->setHint($answer_form);
        $question_col = new CCol($question_span, 'warning');
        $r->addItem($question_col);
    } else {
        if ($type == "poweron") {
            $ssh_link = new CLink(_('connect'), "gateone.php?hostid={$instance['hostid']}");
            $ssh_link->setTarget("_blank");
            $r->addItem($ssh_link);
        }
    }
    return $r;
}
开发者ID:sogaoh,项目名称:hyclops,代码行数:50,代码来源:additional_blocks_func.inc.php

示例11: CTable

 function stage2()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $final_result = true;
     $table->addRow(array(SPACE, new CCol('Current value', 'header'), new CCol('Required', 'header'), new CCol('Recommended', 'header'), SPACE, SPACE));
     $reqs = check_php_requirements();
     foreach ($reqs as $req) {
         $result = null;
         if (!is_null($req['recommended']) && $req['result'] == 1) {
             $result = new CSpan(S_OK, 'orange');
         } else {
             if (!is_null($req['recommended']) && $req['result'] == 2 || is_null($req['recommended']) && $req['result'] == 1) {
                 $result = new CSpan(S_OK, 'green');
             } else {
                 if ($req['result'] == 0) {
                     $result = new CSpan(S_FAIL, 'link_menu fail');
                     $result->setHint($req['error']);
                 }
             }
         }
         $table->addRow(array(new CCol($req['name'], 'header'), $req['current'], $req['required'] ? $req['required'] : SPACE, $req['recommended'] ? $req['recommended'] : SPACE, $result), $req['result'] ? SPACE : 'fail');
         $final_result &= (bool) $req['result'];
     }
     if (!$final_result) {
         $this->DISABLE_NEXT_BUTTON = true;
         $this->addVar('trouble', true);
         $final_result = array(new CSpan(S_FAIL, 'fail'), BR(), BR(), 'Please correct all issues and press "Retry" button', BR(), BR(), new CButton('retry', S_RETRY));
     } else {
         $this->DISABLE_NEXT_BUTTON = false;
         $final_result = new CSpan(S_OK, 'ok');
     }
     return array($table, BR(), $final_result);
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:34,代码来源:setup.inc.php

示例12: make_awsstat_summary

function make_awsstat_summary($preloading = false)
{
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, _('Account name'), _('PoweredOn'), _('PoweredOff'), _('Billing/Month')));
    $script_itemkey = 'push_message.py[{$HYCLOPS_SERVER},{$HYCLOPS_PORT},ec2,{HOST.HOST}]';
    $aws_accounts = get_aws_accounts();
    if (empty($aws_accounts)) {
        return null;
    }
    foreach ($aws_accounts as $host) {
        if (!$preloading) {
            if (is_script_success($host['hostid'], $script_itemkey)) {
                $instances = get_instances($host['hostid']);
                $instances = filter_instances($instances);
                $r = new CRow();
                // Account name
                $col = new CCol($host['host']);
                $r->addItem($col);
                // Poweron (running + pending)
                $poweron_vms = array_merge($instances["running"], $instances["pending"]);
                $poweron_count = new CSpan(count($poweron_vms), 'pointer');
                if (!empty($poweron_vms)) {
                    $poweron_count->setHint(make_ec2_table('ec2_poweron', $poweron_vms));
                }
                $r->addItem(new CCol($poweron_count));
                // Poweroff (stopped + terminated + stopping + shutting-down)
                $poweroff_vms = $instances["stopped"];
                $poweroff_count = new CSpan(count($poweroff_vms), 'pointer');
                if (!empty($poweroff_vms)) {
                    $poweroff_count->setHint(make_ec2_table('ec2_poweroff', $poweroff_vms));
                }
                $r->addItem(new CCol($poweroff_count));
                // AWS Charges
                $item = get_item_by_key('get_aws_charges.py[{$KEY},{$SECRET}]', $host["host"]);
                if (array_key_exists('lastvalue', $item)) {
                    $r->addItem(new CLink($item["lastvalue"], "history.php?action=showgraph&itemid={$item["itemid"]}"));
                } else {
                    $r->addItem(new CCol(_('No data')));
                }
                $table->addRow($r);
                zbx_add_post_js('chkbxRange.pageGoName = "vms";');
            } else {
                $r = new CRow();
                $r->addItem($host['host']);
                $r->addItem(new CCol(_('script failed'), "high"));
                $r->addItem(array("-"));
                $table->addRow($r);
            }
        } else {
            $r = new CRow();
            $r->addItem($host['host']);
            $r->addItem(new CCol(_('loading...')));
            $r->addItem(array("-"));
            $table->addRow($r);
        }
    }
    $script = new CJSScript(get_js("jQuery('#hat_awsstat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
    return new CDiv(array($table, $script));
}
开发者ID:sogaoh,项目名称:hyclops,代码行数:59,代码来源:additional_blocks.inc.php

示例13: make_latest_issues

function make_latest_issues($filter = array())
{
    global $page;
    $config = select_config();
    $limit = isset($filter['limit']) ? $filter['limit'] : 20;
    $options = array('groupids' => $filter['groupids'], 'monitored' => 1, 'maintenance' => $filter['maintenance'], 'skipDependent' => 1, 'filter' => array('priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE), 'select_groups' => API_OUTPUT_EXTEND, 'select_hosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'sortfield' => 'lastchange', 'sortorder' => ZBX_SORT_DOWN, 'limit' => $limit);
    if (isset($filter['hostids'])) {
        $options['hostids'] = $filter['hostids'];
    }
    $triggers = CTrigger::get($options);
    // GATHER HOSTS FOR SELECTED TRIGGERS {{{
    $triggers_hosts = array();
    foreach ($triggers as $tnum => $trigger) {
        // if trigger is lost(broken expression) we skip it
        if (empty($trigger['hosts'])) {
            unset($triggers[$tnum]);
            continue;
        }
        $triggers_hosts = array_merge($triggers_hosts, $trigger['hosts']);
    }
    $triggers_hosts = zbx_toHash($triggers_hosts, 'hostid');
    $triggers_hostids = array_keys($triggers_hosts);
    // }}} GATHER HOSTS FOR SELECTED TRIGGERS
    $scripts_by_hosts = CScript::getScriptsByHosts($triggers_hostids);
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST, S_ISSUE, S_LAST_CHANGE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
    $thosts_cache = array();
    foreach ($triggers as $tnum => $trigger) {
        // Check for dependencies
        $group = reset($trigger['groups']);
        $host = reset($trigger['hosts']);
        $trigger['hostid'] = $host['hostid'];
        $trigger['host'] = $host['host'];
        $host = null;
        $menus = '';
        $host_nodeid = id2nodeid($trigger['hostid']);
        foreach ($scripts_by_hosts[$trigger['hostid']] as $id => $script) {
            $script_nodeid = id2nodeid($script['scriptid']);
            if (bccomp($host_nodeid, $script_nodeid) == 0) {
                $menus .= "[" . zbx_jsvalue($script['name']) . ",\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
            }
        }
        if (!empty($scripts_by_hosts)) {
            $menus = "['" . S_TOOLS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus;
        }
        if (isset($thosts_cache[$trigger['hostid']])) {
            $hprofile = $thosts_cache[$trigger['hostid']];
        } else {
            $hprofile = CHost::get(array('hostids' => $trigger['hostid'], 'output' => API_OUTPUT_SHORTEN, 'select_profile' => API_OUTPUT_EXTEND));
            $hprofile = reset($hprofile);
            $thosts_cache[$hprofile['hostid']] = $hprofile;
        }
        $menus .= "['" . S_LINKS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
        $menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?groupid=" . $group['groupid'] . '&hostid=' . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        if (!empty($hprofile['profile'])) {
            $menus .= "['" . S_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=0')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
        if (!empty($hprofile['profile_ext'])) {
            $menus .= "['" . S_EXTENDED_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=1')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
        $menus = rtrim($menus, ',');
        $menus = 'show_popup_menu(event,[' . $menus . '],180);';
        $host = new CSpan($trigger['host'], 'link_menu pointer');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        //$host = new CSpan($trigger['host'],'link_menu pointer');
        //$host->setAttribute('onclick','javascript: '.$menus);
        // Maintenance {{{
        $trigger_host = $triggers_hosts[$trigger['hostid']];
        $text = null;
        $style = 'link_menu';
        if ($trigger_host['maintenance_status']) {
            $style .= ' orange';
            $options = array('maintenanceids' => $trigger_host['maintenanceid'], 'output' => API_OUTPUT_EXTEND);
            $maintenances = CMaintenance::get($options);
            $maintenance = reset($maintenances);
            $text = $maintenance['name'];
            $text .= ' [' . ($trigger_host['maintenance_type'] ? S_NO_DATA_MAINTENANCE : S_NORMAL_MAINTENANCE) . ']';
        }
        $host = new CSpan($trigger['host'], $style . ' pointer');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        if (!is_null($text)) {
            $host->setHint($text, '', '', false);
        }
        // }}} Maintenance
        $event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged' . ' FROM events e' . ' WHERE e.object=' . EVENT_OBJECT_TRIGGER . ' AND e.objectid=' . $trigger['triggerid'] . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
        $res_events = DBSelect($event_sql, 1);
        while ($row_event = DBfetch($res_events)) {
            $ack = NULL;
            if ($config['event_ack_enable']) {
                if ($row_event['acknowledged'] == 1) {
                    $ack_info = make_acktab_by_eventid($row_event['eventid']);
                    $ack_info->setAttribute('style', 'width: auto;');
                    $ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'off');
                    $ack->setHint($ack_info, '', '', false);
                } else {
                    $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'on');
                }
            }
            //			$description = expand_trigger_description($row['triggerid']);
            $description = expand_trigger_description_by_data(zbx_array_merge($trigger, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:blocks.inc.php

示例14: CTable

 function stage2()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $final_result = true;
     $table->addRow(array(SPACE, new CCol(_('Current value'), 'header'), new CCol(_('Required'), 'header')));
     $reqs = FrontendSetup::i()->checkRequirements();
     foreach ($reqs as $req) {
         $result = null;
         if ($req['result']) {
             $result = new CSpan(_('OK'), 'green');
         } else {
             $result = new CSpan(_('Fail'), 'link_menu fail');
             $result->setHint($req['error']);
         }
         $table->addRow(array(new CCol($req['name'], 'header'), $req['current'], $req['required'] ? $req['required'] : SPACE, $result), $req['result'] ? SPACE : 'fail');
         $final_result &= (bool) $req['result'];
     }
     if (!$final_result) {
         $this->DISABLE_NEXT_BUTTON = true;
         $this->addVar('trouble', true);
         $final_result = array(_('Please correct all issues and press "Retry" button'), BR(), new CSubmit('retry', _('Retry')));
     } else {
         $this->DISABLE_NEXT_BUTTON = false;
         $final_result = array(new CSpan(_('OK'), 'ok'));
     }
     return array(new CDiv(array(BR(), $table, BR()), 'table_wraper'), new CDiv($final_result, 'info_bar'));
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:28,代码来源:setup.inc.php

示例15: CSpan

             $priority = $trigger['priority'];
     }
     if ($trigger['status'] == TRIGGER_STATUS_DISABLED) {
         $tstatus = new CSpan(S_DISABLED, 'disabled');
     } else {
         if ($trigger['status'] == TRIGGER_STATUS_ENABLED) {
             $tstatus = new CSpan(S_ENABLED, 'enabled');
         }
     }
     $trigger_hint->addRow(array($priority, $tr_description, triggerExpression($trigger, 1), $tstatus));
     $item['triggers'][$tnum] = $trigger;
 }
 unset($trigger);
 if (!empty($item['triggers'])) {
     $trigger_info = new CSpan(S_TRIGGERS, 'link_menu');
     $trigger_info->setHint($trigger_hint);
     $trigger_info = array($trigger_info);
     $trigger_info[] = ' (' . count($item['triggers']) . ')';
     $trigger_hint = array();
 } else {
     $trigger_info = SPACE;
 }
 //-------
 // if item type is 'Log' we must show log menu
 if ($item['value_type'] == ITEM_VALUE_TYPE_LOG || $item['value_type'] == ITEM_VALUE_TYPE_STR || $item['value_type'] == ITEM_VALUE_TYPE_TEXT) {
     $triggers_flag = false;
     $triggers = "Array('" . S_EDIT_TRIGGER . "',null,null,{'outer' : 'pum_o_submenu','inner' : ['pum_i_submenu']}\n";
     foreach ($item['triggers'] as $num => $trigger) {
         foreach ($trigger['functions'] as $fnum => $function) {
             if (!str_in_array($function['function'], array('regexp', 'iregexp'))) {
                 continue 2;
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:items.php


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