Example #1
0
                    $hostName = null;
                    if ($pageFilter->hostid == 0) {
                        $hostName = (new CSpan($host['name']))->addClass(ZBX_STYLE_LINK_ACTION)->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
                    }
                    $table->addRow([(new CLink(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event['clock']), 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']))->addClass('action'), $hostName, $triggerDescription, $statusSpan, getSeverityCell($trigger['priority'], $config, null, !$event['value']), $event['duration'], $config['event_ack_enable'] ? getEventAckState($event, $page['file']) : null, (new CCol($action))->addClass(ZBX_STYLE_NOWRAP)]);
                }
            }
        } else {
            if (!$csvExport) {
                $events = [];
                $url = (new CUrl('events.php'))->setArgument('fullscreen', getRequest('fullscreen'))->setArgument('groupid', $pageFilter->groupid)->setArgument('hostid', $pageFilter->hostid);
                $paging = getPagingLine($events, ZBX_SORT_UP, $url);
            }
        }
    }
    if (!$csvExport) {
        $table = [$table, $paging];
    }
}
if ($csvExport) {
    echo zbx_toCSV($csvRows);
} else {
    $eventsWidget->addItem($table);
    $timeline = ['period' => $period, 'starttime' => date(TIMESTAMP_FORMAT, $starttime), 'usertime' => date(TIMESTAMP_FORMAT, $till)];
    $objData = ['id' => 'timeline_1', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1, 'periodFixed' => CProfile::get('web.events.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD];
    zbx_add_post_js('jqBlink.blink();');
    zbx_add_post_js('timeControl.addObject("scroll_events_id", ' . zbx_jsvalue($timeline) . ', ' . zbx_jsvalue($objData) . ');');
    zbx_add_post_js('timeControl.processObjects();');
    $eventsWidget->show();
    require_once dirname(__FILE__) . '/include/page_footer.php';
}
                    $hostSpan->setAttribute('data-menu', hostMenuData($host, $scripts));
                }
                // action
                $action = isset($actions[$event['eventid']]) ? $actions[$event['eventid']] : ' - ';
                $table->addRow(array(new CLink(zbx_date2str(EVENTS_ACTION_TIME_FORMAT, $event['clock']), 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid'], 'action'), is_show_all_nodes() ? get_node_name_by_elid($event['objectid']) : null, $hostSpan, new CSpan($tr_desc, 'link_menu'), $statusSpan, getSeverityCell($trigger['priority'], null, !$event['value']), $event['duration'], $config['event_ack_enable'] ? $ack : null, $action));
                if ($CSV_EXPORT) {
                    $csvRows[] = array(zbx_date2str(EVENTS_ACTION_TIME_FORMAT, $event['clock']), is_show_all_nodes() ? get_node_name_by_elid($event['objectid']) : null, $_REQUEST['hostid'] == 0 ? $host['name'] : null, $description, trigger_value2str($event['value']), getSeverityCaption($trigger['priority']), $event['duration'], $config['event_ack_enable'] ? $event['acknowledges'] ? _('Yes') : _('No') : null, strip_tags((string) $action));
                }
            }
        } else {
            $events = array();
            $paging = getPagingLine($events);
        }
    }
    if ($CSV_EXPORT) {
        print zbx_toCSV($csvRows);
        exit;
    }
    $table = array($paging, $table, $paging);
}
$events_wdgt->addItem($table);
// NAV BAR
$timeline = array('period' => $effectiveperiod, 'starttime' => date('YmdHis', $starttime), 'usertime' => date('YmdHis', $till));
$dom_graph_id = 'scroll_events_id';
$objData = array('id' => 'timeline_1', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1, 'periodFixed' => CProfile::get('web.events.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
zbx_add_post_js('jqBlink.blink();');
zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
// js templates
require_once dirname(__FILE__) . '/include/views/js/general.script.confirm.js.php';
$events_wdgt->show();