Fix that $firstRow thingy in the user/list view script

refs #5543
This commit is contained in:
Eric Lippmann 2015-09-25 12:09:54 +02:00
parent ac6398de0d
commit 49a7084b6a
1 changed files with 13 additions and 19 deletions

View File

@ -16,19 +16,17 @@ if (! $this->compact): ?>
<?php endif ?>
<div class="content users">
<?php
if (! isset($backend)) {
echo $this->translate('No backend found which is able to list users') . '</div>';
return;
} elseif (! $users->hasResult()) {
echo '<p>' . $this->translate('No users found matching the filter') . '</p>' . '</div>';
return;
} else {
$extensible = $this->hasPermission('config/authentication/users/add') && $backend instanceof Extensible;
$reducible = $this->hasPermission('config/authentication/users/remove') && $backend instanceof Reducible;
}
$firstRow = true;
foreach ($users as $user): ?>
<?php if ($firstRow): ?>
<?php $firstRow = false ?>
?>
<table data-base-target="_next" class="action user-list alternating">
<thead>
<tr>
@ -39,7 +37,7 @@ foreach ($users as $user): ?>
</tr>
</thead>
<tbody>
<?php endif ?>
<?php foreach ($users as $user): ?>
<tr>
<td class="user-name"><?= $this->qlink($user->user_name, 'user/show', array(
'backend' => $backend->getName(),
@ -65,12 +63,8 @@ foreach ($users as $user): ?>
<?php endif ?>
</tr>
<?php endforeach ?>
<?php if ($users->hasResult()): ?>
</tbody>
</tbody>
</table>
<?php else: ?>
<p><?= $this->translate('No users found matching the filter') ?></p>
<?php endif ?>
<?php if ($extensible): ?>
<?= $this->qlink($this->translate('Add a new user'), 'user/add', array('backend' => $backend->getName()), array(
'icon' => 'plus',