本文整理汇总了PHP中zbx_nl2br函数的典型用法代码示例。如果您正苦于以下问题:PHP zbx_nl2br函数的具体用法?PHP zbx_nl2br怎么用?PHP zbx_nl2br使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbx_nl2br函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: makeAckTab
/**
* Get acknowledgement table.
*
* @param array $acknowledges
* @param array $acknowledges['clock']
* @param array $acknowledges['alias']
* @param array $acknowledges['name']
* @param array $acknowledges['surname']
* @param array $acknowledges['message']
*
* @return CTableInfo
*/
function makeAckTab($acknowledges)
{
$table = (new CTableInfo())->setHeader([_('Time'), _('User'), _('Message')]);
foreach ($acknowledges as $acknowledge) {
$table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $acknowledge['clock']), getUserFullname($acknowledge), zbx_nl2br($acknowledge['message'])]);
}
return $table;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:20,代码来源:acknow.inc.php
示例2: make_acktab_by_eventid
function make_acktab_by_eventid($eventid)
{
$table = new CTableInfo();
$table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
$acks = get_acknowledges_by_eventid($eventid);
while ($ack = DBfetch($acks)) {
$user = get_user_by_userid($ack['userid']);
$table->AddRow(array(date('d-m-Y h:i:s A', $ack['clock']), $user['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
return $table;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:11,代码来源:acknow.inc.php
示例3: makeAckTab
/**
* Generate acknowledgement table
*
* @param array $event
* @param array $event['acknowledges']
* @param array $event['acknowledges']['clock']
* @param array $event['acknowledges']['alias']
* @param array $event['acknowledges']['message']
*
* @return CTableInfo
*/
function makeAckTab($event)
{
$table = new CTableInfo(_('No acknowledges defined.'));
$table->setHeader(array(_('Time'), _('User'), _('Comments')));
if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) {
foreach ($event['acknowledges'] as $ack) {
$table->addRow(array(zbx_date2str(_('d M Y H:i:s'), $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
}
return $table;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:22,代码来源:acknow.inc.php
示例4: makeAckTab
/**
* Get acknowledgement table.
*
* @param array $event
* @param array $event['acknowledges']
* @param array $event['acknowledges']['clock']
* @param array $event['acknowledges']['alias']
* @param array $event['acknowledges']['message']
*
* @return CTableInfo
*/
function makeAckTab($event)
{
$acknowledgeTable = new CTableInfo(_('No acknowledges found.'));
$acknowledgeTable->setHeader(array(_('Time'), _('User'), _('Comments')));
if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) {
foreach ($event['acknowledges'] as $acknowledge) {
$acknowledgeTable->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $acknowledge['clock']), getUserFullname($acknowledge), new CCol(zbx_nl2br($acknowledge['message']), 'wraptext')));
}
}
return $acknowledgeTable;
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:22,代码来源:acknow.inc.php
示例5: make_acktab_by_eventid
function make_acktab_by_eventid($eventid)
{
$table = new CTableInfo();
$table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
$acks = get_acknowledges_by_eventid($eventid);
while ($ack = DBfetch($acks)) {
//$users = CUser::get(array('userids' => $ack['userid'], 'output' => API_OUTPUT_EXTEND));
//$user = reset($users);
$table->addRow(array(zbx_date2str(S_ACKNOWINC_BY_EVENTS_DATE_FORMAT, $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
}
return $table;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:12,代码来源:acknow.inc.php
示例6: get
//.........这里部分代码省略.........
break;
}
}
$row = array(nbsp(zbx_date2str(_('Y.M.d H:i:s'), $data['clock'])));
if ($isManyItems) {
$row[] = $host['name'] . NAME_DELIMITER . $item['name_expanded'];
}
if ($useLogItem) {
$row[] = $data['timestamp'] == 0 ? '-' : zbx_date2str(HISTORY_LOG_LOCALTIME_DATE_FORMAT, $data['timestamp']);
// if this is a eventLog item, showing additional info
if ($useEventLogItem) {
$row[] = zbx_empty($data['source']) ? '-' : $data['source'];
$row[] = $data['severity'] == 0 ? '-' : new CCol(get_item_logtype_description($data['severity']), get_item_logtype_style($data['severity']));
$row[] = $data['logeventid'] == 0 ? '-' : $data['logeventid'];
}
}
$row[] = new CCol($data['value'], 'pre');
$newRow = new CRow($row);
if (!is_null($color)) {
$newRow->setAttribute('class', $color);
}
$historyTable->addRow($newRow);
} else {
$output[] = zbx_date2str(HISTORY_LOG_ITEM_PLAINTEXT, $data['clock']);
$output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($data['value']) . "\n";
}
}
if (empty($this->plaintext)) {
$output[] = $historyTable;
}
} else {
if (empty($this->plaintext)) {
$historyTable = new CTableInfo(_('No values found.'));
$historyTable->setHeader(array(_('Timestamp'), _('Value')));
}
$options['sortfield'] = array('itemid', 'clock');
$historyData = API::History()->get($options);
foreach ($historyData as $data) {
$item = $this->items[$data['itemid']];
$value = $data['value'];
// format the value as float
if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT) {
sscanf($data['value'], '%f', $value);
}
// html table
if (empty($this->plaintext)) {
if ($item['valuemapid']) {
$value = applyValueMap($value, $item['valuemapid']);
}
$historyTable->addRow(array(zbx_date2str(HISTORY_ITEM_DATE_FORMAT, $data['clock']), zbx_nl2br($value)));
} else {
$output[] = zbx_date2str(HISTORY_PLAINTEXT_DATE_FORMAT, $data['clock']);
$output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($value) . "\n";
}
}
if (empty($this->plaintext)) {
$output[] = $historyTable;
}
}
}
if ($this->action == 'showgraph' && !isset($iv_string[$this->item['value_type']])) {
$this->dataId = 'historyGraph';
$containerId = 'graph_cont1';
$src = 'chart.php?itemid=' . $this->item['itemid'] . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stime'] . $this->getProfileUrlParams();
$output[] = new CDiv(null, 'center', $containerId);
}
// time control
if (!$this->plaintext && str_in_array($this->action, array('showvalues', 'showgraph'))) {
$graphDims = getGraphDims();
$this->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($this->item['itemid']));
$timeControlData = array('periodFixed' => CProfile::get('web.history.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
if (!empty($this->dataId)) {
$timeControlData['id'] = $this->getDataId();
$timeControlData['containerid'] = $containerId;
$timeControlData['src'] = $src;
$timeControlData['objDims'] = $graphDims;
$timeControlData['loadSBox'] = 1;
$timeControlData['loadImage'] = 1;
$timeControlData['dynamic'] = 1;
} else {
$this->dataId = 'historyGraph';
$timeControlData['id'] = $this->getDataId();
$timeControlData['mainObject'] = 1;
}
if ($this->mode == SCREEN_MODE_JS) {
$timeControlData['dynamic'] = 0;
return 'timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');';
} else {
zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');');
}
}
if (!empty($this->plaintext)) {
return $output;
} else {
if ($this->mode != SCREEN_MODE_JS) {
$flickerfreeData = array('itemids' => $this->itemids, 'action' => $this->action, 'filter' => $this->filter, 'filterTask' => $this->filterTask, 'markColor' => $this->markColor);
return $this->getOutput($output, true, $flickerfreeData);
}
}
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:101,代码来源:CScreenHistory.php
示例7: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$output = [];
$items = API::Item()->get(['output' => ['itemid', 'hostid', 'name', 'key_', 'value_type', 'valuemapid'], 'selectHosts' => ['name'], 'itemids' => $this->itemids, 'webitems' => true, 'preservekeys' => true]);
$items = CMacrosResolverHelper::resolveItemNames($items);
$stime = zbxDateToTime($this->timeline['stime']);
$firstItem = reset($items);
$iv_string = [ITEM_VALUE_TYPE_LOG => 1, ITEM_VALUE_TYPE_TEXT => 1];
$iv_numeric = [ITEM_VALUE_TYPE_FLOAT => 1, ITEM_VALUE_TYPE_UINT64 => 1];
if ($this->action == HISTORY_VALUES || $this->action == HISTORY_LATEST) {
$options = ['history' => $firstItem['value_type'], 'itemids' => $this->itemids, 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN];
if ($this->action == HISTORY_LATEST) {
$options['limit'] = 500;
} elseif ($this->action == HISTORY_VALUES) {
$config = select_config();
// interval start value is non-inclusive, hence the + 1 second
$options['time_from'] = $stime + 1;
$options['time_till'] = $stime + $this->timeline['period'];
$options['limit'] = $config['search_limit'];
}
// text log
if (isset($iv_string[$firstItem['value_type']])) {
$isManyItems = count($items) > 1;
$useLogItem = $firstItem['value_type'] == ITEM_VALUE_TYPE_LOG;
$useEventLogItem = strpos($firstItem['key_'], 'eventlog[') === 0;
if (empty($this->plaintext)) {
$historyTable = (new CTableInfo())->setHeader([(new CColHeader(_('Timestamp')))->addClass(ZBX_STYLE_CELL_WIDTH), $isManyItems ? _('Item') : null, $useLogItem ? (new CColHeader(_('Local time')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, $useEventLogItem && $useLogItem ? (new CColHeader(_('Source')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, $useEventLogItem && $useLogItem ? (new CColHeader(_('Severity')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, $useEventLogItem && $useLogItem ? (new CColHeader(_('Event ID')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, _('Value')]);
}
if ($this->filter !== '' && in_array($this->filterTask, [FILTER_TASK_SHOW, FILTER_TASK_HIDE])) {
$options['search'] = ['value' => $this->filter];
if ($this->filterTask == FILTER_TASK_HIDE) {
$options['excludeSearch'] = 1;
}
}
$options['sortfield'] = 'id';
$historyData = API::History()->get($options);
foreach ($historyData as $data) {
$data['value'] = rtrim($data['value'], " \t\r\n");
if (empty($this->plaintext)) {
$item = $items[$data['itemid']];
$host = reset($item['hosts']);
$color = null;
if ($this->filter !== '') {
$haystack = mb_strtolower($data['value']);
$needle = mb_strtolower($this->filter);
$pos = mb_strpos($haystack, $needle);
if ($pos !== false && $this->filterTask == FILTER_TASK_MARK) {
$color = $this->markColor;
} elseif ($pos === false && $this->filterTask == FILTER_TASK_INVERT_MARK) {
$color = $this->markColor;
}
switch ($color) {
case MARK_COLOR_RED:
$color = ZBX_STYLE_RED;
break;
case MARK_COLOR_GREEN:
$color = ZBX_STYLE_GREEN;
break;
case MARK_COLOR_BLUE:
$color = ZBX_STYLE_BLUE;
break;
}
}
$row = [];
$row[] = (new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['clock'])))->addClass(ZBX_STYLE_NOWRAP)->addClass($color);
if ($isManyItems) {
$row[] = (new CCol($host['name'] . NAME_DELIMITER . $item['name_expanded']))->addClass($color);
}
if ($useLogItem) {
$row[] = $data['timestamp'] != 0 ? (new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['timestamp'])))->addClass(ZBX_STYLE_NOWRAP)->addClass($color) : '';
// if this is a eventLog item, showing additional info
if ($useEventLogItem) {
$row[] = (new CCol($data['source']))->addClass(ZBX_STYLE_NOWRAP)->addClass($color);
$row[] = $data['severity'] != 0 ? (new CCol(get_item_logtype_description($data['severity'])))->addClass(ZBX_STYLE_NOWRAP)->addClass(get_item_logtype_style($data['severity'])) : '';
$row[] = $data['logeventid'] != 0 ? (new CCol($data['logeventid']))->addClass(ZBX_STYLE_NOWRAP)->addClass($color) : '';
}
}
$row[] = (new CCol(new CPre(zbx_nl2br($data['value']))))->addClass($color);
$historyTable->addRow($row);
} else {
$output[] = zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['clock']) . ' ' . $data['clock'] . ' ' . htmlspecialchars($data['value']);
}
}
if (empty($this->plaintext)) {
$output[] = $historyTable;
}
} else {
if (empty($this->plaintext)) {
$historyTable = (new CTableInfo())->setHeader([(new CColHeader(_('Timestamp')))->addClass(ZBX_STYLE_CELL_WIDTH), _('Value')]);
}
$options['sortfield'] = ['itemid', 'clock'];
$historyData = API::History()->get($options);
foreach ($historyData as $data) {
$item = $items[$data['itemid']];
$value = rtrim($data['value'], " \t\r\n");
//.........这里部分代码省略.........
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:101,代码来源:CScreenHistory.php
示例8: CSpan
if ($alert['status'] == ALERT_STATUS_SENT) {
if ($alert['alerttype'] == ALERT_TYPE_MESSAGE) {
$status = new CSpan(_('sent'), 'green');
} else {
$status = new CSpan(_('executed'), 'green');
}
$retries = new CSpan(SPACE, 'green');
} elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(_('In progress'), 'orange');
$retries = new CSpan(ALERT_MAX_RETRIES - $alert['retries'], 'orange');
} else {
$status = new CSpan(_('not sent'), 'red');
$retries = new CSpan(0, 'red');
}
if ($alert['alerttype'] == ALERT_TYPE_MESSAGE) {
$message = array(bold(_('Subject') . ': '), br(), $alert['subject'], br(), br(), bold(_('Message') . ': '), br(), zbx_nl2br($alert['message']));
} else {
$message = array(bold(_('Command') . ': '), br(), zbx_nl2br($alert['message']));
}
$error = empty($alert['error']) ? new CSpan(SPACE, 'off') : new CSpan($alert['error'], 'on');
$auditTable->addRow(array(get_node_name_by_elid($alert['alertid']), new CCol(zbx_date2str(_('d M Y H:i:s'), $alert['clock']), 'top'), new CCol($mediatype['description'], 'top'), new CCol($status, 'top'), new CCol($retries, 'top'), new CCol($alert['sendto'], 'top'), new CCol($message, 'wraptext top'), new CCol($error, 'wraptext top')));
}
// append table to form
$auditForm->addItem(array($this->data['paging'], $auditTable, $this->data['paging']));
// append navigation bar js
$objData = array('id' => 'timeline_1', 'domid' => 'events', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1, 'periodFixed' => CProfile::get('web.auditacts.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
zbx_add_post_js('timeControl.addObject(\'events\', ' . zbx_jsvalue($data['timeline']) . ', ' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
// append form to widget
$auditWidget->addItem($auditForm);
return $auditWidget;
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:administration.auditacts.list.php
示例9: show_table_header
/*
* Display
*/
show_table_header(array(_('ALARM ACKNOWLEDGES') . NAME_DELIMITER, $bulk ? ' BULK ACKNOWLEDGE ' : $eventTriggerName));
echo SBR;
if ($bulk) {
$title = _('Acknowledge alarm by');
$saveAndReturnLabel = _('Acknowledge and return');
} else {
$acknowledges = DBselect('SELECT a.*,u.alias,u.name,u.surname' . ' FROM acknowledges a' . ' LEFT JOIN users u ON u.userid=a.userid' . ' WHERE a.eventid=' . zbx_dbstr($_REQUEST['eventid']));
if ($acknowledges) {
$acknowledgesTable = new CTable(null, 'ack_msgs');
$acknowledgesTable->setAlign('center');
while ($acknowledge = DBfetch($acknowledges)) {
$acknowledgesTable->addRow(array(new CCol(getUserFullname($acknowledge), 'user'), new CCol(zbx_date2str(_('d M Y H:i:s'), $acknowledge['clock']), 'time')), 'title');
$acknowledgesTable->addRow(new CCol(zbx_nl2br($acknowledge['message']), null, 2), 'msg');
}
$acknowledgesTable->show();
}
if ($eventAcknowledged) {
$title = _('Add comment by');
$saveLabel = _('Save');
$saveAndReturnLabel = _('Save and return');
} else {
$title = _('Acknowledge alarm by');
$saveLabel = _('Acknowledge');
$saveAndReturnLabel = _('Acknowledge and return');
}
}
$messageTable = new CFormTable($title . ' "' . getUserFullname(CWebUser::$data) . '"');
$messageTable->addVar('backurl', $_REQUEST['backurl']);
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:acknow.php
示例10: foreach
foreach ($scripts as $script) {
$description = new CLink($script['name'], 'javascript:void(0);');
if ($multiselect) {
$js_action = 'javascript: addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($script['scriptid']) . ');';
} else {
$values = [$dstfld1 => $script[$srcfld1], $dstfld2 => $script[$srcfld2]];
$js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . '); close_window(); return false;';
}
$description->onClick($js_action . ' jQuery(this).removeAttr("onclick");');
if ($script['type'] == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT) {
switch ($script['execute_on']) {
case ZBX_SCRIPT_EXECUTE_ON_AGENT:
$scriptExecuteOn = _('Agent');
break;
case ZBX_SCRIPT_EXECUTE_ON_SERVER:
$scriptExecuteOn = _('Server');
break;
}
} else {
$scriptExecuteOn = '';
}
$table->addRow([$multiselect ? new CCheckBox('scripts[' . zbx_jsValue($script[$srcfld1]) . ']', $script['scriptid']) : null, $description, $scriptExecuteOn, zbx_nl2br(htmlspecialchars($script['command'], ENT_COMPAT, 'UTF-8'))]);
}
if ($multiselect) {
$table->setFooter(new CCol((new CButton('select', _('Select')))->onClick("javascript: addSelectedValues('scripts', " . zbx_jsvalue($reference) . ');')));
insert_js('var popupReference = ' . zbx_jsvalue($scripts, true) . ';');
}
$form->addItem($table);
$widget->addItem($form)->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:popup.php
示例11: get_screen_plaintext
function get_screen_plaintext($itemid, $elements, $style = 0)
{
if ($itemid == 0) {
$table = new CTableInfo(S_ITEM_DOES_NOT_EXIST);
$table->setHeader(array(S_TIMESTAMP, S_ITEM));
return $table;
}
global $DB;
$item = get_item_by_itemid($itemid);
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_FLOAT:
$history_table = 'history';
$order_field = 'clock';
break;
case ITEM_VALUE_TYPE_UINT64:
$history_table = 'history_uint';
$order_field = 'clock';
break;
case ITEM_VALUE_TYPE_TEXT:
$history_table = 'history_text';
$order_field = 'id';
break;
case ITEM_VALUE_TYPE_LOG:
$history_table = 'history_log';
$order_field = 'id';
break;
default:
$history_table = 'history_str';
$order_field = 'clock';
break;
}
$sql = 'SELECT h.clock,h.value,i.valuemapid ' . ' FROM ' . $history_table . ' h, items i ' . ' WHERE h.itemid=i.itemid ' . ' AND i.itemid=' . $itemid . ' ORDER BY h.' . $order_field . ' DESC';
$result = DBselect($sql, $elements);
$host = get_host_by_itemid($itemid);
$table = new CTableInfo();
$table->setHeader(array(S_TIMESTAMP, $host['host'] . ': ' . item_description($item)));
while ($row = DBfetch($result)) {
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_TEXT:
if ($DB['TYPE'] == 'ORACLE') {
if (isset($row['value'])) {
$row['value'] = $row['value']->load();
} else {
$row['value'] = '';
}
}
/* do not use break */
/* do not use break */
case ITEM_VALUE_TYPE_STR:
if ($style) {
$value = new CScript($row['value']);
} else {
$value = nbsp(htmlspecialchars($row['value']));
$value = zbx_nl2br($value);
}
break;
case ITEM_VALUE_TYPE_LOG:
if ($style) {
$value = new CScript($row['value']);
} else {
$value = nbsp(htmlspecialchars($row['value']));
$value = zbx_nl2br($value);
}
break;
default:
$value = $row['value'];
break;
}
if ($row['valuemapid'] > 0) {
$value = replace_value_by_map($value, $row['valuemapid']);
}
$table->AddRow(array(date(S_DATE_FORMAT_YMDHMS, $row['clock']), $value));
}
return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:75,代码来源:screens.inc.php
示例12: stage1
function stage1()
{
$LICENCE_FILE = 'conf/COPYING';
$this->DISABLE_NEXT_BUTTON = true;
$license = 'Missing licence file. See GPL licence.';
if (file_exists($LICENCE_FILE)) {
$license = zbx_nl2br(nbsp(file_get_contents($LICENCE_FILE)));
}
$action = <<<JS
if(this.checked) \$("next[1]").writeAttribute('disabled', false);
else \$("next[1]").writeAttribute('disabled', 'disabled');
JS;
return array(new CDiv(new CSpan($license), 'licence'), BR(), new CDiv(array(new CCheckBox('agree', 'no', $action), new CLabel('I agree', 'agree')), 'center'));
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:14,代码来源:setup.inc.php
示例13: CWidget
}
$widget = (new CWidget())->setTitle(_('Scripts'))->setControls((new CForm())->cleanItems()->addItem((new CList())->addItem(new CRedirectButton(_('Create script'), 'zabbix.php?action=script.edit'))));
$scriptsForm = (new CForm())->setName('scriptsForm')->setId('scripts');
$scriptsTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_scripts'))->onClick("checkAll('" . $scriptsForm->getName() . "', 'all_scripts', 'scriptids');")))->addClass(ZBX_STYLE_CELL_WIDTH), make_sorting_header(_('Name'), 'name', $data['sort'], $data['sortorder']), _('Type'), _('Execute on'), make_sorting_header(_('Commands'), 'command', $data['sort'], $data['sortorder']), _('User group'), _('Host group'), _('Host access')]);
foreach ($data['scripts'] as $script) {
switch ($script['type']) {
case ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT:
$scriptType = _('Script');
break;
case ZBX_SCRIPT_TYPE_IPMI:
$scriptType = _('IPMI');
break;
}
if ($script['type'] == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT) {
switch ($script['execute_on']) {
case ZBX_SCRIPT_EXECUTE_ON_AGENT:
$scriptExecuteOn = _('Agent');
break;
case ZBX_SCRIPT_EXECUTE_ON_SERVER:
$scriptExecuteOn = _('Server');
break;
}
} else {
$scriptExecuteOn = '';
}
$scriptsTable->addRow([new CCheckBox('scriptids[' . $script['scriptid'] . ']', $script['scriptid']), (new CCol(new CLink($script['name'], 'zabbix.php?action=script.edit&scriptid=' . $script['scriptid'])))->addClass(ZBX_STYLE_NOWRAP), $scriptType, $scriptExecuteOn, zbx_nl2br(htmlspecialchars($script['command'], ENT_COMPAT, 'UTF-8')), $script['userGroupName'] === null ? _('All') : $script['userGroupName'], $script['hostGroupName'] === null ? _('All') : $script['hostGroupName'], $script['host_access'] == PERM_READ_WRITE ? _('Write') : _('Read')]);
}
// append table to form
$scriptsForm->addItem([$scriptsTable, $data['paging'], new CActionButtonList('action', 'scriptids', ['script.delete' => ['name' => _('Delete'), 'confirm' => _('Delete selected scripts?')]])]);
// append form to widget
$widget->addItem($scriptsForm)->show();
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:administration.script.list.php
示例14: redirect
}
redirect($last_page['url']);
exit;
}
}
}
$msg = $bulk ? ' BULK ACKNOWLEDGE ' : array('"' . expand_trigger_description_by_data($db_data) . '"', BR(), explode_exp($db_data["expression"], 1));
show_table_header(array(S_ALARM_ACKNOWLEDGES_BIG, ' : ', $msg));
echo SBR;
if (!$bulk) {
$table = new CTable(NULL, "ack_msgs");
$table->SetAlign("center");
$db_acks = get_acknowledges_by_eventid($db_data["eventid"]);
while ($db_ack = DBfetch($db_acks)) {
$db_user = get_user_by_userid($db_ack["userid"]);
$table->AddRow(array(new CCol($db_user["alias"], "user"), new CCol(date("d-m-Y h:i:s A", $db_ack["clock"]), "time")), "title");
$msgCol = new CCol(zbx_nl2br($db_ack['message']));
$msgCol->SetColspan(2);
$table->AddRow($msgCol, "msg");
}
/**/
if ($table->GetNumRows() > 0) {
$table->Show();
echo SBR;
}
}
insert_new_message_form($events, $bulk);
?>
<?php
include_once "include/page_footer.php";
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:acknow.php
示例15: array_push
}
if ($row['source'] == '') {
array_push($new_row, new CCol(' - '));
} else {
array_push($new_row, $row['source']);
}
array_push($new_row, new CCol(get_severity_description($row['severity']), get_severity_style($row['severity'])));
if ($row['source'] == '' && $row['logeventid'] == '0') {
array_push($new_row, new CCol(' - '));
} else {
array_push($new_row, $row['logeventid']);
}
$row['value'] = trim($row['value'], "\r\n");
$row['value'] = encode_log($row['value']);
// array_push($new_row,htmlspecialchars($row['value']));
array_push($new_row, zbx_nl2br($row['value']));
if (!isset($_REQUEST['plaintext'])) {
$crow = new CRow($new_row);
if (is_null($color_style) && is_array($_REQUEST['itemid'])) {
$min_color = 0x98;
$max_color = 0xf8;
$int_color = ($max_color - $min_color) / count($_REQUEST['itemid']);
$int_color *= array_search($row['itemid'], $_REQUEST['itemid']);
$int_color += $min_color;
$crow->setAttribute('style', 'background-color: ' . sprintf("#%X%X%X", $int_color, $int_color, $int_color));
} else {
$crow->setClass($color_style);
}
$crow->Show();
// to solve memory leak we call 'Show' method for each element
} else {
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:history.php
示例16: get_action_cmds_for_event
function get_action_cmds_for_event($event)
{
$table = new CTableInfo(_('No actions found.'));
$table->setHeader(array(is_show_all_nodes() ? _('Nodes') : null, _('Time'), _('Status'), _('Command'), _('Error')));
$alerts = $event['alerts'];
foreach ($alerts as $alert) {
if ($alert['alerttype'] != ALERT_TYPE_COMMAND) {
continue;
}
$time = zbx_date2str(EVENT_ACTION_CMDS_DATE_FORMAT, $alert['clock']);
if ($alert['esc_step'] > 0) {
$time = array(bold(_('Step') . NAME_DELIMITER), $alert['esc_step'], br(), bold(_('Time') . NAME_DELIMITER), br(), $time);
}
switch ($alert['status']) {
case ALERT_STATUS_SENT:
$status = new CSpan(_('executed'), 'green');
break;
case ALERT_STATUS_NOT_SENT:
$status = new CSpan(_('In progress'), 'orange');
break;
default:
$status = new CSpan(_('not sent'), 'red');
break;
}
$message = array(bold(_('Command') . NAME_DELIMITER));
array_push($message, BR(), zbx_nl2br($alert['message']));
$error = empty($alert['error']) ? new CSpan(SPACE, 'off') : new CSpan($alert['error'], 'on');
$table->addRow(array(get_node_name_by_elid($alert['alertid']), new CCol($time, 'top'), new CCol($status, 'top'), new CCol($message, 'wraptext top'), new CCol($error, 'wraptext top')));
}
return $table;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:actions.inc.php
示例17: CForm
$filterForm->addNavigator();
$auditWidget->addItem($filterForm);
// create form
$auditForm = (new CForm('get'))->setName('auditForm');
// create table
$auditTable = (new CTableInfo())->setHeader([_('Time'), _('Action'), _('Type'), _('Recipient(s)'), _('Message'), _('Status'), _('Info')]);
foreach ($this->data['alerts'] as $alert) {
$mediatype = array_pop($alert['mediatypes']);
if ($alert['status'] == ALERT_STATUS_SENT) {
$status = $alert['alerttype'] == ALERT_TYPE_MESSAGE ? (new CSpan(_('Sent')))->addClass(ZBX_STYLE_GREEN) : (new CSpan(_('Executed')))->addClass(ZBX_STYLE_GREEN);
} elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
$status = (new CSpan([_('In progress') . ':', BR(), _n('%1$s retry left', '%1$s retries left', ALERT_MAX_RETRIES - $alert['retries'])]))->addClass(ZBX_STYLE_YELLOW);
} else {
$status = (new CSpan(_('Not sent')))->addClass(ZBX_STYLE_RED);
}
$message = $alert['alerttype'] == ALERT_TYPE_MESSAGE ? [bold(_('Subject') . ':'), BR(), $alert['subject'], BR(), BR(), bold(_('Message') . ':'), BR(), zbx_nl2br($alert['message'])] : [bold(_('Command') . ':'), BR(), zbx_nl2br($alert['message'])];
if (zbx_empty($alert['error'])) {
$info = '';
} else {
$info = makeErrorIcon($alert['error']);
}
$recipient = isset($alert['userid']) && $alert['userid'] ? [bold(getUserFullname($this->data['users'][$alert['userid']])), BR(), $alert['sendto']] : $alert['sendto'];
$auditTable->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $alert['clock']), $this->data['actions'][$alert['actionid']]['name'], $mediatype ? $mediatype['description'] : '', $recipient, $message, $status, $info]);
}
// append table to form
$auditForm->addItem([$auditTable, $this->data['paging']]);
// append navigation bar js
$objData = ['id' => 'timeline_1', 'domid' => 'events', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1, 'periodFixed' => CProfile::get('web.auditacts.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD];
zbx_add_post_js('timeControl.addObject("events", ' . zbx_jsvalue($data['timeline']) . ', ' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
// append form to widget
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:administration.auditacts.list.php
示例18: array_pop
$mediatype = array_pop($alert['mediatypes']);
if ($mediatype['mediatypeid'] == 0) {
$mediatype = array('description' => '');
}
if ($alert['status'] == ALERT_STATUS_SENT) {
if ($alert['alerttype'] == ALERT_TYPE_MESSAGE) {
$status = new CSpan(_('sent'), 'green');
} else {
$status = new CSpan(_('executed'), 'green');
}
$retries = new CSpan(SPACE, 'green');
} elseif ($alert['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(_('In progress'), 'orange');
$retries = new CSpan(ALERT_MAX_RETRIES - $alert['retries'], 'orange');
} else {
$status = new CSpan(_('not sent'), 'red');
$retries = new CSpan(0, 'red');
}
$message = $alert['alerttype'] == ALERT_TYPE_MESSAGE ? array(bold(_('Subject') . NAME_DELIMITER), BR(), $alert['subject'], BR(), BR(), bold(_('Message') . NAME_DELIMITER), BR(), zbx_nl2br($alert['message'])) : array(bold(_('Command') . NAME_DELIMITER), BR(), zbx_nl2br($alert['message']));
$error = empty($alert['error']) ? new CSpan(SPACE, 'off') : new CSpan($alert['error'], 'on');
$auditTable->addRow(array(get_node_name_by_elid($alert['alertid']), new CCol(zbx_date2str(_('d M Y H:i:s'), $alert['clock']), 'top'), new CCol($mediatype['description'], 'top'), new CCol($status, 'top'), new CCol($retries, 'top'), new CCol($alert['sendto'], 'top'), new CCol($message, 'wraptext top'), new CCol($error, 'wraptext top')));
}
// append table to form
$auditForm->addItem(array($this->data['paging'], $auditTable, $this->data['paging']));
// append navigation bar js
$objData = array('id' => 'timeline_1', 'domid' => 'events', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1, 'periodFixed' => CProfile::get('web.auditacts.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
zbx_add_post_js('timeControl.addObject(\'events\', ' . zbx_jsvalue($data['timeline']) . ', ' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
// append form to widget
$auditWidget->addItem($auditForm);
return $auditWidget;
开发者ID:itnihao,项目名称:Zabbix_,代码行数:31,代码来源:administration.auditacts.list.php
示例19: reset
$item = $items[$data['itemid']];
$host = reset($item['hosts']);
if (!isset($data['value'])) {
$data['value'] = '';
}
if ($item['valuemapid'] > 0) {
$value = replace_value_by_map($data['value'], $item['valuemapid']);
$value_mapped = true;
} else {
$value = $data['value'];
$value_mapped = false;
}
if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT && !$value_mapped) {
sscanf($data['value'], '%f', $value);
}
$table->addRow(array(zbx_date2str(S_HISTORY_ITEM_DATE_FORMAT, $data['clock']), zbx_nl2br($value)));
// Plaintext
if (!isset($_REQUEST['plaintext'])) {
continue;
}
if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT) {
sscanf($data['value'], '%f', $value);
} else {
$value = $data['value'];
}
$ptData['body'][] = zbx_date2str(S_HISTORY_PLAINTEXT_DATE_FORMAT, $data['clock']);
$ptData['body'][] = "\t" . $data['clock'] . "\t" . htmlspecialchars($value) . "\n";
}
}
}
if ($_REQUEST['action'] == 'showgraph' && !isset($iv_string[$item['value_type']])) {
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:history.php
示例20: switch
default:
$scriptType = '';
break;
}
if ($script['type'] == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT) {
switch ($script['execute_on']) {
case ZBX_SCRIPT_EXECUTE_ON_AGENT:
$scriptExecuteOn = _('Agent');
break;
case ZBX_SCRIPT_EXECUTE_ON_SERVER:
$scriptExecuteOn = _('Server');
break;
}
} else {
$scriptExecuteOn = '';
}
$scriptsTable->addRow(array(new CC
|
请发表评论