2020-05-16 17:14:17 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace OCA\BigBlueButton\BigBlueButton;
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
use OCP\Files\IRootFolder;
|
|
|
|
use OCP\Files\File;
|
2022-04-15 19:45:27 +02:00
|
|
|
use OCP\Files\Storage\IStorage;
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
class Presentation
|
|
|
|
{
|
2020-05-16 17:14:17 +02:00
|
|
|
private $url;
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
/** @var File*/
|
|
|
|
private $file;
|
2020-05-16 17:14:17 +02:00
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
/** @var IRootFolder */
|
|
|
|
private $userFolder;
|
2022-04-15 19:45:27 +02:00
|
|
|
|
|
|
|
/** @var IStorage */
|
|
|
|
private $storage;
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
public function __construct(string $path, string $userID, IRootFolder $iRootFolder)
|
|
|
|
{
|
|
|
|
$userFolder = $iRootFolder->getUserFolder($userID);
|
|
|
|
$this->file = $userFolder->get($path);
|
|
|
|
$this->storage = $this->file->getStorage();
|
2022-04-15 19:45:27 +02:00
|
|
|
}
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
public function generateUrl(): string
|
|
|
|
{
|
|
|
|
$filePath = $this->file->getInternalPath();
|
|
|
|
[$url] = $this->storage->getDirectDownload($filePath);
|
|
|
|
return $url;
|
2020-05-16 17:14:17 +02:00
|
|
|
}
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
public function getUrl(): string
|
|
|
|
{
|
2020-05-16 17:14:17 +02:00
|
|
|
return $this->url;
|
|
|
|
}
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
public function getFilename(): string
|
|
|
|
{
|
|
|
|
return $this->file->getName();
|
2020-05-16 17:14:17 +02:00
|
|
|
}
|
|
|
|
|
2022-05-10 15:35:59 +02:00
|
|
|
public function isValid(): bool
|
|
|
|
{
|
|
|
|
return !empty($this->file->getContent());
|
2020-05-16 17:14:17 +02:00
|
|
|
}
|
|
|
|
}
|