Use more readable coding style in service multi-view

refs #8565
This commit is contained in:
Matthias Jentsch 2015-03-06 12:45:29 +01:00
parent 71534369ef
commit 9fc80ec34f
1 changed files with 109 additions and 109 deletions

View File

@ -20,124 +20,130 @@ use Icinga\Web\Url;
</h3> </h3>
<?php if (($serviceCount = count($objects)) === 0): ?> <?php if (($serviceCount = count($objects)) === 0): ?>
<?= $this->translate('No services matching the filter'); ?> <?= $this->translate('No services matching the filter'); ?>
<?php else: ?> <?php else: ?>
<?= sprintf(t('Issue commands on all %d selected services'), count($objects)) ?> <?= sprintf(t('Issue commands on all %d selected services:'), count($objects)) ?>
<p> <p>
<div> <div>
<?= $checkNowForm; ?> <?= $checkNowForm; ?>
</div> </div>
<div><?= $this->qlink(
<div>
<?= $this->qlink(
$this->translate('Reschedule the next check'), $this->translate('Reschedule the next check'),
$rescheduleAllLink, $rescheduleAllLink,
null, null,
array('icon' => 'reschedule') array('icon' => 'reschedule')
); ?></div> ); ?>
<div><?= $this->qlink( </div>
<div>
<?= $this->qlink(
$this->translate('Schedule a downtime'), $this->translate('Schedule a downtime'),
$downtimeAllLink, $downtimeAllLink,
null, null,
array('icon' => 'plug') array('icon' => 'plug')
); ?></div> ); ?>
<div><?= $this->qlink( </div>
<div>
<?= $this->qlink(
$this->translate('Submit a passive check result'), $this->translate('Submit a passive check result'),
$processCheckResultAllLink, $processCheckResultAllLink,
null, null,
array('icon' => 'reply') array('icon' => 'reply')
); ?></div> ); ?>
<div><?= $this->qlink( </div>
<div>
<?= $this->qlink(
$this->translate('Add a comment'), $this->translate('Add a comment'),
$addCommentLink, $addCommentLink,
null, null,
array('icon' => 'comment') array('icon' => 'comment')
); ?></div>
</p>
<?php if (($unhandledCount = count($unhandledObjects)) > 0): ?>
<div>
<h3>
<?= $this->icon('attention-alt') ?>
<?= $this->translatePlural(
'Unhandled Problem',
'Unhandled Problems',
$unhandledCount
) ?>
</h3>
<p><?= sprintf(t('There are %s unhandled problems. ' .
'Issue commands to the problematic services.'),
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?>
<div>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled service problem',
'Schedule a downtime for %u unhandled service problems',
$unhandledCount
),
$unhandledCount
),
$downtimeUnhandledLink,
null,
array('icon' => 'plug')
); ?> ); ?>
</div> </div>
<div><?= $this->qlink(
sprintf(
$this->translatePlural(
'Acknowledge %u unhandled service problem',
'Acknowledge %u unhandled service problems',
$unhandledCount
),
$unhandledCount
),
$acknowledgeUnhandledLink,
null,
array('icon' => 'ok')
); ?></div>
</p> </p>
<?php if (($unhandledCount = count($unhandledObjects)) > 0): ?>
</div>
<?php endif ?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<h3> <?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?> </h3>
<p>
<?= sprintf(
$this->translatePlural(
'%u Acknowledged Service Problem',
'%u Acknowledged Service Problems',
$acknowledgedCount
),
$acknowledgedCount
); ?> <?= $removeAckForm ?>
</p>
<?php endif ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
<h3> <?= $this->icon('plug', $this->translate('Downtimes')) ?> <?= $this->translate('Downtimes') ?> </h3>
<p> <?= sprintf($this->translatePlural(
'%u service currently in downtime',
'%u services currently in downtime',
$inDowntimeCount
), $inDowntimeCount) ?>
<div> <div>
<?= $this->qlink( <h3>
$this->translate('List all'), <?= $this->icon('attention-alt') ?>
$inDowntimeLink, <?= $this->translatePlural(
null, 'Unhandled Problem',
array('icon' => 'plug') 'Unhandled Problems',
);?> $unhandledCount
) ?>
</h3>
<p><?= sprintf(t('There are %s unhandled problems. ' .
'Issue commands to the problematic services.'),
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?>
<div>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled service problem',
'Schedule a downtime for %u unhandled service problems',
$unhandledCount
),
$unhandledCount
),
$downtimeUnhandledLink,
null,
array('icon' => 'plug')
); ?>
</div>
<div><?= $this->qlink(
sprintf(
$this->translatePlural(
'Acknowledge %u unhandled service problem',
'Acknowledge %u unhandled service problems',
$unhandledCount
),
$unhandledCount
),
$acknowledgeUnhandledLink,
null,
array('icon' => 'ok')
); ?></div>
</p>
</div> </div>
</p> <?php endif ?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
<p>
<?= sprintf(
$this->translatePlural(
'%u Acknowledged Service Problem.',
'%u Acknowledged Service Problems.',
$acknowledgedCount
),
$acknowledgedCount
); ?> <?= $removeAckForm ?>
</p>
<?php endif ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0 /*&& $auth->hasPermission('monitoring/command/comment/delete')*/): ?>
<h3> <?= $this->icon('plug', $this->translate('Downtimes')) ?> <?= $this->translate('Downtimes') ?> </h3>
<p> <?= sprintf($this->translatePlural(
'%u service currently in downtime.',
'%u services currently in downtime.',
$inDowntimeCount
), $inDowntimeCount) ?>
<?= $this->qlink(
$this->translate('List all'),
$inDowntimeLink,
null
);?>
</p>
<?php endif ?> <?php endif ?>
@ -146,12 +152,18 @@ use Icinga\Web\Url;
<h3> <?= $this->icon('comment') ?> <?= t('Comments') ?> </h3> <h3> <?= $this->icon('comment') ?> <?= t('Comments') ?> </h3>
<p><?= sprintf( <p><?= sprintf(
$this->translatePlural( $this->translatePlural(
'There are no comments.', 'There is %d comment.',
'There are %d comments', 'There are %d comments.',
$commentCount $commentCount
), $commentCount); ), $commentCount);
?> ?>
<?= $this->qlink(
$this->translate('List all'),
$commentsLink,
null
); ?>
<p> <p>
<table> <table>
<?php foreach ($objects as $service): ?> <?php foreach ($objects as $service): ?>
<?php $service->fetchComments(); ?> <?php $service->fetchComments(); ?>
@ -180,20 +192,9 @@ use Icinga\Web\Url;
<?php endforeach ?> <?php endforeach ?>
<?php endforeach ?> <?php endforeach ?>
</table> </table>
<!--
</p> </p>
<div>
<?= $this->qlink(
$this->translate('List all'),
$commentsLink,
null,
array('icon' => 'comment')
); ?>
</div>
<!--
TODO: implement backend functionality.
<div><?= $this->qlink( <div><?= $this->qlink(
$this->translate('Remove all'), $this->translate('Remove all'),
$deleteCommentLink, $deleteCommentLink,
@ -201,8 +202,7 @@ use Icinga\Web\Url;
array('icon' => 'trash') array('icon' => 'trash')
); ?></div> ); ?></div>
</p> </p>
--> -->
<?php endif ?> <?php endif ?>