<div class="controls">
  <?= $tabs; ?>
  <h1><?= $this->translate('Monitoring Backends') ?></h1>
</div>

<div class="content" data-base-target="_next">
  <p>
    <a href="<?= $this->href('/monitoring/config/createbackend'); ?>">
      <?= $this->icon('plus'); ?> <?= $this->translate('Create New Monitoring Backend'); ?>
    </a>
  </p>
  <table class="action">
    <thead>
      <th><?= $this->translate('Monitoring Backend'); ?></th>
      <th style="width: 5em"><?= $this->translate('Remove'); ?></th>
    </thead>
    <tbody>
    <?php foreach ($this->backendsConfig as $backendName => $config): ?>
      <tr>
        <td>
          <a href="<?= $this->href('/monitoring/config/editbackend', array('backend' => $backendName)); ?>">
            <?= $this->icon('edit'); ?> <?= $this->escape($backendName); ?>
          </a>
          <small>(<?= sprintf(
            $this->translate('Type: %s'),
            $this->escape($config->type === 'ido' ? 'IDO' : ucfirst($config->type))
          ); ?>)</small>
        </td>
        <td>
          <a href="<?= $this->href('/monitoring/config/removebackend', array('backend' => $backendName)); ?>">
            <?= $this->icon('cancel'); ?>
          </a>
        </td>
      </tr>
    <?php endforeach; ?>
    </tbody>
  </table>
  <h1><?= $this->translate('Monitoring Instances') ?></h1>
  <p>
    <a href="<?= $this->href('/monitoring/config/createinstance'); ?>">
      <?= $this->icon('plus'); ?> <?= $this->translate('Create New Instance'); ?>
    </a>
  </p>
  <table class="action">
    <thead>
      <th><?= $this->translate('Instance'); ?></th>
      <th style="width: 5em"><?= $this->translate('Remove'); ?></th>
    </thead>
    <tbody>
    <?php foreach ($this->instancesConfig as $instanceName => $config): ?>
      <tr>
        <td>
          <a href="<?= $this->href('/monitoring/config/editinstance', array('instance' => $instanceName)); ?>">
            <?= $this->icon('edit'); ?> <?= $this->escape($instanceName); ?>
          </a>
          <small>(<?= sprintf(
            $this->translate('Type: %s'),
            $config->host !== null ? $this->translate('Remote') : $this->translate('Local')
          ); ?>)</small>
        </td>
        <td>
          <a href="<?= $this->href('/monitoring/config/removeinstance', array('instance' => $instanceName)); ?>">
            <?= $this->icon('cancel'); ?>
          </a>
        </td>
      </tr>
    <?php endforeach; ?>
    </tbody>
  </table>
</div>
