Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F464735
PhabricatorCalendarEventDragController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorCalendarEventDragController.php
View Options
<?php
final
class
PhabricatorCalendarEventDragController
extends
PhabricatorCalendarController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$event
=
id
(
new
PhabricatorCalendarEventQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$event
)
{
return
new
Aphront404Response
();
}
if
(!
$request
->
validateCSRF
())
{
return
new
Aphront400Response
();
}
if
(
$event
->
getIsAllDay
())
{
return
new
Aphront400Response
();
}
$xactions
=
array
();
$duration
=
$event
->
getDuration
();
$start
=
$request
->
getInt
(
'start'
);
$start_value
=
id
(
AphrontFormDateControlValue
::
newFromEpoch
(
$viewer
,
$start
));
$end
=
$start
+
$duration
;
$end_value
=
id
(
AphrontFormDateControlValue
::
newFromEpoch
(
$viewer
,
$end
));
$xactions
[]
=
id
(
new
PhabricatorCalendarEventTransaction
())
->
setTransactionType
(
PhabricatorCalendarEventStartDateTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$start_value
);
$xactions
[]
=
id
(
new
PhabricatorCalendarEventTransaction
())
->
setTransactionType
(
PhabricatorCalendarEventEndDateTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$end_value
);
$editor
=
id
(
new
PhabricatorCalendarEventEditor
())
->
setActor
(
$viewer
)
->
setContinueOnMissingFields
(
true
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
);
$xactions
=
$editor
->
applyTransactions
(
$event
,
$xactions
);
return
id
(
new
AphrontReloadResponse
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 9:50 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
74205
Default Alt Text
PhabricatorCalendarEventDragController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment