aboutsummaryrefslogtreecommitdiff
path: root/app/views/questionnaire/widget.php
blob: 6d7f4b3effe3597da6a6385bb3577556c49c19f2 (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
<? $allowed_to_add = ($range_id === $GLOBALS['user']->id && $range_type === "user") || ($range_id === "start" && $GLOBALS['perm']->have_perm("root")) || ($range_type === "course" && $GLOBALS['perm']->have_studip_perm("tutor", $range_id)) || ($range_type === "institute" && $GLOBALS['perm']->have_studip_perm("tutor", $range_id)) ?>
<article class="studip questionnaire_widget" id="questionnaire_area">
    <header>
        <h1>
            <?= Icon::create("evaluation", "info")->asimg("16px", ['class' => "text-bottom"]) ?>
            <?= _('Fragebögen') ?>
        </h1>
        <nav>
            <? if ($allowed_to_add) : ?>
                <? if ($statusgruppen_ids): ?>
                    <a href="<?= $controller->link_for('questionnaire/add_to_context') ?>" data-dialog="size=auto"
                       title="<?= _('Fragebogen hinzufügen') ?>" aria-label="<?= _('Fragebogen hinzufügen') ?>">
                        <?= Icon::create("add", "clickable")->asimg("16px", ['class' => "text-bottom"]) ?>
                    </a>
                <? else: ?>
                    <a href="<?= $controller->link_for('questionnaire/edit', compact('range_type', 'range_id')) ?>" data-dialog
                       title="<?= _('Fragebogen hinzufügen') ?>" aria-label="<?= _('Fragebogen hinzufügen') ?>">
                        <?= Icon::create("add", "clickable")->asimg("16px", ['class' => "text-bottom"]) ?>
                    </a>
                <? endif ?>
                <a href="<?= URLHelper::getLink("dispatch.php/questionnaire/" . ($range_type == 'course' || $range_type == 'institute' ? 'course' : ''). "overview") ?>"
                   title="<?= _('Fragebögen verwalten') ?>" aria-label="<?= _('Fragebögen verwalten') ?>">
                    <?= Icon::create("admin", "clickable")->asimg("16px", ['class' => "text-bottom"]) ?>
                </a>
            <? endif ?>
        </nav>
    </header>

    <? if ($questionnaire_data): ?>
        <? foreach ($questionnaire_data as $questionnaire): ?>
            <?= $this->render_partial("questionnaire/_widget_questionnaire", ['questionnaire' => Questionnaire::buildExisting($questionnaire), 'range_type' => $range_type, 'range_id' => $range_id]) ?>
        <? endforeach; ?>
    <? elseif (empty($suppress_empty_output)): ?>
        <section class="noquestionnaires">
            <?= _('Es sind keine Fragebögen vorhanden.') ?>
            <? if ($allowed_to_add) : ?>
                <?= _("Nutzen Sie die Aktion „Fragebogen hinzufügen“ um einen neuen Fragebogen hinzuzufügen.") ?>
            <? endif ?>
        </section>
    <? endif; ?>
        <footer>
            <? if (Request::get('questionnaire_showall')): ?>
                <a href="<?= URLHelper::getLink('#questionnaire_area', ['questionnaire_showall' => 0]) ?>"><?= _('Abgelaufene Fragebögen ausblenden') ?></a>
            <? else: ?>
                <a href="<?= URLHelper::getLink('#questionnaire_area', ['questionnaire_showall' => 1]) ?>"><?= _('Abgelaufene Fragebögen einblenden') ?></a>
            <? endif; ?>
        </footer>
</article>