|
|
|
@ -17,4 +17,33 @@ class Helper |
|
|
|
|
'maxHumanFilesize' => $maxHumanFilesize, |
|
|
|
|
'usedSpacePercent' => (int)$storageInfo['relative']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function determineIcon($file) { |
|
|
|
|
if($file['type'] === 'dir') { |
|
|
|
|
$dir = $file['directory']; |
|
|
|
|
$absPath = \OC\Files\Filesystem::getView()->getAbsolutePath($dir.'/'.$file['name']); |
|
|
|
|
$mount = \OC\Files\Filesystem::getMountManager()->find($absPath); |
|
|
|
|
if (!is_null($mount)) { |
|
|
|
|
$sid = $mount->getStorageId(); |
|
|
|
|
if (!is_null($sid)) { |
|
|
|
|
$sid = explode(':', $sid); |
|
|
|
|
if ($sid[0] === 'shared') { |
|
|
|
|
return \OC_Helper::mimetypeIcon('dir-shared'); |
|
|
|
|
} |
|
|
|
|
if ($sid[0] !== 'local') { |
|
|
|
|
return \OC_Helper::mimetypeIcon('dir-external'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return \OC_Helper::mimetypeIcon('dir'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if($file['isPreviewAvailable']) { |
|
|
|
|
$relativePath = substr($file['path'], 6); |
|
|
|
|
return \OC_Helper::previewIcon($relativePath); |
|
|
|
|
} |
|
|
|
|
return \OC_Helper::mimetypeIcon($file['mimetype']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|