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

<?php echo $this->pageTitle(sprintf($this->translate('Properties in “%s”'), $vocabulary->label())); ?>

<p><?php echo $escape($this->translate($vocabulary->comment())); ?></p>
<p><strong><?php echo $this->translate('Prefix:'); ?></strong> <?php echo $escape($vocabulary->prefix()); ?><br>
<strong><?php echo $this->translate('Namespace URI:'); ?></strong> <?php echo $escape($vocabulary->namespaceUri()); ?></p>

<?php if (count($properties)): ?>

<?php echo $this->pagination(); ?>

<table>
    <thead>
        <tr>
            <th><?php echo $this->sortLink($this->translate('Label'), 'label'); ?></th>
            <th><?php echo $this->sortLink($this->translate('Term'), 'local_name'); ?></th>
            <th><?php echo $this->sortLink($this->translate('Items'), 'item_count'); ?></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($properties as $property): ?>
        <tr>
            <td>
                <span class="resource-name">
                    <?php echo $escape($this->translate($property->label())); ?>
                </span>
                <ul class="actions">
                    <li><a href="#"
                        data-sidebar-content-url="<?php echo $escape($property->url('show-details')); ?>"
                        class="o-icon-more sidebar-content"
                        aria-label="<?php echo $escape($this->translate('Details')); ?>"
                        title="<?php echo $escape($this->translate('Details')); ?>"></a>
                    </li>
                </ul>
            </td>
            <td><?php echo $escape($this->translate($property->term())); ?></td>
            <td><?php echo $this->hyperlink($property->itemCount(), $this->url('admin/default', ['controller' => 'item', 'action' => 'browse'], ['query' => ["has_property[{$property->id()}]" => 1]])); ?></td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>

<?php echo $this->pagination(); ?>

<div class="sidebar">
    <a href="#"
        class="sidebar-close o-icon-close"
        aria-label="<?php echo $escape($this->translate('Close')); ?>"
        title="<?php echo $escape($this->translate('Close')); ?>"></a>
    <div class="sidebar-content"></div>
</div>

<?php else: ?>

<div class="no-resources">
    <p><?php echo $this->translate('This vocabulary has no properties.'); ?></p>
</div>

<?php endif; ?>
