<div class="controls">
    <?= $tabs ?>
</div>
<div class="content">
    <?= $this->qlink(
        $this->translate('Create a New Role') ,
        'role/add',
        null,
        array(
            'class'             => 'button-link',
            'data-base-target'  => '_next',
            'icon'              => 'plus',
            'title'             => $this->translate('Create a new role')
        )
    ) ?>
<?php /** @var \Icinga\Application\Config $roles */ if ($roles->isEmpty()): ?>
    <p><?= $this->translate('No roles found.') ?></p>
<?php return; endif ?>
    <table class="table-row-selectable common-table" data-base-target="_next">
    <thead>
    <tr>
        <th><?= $this->translate('Name') ?></th>
        <th><?= $this->translate('Users') ?></th>
        <th><?= $this->translate('Groups') ?></th>
        <th></th>
    </tr>
    </thead>
    <tbody>
<?php foreach ($roles as $name => $role): /** @var object $role */ ?>
    <tr>
        <td>
            <?= $this->qlink(
                $name,
                'role/edit',
                array('role' => $name),
                array('title' => sprintf($this->translate('Edit role %s'), $name))
            ) ?>
        </td>
        <td><?= $this->escape($role->users) ?></td>
        <td><?= $this->escape($role->groups) ?></td>
        <td class="icon-col text-right">
            <?= $this->qlink(
                '',
                'role/remove',
                array('role' => $name),
                array(
                    'class' => 'action-link',
                    'icon'  => 'cancel',
                    'title' => sprintf($this->translate('Remove role %s'), $name)
                )
            ) ?>
        </td>
    </tr>
<?php endforeach ?>
    </tbody>
    </table>
</div>
