Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101887497
PhabricatorCountdown.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
Fri, Feb 14, 18:43
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Feb 16, 18:43 (2 d)
Engine
blob
Format
Raw Data
Handle
24247624
Attached To
rPH Phabricator
PhabricatorCountdown.php
View Options
<?php
final
class
PhabricatorCountdown
extends
PhabricatorCountdownDAO
implements
PhabricatorPolicyInterface
{
protected
$title
;
protected
$authorPHID
;
protected
$epoch
;
protected
$viewPolicy
;
public
static
function
initializeNewCountdown
(
PhabricatorUser
$actor
)
{
$app
=
id
(
new
PhabricatorApplicationQuery
())
->
setViewer
(
$actor
)
->
withClasses
(
array
(
'PhabricatorApplicationCountdown'
))
->
executeOne
();
$view_policy
=
$app
->
getPolicy
(
PhabricatorCountdownCapabilityDefaultView
::
CAPABILITY
);
return
id
(
new
PhabricatorCountdown
())
->
setAuthorPHID
(
$actor
->
getPHID
())
->
setViewPolicy
(
$view_policy
)
->
setEpoch
(
PhabricatorTime
::
getNow
());
}
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_AUX_PHID
=>
true
,
)
+
parent
::
getConfiguration
();
}
public
function
generatePHID
()
{
return
PhabricatorPHID
::
generateNewPHID
(
PhabricatorCountdownPHIDTypeCountdown
::
TYPECONST
);
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
);
}
public
function
getPolicy
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
$this
->
getViewPolicy
();
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
PhabricatorPolicies
::
POLICY_NOONE
;
}
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
return
(
$viewer
->
getPHID
()
==
$this
->
getAuthorPHID
());
}
public
function
describeAutomaticCapability
(
$capability
)
{
return
pht
(
'The author of a countdown can always view and edit it.'
);
}
}
Event Timeline
Log In to Comment