aboutsummaryrefslogtreecommitdiff
path: root/app/views/files/_fileref_tr.php
blob: a7c1156b58185320aa8a5f352e7fa66aec258279 (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
<?php
$permissions = [];
if ($file->isEditable($GLOBALS['user']->id)) {
    $permissions[] = 'w';
}
if ($file->isDownloadable($GLOBALS['user']->id)) {
    $permissions[] = 'dr';
}
?>
<tr class="<? if ($file->getLastChangeDate() > $last_visitdate && ($file->getUserId() !== $GLOBALS['user']->id)) echo 'new'; ?>"
    <?= !empty($table_id) ? 'id="' . htmlReady("fileref_{$table_id}_{$file->getId()}") . '"' : '' ?>
    role="row"
    data-permissions="<?= implode($permissions) ?>">
    <? if (!empty($show_bulk_checkboxes)) : ?>
        <td>
            <? if ($file->isDownloadable($GLOBALS['user']->id)) : ?>
                <input type="checkbox"
                       name="ids[]"
                       value="<?= htmlReady($file->getId()) ?>"
                       <?= in_array($file->getId(), (array) ($marked_element_ids ?? [])) ? 'checked' : '' ?>>
            <? endif ?>
        </td>
    <? endif ?>
    <td class="file-icon" data-sort-value="<?= crc32($file->getMimeType()) ?>">
        <? if ($file->isDownloadable($GLOBALS['user']->id)) : ?>
            <a href="<?= htmlReady($file->getDownloadURL()) ?>" target="_blank" rel="noopener noreferrer">
                <?= $file->getIcon(Icon::ROLE_CLICKABLE)->asSvg(24) ?>
            </a>
        <? else : ?>
            <?= $file->getIcon(Icon::ROLE_INACTIVE)->asSvg(24, ['class' => 'icon-inactive']) ?>
        <? endif ?>
    </td>
    <td data-sort-value="<?= htmlReady($file->getFilename()) ?>">
        <? if ($file->isDownloadable($GLOBALS['user']->id)) : ?>
            <a href="<?= $controller->link_for("file/details/{$file->getId()}", ['file_navigation' => '1']) ?>" data-dialog>
                <?= htmlReady($file->getFilename()) ?>
            </a>
        <? else : ?>
            <?= htmlReady($file->getFilename()) ?>
        <? endif ?>

        <?php $terms = $file->getTermsOfUse() ?>
        <? if ($terms && !empty($topFolder) && !$terms->isDownloadable($topFolder->range_id, $topFolder->range_type, false)) : ?>
            <?= Icon::create('lock-locked', Icon::ROLE_INFO)->asSvg(['title' => _('Das Herunterladen dieser Datei ist nur eingeschränkt möglich.')]) ?>
        <? endif ?>
    </td>
    <? $size = $file->getSize() ?>
    <td title="<?= number_format($size, 0, ',', '.') . ' Byte' ?>" data-sort-value="<?= htmlReady($size) ?>" class="responsive-hidden">
    <? if ($size !== null) : ?>
        <?= relSize($size, false) ?>
    <? endif ?>
    </td>
    <? if (!empty($show_downloads)) : ?>
        <? $downloads = $file->getDownloads() ?>
        <td data-sort-value="<?= htmlReady($downloads) ?>" class="responsive-hidden">
            <?= htmlReady($downloads) ?>
        </td>
    <? endif ?>
    <? $author_name = $file->getUserName() ?>
    <td data-sort-value="<?= htmlReady($author_name) ?>" class="responsive-hidden">
    <? if ($file->getUser() && $file->getUser()->id !== $GLOBALS['user']->id) : ?>
        <a href="<?= URLHelper::getLink('dispatch.php/profile?username=' . $file->getUser()->username) ?>">
            <?= htmlReady($author_name) ?>
        </a>
    <? else: ?>
        <?= htmlReady($author_name) ?>
    <? endif; ?>
    </td>
    <? $chdate = $file->getLastChangeDate() ?>
    <td title="<?= strftime('%x %X', $chdate) ?>" data-sort-value="<?= htmlReady($chdate) ?>" class="responsive-hidden">
        <?= $chdate ? reltime($chdate) : "" ?>
    </td>
    <? foreach ($current_folder->getAdditionalColumns() as $index => $column_name) : ?>
        <td class="responsive-hidden"
            data-sort-value="<?= htmlReady($file->getAdditionalColumnOrderWeigh($index)) ?>">
        <? $content = $file->getContentForAdditionalColumn($index) ?>
        <? if ($content) : ?>
            <?= $content instanceof Flexi\Template ? $content->render() : $content ?>
        <? endif ?>
        </td>
    <? endforeach ?>
    <td class="actions">
        <?
        $actionMenu = $file->getActionMenu();
        if ($actionMenu) {
            echo $actionMenu->render();
        }
        ?>
    </td>
</tr>