Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120052488
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
Tue, Jul 1, 15:09
Size
3 KB
Mime Type
text/x-php
Expires
Thu, Jul 3, 15:09 (2 d)
Engine
blob
Format
Raw Data
Handle
27105199
Attached To
rPH Phabricator
PhabricatorCountdown.php
View Options
<?php
final
class
PhabricatorCountdown
extends
PhabricatorCountdownDAO
implements
PhabricatorPolicyInterface
,
PhabricatorFlaggableInterface
,
PhabricatorSubscribableInterface
,
PhabricatorApplicationTransactionInterface
,
PhabricatorTokenReceiverInterface
,
PhabricatorSpacesInterface
,
PhabricatorProjectInterface
{
protected
$title
;
protected
$authorPHID
;
protected
$epoch
;
protected
$description
;
protected
$viewPolicy
;
protected
$editPolicy
;
protected
$mailKey
;
protected
$spacePHID
;
public
static
function
initializeNewCountdown
(
PhabricatorUser
$actor
)
{
$app
=
id
(
new
PhabricatorApplicationQuery
())
->
setViewer
(
$actor
)
->
withClasses
(
array
(
'PhabricatorCountdownApplication'
))
->
executeOne
();
$view_policy
=
$app
->
getPolicy
(
PhabricatorCountdownDefaultViewCapability
::
CAPABILITY
);
return
id
(
new
PhabricatorCountdown
())
->
setAuthorPHID
(
$actor
->
getPHID
())
->
setViewPolicy
(
$view_policy
)
->
setEpoch
(
PhabricatorTime
::
getNow
())
->
setSpacePHID
(
$actor
->
getDefaultSpacePHID
());
}
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_AUX_PHID
=>
true
,
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'title'
=>
'text255'
,
'description'
=>
'text'
,
'mailKey'
=>
'bytes20'
,
),
)
+
parent
::
getConfiguration
();
}
public
function
generatePHID
()
{
return
PhabricatorPHID
::
generateNewPHID
(
PhabricatorCountdownCountdownPHIDType
::
TYPECONST
);
}
public
function
getMonogram
()
{
return
'C'
.
$this
->
getID
();
}
public
function
save
()
{
if
(!
$this
->
getMailKey
())
{
$this
->
setMailKey
(
Filesystem
::
readRandomCharacters
(
20
));
}
return
parent
::
save
();
}
/* -( PhabricatorSubscribableInterface )----------------------------------- */
public
function
isAutomaticallySubscribed
(
$phid
)
{
return
(
$phid
==
$this
->
getAuthorPHID
());
}
public
function
shouldShowSubscribersProperty
()
{
return
true
;
}
public
function
shouldAllowSubscription
(
$phid
)
{
return
true
;
}
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public
function
getApplicationTransactionEditor
()
{
return
new
PhabricatorCountdownEditor
();
}
public
function
getApplicationTransactionObject
()
{
return
$this
;
}
public
function
getApplicationTransactionTemplate
()
{
return
new
PhabricatorCountdownTransaction
();
}
public
function
willRenderTimeline
(
PhabricatorApplicationTransactionView
$timeline
,
AphrontRequest
$request
)
{
return
$timeline
;
}
/* -( PhabricatorTokenReceiverInterface )---------------------------------- */
public
function
getUsersToNotifyOfTokenGiven
()
{
return
array
(
$this
->
getAuthorPHID
());
}
/* -( 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
$this
->
getEditPolicy
();
}
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
return
false
;
}
public
function
describeAutomaticCapability
(
$capability
)
{
return
false
;
}
/* -( PhabricatorSpacesInterface )------------------------------------------- */
public
function
getSpacePHID
()
{
return
$this
->
spacePHID
;
}
}
Event Timeline
Log In to Comment