Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19082522
PhabricatorLegalpadDocumentPHIDType.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorLegalpadDocumentPHIDType.php
View Options
<?php
final
class
PhabricatorLegalpadDocumentPHIDType
extends
PhabricatorPHIDType
{
const
TYPECONST
=
'LEGD'
;
public
function
getTypeName
()
{
return
pht
(
'Legalpad Document'
);
}
public
function
getTypeIcon
()
{
return
'fa-file-text-o'
;
}
public
function
newObject
()
{
return
new
LegalpadDocument
();
}
public
function
getPHIDTypeApplicationClass
()
{
return
'PhabricatorLegalpadApplication'
;
}
protected
function
buildQueryForObjects
(
PhabricatorObjectQuery
$query
,
array
$phids
)
{
return
id
(
new
LegalpadDocumentQuery
())
->
withPHIDs
(
$phids
)
->
needDocumentBodies
(
true
);
}
public
function
loadHandles
(
PhabricatorHandleQuery
$query
,
array
$handles
,
array
$objects
)
{
foreach
(
$handles
as
$phid
=>
$handle
)
{
$document
=
$objects
[
$phid
];
$name
=
$document
->
getDocumentBody
()->
getTitle
();
$handle
->
setName
(
$document
->
getMonogram
().
' '
.
$name
);
$handle
->
setURI
(
'/'
.
$document
->
getMonogram
());
}
}
public
function
canLoadNamedObject
(
$name
)
{
return
preg_match
(
'/^L
\d
*[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
LegalpadDocumentQuery
())
->
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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Dec 4, 11:26 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8232170
Default Alt Text
PhabricatorLegalpadDocumentPHIDType.php (1 KB)
Attached To
Mode
rP Phabricator
Attached
Detach File
Event Timeline
Log In to Comment