Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121866408
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
Mon, Jul 14, 11:31
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Jul 16, 11:31 (2 d)
Engine
blob
Format
Raw Data
Handle
27387438
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
,
'getRecentContributorPHIDs'
));
$this
->
loadHandles
(
$contributors
);
$list
=
new
PhabricatorObjectItemListView
();
$list
->
setUser
(
$user
);
foreach
(
$documents
as
$document
)
{
$last_updated
=
phabricator_date
(
$document
->
getDateModified
(),
$user
);
$recent_contributors
=
$document
->
getRecentContributorPHIDs
();
$updater
=
$this
->
getHandle
(
reset
(
$recent_contributors
))->
renderLink
();
$title
=
$document
->
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