<?php
$service_problems = (
    $this->statusSummary->services_warning_handled_on_ok_hosts ||
    $this->statusSummary->services_warning_unhandled_on_ok_hosts ||
    $this->statusSummary->services_critical_handled_on_ok_hosts ||
    $this->statusSummary->services_critical_unhandled_on_ok_hosts ||
    $this->statusSummary->services_unknown_handled_on_ok_hosts ||
    $this->statusSummary->services_unknown_unhandled_on_ok_hosts
);
?>
<div class="box ok_hosts state_<?= $this->statusSummary->hosts_up ? 'up' : 'pending'; ?> col-1-2">
    <div class="box header">
    <?php if ($this->statusSummary->hosts_up): ?>
        <h2><?= $this->qlink(
            sprintf(
                $this->translatePlural('%u Host UP', '%u Hosts UP', $this->statusSummary->hosts_up),
                $this->statusSummary->hosts_up
            ),
            'monitoring/list/hosts',
            array('host_state' => 0),
            array('title' => sprintf(
                $this->translatePlural(
                    'List %u host that is currently in state UP',
                    'List %u hosts which are currently in state UP',
                    $this->statusSummary->hosts_up
                ),
                $this->statusSummary->hosts_up
            ))
        ); ?></h2>
    <?php endif ?>
    <?php if ($this->statusSummary->hosts_pending): ?>
        <h2><?= $this->qlink(
            sprintf(
                $this->translatePlural('%u Host PENDING', '%u Hosts PENDING', $this->statusSummary->hosts_pending),
                $this->statusSummary->hosts_pending
            ),
            'monitoring/list/hosts',
            array('host_state' => 99),
            array('title' => sprintf(
                $this->translatePlural(
                    'List %u host that is currently in state PENDING',
                    'List %u hosts which are currently in state PENDING',
                    $this->statusSummary->hosts_pending
                ),
                $this->statusSummary->hosts_pending
            ))
        ); ?></h2>
    <?php endif ?>
    </div>
<?php if ($service_problems || $this->statusSummary->hosts_down || $this->statusSummary->hosts_unreachable): ?>
    <div class="box contents">
        <?= $this->partial(
            'tactical/components/parts/servicestatesummarybyhoststate.phtml',
            array(
                'translationDomain'             => $this->translationDomain,
                'host_problem'                  => 0,
                'services_ok'                   => $this->statusSummary->services_ok_on_ok_hosts,
                'services_ok_not_checked'       => $this->statusSummary->services_ok_not_checked_on_ok_hosts,
                'services_pending'              => $this->statusSummary->services_pending_on_ok_hosts,
                'services_pending_not_checked'  => $this->statusSummary->services_pending_not_checked_on_ok_hosts,
                'services_warning_handled'      => $this->statusSummary->services_warning_handled_on_ok_hosts,
                'services_warning_unhandled'    => $this->statusSummary->services_warning_unhandled_on_ok_hosts,
                'services_warning_passive'      => $this->statusSummary->services_warning_passive_on_ok_hosts,
                'services_warning_not_checked'  => $this->statusSummary->services_warning_not_checked_on_ok_hosts,
                'services_critical_handled'     => $this->statusSummary->services_critical_handled_on_ok_hosts,
                'services_critical_unhandled'   => $this->statusSummary->services_critical_unhandled_on_ok_hosts,
                'services_critical_passive'     => $this->statusSummary->services_critical_passive_on_ok_hosts,
                'services_critical_not_checked' => $this->statusSummary->services_critical_not_checked_on_ok_hosts,
                'services_unknown_handled'      => $this->statusSummary->services_unknown_handled_on_ok_hosts,
                'services_unknown_unhandled'    => $this->statusSummary->services_unknown_unhandled_on_ok_hosts,
                'services_unknown_passive'      => $this->statusSummary->services_unknown_passive_on_ok_hosts,
                'services_unknown_not_checked'  => $this->statusSummary->services_unknown_not_checked_on_ok_hosts
            )
        ); ?>
<?php else: ?>
    <div class="box contents zero">
        <h3>0</h3>
        <span><?= $this->translate('Service Problems'); ?></span>
<?php endif ?>
    </div>
</div>
