2015-05-20 13:53:19 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Icinga\Data\Extensible;
|
|
|
|
use Icinga\Data\Reducible;
|
|
|
|
|
|
|
|
if (! $this->compact): ?>
|
2015-05-04 17:04:50 +02:00
|
|
|
<div class="controls">
|
|
|
|
<?= $this->tabs; ?>
|
|
|
|
<?= $this->sortBox; ?>
|
|
|
|
<?= $this->limiter; ?>
|
|
|
|
<?= $this->paginator; ?>
|
2015-05-08 09:54:45 +02:00
|
|
|
<div>
|
|
|
|
<?= $this->backendSelection; ?>
|
|
|
|
<?= $this->filterEditor; ?>
|
|
|
|
</div>
|
2015-05-04 17:04:50 +02:00
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
|
|
|
<div class="content">
|
|
|
|
<?php
|
|
|
|
|
|
|
|
if ($backend === null) {
|
|
|
|
echo $this->translate('No backend found which is able to list users') . '</div>';
|
|
|
|
return;
|
2015-05-20 13:53:19 +02:00
|
|
|
} else {
|
|
|
|
$extensible = $backend instanceof Extensible;
|
|
|
|
$reducible = $backend instanceof Reducible;
|
2015-05-04 17:04:50 +02:00
|
|
|
}
|
|
|
|
|
2015-05-13 13:50:19 +02:00
|
|
|
if (! isset($users)) {
|
|
|
|
echo $this->translate('Failed to fetch any users') . '</div>';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-05-04 17:04:50 +02:00
|
|
|
if (count($users) === 0) {
|
|
|
|
echo $this->translate('No users found matching the filter') . '</div>';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<table data-base-target="_next" class="action user-list">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="user-name"><?= $this->translate('Username'); ?></th>
|
|
|
|
<th class="user-state"><?= $this->translate('State'); ?></th>
|
|
|
|
<th class="user-created"><?= $this->translate('Created at'); ?></th>
|
|
|
|
<th class="user-modified"><?= $this->translate('Last modified'); ?></th>
|
2015-05-20 13:53:19 +02:00
|
|
|
<?php if ($reducible): ?>
|
|
|
|
<th class="user-remove"><?= $this->translate('Remove'); ?></th>
|
|
|
|
<?php endif ?>
|
2015-05-04 17:04:50 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php foreach ($users as $user): ?>
|
|
|
|
<tr>
|
|
|
|
<td clas="user-name"><?= $this->escape($user->user_name); ?></td>
|
|
|
|
<td class="user-state"><?= $user->is_active === null ? $this->translate('N/A') : (
|
|
|
|
$user->is_active ? $this->translate('Active') : $this->translate('Inactive')
|
|
|
|
); ?></td>
|
|
|
|
<td class="user-created">
|
|
|
|
<?= $user->created_at === null ? $this->translate('N/A') : date('d/m/Y g:i A', $user->created_at); ?>
|
|
|
|
</td>
|
|
|
|
<td class="user-modified">
|
|
|
|
<?= $user->last_modified === null ? $this->translate('Never') : date('d/m/Y g:i A', $user->last_modified); ?>
|
|
|
|
</td>
|
2015-05-20 13:53:19 +02:00
|
|
|
<?php if ($reducible): ?>
|
|
|
|
<td class="user-remove">
|
|
|
|
<?= $this->qlink(
|
|
|
|
null,
|
|
|
|
'user/remove',
|
|
|
|
array(
|
|
|
|
'backend' => $backend->getName(),
|
|
|
|
'user' => $user->user_name
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => sprintf($this->translate('Remove user %s'), $user->user_name),
|
|
|
|
'icon' => 'trash'
|
|
|
|
)
|
|
|
|
); ?>
|
|
|
|
</td>
|
|
|
|
<?php endif ?>
|
2015-05-04 17:04:50 +02:00
|
|
|
</tr>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</tbody>
|
2015-05-05 07:12:25 +02:00
|
|
|
</table>
|
2015-05-20 13:53:19 +02:00
|
|
|
<?php if ($extensible): ?>
|
|
|
|
<?= $this->qlink($this->translate('Add a new user'), 'user/add', array('backend' => $backend->getName()), array(
|
|
|
|
'icon' => 'plus',
|
|
|
|
'data-base-target' => '_next',
|
|
|
|
'class' => 'user-add'
|
|
|
|
)); ?>
|
|
|
|
<?php endif ?>
|
2015-05-05 07:12:25 +02:00
|
|
|
</div>
|