Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96361329
PhabricatorTokenLeaderController.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, Dec 25, 22:06
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Dec 27, 22:06 (1 d, 11 h)
Engine
blob
Format
Raw Data
Handle
23172094
Attached To
rPH Phabricator
PhabricatorTokenLeaderController.php
View Options
<?php
final
class
PhabricatorTokenLeaderController
extends
PhabricatorTokenController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$pager
=
new
PHUIPagerView
();
$pager
->
setURI
(
$request
->
getRequestURI
(),
'page'
);
$pager
->
setOffset
(
$request
->
getInt
(
'page'
));
$query
=
id
(
new
PhabricatorTokenReceiverQuery
());
$objects
=
$query
->
setViewer
(
$viewer
)->
executeWithOffsetPager
(
$pager
);
$counts
=
$query
->
getTokenCounts
();
$handles
=
array
();
$phids
=
array
();
if
(
$counts
)
{
$phids
=
mpull
(
$objects
,
'getPHID'
);
$handles
=
id
(
new
PhabricatorHandleQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
$phids
)
->
execute
();
}
$list
=
new
PHUIObjectItemListView
();
foreach
(
$phids
as
$object
)
{
$count
=
idx
(
$counts
,
$object
,
0
);
$item
=
id
(
new
PHUIObjectItemView
());
$handle
=
$handles
[
$object
];
$item
->
setHeader
(
$handle
->
getFullName
());
$item
->
setHref
(
$handle
->
getURI
());
$item
->
addAttribute
(
pht
(
'Tokens: %s'
,
$count
));
$list
->
addItem
(
$item
);
}
$title
=
pht
(
'Token Leader Board'
);
$box
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
$title
)
->
setObjectList
(
$list
);
$nav
=
$this
->
buildSideNav
();
$nav
->
setCrumbs
(
$this
->
buildApplicationCrumbs
()
->
addTextCrumb
(
$title
));
$nav
->
selectFilter
(
'leaders/'
);
$nav
->
appendChild
(
$box
);
$nav
->
appendChild
(
$pager
);
return
$this
->
newPage
()
->
setTitle
(
$title
)
->
appendChild
(
$nav
);
}
}
Event Timeline
Log In to Comment