<?php

/**
 * @copyright 2014-2016 City of Bloomington, Indiana
 * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
 * @param mixed $object
 */
$type = !empty($object['type']) ? $object['type'] : $object['mimeType'];
$attr = ['attributes' => ['class' => ['cmis_object', _cmisro_class_for_type($type)]]];
$cmis_link = user_is_logged_in() ? l('View in Alfresco', "/cmisro/proxy/{$object['id']}") : '';
$size = _cmisro_size_readable($object['filesize']);
$label = "{$object['title']} ({$size})";
echo l($label, _cmisro_document_uri($object['id']), $attr);
echo " {$cmis_link}";
<div class="cmisro">
	<?php 
echo theme('cmisro_breadcrumbs', ['object' => $variables['current_directory']]);
?>
	<table>
	<?php 
global $base_url;
$url = "{$base_url}/cmisro/browser";
$ignore = ['.DS_Store'];
if (isset($variables['listing'])) {
    foreach ($variables['listing'] as $o) {
        if (in_array($o['title'], $ignore)) {
            continue;
        }
        $title = check_plain($o['title']);
        $class = _cmisro_class_for_type($o['type']);
        // Only render links on folders
        //
        // This browser is written to navigate the directory structure.
        // It makes no sense to render a link on a document.
        //
        // However, if this browser is being used as a popup, the user
        // should be able to choose either a folder or a document.
        // We should render buttons on every item.
        $params = '';
        $button = '';
        if (!empty($_GET['popup']) && !empty($_GET['id'])) {
            $params = '&amp;popup=1&amp;id=' . $_GET['id'];
            $button = "\n\t\t\t\t\t<button type=\"button\" onclick=\"CMISRO_BROWSER.handleSelection('{$_GET['id']}', '{$o['id']}');\">\n\t\t\t\t\t\tChoose\n\t\t\t\t\t</button>\n\t\t\t\t\t";
        }
        if ($o['type'] == 'cmis:folder') {