Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110600123
PonderQuestionSummaryView.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
Sun, Apr 27, 02:18
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Apr 29, 02:18 (2 d)
Engine
blob
Format
Raw Data
Handle
25832797
Attached To
rPH Phabricator
PonderQuestionSummaryView.php
View Options
<?php
final
class
PonderQuestionSummaryView
extends
AphrontView
{
private
$question
;
private
$handles
;
public
function
setQuestion
(
$question
)
{
$this
->
question
=
$question
;
return
$this
;
}
public
function
setHandles
(
$handles
)
{
$this
->
handles
=
$handles
;
return
$this
;
}
public
function
render
()
{
require_celerity_resource
(
'ponder-feed-view-css'
);
$user
=
$this
->
user
;
$question
=
$this
->
question
;
$author_phid
=
$question
->
getAuthorPHID
();
$handles
=
$this
->
handles
;
$authorlink
=
$handles
[
$author_phid
]
->
renderLink
();
$votecount
=
hsprintf
(
'<div class="ponder-summary-votes">'
.
'%s'
.
'<div class="ponder-question-label">votes</div>'
.
'</div>'
,
$question
->
getVoteCount
());
$answerclass
=
"ponder-summary-answers"
;
if
(
$question
->
getAnswercount
()
==
0
)
{
$answerclass
.=
" ponder-not-answered"
;
}
$answercount
=
hsprintf
(
'<div class="ponder-summary-answers">'
.
'%s'
.
'<div class="ponder-question-label">answers</div>'
.
'</div>'
,
$question
->
getAnswerCount
());
$title
=
hsprintf
(
'<h2 class="ponder-question-title">%s</h2>'
,
phutil_tag
(
'a'
,
array
(
"href"
=>
'/Q'
.
$question
->
getID
(),
),
'Q'
.
$question
->
getID
()
.
' '
.
$question
->
getTitle
()));
$rhs
=
hsprintf
(
'<div class="ponder-metadata">'
.
'%s <span class="ponder-small-metadata">asked on %s by %s</span>'
.
'</div>'
,
$title
,
phabricator_datetime
(
$question
->
getDateCreated
(),
$user
),
$authorlink
);
$summary
=
hsprintf
(
'<div class="ponder-question-summary">%s%s%s</div>'
,
$votecount
,
$answercount
,
$rhs
);
return
$summary
;
}
}
Event Timeline
Log In to Comment