Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106158883
PhabricatorCalendarEventDragController.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
Sun, Mar 23, 05:15
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Mar 25, 05:15 (2 d)
Engine
blob
Format
Raw Data
Handle
25113874
Attached To
rPH Phabricator
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
->
getDateTo
()
-
$event
->
getDateFrom
();
$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
(
PhabricatorCalendarEventTransaction
::
TYPE_START_DATE
)
->
setNewValue
(
$start_value
);
$xactions
[]
=
id
(
new
PhabricatorCalendarEventTransaction
())
->
setTransactionType
(
PhabricatorCalendarEventTransaction
::
TYPE_END_DATE
)
->
setNewValue
(
$end_value
);
$editor
=
id
(
new
PhabricatorCalendarEventEditor
())
->
setActor
(
$viewer
)
->
setContinueOnMissingFields
(
true
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
);
$xactions
=
$editor
->
applyTransactions
(
$event
,
$xactions
);
return
id
(
new
AphrontReloadResponse
());
}
}
Event Timeline
Log In to Comment