本文整理汇总了PHP中zbxDateToTime函数的典型用法代码示例。如果您正苦于以下问题:PHP zbxDateToTime函数的具体用法?PHP zbxDateToTime怎么用?PHP zbxDateToTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbxDateToTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
// if screen is defined in template, then 'real_resourceid' is defined and should be used
if (!empty($this->screenitem['real_resourceid'])) {
$this->screenitem['resourceid'] = $this->screenitem['real_resourceid'];
}
if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
$newitemid = get_same_item_for_host($this->screenitem['resourceid'], $this->hostid);
$this->screenitem['resourceid'] = !empty($newitemid) ? $newitemid : 0;
}
if ($this->screenitem['resourceid'] == 0) {
$table = (new CTableInfo())->setHeader([_('Timestamp'), _('Item')]);
return $this->getOutput($table);
}
$items = CMacrosResolverHelper::resolveItemNames([get_item_by_itemid($this->screenitem['resourceid'])]);
$item = reset($items);
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_TEXT:
case ITEM_VALUE_TYPE_LOG:
$orderField = 'id';
break;
case ITEM_VALUE_TYPE_FLOAT:
case ITEM_VALUE_TYPE_UINT64:
default:
$orderField = ['itemid', 'clock'];
}
$host = get_host_by_itemid($this->screenitem['resourceid']);
$table = (new CTableInfo())->setHeader([_('Timestamp'), _('Value')]);
$stime = zbxDateToTime($this->timeline['stime']);
$histories = API::History()->get(['history' => $item['value_type'], 'itemids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN, 'sortfield' => $orderField, 'limit' => $this->screenitem['elements'], 'time_from' => $stime, 'time_till' => $stime + $this->timeline['period']]);
foreach ($histories as $history) {
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_FLOAT:
sscanf($history['value'], '%f', $value);
break;
case ITEM_VALUE_TYPE_TEXT:
case ITEM_VALUE_TYPE_STR:
case ITEM_VALUE_TYPE_LOG:
$value = $this->screenitem['style'] ? new CJsScript($history['value']) : $history['value'];
break;
default:
$value = $history['value'];
break;
}
if ($item['valuemapid'] > 0) {
$value = applyValueMap($value, $item['valuemapid']);
}
if ($this->screenitem['style'] == 0) {
$value = new CPre($value);
}
$table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $history['clock']), $value]);
}
$footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
return $this->getOutput((new CUiWidget(uniqid(), [$table, $footer]))->setHeader($host['name'] . NAME_DELIMITER . $item['name_expanded']));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:60,代码来源:CScreenPlainText.php
示例2: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
// if screen is defined in template, then 'real_resourceid' is defined and should be used
if (!empty($this->screenitem['real_resourceid'])) {
$this->screenitem['resourceid'] = $this->screenitem['real_resourceid'];
}
if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
$newitemid = get_same_item_for_host($this->screenitem['resourceid'], $this->hostid);
$this->screenitem['resourceid'] = !empty($newitemid) ? $newitemid : 0;
}
if ($this->screenitem['resourceid'] == 0) {
$table = new CTableInfo(_('No values found.'));
$table->setHeader(array(_('Timestamp'), _('Item')));
return $this->getOutput($table);
}
$items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid($this->screenitem['resourceid'])));
$item = reset($items);
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_TEXT:
case ITEM_VALUE_TYPE_LOG:
$orderField = 'id';
break;
case ITEM_VALUE_TYPE_FLOAT:
case ITEM_VALUE_TYPE_UINT64:
default:
$orderField = array('itemid', 'clock');
}
$host = get_host_by_itemid($this->screenitem['resourceid']);
$table = new CTableInfo(_('No values found.'));
$table->setHeader(array(_('Timestamp'), $host['name'] . NAME_DELIMITER . $item['name_expanded']));
$stime = zbxDateToTime($this->timeline['stime']);
$histories = API::History()->get(array('history' => $item['value_type'], 'itemids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN, 'sortfield' => $orderField, 'limit' => $this->screenitem['elements'], 'time_from' => $stime, 'time_till' => $stime + $this->timeline['period']));
foreach ($histories as $history) {
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_FLOAT:
sscanf($history['value'], '%f', $value);
break;
case ITEM_VALUE_TYPE_TEXT:
case ITEM_VALUE_TYPE_STR:
case ITEM_VALUE_TYPE_LOG:
$value = $this->screenitem['style'] ? new CJsScript($history['value']) : $history['value'];
break;
default:
$value = $history['value'];
break;
}
if ($item['valuemapid'] > 0) {
$value = applyValueMap($value, $item['valuemapid']);
}
$class = $this->screenitem['style'] ? null : 'pre';
$table->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $history['clock']), new CCol($value, $class)));
}
return $this->getOutput($table);
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:59,代码来源:CScreenPlainText.php
示例3: get_timeperiod_form
//.........这里部分代码省略.........
$tblPeriod->addRow(array(_('Month'), $tabMonths));
$radioDaily = new CTag('input');
$radioDaily->setAttribute('type', 'radio');
$radioDaily->setAttribute('name', 'new_timeperiod[month_date_type]');
$radioDaily->setAttribute('value', '0');
$radioDaily->setAttribute('onclick', 'submit()');
$radioDaily2 = new CTag('input');
$radioDaily2->setAttribute('type', 'radio');
$radioDaily2->setAttribute('name', 'new_timeperiod[month_date_type]');
$radioDaily2->setAttribute('value', '1');
$radioDaily2->setAttribute('onclick', 'submit()');
if ($new_timeperiod['month_date_type']) {
$radioDaily2->setAttribute('checked', 'checked');
} else {
$radioDaily->setAttribute('checked', 'checked');
}
$tblPeriod->addRow(array(_('Date'), array($radioDaily, _('Day'), SPACE, SPACE, $radioDaily2, _('Day of week'))));
if ($new_timeperiod['month_date_type'] > 0) {
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
$cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']);
$cmbCount->addItem(1, _('First'));
$cmbCount->addItem(2, _('Second'));
$cmbCount->addItem(3, _('Third'));
$cmbCount->addItem(4, _('Fourth'));
$cmbCount->addItem(5, _('Last'));
$td = new CCol($cmbCount);
$td->setColSpan(2);
$tabDays = new CTable();
$tabDays->addRow($td);
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday')));
$tblPeriod->addRow(array(_('Day of week'), $tabDays));
} else {
$tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
$tblPeriod->addRow(array(_('Day of month'), new CNumericBox('new_timeperiod[day]', $new_timeperiod['day'], 2)));
}
} else {
$tblPeriod->addItem(new CVar('new_timeperiod[every]', $new_timeperiod['every'], 'new_timeperiod_every_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month), 'new_timeperiod_month_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'], 'new_timeperiod_day_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[hour]', $new_timeperiod['hour'], 'new_timeperiod_hour_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[minute]', $new_timeperiod['minute'], 'new_timeperiod_minute_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
$tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
$tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->addAction('onclick', 'javascript: var pos = getPosition(this); pos.top += 10; pos.left += 16; CLNDR["new_timeperiod_date"].clndr.clndrshow(pos.top, pos.left);');
$filtertimetab = new CTable(null, 'calendar');
$filtertimetab->setAttribute('width', '10%');
$filtertimetab->setCellPadding(0);
$filtertimetab->setCellSpacing(0);
$startDate = zbxDateToTime($new_timeperiod['start_date']);
if (isset($_REQUEST['add_timeperiod'])) {
$newTimePeriodYear = get_request('new_timeperiod_year');
$newTimePeriodMonth = get_request('new_timeperiod_month');
$newTimePeriodDay = get_request('new_timeperiod_day');
$newTimePeriodHours = get_request('new_timeperiod_hour');
$newTimePeriodMinutes = get_request('new_timeperiod_minute');
} elseif ($startDate > 0) {
$newTimePeriodYear = date('Y', $startDate);
$newTimePeriodMonth = date('m', $startDate);
$newTimePeriodDay = date('d', $startDate);
$newTimePeriodHours = date('H', $startDate);
$newTimePeriodMinutes = date('i', $startDate);
} else {
$newTimePeriodYear = '';
$newTimePeriodMonth = '';
$newTimePeriodDay = '';
$newTimePeriodHours = '';
$newTimePeriodMinutes = '';
}
$filtertimetab->addRow(array(new CNumericBox('new_timeperiod_day', $newTimePeriodDay, 2), '/', new CNumericBox('new_timeperiod_month', $newTimePeriodMonth, 2), '/', new CNumericBox('new_timeperiod_year', $newTimePeriodYear, 4), SPACE, new CNumericBox('new_timeperiod_hour', $newTimePeriodHours, 2), ':', new CNumericBox('new_timeperiod_minute', $newTimePeriodMinutes, 2), $clndr_icon));
zbx_add_post_js('create_calendar(null, ["new_timeperiod_day", "new_timeperiod_month", "new_timeperiod_year", "new_timeperiod_hour", "new_timeperiod_minute"], "new_timeperiod_date", "new_timeperiod_start_date");');
$tblPeriod->addRow(array(_('Date'), $filtertimetab));
}
if ($new_timeperiod['timeperiod_type'] != TIMEPERIOD_TYPE_ONETIME) {
$tabTime = new CTable(null, 'calendar');
$tabTime->addRow(array(new CNumericBox('new_timeperiod[hour]', $new_timeperiod['hour'], 2), ':', new CNumericBox('new_timeperiod[minute]', $new_timeperiod['minute'], 2)));
$tblPeriod->addRow(array(_('At (hour:minute)'), $tabTime));
}
$perHours = new CComboBox('new_timeperiod[period_hours]', $new_timeperiod['period_hours']);
for ($i = 0; $i < 24; $i++) {
$perHours->addItem($i, $i);
}
$perMinutes = new CComboBox('new_timeperiod[period_minutes]', $new_timeperiod['period_minutes']);
for ($i = 0; $i < 60; $i++) {
$perMinutes->addItem($i, $i);
}
$tblPeriod->addRow(array(_('Maintenance period length'), array(new CNumericBox('new_timeperiod[period_days]', $new_timeperiod['period_days'], 3), _('Days') . SPACE . SPACE, $perHours, SPACE . _('Hours'), $perMinutes, SPACE . _('Minutes'))));
$td = new CCol(array(new CSubmit('add_timeperiod', $new ? _('Save') : _('Add')), SPACE, new CSubmit('cancel_new_timeperiod', _('Cancel'))));
$td->setAttribute('colspan', '3');
$td->setAttribute('style', 'text-align: right;');
$tblPeriod->setFooter($td);
return $tblPeriod;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:forms.inc.php
示例4: _
case AUDIT_ACTION_ENABLE:
$action = _('Enabled');
break;
case AUDIT_ACTION_DISABLE:
$action = _('Disabled');
break;
default:
$action = _('Unknown action');
}
$audit['action'] = $action;
$audit['resourcetype'] = audit_resource2str($audit['resourcetype']);
if (empty($audit['details'])) {
$audit['details'] = DBfetchArray(DBselect('SELECT ad.table_name,ad.field_name,ad.oldvalue,ad.newvalue' . ' FROM auditlog_details ad' . ' WHERE ad.auditid=' . $audit['auditid']));
}
$data['actions'][$audit['auditid']] = $audit;
}
if (!empty($data['actions'])) {
order_result($data['actions'], 'clock', ZBX_SORT_DOWN);
}
// get paging
$data['paging'] = getPagingLine($data['actions']);
// get timeline
unset($sqlWhere['from'], $sqlWhere['till']);
$sql = 'SELECT a.auditid,a.clock' . ' FROM auditlog a,users u' . ' WHERE u.userid=a.userid' . implode('', $sqlWhere) . ' AND ' . DBin_node('u.userid', get_current_nodeid(null, PERM_READ_ONLY)) . ' ORDER BY a.clock';
$firstAudit = DBfetch(DBselect($sql, $config['search_limit'] + 1));
$data['timeline'] = array('period' => $effectivePeriod, 'starttime' => date('YmdHis', !empty($firstAudit) ? $firstAudit['clock'] : null), 'usertime' => isset($_REQUEST['stime']) ? date('YmdHis', zbxDateToTime($data['stime']) + $effectivePeriod) : null);
// render view
$auditView = new CView('administration.auditlogs.list', $data);
$auditView->render();
$auditView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:auditlogs.php
示例5: get_timeperiod_form
//.........这里部分代码省略.........
$new_timeperiod['month_feb'] = $month[1];
$new_timeperiod['month_mar'] = $month[2];
$new_timeperiod['month_apr'] = $month[3];
$new_timeperiod['month_may'] = $month[4];
$new_timeperiod['month_jun'] = $month[5];
$new_timeperiod['month_jul'] = $month[6];
$new_timeperiod['month_aug'] = $month[7];
$new_timeperiod['month_sep'] = $month[8];
$new_timeperiod['month_oct'] = $month[9];
$new_timeperiod['month_nov'] = $month[10];
$new_timeperiod['month_dec'] = $month[11];
$bit_dayofweek = strrev($dayofweek);
$bit_month = strrev($month);
$cmbType = new CComboBox('new_timeperiod[timeperiod_type]', $new_timeperiod['timeperiod_type'], 'submit()');
$cmbType->addItem(TIMEPERIOD_TYPE_ONETIME, _('One time only'));
$cmbType->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily'));
$cmbType->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly'));
$cmbType->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly'));
$tblPeriod->addRow(array(_('Period type'), $cmbType));
if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_DAILY) {
$tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
$tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month)));
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
$tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
$tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
$tblPeriod->addRow(array(_('Every day(s)'), new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 3)));
} elseif ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY) {
$tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month)));
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
$tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
$tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
$tblPeriod->addRow(array(_('Every week(s)'), new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 2)));
$tabDays = new CTable();
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday')));
$tblPeriod->addRow(array(_('Day of week'), $tabDays));
} elseif ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY) {
$tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
$tabMonths = new CTable();
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jan]', $month[0], null, 1), _('January'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_jul]', $month[6], null, 1), _('July')));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_feb]', $month[1], null, 1), _('February'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_aug]', $month[7], null, 1), _('August')));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_mar]', $month[2], null, 1), _('March'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_sep]', $month[8], null, 1), _('September')));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_apr]', $month[3], null, 1), _('April'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_oct]', $month[9], null, 1), _('October')));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_may]', $month[4], null, 1), _('May'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_nov]', $month[10], null, 1), _('November')));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jun]', $month[5], null, 1), _('June'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_dec]', $month[11], null, 1), _('December')));
$tblPeriod->addRow(array(_('Month'), $tabMonths));
$tblPeriod->addRow(array(_('Date'), array(new CRadioButton('new_timeperiod[month_date_type]', '0', null, null, !$new_timeperiod['month_date_type'], 'submit()'), _('Day'), SPACE, new CRadioButton('new_timeperiod[month_date_type]', '1', null, null, $new_timeperiod['month_date_type'], 'submit()'), _('Day of week'))));
if ($new_timeperiod['month_date_type'] > 0) {
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
$cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']);
$cmbCount->addItem(1, _('First'));
$cmbCount->addItem(2, _('Second'));
$cmbCount->addItem(3, _('Third'));
$cmbCount->addItem(4, _('Fourth'));
$cmbCount->addItem(5, _('Last'));
$td = new CCol($cmbCount);
$td->setColSpan(2);
$tabDays = new CTable();
$tabDays->addRow($td);
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday')));
$tblPeriod->addRow(array(_('Day of week'), $tabDays));
} else {
$tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
$tblPeriod->addRow(array(_('Day of month'), new CNumericBox('new_timeperiod[day]', $new_timeperiod['day'], 2)));
}
} else {
$tblPeriod->addItem(new CVar('new_timeperiod[every]', $new_timeperiod['every'], 'new_timeperiod_every_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month), 'new_timeperiod_month_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'], 'new_timeperiod_day_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[hour]', $new_timeperiod['hour'], 'new_timeperiod_hour_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[minute]', $new_timeperiod['minute'], 'new_timeperiod_minute_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
$tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
$tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
if (isset($_REQUEST['add_timeperiod'])) {
$date = array('y' => getRequest('new_timeperiod_start_date_year'), 'm' => getRequest('new_timeperiod_start_date_month'), 'd' => getRequest('new_timeperiod_start_date_day'), 'h' => getRequest('new_timeperiod_start_date_hour'), 'i' => getRequest('new_timeperiod_start_date_minute'));
} else {
$date = zbxDateToTime($new_timeperiod['start_date'] ? $new_timeperiod['start_date'] : date(TIMESTAMP_FORMAT_ZERO_TIME, time()));
}
$tblPeriod->addRow(array(_('Date'), createDateSelector('new_timeperiod_start_date', $date)));
}
if ($new_timeperiod['timeperiod_type'] != TIMEPERIOD_TYPE_ONETIME) {
$tblPeriod->addRow(array(_('At (hour:minute)'), array(new CNumericBox('new_timeperiod[hour]', $new_timeperiod['hour'], 2), ':', new CNumericBox('new_timeperiod[minute]', $new_timeperiod['minute'], 2))));
}
$perHours = new CComboBox('new_timeperiod[period_hours]', $new_timeperiod['period_hours'], null, range(0, 23));
$perMinutes = new CComboBox('new_timeperiod[period_minutes]', $new_timeperiod['period_minutes'], null, range(0, 59));
$tblPeriod->addRow(array(_('Maintenance period length'), array(new CNumericBox('new_timeperiod[period_days]', $new_timeperiod['period_days'], 3), _('Days') . SPACE . SPACE, $perHours, _('Hours') . SPACE . SPACE, $perMinutes, _('Minutes'))));
return $tblPeriod;
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:101,代码来源:forms.inc.php
示例6: zbxDateToTime
} else {
$fromDate = zbxDateToTime($this->data['active_since']);
$activeSince = $this->data['active_since'];
}
$maintenanceForm->addVar('active_since', $activeSince);
// active till
if (isset($_REQUEST['active_till'])) {
$toYear = get_request('active_till_year');
$toMonth = get_request('active_till_month');
$toDay = get_request('active_till_day');
$toHours = get_request('active_till_hour');
$toMinutes = get_request('active_till_minute');
$toDate = array('y' => $toYear, 'm' => $toMonth, 'd' => $toDay, 'h' => $toHours, 'i' => $toMinutes);
$activeTill = $toYear . $toMonth . $toDay . $toHours . $toMinutes;
} else {
$toDate = zbxDateToTime($this->data['active_till']);
$activeTill = $this->data['active_till'];
}
$maintenanceForm->addVar('active_till', $activeTill);
$maintenanceFormList->addRow(_('Active since'), createDateSelector('active_since', $fromDate, 'active_till'));
$maintenanceFormList->addRow(_('Active till'), createDateSelector('active_till', $toDate, 'active_since'));
$maintenanceFormList->addRow(_('Description'), new CTextArea('description', $this->data['description']));
/*
* Maintenance period tab
*/
$maintenancePeriodFormList = new CFormList('maintenancePeriodFormList');
$maintenancePeriodTable = new CTable(_('No maintenance periods defined.'), 'formElementTable');
$maintenancePeriodTable->setHeader(array(_('Period type'), _('Schedule'), _('Period'), _('Action')));
foreach ($this->data['timeperiods'] as $id => $timeperiod) {
$maintenancePeriodTable->addRow(array(new CCol(timeperiod_type2str($timeperiod['timeperiod_type']), 'nowrap'), new CCol(shedule2str($timeperiod), 'wraptext'), new CCol(zbx_date2age(0, $timeperiod['period']), 'nowrap'), new CCol(array(new CSubmit('edit_timeperiodid[' . $id . ']', _('Edit'), null, 'link_menu'), SPACE . SPACE, new CSubmit('del_timeperiodid[' . $id . ']', _('Remove'), null, 'link_menu')), 'nowrap')));
if (isset($timeperiod['timeperiodid'])) {
开发者ID:itnihao,项目名称:Zabbix_,代码行数:31,代码来源:configuration.maintenance.edit.php
示例7: setSTime
public function setSTime($stime)
{
if ($stime > 19000000000000.0 && $stime < 21000000000000.0) {
$this->stime = zbxDateToTime($stime);
} else {
$this->stime = $stime;
}
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:8,代码来源:class.cgraphdraw.php
示例8: navigation_bar_calc
function navigation_bar_calc($idx = null, $idx2 = 0, $update = false)
{
if (!empty($idx)) {
if ($update) {
if (!empty($_REQUEST['period']) && $_REQUEST['period'] >= ZBX_MIN_PERIOD) {
CProfile::update($idx . '.period', $_REQUEST['period'], PROFILE_TYPE_INT, $idx2);
}
if (!empty($_REQUEST['stime'])) {
CProfile::update($idx . '.stime', $_REQUEST['stime'], PROFILE_TYPE_STR, $idx2);
}
}
$_REQUEST['period'] = get_request('period', CProfile::get($idx . '.period', ZBX_PERIOD_DEFAULT, $idx2));
$_REQUEST['stime'] = get_request('stime', CProfile::get($idx . '.stime', null, $idx2));
}
$_REQUEST['period'] = get_request('period', ZBX_PERIOD_DEFAULT);
$_REQUEST['stime'] = get_request('stime', null);
if ($_REQUEST['period'] < ZBX_MIN_PERIOD) {
show_message(_n('Warning. Minimum time period to display is %1$s hour.', 'Warning. Minimum time period to display is %1$s hours.', (int) ZBX_MIN_PERIOD / SEC_PER_HOUR));
$_REQUEST['period'] = ZBX_MIN_PERIOD;
} elseif ($_REQUEST['period'] > ZBX_MAX_PERIOD) {
show_message(_n('Warning. Maximum time period to display is %1$s day.', 'Warning. Maximum time period to display is %1$s days.', (int) ZBX_MAX_PERIOD / SEC_PER_DAY));
$_REQUEST['period'] = ZBX_MAX_PERIOD;
}
if (!empty($_REQUEST['stime'])) {
$time = zbxDateToTime($_REQUEST['stime']);
if ($time + $_REQUEST['period'] > time()) {
$_REQUEST['stime'] = date('YmdHis', time() - $_REQUEST['period']);
}
} else {
$_REQUEST['stime'] = date('YmdHis', time() - $_REQUEST['period']);
}
return $_REQUEST['period'];
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:33,代码来源:graphs.inc.php
示例9: order_result
order_result($actions, 'clock', ZBX_SORT_DOWN);
$paging = getPagingLine($actions);
//---------
foreach ($actions as $num => $row) {
if (empty($row['details'])) {
$details = array();
$sql = 'SELECT table_name,field_name,oldvalue,newvalue ' . ' FROM auditlog_details ' . ' WHERE auditid=' . $row['auditid'];
$db_details = DBselect($sql);
while ($db_detail = DBfetch($db_details)) {
$details[] = array($db_detail['table_name'] . '.' . $db_detail['field_name'] . ': ' . $db_detail['oldvalue'] . ' => ' . $db_detail['newvalue'], BR());
}
} else {
$details = $row['details'];
}
$table->addRow(array(zbx_date2str(S_AUDITLOGS_RECORD_DATE_FORMAT, $row['clock']), $row['alias'], $row['ip'], $row['resourcetype'], $row['action'], $row['resourceid'], $row['resourcename'], new CCol($details, 'wraptext')));
}
// PAGING FOOTER
$table = array($paging, $table, $paging);
//---------
$audit_wdgt->addItem($table);
$audit_wdgt->show();
// NAV BAR
$timeline = array('period' => $effectiveperiod, 'starttime' => date('YmdHis', $starttime), 'usertime' => null);
if (isset($_REQUEST['stime'])) {
$timeline['usertime'] = date('YmdHis', zbxDateToTime($_REQUEST['stime']) + $timeline['period']);
}
$dom_graph_id = 'events';
$objData = array('id' => 'timeline_1', 'domid' => $dom_graph_id, 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1);
zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
include_once 'include/page_footer.php';
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:auditlogs.php
示例10: get_screen
//.........这里部分代码省略.........
}
}
$url = $graph['graphtype'] == GRAPH_TYPE_PIE || $graph['graphtype'] == GRAPH_TYPE_EXPLODED ? 'chart7.php' : 'chart3.php';
$url = new Curl($url);
foreach ($graph as $name => $value) {
if ($name == 'width' || $name == 'height') {
continue;
}
$url->setArgument($name, $value);
}
$new_items = get_same_graphitems_for_host($graph['gitems'], $_REQUEST['hostid'], false);
foreach ($new_items as $gitem) {
unset($gitem['gitemid']);
unset($gitem['graphid']);
foreach ($gitem as $name => $value) {
$url->setArgument('items[' . $gitem['itemid'] . '][' . $name . ']', $value);
}
}
$url->setArgument('name', $host['host'] . ': ' . $graph['name']);
$url = $url->getUrl();
}
//-------------
$objData = array('id' => $resourceid, 'domid' => $dom_graph_id, 'containerid' => $containerid, 'objDims' => $graphDims, 'loadSBox' => 0, 'loadImage' => 1, 'loadScroll' => 0, 'dynamic' => 0);
$default = false;
if ($graphDims['graphtype'] == GRAPH_TYPE_PIE || $graphDims['graphtype'] == GRAPH_TYPE_EXPLODED) {
if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
$url = 'chart6.php?graphid=' . $resourceid;
$default = true;
}
$timeline = array();
$timeline['period'] = $effectiveperiod;
$timeline['starttime'] = date('YmdHis', get_min_itemclock_by_graphid($resourceid));
if (isset($_REQUEST['stime'])) {
$timeline['usertime'] = date('YmdHis', zbxDateToTime($_REQUEST['stime']) + $timeline['period']);
}
// $src = $url.'&width='.$width.'&height='.$height.'&legend='.$legend.'&graph3d='.$graph3d;
$src = $url . '&width=' . $width . '&height=' . $height . '&legend=' . $legend . '&graph3d=' . $graph3d . '&period=' . $effectiveperiod . url_param('stime');
$objData['src'] = $src;
} else {
if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
$url = 'chart2.php?graphid=' . $resourceid;
$default = true;
}
$src = $url . '&width=' . $width . '&height=' . $height . '&period=' . $effectiveperiod . url_param('stime');
$timeline = array();
if (isset($graphid) && !is_null($graphid) && $editmode != 1) {
$timeline['period'] = $effectiveperiod;
$timeline['starttime'] = date('YmdHis', time() - ZBX_MAX_PERIOD);
//get_min_itemclock_by_graphid($graphid);
if (isset($_REQUEST['stime'])) {
$timeline['usertime'] = date('YmdHis', zbxDateToTime($_REQUEST['stime']) + $timeline['period']);
}
$objData['loadSBox'] = 1;
}
$objData['src'] = $src;
}
if ($editmode || !$default) {
$item = new CDiv();
} else {
$item = new CLink(null, $action);
}
$item->setAttribute('id', $containerid);
$item = array($item);
if ($editmode == 1) {
$item[] = BR();
$item[] = new CLink(S_CHANGE, $action);
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:67,代码来源:screens.inc.php
示例11: array
$left_tab->setCellSpacing(3);
// MAINTENANCE FORM {{{
if (isset($_REQUEST['maintenanceid']) && !isset($_REQUEST['form_refresh'])) {
$options = array('editable' => 1, 'maintenanceids' => $_REQUEST['maintenanceid'], 'output' => API_OUTPUT_EXTEND);
$maintenance = CMaintenance::get($options);
$maintenance = reset($maintenance);
$mname = $maintenance['name'];
$maintenance_type = $maintenance['maintenance_type'];
$active_since = $maintenance['active_since'];
$active_till = $maintenance['active_till'];
$description = $maintenance['description'];
} else {
$mname = get_request('mname', '');
$maintenance_type = get_request('maintenance_type', 0);
$active_since = zbxDateToTime(get_request('active_since', date('YmdHis')));
$active_till = zbxDateToTime(get_request('active_till', date('YmdHis', time() + 86400)));
$description = get_request('description', '');
}
$tblMntc = new CTable(null, 'formElementTable');
$tblMntc->addRow(array(S_NAME, new CTextBox('mname', $mname, 50)));
$cmbType = new CComboBox('maintenance_type', $maintenance_type);
$cmbType->addItem(MAINTENANCE_TYPE_NORMAL, S_WITH_DATA_COLLECTION);
$cmbType->addItem(MAINTENANCE_TYPE_NODATA, S_NO_DATA_COLLECTION);
$tblMntc->addRow(array(S_MAINTENANCE_TYPE, $cmbType));
$tblMntc->addItem(new Cvar('active_since', date('YmdHis', $active_since)));
$tblMntc->addItem(new Cvar('active_till', date('YmdHis', $active_till)));
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->addAction('onclick', 'javascript: var pos = getPosition(this); ' . 'pos.top+=10; pos.left+=16; CLNDR["mntc_active_since"].clndr.clndrshow(pos.top,pos.left);');
zbx_add_post_js('create_calendar(null, ["mntc_since_day","mntc_since_month","mntc_since_year",' . '"mntc_since_hour","mntc_since_minute"],"mntc_active_since","active_since");');
$tblMntc->addRow(array(S_ACTIVE_SINCE, array(new CNumericBox('mntc_since_day', $active_since > 0 ? date('d', $active_since) : '', 2), '/', new CNumericBox('mntc_since_month', $active_since > 0 ? date('m', $active_since) : '', 2), '/', new CNumericBox('mntc_since_year', $active_since > 0 ? date('Y', $active_since) : '', 4), SPACE, new CNumericBox('mntc_since_hour', $active_since > 0 ? date('H', $active_since) : '', 2), ':', new CNumericBox('mntc_since_minute', $active_since > 0 ? date('i', $active_since) : '', 2), $clndr_icon)));
$clndr_icon->addAction('onclick', 'javascript: var pos = getPosition(this); ' . 'pos.top+=10; pos.left+=16; CLNDR["mntc_active_till"].clndr.clndrshow(pos.top,pos.left);');
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:maintenance.php
示例12: foreach
foreach (eventSourceObjects() as $eventSource) {
$data['alerts'] = array_merge($data['alerts'], API::Alert()->get(array('output' => API_OUTPUT_EXTEND, 'selectMediatypes' => API_OUTPUT_EXTEND, 'userids' => $userId, 'time_from' => $from, 'time_till' => $till, 'eventsource' => $eventSource['source'], 'eventobject' => $eventSource['object'], 'limit' => $config['search_limit'] + 1)));
}
CArrayHelper::sort($data['alerts'], array(array('field' => 'alertid', 'order' => ZBX_SORT_DOWN)));
$data['alerts'] = array_slice($data['alerts'], 0, $config['search_limit'] + 1);
// paging
$data['paging'] = getPagingLine($data['alerts']);
// get users
if (!$data['alias']) {
$data['users'] = API::User()->get(array('output' => array('userid', 'alias', 'name', 'surname'), 'userids' => zbx_objectValues($data['alerts'], 'userid'), 'preservekeys' => true));
}
}
// get first alert clock
$firstAlert = null;
if ($userId) {
$firstAlert = DBfetch(DBselect('SELECT MIN(a.clock) AS clock' . ' FROM alerts a' . ' WHERE a.userid=' . zbx_dbstr($userId)));
} elseif ($data['alias'] === '') {
$firstAlert = DBfetch(DBselect('SELECT MIN(a.clock) AS clock FROM alerts a'));
}
$minStartTime = $firstAlert ? $firstAlert['clock'] : null;
// get actions names
if ($data['alerts']) {
$data['actions'] = API::Action()->get(array('output' => array('actionid', 'name'), 'actionids' => array_unique(zbx_objectValues($data['alerts'], 'actionid')), 'preservekeys' => true));
}
// timeline
$data['timeline'] = array('period' => $effectivePeriod, 'starttime' => date(TIMESTAMP_FORMAT, $minStartTime), 'usertime' => $data['stime'] ? date(TIMESTAMP_FORMAT, zbxDateToTime($data['stime']) + $effectivePeriod) : null);
// render view
$auditView = new CView('administration.auditacts.list', $data);
$auditView->render();
$auditView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:auditacts.php
示例13: navigation_bar_calc
function navigation_bar_calc($idx = null, $idx2 = 0, $update = false)
{
//SDI($_REQUEST['stime']);
if (!is_null($idx)) {
if ($update) {
if (isset($_REQUEST['period']) && $_REQUEST['period'] >= ZBX_MIN_PERIOD) {
CProfile::update($idx . '.period', $_REQUEST['period'], PROFILE_TYPE_INT, $idx2);
}
if (isset($_REQUEST['stime'])) {
CProfile::update($idx . '.stime', $_REQUEST['stime'], PROFILE_TYPE_STR, $idx2);
}
}
$_REQUEST['period'] = get_request('period', CProfile::get($idx . '.period', ZBX_PERIOD_DEFAULT, $idx2));
$_REQUEST['stime'] = get_request('stime', CProfile::get($idx . '.stime', null, $idx2));
}
$_REQUEST['period'] = get_request('period', ZBX_PERIOD_DEFAULT);
$_REQUEST['stime'] = get_request('stime', null);
if ($_REQUEST['period'] < ZBX_MIN_PERIOD) {
show_message(S_WARNING . '. ' . S_TIME_PERIOD . SPACE . S_MIN_VALUE_SMALL . ': ' . ZBX_MIN_PERIOD . ' (' . (int) (ZBX_MIN_PERIOD / 3600) . S_HOUR_SHORT . ')');
$_REQUEST['period'] = ZBX_MIN_PERIOD;
} else {
if ($_REQUEST['period'] > ZBX_MAX_PERIOD) {
show_message(S_WARNING . '. ' . S_TIME_PERIOD . SPACE . S_MAX_VALUE_SMALL . ': ' . ZBX_MAX_PERIOD . ' (' . (int) (ZBX_MAX_PERIOD / 86400) . S_DAY_SHORT . ')');
$_REQUEST['period'] = ZBX_MAX_PERIOD;
}
}
if (isset($_REQUEST['stime'])) {
$time = zbxDateToTime($_REQUEST['stime']);
if ($time + $_REQUEST['period'] > time()) {
$_REQUEST['stime'] = date('YmdHis', time() - $_REQUEST['period']);
}
} else {
$_REQUEST['stime'] = date('YmdHis', time() - $_REQUEST['period']);
}
return $_REQUEST['period'];
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:36,代码来源:graphs.inc.php
示例14: zbx_date2str
$to = zbx_date2str(_('d M Y H:i'), $serviceTime['ts_to']);
break;
}
$row = new CRow(array(array($type, new CVar('times[' . $i . '][type]', $serviceTime['type']), new CVar('times[' . $i . '][ts_from]', $serviceTime['ts_from']), new CVar('times[' . $i . '][ts_to]', $serviceTime['ts_to']), new CVar('times[' . $i . '][note]', $serviceTime['note'])), $from . ' - ' . $to, htmlspecialchars($serviceTime['note']), new CButton('remove', _('Remove'), 'javascript: removeTime(\'' . $i . '\');', 'link_menu')));
$row->setAttribute('id', 'times_' . $i);
$servicesTimeTable->addRow($row);
$i++;
}
$servicesTimeFormList->addRow(_('Service times'), new CDiv($servicesTimeTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// create service time table
$serviceTimeTable = new CTable(null, 'formElementTable');
if ($this->data['new_service_time']['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME) {
$downtimeSince = date('YmdHis');
$downtimeTill = date('YmdHis', time() + 86400);
$downtimeSince = zbxDateToTime($downtimeSince);
$downtimeTill = zbxDateToTime($downtimeTill);
// create calendar table
$timeCalendarTable = new CTable();
$calendarIcon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$calendarIcon->addAction('onclick', "javascript: var pos = getPosition(this); pos.top -= 203; pos.left += 16; CLNDR['downtime_since'].clndr.clndrshow(pos.top, pos.left); CLNDR['downtime_till'].clndr.clndrhide();");
// downtime since
if (isset($_REQUEST['new_service_time']['from'])) {
$year = get_request('downtime_since_year');
$month = get_request('downtime_since_month');
$day = get_request('downtime_since_day');
$hours = get_request('downtime_since_hour');
$minutes = get_request('downtime_since_minute');
} elseif ($downtimeSince > 0) {
$year = date('Y', $downtimeSince);
$month = date('m', $downtimeSince);
$day = date('d', $downtimeSince);
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:configuration.services.edit.php
示例15: navigation_bar_calc
if (isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst'])) {
CProfile::update('web.auditacts.filter.alias', $_REQUEST['alias'], PROFILE_TYPE_STR);
}
/*
* Display
*/
$effectivePeriod = navigation_bar_calc('web.auditacts.timeline', 0, true);
$data = array('stime' =&g
|
请发表评论