<?php
$this->htmlElement('body')->appendAttribute('class', 'media show');
$escape = $this->plugin('escapeHtml');
?>

<?php echo $this->pageTitle(sprintf($this->translate('Media: “%s”'), $media->displayTitle())); ?>


<div id="page-actions">
    <?php echo $media->link($this->translate('Edit media'), 'edit', ['class' => 'button']); ?>
</div>


<div id="item-metadata" class="active section">
    <?php echo $media->render(); ?>
    <?php if ( $media->resourceClass()): ?>
        <div class="meta-group">
            <h4><?php echo $this->translate('Class'); ?></h4>
            <div class="value"><?php echo $media->resourceClass()->label(); ?></div>
        </div>
    <?php endif; ?>
    <?php echo $media->displayValues(); ?>
</div>

<div class="sidebar active">
    <div class="meta-group">
        <h4><?php echo $this->translate('Visibility'); ?></h4>
        <div class="value"><?php echo ($media->isPublic()) ? $this->translate('Public') : $this->translate('Private'); ?></div>
    </div>
    <div class="meta-group">
        <h4><?php echo $this->translate('Part of Item'); ?></h4>
        <?php $mediaItem = $media->item(); ?>
        <div class="value"><?php echo $mediaItem->link($mediaItem->displayTitle()); ?></div>
    </div>
    <div class="meta-group">
        <h4><?php echo $this->translate('Date Created'); ?></h4>
        <div class="value"><?php echo $escape($this->i18n()->dateFormat($media->created())); ?></div>
    </div>
    <?php if ($media->mediaType()): ?>
    <div class="meta-group">
        <h4><?php echo $this->translate('MIME Type'); ?></h4>
        <div class="value"><?php echo $escape($media->mediaType()); ?></div>
    </div>
    <?php endif; ?>
    <div class="meta-group">
        <h4><?php echo $this->translate('Ingester'); ?></h4>
        <div class="value"><?php echo $escape($this->translate($media->ingesterLabel())); ?></div>
    </div>
    <?php if ($media->source()): ?>
    <div class="meta-group">
        <h4><?php echo $this->translate('Source'); ?></h4>
        <div class="value"><?php echo $escape($media->source()); ?></div>
    </div>
    <?php endif; ?>
    <?php if ($media->hasThumbnails() || $media->hasOriginal()): ?>
    <div class="meta-group">
        <h4>File Derivatives</h4>
        <?php if ($media->hasOriginal()): ?>
            <div class="value"><a href="<?php echo $escape($media->originalUrl()); ?>">original</a></div>
        <?php endif; ?>
        <?php if ($media->hasThumbnails()): ?>
            <div class="value"><a href="<?php echo $escape($media->thumbnailUrl('large')); ?>"><?php echo $this->translate('large'); ?></a></div>
            <div class="value"><a href="<?php echo $escape($media->thumbnailUrl('medium')); ?>"><?php echo $this->translate('medium'); ?></a></div>
            <div class="value"><a href="<?php echo $escape($media->thumbnailUrl('square')); ?>"><?php echo $this->translate('square'); ?></a></div>
        <?php endif; ?>
    </div>
    <?php endif; ?>
</div>

<?php $this->trigger('view.show.after'); ?>
