aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/studygroup/widget.php
blob: cf0f787982685487f77314a64a25a1d41d395d1b (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 connectedcourses_widget">
    <header>
        <h1>

            <? if ($course->isStudygroup()) : ?>
                <?= Icon::create('seminar', Icon::ROLE_INFO)->asSvg(['class' => "text-bottom"]) ?>
                <?= _('Zugehörige Veranstaltung') ?>
            <? else : ?>
                <?= Icon::create('studygroup', Icon::ROLE_INFO)->asSvg(['class' => "text-bottom"]) ?>
                <?= _('Verknüpfte Studiengruppen') ?>
            <? endif ?>
        </h1>

    </header>

    <section>
        <? if ($course->isStudygroup()) : ?>
            <ul>
            <? foreach ($connections as $connection) : ?>
                <li>
                    <? $link = $connection->course->isAccessibleToUser()
                        ? URLHelper::getLink('seminar_main.php', ['auswahl' => $connection->course->id])
                        : URLHelper::getLink('dispatch.php/course/details', ['cid' => $connection->course->id]) ?>
                    <a href="<?= $link ?>">
                        <?= htmlReady($connection->course->getFullname()) ?>
                    </a>
                </li>
            <? endforeach ?>
            </ul>
        <? else : ?>
            <table class="default">
                <colgroup>
                    <col style="width: 60px;">
                </colgroup>
                <thead>
                    <tr>
                        <th><?= _('Avatar') ?></th>
                        <th><?= _('Name / Beschreibung') ?></th>
                        <th><?= _('Mitglieder') ?></th>
                        <th><?= _('Gründer:in') ?></th>
                    </tr>
                </thead>
                <tbody>
                <? foreach ($connections as $connection) : ?>
                    <tr>
                        <td>
                            <? $link = $connection->studygroup->isAccessibleToUser()
                                ? URLHelper::getLink('seminar_main.php', ['auswahl' => $connection->studygroup->id])
                                : URLHelper::getLink('dispatch.php/course/studygroup/details/'.$connection->studygroup->id) ?>
                            <a href="<?= $link ?>">
                                <?= CourseAvatar::getAvatar($connection->studygroup->id)->getImageTag(Avatar::SMALL) ?>
                            </a>
                        </td>
                        <td>
                            <a href="<?= $link ?>">
                                <?= htmlReady($connection->studygroup->getFullname()) ?>
                            </a>
                            <? if ($connection->studygroup->beschreibung) : ?>
                            <div>
                                <?= htmlReady($connection->studygroup->beschreibung) ?>
                            </div>
                            <? endif ?>
                        </td>
                        <td>
                            <?= count($connection->studygroup->members) ?>
                        </td>
                        <td>
                            <?
                            $founders = $connection->studygroup->members->filter(function ($m) { return $m['status'] === 'dozent'; });
                            foreach ($founders as $index => $founder) : ?>
                                <? if ($index > 0) : ?>
                                ,
                                <? endif ?>
                                <a href="<?= URLHelper::getLink('dispatch.php/profile', ['username' => $founder->user->username]) ?>">
                                    <?= Avatar::getAvatar($founder->user->id)->getImageTag(Avatar::SMALL) ?>
                                    <?= htmlReady($founder->user->getFullname()) ?>
                                </a>
                            <? endforeach ?>
                        </td>
                    </tr>
                <? endforeach ?>
                </tbody>
            </table>
        <? endif ?>

    </section>

</article>