Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92461987
PhabricatorBadgesArchiveController.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
Wed, Nov 20, 12:36
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 22, 12:36 (2 d)
Engine
blob
Format
Raw Data
Handle
22444910
Attached To
rPH Phabricator
PhabricatorBadgesArchiveController.php
View Options
<?php
final
class
PhabricatorBadgesArchiveController
extends
PhabricatorBadgesController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$badge
=
id
(
new
PhabricatorBadgesQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$badge
)
{
return
new
Aphront404Response
();
}
$view_uri
=
$this
->
getApplicationURI
(
'view/'
.
$badge
->
getID
().
'/'
);
if
(
$request
->
isFormPost
())
{
if
(
$badge
->
isArchived
())
{
$new_status
=
PhabricatorBadgesBadge
::
STATUS_ACTIVE
;
}
else
{
$new_status
=
PhabricatorBadgesBadge
::
STATUS_ARCHIVED
;
}
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorBadgesTransaction
())
->
setTransactionType
(
PhabricatorBadgesTransaction
::
TYPE_STATUS
)
->
setNewValue
(
$new_status
);
id
(
new
PhabricatorBadgesEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$badge
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$view_uri
);
}
if
(
$badge
->
isArchived
())
{
$title
=
pht
(
'Activate Badge'
);
$body
=
pht
(
'This badge will be re-commissioned into service.'
);
$button
=
pht
(
'Activate Badge'
);
}
else
{
$title
=
pht
(
'Archive Badge'
);
$body
=
pht
(
'This dedicated badge, once a distinguish icon of this install, '
.
'shall be immediately retired from service, but will never far from '
.
'our hearts. Godspeed.'
);
$button
=
pht
(
'Archive Badge'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendChild
(
$body
)
->
addCancelButton
(
$view_uri
)
->
addSubmitButton
(
$button
);
}
}
Event Timeline
Log In to Comment