aboutsummaryrefslogtreecommitdiff
path: root/app/views/oer/mymaterial/_material_list.php
blob: afb47b3f30aef2fda2292e45b728592b659c6aee (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
<table class="default oer_mymaterial">
    <thead>
    <tr>
        <th style="width:20px"></th>
        <th><?= _('Material') ?></th>
        <th><?= _('Bewertung') ?></th>
        <th><?= _('Downloads') ?></th>
        <th class="actions"><?= _('Aktion') ?></th>
    </tr>
    </thead>
    <tbody>
    <? $starwidth = '20px' ?>
    <? foreach ($materialien as $material) : ?>
        <tr>
            <td>
                <? if ($material->draft) : ?>
                    <?= Icon::create('lock-locked', Icon::ROLE_INFO)->asImg(['class' => 'text-bottom']) ?>
                <? endif ?>
            </td>
            <td>
                <a href="<?= $controller->link_for('oer/market/details/' . $material->id) ?>">
                    <?= htmlReady($material['name']) ?>
                </a>
            </td>
            <td>
                <? if ($material->rating === null) : ?>
                    <?= Icon::create('star', Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <?= Icon::create('star', Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <?= Icon::create('star', Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <?= Icon::create('star', Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <?= Icon::create('star', Icon::ROLE_INFO)->asImg($starwidth) ?>
                <? else : ?>
                    <? $material->rating = round($material->rating, 1) / 2 ?>
                    <? $v = $material->rating >= 0.75 ? '' : ($material->rating >= 0.25 ? '-halffull' : '-empty') ?>
                    <?= Icon::create("star{$v}", Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <? $v = $material->rating >= 1.75 ? '' : ($material->rating >= 1.25 ? '-halffull' : '-empty') ?>
                    <?= Icon::create("star{$v}", Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <? $v = $material->rating >= 2.75 ? '' : ($material->rating >= 2.25 ? '-halffull' : '-empty') ?>
                    <?= Icon::create("star{$v}", Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <? $v = $material->rating >= 3.75 ? '' : ($material->rating >= 3.25 ? '-halffull' : '-empty') ?>
                    <?= Icon::create("star{$v}", Icon::ROLE_INFO)->asImg($starwidth) ?>
                    <? $v = $material->rating >= 4.75 ? '' : ($material->rating >= 4.25 ? '-halffull' : '-empty') ?>
                    <?= Icon::create("star{$v}", Icon::ROLE_INFO)->asImg($starwidth) ?>
                <? endif ?>
            </td>
            <td>
                <a href="<?= $controller->link_for('oer/mymaterial/statistics/' . $material->id) ?>" data-dialog="size=auto">
                    <?= OERDownloadcounter::countBySQL('material_id = ?', [$material->id]) ?>
                </a>
            </td>
            <td class="actions">
                <? if ($material->isMine()) : ?>
                    <a href="<?= $controller->link_for('oer/mymaterial/edit/' . $material->id)  ?>" data-dialog
                       title="<?= _('Lernmaterial bearbeiten') ?>">
                        <?= Icon::create('edit') ?>
                    </a>
                    <form action="<?= $controller->link_for('oer/mymaterial/delete/' . $material->id) ?>"
                          class="inlineform"
                          method="post"
                          data-confirm="<?= _('Dieses Material wirklich löschen?') ?>">
                        <?= Icon::create('trash')->asInput() ?>
                    </form>
                <? endif ?>
            </td>
        </tr>
    <? endforeach ?>
    </tbody>
</table>