Browse Source

Ticket #4230 - Discussions: Score element has unparsed keys.

AntonLV 3 years ago
parent
commit
49bce24ea4
2 changed files with 20 additions and 17 deletions
  1. 1 1
      template/score_counter.html
  2. 19 16
      template/scripts/BxBaseScore.php

+ 1 - 1
template/score_counter.html

@@ -1,5 +1,5 @@
 <bx_if:show_text>
-    <span id="__id__" class="__class__ bx-def-font-grayed">__content__</span>
+    <span id="__id__" class="__class__ bx-def-font-grayed" title="__title__">__content__</span>
 </bx_if:show_text>
 <bx_if:show_link>
     <a id="__id__" class="__class__ sys-ac-link group box-border" href="javascript:void(0)" onclick="__onclick__" title="__title__">__content__</a>

+ 19 - 16
template/scripts/BxBaseScore.php

@@ -129,25 +129,25 @@ class BxBaseScore extends BxDolScore
         $bLink = $bAllowedViewViewVoters && !$bEmpty;
         $sCounter = !$bEmpty || $bShowEmpty ? $this->_getCounterLabel($iCup - $iCdown, $aParams) : '';
 
-        $aTmplVars = array(
+        $aTmplVarsText = [
             'id' => $this->_aHtmlIds['counter'],
             'class' => $sClass,
-            'content' => $sCounter
-        );
-        if($bLink)
-            $aTmplVars = array_merge($aTmplVars, array(
-                'title' => _t($this->_getTitleDoBy()),
-                'onclick' => 'javascript:' . $this->getJsClickCounter()
-            ));
+            'content' => $sCounter,
+            'title' => _t($this->_getTitleDoBy()),
+        ];
+
+        $aTmplVarsLink = array_merge($aTmplVarsText, [
+            'onclick' => $bLink ? 'javascript:' . $this->getJsClickCounter() : ''
+        ]);
 
         return $this->_oTemplate->parseHtmlByName('score_counter.html', array(
             'bx_if:show_link' => array(
                 'condition' => $bLink,
-                'content' => $aTmplVars
+                'content' => $aTmplVarsLink
             ),
             'bx_if:show_text' => array(
                 'condition' => !$bLink,
-                'content' => $aTmplVars
+                'content' => $aTmplVarsText
             ),
             'script' => $bShowScript ? $this->getJsScript($aParams) : ''
         ));
@@ -345,29 +345,32 @@ class BxBaseScore extends BxDolScore
 
     protected function _getVotedBy($aParams)
     {
-        $aParams['show_do_vote_label'] = false;
+        $aParams = array_merge($this->_aElementDefaults, $aParams, [
+            'show_do_vote_icon' => true,
+            'show_do_vote_label' => false
+        ]);
 
-        $aTmplUsers = array();
+        $aTmplUsers = [];
         $aUsers = $this->_oQuery->getPerformedBy($this->getId());
         foreach($aUsers as $aUser) {
             list($sUserName, $sUserLink, $sUserIcon, $sUserUnit, $sUserUnitWoInfo) = $this->_getAuthorInfo($aUser['id']);
-            $aTmplUsers[] = array(
+            $aTmplUsers[] = [
                 'style_prefix' => $this->_sStylePrefix,
             	'user_name' => $sUserName,
             	'user_link' => $sUserLink,
                 'user_unit' => $sUserUnitWoInfo,
                 'vote' => $this->_getLabelDo($aUser['vote_type'], $aParams),
                 'date' => bx_time_js($aUser['vote_date']),
-            );
+            ];
         }
 
         if(empty($aTmplUsers))
             $aTmplUsers = MsgBox(_t('_Empty'));
 
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameByList, array(
+        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameByList, [
             'style_prefix' => $this->_sStylePrefix,
             'bx_repeat:list' => $aTmplUsers
-        ));
+        ]);
     }
 
     protected function _isShowDoVote($aParams, $isAllowedVote, $bCount)