?>
" data-type="<?php 
    echo $file['type'] == 'dir' ? 'dir' : 'file';
    ?>
" data-mime="<?php 
    echo $file['mime'];
    ?>
" data-size='<?php 
    echo $file['size'];
    ?>
'>
				<td class="filename svg" style="background-image:url(<?php 
    if ($file['type'] == 'dir') {
        echo mimetype_icon('dir');
    } else {
        echo mimetype_icon($file['mime']);
    }
    ?>
)">
					<?php 
    if (!isset($_['readonly']) || !$_['readonly']) {
        ?>
<input type="checkbox" /><?php 
    }
    ?>
					<a class="name" href="<?php 
    if ($file['type'] == 'dir') {
        echo $_['baseURL'] . $file['directory'] . '/' . $file['name'];
    } else {
        echo $_['downloadURL'] . urlencode($file['directory']) . '/' . urlencode($file['name']);
    }
/**
 * @brief make OC_Helper::mimetypeIcon available as a simple function
 * Returns the path to the image of this file type.
 * @param $mimetype mimetype
 * @returns link to the image
 */
function mimetype_icon($mimetype)
{
    return \mimetype_icon($mimetype);
}
Esempio n. 3
0
 /**
  * Make OC_Helper::mimetypeIcon available as a simple function
  *
  * @param string $mimetype
  * @return string to the image of this file type.
  * @since 8.0.0
  */
 public static function mimetype_icon($mimetype)
 {
     return \mimetype_icon($mimetype);
 }
Esempio n. 4
0
<?php

// only need filesystem apps
$RUNTIME_APPTYPES = array('filesystem');
// Init owncloud
require_once 'lib/template.php';
OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
// make filelist
$files = array();
foreach (OC_Files::getdirectorycontent($dir, $mimetype) as $i) {
    $i["date"] = OCP\Util::formatDate($i["mtime"]);
    $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir') : \mimetype_icon($i['mimetype']);
    $files[] = $i;
}
OCP\JSON::success(array('data' => $files));