Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93850057
PhabricatorFeedMainController.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
Mon, Dec 2, 00:19
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 00:19 (2 d)
Engine
blob
Format
Raw Data
Handle
22714194
Attached To
rPH Phabricator
PhabricatorFeedMainController.php
View Options
<?php
final
class
PhabricatorFeedMainController
extends
PhabricatorFeedController
{
private
$filter
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
filter
=
idx
(
$data
,
'filter'
);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$nav
=
$this
->
buildSideNavView
();
$filter
=
$nav
->
selectFilter
(
$this
->
filter
,
'all'
);
$pager
=
new
AphrontCursorPagerView
();
$pager
->
readFromRequest
(
$request
);
$pager
->
setPageSize
(
200
);
$query
=
id
(
new
PhabricatorFeedQuery
())
->
setViewer
(
$user
);
$nodata
=
null
;
switch
(
$filter
)
{
case
'all'
:
$title
=
pht
(
'Feed'
);
break
;
case
'projects'
:
$projects
=
id
(
new
PhabricatorProjectQuery
())
->
setViewer
(
$user
)
->
withMemberPHIDs
(
array
(
$user
->
getPHID
()))
->
execute
();
if
(!
$projects
)
{
$nodata
=
pht
(
'You have not joined any projects.'
);
}
else
{
$query
->
setFilterPHIDs
(
mpull
(
$projects
,
'getPHID'
));
}
$title
=
pht
(
'Feed: My Projects'
);
break
;
}
if
(
$nodata
)
{
$feed_view
=
id
(
new
AphrontErrorView
())
->
setSeverity
(
AphrontErrorView
::
SEVERITY_NODATA
)
->
setTitle
(
pht
(
'No Stories'
))
->
appendChild
(
$nodata
);
}
else
{
$feed
=
$query
->
executeWithCursorPager
(
$pager
);
$builder
=
new
PhabricatorFeedBuilder
(
$feed
);
$builder
->
setUser
(
$user
);
$feed_view
=
$builder
->
buildView
();
}
$feed_view
=
hsprintf
(
'<div class="phabricator-feed-frame">%s</div>'
,
$feed_view
);
$crumbs
=
$this
->
buildApplicationCrumbs
(
$nav
)
->
addCrumb
(
id
(
new
PhabricatorCrumbView
())
->
setName
(
$title
)
->
setHref
(
$this
->
getApplicationURI
(
'filter/'
.
$filter
.
'/'
)));
$nav
->
setCrumbs
(
$crumbs
);
$nav
->
appendChild
(
array
(
$feed_view
,
$pager
,
));
return
$this
->
buildApplicationPage
(
$nav
,
array
(
'title'
=>
$title
,
'device'
=>
true
,
'dust'
=>
true
,
));
}
}
Event Timeline
Log In to Comment