index.ctp 2.9 KB
<?php
/**
 * @var \App\View\AppView $this
 * @var \App\Model\Entity\Stat[]|\Cake\Collection\CollectionInterface $stats
 */
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
    <ul class="side-nav">
        <li class="heading"><?= __('Actions') ?></li>
        <li><?= $this->Html->link(__('New Stat'), ['action' => 'add']) ?></li>
        <li><?= $this->Html->link(__('List Users'), ['controller' => 'Users', 'action' => 'index']) ?></li>
        <li><?= $this->Html->link(__('New User'), ['controller' => 'Users', 'action' => 'add']) ?></li>
    </ul>
</nav>
<div class="stats index large-9 medium-8 columns content">
    <h3><?= __('Stats') ?></h3>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th scope="col"><?= $this->Paginator->sort('year') ?></th>
                <th scope="col"><?= $this->Paginator->sort('user_id') ?></th>
                <th scope="col"><?= $this->Paginator->sort('last_login_time') ?></th>
                <th scope="col"><?= $this->Paginator->sort('last_logout_time') ?></th>
                <th scope="col"><?= $this->Paginator->sort('connex_nb') ?></th>
                <th scope="col"><?= $this->Paginator->sort('connex_dur') ?></th>
                <th scope="col" class="actions"><?= __('Actions') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($stats as $stat): ?>
            <tr>
                <td><?= h($stat->year) ?></td>
                <td><?= $stat->has('user') ? $this->Html->link($stat->user->nom, ['controller' => 'Users', 'action' => 'view', $stat->user->id]) : '' ?></td>
                <td><?= h($stat->last_login_time) ?></td>
                <td><?= h($stat->last_logout_time) ?></td>
                <td><?= $this->Number->format($stat->connex_nb) ?></td>
                <td><?= $this->Number->format($stat->connex_dur) ?></td>
                <td class="actions">
                    <?= $this->Html->link(__('View'), ['action' => 'view', $stat->year,$stat->user_id]) ?>
                    <?= $this->Html->link(__('Edit'), ['action' => 'edit', $stat->year,$stat->user_id]) ?>
                    <?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $stat->year,$stat->user_id], ['confirm' => __('Are you sure you want to delete # {0}?', $stat->year)]) ?>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <div class="paginator">
        <ul class="pagination">
            <?= $this->Paginator->first('<< ' . __('first')) ?>
            <?= $this->Paginator->prev('< ' . __('previous')) ?>
            <?= $this->Paginator->numbers() ?>
            <?= $this->Paginator->next(__('next') . ' >') ?>
            <?= $this->Paginator->last(__('last') . ' >>') ?>
        </ul>
        <p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
    </div>
</div>