aboutsummaryrefslogtreecommitdiff
path: root/app/views/fachabschluss/abschluesse/index.php
blob: 7e8947ff1eeb1d099ff9301cfac808d31be0d3ac (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
<form method="post">
    <?= CSRFProtection::tokenTag(); ?>
    <table class="default collapsable">
        <caption>
            <?= _('Abschlüsse mit verwendeten Fächern') ?>
            <span class="actions"><? printf(ngettext('%s Abschluss', '%s Abschlüsse', $count), $count) ?></span>
        </caption>
        <thead>
            <tr class="sortable">
                <?= $controller->renderSortLink('/index', _('Abschluss'), 'name') ?>
                <?= $controller->renderSortLink('/index', _('Abschluss-Kategorie'), 'kategorie_name', ['style' => 'width: 30%;']) ?>
                <?= $controller->renderSortLink('/index', ('Fächer'), 'count_faecher', ['style' => 'width: 5%;']) ?>
                <th style="width: 5%; text-align: right;"><?= _('Aktionen') ?></th>
            </tr>
        </thead>
        <? foreach ($abschluesse as $abschluss) : ?>
        <tbody class="<?= $abschluss->count_faecher ? '' : 'empty' ?> <?= !empty($abschluss_id) ? 'not-collapsed' : 'collapsed' ?>">
        <tr class="header-row">
            <td class="toggle-indicator">
                <? if ($abschluss->count_faecher) : ?>
                    <a class="mvv-load-in-new-row" href="<?= $controller->action_link('details/' . $abschluss->id) ?>"><?= htmlReady($abschluss->name) ?> </a>
                <? else: ?>
                    <?= htmlReady($abschluss->name) ?>
                <? endif; ?>
            </td>
            <td class="dont-hide"><?= htmlReady($abschluss->kategorie_name) ?></td>
            <td style="text-align: center;" class="dont-hide"><?= $abschluss->count_faecher ?></td>
            <td class="dont-hide actions" style="white-space: nowrap;">
            <? if (MvvPerm::havePermWrite($abschluss)) : ?>
                <a href="<?=$controller->action_link('abschluss/' . $abschluss->id)?>">
                    <?= Icon::create('edit', Icon::ROLE_CLICKABLE, tooltip2(_('Abschluss bearbeiten')))->asSvg(); ?>
                </a>
            <? endif; ?>
            <? if (MvvPerm::havePermCreate($abschluss)) : ?>
                <? if (!$abschluss->count_faecher) : ?>
                <?= Icon::create('trash', Icon::ROLE_CLICKABLE, tooltip2(_('Abschluss löschen')))->asInput(
                        [
                            'formaction'   => $controller->action_url('delete/' . $abschluss->id),
                            'data-confirm' => sprintf(
                                _('Wollen Sie wirklich den Abschluss "%s" löschen?'),
                                $abschluss->name
                            ),
                            'name'         => 'delete'
                        ]); ?>
                <? else : ?>
                    <?= Icon::create('trash', Icon::ROLE_INACTIVE, tooltip2(_('Abschluss kann nicht glöscht werden')))->asSvg(); ?>
                <? endif; ?>
            <? endif; ?>
            </td>
        </tr>
        </tbody>
        <? endforeach; ?>
        <? if ($count > MVVController::$items_per_page) : ?>
            <tfoot>
                <tr>
                    <td colspan="4" style="text-align: right;">
                    <?php
                        $pagination = $GLOBALS['template_factory']->open('shared/pagechooser');
                        $pagination->clear_attributes();
                        $pagination->set_attribute('perPage', MVVController::$items_per_page);
                        $pagination->set_attribute('num_postings', $count);
                        $pagination->set_attribute('page', $page);
                        $page_link = explode('?', $controller->action_url('index'))[0] . '?page_abschluesse=%s';
                        $pagination->set_attribute('pagelink', $page_link);
                        echo $pagination->render();
                    ?>

                    </td>
                </tr>
            </tfoot>
        <? endif; ?>
    </table>
</form>