summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/events/index.phtml
blob: f1e4da75b2e724ac5b1bf7eb488719662ca6ed35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php if (! $this->compact): ?>
<div class="controls">
    <?= $this->tabs ?>
    <?php
    $helpMessage = $this->translate(
        'Press and hold the Ctrl key while clicking on rows to select multiple rows or press and hold the Shift key to'
        . ' select a range of rows',
        'Multi-selection help'
    );
    ?>
    <div class="selection-info" title="<?= $this->escape($helpMessage) ?>">
        <?= sprintf(
        /// TRANSLATORS: Please leave %s as it is because the selection counter is wrapped in a span tag for updating
        /// the counter via JavaScript
            $this->translate('%s row(s) selected', 'Multi-selection count'),
            '<span class="selection-info-count">0</span>'
        ) ?>
    </div>
    <?= $this->paginator ?>
    <div class="sort-controls-container">
        <?= $this->limiter ?>
        <?= $this->sortBox ?>
    </div>
    <?= $this->filterEditor ?>
    <div class="quick-filter-controls">
        <?= $this->severityFilterForm ?>
        <?= $this->ackFilterForm ?>
    </div>
</div>
<?php endif ?>
<div class="content">
<?php /** @var \Icinga\Repository\RepositoryQuery $events */if (! $events->hasResult()): ?>
    <p><?= $this->translate('No events recorded yet.') ?></p>
</div>
<?php return; endif; $displayColumns = array_merge(array('host_name', 'program', 'message', 'facility'), $additionalColumns); ?>
    <table class="common-table table-row-selectable multiselect table-responsive events-table"
           data-base-target="_next"
           data-icinga-multiselect-url="<?= $this->href('eventdb/events/details') ?>"
           data-icinga-multiselect-controllers="<?= $this->href('eventdb/events') ?>"
           data-icinga-multiselect-data="id">
        <?php if (! $this->compact): ?>
        <thead>
            <tr>
                <th></th>
                <th></th>
            <?php foreach ($displayColumns as $displayColumn): ?>
                <?= $this->columnHeader($displayColumn) ?>
            <?php endforeach ?>
            </tr>
        </thead>
        <?php endif; ?>
        <tbody>
        <?php
        foreach ($events as $eventData):
            /** @var \Icinga\Module\Eventdb\Event $event */
            $event = $this->event($eventData);
            $created = $event->created;
            $createdTs = strtotime($created);
            $url = $this->url('eventdb/event', array('id' => $event->id));
            $classes = array('priority-col', $event->getPriority());
            if ($event->ack) {
                $classes[] = 'ack';
            }
            ?>
            <tr href="<?= $url ?>">
                <td class="<?= implode(' ', $classes) ?>">
                    <div class="priority-label"><?= strtoupper($event->getPriority()) ?></div>
                    <div class="event-meta"><a href="<?= $url ?>" class="timeago" title="<?= $created ?>"><?= $this->timeAgo($createdTs) ?></a></div>
                </td>
                <td class="icon-col">
                    <?= $this->icon($event->getTypeIcon(), $event->getType()) ?>
                    <?php if ($event->ack) { echo $this->icon('ok', $this->translate('Acknowledged')); } ?>
                    <?php if ($event->group_autoclear) { echo $this->icon('reschedule', $this->translate('Auto-Clear')); } ?>
                </td>
            <?php foreach ($displayColumns as $displayColumn): ?>
                <?= $this->column($displayColumn, $event) ?>
            <?php endforeach ?>
            </tr>
        <?php endforeach ?>
        </tbody>
    </table>
<?php if ($this->compact && $events->hasMore()): ?>
    <?= $this->qlink(
        $this->translate('Show More'),
        $this->url()->without(array('view', 'limit')),
        null,
        array(
            'data-base-target'  => '_next',
            'class'             => 'action-link'
        )
    ) ?>
<?php endif; ?>
</div>