aboutsummaryrefslogtreecommitdiff
path: root/app/views/evaluation/pool/index.php
blob: 6eb2e7d119b76653dfb5d106ee0d5da3a12d7a4b (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
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
 * @var Evaluation_PoolController $controller
 */

use Studip\Button;

?>
<form action="<?= $controller->link_for("questionnaire/bulkdelete", ["range_type" => 'pool']) ?>"
      method="post">
    <?= CSRFProtection::tokenTag() ?>
    <table class="default sortable-table" id="template_pool">
        <caption><?= _('Evaluations-Vorlagen') ?></caption>
        <thead>
            <tr>
                <th style="width: 20px" scope="col">
                    <input type="checkbox"
                           data-proxyfor="#template_pool > tbody input[type=checkbox]"
                           data-activates="#template_pool tfoot button">
                </th>
                <th data-sort="text" scope="col"><?= _('Titel') ?></th>
                <th data-sort="digit" scope="col"><?= _('Datum') ?></th>
                <th data-sort="text" scope="col"><?= _('Status') ?></th>
                <th class="actions" scope="col"><?= _('Aktionen') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php if (count($controller->templates)) : ?>
                <?php foreach ($controller->templates as $template) : ?>
                    <tr>
                        <td>
                            <input type="checkbox" name="q[]" value="<?= htmlReady($template->id) ?>">
                        </td>
                        <td>
                            <?php if ($template->isEditable()) : ?>
                                <a href="<?= $controller->link_for('questionnaire/edit/' . $template->id,
                                    ['range_type' => 'pool']) ?>"
                                   data-dialog="size=big">
                                    <?= htmlReady($template->title) ?>
                                </a>
                            <?php else : ?>
                                <?= htmlReady($template->title) ?>
                            <?php endif ?>
                        </td>
                        <td data-text="<?= (int) $template->chdate ?>">
                            <?= date('d.m.Y H:i', $template->chdate) ?>
                        </td>
                        <td>
                            <?= $template->template_is_enabled ? _('Freigegeben') : _('Gesperrt') ?>
                        </td>
                        <td class="actions">
                            <? if (!$template->isEditable()) : ?>
                                <?= Icon::create('edit', Icon::ROLE_INACTIVE)->asSvg(
                                    ['title' => _('Mindestens eine Evaluation dieser Vorlage ist gestartet.
                                     Sie kann nicht mehr bearbeitet werden.')]
                                ) ?>
                            <? else : ?>
                                <a href="<?= $controller->link_for('questionnaire/edit/' . $template->id) ?>"
                                   data-dialog="size=big"
                                   title="<?= _('Vorlage bearbeiten') ?>">
                                    <?= Icon::create('edit') ?>
                                </a>
                            <? endif ?>

                            <?php
                                $menu = ActionMenu::get()->setContext($template['title']);
                                $menu->addLink(
                                    $controller->url_for('questionnaire/copy/' . $template->id),
                                    _('Kopieren'),
                                    Icon::create('clipboard')
                                );
                                $menu->addLink(
                                    $controller->url_for('evaluation/pool/template_enable/' . $template->id),
                                    $template->template_is_enabled ? _('Sperren') : _('Freigeben'),
                                    Icon::create($template->template_is_enabled ? 'lock-locked' : 'lock-unlocked')
                                );
                                echo $menu->render();
                            ?>
                        </td>
                    </tr>
                <?php endforeach ?>
            <?php else : ?>
                <tr>
                    <td colspan="5" style="text-align: center">
                        <?= _('Sie haben noch keine Vorlagen erstellt.') ?>
                    </td>
                </tr>
            <? endif ?>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="5">
                    <?= Button::create(_("Löschen"), "bulkdelete", ['data-confirm' => _("Wirklich löschen?")]) ?>
                </td>
            </tr>
        </tfoot>
    </table>
</form>

<?php
$actions = new ActionsWidget();
$actions->addLink(
    _('Vorlage erstellen'),
    $controller->url_for('questionnaire/edit', ["range_type" => 'pool']),
    Icon::create('add'),
    ['data-dialog' => 'size=big']
);
Sidebar::Get()->addWidget($actions);