Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101632472
ReleephProjectListController.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
Wed, Feb 12, 06:53
Size
2 KB
Mime Type
text/x-php
Expires
Fri, Feb 14, 06:53 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24202732
Attached To
rPH Phabricator
ReleephProjectListController.php
View Options
<?php
final
class
ReleephProjectListController
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
ReleephProjectSearchEngine
())
->
setNavigation
(
$this
->
buildSideNavView
());
return
$this
->
delegateToController
(
$controller
);
}
public
function
renderResultsList
(
array
$projects
,
PhabricatorSavedQuery
$query
)
{
assert_instances_of
(
$projects
,
'ReleephProject'
);
$viewer
=
$this
->
getRequest
()->
getUser
();
$list
=
id
(
new
PhabricatorObjectItemListView
())
->
setUser
(
$viewer
);
foreach
(
$projects
as
$project
)
{
$id
=
$project
->
getID
();
$item
=
id
(
new
PhabricatorObjectItemView
())
->
setHeader
(
$project
->
getName
())
->
setHref
(
$this
->
getApplicationURI
(
"project/{$id}/"
));
$edit_uri
=
$this
->
getApplicationURI
(
"project/{$id}/edit/"
);
$item
->
addAction
(
id
(
new
PHUIListItemView
())
->
setIcon
(
'edit'
)
->
setHref
(
$edit_uri
));
if
(
$project
->
getIsActive
())
{
$disable_uri
=
$this
->
getApplicationURI
(
"project/{$id}/action/deactivate/"
);
$item
->
addAction
(
id
(
new
PHUIListItemView
())
->
setIcon
(
'delete'
)
->
setName
(
pht
(
'Deactivate'
))
->
setWorkflow
(
true
)
->
setHref
(
$disable_uri
));
}
else
{
$enable_uri
=
$this
->
getApplicationURI
(
"project/{$id}/action/activate/"
);
$item
->
setDisabled
(
true
);
$item
->
addIcon
(
'none'
,
pht
(
'Inactive'
));
$item
->
addAction
(
id
(
new
PHUIListItemView
())
->
setIcon
(
'new'
)
->
setName
(
pht
(
'Reactivate'
))
->
setWorkflow
(
true
)
->
setHref
(
$enable_uri
));
}
$repo
=
$project
->
getRepository
();
$item
->
addAttribute
(
phutil_tag
(
'a'
,
array
(
'href'
=>
'/diffusion/'
.
$repo
->
getCallsign
().
'/'
,
),
'r'
.
$repo
->
getCallsign
()));
$arc
=
$project
->
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 Project'
))
->
setHref
(
$this
->
getApplicationURI
(
'project/create/'
))
->
setIcon
(
'create'
));
return
$crumbs
;
}
}
Event Timeline
Log In to Comment