Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77210558
ReleephProductListController.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
Tue, Aug 13, 03:28
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Aug 15, 03:28 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
19833444
Attached To
rPH Phabricator
ReleephProductListController.php
View Options
<?php
final
class
ReleephProductListController
extends
ReleephController
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
ReleephProductSearchEngine
())
->
setNavigation
(
$this
->
buildSideNavView
());
return
$this
->
delegateToController
(
$controller
);
}
public
function
renderResultsList
(
array
$products
,
PhabricatorSavedQuery
$query
)
{
assert_instances_of
(
$products
,
'ReleephProject'
);
$viewer
=
$this
->
getRequest
()->
getUser
();
$list
=
id
(
new
PHUIObjectItemListView
())
->
setUser
(
$viewer
);
foreach
(
$products
as
$product
)
{
$id
=
$product
->
getID
();
$item
=
id
(
new
PHUIObjectItemView
())
->
setHeader
(
$product
->
getName
())
->
setHref
(
$this
->
getApplicationURI
(
"project/{$id}/"
));
if
(!
$product
->
getIsActive
())
{
$item
->
setDisabled
(
true
);
$item
->
addIcon
(
'none'
,
pht
(
'Inactive'
));
}
$repo
=
$product
->
getRepository
();
$item
->
addAttribute
(
phutil_tag
(
'a'
,
array
(
'href'
=>
'/diffusion/'
.
$repo
->
getCallsign
().
'/'
,
),
'r'
.
$repo
->
getCallsign
()));
$arc
=
$product
->
loadArcanistProject
();
if
(
$arc
)
{
$item
->
addAttribute
(
$arc
->
getName
());
}
$list
->
addItem
(
$item
);
}
return
$list
;
}
public
function
buildApplicationCrumbs
()
{
$crumbs
=
parent
::
buildApplicationCrumbs
();
$crumbs
->
addAction
(
id
(
new
PHUIListItemView
())
->
setName
(
pht
(
'Create Product'
))
->
setHref
(
$this
->
getApplicationURI
(
'project/create/'
))
->
setIcon
(
'create'
));
return
$crumbs
;
}
}
Event Timeline
Log In to Comment