<?php
$this->is_service = true;
$this->hostquery = implode($this->hostnames, ',');
$this->servicequery = implode($this->servicenames, ',');
$this->target = array(
    'host' => $this->hostquery,
    'service' => $this->servicequery
);
?>

<div class="controls">
<?= $this->tabs ?>
</div>

<div class="content">
  <?php if (count($objects) === 0): ?>
      <?= mt('monitoring', 'No services matching the filter'); ?>
  <?php else: ?>
  <h1> Summary for <?= count($objects) ?> services </h1>

  <table style="width: 100%; font-size: 0.8em;">
    <tr>
      <th colspan="2"><?= array_sum(array_values($service_states)) ?> Services</th>
      <th colspan="2"><?= array_sum(array_values($host_states)) ?> Hosts</th>
    </tr>
    <tr>
      <td align="center"><?= $this->service_pie->render() ?></td>
      <td><?php

          foreach ($service_states as $state => $count) {
              if ($count > 0) {
                  echo ucfirst($state) . ': ' . $count . '<br />';
              }
          }

      ?></td>
      <td align="center"><?= $this->host_pie->render() ?></td>
      <td><?php
          foreach ($host_states as $state => $count) {
              if ($count > 0) {
                  echo ucfirst($state) . ': ' . $count . '<br />';
              }
          }
      ?></td>
    </tr>
  </table>

  <h2><?=$this->icon('servicegroup.png')?> Service Actions</h2>

  <table class="avp newsection">
    <tbody>
      <?= $this->render('multi/components/objectlist.phtml') ?>
      <?= $this->render('multi/components/summary.phtml') ?>
      <?= $this->render('multi/components/comments.phtml') ?>
      <?= $this->render('multi/components/downtimes.phtml') ?>
    </tbody>
  </table>

  <?= $this->render('multi/components/flags.phtml') ?>
  <?php endif ?>
</div>
