downtimes-header: Be more efficient when listing downtimes

This commit is contained in:
Johannes Meyer 2015-07-10 14:39:30 +02:00
parent bba57d2bbc
commit 006d2cb537

View File

@ -2,7 +2,7 @@
<tbody> <tbody>
<?php $i = 0; foreach ($downtimes as $downtime): <?php $i = 0; foreach ($downtimes as $downtime):
if (++ $i > 5) { if (++ $i > 5) {
continue; break;
} ?> } ?>
<tr class="state <?= $downtime->stateText ?>"> <tr class="state <?= $downtime->stateText ?>">
<td class="state"> <td class="state">
@ -68,18 +68,18 @@
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<p> <?php if (count($downtimes) > 5): ?>
<?php if ($i > 5): ?> <p>
<?= $this->qlink( <?= $this->qlink(
sprintf($this->translate('show all %d downtimes'), $i), sprintf($this->translate('show all %d downtimes'), $i),
$listAllLink, $listAllLink,
null, null,
array( array(
'icon' => $i > 5 ? 'down-open' : '', 'icon' => 'down-open',
'data-base-target' => "_next" 'data-base-target' => "_next"
) )
) ?> ) ?>
<?php endif ?> </p>
</p> <?php endif ?>