aboutsummaryrefslogtreecommitdiff
path: root/app/views/questionnaire/context.php
blob: e1b53ace0a734a7fa69c77555bb2613599355d32 (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
109
<form action="<?= URLHelper::getLink("dispatch.php/questionnaire/context/".$questionnaire->getId()) ?>"
      method="post"
      class="default"
      <?= Request::isAjax() ? "data-dialog" : "" ?>
    >
    <fieldset>
        <legend><?= _("URL zum Fragebogen") ?></legend>
        <input type="text" aria-label="<?= _('URL zum Fragebogen (nur lesbar)') ?>" readonly value="<?= htmlReady($GLOBALS['ABSOLUTE_URI_STUDIP'].'dispatch.php/questionnaire/answer/'.$questionnaire->getId()) ?>">
        <a href="<?= htmlReady($GLOBALS['ABSOLUTE_URI_STUDIP'] . "dispatch.php/questionnaire/answer/" . $questionnaire->id) ?>"
           data-qr-code title="<?= _('QR-Code zum Link anzeigen') ?>">
            <?= Icon::create('code-qr')->asSvg(['class' => 'text-bottom']) ?>
        </a>
    </fieldset>
    <fieldset>
        <legend><?= _("Freigaben bearbeiten") ?></legend>
        <label>
            <input type="checkbox" name="user" value="1"<?= $profile ? " checked" : "" ?>>
            <?= _("Auf der persönlichen Profilseite") ?>
        </label>
        <label>
            <input type="checkbox" name="public" value="1"<?= $public ? " checked" : "" ?>>
            <?= _("Als öffentlicher Link für unangemeldete Nutzer") ?>
        </label>
        <? if ($GLOBALS['perm']->have_perm("root")) : ?>
            <label>
                <input type="checkbox" name="start" value="1"<?= $start ? " checked" : "" ?>>
                <?= _("Auf der Systemstartseite") ?>
            </label>
        <? endif ?>

        <h3><?= _("Veranstaltungen") ?></h3>
        <ul class="clean courseselector">
            <? foreach ($this->questionnaire->assignments as $assignment) : ?>
            <? if ($assignment['range_type'] === "course") : ?>
                <? $course = Course::find($assignment['range_id']) ?>
                <? if ($course) : ?>
                <li>
                    <label>
                        <input type="checkbox" name="remove_sem[]" value="<?= htmlReady($assignment['range_id']) ?>" style="display: none;">
                        <span>
                            <a href="<?= URLHelper::getLink('dispatch.php/course/go', ['to' => $course->getId()]) ?>">
                                <?= htmlReady((Config::get()->IMPORTANT_SEMNUMBER ? $course->veranstaltungsnummer." " : "").$course->name. ' ('.$course->semester_text.')') ?>
                            </a>
                            <?= Icon::create('trash')->asSvg(['class' => 'text-bottom', 'title' => _('Zuweisung zur Veranstaltung aufheben.')]) ?>
                        </span>
                    </label>
                </li>
                <? endif ?>
            <? endif ?>
            <? endforeach ?>
        </ul>
        <?= QuickSearch::get("add_seminar_id", $seminarsearch)->render() ?>

        <h3><?= _("Teilnehmergruppen in Veranstaltungen") ?></h3>
        <ul class="clean statusgroupselector">
            <? foreach ($this->questionnaire->assignments as $assignment) : ?>
                <? if ($assignment['range_type'] === "statusgruppe") : ?>
                    <li>
                        <label>
                            <input type="checkbox" name="remove_statusgruppe[]" value="<?= htmlReady($assignment['range_id']) ?>" style="display: none;">
                            <? $statusgruppe = Statusgruppen::find($assignment['range_id']) ?>
                            <span>
                                <a href="<?= URLHelper::getLink("dispatch.php/course/go", ['to' => $statusgruppe->getId()]) ?>">
                                    <?= htmlReady($statusgruppe->course['name'].": ".$statusgruppe->name) ?>
                                </a>
                                <?= Icon::create('trash')->asSvg(['class' => 'text-bottom', 'title' => _('Zuweisung zur Veranstaltung aufheben.')]) ?>
                            </span>
                        </label>
                    </li>
                <? endif ?>
            <? endforeach ?>
        </ul>
        <?= QuickSearch::get("add_statusgruppe_id", $statusgruppesearch)->render() ?>

        <? if ($GLOBALS['perm']->have_perm("admin")) : ?>
            <h3><?= _("Einrichtungen") ?></h3>
            <ul class="clean instituteselector">
                <? foreach ($this->questionnaire->assignments as $assignment) : ?>
                    <? if ($assignment['range_type'] === 'institute') : ?>
                        <li>
                            <label>
                                <input type="checkbox" name="remove_inst[]" value="<?= htmlReady($assignment['range_id']) ?>" style="display: none;">
                                <span><?= htmlReady(Institute::find($assignment['range_id'])->name) ?></span>
                                <?= Icon::create('trash', 'clickable', ['title' => _('Zuweisung zur Einrichtung aufheben.')])->asSvg(['class' => 'text-bottom']) ?>
                            </label>
                        </li>
                    <? endif ?>
                <? endforeach ?>
            </ul>
            <?= QuickSearch::get('add_institut_id', new InstituteSearch($this->questionnaire->assignments->filter(function ($q) {
                return $q['range_type'] === 'institute';
            })->pluck('range_id')))->render() ?>
        <? endif ?>

        <?
        foreach (PluginManager::getInstance()->getPlugins(QuestionnaireAssignmentPlugin::class) as $plugin) {
            $template = $plugin->getQuestionnaireAssignmentEditTemplate($this->questionnaire);
            if ($template) {
                echo $template->render();
            }
        }
        ?>

    </fieldset>

    <footer data-dialog-button>
        <?= \Studip\Button::create(_("Speichern"), 'questionnaire_store_relations') ?>
    </footer>
</form>