Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F476324
PholioInlineCommentView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
PholioInlineCommentView.php
View Options
<?php
/**
* @group pholio
*/
final
class
PholioInlineCommentView
extends
AphrontView
{
private
$engine
;
private
$handle
;
private
$inlineComment
;
public
function
setEngine
(
PhabricatorMarkupEngine
$engine
)
{
$this
->
engine
=
$engine
;
return
$this
;
}
public
function
setHandle
(
PhabricatorObjectHandle
$handle
)
{
$this
->
handle
=
$handle
;
return
$this
;
}
public
function
setInlineComment
(
PholioTransactionComment
$inline_comment
)
{
if
(
$inline_comment
->
getImageID
()
===
null
)
{
throw
new
Exception
(
'Comment provided is not inline comment'
);
}
$this
->
inlineComment
=
$inline_comment
;
return
$this
;
}
public
function
render
()
{
if
(!
$this
->
inlineComment
)
{
throw
new
Exception
(
'Call setInlineComment() before render()!'
);
}
if
(
$this
->
user
===
null
)
{
throw
new
Exception
(
'Call setUser() before render()!'
);
}
if
(
$this
->
engine
===
null
)
{
throw
new
Exception
(
'Call setEngine() before render()!'
);
}
if
(
$this
->
handle
===
null
)
{
throw
new
Exception
(
'Call setHandle() before render()!'
);
}
$actions
=
null
;
$inline
=
$this
->
inlineComment
;
$phid
=
$inline
->
getPHID
();
$id
=
$inline
->
getID
();
$user
=
$this
->
user
;
$is_draft
=
(
$inline
->
getTransactionPHID
()
===
null
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$user
,
$inline
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
if
(
$is_draft
&&
$can_edit
)
{
$draft
=
phutil_tag
(
'span'
,
array
(
'class'
=>
'pholio-inline-status'
,
),
pht
(
'Not Submitted Yet'
));
$edit_action
=
javelin_tag
(
'a'
,
array
(
'href'
=>
'/pholio/inline/edit/'
.
$id
.
'/'
,
'sigil'
=>
'inline-edit'
,
'meta'
=>
array
(
'phid'
=>
$phid
,
'id'
=>
$id
,
)
),
pht
(
'Edit'
));
$delete_action
=
javelin_tag
(
'a'
,
array
(
'href'
=>
'/pholio/inline/delete/'
.
$id
.
'/'
,
'sigil'
=>
'inline-delete'
,
'meta'
=>
array
(
'phid'
=>
$phid
,
'id'
=>
$id
,
)
),
pht
(
'Delete'
));
$actions
=
phutil_tag
(
'span'
,
array
(
'class'
=>
'pholio-inline-head-links'
),
phutil_implode_html
(
"
\x
C2
\x
B7 "
,
array
(
$draft
,
$edit_action
,
$delete_action
)));
}
$comment_header
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'pholio-inline-comment-header'
),
array
(
$this
->
handle
->
getName
(),
$actions
));
$comment
=
$this
->
engine
->
renderOneObject
(
$inline
,
PholioTransactionComment
::
MARKUP_FIELD_COMMENT
,
$this
->
user
);
$comment_body
=
phutil_tag
(
'div'
,
array
(),
$comment
);
$classes
=
array
();
$classes
[]
=
'pholio-inline-comment'
;
if
(
$is_draft
)
{
$classes
[]
=
'pholio-inline-comment-draft'
;
}
return
javelin_tag
(
'div'
,
array
(
'id'
=>
"{$phid}_comment"
,
'class'
=>
implode
(
' '
,
$classes
),
'sigil'
=>
'inline_comment'
,
'meta'
=>
array
(
'phid'
=>
$phid
,
)
),
array
(
$comment_header
,
$comment_body
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, May 7, 2:45 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
86375
Default Alt Text
PholioInlineCommentView.php (3 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment