aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/connectedcourses/connect.php
blob: 4c6a2e54a7af63bae653a0cf8a0694a4e72460c5 (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
<form method="get"
      action="<?= $controller->link_for('course/connectedcourses/connect', ['search' => 1]) ?>">
    <?= CSRFProtection::tokenTag() ?>
    <table class="default" style="margin-top: 20px;">
        <caption>
            <?= _('Lehrveranstaltungen') ?>
            <span class="actions">
                <? if (Request::get('search')) : ?>
                        <select name="semester_id" aria-label="<?= _('Filtern Sie optional nach einem Semester') ?>">
                            <option value=""><?= _('In Semester') ?></option>
                            <? foreach (array_reverse(Semester::getAll()) as $semester) : ?>
                                <option value="<?= htmlReady($semester->id) ?>"<?= $semester->id === Request::option('semester_id') ? ' selected' : '' ?>>
                                     <?= htmlReady($semester->name) ?>
                                </option>
                            <? endforeach ?>
                        </select>

                        <input type="text"
                               name="search"
                               id="search_connectable_courses"
                               autofocus
                               placeholder="<?= _('Veranstaltung suchen ...') ?>"
                               value="<?= htmlReady(Request::get('search') != 1 ? Request::get('search') : '') ?>">
                        <?= Icon::create('search')->asInput([
                            'title' => _('Suchen Sie nach beliebigen Veranstaltungen'),
                            'data-dialog' => 1
                        ]) ?>
                        <a href="<?= $controller->connect() ?>" data-dialog title="<?= _('Suche schließen') ?>">
                            <?= Icon::create('decline') ?>
                        </a>
                <? else : ?>
                    <?= Icon::create('search')->asInput([
                        'title' => _('Suchen Sie nach beliebigen Veranstaltungen'),
                        'data-dialog' => 1,
                        'formaction' => $controller->connectURL(['search' => 1])
                    ]) ?>
                <? endif ?>
            </span>
        </caption>
        <thead>
            <tr>
                <th><?= _('Name') ?></th>
                <th><?= _('Semester') ?></th>
                <th class="actions"><?= _('Aktion') ?></th>
            </tr>
        </thead>
        <tbody>
        <? if (!Request::get('search') || Request::get('search') == 1) : ?>
            <? if (count($my_courses) + count($suggestions) > 0) : ?>
                <? foreach ($my_courses as $my_course) : ?>
                    <?= $this->render_partial('course/connectedcourses/_course_to_connect', ['course' => $my_course]) ?>
                <? endforeach ?>
                <? foreach ($suggestions as $suggested_course) : ?>
                    <?= $this->render_partial('course/connectedcourses/_course_to_connect', ['course' => $suggested_course]) ?>
                <? endforeach ?>
            <? else : ?>
            <tr>
                <td colspan="3">
                    <?= _('Suchen Sie nach Veranstaltungen.') ?>
                </td>
            </tr>
            <? endif ?>
        <? else : ?>
            <? if (isset($searchresults) && count($searchresults)) : ?>
            <? foreach ($searchresults as $course) : ?>
                <?= $this->render_partial('course/connectedcourses/_course_to_connect', ['course' => $course]) ?>
            <? endforeach ?>
            <? else : ?>
                <tr>
                    <td colspan="3">
                        <?= _('Keine passenden Ergebnisse gefunden.') ?>
                    </td>
                </tr>
            <? endif ?>
        <? endif ?>
        </tbody>
    </table>
</form>