aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/_common/_resource_tree_item.php
blob: 204aa2e7930aa89fd7cb496545ef46ad44185e24 (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
<?php
$children = $resource->children;
$has_children = count($children) > 0;
?>
<article class="studip <?= $has_children ? 'toggle' : ''?> <?= $open ? 'open' : ''?>">
    <header>
        <h1>
            <a href="#"><?= htmlReady($resource->getFullName()) ?></a>
        </h1>
        <a href="<?= $resource->getActionLink('show') ?>" data-dialog>
            <?= Icon::create('info-circle') ?>
        </a>
    </header>
    <? if ($has_children) : ?>
        <section>
            <? foreach ($children as $child) : ?>
                <?= $this->render_partial(
                    'resources/_common/_resource_tree_item',
                    [
                        'resource' => $child,
                        'open' => false
                    ]
                ) ?>
            <? endforeach ?>
        </section>
    <? else : ?>
        <section>
            <?= htmlReady($resource->description) ?>
        </section>
    <? endif ?>
</article>