|
|
@@ -426,22 +426,46 @@ class BxBaseVoteReactions extends BxDolVoteReactions
|
|
|
protected function _getDoVoteLabel($aParams = array())
|
|
|
{
|
|
|
$bVoted = isset($aParams['is_voted']) && (bool)$aParams['is_voted'] === true;
|
|
|
+ $aTrack = $bVoted ? $aParams['track'] : [];
|
|
|
|
|
|
+ $sReaction = $bVoted ? $aTrack['reaction'] : $this->_sDefault;
|
|
|
+ $aReaction = $this->getReaction($sReaction);
|
|
|
+
|
|
|
+ $sUse = !empty($aReaction['use']) ? $aReaction['use'] : 'emoji';
|
|
|
+ if(!$bVoted && !empty($aReaction['default']))
|
|
|
+ $sUse = 'icon';
|
|
|
+
|
|
|
return $this->_oTemplate->parseHtmlByContent($this->_getTmplContentDoActionLabel(), array(
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'bx_if:show_icon' => array(
|
|
|
+ 'bx_if:show_icon' => [
|
|
|
'condition' => isset($aParams['show_do_vote_icon']) && (bool)$aParams['show_do_vote_icon'] === true,
|
|
|
- 'content' => array(
|
|
|
+ 'content' => [
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'name' => $this->_getIconDoWithTrack($bVoted, $aParams['track']),
|
|
|
- 'emoji' => $this->_getEmojiDoWithTrack($bVoted, $aParams['track'])
|
|
|
- )
|
|
|
- ),
|
|
|
+ 'bx_if:show_as_icon' => [
|
|
|
+ 'condition' => $sUse == 'icon',
|
|
|
+ 'content' => [
|
|
|
+ 'name' => $sUse == 'icon' ? $this->_getIconDoWithTrack($bVoted, $aTrack) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'bx_if:show_as_emoji' => [
|
|
|
+ 'condition' => $sUse == 'emoji',
|
|
|
+ 'content' => [
|
|
|
+ 'emoji' => $sUse == 'emoji' ? $this->_getEmojiDoWithTrack($bVoted, $aTrack) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'bx_if:show_as_image' => [
|
|
|
+ 'condition' => $sUse == 'image',
|
|
|
+ 'content' => [
|
|
|
+ 'image' => $sUse == 'image' ? $this->_getImageDoWithTrack($bVoted, $aTrack) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ ],
|
|
|
'bx_if:show_text' => array(
|
|
|
'condition' => isset($aParams['show_do_vote_label']) && (bool)$aParams['show_do_vote_label'] === true,
|
|
|
'content' => array(
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'text' => _t($this->_getTitleDoWithTrack($bVoted, $aParams['track']))
|
|
|
+ 'text' => _t($this->_getTitleDoWithTrack($bVoted, $aTrack))
|
|
|
)
|
|
|
)
|
|
|
));
|
|
|
@@ -475,6 +499,9 @@ class BxBaseVoteReactions extends BxDolVoteReactions
|
|
|
protected function _getCounterLabel($iCount, $aParams = array())
|
|
|
{
|
|
|
$sReaction = !empty($aParams['reaction']) ? $aParams['reaction'] : $this->_sDefault;
|
|
|
+ $aReaction = $this->getReaction($sReaction);
|
|
|
+
|
|
|
+ $sUse = !empty($aReaction['use']) ? $aReaction['use'] : 'emoji';
|
|
|
|
|
|
return $this->_oTemplate->parseHtmlByContent($this->_getTmplContentCounterLabel(), array(
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
@@ -482,8 +509,24 @@ class BxBaseVoteReactions extends BxDolVoteReactions
|
|
|
'condition' => !isset($aParams['show_counter_label_icon']) || (bool)$aParams['show_counter_label_icon'] === true,
|
|
|
'content' => array(
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'name' => $this->getIcon($sReaction),
|
|
|
- 'emoji' => $this->getEmoji($sReaction),
|
|
|
+ 'bx_if:show_as_icon' => [
|
|
|
+ 'condition' => $sUse == 'icon',
|
|
|
+ 'content' => [
|
|
|
+ 'name' => $sUse == 'icon' ? $this->getIcon($sReaction) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'bx_if:show_as_emoji' => [
|
|
|
+ 'condition' => $sUse == 'emoji',
|
|
|
+ 'content' => [
|
|
|
+ 'emoji' => $sUse == 'emoji' ? $this->getEmoji($sReaction) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'bx_if:show_as_image' => [
|
|
|
+ 'condition' => $sUse == 'image',
|
|
|
+ 'content' => [
|
|
|
+ 'image' => $sUse == 'image' ? $this->getImage($sReaction) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
'title_attr' => bx_html_attribute(_t($this->_aDataList[$sReaction]['title'])),
|
|
|
)
|
|
|
),
|
|
|
@@ -502,6 +545,8 @@ class BxBaseVoteReactions extends BxDolVoteReactions
|
|
|
if(!isset($aParams['reaction']))
|
|
|
return $this->_getVotedBySummary($aParams);
|
|
|
|
|
|
+ $aReactions = $this->getReactions(true);
|
|
|
+
|
|
|
$bSummary = $aParams['reaction'] == 'summary';
|
|
|
|
|
|
$aBrowseParams = array('type' => 'by', 'object_id' => $this->getId());
|
|
|
@@ -514,17 +559,40 @@ class BxBaseVoteReactions extends BxDolVoteReactions
|
|
|
foreach($aValues as $mValue) {
|
|
|
$mValue = is_array($mValue) ? $mValue : array('author_id' => (int)$mValue, 'reaction' => '');
|
|
|
|
|
|
+ $aTmplReaction = [];
|
|
|
+ if($bSummary) {
|
|
|
+ $sUse = !empty($aReactions[$mValue['reaction']]['use']) ? $aReactions[$mValue['reaction']]['use'] : 'emoji';
|
|
|
+
|
|
|
+ $aTmplReaction = [
|
|
|
+ 'style_prefix' => $this->_sStylePrefix,
|
|
|
+ 'bx_if:show_as_icon' => [
|
|
|
+ 'condition' => $sUse == 'icon',
|
|
|
+ 'content' => [
|
|
|
+ 'name' => $sUse == 'icon' ? $this->getIcon($mValue['reaction']) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'bx_if:show_as_emoji' => [
|
|
|
+ 'condition' => $sUse == 'emoji',
|
|
|
+ 'content' => [
|
|
|
+ 'emoji' => $sUse == 'emoji' ? $this->getEmoji($mValue['reaction']) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'bx_if:show_as_image' => [
|
|
|
+ 'condition' => $sUse == 'image',
|
|
|
+ 'content' => [
|
|
|
+ 'image' => $sUse == 'image' ? $this->getImage($mValue['reaction']) : '',
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
list($sUserName, $sUserUrl, $sUserIcon, $sUserUnit) = $this->_getAuthorInfo($mValue['author_id']);
|
|
|
$aTmplUsers[] = array(
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
'user_unit' => $sUserUnit,
|
|
|
'bx_if:show_reaction' => array(
|
|
|
'condition' => $bSummary,
|
|
|
- 'content' => array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'icon' => $bSummary ? $this->getIcon($mValue['reaction']) : '',
|
|
|
- 'emoji' => $bSummary ? $this->getEmoji($mValue['reaction']) : ''
|
|
|
- )
|
|
|
+ 'content' => $aTmplReaction
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
@@ -544,21 +612,36 @@ class BxBaseVoteReactions extends BxDolVoteReactions
|
|
|
$sJsObject = $this->getJsObjectName();
|
|
|
|
|
|
$sTxtSummary = _t('_vote_do_by_summary');
|
|
|
- $aReactions = array_merge(array('summary'), $this->getReactions());
|
|
|
+ $aReactions = array_merge(['summary' => []], $this->getReactions(true));
|
|
|
|
|
|
$aMenuItems = array();
|
|
|
$aTmplVarsLists = array();
|
|
|
- foreach ($aReactions as $sReaction) {
|
|
|
+ foreach ($aReactions as $sReaction => $aReaction) {
|
|
|
if($sReaction == $this->_sDefault)
|
|
|
continue;
|
|
|
|
|
|
$bSummary = $sReaction == 'summary';
|
|
|
+ $sUse = !empty($aReaction['use']) ? $aReaction['use'] : 'emoji';
|
|
|
+
|
|
|
+ $sIcon = '';
|
|
|
+ switch($sUse) {
|
|
|
+ case 'icon':
|
|
|
+ $sIcon = $this->_oTemplate->parseIcon($this->getIcon($sReaction));
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'emoji':
|
|
|
+ $sIcon = $this->getEmoji($sReaction);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'image':
|
|
|
+ $sIcon = $this->getImage($sReaction);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- $sName = $this->_sStylePrefix . '-' . $sReaction;
|
|
|
- $sEmoji = $this->getEmoji($sReaction);
|
|
|
- $sTitle = !$bSummary ? $this->_oTemplate->parseIcon($sEmoji ? $sEmoji : $this->getIcon($sReaction)) : $sTxtSummary;
|
|
|
+ $sTitle = !$bSummary ? $sIcon : $sTxtSummary;
|
|
|
$sTitleAttr = !$bSummary ? _t('_vote_do_by_x_reaction', _t($this->_aDataList[$sReaction]['title'])) : $sTxtSummary;
|
|
|
|
|
|
+ $sName = $this->_sStylePrefix . '-' . $sReaction;
|
|
|
$aMenuItems[] = array('id' => $sName, 'name' => $sName, 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.changeVotedBy(this, \'' . $sReaction . '\')', 'target' => '_self', 'title' => $sTitle, 'title_attr' => $sTitleAttr, 'active' => 1);
|
|
|
|
|
|
$aTmplVarsLists[] = array(
|