aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/dates/new_topic.php
blob: 1cc303d78ae13196d559dab0b2f35701223aee38 (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
<?php
/**
 * @var Course $course
 * @var CourseDate $date
 */
?>
<form action="<?= URLHelper::getLink("dispatch.php/course/dates") ?>" method="post" id="dates_add_topic" class="default">
    <input type="hidden" name="termin_id" value="<?= $date->getId() ?>">
    <fieldset>
        <legend><?= _('Thema anlegen / verknüpfen') ?></legend>
    <table class="default">
        <tbody>
        <tr>
            <td><?= _("Termin") ?></td>
            <td class="date_name"><?= htmlReady($date->getFullName()) ?></td>
        </tr>
        <tr>
            <td><label for="topic_title"><?= _("Thema") ?></label></td>
            <td>
                <input type="text" class="topic_title" name="topic_title" id="topic_title" required>
                <script>
                    jQuery(function () {
                        jQuery("#dates_add_topic .topic_title").autocomplete({
                            'source': <?= json_encode($course->topics->pluck('title')) ?>,
                            'select': function (event, { item }) {
                                $(this).val(item.value);
                                jQuery("#dates_add_topic").trigger('submit');
                            }
                        });
                    });
                </script>
            </td>
        </tr>
        <tr>
            <td><?= _("Vorhandenes Thema verknüpfen") ?></td>
            <td>
                <ul class="clean">
                <? foreach ($course->topics as $topic) : ?>
                    <li>
                        <a href="#" onClick="jQuery('#dates_add_topic .topic_title').val('<?= htmlReady($topic['title']) ?>'); jQuery('#dates_add_topic').submit(); return false;">
                            <?= Icon::create('arr_2up', 'clickable')->asImg() ?>
                            <?= htmlReady($topic['title']) ?>
                        </a>
                    </li>
                <? endforeach ?>
                </ul>
            </td>
        </tr>
        </tbody>
    </table>
    </fieldset>
    <footer data-dialog-button>
        <?= \Studip\Button::create(_("Hinzufügen")) ?>
    </footer>
</form>