aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/location/index.php
blob: 8e6ef8c7d9e326fa67a2e524501f8679365e0a1b (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
<? if ($location): ?>
    <? if ((string)$location->description !== '') : ?>
        <section class="contentbox">
            <header>
                <h1><?= _('Beschreibung und Hinweise') ?></h1>
            </header>
            <section>
                <?= htmlReady($location->description) ?>
            </section>
        </section>
    <? endif ?>

    <? if (Request::isDialog()) : ?>
        <? if ($geo_coordinates_object instanceof ResourceProperty) : ?>
            <div data-dialog-button>
                <?= \Studip\LinkButton::create(
                    _('Zum Lageplan'),
                    ResourceManager::getMapUrlForResourcePosition($geo_coordinates_object),
                    ['target' => '_blank']
                ) ?>
            </div>
            <? if($location->userHasPermission(User::findCurrent(), 'admin')) : ?>
                <?= \Studip\LinkButton::createEdit(
                    _('Bearbeiten'),
                    $location->getActionURL('edit'),
                    [
                        'data-dialog' => 'size=auto'
                    ]
                ) ?>
            <? endif ?>
        <? endif ?>
    <? endif ?>
    <? $property_groups = $location->getGroupedProperties($other_properties) ?>
    <? if (count($property_groups)): ?>
        <?= $this->render_partial(
            'resources/resource/_standard_properties_display_part.php',
            [
                'property_groups' => $property_groups
            ]
        ) ?>
    <? endif ?>

    <? $resource_folder = $location->getFolder(); ?>
    <? if ($resource_folder && $resource_folder->getFiles()): ?>
        <section class="contentbox">
            <header>
                <h1><?= _('Dateien') ?></h1>
            </header>
            <table class="default sortable-table" data-sortlist="[[2, 0]]">
                <?= $this->render_partial('files/_files_thead') ?>
                <? foreach ($resource_folder->getFiles() as $file): ?>
                    <? if ($file->isVisible($GLOBALS['user']->id)) : ?>
                        <?= $this->render_partial(
                            'files/_fileref_tr',
                            [
                                'file' => $file,
                                'current_folder' => $resource_folder,
                                'last_visitdate' => time()
                            ]
                        ) ?>
                    <? endif ?>
                <? endforeach ?>
            </table>
        </section>
    <? endif ?>

    <? if (count($location->children)): ?>
        <section class="contentbox">
            <header>
                <h1><?= _('Gebäude') ?></h1>
            </header>
            <section>
                <ul class="list-unstyled">
                    <? foreach ($location->findChildrenByClassName('Building') as $child): ?>
                        <li>
                            <a href="<?= $controller->link_for('resources/building/index/' . $child->id); ?>"
                                <?= (Request::isDialog()) ? 'data-dialog' : ''; ?>>
                                <?= $child->getIcon('clickable')->asSvg(
                                    ['class' => 'text-bottom']
                                ) ?>
                                <?= htmlReady($child->name); ?>
                            </a>
                        </li>
                    <? endforeach ?>
                </ul>
            </section>
        </section>
    <? endif ?>
<? endif ?>