PHP Classes
elePHPant
Icontem

File: src/Cabin/Bridge/View/cargo/bridge_files_info.twig

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  CMS Airship  >  src/Cabin/Bridge/View/cargo/bridge_files_info.twig  >  Download  
File: src/Cabin/Bridge/View/cargo/bridge_files_info.twig
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: CMS Airship
Content management system with security features
Author: By
Last change:
Date: 0 years ago
Size: 2,689 bytes
 

Contents

Class file image Download
<div class="table" id="file_metadata">
    <div class="table-row">
        <div class="table-cell table-label">
            {{ __("Cabin") }}:
        </div>
        <div class="table-cell">
            <a href="{{ cabin_url() ~ path_middle ~ "/" ~ cabin|e('url') }}">{#
                #}{{ cabin }}{#
            #}</a>
        </div>
    </div>
    <div class="table-row">
        <div class="table-cell table-label">
            {{ __("Directory") }}:
        </div>
        <div class="table-cell">
            <a href="{{ cabin_url() ~ path_middle ~ "/" ~ cabin|e('url') ~ "/?dir=" ~ dir|e('url') }}">{#
                #}{{ dir|default('/') }}{#
            #}</a>
        </div>
    </div>
    <div class="table-row">
        <div class="table-cell table-label">
            {{ __("File Name") }}:
        </div>
        <div class="table-cell">
            {% if dir and root_dir %}
                {% set rdir = root_dir ~ "/" ~ dir ~ "/" %}
            {% elseif dir %}
                {% set rdir = dir ~ "/" %}
            {% elseif root_dir %}
                {% set rdir = root_dir ~ "/" %}
            {% else %}
                {% set rdir = "" %}
            {% endif %}
            <a href="{{ cabin_url(cabin) ~ (
                    "files/" ~
                    rdir ~
                    file.filename|e('html_attr')
                ) }}">{#
                #}{{ file.filename }}{#
            #}</a>
        </div>
    </div>
    <div class="table-row">
        <div class="table-cell table-label">
            {{ __("Type") }}:
        </div>
        <div class="table-cell">
            {{ file.type }}
        </div>
    </div>


    <div class="table-row">
        <div class="table-cell table-label">
            {{ __("Size") }}:
        </div>
        <div class="table-cell">
            {% set kilobyte = 1024 %}
            {% set megabyte = kilobyte * 1024 %}
            {% set gigabyte = megabyte * 1024 %}
            {% set terabyte = gigabyte * 1024 %}

            {% if file.size < kilobyte %}
                {{ file.size ~ ' B' }}
            {% elseif file.size < megabyte %}
                {{ (file.size / kilobyte)|number_format(2, '.') ~ ' KiB' }}
            {% elseif file.size < gigabyte %}
                {{ (file.size / megabyte)|number_format(2, '.') ~ ' MiB' }}
            {% elseif file.size < terabyte %}
                {{ (file.size / gigabyte)|number_format(2, '.') ~ ' GiB' }}
            {% else %}
                {{ (file.size / terabyte)|number_format(2, '.') ~ ' TiB' }}
            {% endif %}
        </div>
    </div>
</div>

{% if 'image' in file.type %}
    {% include cargo("bridge_files_info_img") %}
{% endif %}