Quelltext des aktuellen Standes
<?php $this->layout('layouts/admin', [
'page_title' => 'Rollenverwaltung',
'current_admin_page' => 'roles',
'breadcrumbs' => [['label' => 'Rollen']],
'page_actions' => '<a href="/admin/roles/create" class="btn btn-primary"><i class="fas fa-plus"></i> Neue Rolle</a>'
]); ?>
<style>
.roles-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.roles-table th {
padding: 0.625rem 1rem;
text-align: left;
font-size: 0.75rem;
font-weight: 600;
color: var(--gray-500);
text-transform: uppercase;
letter-spacing: 0.04em;
border-bottom: 1px solid var(--gray-200);
background: var(--gray-50);
white-space: nowrap;
}
.roles-table td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--gray-100);
vertical-align: middle;
}
.roles-table tbody tr:last-child td { border-bottom: none; }
.roles-table tbody tr:hover td { background: var(--color-gray-50); }
.role-name-link { font-weight: 600; color: var(--color-primary, var(--blue-600)); text-decoration: none; }
.role-name-link:hover { text-decoration: underline; }
.role-description { color: var(--gray-500); font-size: 0.85rem; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-cell { white-space: nowrap; width: 90px; }
.actions-cell .btn { padding: 0.2rem 0.5rem; font-size: 0.78rem; margin-right: 2px; }
</style>
<?php if (!empty($roles)): ?>
<div class="card">
<div class="card-body p-0">
<table class="roles-table">
<thead>
<tr>
<th scope="col"><?= $this->te('Rolle') ?></th>
<th scope="col"><?= $this->te('Beschreibung') ?></th>
<th scope="col"><?= $this->te('Berechtigungen') ?></th>
<th scope="col"><?= $this->te('Benutzer') ?></th>
<th scope="col"><?= $this->te('Aktionen') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($roles as $role): ?>
<tr>
<td>
<a href="/admin/roles/<?= $role['id'] ?>" class="role-name-link">
<?= $this->e($role['name']) ?>
</a>
<?php if ($role['is_admin']): ?>
<span class="badge badge-danger" style="margin-left:6px;"><?= $this->te('Admin') ?></span>
<?php endif; ?>
</td>
<td>
<span class="role-description" title="<?= $this->e($role['description']) ?>">
<?= $this->e($role['description']) ?>
</span>
</td>
<td>
<span class="badge badge-info"><?= (int)($role['capability_count'] ?? 0) ?></span>
</td>
<td>
<span class="badge badge-secondary"><?= (int)($role['user_count'] ?? 0) ?></span>
</td>
<td class="actions-cell">
<a href="/admin/roles/<?= $role['id'] ?>" class="btn btn-default btn-sm" title="Details">
<i class="fas fa-eye"></i>
</a>
<a href="/admin/roles/<?= $role['id'] ?>/edit" class="btn btn-default btn-sm" title="<?= $this->te('Bearbeiten') ?>">
<i class="fas fa-pencil-alt"></i>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php else: ?>
<div class="card">
<div class="card-body text-center" style="padding:3rem;">
<i class="fas fa-user-shield fa-3x text-muted mb-3" style="display:block;margin-bottom:1rem;"></i>
<h4><?= $this->te('Keine Rollen vorhanden') ?></h4>
<p class="text-muted"><?= $this->te('Es wurden noch keine Rollen definiert.') ?></p>
<a href="/admin/roles/create" class="btn btn-primary"><i class="fas fa-plus"></i> <?= $this->te('Erste Rolle erstellen') ?></a>
</div>
</div>
<?php endif; ?>