<?php if (!empty($this->downtimes)): ?>
<?php
    $list = array();
    foreach ($this->downtimes as $downtime) {
        $row = array();
        if ($downtime->downtime_is_in_effect === '1') {
            $row[] = 'Running<br />since '. $this->timeSince($downtime->downtime_actual_start_time);
        } else {
            if ($downtime->downtime_is_fixed) {
                $row[] = 'Scheduled<br />for '. $downtime->downtime_scheduled_start_time;
            } else {
                $row[] = 'Waiting';
            }
        }

        $row[] = sprintf(
            'Triggered by %s: <em>%s</em>',
            $downtime->downtime_author_name,
            $downtime->downtime_comment_data
        );

        $row[] = '<button type="button" data-target="command" class="btn btn-warning"'
            . ' data-command-id="29" data-command-info="'. $downtime->downtime_internal_downtime_id. '"'
            . '>{{REMOVE_ICON}} Remove'
            . '</button>';

        $list[] = '<td>'. implode('</td><td>', $row). '</td>';
    }
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <span>{{IN_DOWNTIME_ICON}} Downtimes</span>
    </div>

    <div class="panel-body">
        <table>
            <tr>
            <?= implode('</tr><tr>', $list); ?>
            </tr>
        </table>
    </div>
</div>
<?php endif; ?>