2022-08-13 01:58:37 +00:00
|
|
|
<?php
|
2022-08-18 18:27:25 +00:00
|
|
|
namespace OCA\Memories\Controller;
|
2022-08-13 01:58:37 +00:00
|
|
|
|
|
|
|
use OCP\IRequest;
|
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
2022-08-15 21:41:05 +00:00
|
|
|
use OCA\Viewer\Event\LoadViewer;
|
2022-08-13 01:58:37 +00:00
|
|
|
use OCP\AppFramework\Controller;
|
2022-08-15 21:41:05 +00:00
|
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
2022-08-14 20:54:18 +00:00
|
|
|
use OCP\Util;
|
2022-08-13 01:58:37 +00:00
|
|
|
|
|
|
|
class PageController extends Controller {
|
2022-08-15 21:41:05 +00:00
|
|
|
protected string $userId;
|
2022-08-14 20:54:18 +00:00
|
|
|
protected $appName;
|
2022-08-15 21:41:05 +00:00
|
|
|
protected IEventDispatcher $eventDispatcher;
|
2022-08-13 01:58:37 +00:00
|
|
|
|
2022-08-15 21:41:05 +00:00
|
|
|
public function __construct(
|
|
|
|
string $AppName,
|
|
|
|
IRequest $request,
|
|
|
|
string $UserId,
|
|
|
|
IEventDispatcher $eventDispatcher,
|
|
|
|
){
|
2022-08-13 01:58:37 +00:00
|
|
|
parent::__construct($AppName, $request);
|
|
|
|
$this->userId = $UserId;
|
2022-08-14 20:54:18 +00:00
|
|
|
$this->appName = $AppName;
|
2022-08-15 21:41:05 +00:00
|
|
|
$this->eventDispatcher = $eventDispatcher;
|
2022-08-13 01:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @NoAdminRequired
|
|
|
|
* @NoCSRFRequired
|
|
|
|
*/
|
2022-08-17 20:59:26 +00:00
|
|
|
public function main() {
|
2022-08-18 18:27:25 +00:00
|
|
|
Util::addScript($this->appName, 'memories-main');
|
2022-08-18 18:49:53 +00:00
|
|
|
Util::addStyle($this->appName, 'custom-icons');
|
2022-08-14 20:54:18 +00:00
|
|
|
|
2022-08-15 21:41:05 +00:00
|
|
|
$this->eventDispatcher->dispatchTyped(new LoadViewer());
|
|
|
|
|
2022-08-14 20:54:18 +00:00
|
|
|
$response = new TemplateResponse($this->appName, 'main');
|
|
|
|
return $response;
|
2022-08-13 01:58:37 +00:00
|
|
|
}
|
|
|
|
|
2022-08-17 20:59:26 +00:00
|
|
|
/**
|
|
|
|
* @NoAdminRequired
|
|
|
|
* @NoCSRFRequired
|
|
|
|
*/
|
|
|
|
public function album() {
|
|
|
|
return $this->main();
|
|
|
|
}
|
2022-08-13 01:58:37 +00:00
|
|
|
}
|