Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93916822
PhrequentUserTime.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
Mon, Dec 2, 12:11
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 12:11 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22724190
Attached To
rPH Phabricator
PhrequentUserTime.php
View Options
<?php
final
class
PhrequentUserTime
extends
PhrequentDAO
implements
PhabricatorPolicyInterface
{
protected
$userPHID
;
protected
$objectPHID
;
protected
$note
;
protected
$dateStarted
;
protected
$dateEnded
;
private
$preemptingEvents
=
self
::
ATTACHABLE
;
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'objectPHID'
=>
'phid?'
,
'note'
=>
'text?'
,
'dateStarted'
=>
'epoch'
,
'dateEnded'
=>
'epoch?'
,
),
)
+
parent
::
getConfiguration
();
}
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
);
}
public
function
getPolicy
(
$capability
)
{
$policy
=
PhabricatorPolicies
::
POLICY_NOONE
;
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
// Since it's impossible to perform any meaningful computations with
// time if a user can't view some of it, visibility on tracked time is
// unrestricted. If we eventually lock it down, it should be per-user.
// (This doesn't mean that users can see tracked objects.)
return
PhabricatorPolicies
::
getMostOpenPolicy
();
}
return
$policy
;
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
return
(
$viewer
->
getPHID
()
==
$this
->
getUserPHID
());
}
public
function
describeAutomaticCapability
(
$capability
)
{
return
null
;
}
public
function
attachPreemptingEvents
(
array
$events
)
{
$this
->
preemptingEvents
=
$events
;
return
$this
;
}
public
function
getPreemptingEvents
()
{
return
$this
->
assertAttached
(
$this
->
preemptingEvents
);
}
public
function
isPreempted
()
{
if
(
$this
->
getDateEnded
()
!==
null
)
{
return
false
;
}
foreach
(
$this
->
getPreemptingEvents
()
as
$event
)
{
if
(
$event
->
getDateEnded
()
===
null
&&
$event
->
getObjectPHID
()
!=
$this
->
getObjectPHID
())
{
return
true
;
}
}
return
false
;
}
}
Event Timeline
Log In to Comment