Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112325344
LegalpadDocumentListController.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
Sat, May 10, 01:22
Size
1 KB
Mime Type
text/x-php
Expires
Mon, May 12, 01:22 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
26062717
Attached To
rPH Phabricator
LegalpadDocumentListController.php
View Options
<?php
/**
* @group legalpad
*/
final
class
LegalpadDocumentListController
extends
LegalpadController
implements
PhabricatorApplicationSearchResultsControllerInterface
{
private
$queryKey
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
queryKey
=
idx
(
$data
,
'queryKey'
);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$controller
=
id
(
new
PhabricatorApplicationSearchController
(
$request
))
->
setQueryKey
(
$this
->
queryKey
)
->
setSearchEngine
(
new
LegalpadDocumentSearchEngine
())
->
setNavigation
(
$this
->
buildSideNav
());
return
$this
->
delegateToController
(
$controller
);
}
public
function
renderResultsList
(
array
$documents
,
PhabricatorSavedQuery
$query
)
{
assert_instances_of
(
$documents
,
'LegalpadDocument'
);
$user
=
$this
->
getRequest
()->
getUser
();
$contributors
=
array_mergev
(
mpull
(
$documents
,
'getContributors'
));
$this
->
loadHandles
(
$contributors
);
$list
=
new
PhabricatorObjectItemListView
();
$list
->
setUser
(
$user
);
foreach
(
$documents
as
$document
)
{
$document_body
=
$document
->
getDocumentBody
();
$last_updated
=
phabricator_date
(
$document
->
getDateModified
(),
$user
);
$updater
=
$this
->
getHandle
(
$document_body
->
getCreatorPHID
())->
renderLink
();
$title
=
$document_body
->
getTitle
();
$item
=
id
(
new
PhabricatorObjectItemView
())
->
setObjectName
(
'L'
.
$document
->
getID
())
->
setHeader
(
$title
)
->
setHref
(
$this
->
getApplicationURI
(
'view/'
.
$document
->
getID
()))
->
setObject
(
$document
)
->
addIcon
(
'none'
,
pht
(
'Last updated: %s'
,
$last_updated
))
->
addByline
(
pht
(
'Updated by: %s'
,
$updater
))
->
addAttribute
(
pht
(
'Versions: %d'
,
$document
->
getVersions
()));
$list
->
addItem
(
$item
);
}
return
$list
;
}
}
Event Timeline
Log In to Comment