Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80369165
PholioMockListController.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, Aug 31, 09:23
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Sep 2, 09:23 (2 d)
Engine
blob
Format
Raw Data
Handle
20354082
Attached To
rPH Phabricator
PholioMockListController.php
View Options
<?php
final
class
PholioMockListController
extends
PholioController
implements
PhabricatorApplicationSearchResultsControllerInterface
{
private
$queryKey
;
public
function
shouldAllowPublic
()
{
return
true
;
}
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
PholioMockSearchEngine
())
->
setNavigation
(
$this
->
buildSideNavView
());
return
$this
->
delegateToController
(
$controller
);
}
public
function
renderResultsList
(
array
$mocks
,
PhabricatorSavedQuery
$query
)
{
assert_instances_of
(
$mocks
,
'PholioMock'
);
$viewer
=
$this
->
getRequest
()->
getUser
();
$author_phids
=
array
();
foreach
(
$mocks
as
$mock
)
{
$author_phids
[]
=
$mock
->
getAuthorPHID
();
}
$this
->
loadHandles
(
$author_phids
);
$board
=
new
PHUIPinboardView
();
foreach
(
$mocks
as
$mock
)
{
$item
=
id
(
new
PHUIPinboardItemView
())
->
setHeader
(
'M'
.
$mock
->
getID
().
' '
.
$mock
->
getName
())
->
setURI
(
'/M'
.
$mock
->
getID
())
->
setImageURI
(
$mock
->
getCoverFile
()->
getThumb280x210URI
())
->
setImageSize
(
280
,
210
)
->
addIconCount
(
'image'
,
count
(
$mock
->
getImages
()))
->
addIconCount
(
'like'
,
$mock
->
getTokenCount
());
if
(
$mock
->
getAuthorPHID
())
{
$author_handle
=
$this
->
getHandle
(
$mock
->
getAuthorPHID
());
$datetime
=
phabricator_date
(
$mock
->
getDateCreated
(),
$viewer
);
$item
->
appendChild
(
pht
(
'By %s on %s'
,
$author_handle
->
renderLink
(),
$datetime
));
}
$board
->
addItem
(
$item
);
}
return
$board
;
}
}
Event Timeline
Log In to Comment