Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F547322
PhabricatorSlowvoteCloseController.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
PhabricatorSlowvoteCloseController.php
View Options
<?php
final
class
PhabricatorSlowvoteCloseController
extends
PhabricatorSlowvoteController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$poll
=
id
(
new
PhabricatorSlowvoteQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$poll
)
{
return
new
Aphront404Response
();
}
$close_uri
=
$poll
->
getURI
();
if
(
$request
->
isFormPost
())
{
if
(
$poll
->
isClosed
())
{
$new_status
=
SlowvotePollStatus
::
STATUS_OPEN
;
}
else
{
$new_status
=
SlowvotePollStatus
::
STATUS_CLOSED
;
}
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorSlowvoteTransaction
())
->
setTransactionType
(
PhabricatorSlowvoteStatusTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$new_status
);
id
(
new
PhabricatorSlowvoteEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$poll
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$close_uri
);
}
if
(
$poll
->
isClosed
())
{
$title
=
pht
(
'Reopen Poll'
);
$content
=
pht
(
'Are you sure you want to reopen the poll?'
);
$submit
=
pht
(
'Reopen'
);
}
else
{
$title
=
pht
(
'Close Poll'
);
$content
=
pht
(
'Are you sure you want to close the poll?'
);
$submit
=
pht
(
'Close'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendChild
(
$content
)
->
addSubmitButton
(
$submit
)
->
addCancelButton
(
$close_uri
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:31 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
122803
Default Alt Text
PhabricatorSlowvoteCloseController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment