Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96676807
PholioMockArchiveController.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, Dec 29, 18:09
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 31, 18:09 (2 d)
Engine
blob
Format
Raw Data
Handle
23224821
Attached To
rPH Phabricator
PholioMockArchiveController.php
View Options
<?php
final
class
PholioMockArchiveController
extends
PholioController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$mock
=
id
(
new
PholioMockQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$mock
)
{
return
new
Aphront404Response
();
}
$view_uri
=
'/M'
.
$mock
->
getID
();
if
(
$request
->
isFormPost
())
{
if
(
$mock
->
isClosed
())
{
$new_status
=
PholioMock
::
STATUS_OPEN
;
}
else
{
$new_status
=
PholioMock
::
STATUS_CLOSED
;
}
$xactions
=
array
();
$xactions
[]
=
id
(
new
PholioTransaction
())
->
setTransactionType
(
PholioMockStatusTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$new_status
);
id
(
new
PholioMockEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$mock
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$view_uri
);
}
if
(
$mock
->
isClosed
())
{
$title
=
pht
(
'Open Pholio Mock'
);
$body
=
pht
(
'This mock will become open again.'
);
$button
=
pht
(
'Open Mock'
);
}
else
{
$title
=
pht
(
'Close Pholio Mock'
);
$body
=
pht
(
'This mock will be closed.'
);
$button
=
pht
(
'Close Mock'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendChild
(
$body
)
->
addCancelButton
(
$view_uri
)
->
addSubmitButton
(
$button
);
}
}
Event Timeline
Log In to Comment