monitoring: Use createTicketLinks helper when showing downtimes of an object

refs #9611
This commit is contained in:
Eric Lippmann 2015-08-03 11:00:46 +02:00
parent a379a448d9
commit d5e2f92aa9
1 changed files with 2 additions and 9 deletions

View File

@ -58,13 +58,6 @@ if (empty($object->comments) && ! $addLink) {
<?php foreach ($object->downtimes as $downtime): ?> <?php foreach ($object->downtimes as $downtime): ?>
<?php <?php
// Ticket hook sample
$commentText = $this->tickets ? preg_replace_callback(
$this->tickets->getPattern(),
array($this->tickets, 'createLink'),
$this->escape($downtime->comment)
) : $this->escape($downtime->comment);
if ((bool) $downtime->is_in_effect) { if ((bool) $downtime->is_in_effect) {
$state = sprintf( $state = sprintf(
$this->translate('in downtime %s', 'Last format parameter represents the time in downtime'), $this->translate('in downtime %s', 'Last format parameter represents the time in downtime'),
@ -86,7 +79,7 @@ if (empty($object->comments) && ! $addLink) {
// Form is unset if the current user lacks the respective permission // Form is unset if the current user lacks the respective permission
if (isset($delDowntimeForm)) { if (isset($delDowntimeForm)) {
$deleteButton = clone($delDowntimeForm); $deleteButton = clone($delDowntimeForm);
$deleteButton->populate( $deleteButton->populate(
array( array(
@ -106,7 +99,7 @@ if (isset($delDowntimeForm)) {
<?= $this->timeAgo($downtime->entry_time) ?> <?= $this->timeAgo($downtime->entry_time) ?>
<?= $deleteButton ?> <?= $deleteButton ?>
</h3> </h3>
<p> <span class="sr-only"><?= $this->translate('Downtime'); ?></span><?= $state; ?> - <?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?></p> <p> <span class="sr-only"><?= $this->translate('Downtime'); ?></span><?= $state; ?> - <?= str_replace(array('\r\n', '\n'), '<br>', $this->createTicketLinks($downtime->comment)); ?></p>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>