Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F107675688
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
Wed, Apr 9, 14:39
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Apr 11, 14:39 (2 d)
Engine
blob
Format
Raw Data
Handle
25374819
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