Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97250204
PhabricatorCalendarEventExportController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 3, 19:17
Size
1007 B
Mime Type
text/x-php
Expires
Sun, Jan 5, 19:17 (2 d)
Engine
blob
Format
Raw Data
Handle
23364628
Attached To
rPH Phabricator
PhabricatorCalendarEventExportController.php
View Options
<?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
();
}
$file_name
=
$event
->
getICSFilename
();
$event_node
=
$event
->
newIntermediateEventNode
(
$viewer
);
$document_node
=
id
(
new
PhutilCalendarDocumentNode
())
->
appendChild
(
$event_node
);
$root_node
=
id
(
new
PhutilCalendarRootNode
())
->
appendChild
(
$document_node
);
$ics_data
=
id
(
new
PhutilICSWriter
())
->
writeICSDocument
(
$root_node
);
return
id
(
new
AphrontFileResponse
())
->
setDownload
(
$file_name
)
->
setMimeType
(
'text/calendar'
)
->
setContent
(
$ics_data
);
}
}
Event Timeline
Log In to Comment