Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F111536571
SlowvoteRemarkupRule.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
Sat, May 3, 01:53
Size
1 KB
Mime Type
text/x-php
Expires
Mon, May 5, 01:53 (2 d)
Engine
blob
Format
Raw Data
Handle
25944786
Attached To
rPH Phabricator
SlowvoteRemarkupRule.php
View Options
<?php
/**
* @group slowvote
*/
final
class
SlowvoteRemarkupRule
extends
PhabricatorRemarkupRuleObject
{
protected
function
getObjectNamePrefix
()
{
return
'V'
;
}
protected
function
loadObjects
(
array
$ids
)
{
$polls
=
array
(
id
(
new
PhabricatorSlowvotePoll
())->
load
(
head
(
$ids
)));
return
id
(
new
PhabricatorSlowvotePoll
())
->
loadAllWhere
(
'id IN (%Ld)'
,
$ids
);
}
protected
function
renderObjectEmbed
(
$object
,
$handle
,
$options
)
{
$viewer
=
$this
->
getEngine
()->
getConfig
(
'viewer'
);
$options
=
id
(
new
PhabricatorSlowvoteOption
())->
loadAllWhere
(
'pollID = %d'
,
$object
->
getID
());
$choices
=
id
(
new
PhabricatorSlowvoteChoice
())->
loadAllWhere
(
'pollID = %d'
,
$object
->
getID
());
$choices_by_user
=
mgroup
(
$choices
,
'getAuthorPHID'
);
$viewer_choices
=
idx
(
$choices_by_user
,
$viewer
->
getPHID
(),
array
());
$embed
=
id
(
new
SlowvoteEmbedView
())
->
setPoll
(
$object
)
->
setOptions
(
$options
)
->
setViewerChoices
(
$viewer_choices
);
return
$embed
->
render
();
}
}
Event Timeline
Log In to Comment