l10n->t('Files');
}
public function getIconSvg(): string {
return '';
}
public function getSharedWith(string $teamId): array {
if (!$this->circlesManager) {
return [];
}
$shares = $this->shareByCircleProvider->getSharesToCircle($teamId);
usort($shares, function ($a, $b) {
return (int)($b->getItemType() === 'folder') - (int)($a->getItemType() === 'folder');
});
return array_map(function (ShareWrapper $shareWrapper) {
$isFolder = $shareWrapper->getItemType() === 'folder';
return new TeamResource(
$this,
(string)$shareWrapper->getFileSource(),
basename($shareWrapper->getFileTarget()),
$this->urlGenerator->getAbsoluteURL('/index.php/f/' . $shareWrapper->getFileSource()),
iconSvg: $isFolder ? '' : null,
iconURL: !$isFolder ?
$this->urlGenerator->linkToRouteAbsolute('core.preview.getPreviewByFileId', ['fileId' => $shareWrapper->getFileSource(), 'mimeFallback' => true, ])
: null,
);
}, $shares);
}
public function isSharedWithTeam(string $teamId, string $resourceId): bool {
if (!$this->circlesManager) {
return false;
}
return count(array_filter($this->getSharedWith($teamId), function (TeamResource $resource) use ($resourceId) {
return $resource->getId() === $resourceId;
})) !== 0;
}
public function getTeamsForResource(string $resourceId): array {
if (!$this->circlesManager) {
return [];
}
$shares = $this->shareByCircleProvider->getSharesByFileId((int)$resourceId);
return array_map(function ($share) {
return $share->getSharedWith();
}, $shares);
}
}