aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/resource/permissions.php
blob: 94c36dac003218c9ce2857e07852c9c4303f3c38 (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
<form class="default" method="post"
      action="<?= (!empty($custom_form_action_link)
          ? $custom_form_action_link : ($single_user_mode
              ? $resource->getActionLink(
                  'permissions',
                  [
                      'user_id' => $user->id
                  ]
              )
              : ($resource
                  ? $resource->getActionLink('permissions')
                  : URLHelper::getLink(
                      'dispatch.php/resources/admin/permissions/global'
                  )
              )
          )
      ) ?>"
      <?= (Request::isDialog()
          ? (
          !empty($single_user_mode)
              ? 'data-dialog="reload-on-close"'
              : 'data-dialog'
          )
          : '') ?>>
    <? if (!empty($custom_hidden_fields)): ?>
        <? foreach ($custom_hidden_fields as $name => $content): ?>
            <? if (is_array($content)): ?>
                <? foreach ($content as $item): ?>
                    <input type="hidden" name="<?= htmlReady($name) ?>"
                           value="<?= htmlReady($item) ?>">
                <? endforeach ?>
            <? else: ?>
                <input type="hidden" name="<?= htmlReady($name) ?>"
                       value="<?= htmlReady($content) ?>">
            <? endif ?>
        <? endforeach ?>
    <? endif ?>
    <?= CSRFProtection::tokenTag() ?>
    <?= $this->render_partial(
        'resources/_common/_permission_table.php',
        [
            'permissions'               => $permissions,
            'custom_empty_list_message' => $custom_empty_list_message ?? '',
            'table_id'                  => $table_id,
            'single_user'               => $user ?? null,
        ]
    ) ?>
    <? if (empty($single_user_mode)): ?>
        <p>
            <label>
                <?= _('Person hinzufügen') ?>
                <?= $user_search->render() ?>
            </label>
        </p>
        <? if (!empty($course_search)): ?>
            <p>
                <label>
                    <?= _('Teilnehmende aus Veranstaltung hinzufügen') ?>
                    <?= $course_search->render() ?>
                </label>
            </p>
        <? endif ?>
    <? endif ?>

    <div data-dialog-button>
        <?= \Studip\Button::create(
            $custom_save_button_text ?? _('Speichern'),
            'save'
        ) ?>
    </div>
</form>