aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/resource/files.php
blob: fc46b92e1e5ae281e253bda1752244a01d4d7ae3 (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
<? if ($folder): ?>
    <form method="post" action="<?= $controller->link_for('file/bulk/' . $folder->getId()) ?>">
        <?= CSRFProtection::tokenTag() ?>
        <input type="hidden" name="parent_folder_id" value="<?= $folder->getId() ?>">
        <table class="default documents sortable-table" data-sortlist="[[2, 0]]" data-folder_id="<?= $folder->getId() ?>">
            <caption>
                <a href="<?= $controller->url_for('resources/resource/files/' . $resource->id)?>"
                   title="<?= _('Zum Hauptordner') ?>">
                    <?= Icon::create('folder-home-full', 'clickable')->asImg(30, ['class' => 'text-bottom']) ?>
                </a>
                <?= htmlReady($resource->getFullName()) ?></caption>
            <?= $this->render_partial('files/_files_thead') ?>
            <tbody>
                <? if (count($folder_files)): ?>
                    <? foreach($folder_files as $file): ?>
                        <? if ($file->isVisible($GLOBALS['user']->id)) : ?>
                            <?= $this->render_partial(
                                'files/_fileref_tr',
                                [
                                    'file'           => $file,
                                    'current_folder' => $folder,
                                    'controllerpath' => 'resources/resource/files',
                                    'last_visitdate' => $last_visitdate
                                ]
                            ) ?>
                        <? endif ?>
                    <? endforeach ?>
                <? else: ?>
                    <tr class="empty">
                        <td colspan="7">
                            <?= _('Dieser Ordner ist leer') ?>
                        </td>
                    </tr>
                <? endif ?>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="7">
                        <span class="multibuttons">
                            <?= Studip\Button::create(
                                _('Herunterladen'),
                                'download'
                            ) ?>
                            <? if ($folder->isWritable($GLOBALS['user']->id)): ?>
                                <?= Studip\Button::create(
                                    _('Verschieben'),
                                    'move',
                                    [
                                        'data-dialog' => '',
                                        'disabled' => 'disabled'
                                    ]
                                ) ?>
                            <? endif ?>
                            <? if ($folder->isReadable($GLOBALS['user']->id)): ?>
                                <?= Studip\Button::create(
                                    _('Kopieren'),
                                    'copy',
                                    [
                                        'data-dialog' => '',
                                        'disabled'    => '',
                                    ]
                                ) ?>
                            <? endif ?>
                            <? if ($folder->isWritable($GLOBALS['user']->id)): ?>
                                <?= Studip\Button::create(
                                    _('Löschen'),
                                    'delete', [
                                        'disabled'     => '',
                                        'data-confirm' => _('Soll die Auswahl wirklich gelöscht werden?')
                                    ]
                                ) ?>
                            <? endif ?>
                        </span>
                        <? if ($folder->isWritable($GLOBALS['user']->id)): ?>
                            <?= Studip\LinkButton::create(
                                _('Dokument hinzufügen'),
                                '#',
                                [
                                    'onclick' => 'STUDIP.Files.openAddFilesWindow(); return false;'
                                ]
                            ) ?>
                        <? endif ?>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form>
    <? if ($GLOBALS['user']->id !== 'nobody'): ?>
        <?= $this->render_partial('file/upload_window.php') ?>
        <?= $this->render_partial(
            'file/add_files_window.php',
            [
                'folder_id' => $folder->getId(),
                'hidden'    => true,
                'upload_type' => FileManager::getUploadTypeConfig(
                    $folder->range_id,
                    $GLOBALS['user']->id
                )
            ]
        ) ?>
    <? endif ?>
<? endif ?>