aboutsummaryrefslogtreecommitdiff
path: root/app/views/file/choose_folder_from_institute.php
blob: 9a9298d0e6c63ecf175a7a78b1745df0522a19e2 (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
<?php
$options = array_filter([
    'to_plugin'   => Request::get('to_plugin'),
    'from_plugin' => Request::get('from_plugin'),
    'range_type'  => Request::get('range_type'),
    'fileref_id'  => Request::getArray('fileref_id'),
    'isfolder'    => Request::get('isfolder'),
    'copymode'    => Request::get('copymode'),
], function ($value) {
    return $value !== null;
});
?>

<? if ($GLOBALS['perm']->have_perm("admin")) : ?>
<form id="folderchooser_institute_search" method="post"
      action="<?= $controller->action_link('choose_folder_from_institute') ?>"
      data-dialog>
    <?= QuickSearch::get('Institut_id', $instsearch)
        ->fireJSFunctionOnSelect("function () { jQuery('#folderchooser_institute_search').submit(); }")
        ->setInputStyle('width: calc(100% - 40px); margin: 20px;')
        ->render()
    ?>
<? else : ?>
<form action="#" method="post" data-dialog>
    <table class="default sortable-table">
        <thead>
            <tr>
                <th><?= _('Bild') ?></th>
                <th data-sort="text"><?= _('Name') ?></th>
            </tr>
        </thead>
        <tbody>
        <? foreach (Institute::getMyInstitutes($GLOBALS['user']->id) as $institut) : ?>
            <tr>
                <td data-sort-value="<?= htmlReady($institut['Name']) ?>">
                    <input type="image" class="undecorated"
                           style="width: 20px; height: 20px;"
                           formaction="<?= $controller->link_for('file/choose_folder_from_institute') ?>"
                           name="Institut_id"
                           value="<?= htmlReady($institut['Institut_id']) ?>"
                           src="<?= htmlReady(
                                InstituteAvatar::getAvatar($institut['Institut_id'])->getUrl(Avatar::MEDIUM)
                                ) ?>">
                </td>
                <td>
                    <button formaction="<?= $controller->link_for('file/choose_folder_from_institute') ?>"
                            name="Institut_id"
                            value="<?= htmlReady($institut['Institut_id']) ?>"
                            class="undecorated">
                        <?= htmlReady($institut['Name']) ?>
                    </button>
                </td>
            </tr>
        <? endforeach; ?>
        </tbody>
    </table>
<? endif; ?>

<? foreach ($options as $key => $value): ?>
    <?= addHiddenFields($key, $value) ?>
<? endforeach; ?>

    <footer data-dialog-button>
        <!-- neu -->
        <?= Studip\Button::create(_('Zurück'), [
            'formaction'  => $controller->action_url('choose_destination/' . $options['copymode']),
            'data-dialog' => 'size=auto',
        ]) ?>
    </footer>
</form>

<script>
jQuery(function () {
    $('#folderchooser_institute_search select option').on('click', function () {
    	$('#folderchooser_institute_search').submit();
    });
});
</script>