aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/plus/index.php
blob: adf58b2ee1ac45019892edd904bfd2735acabc35 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?

/*
 *  Copyright (c) 2012  Rasmus Fuhse <fuhse@data-quest.de>
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License as
 *  published by the Free Software Foundation; either version 2 of
 *  the License, or (at your option) any later version.
 */

use Studip\Button;

?>

<form action="<?= URLHelper::getLink() ?>" method="post" class="default">
    <?= CSRFProtection::tokenTag() ?>
    <input name="uebernehmen" value="1" type="hidden">
    <table class="default nohover plus">
        <!-- <caption><?= _("Inhaltselemente") ?></caption> -->
        <tbody>
            <? foreach ($available_modules as $category => $pluginlist) : ?>
                <?
                $visibility = '';
                if ($_SESSION['plus']['displaystyle'] != 'category' && $category != 'Funktionen von A-Z') {
                    $visibility = 'invisible';
                }
                if (isset($_SESSION['plus']) && empty($_SESSION['plus']['Kategorie'][$category]) && $category != 'Funktionen von A-Z') {
                    $visibility = 'invisible';
                }
                ?>
                <tr class="<?= $visibility; ?>">
                    <th colspan=3>
                        <?= htmlReady($category) ?>
                    </th>
                </tr>
                <? foreach ($pluginlist as $key => $val) : ?>
                    <?
                    if ($val['type'] == 'plugin') {
                        $plugin           = $val['object'];
                        $plugin_activated = $plugin->isActivated();
                        $info             = $plugin->getMetadata();

                        //Checkbox
                        $anchor      = 'p_' . $plugin->getPluginId();
                        $cb_disabled = '';
                        $cb_checked  = $plugin_activated ? "checked" : "";

                        $pluginname       = $val['displayname'];
                        $url              = $plugin->isCorePlugin() ? $GLOBALS['ABSOLUTE_URI_STUDIP'] : $plugin->getPluginURL();
                        $pluginvisibility = $val['visibility'];
                    }
                    ?>

                    <tr id="<?= htmlReady($anchor); ?>"
                        class="<?= $visibility; ?>">
                        <td class="element" colspan=3>

                            <div class="plus_basic">
                                <input type="checkbox"
                                       id="<?= $key ?>"
                                       name="<?= $key ?>"
                                       data-moduleclass="<?= htmlReady($val['moduleclass']) ?>"
                                       data-key="<?= htmlReady($val['modulkey'] ?? '') ?>"
                                       value="TRUE" <?= $cb_disabled ?> <?= $cb_checked ?>
                                       onClick="STUDIP.Plus.setModule.call(this);">
                                <div class="element_header">
                                    <!-- Name -->
                                    <label for="<?= $key ?>">
                                        <strong><?= htmlReady($pluginname) ?></strong>
                                        <? if ($cb_checked) : ?>
                                            <?= Icon::create(
                                                $pluginvisibility === 'autor' ? 'visibility-visible' : 'visibility-invisible',
                                                Icon::ROLE_INFO,
                                                [
                                                    'title' => sprintf(
                                                        _('%s für Studierende'),
                                                        $pluginvisibility === 'autor' ? _('Sichtbar') : _('Unsichtbar')
                                                    )
                                                ]
                                            ) ?>
                                        <? endif ?>
                                    </label>
                                </div>
                                <div class="element_description">
                                    <? if (isset($info['icon'])) : ?>
                                        <? /* TODO: Plugins should use class "Icon"  */ ?>
                                        <? if (is_string($info['icon'])) : ?>
                                            <img class="plugin_icon text-bottom" alt=""
                                                 src="<?= htmlReady($url . "/" . $info['icon']) ?> ">
                                        <? else: ?>
                                            <?= $info['icon']->asImg(['class' => 'plugin_icon text-bottom', 'alt' => '']) ?>
                                        <? endif ?>
                                    <? endif ?>
                                    <strong class="shortdesc">
                                        <? if (isset($info['descriptionshort'])) : ?>
                                            <? foreach (explode('\n', $info['descriptionshort']) as $descriptionshort) : ?>
                                                <?= htmlReady($descriptionshort) ?>
                                            <? endforeach ?>
                                        <? endif ?>
                                        <? if (!isset($info['descriptionshort'])) : ?>
                                            <? if (isset($info['summary'])) : ?>
                                                <?= htmlReady($info['summary']) ?>
                                            <? elseif (isset($info['description'])) : ?>
                                                <?= htmlReady($info['description']) ?>
                                            <? else: ?>
                                                <?= _('Keine Beschreibung vorhanden.') ?>
                                            <? endif ?>
                                        <? endif ?>
                                    </strong>
                                </div>
                                <? if ($plugin_activated) : ?>
                                    <?
                                    $actionMenu = ActionMenu::get()->setContext($pluginname);
                                    $actionMenu->addLink(
                                        $controller->action_url('edittool/' . $key),
                                        _('Optionen bearbeiten'),
                                        Icon::create('edit'),
                                        ['data-dialog' => 'size=auto']
                                    );
                                    if (method_exists($plugin, 'deleteContent')) {
                                        $actionMenu->addLink(
                                            $controller->action_url('index', ['deleteContent' => 1, 'name' => $key]),
                                            _('Inhalte löschen'),
                                            Icon::create('trash')
                                        );
                                    }
                                    ?>
                                    <div style="float: right">
                                        <?= $actionMenu->render() ?>
                                    </div>
                                <? endif ?>
                            </div>

                            <? if ($_SESSION['plus']['View'] === 'openall' || !isset($_SESSION['plus'])) : ?>
                                <div class="plus_expert hidden-tiny-down">
                                    <div class="screenshot_holder">
                                        <? if (isset($info['screenshot']) || isset($info['screenshots'])) :
                                            if (isset($info['screenshots'])) {
                                                $title  = $info['screenshots']['pictures'][0]['title']??'';
                                                $source = $info['screenshots']['path'] . '/' . $info['screenshots']['pictures'][0]['source'];
                                            } else {
                                                $fileext = pathinfo($info['screenshot'], PATHINFO_EXTENSION);
                                                $title   = str_replace('_', ' ', basename($info['screenshot'], ".$fileext"));
                                                $source  = $info['screenshot'];
                                            }
                                            ?>

                                            <a href="<?= htmlReady("$url/$source") ?>"
                                               data-lightbox="<?= htmlReady($pluginname) ?>"
                                               data-title="<?= htmlReady($title) ?>">
                                                <img class="big_thumb" src="<?= htmlReady("$url/$source") ?>"
                                                     alt="<?= htmlReady($pluginname) ?>"/>
                                            </a>

                                            <? if (isset($info['additionalscreenshots'])
                                                || (isset($info['screenshots']) && count($info['screenshots']) > 1)) :?>
                                                <div class="thumb_holder">
                                                    <?
                                                        if (isset($info['screenshots'])) {
                                                            $counter = count($info['screenshots']['pictures']);
                                                            $cstart  = 1;
                                                        } else {
                                                            $counter = count($info['additionalscreenshots']);
                                                            $cstart  = 0;
                                                        }
                                                    ?>

                                                    <? for ($i = $cstart; $i < $counter; $i++) :?>
                                                        <?
                                                            if (isset($info['screenshots'])) {
                                                                $title  = $info['screenshots']['pictures'][$i]['title']?? '';
                                                                $source = $info['screenshots']['path'] . '/' . $info['screenshots']['pictures'][$i]['source'];
                                                            } else {
                                                                $fileext = pathinfo($info['additionalscreenshots'][$i], PATHINFO_EXTENSION);
                                                                $title   = str_replace('_', ' ', basename($info['additionalscreenshots'][$i], ".$fileext"));
                                                                $source  = $info['additionalscreenshots'][$i];
                                                            }
                                                        ?>
                                                        <a href="<?= htmlReady("$url/$source") ?>"
                                                           data-lightbox="<?= htmlReady($pluginname) ?>"
                                                           data-title="<?= htmlReady($title) ?>">
                                                            <img class="small_thumb"
                                                                 src="<?= htmlReady("$url/$source") ?>"
                                                                 alt="<?= htmlReady($pluginname) ?>">
                                                        </a>
                                                    <? endfor ?>
                                                </div>
                                            <? endif ?>
                                        <? endif ?>
                                    </div>
                                    <div class="descriptionbox">
                                        <? if (isset($info['keywords'])) : ?>
                                            <ul class="keywords">
                                                <? foreach (explode(';', $info['keywords']) as $keyword) : ?>
                                                    <li><?= htmlReady($keyword) ?> </li>
                                                <? endforeach ?>
                                            </ul>
                                        <? endif ?>
                                        <? if (isset($info['descriptionlong'])) : ?>
                                            <? foreach (explode('\n', $info['descriptionlong']) as $descriptionlong) : ?>
                                                <p class="longdesc">
                                                    <?= htmlReady($descriptionlong) ?>
                                                </p>
                                            <? endforeach ?>
                                        <? endif ?>
                                        <? if (!isset($info['descriptionlong']) && isset($info['summary'])) : ?>
                                            <p class="longdesc">
                                                <? if (isset($info['description'])) : ?>
                                                    <?= htmlReady($info['description']) ?>
                                                <? else: ?>
                                                    <?= _('Keine Beschreibung vorhanden.') ?>
                                                <? endif ?>
                                            </p>
                                        <? endif ?>
                                        <? if (isset($info['homepage'])) : ?>
                                            <p>
                                                <strong><?= _('Weitere Informationen:') ?></strong>
                                                <a href="<?= htmlReady($info['homepage']) ?>">
                                                    <?= htmlReady($info['homepage']) ?>
                                                </a>
                                            </p>
                                        <? endif ?>
                                        <? if (isset($info['helplink'])) : ?>
                                            <a class="helplink" href=" <?= htmlReady($info['helplink']) ?> ">
                                                ...<?= _('mehr') ?>
                                            </a>
                                        <? endif ?>
                                    </div>
                                </div>
                            <? endif ?>
                        </td>
                    </tr>
                <? endforeach ?>
            <? endforeach ?>
        </tbody>
        <tfoot>
            <tr class="hidden-js">
                <td colspan="3">
                    <?= Button::create(_('An- / Ausschalten'), 'uebernehmen') ?>
                </td>
            </tr>
        </tfoot>
    </table>
</form>