2016-09-15 02:16:54 +02:00
|
|
|
<?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();
|
|
|
|
}
|
|
|
|
|
2016-10-06 21:31:57 +02:00
|
|
|
if ($event->isChildEvent()) {
|
|
|
|
$target = $event->getParentEvent();
|
|
|
|
} else {
|
|
|
|
$target = $event;
|
|
|
|
}
|
2016-09-15 02:16:54 +02:00
|
|
|
|
2016-10-06 21:31:57 +02:00
|
|
|
return $this->newICSResponse(
|
|
|
|
$viewer,
|
|
|
|
$target->getICSFileName(),
|
|
|
|
array($target));
|
2016-09-15 02:16:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|