summaryrefslogtreecommitdiff
path: root/app/Template/project_permission/groups.php
blob: c991434483b428e9bceadf568e309c4f50d11721 (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
<div class="page-header">
    <h2><?= t('Allowed Groups') ?></h2>
</div>

<?php if (empty($groups)): ?>
    <div class="alert"><?= t('No group have been allowed specifically.') ?></div>
<?php else: ?>
    <table class="table-scrolling">
        <tr>
            <th class="column-50"><?= t('Group') ?></th>
            <th><?= t('Role') ?></th>
            <?php if ($project['is_private'] == 0): ?>
                <th class="column-15"><?= t('Actions') ?></th>
            <?php endif ?>
        </tr>
        <?php foreach ($groups as $group): ?>
            <tr>
                <td><?= $this->text->e($group['name']) ?></td>
                <td>
                    <?= $this->app->component('project-select-role', array(
                        'roles' => $roles,
                        'role' => $group['role'],
                        'id' => $group['id'],
                        'url' => $this->url->to('ProjectPermissionController', 'changeGroupRole', array('project_id' => $project['id'])),
                    )) ?>
                </td>
                <td>
                    <?= $this->url->icon('trash-o', t('Remove'), 'ProjectPermissionController', 'removeGroup', array('project_id' => $project['id'], 'group_id' => $group['id']), true) ?>
                </td>
            </tr>
        <?php endforeach ?>
    </table>
<?php endif ?>

<?php if ($project['is_private'] == 0): ?>
    <div class="panel">
        <form method="post" action="<?= $this->url->href('ProjectPermissionController', 'addGroup', array('project_id' => $project['id'])) ?>" autocomplete="off" class="form-inline">
            <?= $this->form->csrf() ?>
            <?= $this->form->hidden('project_id', array('project_id' => $project['id'])) ?>
            <?= $this->form->hidden('group_id', $values) ?>
            <?= $this->form->hidden('external_id', $values) ?>

            <?= $this->form->label(t('Group Name'), 'name') ?>
            <?= $this->form->text('name', $values, $errors, array(
                'required',
                'placeholder="'.t('Enter group name...').'"',
                'title="'.t('Enter group name...').'"',
                'data-dst-field="group_id"',
                'data-dst-extra-field="external_id"',
                'data-search-url="'.$this->url->href('GroupAjaxController', 'autocomplete').'"',
            ),
                'autocomplete') ?>

            <?= $this->form->select('role', $roles, $values, $errors) ?>

            <button type="submit" class="btn btn-blue"><?= t('Add') ?></button>
        </form>
    </div>
<?php endif ?>