<?= $this->tabs->render($this); ?>

<?php
  $formatter = $this->getHelper('MonitoringProperties');
?>

<form method="get" action="<?=
  $this->href(
    'monitoring/list/notifications',
    $this->notifications->getAppliedFilter()->toParams()
  );
?>">
  <label>Sort By</label> <?=
    $this->formSelect(
        'sort',
        $this->sort,
        array(
          'class' => 'autosubmit'
        ),
        array(
          'notification_start_time' => 'Time'
        )
    );
  ?>
  <noscript>
    <button class="btn btn-small btn-default">
      {{REFRESH_ICON}}
    </button>
  </noscript>
</form>

<?php
$notifications = $this->notifications->paginate();
echo $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve));
?>

<table class="table table-condensed">
  <thead>
    <tr>
      <th>Host</th>
      <th>Service</th>
      <th>Type</th>
      <th>Time</th>
      <th>Contact</th>
      <th>Notification Command</th>
      <th>Information</th>
    </tr>
  </thead>
  <tbody>
  <?php foreach ($notifications as $notification): ?>
    <tr>
      <td>
        <?= $notification->host_name ?>
      </td>
      <td>
        <?= empty($notification->service_description) ? '' : $notification->service_description; ?>
      </td>
      <td><?= $formatter->getNotificationType($notification); ?>
      </td>
      <td>
        <?= $notification->notification_start_time ?>
      </td>
      <td>
        <?= $notification->notification_contact ?>
      </td>
      <td>
        <?= $notification->notification_command ?>
      </td>
      <td>
        <?= $this->escape(substr(strip_tags($notification->notification_information), 0, 10000)); ?>
      </td>
    </tr>
  <?php endforeach; ?>
  </tbody>
</table>
