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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
<?php
use Icinga\Web\Url;
$showText = $this->translate('%s: Show %s %u to %u out of %u', 'pagination.joystick');
$flipUrl = clone $baseUrl;
if ($flipUrl->getParam('flipped')) {
$flipUrl->remove('flipped');
} else {
$flipUrl->setParam('flipped');
}
if ($flipUrl->hasParam('page')) {
$flipUrl->setParam('page', implode(',', array_reverse(explode(',', $flipUrl->getParam('page')))));
}
if ($flipUrl->hasParam('limit')) {
$flipUrl->setParam('limit', implode(',', array_reverse(explode(',', $flipUrl->getParam('limit')))));
}
$yAxisItemCountPerPage = $yAxisPaginator->getLimit();
$yAxisTotalItem = $yAxisPaginator->count();
$totalYAxisPages = ceil($yAxisTotalItem / $yAxisItemCountPerPage);
$currentYAxisPage = round($yAxisPaginator->getOffset() / $yAxisItemCountPerPage) + 1;
$prevYAxisPage = $currentYAxisPage > 1 ? $currentYAxisPage - 1 : null;
$nextYAxisPage = $currentYAxisPage < $totalYAxisPages ? $currentYAxisPage + 1 : null;
$xAxisItemCountPerPage = $xAxisPaginator->getLimit();
$xAxisTotalItem = $xAxisPaginator->count();
$totalXAxisPages = ceil($xAxisTotalItem / $xAxisItemCountPerPage);
$currentXAxisPage = round($xAxisPaginator->getOffset() / $xAxisItemCountPerPage) + 1;
$prevXAxisPage = $currentXAxisPage > 1 ? $currentXAxisPage - 1 : null;
$nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : null;
?>
<table class="joystick-pagination">
<tbody>
<tr>
<td> </td>
<td>
<?php if ($prevYAxisPage): ?>
<?= $this->qlink(
'',
$baseUrl,
array(
'page' => $currentXAxisPage . ',' . $prevYAxisPage
),
array(
'icon' => 'up-open',
'data-base-target' => '_self',
'title' => sprintf(
$showText,
$this->translate('Y-Axis', 'pagination.joystick'),
$this->translate('hosts', 'pagination.joystick'),
($prevYAxisPage - 1) * $xAxisItemCountPerPage + 1,
$prevYAxisPage * $xAxisItemCountPerPage,
$yAxisTotalItem
)
)
); ?>
<?php else: ?>
<?= $this->icon('up-open'); ?>
<?php endif ?>
</td>
<td> </td>
</tr>
<tr>
<td>
<?php if ($prevXAxisPage): ?>
<?= $this->qlink(
'',
$baseUrl,
array(
'page' => $prevXAxisPage . ',' . $currentYAxisPage
),
array(
'icon' => 'left-open',
'data-base-target' => '_self',
'title' => sprintf(
$showText,
$this->translate('X-Axis', 'pagination.joystick'),
$this->translate('services', 'pagination.joystick'),
($prevXAxisPage - 1) * $xAxisItemCountPerPage + 1,
$prevXAxisPage * $xAxisItemCountPerPage,
$xAxisTotalItem
)
)
); ?>
<?php else: ?>
<?= $this->icon('left-open'); ?>
<?php endif ?>
</td>
<?php if ($this->flippable): ?>
<td><?= $this->qlink(
'',
$flipUrl,
null,
array(
'icon' => 'arrows-cw',
'data-base-target' => '_self',
'title' => $this->translate('Flip grid axes')
)
) ?></td>
<?php else: ?>
<td> </td>
<?php endif ?>
<td>
<?php if ($nextXAxisPage): ?>
<?= $this->qlink(
'',
$baseUrl,
array(
'page' => $nextXAxisPage . ',' . $currentYAxisPage
),
array(
'icon' => 'right-open',
'data-base-target' => '_self',
'title' => sprintf(
$showText,
$this->translate('X-Axis', 'pagination.joystick'),
$this->translate('services', 'pagination.joystick'),
$currentXAxisPage * $xAxisItemCountPerPage + 1,
$nextXAxisPage === $totalXAxisPages ? $xAxisItemCountPerPage : $nextXAxisPage * $xAxisItemCountPerPage,
$xAxisTotalItem
)
),
false
); ?>
<?php else: ?>
<?= $this->icon('right-open'); ?>
<?php endif ?>
</td>
</tr>
<tr>
<td> </td>
<td>
<?php if ($nextYAxisPage): ?>
<?= $this->qlink(
'',
$baseUrl,
array(
'page' => $currentXAxisPage . ',' . $nextYAxisPage
),
array(
'icon' => 'down-open',
'data-base-target' => '_self',
'title' => sprintf(
$showText,
$this->translate('Y-Axis', 'pagination.joystick'),
$this->translate('hosts', 'pagination.joystick'),
$currentYAxisPage * $yAxisItemCountPerPage + 1,
$nextYAxisPage === $totalYAxisPages ? $yAxisItemCountPerPage : $nextYAxisPage * $yAxisItemCountPerPage,
$yAxisTotalItem
)
)
); ?>
<?php else: ?>
<?= $this->icon('down-open'); ?>
<?php endif ?>
</td>
<td> </td>
</tr>
</tbody>
</table>
|