<div class="controls">
    <?php if (! $this->compact): ?>
        <?= $tabs; ?>
    <?php endif ?>
    <?= $this->render('list/components/hostssummary.phtml') ?>
    <?= $this->render('partials/host/objects-header.phtml'); ?>
    <?php
        $hostCount = count($objects);
        $unhandledCount = count($unhandledObjects);
        $problemCount = count($problemObjects);
        $unackCount = count($unacknowledgedObjects);
        $scheduledDowntimeCount = count($objects->getScheduledDowntimes());
    ?>
</div>

<div class="content">
    <?php if ($hostCount === 0): ?>
        <?= $this->translate('No hosts found matching the filter'); ?>
    <?php else: ?>
        <h2><?= $this->translate('Problem Handling') ?></h2>
        <table class="name-value-table">
            <tbody>
            <?php

            if ($unackCount > 0): ?>
                <tr>
                    <th> <?= sprintf($this->translate('%d unhandled problems'), $unackCount) ?> </th>
                    <td>
                        <?= $this->qlink(
                            $this->translate('Acknowledge'),
                            $acknowledgeLink,
                            null,
                            array(
                                'icon' => 'ok',
                                'class' => 'action-link'
                            )
                        ) ?>
                    </td>
                </tr>
            <?php endif; ?>

            <?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
                <tr>
                    <th> <?= sprintf(
                            $this->translatePlural(
                                '%s acknowledgedment',
                                '%s acknowledgedments',
                                $acknowledgedCount
                            ),
                            '<b>' . $acknowledgedCount . '</b>'
                        ); ?> </th>
                    <td>
                        <?= $removeAckForm ?>
                    </td>
                </tr>
            <?php endif ?>

            <tr>
                <th> <?= $this->translate('Comments') ?> </th>
                <td>
                    <?= $this->qlink(
                        $this->translate('Add comments'),
                        $addCommentLink,
                        null,
                        array(
                            'icon' => 'comment',
                            'class' => 'action-link'
                        )
                    ) ?>
                </td>
            </tr>

            <?php if (($commentCount = count($objects->getComments())) > 0): ?>
            <tr>
                <th></th>
                <td>
                    <?= $this->qlink(
                        sprintf(
                            $this->translatePlural(
                                '%s comment',
                                '%s comments',
                                $commentCount
                            ),
                            $commentCount
                        ),
                        $commentsLink,
                        null,
                        array('data-base-target' => '_next')
                    ); ?>
                </td>
            </tr>
            <?php endif ?>

            <tr>
                <th>
                    <?= $this->translate('Downtimes') ?>
                </th>
                <td>
                    <?= $this->qlink(
                        $this->translate('Schedule downtimes'),
                        $downtimeAllLink,
                        null,
                        array(
                            'icon' => 'plug',
                            'class' => 'action-link'
                        )
                    ) ?>
                </td>
            </tr>

            <?php if ($scheduledDowntimeCount > 0): ?>
                <tr>
                    <th></th>
                    <td>
                        <?= $this->qlink(
                            sprintf(
                                $this->translatePlural(
                                    '%d scheduled downtime',
                                    '%d scheduled downtimes',
                                    $scheduledDowntimeCount
                                ),
                                $scheduledDowntimeCount
                            ),
                            $showDowntimesLink,
                            null,
                            array(
                                'data-base-target' => '_next'
                            )
                        ) ?>
                    </td>
                </tr>
            <?php endif ?>
            </tbody>
        </table>

        <?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
            <h2> <?= $this->translate('Notifications') ?> </h2>
            <table class="name-value-table">
                <tbody>
                <tr>
                    <th> <?= $this->translate('Notifications') ?> </th>
                    <td>
                        <?= $this->qlink(
                            $this->translate('Send notifications'),
                            $sendCustomNotificationLink,
                            null,
                            array(
                                'icon' => 'bell-alt',
                                'class' => 'action-link'
                            )
                        ) ?>
                    </td>
                </tr>
                </tbody>
            </table>
        <?php endif ?>

        <h2> <?= $this->translate('Check Execution') ?> </h2>

        <table class="name-value-table">
            <tbody>
            <tr>
                <th> <?= $this->translate('Command') ?> </th>
                <td>
                    <?= $this->qlink(
                        $this->translate('Process check result'),
                        $processCheckResultAllLink,
                        null,
                        array(
                            'icon' => 'reply',
                            'class' => 'action-link'
                        )
                    ) ?>
                </td>
            </tr>

            <tr>
                <th> <?= $this->translate('Schedule Check') ?> </th>
                <td> <?= $checkNowForm ?> </td>
            </tr>

            <tr>
                <th></th>
                <td>
                    <?= $this->qlink(
                        $this->translate('Reschedule'),
                        $rescheduleAllLink,
                        null,
                        array(
                            'icon' => 'reschedule',
                            'class' => 'action-link'
                        )
                    ) ?>
                </td>
            </tr>
            </tbody>
        </table>

    <?php endif ?>
</div>
