1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 00:02:41 +01:00
phorge-phorge/src/applications/calendar/controller/PhabricatorCalendarEventExportController.php

35 lines
724 B
PHP
Raw Normal View History

<?php
final class PhabricatorCalendarEventExportController
extends PhabricatorCalendarController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$id = $request->getURIData('id');
$event = id(new PhabricatorCalendarEventQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$event) {
return new Aphront404Response();
}
if ($event->isChildEvent()) {
$target = $event->getParentEvent();
} else {
$target = $event;
}
return $this->newICSResponse(
$viewer,
$target->getICSFileName(),
array($target));
}
}