Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93462075
PhabricatorProjectListView.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
Thu, Nov 28, 23:15
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Nov 30, 23:15 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22644948
Attached To
rPH Phabricator
PhabricatorProjectListView.php
View Options
<?php
final
class
PhabricatorProjectListView
extends
AphrontView
{
private
$projects
;
private
$showMember
;
private
$showWatching
;
private
$noDataString
;
public
function
setProjects
(
array
$projects
)
{
$this
->
projects
=
$projects
;
return
$this
;
}
public
function
getProjects
()
{
return
$this
->
projects
;
}
public
function
setShowWatching
(
$watching
)
{
$this
->
showWatching
=
$watching
;
return
$this
;
}
public
function
setShowMember
(
$member
)
{
$this
->
showMember
=
$member
;
return
$this
;
}
public
function
setNoDataString
(
$text
)
{
$this
->
noDataString
=
$text
;
return
$this
;
}
public
function
renderList
()
{
$viewer
=
$this
->
getUser
();
$viewer_phid
=
$viewer
->
getPHID
();
$projects
=
$this
->
getProjects
();
$handles
=
$viewer
->
loadHandles
(
mpull
(
$projects
,
'getPHID'
));
$no_data
=
pht
(
'No projects found.'
);
if
(
$this
->
noDataString
)
{
$no_data
=
$this
->
noDataString
;
}
$list
=
id
(
new
PHUIObjectItemListView
())
->
setUser
(
$viewer
)
->
setNoDataString
(
$no_data
);
foreach
(
$projects
as
$key
=>
$project
)
{
$id
=
$project
->
getID
();
$icon
=
$project
->
getDisplayIconIcon
();
$icon_icon
=
id
(
new
PHUIIconView
())
->
setIcon
(
$icon
);
$icon_name
=
$project
->
getDisplayIconName
();
$item
=
id
(
new
PHUIObjectItemView
())
->
setHeader
(
$project
->
getName
())
->
setHref
(
"/project/view/{$id}/"
)
->
setImageURI
(
$project
->
getProfileImageURI
())
->
addAttribute
(
array
(
$icon_icon
,
' '
,
$icon_name
,
));
if
(
$project
->
getStatus
()
==
PhabricatorProjectStatus
::
STATUS_ARCHIVED
)
{
$item
->
addIcon
(
'fa-ban'
,
pht
(
'Archived'
));
$item
->
setDisabled
(
true
);
}
if
(
$this
->
showMember
)
{
$is_member
=
$project
->
isUserMember
(
$viewer_phid
);
if
(
$is_member
)
{
$item
->
addIcon
(
'fa-user'
,
pht
(
'Member'
));
}
}
if
(
$this
->
showWatching
)
{
$is_watcher
=
$project
->
isUserWatcher
(
$viewer_phid
);
if
(
$is_watcher
)
{
$item
->
addIcon
(
'fa-eye'
,
pht
(
'Watching'
));
}
}
$list
->
addItem
(
$item
);
}
return
$list
;
}
public
function
render
()
{
return
$this
->
renderList
();
}
}
Event Timeline
Log In to Comment