aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/plugin/search.php
blob: d88dc25887fd81ec6cf5c9ecc0e19c9da2d545c3 (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
<?php
/**
 * @var Admin_PluginController $controller
 * @var array $search_results
 * @var string $search
 * @var array $errors
 */
?>
<? if (!$search_results): ?>
    <?= MessageBox::info(_('Es wurden keine Plugins gefunden.')) ?>
<? else: ?>
    <table class="default nohover">
        <caption>
        <? if ($search === null): ?>
            <?= _('Empfohlene Plugins') ?>
        <? else: ?>
            <?= _('Suchergebnisse') ?>
        <? endif ?>
        </caption>
        <thead>
            <tr>
                <th class="plugin_image"><?= _('Bild')?></th>
                <th><?= _('Name und Beschreibung')?></th>
                <th><?= _('Version') ?></th>
                <th><?= _('Bewertung') ?></th>
                <th class="plugin_install actions"><?= _('Installieren') ?></th>
            </tr>
        </thead>
        <tbody>
        <? foreach ($search_results as $name => $plugin): ?>
            <tr style="vertical-align: top">
                <td class="plugin_image">
                <? if ($plugin['image']): ?>
                    <a href="<?= htmlReady($plugin['image']) ?>"
                       data-lightbox="<?= htmlReady($plugin['displayname']?? '') ?>"
                       data-title="<?= htmlReady($name) ?>">
                        <img src="<?= htmlReady($plugin['image']) ?>" class="plugin_preview">
                    </a>
                <? endif ?>
                </td>
                <td>
                    <a href="<?= htmlReady($plugin['marketplace_url']) ?>" target="_blank" rel="noopener noreferrer" title="<?= _('Zum Marktplatz') ?>">
                        <strong><?= htmlReady($name) ?></strong>
                    </a>
                <? if (mb_strlen($plugin['description']) > 500) : ?>
                    <span class="plugin_description short">
                        <div>
                            <p>
                                <?= htmlReady($plugin['description'], true, true) ?>
                            </p>
                        <? if ($plugin['plugin_url'] && $plugin['plugin_url'] !== $plugin['marketplace_url']): ?>
                            <a href="<?= htmlReady($plugin['plugin_url']) ?>" target="_blank" rel="noopener noreferrer" class="link-extern">
                                <?= _('Plugin-Homepage') ?>
                            </a>
                        <? endif ?>

                            <p class="read_more"></p>
                        </div>

                        <a href="" class="read_more_link" onClick="jQuery(this).parent().toggleClass('short');return false;">
                            <span><?= _('Weiterlesen') ?></span>
                        </a>
                    </span>
                <? else: ?>
                    <p>
                        <?= htmlReady($plugin['description'], true, true) ?>
                    </p>
                    <? if ($plugin['plugin_url'] && $plugin['plugin_url'] !== $plugin['marketplace_url']): ?>
                        <a href="<?= htmlReady($plugin['plugin_url']) ?>" target="_blank" rel="noopener noreferrer" class="link-extern">
                            <?= _('Plugin-Homepage') ?>
                        </a>
                    <? endif ?>
                <? endif ?>
                </td>
                <td>
                    <?= htmlReady($plugin['version']) ?>
                </td>
                <td class="plugin_score" <? if ($plugin['score']) printf('title="%s"', round($plugin['score'] / 2, 1)) ?>>
                <? for ($i = 0; $i < $plugin['score'] / 2; ++$i): ?>
                    <?= Icon::create('star', Icon::ROLE_INACTIVE) ?>
                <? endfor ?>
                </td>
                <td class="plugin_install actions">
                    <form action="<?= $controller->link_for('admin/plugin/install') ?>" method="post">
                        <?= CSRFProtection::tokenTag() ?>
                        <input type="hidden" name="plugin_url" value="<?= htmlReady($plugin['url']) ?>">
                        <input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>">
                        <?= Icon::create('install')->asInput([
                            'title' => _('Plugin installieren'),
                            'class' => 'middle',
                            'name'  => 'install',
                        ]) ?>
                    </form>
                </td>
            </tr>
        <? endforeach ?>
        </tbody>
    </table>
<? endif ?>