aboutsummaryrefslogtreecommitdiff
path: root/app/views/file/choose_destination.php
blob: c71f072b6ce11ed7b7851324cc39f32b1002c85d (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
<?php
$options = array_filter([
    'from_plugin'   => Request::get('from_plugin'),
    'to_folder_id'  => Request::get('to_folder_id'),
    'copymode'      => Request::get('copymode', $copymode),
    'isfolder'      => Request::get('isfolder', $is_folder),
    'fileref_id'    => Request::getArray('fileref_id') ?: $fileref_id,
    'ids'           => Request::getArray('ids'),
    'direct_parent' => true,
], function ($value) {
    return $value !== null;
});
?>

<form action="#" method="post" class="files_source_selector" data-dialog <? if ($hidden) echo ' style="display: none;"'; ?>>
    <input type="hidden" name="webkitbugfix" value="1">
<? foreach ($options as $key => $value): ?>
    <?= addHiddenFields($key, $value) ?>
<? endforeach; ?>

<? if ($options['copymode'] === 'move') : ?>
    <?= _('Ziel zum Verschieben auswählen') ?>
<? elseif ($options['copymode'] === 'copy') : ?>
    <?= _('Ziel zum Kopieren auswählen') ?>
<? elseif ($options['copymode'] === 'upload') : ?>
    <?= _('Wohin soll hochgeladen werden?') ?>
<? endif ?>

    <div class="file_select_possibilities">
        <div>
        <? if (isset($parent_folder) && ($parent_folder->isWritable($GLOBALS['user']->id) || count($parent_folder->getSubfolders()))): ?>
            <div class="clickable">
                <?= Icon::create('folder-parent', Icon::ROLE_CLICKABLE)->asInput(50, ['formaction' => $controller->action_url('choose_folder/' . $parent_folder->getId()), 'to_plugin' => $options['from_plugin'] ?? null]) ?>
                <button
                    class="undecorated"
                    formaction="<?= $controller->action_link('choose_folder/' . $parent_folder->getId()) ?>" <? if (!empty($options['from_plugin'])): ?> name="to_plugin" value="<?= htmlReady($options['from_plugin']) ?>"<? endif; ?>
                    data-dialog="size=medium">
                    <?= _('Aktueller Ordner') ?>
                </button>
            </div>
        <? endif ?>
            <div class="clickable">
                <?= Icon::create('files')->asInput(50, ['formaction' => $controller->action_url('choose_folder/' . Folder::findTopFolder($GLOBALS['user']->id)->getId())]) ?>
                <button
                    class="undecorated"
                    formaction="<?= $controller->action_link('choose_folder/' . Folder::findTopFolder($GLOBALS['user']->id)->getId()) ?>" data-dialog="size=medium">
                    <?= _('Persönlicher Dateibereich') ?>
                </button>
            </div>

            <div class="clickable">
                <?= Icon::create('seminar')->asinput(50, ['formaction' => $controller->action_url('choose_folder_from_course')]) ?>
                <button class="undecorated"
                        formaction="<?= $controller->action_link('choose_folder_from_course') ?>" data-dialog="size=medium">
                    <?= _('Meine Veranstaltungen') ?>
                </button>
            </div>

            <div class="clickable">
                <?= Icon::create('institute')->asInput(50, ['formaction' => $controller->action_url('choose_folder_from_institute')]) ?>
                <button class="undecorated"
                        formaction="<?= $controller->action_link('choose_folder_from_institute') ?>" data-dialog="size=medium">
                    <?= _('Meine Einrichtungen') ?>
                </button>
            </div>

        <? foreach (PluginManager::getInstance()->getPlugins(FilesystemPlugin::class) as $plugin) : ?>
            <? if ($plugin->isPersonalFileArea()) : ?>
                <? $nav = $plugin->getFileSelectNavigation() ?>
                <? if ($nav) : ?>
                    <div class="clickable">
                        <?= $nav->getImage()->asInput(50, ['formaction' => $controller->action_url('choose_folder'), 'name' => 'to_plugin', 'value' => get_class($plugin)]) ?>
                        <button formaction="<?= $controller->action_link('choose_folder') ?>"
                                type="submit"
                                class="undecorated"
                                name="to_plugin"
                                value="<?= htmlReady(get_class($plugin)) ?>">
                            <?= htmlReady($nav->getTitle()) ?>
                        </button>
                    </div>
                <? endif ?>
            <? endif ?>
        <? endforeach ?>
        </div>
    </div>


<? if (!Request::isDialog()) : ?>
    <?
        if ($parent_folder) {
            $cancelUrl = (in_array($parent_folder->range_type,  ['course', 'institute']) ? $parent_folder->range_type . '/' : '') . 'files/index/' . $parent_folder->getId();
        } else {
            $cancelUrl = 'files_dashboard';
        }
    ?>

    <div>
        <?= Studip\LinkButton::createCancel(_('Abbrechen'), $controller->url_for($cancelUrl)) ?>
    </div>
<? endif ?>
</form>