RomanL 5 лет назад
Родитель
Сommit
d59dd0583f

+ 16 - 0
inc/classes/BxDolVoteReactions.php

@@ -53,6 +53,7 @@ class BxDolVoteReactions extends BxTemplVote
                 'title' => $aReaction['LKey'],
                 'title_aux' => $aReaction['LKey2'],
                 'icon' => isset($aData['icon']) ? $aData['icon'] : '',
+                'emoji' => isset($aData['emoji']) ? $aData['emoji'] : '',
                 'color' => isset($aData['color']) ? $aData['color'] : '',
                 'weight' => isset($aData['weight']) ? $aData['weight'] : 1,
             );
@@ -100,6 +101,13 @@ class BxDolVoteReactions extends BxTemplVote
 
     	return $aReaction['icon'] . ($bWithColor && !empty($aReaction['color']) ? ' ' . $aReaction['color'] : '');
     }
+    
+    public function getEmoji($sReaction, $bWithColor = true)
+    {
+        $aReaction = isset($this->_aDataList[$sReaction]) ? $this->_aDataList[$sReaction] : $this->_aDataList[$this->_sDefault];
+
+    	return $aReaction['emoji'];
+    }
 
     /**
      * Actions functions
@@ -197,6 +205,7 @@ class BxDolVoteReactions extends BxTemplVote
             'count' => $iCount,
             'countf' => $iCount > 0 ? $this->_getCounterLabel($iCount, array('reaction' => $sReaction)) : '',
             'label_icon' => $this->_getIconDoWithTrack($bVoted, $aTrack),
+            'label_emoji' => $this->_getEmojiDoWithTrack($bVoted, $aTrack),
             'label_title' => _t($this->_getTitleDoWithTrack($bVoted, $aTrack)),
             'label_click' => $sJsClick,
             'disabled' => $bVoted && !$this->isUndo(),
@@ -216,6 +225,13 @@ class BxDolVoteReactions extends BxTemplVote
 
     	return $this->getIcon($sReaction);
     }
+    
+    protected function _getEmojiDoWithTrack($bVoted, $aTrack = array())
+    {
+        $sReaction = $bVoted ? $aTrack['reaction'] : $this->_sDefault;
+
+    	return $this->getEmoji($sReaction);
+    }
 
     protected function _getTitleDoWithTrack($bVoted, $aTrack = array())
     {

+ 5 - 2
inc/js/classes/BxDolVoteReactions.js

@@ -83,8 +83,11 @@ BxDolVoteReactions.prototype.onVote = function (oLink, oData, onComplete)
     //--- Update Do button.
     oLink.each(function() {
         if(oData && oData.label_icon)
-            $(this).find('.sys-action-do-icon .sys-icon').attr('class', 'sys-icon ' + oData.label_icon);
-
+            $(this).find('.sys-action-do-icon .sys-icon').attr('class', 'sys-icon ' + oData.label_icon).html('');
+        if(oData && oData.label_emoji){
+            $(this).find('.sys-action-do-icon .sys-icon').html(oData.label_emoji).attr('class', 'sys-icon ');
+        }
+        
         if(oData && oData.label_title) {
             $(this).attr('title', oData.label_title);
             $(this).find('.sys-action-do-text').html(oData.label_title);

+ 6 - 6
install/sql/system.sql

@@ -3998,12 +3998,12 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALU
 ('sys_report_types', 'other', 5, '_sys_pre_lists_report_types_other', '');
 
 INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`, `Data`) VALUES
-('sys_vote_reactions', 'like', 1, '_sys_pre_lists_vote_reactions_like', '', 'a:3:{s:4:"icon";s:9:"thumbs-up";s:5:"color";s:20:"sys-colored col-gray";s:6:"weight";s:1:"1";}'),
-('sys_vote_reactions', 'love', 2, '_sys_pre_lists_vote_reactions_love', '', 'a:3:{s:4:"icon";s:5:"heart";s:5:"color";s:20:"sys-colored col-red1";s:6:"weight";s:1:"1";}'),
-('sys_vote_reactions', 'joy', 3, '_sys_pre_lists_vote_reactions_joy', '', 'a:3:{s:4:"icon";s:11:"grin-squint";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}'),
-('sys_vote_reactions', 'surprise', 4, '_sys_pre_lists_vote_reactions_surprise', '', 'a:3:{s:4:"icon";s:8:"surprise";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}'),
-('sys_vote_reactions', 'sadness', 5, '_sys_pre_lists_vote_reactions_sadness', '', 'a:3:{s:4:"icon";s:8:"sad-tear";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}'),
-('sys_vote_reactions', 'anger', 6, '_sys_pre_lists_vote_reactions_anger', '', 'a:3:{s:4:"icon";s:5:"angry";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}');
+('sys_vote_reactions', 'like', 1, '_sys_pre_lists_vote_reactions_like', '', 'a:3:{s:5:"emoji";s:4:"👍";s:5:"color";s:20:"sys-colored col-gray";s:6:"weight";s:1:"1";}'),
+('sys_vote_reactions', 'love', 2, '_sys_pre_lists_vote_reactions_love', '', 'a:3:{s:5:"emoji";s:4:"💓";s:5:"color";s:20:"sys-colored col-red1";s:6:"weight";s:1:"1";}'),
+('sys_vote_reactions', 'joy', 3, '_sys_pre_lists_vote_reactions_joy', '', 'a:3:{s:5:"emoji";s:4:"😆";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}'),
+('sys_vote_reactions', 'surprise', 4, '_sys_pre_lists_vote_reactions_surprise', '', 'a:3:{s:5:"emoji";s:4:"😲";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}'),
+('sys_vote_reactions', 'sadness', 5, '_sys_pre_lists_vote_reactions_sadness', '', 'a:3:{s:5:"emoji";s:4:"😥";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}'),
+('sys_vote_reactions', 'anger', 6, '_sys_pre_lists_vote_reactions_anger', '', 'a:3:{s:5:"emoji";s:4:"😠";s:5:"color";s:20:"sys-colored col-red3";s:6:"weight";s:1:"1";}');
 
 INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`, `Data`) VALUES
 ('sys_relations', '1', 1, '_sys_pre_lists_relations_husband', '', 'a:1:{i:0;s:1:"2";}'),

+ 8 - 4
template/scripts/BxBaseVoteReactions.php

@@ -350,7 +350,8 @@ class BxBaseVoteReactions extends BxDolVoteReactions
                 'condition' => isset($aParams['show_do_vote_icon']) && (bool)$aParams['show_do_vote_icon'] === true,
                 'content' => array(
                     'style_prefix' => $this->_sStylePrefix,
-                    'name' => $this->_getIconDoWithTrack($bVoted, $aParams['track'])
+                    'name' => $this->_getIconDoWithTrack($bVoted, $aParams['track']),
+                    'emoji' => $this->_getEmojiDoWithTrack($bVoted, $aParams['track'])
                 )
             ),
             'bx_if:show_text' => array(
@@ -389,7 +390,8 @@ 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)
+                    'name' => $this->getIcon($sReaction),
+                    'emoji' => $this->getEmoji($sReaction)
                 )
             ),
             'bx_if:show_text' => array(
@@ -427,7 +429,8 @@ class BxBaseVoteReactions extends BxDolVoteReactions
                     'condition' => $bSummary,
                     'content' => array(
                         'style_prefix' => $this->_sStylePrefix,
-                        'icon' => $bSummary ? $this->getIcon($mValue['reaction']) : ''
+                        'icon' => $bSummary ? $this->getIcon($mValue['reaction']) : '',
+                        'emoji' => $bSummary ? $this->getEmoji($mValue['reaction']) : ''
                     )
                 )
             );
@@ -459,7 +462,8 @@ class BxBaseVoteReactions extends BxDolVoteReactions
             $bSummary = $sReaction == 'summary';
 
             $sName = $this->_sStylePrefix . '-' . $sReaction;
-            $sTitle = !$bSummary ? $this->_oTemplate->parseIcon($this->getIcon($sReaction)) : $sTxtSummary;
+            $sEmoji = $this->getEmoji($sReaction);
+            $sTitle = !$bSummary ? $this->_oTemplate->parseIcon($sEmoji ? $sEmoji : $this->getIcon($sReaction)) : $sTxtSummary;
             $sTitleAttr = !$bSummary ? _t('_vote_do_by_x_reaction', _t($this->_aDataList[$sReaction]['title'])) : $sTxtSummary;
 
             $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);

+ 3 - 1
template/scripts/BxBaseVoteReactionsMenuDo.php

@@ -42,6 +42,8 @@ class BxBaseVoteReactionsMenuDo extends BxTemplMenu
             if($sName == $sDefault)
                 continue;
 
+            $sEmoji = $this->_oObject->getEmoji($sName);
+            
             $aMenuItems[] = array(
                 'id' => $sName, 
                 'name' => $sName, 
@@ -50,7 +52,7 @@ class BxBaseVoteReactionsMenuDo extends BxTemplMenu
                 'onclick' => 'javascript:' . $this->_oObject->getJsClickDo($sName, $this->_iValue), 
                 'target' => '_self', 
                 'title' => _t($aReaction['title']), 
-                'icon' => $this->_oObject->getIcon($sName), 
+                'icon' => $sEmoji != '' ? $sEmoji : $this->_oObject->getIcon($sName), 
                 'active' => 1
             );
         }

+ 1 - 1
template/vote_by_list_reactions.html

@@ -5,7 +5,7 @@
                 <div class="__style_prefix__-by-item bx-def-padding-sec-topbottom bx-clearfix">
                     <div class="__style_prefix__-bi-user">__user_unit__</div>
                     <bx_if:show_reaction>
-                        <div class="__style_prefix__-bi-icon"><i class="sys-icon __icon__"></i></div>
+                        <div class="__style_prefix__-bi-icon"><i class="sys-icon __icon__">__emoji__</i></div>
                     </bx_if:show_reaction>
                 </div>
             </bx_repeat:list>

+ 1 - 1
template/vote_counter_label_reactions.html

@@ -1 +1 @@
-<span class="__style_prefix__-counter-label bx-def-valign-center"><bx_if:show_icon><span class="sys-action-counter-icon __style_prefix__-counter-icon bx-def-align-center"><i class="sys-icon __name__"></i></span></bx_if:show_icon><bx_if:show_text><span class="sys-action-counter-text __style_prefix__-counter-text bx-def-margin-sec-left-auto">__text__</span></bx_if:show_text></span>
+<span class="__style_prefix__-counter-label bx-def-valign-center"><bx_if:show_icon><span class="sys-action-counter-icon __style_prefix__-counter-icon bx-def-align-center"><i class="sys-icon __name__">__emoji__</i></span></bx_if:show_icon><bx_if:show_text><span class="sys-action-counter-text __style_prefix__-counter-text bx-def-margin-sec-left-auto">__text__</span></bx_if:show_text></span>

+ 1 - 1
template/vote_do_vote_label_reactions.html

@@ -1 +1 @@
-<span class="sys-action-do __style_prefix__-do bx-def-valign-center"><bx_if:show_icon><span class="sys-action-do-icon __style_prefix__-do-icon bx-def-align-center"><i class="sys-icon __name__"></i></span></bx_if:show_icon><bx_if:show_text><span class="sys-action-do-text __style_prefix__-do-text bx-def-margin-sec-left-auto">__text__</span></bx_if:show_text></span>
+<span class="sys-action-do __style_prefix__-do bx-def-valign-center"><bx_if:show_icon><span class="sys-action-do-icon __style_prefix__-do-icon bx-def-align-center"><i class="sys-icon __name__"></i>__emoji__</span></bx_if:show_icon><bx_if:show_text><span class="sys-action-do-text __style_prefix__-do-text bx-def-margin-sec-left-auto">__text__</span></bx_if:show_text></span>