summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/group/show.phtml
blob: 75f0b7554c6ec08dddcb16cb283f4574861186d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php

use Icinga\Data\Extensible;
use Icinga\Data\Updatable;

$extensible = $this->hasPermission('config/access-control/groups') && $backend instanceof Extensible;

$editLink = null;
if ($this->hasPermission('config/access-control/groups') && $backend instanceof Updatable) {
    $editLink = $this->qlink(
        null,
        'group/edit',
        array(
            'backend'   => $backend->getName(),
            'group'     => $group->group_name
        ),
        array(
            'title' => sprintf($this->translate('Edit group %s'), $group->group_name),
            'class' => 'group-edit',
            'icon'  => 'edit'
        )
    );
}

?>
<div class="controls separated">
<?php if (! $this->compact): ?>
    <?= $tabs; ?>
<?php endif ?>
    <h2 class="clearfix"><?= $this->escape($group->group_name) ?><span class="pull-right"><?= $editLink ?></span></h2>
    <table class="name-value-table">
        <tr>
            <th><?= $this->translate('Created at'); ?></th>
            <td><?= $group->created_at === null ? '-' : $this->formatDateTime($group->created_at); ?></td>
        </tr>
        <tr>
            <th><?= $this->translate('Last modified'); ?></th>
            <td><?= $group->last_modified === null ? '-' : $this->formatDateTime($group->last_modified); ?></td>
        </tr>
    </table>
<?php if (! $this->compact): ?>
    <h2><?= $this->translate('Members'); ?></h2>
    <div class="sort-controls-container">
        <?= $this->limiter; ?>
        <?= $this->paginator; ?>
        <?= $this->sortBox; ?>
    </div>
    <?= $this->filterEditor; ?>
<?php endif ?>
</div>
<div class="content">
<?php if ($extensible): ?>
    <?= $this->qlink(
        $this->translate('Add New Member'),
        'group/addmember',
        array(
            'backend'   => $backend->getName(),
            'group'     => $group->group_name
        ),
        array(
            'icon'  => 'plus',
            'class' => 'button-link'
        )
    ) ?>
<?php endif ?>

<?php if (! $members->hasResult()): ?>
  <p><?= $this->translate('No group member found matching the filter'); ?></p>
</div>
<?php return; endif ?>

    <table data-base-target="_next" class="table-row-selectable common-table">
        <thead>
            <tr>
                <th><?= $this->translate('Username'); ?></th>
            <?php if (isset($removeForm)): ?>
                <th><?= $this->translate('Remove'); ?></th>
            <?php endif ?>
            </tr>
        </thead>
        <tbody>
        <?php foreach ($members as $member): ?>
            <tr>
                <td>
                <?php if (
                    $this->hasPermission('config/access-control/users')
                    && ($userBackend = $backend->getUserBackendName($member->user_name)) !== null
                ): ?>
                    <?= $this->qlink($member->user_name, 'user/show', array(
                        'backend' => $userBackend,
                        'user'    => $member->user_name
                    ), array(
                        'title'   => sprintf($this->translate('Show detailed information about %s'), $member->user_name)
                    )); ?>
                <?php else: ?>
                    <?= $this->escape($member->user_name); ?>
                <?php endif ?>
                </td>
            <?php if (isset($removeForm)): ?>
                <td class="icon-col" data-base-target="_self">
                    <?php $removeForm->getElement('user_name')->setValue($member->user_name); echo $removeForm; ?>
                </td>
            <?php endif ?>
            </tr>
        <?php endforeach ?>
        </tbody>
    </table>
</div>