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


PHP CTableInfo::setAttribute方法代码示例

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


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

示例1: foreach

     $discoveryTable->addRow($col);
 }
 order_result($discovery_info, $this->data['sort'], $this->data['sortorder']);
 foreach ($discovery_info as $ip => $h_data) {
     $dns = $h_data['dns'] == '' ? '' : ' (' . $h_data['dns'] . ')';
     $row = array($h_data['type'] == 'primary' ? new CSpan($ip . $dns, $h_data['class']) : new CSpan(SPACE . SPACE . $ip . $dns), new CSpan(empty($h_data['host']) ? '-' : $h_data['host']), new CSpan($h_data['time'] == 0 || $h_data['type'] === 'slave' ? '' : convert_units(array('value' => time() - $h_data['time'], 'units' => 'uptime')), $h_data['class']));
     foreach ($this->data['services'] as $name => $foo) {
         $class = null;
         $time = SPACE;
         $hint = new CDiv(SPACE, $class);
         $hintTable = null;
         if (isset($h_data['services'][$name])) {
             $class = $h_data['services'][$name]['class'];
             $time = $h_data['services'][$name]['time'];
             $hintTable = new CTableInfo();
             $hintTable->setAttribute('style', 'width: auto;');
             if ($class == 'active') {
                 $hintTable->setHeader(_('Uptime'));
             } elseif ($class == 'inactive') {
                 $hintTable->setHeader(_('Downtime'));
             }
             $timeColumn = new CCol(zbx_date2age($h_data['services'][$name]['time']), $class);
             $hintTable->addRow($timeColumn);
         }
         $column = new CCol($hint, $class);
         if (!is_null($hintTable)) {
             $column->setHint($hintTable);
         }
         $row[] = $column;
     }
     $discoveryTable->addRow($row);
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:monitoring.discovery.php

示例2: bold

    $status['msg'] = $httpTestData['error'] === null ? _('Unknown error') : _s('Error: %1$s', $httpTestData['error']);
    $status['style'] = 'disabled';
} else {
    $status['msg'] = _('OK');
    $status['style'] = 'enabled';
}
$httpdetailsTable->addRow(array(bold(_('TOTAL')), SPACE, bold($totalTime['value'] ? formatHistoryValue($totalTime['value'], $totalTime) : UNKNOWN_VALUE), SPACE, new CSpan($status['msg'], $status['style'] . ' bold')));
$httpdetailsWidget->addItem($httpdetailsTable);
$httpdetailsWidget->show();
echo SBR;
// create graphs widget
$graphsWidget = new CWidget();
$graphsWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.httpdetails.filter.state', 0));
$graphsWidget->addItem(SPACE);
$graphTable = new CTableInfo();
$graphTable->setAttribute('id', 'graph');
// dims
$graphDims = getGraphDims();
$graphDims['shiftYtop'] += 1;
$graphDims['width'] = -120;
$graphDims['graphHeight'] = 150;
/*
 * Graph in
 */
$graphInScreen = new CScreenBase(array('resourcetype' => SCREEN_RESOURCE_GRAPH, 'mode' => SCREEN_MODE_PREVIEW, 'dataId' => 'graph_in', 'profileIdx' => 'web.httptest', 'profileIdx2' => get_request('httptestid'), 'period' => get_request('period'), 'stime' => get_request('stime')));
$graphInScreen->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($itemIds));
$src = 'chart3.php?height=150' . '&name=' . $httpTest['name'] . '&http_item_type=' . HTTPSTEP_ITEM_TYPE_IN . '&httptestid=' . $httpTest['httptestid'] . '&graphtype=' . GRAPH_TYPE_STACKED . '&period=' . $graphInScreen->timeline['period'] . '&stime=' . $graphInScreen->timeline['stime'] . '&profileIdx=' . $graphInScreen->profileIdx . '&profileIdx2=' . $graphInScreen->profileIdx2;
$graphInContainer = new CDiv(new CLink(null, $src), 'flickerfreescreen', 'flickerfreescreen_graph_in');
$graphInContainer->setAttribute('style', 'position: relative');
$graphInContainer->setAttribute('data-timestamp', time());
$graphTable->addRow(array(bold(_('Speed')), $graphInContainer));
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:httpdetails.php

示例3: get_actions_hint_by_eventid

function get_actions_hint_by_eventid($eventid, $status = null)
{
    $tab_hint = new CTableInfo(_('No actions found.'));
    $tab_hint->setAttribute('style', 'width: 300px;');
    $tab_hint->setHeader(array(is_show_all_nodes() ? _('Nodes') : null, _('User'), _('Details'), _('Status')));
    $sql = 'SELECT a.alertid,mt.description,u.alias,u.name,u.surname,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype' . ' FROM events e,alerts a' . ' LEFT JOIN users u ON u.userid=a.userid' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . zbx_dbstr($eventid) . (is_null($status) ? '' : ' AND a.status=' . $status) . ' AND e.eventid=a.eventid' . ' AND a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . andDbNode('a.alertid') . ' ORDER BY a.alertid';
    $result = DBselect($sql, 30);
    while ($row = DBfetch($result)) {
        if ($row['status'] == ALERT_STATUS_SENT) {
            $status = new CSpan(_('Sent'), 'green');
        } elseif ($row['status'] == ALERT_STATUS_NOT_SENT) {
            $status = new CSpan(_('In progress'), 'orange');
        } else {
            $status = new CSpan(_('not sent'), 'red');
        }
        switch ($row['alerttype']) {
            case ALERT_TYPE_MESSAGE:
                $message = empty($row['description']) ? '-' : $row['description'];
                break;
            case ALERT_TYPE_COMMAND:
                $message = array(bold(_('Command') . NAME_DELIMITER));
                $msg = explode("\n", $row['message']);
                foreach ($msg as $m) {
                    array_push($message, BR(), $m);
                }
                break;
            default:
                $message = '-';
        }
        if (!$row['alias']) {
            $row['alias'] = ' - ';
        } else {
            $fullname = '';
            if ($row['name']) {
                $fullname = $row['name'];
            }
            if ($row['surname']) {
                $fullname .= $fullname ? ' ' . $row['surname'] : $row['surname'];
            }
            if ($fullname) {
                $row['alias'] .= ' (' . $fullname . ')';
            }
        }
        $tab_hint->addRow(array(get_node_name_by_elid($row['alertid']), $row['alias'], $message, $status));
    }
    return $tab_hint;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:47,代码来源:actions.inc.php

示例4: get_trigger_overview_cells

function get_trigger_overview_cells(&$table_row, &$trhosts, &$hostname)
{
    $css_class = NULL;
    unset($tr_ov_menu);
    $ack = null;
    if (isset($trhosts[$hostname])) {
        unset($ack_menu);
        switch ($trhosts[$hostname]['value']) {
            case TRIGGER_VALUE_TRUE:
                $css_class = get_severity_style($trhosts[$hostname]['priority']);
                if ($ack = get_last_event_by_triggerid($trhosts[$hostname]['triggerid'])) {
                    $ack_menu = array(S_ACKNOWLEDGE, 'acknow.php?eventid=' . $ack['eventid'], array('tw' => '_blank'));
                }
                if (1 == $ack['acknowledged']) {
                    $ack = new CImg('images/general/tick.png', 'ack');
                } else {
                    $ack = null;
                }
                break;
            case TRIGGER_VALUE_FALSE:
                $css_class = 'normal';
                break;
            default:
                $css_class = 'unknown_trigger';
        }
        $style = 'cursor: pointer; ';
        if (time(NULL) - $trhosts[$hostname]['lastchange'] < 300) {
            $style .= 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;';
        } else {
            if (time(NULL) - $trhosts[$hostname]['lastchange'] < 900) {
                $style .= 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;';
            }
        }
        unset($item_menu);
        $tr_ov_menu = array(array(S_TRIGGER, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_EVENTS, 'events.php?triggerid=' . $trhosts[$hostname]['triggerid'], array('tw' => '_blank')));
        if (isset($ack_menu)) {
            $tr_ov_menu[] = $ack_menu;
        }
        $db_items = DBselect('select distinct i.itemid, i.description, i.key_, i.value_type ' . ' from items i, functions f ' . ' where f.itemid=i.itemid and f.triggerid=' . $trhosts[$hostname]['triggerid']);
        while ($item_data = DBfetch($db_items)) {
            $description = item_description($item_data);
            switch ($item_data['value_type']) {
                case ITEM_VALUE_TYPE_UINT64:
                case ITEM_VALUE_TYPE_FLOAT:
                    $action = 'showgraph';
                    $status_bar = S_SHOW_GRAPH_OF_ITEM . ' \'' . $description . '\'';
                    break;
                case ITEM_VALUE_TYPE_LOG:
                case ITEM_VALUE_TYPE_STR:
                case ITEM_VALUE_TYPE_TEXT:
                default:
                    $action = 'showlatest';
                    $status_bar = S_SHOW_VALUES_OF_ITEM . ' \'' . $description . '\'';
                    break;
            }
            if (strlen($description) > 25) {
                $description = substr($description, 0, 22) . '...';
            }
            $item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item_data['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar));
        }
        if (isset($item_menu['showgraph'])) {
            $tr_ov_menu[] = array(S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
            $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']);
        }
        if (isset($item_menu['showlatest'])) {
            $tr_ov_menu[] = array(S_VALUES, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
            $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']);
        }
        unset($item_menu);
    }
    // dependency
    // TRIGGERS ON WHICH DEPENDS THIS
    $desc = array();
    if (isset($trhosts[$hostname])) {
        $triggerid = $trhosts[$hostname]['triggerid'];
        $dependency = false;
        $dep_table = new CTableInfo();
        $dep_table->setAttribute('style', 'width: 200px;');
        $dep_table->addRow(bold(S_DEPENDS_ON . ':'));
        $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_down=' . $triggerid;
        $dep_res = DBselect($sql_dep);
        while ($dep_row = DBfetch($dep_res)) {
            $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_up']));
            $dependency = true;
        }
        if ($dependency) {
            $img = new Cimg('images/general/down_icon.png', 'DEP_DOWN');
            $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
            $img->SetHint($dep_table);
            array_push($desc, $img);
        }
        unset($img, $dep_table, $dependency);
        // TRIGGERS THAT DEPEND ON THIS
        $dependency = false;
        $dep_table = new CTableInfo();
        $dep_table->setAttribute('style', 'width: 200px;');
        $dep_table->addRow(bold(S_DEPENDENT . ':'));
        $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $triggerid;
        $dep_res = DBselect($sql_dep);
        while ($dep_row = DBfetch($dep_res)) {
//.........这里部分代码省略.........
开发者ID:phedders,项目名称:zabbix,代码行数:101,代码来源:triggers.inc.php

示例5: make_popup_eventlist

function make_popup_eventlist($triggerId, $eventId)
{
    $config = select_config();
    $table = new CTableInfo();
    $table->setAttribute('style', 'width: 400px;');
    // if acknowledges are turned on, we show 'ack' column
    if ($config['event_ack_enable']) {
        $table->setHeader(array(_('Time'), _('Status'), _('Duration'), _('Age'), _('Ack')));
    } else {
        $table->setHeader(array(_('Time'), _('Status'), _('Duration'), _('Age')));
    }
    $events = API::Event()->get(array('source' => EVENT_SOURCE_TRIGGERS, 'object' => EVENT_OBJECT_TRIGGER, 'output' => API_OUTPUT_EXTEND, 'objectids' => $triggerId, 'eventid_till' => $eventId, 'select_acknowledges' => API_OUTPUT_COUNT, 'sortfield' => array('clock', 'eventid'), 'sortorder' => ZBX_SORT_DOWN, 'limit' => ZBX_WIDGET_ROWS));
    $lclock = time();
    foreach ($events as $event) {
        $duration = zbx_date2age($lclock, $event['clock']);
        $lclock = $event['clock'];
        $eventStatusSpan = new CSpan(trigger_value2str($event['value']));
        // add colors and blinking to span depending on configuration and trigger parameters
        addTriggerValueStyle($eventStatusSpan, $event['value'], $event['clock'], $event['acknowledged']);
        $table->addRow(array(zbx_date2str(_('d M Y H:i:s'), $event['clock']), $eventStatusSpan, $duration, zbx_date2age($event['clock']), getEventAckState($event, false, false)));
    }
    return $table;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:23,代码来源:events.inc.php

示例6: CTableInfo

 // DEPENDENCIES {{{
 if (!empty($trigger['dependencies'])) {
     $dep_table = new CTableInfo();
     $dep_table->setAttribute('style', 'width: 200px;');
     $dep_table->addRow(bold(S_DEPENDS_ON . ':'));
     foreach ($trigger['dependencies'] as $dep) {
         $dep_table->addRow(' - ' . expand_trigger_description($dep['triggerid']));
     }
     $img = new Cimg('images/general/down_icon.png', 'DEP_UP');
     $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
     $img->setHint($dep_table);
     $description = array($img, SPACE, $description);
 }
 $dependency = false;
 $dep_table = new CTableInfo();
 $dep_table->setAttribute('style', 'width: 200px;');
 $dep_table->addRow(bold(S_DEPENDENT . ':'));
 $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $trigger['triggerid'];
 $dep_res = DBselect($sql_dep);
 while ($dep_row = DBfetch($dep_res)) {
     $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_down']));
     $dependency = true;
 }
 if ($dependency) {
     $img = new Cimg('images/general/up_icon.png', 'DEP_UP');
     $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
     $img->setHint($dep_table);
     $description = array($img, SPACE, $description);
 }
 unset($img, $dep_table, $dependency);
 // }}} DEPENDENCIES
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_status.php

示例7: CWidget

** 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();');
$overviewWidget = new CWidget();
$typeComboBox = new CComboBox('type', $this->data['type'], 'submit()');
$typeComboBox->addItem(SHOW_TRIGGERS, _('Triggers'));
$typeComboBox->addItem(SHOW_DATA, _('Data'));
$headerForm = new CForm('get');
$headerForm->addItem(array(_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB(true)));
$headerForm->addItem(array(SPACE, _('Application'), SPACE, $this->data['pageFilter']->getApplicationsCB(true)));
$headerForm->addItem(array(SPACE, _('Type'), SPACE, $typeComboBox));
$overviewWidget->addHeader(_('Overview'), $headerForm);
$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)));
        }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:monitoring.overview.php

示例8: make_hoststat_summary


//.........这里部分代码省略.........
        }
    }
    foreach ($hosts as $hnum => $host) {
        foreach ($host['groups'] as $gnum => $group) {
            if (!isset($groups[$group['groupid']]['hosts'])) {
                $groups[$group['groupid']]['hosts'] = array();
            }
            $groups[$group['groupid']]['hosts'][$host['hostid']] = array('hostid' => $host['hostid']);
            if (!isset($highest_severity[$group['groupid']])) {
                $highest_severity[$group['groupid']] = 0;
            }
            if (!isset($hosts_data[$group['groupid']])) {
                $hosts_data[$group['groupid']] = array('problematic' => 0, 'ok' => 0, 'lastUnack' => 0);
            }
            if (!isset($problematic_host_list[$host['hostid']])) {
                $hosts_data[$group['groupid']]['ok']++;
            }
        }
    }
    foreach ($groups as $gnum => $group) {
        if (!isset($hosts_data[$group['groupid']])) {
            continue;
        }
        $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'] . '&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(S_HOST, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_DISASTER]) ? S_DISASTER : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_HIGH]) ? S_HIGH : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_AVERAGE]) ? S_AVERAGE : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_WARNING]) ? S_WARNING : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_INFORMATION]) ? S_INFORMATION : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_NOT_CLASSIFIED]) ? S_NOT_CLASSIFIED : null));
                $popup_rows = 0;
                foreach ($group['hosts'] as $hnum => $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, get_severity_style($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;');
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:67,代码来源:blocks.inc.php

示例9: CComboBox

 $exp_select = new CComboBox('expr_type');
 $exp_select->setAttribute('id', 'expr_type');
 $exp_select->addItem(REGEXP_INCLUDE, _('Include'));
 $exp_select->addItem(REGEXP_EXCLUDE, _('Exclude'));
 $ctb = new CTextBox('expression', '', 80);
 $ctb->setAttribute('id', 'logexpr');
 $cb = new CButton('add_exp', _('Add'), 'javascript: add_logexpr();');
 $cbAdd = new CButton('add_key_and', _('AND'), 'javascript: add_keyword_and();');
 $cbOr = new CButton('add_key_or', _('OR'), 'javascript: add_keyword_or();');
 $cbIregexp = new CCheckBox('iregexp', 'no', null, 1);
 $frmTRLog->addRow(_('Expression'), array($ctb, BR(), $cbIregexp, 'iregexp', SPACE, $cbAdd, SPACE, $cbOr, SPACE, $exp_select, SPACE, $cb));
 $keyTable = new CTableInfo(null);
 $keyTable->setAttribute('id', 'key_list');
 $keyTable->setHeader(array(_('Keyword'), _('Type'), _('Action')));
 $table = new CTableInfo(null);
 $table->setAttribute('id', 'exp_list');
 $table->setHeader(array(_('Expression'), _('Type'), _('Position'), _('Action')));
 $maxid = 0;
 $bExprResult = true;
 $expressionData = new CTriggerExpression();
 if (isset($_REQUEST['triggerid']) && !isset($_REQUEST['save_trigger']) && !$expressionData->parse(empty($expressions) ? '' : construct_expression($itemid, $expressions)) && !isset($_REQUEST['form_refresh'])) {
     info($expressionData->error);
     unset($expressions);
     $expressions[0]['value'] = $expr_incase;
     $expressions[0]['type'] = 0;
     $expressions[0]['view'] = $expr_incase;
     $bExprResult = false;
 }
 foreach ($expressions as $id => $expr) {
     $imgup = new CImg('images/general/arrow_up.png', 'up', 12, 14);
     $imgup->setAttribute('onclick', 'javascript:  element_up("logtr' . $id . '");');
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:tr_logform.php

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

示例11: get_actions_hint_by_eventid

function get_actions_hint_by_eventid($eventid, $status = NULL)
{
    $hostids = array();
    $sql = 'SELECT DISTINCT i.hostid ' . ' FROM events e, functions f, items i ' . ' WHERE e.eventid=' . $eventid . ' AND e.object=' . EVENT_SOURCE_TRIGGERS . ' AND f.triggerid=e.objectid ' . ' AND i.itemid=f.itemid';
    if ($host = DBfetch(DBselect($sql, 1))) {
        $hostids[$host['hostid']] = $host['hostid'];
    }
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids);
    $tab_hint = new CTableInfo(S_NO_ACTIONS_FOUND);
    $tab_hint->setAttribute('style', 'width: 300px;');
    $tab_hint->SetHeader(array(is_show_all_nodes() ? S_NODES : null, S_USER, S_DETAILS, S_STATUS));
    /*
    	$sql = 'SELECT DISTINCT a.alertid,mt.description,a.sendto,a.status,u.alias,a.retries '.
    			' FROM events e,users u,alerts a'.
    			' left join media_type mt on mt.mediatypeid=a.mediatypeid'.
    			' WHERE a.eventid='.$eventid.
    				(is_null($status)?'':' AND a.status='.$status).
    				' AND e.eventid = a.eventid'.
    				' AND a.alerttype IN ('.ALERT_TYPE_MESSAGE.','.ALERT_TYPE_COMMAND.')'.
    				' AND '.DBcondition('e.objectid',$available_triggers).
    				' AND '.DBin_node('a.alertid').
    				' AND u.userid=a.userid '.
    			' ORDER BY mt.description';
    //*/
    $sql = 'SELECT DISTINCT a.alertid,mt.description,u.alias,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype ' . ' FROM events e,alerts a ' . ' LEFT JOIN users u ON u.userid=a.userid ' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . $eventid . (is_null($status) ? '' : ' AND a.status=' . $status) . ' AND e.eventid = a.eventid' . ' AND a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND ' . DBin_node('a.alertid') . ' ORDER BY a.alertid';
    $result = DBselect($sql, 30);
    while ($row = DBfetch($result)) {
        if ($row["status"] == ALERT_STATUS_SENT) {
            $status = new CSpan(S_SENT, "green");
            $retries = new CSpan(SPACE, "green");
        } else {
            if ($row["status"] == ALERT_STATUS_NOT_SENT) {
                $status = new CSpan(S_IN_PROGRESS, "orange");
                $retries = new CSpan(ALERT_MAX_RETRIES - $row["retries"], "orange");
            } else {
                $status = new CSpan(S_NOT_SENT, "red");
                $retries = new CSpan(0, "red");
            }
        }
        switch ($row['alerttype']) {
            case ALERT_TYPE_MESSAGE:
                $message = empty($row['description']) ? '-' : $row['description'];
                break;
            case ALERT_TYPE_COMMAND:
                $message = array(bold(S_COMMAND . ':'));
                $msg = explode("\n", $row['message']);
                foreach ($msg as $m) {
                    array_push($message, BR(), $m);
                }
                break;
            default:
                $message = '-';
        }
        $tab_hint->addRow(array(get_node_name_by_elid($row['alertid']), empty($row['alias']) ? ' - ' : $row['alias'], $message, $status));
    }
    return $tab_hint;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:57,代码来源:actions.inc.php

示例12: get_act_operations_form

function get_act_operations_form($action = null)
{
    $tblOper = new CTableInfo(S_NO_OPERATIONS_DEFINED);
    $tblOper->setAttribute('style', 'background-color: #CCC;');
    if (isset($_REQUEST['actionid']) && empty($action)) {
        $action = get_action_by_actionid($_REQUEST['actionid']);
    }
    $operations = get_request('operations', array());
    if (isset($_REQUEST['actionid']) && !isset($_REQUEST['form_refresh'])) {
        $eventsource = $action['eventsource'];
        $evaltype = $action['evaltype'];
        $esc_period = $action['esc_period'];
        /* prepate operations */
        $db_operations = DBselect('SELECT * ' . ' FROM operations' . ' WHERE actionid=' . $_REQUEST['actionid'] . ' ORDER BY esc_step_from,operationtype,object,operationid');
        while ($operation_data = DBfetch($db_operations)) {
            $operation_data = array('operationtype' => $operation_data['operationtype'], 'operationid' => $operation_data['operationid'], 'object' => $operation_data['object'], 'objectid' => $operation_data['objectid'], 'shortdata' => $operation_data['shortdata'], 'longdata' => $operation_data['longdata'], 'esc_period' => $operation_data['esc_period'], 'esc_step_from' => $operation_data['esc_step_from'], 'esc_step_to' => $operation_data['esc_step_to'], 'default_msg' => $operation_data['default_msg'], 'evaltype' => $operation_data['evaltype']);
            $operation_data['opconditions'] = array();
            $sql = 'SELECT * FROM opconditions WHERE operationid=' . $operation_data['operationid'];
            $db_opconds = DBselect($sql);
            while ($db_opcond = DBfetch($db_opconds)) {
                $operation_data['opconditions'][] = $db_opcond;
            }
            $sql = 'SELECT * from opmediatypes WHERE operationid=' . $operation_data['operationid'];
            $db_opmtypes = DBSelect($sql);
            if ($db_opmtype = DBfetch($db_opmtypes)) {
                $operation_data['mediatypeid'] = $db_opmtype['mediatypeid'];
            }
            if (str_in_array($operation_data, $operations)) {
                continue;
            }
            array_push($operations, $operation_data);
        }
        unset($db_operations, $operation_data);
    } else {
        $eventsource = get_request('eventsource');
        $evaltype = get_request('evaltype');
        $esc_period = get_request('esc_period');
    }
    $esc_step_from = array();
    $objects_tmp = array();
    $objectids_tmp = array();
    foreach ($operations as $key => $operation) {
        $esc_step_from[$key] = $operation['esc_step_from'];
        $objects_tmp[$key] = $operation['object'];
        $objectids_tmp[$key] = $operation['objectid'];
    }
    array_multisort($esc_step_from, SORT_ASC, SORT_NUMERIC, $objects_tmp, SORT_DESC, $objectids_tmp, SORT_ASC, $operations);
    $tblOper->SetHeader(array(new CCheckBox('all_operations', null, 'checkAll("' . S_ACTION . '","all_operations","g_operationid");'), isset($_REQUEST['escalation']) ? S_STEPS : null, S_DETAILS, isset($_REQUEST['escalation']) ? S_PERIOD . ' (' . S_SEC_SMALL . ')' : null, isset($_REQUEST['escalation']) ? S_DELAY : null, S_ACTION));
    $allowed_operations = get_operations_by_eventsource($eventsource);
    $delay = count_operations_delay($operations, $esc_period);
    foreach ($operations as $id => $val) {
        if (!str_in_array($val['operationtype'], $allowed_operations)) {
            continue;
        }
        if (!isset($val['default_msg'])) {
            $val['default_msg'] = 0;
        }
        if (!isset($val['opconditions'])) {
            $val['opconditions'] = array();
        }
        if (!isset($val['mediatypeid'])) {
            $val['mediatypeid'] = 0;
        }
        $oper_details = new CSpan(get_operation_desc(SHORT_DESCRITION, $val));
        $oper_details->SetHint(nl2br(get_operation_desc(LONG_DESCRITION, $val)));
        $esc_steps_txt = null;
        $esc_period_txt = null;
        $esc_delay_txt = null;
        if ($val['esc_step_from'] < 1) {
            $val['esc_step_from'] = 1;
        }
        if (isset($_REQUEST['escalation'])) {
            $esc_steps_txt = $val['esc_step_from'] . ' - ' . $val['esc_step_to'];
            /* Display N-N as N */
            $esc_steps_txt = $val['esc_step_from'] == $val['esc_step_to'] ? $val['esc_step_from'] : $val['esc_step_from'] . ' - ' . $val['esc_step_to'];
            $esc_period_txt = $val['esc_period'] ? $val['esc_period'] : S_DEFAULT;
            $esc_delay_txt = $delay[$val['esc_step_from']] ? convert_units($delay[$val['esc_step_from']], 'uptime') : S_IMMEDIATELY;
        }
        $tblOper->addRow(array(new CCheckBox("g_operationid[]", 'no', null, $id), $esc_steps_txt, $oper_details, $esc_period_txt, $esc_delay_txt, new CButton('edit_operationid[' . $id . ']', S_EDIT)));
        $tblOper->addItem(new CVar('operations[' . $id . '][operationtype]', $val['operationtype']));
        $tblOper->addItem(new CVar('operations[' . $id . '][object]', $val['object']));
        $tblOper->addItem(new CVar('operations[' . $id . '][objectid]', $val['objectid']));
        $tblOper->addItem(new CVar('operations[' . $id . '][mediatypeid]', $val['mediatypeid']));
        $tblOper->addItem(new CVar('operations[' . $id . '][shortdata]', $val['shortdata']));
        $tblOper->addItem(new CVar('operations[' . $id . '][longdata]', $val['longdata']));
        $tblOper->addItem(new CVar('operations[' . $id . '][esc_period]', $val['esc_period']));
        $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_from]', $val['esc_step_from']));
        $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_to]', $val['esc_step_to']));
        $tblOper->addItem(new CVar('operations[' . $id . '][default_msg]', $val['default_msg']));
        $tblOper->addItem(new CVar('operations[' . $id . '][evaltype]', $val['evaltype']));
        foreach ($val['opconditions'] as $opcondid => $opcond) {
            foreach ($opcond as $field => $value) {
                $tblOper->addItem(new CVar('operations[' . $id . '][opconditions][' . $opcondid . '][' . $field . ']', $value));
            }
        }
    }
    unset($operations);
    $tblOperFooter = new CTableInfo(null);
    $oper_buttons = array();
    if (!isset($_REQUEST['new_operation'])) {
//.........这里部分代码省略.........
开发者ID:phedders,项目名称:zabbix,代码行数:101,代码来源:forms.inc.php

示例13: make_popup_eventlist

function make_popup_eventlist($eventid, $trigger_type)
{
    $table = new CTableInfo();
    $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE, S_ACK));
    $table->setAttribute('style', 'width: 400px;');
    $event_list = array();
    $sql = 'SELECT * ' . ' FROM events ' . ' WHERE eventid<=' . $eventid . ' ORDER BY eventid DESC';
    $db_events = DBselect($sql, 20);
    while ($event = DBfetch($db_events)) {
        if (!empty($event_list) && $event_list[$count]['value'] != $event['value']) {
            $count++;
        } else {
            if (!empty($event_list) && $event_list[$count]['value'] == $event['value'] && $trigger_type == TRIGGER_MULT_EVENT_ENABLED && $event['value'] == TRIGGER_VALUE_TRUE) {
                $count++;
            }
        }
        $event_list[$count] = $event;
    }
    $lclock = time();
    foreach ($event_list as $id => $event) {
        $duration = zbx_date2age($lclock, $event['clock']);
        $lclock = $event['clock'];
        $value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value']));
        // ack +++
        $ack = new CSpan(S_NO, 'on');
        if ($event['acknowledged']) {
            $ack = new CSpan(S_YES, 'action');
        }
        // ---
        $table->addRow(array(zbx_date2str(S_DATE_FORMAT_YMDHMS, $event['clock']), $value, $duration, zbx_date2age($event['clock']), $ack));
    }
    return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:33,代码来源:events.inc.php

示例14: make_popup_eventlist

function make_popup_eventlist($eventid, $trigger_type, $triggerid)
{
    $config = select_config();
    $table = new CTableInfo();
    //if acknowledges are turned on, we show 'ack' column
    if ($config['event_ack_enable']) {
        $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE, S_ACK));
    } else {
        $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE));
    }
    $table->setAttribute('style', 'width: 400px;');
    $event_list = array();
    $sql = 'SELECT * ' . ' FROM events ' . ' WHERE eventid<=' . $eventid . ' AND object=' . EVENT_OBJECT_TRIGGER . ' AND objectid=' . $triggerid . ' ORDER BY eventid DESC';
    $db_events = DBselect($sql, ZBX_WIDGET_ROWS);
    $count = 0;
    while ($event = DBfetch($db_events)) {
        if (!empty($event_list) && $event_list[$count]['value'] != $event['value']) {
            $count++;
        } else {
            if (!empty($event_list) && $event_list[$count]['value'] == $event['value'] && $trigger_type == TRIGGER_MULT_EVENT_ENABLED && $event['value'] == TRIGGER_VALUE_TRUE) {
                $count++;
            }
        }
        $event_list[$count] = $event;
    }
    $lclock = time();
    foreach ($event_list as $id => $event) {
        $duration = zbx_date2age($lclock, $event['clock']);
        $lclock = $event['clock'];
        $value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value']));
        // ack +++
        $ack = new CSpan(S_NO, 'on');
        if ($event['acknowledged']) {
            $ack = new CSpan(S_YES, 'off');
        }
        // ---
        $table->addRow(array(zbx_date2str(S_EVENTS_POPUP_EVENT_LIST_DATE_FORMAT, $event['clock']), $value, $duration, zbx_date2age($event['clock']), $config['event_ack_enable'] ? $ack : NULL));
    }
    return $table;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:40,代码来源:events.inc.php

示例15: CForm

$slideWidget->addPageHeader(_('CONFIGURATION OF SLIDE SHOWS'));
// create form
$slideForm = new CForm();
$slideForm->setName('slideForm');
$slideForm->addVar('form', $this->data['form']);
$slideForm->addVar('slides', $this->data['slides_without_delay']);
if (!empty($this->data['slideshowid'])) {
    $slideForm->addVar('slideshowid', $this->data['slideshowid']);
}
// create slide form list
$slideFormList = new CFormList('slideFormList');
$slideFormList->addRow(_('Name'), new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE));
$slideFormList->addRow(_('Default delay (in seconds)'), new CNumericBox('delay', $this->data['delay'], 5, 'no', false, false));
// append slide table
$slideTable = new CTableInfo(_('No slides defined.'), 'formElementTable');
$slideTable->setAttribute('style', 'min-width: 500px;');
$slideTable->setAttribute('id', 'slideTable');
$slideTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), new CCol(_('Screen'), null, null, '140'), new CCol(_('Delay'), null, null, '70'), new CCol(_('Action'), null, null, '50')));
$i = 1;
foreach ($this->data['slides'] as $step => $slides) {
    $name = '';
    if (!empty($slides['screenid'])) {
        $screen = get_screen_by_screenid($slides['screenid']);
        if (!empty($screen['name'])) {
            $name = $screen['name'];
        }
    }
    $delay = new CNumericBox('slides[' . $step . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, 'no', true, false);
    $delay->setAttribute('placeholder', _('default'));
    $removeButton = new CButton('remove_' . $step, _('Remove'), 'javascript: removeSlide(this);', 'link_menu');
    $removeButton->setAttribute('remove_slide', $step);
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:configuration.slideconf.edit.php


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