Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77694800
PhabricatorCalendarEventPHIDType.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
Thu, Aug 15, 22:27
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Aug 17, 22:27 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19906901
Attached To
rPH Phabricator
PhabricatorCalendarEventPHIDType.php
View Options
<?php
final
class
PhabricatorCalendarEventPHIDType
extends
PhabricatorPHIDType
{
const
TYPECONST
=
'CEVT'
;
public
function
getTypeName
()
{
return
pht
(
'Event'
);
}
public
function
newObject
()
{
return
new
PhabricatorCalendarEvent
();
}
public
function
getPHIDTypeApplicationClass
()
{
return
'PhabricatorCalendarApplication'
;
}
protected
function
buildQueryForObjects
(
PhabricatorObjectQuery
$query
,
array
$phids
)
{
return
id
(
new
PhabricatorCalendarEventQuery
())
->
withPHIDs
(
$phids
);
}
public
function
loadHandles
(
PhabricatorHandleQuery
$query
,
array
$handles
,
array
$objects
)
{
foreach
(
$handles
as
$phid
=>
$handle
)
{
$event
=
$objects
[
$phid
];
$monogram
=
$event
->
getMonogram
();
$name
=
$event
->
getName
();
$uri
=
$event
->
getURI
();
$handle
->
setName
(
$name
)
->
setFullName
(
pht
(
'%s: %s'
,
$monogram
,
$name
))
->
setURI
(
$uri
);
if
(
$event
->
getIsCancelled
())
{
$handle
->
setStatus
(
PhabricatorObjectHandle
::
STATUS_CLOSED
);
}
}
}
public
function
canLoadNamedObject
(
$name
)
{
return
preg_match
(
'/^E[1-9]
\d
*$/i'
,
$name
);
}
public
function
loadNamedObjects
(
PhabricatorObjectQuery
$query
,
array
$names
)
{
$id_map
=
array
();
foreach
(
$names
as
$name
)
{
$id
=
(
int
)
substr
(
$name
,
1
);
$id_map
[
$id
][]
=
$name
;
}
$objects
=
id
(
new
PhabricatorCalendarEventQuery
())
->
setViewer
(
$query
->
getViewer
())
->
withIDs
(
array_keys
(
$id_map
))
->
execute
();
$results
=
array
();
foreach
(
$objects
as
$id
=>
$object
)
{
foreach
(
idx
(
$id_map
,
$id
,
array
())
as
$name
)
{
$results
[
$name
]
=
$object
;
}
}
return
$results
;
}
}
Event Timeline
Log In to Comment