aboutsummaryrefslogtreecommitdiff
path: root/app/views/studiengaenge/versionen/versionen.php
blob: 9e42873354a4606e18c07745c0c6b4700a6d5165 (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
<? foreach ($versionen as $version) : ?>
    <? $perm = MvvPerm::get($version); ?>
    <tbody class="<?= ($version->count_abschnitte ? '' : 'empty') ?> <?= ($version_id === $version->id ? 'not-collapsed' : 'collapsed') ?>">
        <tr class="header-row">
            <td class="toggle-indicator">
                <? if ($version->count_abschnitte) : ?>
                <a class="mvv-load-in-new-row" href="<?= $controller->action_link('abschnitte/' . $version->id) ?>">
                    <? endif; ?>
                    <? $ampel_icon = $GLOBALS['MVV_STGTEILVERSION']['STATUS']['values'][$version->stat]['icon'] ?>
                    <? $ampelstatus = $GLOBALS['MVV_STGTEILVERSION']['STATUS']['values'][$version->stat]['name'] ?>
                    <? if ($ampel_icon) : ?>
                        <?= $ampel_icon->asSvg(['title' => $ampelstatus, 'style' => 'vertical-align: text-top;']) ?>
                    <? endif; ?>
                    <?= htmlReady($version->getDisplayName()) ?>
                    <? if ($version->count_abschnitte) : ?>
                </a>
            <? endif; ?>
            </td>
            <td class="dont-hide" style="text-align: center;">
                <? if ($version->count_dokumente) : ?>
                    <?= Icon::create('staple', Icon::ROLE_INFO, ['title' => sprintf(ngettext('%s Dokument zugeordnet', '%s Dokumente zugeordnet', $version->count_dokumente), $version->count_dokumente)])->asSvg(); ?>
                <? endif; ?>
            </td>
            <td class="dont-hide" style="white-space: nowrap; text-align: right;">
                <form method="post">
                    <?= CSRFProtection::tokenTag(); ?>
                    <? $actionMenu = ActionMenu::get()->setContext($version->getDisplayName()) ?>
                    <? if ($version->stat === 'planung' && MvvPerm::haveFieldPermStat($version)) : ?>
                        <? $actionMenu->addLink(
                            $controller->action_url('approve/' . $version->id),
                            _('Version genehmigen'),
                            Icon::create('accept', Icon::ROLE_CLICKABLE, ['title' => _('Version genehmigen')]),
                            ['data-dialog' => 'title=\'' . $version->getDisplayName() . '\''])
                        ?>
                    <? endif; ?>
                    <? if ($perm->haveFieldPerm('abschnitte', MvvPerm::PERM_CREATE)) : ?>
                        <? $actionMenu->addLink(
                            $controller->action_url('abschnitt', ['version_id' => $version->id]),
                            _('Studiengangteil-Abschnitt anlegen'),
                            Icon::create('file', Icon::ROLE_CLICKABLE, ['title' => _('Studiengangteil-Abschnitt anlegen')]),
                            ['data-dialog' => true])
                        ?>
                    <? endif; ?>
                    <? if ($perm->havePermWrite()) : ?>
                        <? $actionMenu->addLink(
                            $controller->action_url('version/' . $version->stgteil_id . '/' . $version->id),
                            _('Version bearbeiten'),
                            Icon::create('edit', Icon::ROLE_CLICKABLE, ['title' => _('Version bearbeiten')]))
                        ?>
                    <? endif; ?>
                    <? if (MvvPerm::havePermCreate('StgteilVersion')) : ?>
                        <? $actionMenu->addButton(
                            'copy',
                            _('Version kopieren'),
                            Icon::create(
                                'files',
                                Icon::ROLE_CLICKABLE,
                                ['title'        => _('Version kopieren'),
                                 'formaction'   => $controller->action_url('copy_version/' . $version->id),
                                 'data-confirm' => sprintf(
                                     _('Wollen Sie wirklich die Version "%s" des Studiengangteils kopieren?'),
                                     $version->getDisplayName())
                                ]
                            ))
                        ?>
                    <? endif; ?>
                    <? if ($perm->havePermCreate()) : ?>
                        <? $actionMenu->addButton(
                            'delete',
                            _('Version löschen'),
                            Icon::create('trash', Icon::ROLE_CLICKABLE,
                                ['title'        => _('Version löschen'),
                                 'formaction'   => $controller->action_url('delete_version/' . $version->id),
                                 'data-confirm' => sprintf(
                                     _('Wollen Sie wirklich die Version "%s" des Studiengangteils löschen?'),
                                     $version->getDisplayName())
                                ]
                            ))
                        ?>
                    <? endif; ?>
                    <?= $actionMenu->render() ?>
                </form>
            </td>
        </tr>
        <? if (!empty($version_id) && ($version_id === $version->id)) : ?>
            <tr class="loaded-details nohover">
                <?= $this->render_partial('studiengaenge/versionen/abschnitte', compact('version', 'abschnitte')) ?>
            </tr>
        <? endif; ?>
    </tbody>
<? endforeach; ?>