aboutsummaryrefslogtreecommitdiff
path: root/app/views/calendar/contentbox/_termin.php
blob: ded7d0bc2289be1fca13770262e914f2e8d381df (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
<article class="studip toggle <?= ContentBoxHelper::classes($termin->getObjectId()) ?>"
         id="<?= htmlReady($termin->getObjectId()) ?>">
    <header>
        <h1>
            <a href="<?= ContentBoxHelper::href($termin->getObjectId()) ?>">
                <?= Icon::create('date', Icon::ROLE_INACTIVE)->asImg(['class' => 'text-bottom']) ?>
                <?= htmlReady($titles[$termin->getObjectId()] ?? $termin->getTitle()) ?>
            </a>
        </h1>
        <nav>
            <span>
                <?= $termin->getLocation() ? _('Raum') . ': ' . formatLinks($termin->getLocation()) : '' ?>
            </span>
            <? if ($admin && $isProfile && $termin->getObjectClass() === 'CalendarDateAssignment') : ?>
                <a href="<?= URLHelper::getLink('dispatch.php/calendar/calendar') ?>"
                   title="<?= _('Zum Kalender') ?>">
                    <?= Icon::create('schedule')->asImg(['class' => 'text-bottom']) ?>
                </a>
                <? if ($termin->calendar_date->isWritable($GLOBALS['user']->id)) : ?>
                    <a href="<?= URLHelper::getLink('dispatch.php/calendar/date/edit/' . $termin->getPrimaryObjectId()) ?>"
                       title="<?= _('Termin bearbeiten') ?>"
                       data-dialog>
                        <?= Icon::create('edit')->asImg(['class' => 'text-bottom']) ?>
                    </a>
                <? endif ?>
            <? elseif (!$course_range && in_array($termin->getObjectClass(), ['CourseDate', 'CourseExDate'])) : ?>
                <a href="<?= URLHelper::getLink('dispatch.php/course/dates', ['cid' => $termin->getPrimaryObjectId()]) ?>"
                   title="<?= _('Zur Veranstaltung') ?>">
                    <?= Icon::create('seminar')->asImg(['class'=> 'text-bottom']) ?>
                </a>
            <? endif ?>
        </nav>
    </header>
    <div>
        <?
        $themen = [];
        if ($termin instanceof CourseDate) {
            $themen = $termin->topics->toArray('title description');
        }
        $description = '';
        if ($termin instanceof CourseExDate) {
            $description = $termin->content;
        } elseif ($termin instanceof CourseDate && isset($termin->cycle)) {
            $description = $termin->cycle->description;
        } else {
            $description = $termin->getDescription();
        }
        ?>
        <? if ($description || count($themen) > 0) : ?>
            <p><?= formatReady($description) ?></p>
            <? if (count($themen)) : ?>
                <? foreach ($themen as $thema) : ?>
                    <h3>
                        <?= Icon::create('topic', Icon::ROLE_INFO)->asImg(20, ['class' => "text-bottom"]) ?>
                        <?= htmlReady($thema['title']) ?>
                    </h3>
                    <div>
                        <?= formatReady($thema['description']) ?>
                    </div>
                <? endforeach ?>
            <? endif ?>
        <? else : ?>
            <?= _('Keine Beschreibung vorhanden') ?>
        <? endif ?>
        <ul class="list-csv" style="text-align: center;">
            <? foreach ($termin->getAdditionalDescriptions() as $type => $info) : ?>
                <? if (trim($info)) : ?>
                    <li>
                        <small>
                            <? if (!is_numeric($type)): ?>
                                <em><?= htmlReady($type) ?>:</em>
                            <? endif; ?>
                            <?= htmlReady(trim($info)) ?>
                        </small>
                    </li>
                <? endif ?>
            <? endforeach ?>
        </ul>
        <? if (!$course_range && in_array($termin->getObjectClass(), [CourseDate::class, CourseExDate::class])) : ?>
            <div>
                <a href="<?= URLHelper::getLink('dispatch.php/course/dates', ['cid' => $termin->getPrimaryObjectId()]) ?>">
                    <?= Icon::create('link-intern')->asImg(['class'=> 'text-bottom']) ?>
                    <?= _('Zur Veranstaltung') ?>
                </a>
            </div>
        <? endif ?>
    </div>
</article>