aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/admin/categories.php
blob: 185033d140bdfbf4efd2971afdd65c4a74dab19d (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
<? if ($categories): ?>
    <table class="default resource-categories">
        <colspan>
            <col style="width: 20px">
            <col style="width: 50%">
            <col style="width: 30%">
            <col style="width:10%">
            <col class="actions">
        </colspan>
        <thead>
        <tr>
            <th></th>
            <th><?= _('Name') ?></th>
            <th><?= _('Klassenname') ?></th>
            <th><?= _('System-Kategorie') ?></th>
            <th class="actions"><?= _('Aktionen') ?></th>
        </tr>
        </thead>
        <tbody>
        <? foreach ($categories as $category): ?>
            <tr>
                <td>
                    <?= $category->getIcon() ?>
                </td>
                <td><?= htmlReady($category->name) ?></td>
                <td><?= htmlReady($category->class_name) ?></td>
                <td style="text-align: center">
                    <?= Icon::create(
                        sprintf('checkbox-%s', $category->system ? 'checked' : 'unchecked'),
                        Icon::ROLE_INFO
                    ) ?>
                </td>
                <td class="actions">
                    <?php
                    $actions = ActionMenu::get()
                        ->setContext($category->name)
                        ->conditionAll($category->hasResources())
                        ->addLink(
                            $controller->url_for(
                                'resources/category/show_resources/' . $category->id
                            ),
                            _('Alle Ressourcen anzeigen'),
                            Icon::create('log'),
                            ['data-dialog' => 'size=auto'])
                        ->addLink(
                            $controller->url_for(
                                'resources/category/details', $category
                            ),
                            _('Details anzeigen'),
                            Icon::create('info-circle'),
                            ['data-dialog' => 'size=auto']
                        )
                        ->conditionAll(true)
                        ->addLink(
                            $controller->url_for(
                                'resources/category/edit/' . $category->id
                            ),
                            _('Bearbeiten'),
                            Icon::create('edit'),
                            ['data-dialog' => 'size=auto'])
                        ->condition($category->system == '0')
                        ->addLink(
                            $controller->url_for(
                                'resources/category/delete/' . $category->id
                            ),
                            _('Löschen'),
                            Icon::create('trash'),
                            ['data-dialog' => 'size=auto']
                        );
                    echo $actions->render();
                    ?>
                </td>
            </tr>
        <? endforeach ?>
        </tbody>
    </table>
<? endif ?>