aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/building/index.php
blob: cfd874ce94c7932da8cfb4752be9b97030d259a4 (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
<? if ($building): ?>
    <nav class="resource-hierarchy">
        <? if ($building->location): ?>
            <a href="<?= $building->location->getActionLink('show') ?>" <?= (Request::isDialog()) ? 'data-dialog' : ''; ?>>
                <?= htmlReady($building->location->name) ?>
            </a>
            &gt;
        <? endif ?>
        <?= htmlReady($building->name) ?>
    </nav>
    <? if (!empty($building_details)) : ?>
        <dl>
            <? foreach ($building_details as $title => $building_detail) : ?>
                <dt>
                    <?= $title ?>
                </dt>
                <dd>
                    <?= htmlReady($building_detail) ?>
                </dd>
            <? endforeach ?>
        </dl>
    <? endif ?>
    <? if ($building->description): ?>
        <section class="contentbox">
            <header>
                <h1><?= _('Beschreibung und Hinweise') ?></h1>
            </header>
            <section>
                <p class="resource-description-text"><?= htmlReady($building->description) ?></p>
            </section>
        </section>
    <? endif ?>
    <div data-dialog-button>
        <? if (Request::isDialog()) : ?>
            <? if ($geo_coordinates_object instanceof ResourceProperty): ?>
                <?= \Studip\LinkButton::create(
                    _('Zum Lageplan'),
                    ResourceManager::getMapUrlForResourcePosition($geo_coordinates_object),
                    ['target' => '_blank']
                ) ?>
            <? endif ?>
            <? if ($building->userHasPermission($GLOBALS['user']->getAuthenticatedUser(), 'admin')) : ?>
                <?= \Studip\LinkButton::createEdit(
                    _('Bearbeiten'),
                    $building->getActionURL('edit'),
                    [
                        'data-dialog' => 'size=auto'
                    ]
                ) ?>
            <? endif ?>
        <? endif ?>
    </div>
    <?
    $property_groups = $building->getGroupedProperties(
        ['geo_coordinates', 'number', 'address']
    );
    ?>
    <? if (count($property_groups)): ?>
        <?= $this->render_partial(
            'resources/resource/_standard_properties_display_part.php',
            [
                'property_groups' => $property_groups
            ]
        ) ?>
    <? endif ?>

<? endif ?>

<? $resource_folder = $building->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 ($building->children): ?>
    <section class="contentbox">
        <header>
            <h1><?= _('Räume') ?></h1>
        </header>
        <section>
            <ul class="list-unstyled">
                <? foreach ($building->findChildrenByClassName('Room') as $child): ?>
                    <li>
                        <a href="<?= $controller->link_for('resources/room/index/' . $child->id); ?>"
                            <?= (Request::isDialog()) ? 'data-dialog' : ''; ?>>
                            <?= $child->getIcon('clickable')->asSvg(
                                ['class' => 'text-bottom']
                            ) ?>
                            <?= htmlReady($child->name); ?>
                        </a>
                    </li>
                <? endforeach ?>
            </ul>
        </section>
    </section>
<? endif ?>