示例#1
0
$lastDataHeader = new CCol(new CSpan(_x('Change', 'noun in latest data')), 'latest-data');
$lastDataHeader->setAttribute('title', _x('Change', 'noun in latest data'));
$checkAllCheckbox = new CCheckBox('all_items', null, "checkAll('" . $form->getName() . "', 'all_items', 'itemids');");
$checkAllCheckboxCol = new CCol($checkAllCheckbox, 'latest-checkbox');
if ($filter['showDetails']) {
    $intervalHeader = new CCol(new CSpan(_('Interval')), 'latest-interval');
    $intervalHeader->setAttribute('title', _('Interval'));
    $historyHeader = new CCol(new CSpan(_('History')), 'latest-history');
    $historyHeader->setAttribute('title', _('History'));
    $trendsHeader = new CCol(new CSpan(_('Trends')), 'latest-trends');
    $trendsHeader->setAttribute('title', _('Trends'));
    $typeHeader = new CCol(new CSpan(_('Type')), 'latest-type');
    $typeHeader->setAttribute('title', _('Type'));
    $infoHeader = new CCol(new CSpan(_('Info')), 'latest-info');
    $infoHeader->setAttribute('title', _('Info'));
    $table->addClass('latest-details');
    $table->setHeader(array(new CCol(new CDiv(null, 'app-list-toggle-all icon-plus-9x9')), $checkAllCheckboxCol, $hostHeader, $nameHeader, $intervalHeader, $historyHeader, $trendsHeader, $typeHeader, $lastCheckHeader, $lastValueHeader, $lastDataHeader, new CCol(null, 'latest-actions'), $infoHeader));
} else {
    $table->setHeader(array(new CCol(new CDiv(null, 'app-list-toggle-all icon-plus-9x9')), $checkAllCheckboxCol, $hostHeader, $nameHeader, $lastCheckHeader, $lastValueHeader, $lastDataHeader, new CCol(null, 'latest-actions')));
}
$tab_rows = array();
foreach ($items as $key => $item) {
    if (!$item['applications']) {
        continue;
    }
    $lastHistory = isset($history[$item['itemid']][0]) ? $history[$item['itemid']][0] : null;
    $prevHistory = isset($history[$item['itemid']][1]) ? $history[$item['itemid']][1] : null;
    if (strpos($item['units'], ',') !== false) {
        list($item['units'], $item['unitsLong']) = explode(',', $item['units']);
    } else {
        $item['unitsLong'] = '';