<?php

/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */

if ($object->getType() === $object::TYPE_HOST) {
    $reschedule = $this->href(
        'monitoring/host/reschedule-check',
        array('host' => $object->getName())
    );
} else {
    $reschedule = $this->href(
        'monitoring/service/reschedule-check',
        array('host' => $object->getHost()->getName(), 'service' => $object->getName())
    );
}

?>

<tr>
    <th><?= $this->translate('Last check') ?></th>
    <td data-base-target="_self">
        <?= $checkNowForm ?>
        <?= $this->timeSince($object->last_check) ?>
    </td>
</tr>
<tr>
  <th><?= $this->translate('Next check') ?></th>
  <td>
      <a href="<?= $reschedule ?>">
          <?= $this->icon('reschedule_petrol.png') ?> <?= $this->translate('Reschedule') ?>
      </a>
      <?= $this->timeUntil($object->next_check) ?>
  </td>
</tr>
<?php if ($object->check_execution_time): ?>
<tr>
  <th><?= $this->translate('Check execution time') ?></th>
  <td><?= $object->check_execution_time ?>s</td>
</tr>
<?php endif ?>
<?php if ($object->check_latency): ?>
<tr>
 <th><?= $this->translate('Check latency') ?></th>
 <td><?= $object->check_latency ?>s</td>
</tr>
<?php endif ?>
