<?php
$rv = $this->runtimeVariables()->create($this->runtimevariables);
$cp = $this->checkPerformance()->create($this->checkperformance);

if (! $this->compact): ?>
<div class="controls">
    <?= $this->tabs; ?>
</div>
<?php endif ?>

<div class="content processinfo grid">
    <div class="boxview">
        <div class="box process col-1-2">
            <h2><?= $this->translate('Process Info') ?></h2>
            <table class="avp">
                <tbody>
                <tr>
                    <th><?= $this->translate('Program Version') ?></th>
                    <td><?= $this->programStatus->program_version
                            ? $this->programStatus->program_version
                            : $this->translate('N/A') ?></td>
                </tr>
                <tr>
                    <th><?= $this->translate('Program Start Time') ?></th>
                    <td><?= $this->formatDateTime($this->programStatus->program_start_time) ?></td>
                </tr>
                <tr>
                    <th><?= $this->translate('Last Status Update'); ?></th>
                    <td><?= $this->timeAgo($this->programStatus->status_update_time); ?></td>
                </tr>
                <tr>
                    <th><?= $this->translate('Last External Command Check'); ?></th>
                    <td><?= $this->timeAgo($this->programStatus->last_command_check); ?></td>
                </tr>
                <tr>
                    <th><?= $this->translate('Last Log File Rotation'); ?></th>
                    <td><?= $this->programStatus->last_log_rotation
                            ? $this->timeSince($this->programStatus->last_log_rotation)
                            : $this->translate('N/A') ?></td>
                </tr>
                <tr>
                    <th><?= $this->translate('Global Service Event Handler'); ?></th>
                    <td><?= $this->programStatus->global_service_event_handler
                            ? $this->programStatus->global_service_event_handler
                            : $this->translate('N/A'); ?></td>
                </tr>
                <tr>
                    <th><?= $this->translate('Global Host Event Handler'); ?></th>
                    <td><?= $this->programStatus->global_host_event_handler
                            ? $this->programStatus->global_host_event_handler
                            : $this->translate('N/A'); ?></td>
                </tr>
                <tr>
                    <th><?= $this->translate('Active Endpoint'); ?></th>
                    <td><?= $this->programStatus->endpoint_name
                            ? $this->programStatus->endpoint_name
                            : $this->translate('N/A') ?></td>
                </tr>
                </tbody>
            </table>
            <?php if ((bool) $this->programStatus->is_currently_running === true): ?>
                <div class="backend-running">
                    <?= sprintf(
                        $this->translate(
                            '%1$s has been up and running with PID %2$d %3$s',
                            'Last format parameter represents the time running'
                        ),
                        $this->backendName,
                        $this->programStatus->process_id,
                        $this->timeSince($this->programStatus->program_start_time)) ?>
                </div>
            <?php else: ?>
                <div class="backend-not-running">
                    <?= sprintf($this->translate('Backend %s is not running'), $this->backendName) ?>
                </div>
            <?php endif ?>
        </div>
        <div class="box features col-1-2">
            <?= $this->toggleFeaturesForm; ?>
        </div>
    </div>
</div>
