Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68638916
PhabricatorFeedBuilder.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
Fri, Jun 28, 07:10
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jun 30, 07:10 (2 d)
Engine
blob
Format
Raw Data
Handle
18613713
Attached To
rPH Phabricator
PhabricatorFeedBuilder.php
View Options
<?php
final
class
PhabricatorFeedBuilder
{
private
$stories
;
private
$framed
;
public
function
__construct
(
array
$stories
)
{
assert_instances_of
(
$stories
,
'PhabricatorFeedStory'
);
$this
->
stories
=
$stories
;
}
public
function
setFramed
(
$framed
)
{
$this
->
framed
=
$framed
;
return
$this
;
}
public
function
setUser
(
PhabricatorUser
$user
)
{
$this
->
user
=
$user
;
return
$this
;
}
public
function
buildView
()
{
if
(!
$this
->
user
)
{
throw
new
Exception
(
'Call setUser() before buildView()!'
);
}
$user
=
$this
->
user
;
$stories
=
$this
->
stories
;
$null_view
=
new
AphrontNullView
();
require_celerity_resource
(
'phabricator-feed-css'
);
$last_date
=
null
;
foreach
(
$stories
as
$story
)
{
$story
->
setFramed
(
$this
->
framed
);
$date
=
ucfirst
(
phabricator_relative_date
(
$story
->
getEpoch
(),
$user
));
if
(
$date
!==
$last_date
)
{
if
(
$last_date
!==
null
)
{
$null_view
->
appendChild
(
'<div class="phabricator-feed-story-date-separator"></div>'
);
}
$last_date
=
$date
;
$null_view
->
appendChild
(
phutil_tag
(
'div'
,
array
(
'class'
=>
'phabricator-feed-story-date'
,
),
$date
));
}
$view
=
$story
->
renderView
();
$view
->
setUser
(
$user
);
$null_view
->
appendChild
(
$view
);
}
return
id
(
new
AphrontNullView
())->
appendChild
(
'<div class="phabricator-feed-frame">'
.
$null_view
->
render
().
'</div>'
);
}
}
Event Timeline
Log In to Comment