aboutsummaryrefslogtreecommitdiff
path: root/app/views/score/index.php
blob: a5901ef07b82e6d88a22f12f375054efb7c54860 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/**
 * @var ScoreController $controller
 * @var int $current_user_score
 * @var User $current_user
 * @var array $persons
 * @var int $offset
 * @var int $page
 * @var int $numberOfPersons
 * @var int $max_per_page
 */
?>
<table class="default">
    <caption>
        <span class="actions" style="font-size: 0.9em;">
            <?= _('Ihre Punkte:') ?>
            <strong><?= number_format($current_user_score, 0, ',', '.') ?></strong>
            <div class="hidden-small-down">(<?= Score::getTitel($current_user_score, $current_user->geschlecht) ?>)</div>
        </span>
        <?= _('Stud.IP-Rangliste')?>
    </caption>
    <colgroup>
        <col width="3%">
        <col width="1%">
        <col width="50%">
        <col class="hidden-small-down" width="15%">
        <col width="15%">
        <col class="hidden-small-down" width="15%">
        <col class="hidden-small-down" width="1%">
    </colgroup>
    <thead>
    <tr>
        <th><div class="hidden-small-down"><?= _('Platz') ?></div></th>
        <th></th>
        <th><?= _('Name') ?></th>
        <th class="hidden-small-down"></th>
        <th><?= _('Punkte') ?></th>
        <th class="hidden-small-down"><?= _('Titel') ?></th>
        <th class="hidden-small-down"></th>
    </tr>
    </thead>
    <tbody>
    <? foreach ($persons as $index => $person): ?>
        <tr>
            <td style="text-align: right;">
                <?= $offset + $index + 1 ?>.
            </td>
            <td>
                <?= Avatar::getAvatar($person['user_id'], $person['username'])
                    ->getImageTag(Avatar::SMALL, ['title' => $person['fullname']])
                ?>
            </td>
            <td>
                <a href="<?= URLHelper::getLink('dispatch.php/profile?username='. $person['username']) ?>">
                    <?= htmlReady($person['fullname']) ?>
                </a>
                <? foreach ($person['is_king'] as $type => $text): ?>
                    <?= Icon::create('crown', Icon::ROLE_SORT)->asSvg(['title' => $text, 'alt' => $text, 'class' => 'text-top']) ?>
                <? endforeach ?>
            </td>
            <td class="hidden-small-down">
                <?
                $content = Assets::img('blank.gif', ['width' => Icon::SIZE_DEFAULT]) . ' ';

                // News
                if (!empty($person['newscount'])) {
                    $tmp = sprintf(ngettext('Eine persönliche Ankündigung', '%s persönliche Ankündigungen', $person['newscount']), $person['newscount']);
                    $content .= sprintf(
                        '<a href="%s">%s</a> ',
                        URLHelper::getLink('dispatch.php/profile?username=' . $person['username']),
                        Icon::create('news', Icon::ROLE_CLICKABLE, ['title' => $tmp])->asSvg()
                    );
                } else {
                    $content .= Assets::img('blank.gif', ['width' => Icon::SIZE_DEFAULT]) . ' ';
                }

                // Votes
                if (!empty($person['votecount'])) {
                    $tmp = sprintf(ngettext('Eine Umfrage', '%s Umfragen', $person['votecount']), $person['votecount']);
                    $content .= sprintf(
                        '<a href="%s">%s</a> ',
                        URLHelper::getLink('dispatch.php/profile?username=' . $person['username'] . '#questionnaire_area'),
                        Icon::create('vote', Icon::ROLE_CLICKABLE, ['title' => $tmp])->asSvg()
                    );
                } else {
                    $content .= Assets::img('blank.gif', ['width' => Icon::SIZE_DEFAULT]) . ' ';
                }

                // Termine
                if (!empty($person['eventcount'])) {
                    $tmp = sprintf(ngettext('Ein Termin', '%s Termine', $person['eventcount']), $person['eventcount']);
                    $content .= sprintf(
                        '<a href="%s">%s</a> ',
                        URLHelper::getLink('dispatch.php/profile?username=' . $person['username'] . '#a'),
                        Icon::create('schedule', Icon::ROLE_CLICKABLE, ['title' => $tmp])->asSvg()
                    );
                } else {
                    $content .= Assets::img('blank.gif', ['width' => Icon::SIZE_DEFAULT]) . ' ';
                }

                $content .= Assets::img('blank.gif', ['width' => Icon::SIZE_DEFAULT]) . ' ';

                echo $content;
                ?>
            </td>
            <td><?= number_format($person['score'], 0, ',', '.') ?></td>
            <td class="hidden-small-down" ><?= Score::getTitel($person['score'], $person['geschlecht']) ?></td>
            <td class="hidden-small-down"  style="text-align: right">
                <? if($person['user_id'] == $GLOBALS['user']->id): ?>
                    <a href="<?= $controller->url_for('score/unpublish') ?>">
                        <?= Icon::create('trash', Icon::ROLE_CLICKABLE, ['title' => _('Ihren Wert von der Liste löschen')])
                            ->asSvg(['class' => 'text-top'])
                        ?>
                    </a>
                <? endif; ?>
            </td>
        </tr>
    <? endforeach ?>
    </tbody>
    <? if (ceil($numberOfPersons / $max_per_page) > 1): ?>
        <tfoot>
        <tr>
            <td colspan="7" style="text-align: right">
                <?= $GLOBALS['template_factory']->render('shared/pagechooser',
                    [
                        'perPage'      => $max_per_page,
                        'num_postings' => $numberOfPersons,
                        'page'         => $page,
                        'pagelink'     => 'dispatch.php/score/%u'
                    ]
                ) ?>
            </td>
        </tr>
        </tfoot>
    <? endif ?>
</table>