aboutsummaryrefslogtreecommitdiff
path: root/app/views/start/masswidget_index.php
blob: c99e3fdeaf63f80efa88cb6268f98f31edb9a8a3 (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
<?php
/**
 * @var StartController $controller
 * @var \MassWidget\MassWidget[] $massWidgets
 */
?>

<table class="default sortable-table">
    <caption>
        <?= _('Zielgruppen') ?>
        <span class="actions">
            <a
                href="<?= $controller->masswidget_edit() ?>"
                data-dialog
                title="<?= _('Neue Regel hinzufügen') ?>"
                aria-label="<?= _('Neue Regel hinzufügen') ?>"
            >
                <?= Icon::create('add', Icon::DEFAULT_ROLE, ['aria-hidden' => 'true']) ?>
            </a>
        </span>
    </caption>

    <colgroup>
        <col>
        <col>
        <col>
        <col>
        <col style="width: 24px">
    </colgroup>

    <thead>
        <tr>
            <th scope="col" data-sort="name"><?= _('Name') ?></th>
            <th scope="col" data-sort="htmldata"><?= _('Widget') ?></th>
            <th scope="col" data-sort="htmldata"><?= _('Erstellt von') ?></th>
            <th scope="col" data-sort="target"><?= _('Zielgruppe') ?></th>
            <th scope="col" class="actions"><?= _('Aktionen') ?></th>
        </tr>
    </thead>

    <tbody>
    <?php foreach ($massWidgets as $massWidget) : ?>
        <tr>
            <td>
                <?= htmlReady($massWidget->name) ?>
            </td>
            <td data-sort-value="<?= htmlReady($massWidget->plugin->pluginclassname) ?>">
                <?= htmlReady($massWidget->plugin->pluginclassname) ?>
            </td>
            <td data-sort-value="<?= htmlReady($massWidget->author->getFullName()) ?>">
                <?= Avatar::getAvatarDropdownHTML($massWidget->author, true) ?>
            </td>
            <td>
                <?= htmlReady($massWidget->target) . ' ('. count($massWidget->getTargetUserIds()) . ')' ?>
            </td>
            <td class="actions">
               <?=
                   ActionMenu::get()
                       ->setContext(htmlReady($massWidget->name))
                       ->addLink(
                           $controller->masswidget_editURL($massWidget),
                           _('Bearbeiten'),
                           Icon::create('edit'),
                           ['data-dialog' => 'default']
                       )
                       ->addButton(
                           'delete',
                            _('Löschen'),
                            Icon::create('trash'),
                            [
                                'data-confirm' => sprintf(
                                    _('Wollen Sie die Regel "%s" löschen?'),
                                    $massWidget->name
                                ),
                                'form' => 'delete-mass-widget',
                                'formaction' => $controller->masswidget_deleteURL($massWidget)
                            ]
                       )
               ?>
            </td>
        </tr>
    <? endforeach ?>

    <?php if (count($massWidgets) === 0) : ?>
        <tr>
            <td colspan="5" class="text-center">
                <?= _('Es sind noch keine Regeln definiert.') ?>
            </td>
        </tr>
    <?php endif ?>
    </tbody>
</table>

<form action="" method="post" id="delete-mass-widget">
    <?= CSRFProtection::tokenTag() ?>
</form>