|
|
@@ -14,61 +14,41 @@ class BxBaseVote extends BxDolVote
|
|
|
{
|
|
|
protected static $_sTmplContentElementBlock;
|
|
|
protected static $_sTmplContentElementInline;
|
|
|
- protected static $_sTmplContentDoVoteLikesLabel;
|
|
|
protected static $_sTmplContentCounter;
|
|
|
|
|
|
+ protected $_aElementDefaults;
|
|
|
+
|
|
|
protected $_bCssJsAdded;
|
|
|
|
|
|
+ protected $_sJsClsName;
|
|
|
protected $_sJsObjName;
|
|
|
protected $_sStylePrefix;
|
|
|
|
|
|
protected $_aHtmlIds;
|
|
|
|
|
|
- protected $_aElementDefaults;
|
|
|
-
|
|
|
protected $_sTmplNameLegend;
|
|
|
protected $_sTmplNameByList;
|
|
|
- protected $_sTmplNameDoVoteStars;
|
|
|
|
|
|
public function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
|
|
|
{
|
|
|
parent::__construct($sSystem, $iId, $iInit, $oTemplate);
|
|
|
|
|
|
+ $this->_aElementDefaults = array();
|
|
|
+
|
|
|
$this->_bCssJsAdded = false;
|
|
|
+ $this->_sStylePrefix = 'bx-vote';
|
|
|
|
|
|
+ $this->_sJsClsName = 'BxDolVote';
|
|
|
$this->_sJsObjName = 'oVote' . bx_gen_method_name($sSystem, array('_' , '-')) . $iId;
|
|
|
- $this->_sStylePrefix = 'bx-vote';
|
|
|
|
|
|
$sHtmlId = str_replace(array('_' , ' '), array('-', '-'), $sSystem) . '-' . $iId;
|
|
|
$this->_aHtmlIds = array(
|
|
|
- 'main_stars' => 'bx-vote-stars-' . $sHtmlId,
|
|
|
- 'main_likes' => 'bx-vote-likes-' . $sHtmlId,
|
|
|
'counter' => 'bx-vote-counter-' . $sHtmlId,
|
|
|
- 'by_popup' => 'bx-vote-by-popup-' . $sHtmlId,
|
|
|
- 'legend_stars' => 'bx-vote-stars-legend-' . $sHtmlId,
|
|
|
- );
|
|
|
-
|
|
|
- $this->_aElementDefaults = array(
|
|
|
- 'stars' => array(
|
|
|
- 'show_do_vote_legend' => false,
|
|
|
- 'show_counter' => true,
|
|
|
- 'show_counter_empty' => false,
|
|
|
- 'show_legend' => false
|
|
|
- ),
|
|
|
- 'likes' => array(
|
|
|
- 'show_do_vote_as_button' => false,
|
|
|
- 'show_do_vote_as_button_small' => false,
|
|
|
- 'show_do_vote_icon' => true,
|
|
|
- 'show_do_vote_label' => false,
|
|
|
- 'show_counter' => true,
|
|
|
- 'show_counter_empty' => false,
|
|
|
- 'show_legend' => false
|
|
|
- )
|
|
|
+ 'by_popup' => 'bx-vote-by-popup-' . $sHtmlId
|
|
|
);
|
|
|
|
|
|
$this->_sTmplNameLegend = 'vote_legend.html';
|
|
|
$this->_sTmplNameByList = 'vote_by_list.html';
|
|
|
- $this->_sTmplNameDoVoteStars = 'vote_do_vote_stars.html';
|
|
|
|
|
|
if(empty(self::$_sTmplContentElementBlock))
|
|
|
self::$_sTmplContentElementBlock = $this->_oTemplate->getHtml('vote_element_block.html');
|
|
|
@@ -76,13 +56,15 @@ class BxBaseVote extends BxDolVote
|
|
|
if(empty(self::$_sTmplContentElementInline))
|
|
|
self::$_sTmplContentElementInline = $this->_oTemplate->getHtml('vote_element_inline.html');
|
|
|
|
|
|
- if(empty(self::$_sTmplContentDoVoteLikesLabel))
|
|
|
- self::$_sTmplContentDoVoteLikesLabel = $this->_oTemplate->getHtml('vote_do_vote_likes_label.html');
|
|
|
-
|
|
|
if(empty(self::$_sTmplContentCounter))
|
|
|
self::$_sTmplContentCounter = $this->_oTemplate->getHtml('vote_counter.html');
|
|
|
}
|
|
|
|
|
|
+ public function getJsClassName()
|
|
|
+ {
|
|
|
+ return $this->_sJsClsName;
|
|
|
+ }
|
|
|
+
|
|
|
public function getJsObjectName()
|
|
|
{
|
|
|
return $this->_sJsObjName;
|
|
|
@@ -95,97 +77,54 @@ class BxBaseVote extends BxDolVote
|
|
|
'sSystem' => $this->getSystemName(),
|
|
|
'iAuthorId' => $this->_getAuthorId(),
|
|
|
'iObjId' => $this->getId(),
|
|
|
- 'iLikeMode' => $this->isLikeMode() ? 1 : 0,
|
|
|
'sRootUrl' => BX_DOL_URL_ROOT,
|
|
|
'sStylePrefix' => $this->_sStylePrefix,
|
|
|
'aHtmlIds' => $this->_aHtmlIds
|
|
|
);
|
|
|
- $sCode = "var " . $this->_sJsObjName . " = new BxDolVote(" . json_encode($aParams) . ");";
|
|
|
+ $sCode = "var " . $this->getJsObjectName() . " = new " . $this->getJsClassName() . "(" . json_encode($aParams) . ");";
|
|
|
|
|
|
return $this->_oTemplate->_wrapInTagJsCode($sCode);
|
|
|
}
|
|
|
|
|
|
- public function getJsClick()
|
|
|
+ public function getJsClick($iValue = 0)
|
|
|
{
|
|
|
- if(!$this->isLikeMode())
|
|
|
- return false;
|
|
|
-
|
|
|
- return $this->getJsObjectName() . '.vote(this, ' . $this->getMaxValue() . ')';
|
|
|
+ return $this->getJsObjectName() . '.vote(this, ' . $iValue . ')';
|
|
|
}
|
|
|
|
|
|
- public function getJsClickCounter()
|
|
|
+ public function getJsClickCounter($aParams = array())
|
|
|
{
|
|
|
return $this->getJsObjectName() . '.toggleByPopup(this)';
|
|
|
}
|
|
|
|
|
|
public function getCounter($aParams = array())
|
|
|
{
|
|
|
- $sJsObject = $this->getJsObjectName();
|
|
|
-
|
|
|
$bShowEmpty = isset($aParams['show_counter_empty']) && $aParams['show_counter_empty'] == true;
|
|
|
- $bShowDoVoteAsButtonSmall = $this->_bLike && isset($aParams['show_do_vote_as_button_small']) && $aParams['show_do_vote_as_button_small'] == true;
|
|
|
- $bShowDoVoteAsButton = $this->_bLike && !$bShowDoVoteAsButtonSmall && isset($aParams['show_do_vote_as_button']) && $aParams['show_do_vote_as_button'] == true;
|
|
|
|
|
|
- $aVote = $this->_oQuery->getVote($this->getId());
|
|
|
$sClass = $this->_sStylePrefix . '-counter';
|
|
|
- if($bShowDoVoteAsButtonSmall)
|
|
|
- $sClass .= ' bx-btn-small-height';
|
|
|
- if($bShowDoVoteAsButton)
|
|
|
- $sClass .= ' bx-btn-height';
|
|
|
+ if(!empty($aParams['class_counter']))
|
|
|
+ $sClass .= $aParams['class_counter'];
|
|
|
+
|
|
|
+ $aTmplVarsAttrs = array(
|
|
|
+ array('key' => 'class', 'value' => $sClass),
|
|
|
+ array('key' => 'href', 'value' => 'javascript:void(0)'),
|
|
|
+ array('key' => 'title', 'value' => bx_html_attribute($this->_getTitleDoBy($aParams))),
|
|
|
+ array('key' => 'onclick', 'value' => 'javascript:' . $this->getJsClickCounter($aParams))
|
|
|
+ );
|
|
|
+
|
|
|
+ $sHtmlId = isset($aParams['id_counter']) ? $aParams['id_counter'] : $this->_aHtmlIds['counter'];
|
|
|
+ if(!empty($sHtmlId))
|
|
|
+ $aTmplVarsAttrs[] = array('key' => 'id', 'value' => $sHtmlId);
|
|
|
|
|
|
+ $aVote = !empty($aParams['vote']) && is_array($aParams['vote']) ? $aParams['vote'] : $this->_getVote();
|
|
|
return $this->_oTemplate->parseHtmlByContent($this->_getTmplContentCounter(), array(
|
|
|
- 'bx_repeat:attrs' => array(
|
|
|
- array('key' => 'href', 'value' => 'javascript:void(0)'),
|
|
|
- array('key' => 'id', 'value' => $this->_aHtmlIds['counter']),
|
|
|
- array('key' => 'class', 'value' => $sClass),
|
|
|
- array('key' => 'title', 'value' => _t($this->_getTitleDoBy())),
|
|
|
- array('key' => 'onclick', 'value' => 'javascript:' . $this->getJsClickCounter())
|
|
|
- ),
|
|
|
- 'content' => $bShowEmpty || (int)$aVote['count'] > 0 ? $this->_getLabelCounter($aVote['count']) : ''
|
|
|
+ 'bx_repeat:attrs' => $aTmplVarsAttrs,
|
|
|
+ 'content' => $bShowEmpty || (int)$aVote['count'] > 0 ? $this->_getLabelCounter($aVote['count'], $aParams) : ''
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Note. The Legend is available in Start based mode only.
|
|
|
- */
|
|
|
public function getLegend($aParams = array())
|
|
|
{
|
|
|
- $sJsObject = $this->getJsObjectName();
|
|
|
- $iMinValue = $this->getMinValue();
|
|
|
- $iMaxValue = $this->getMaxValue();
|
|
|
-
|
|
|
- $aLegend = $this->_oQuery->getLegend($this->_iId);
|
|
|
-
|
|
|
- $aTmplVarsItems = array();
|
|
|
- for($i = $iMaxValue; $i >= $iMinValue; $i--) {
|
|
|
- $aTmplVarsStars = $aTmplVarsSlider = array();
|
|
|
-
|
|
|
- for($j = $iMinValue; $j <= $iMaxValue; $j++) {
|
|
|
- $aTmplVarsStars[] = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'value' => $i
|
|
|
- );
|
|
|
-
|
|
|
- $aTmplVarsSlider[] = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- $aTmplVarsItems[] = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'value' => $i,
|
|
|
- 'bx_repeat:stars' => $aTmplVarsStars,
|
|
|
- 'bx_repeat:slider' => $aTmplVarsSlider,
|
|
|
- 'label' => isset($aLegend[$i]['count']) ? (int)$aLegend[$i]['count'] : 0
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- return $this->_oTemplate->parseHtmlByName($this->_sTmplNameLegend, array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'html_id' => $this->_aHtmlIds['legend_stars'],
|
|
|
- 'type' => $this->_sType,
|
|
|
- 'bx_repeat:items' => $aTmplVarsItems
|
|
|
- ));
|
|
|
+ return '';
|
|
|
}
|
|
|
|
|
|
public function getElementBlock($aParams = array())
|
|
|
@@ -204,174 +143,109 @@ class BxBaseVote extends BxDolVote
|
|
|
|
|
|
public function getElement($aParams = array())
|
|
|
{
|
|
|
- $aParams = array_merge($this->_aElementDefaults[$this->_sType], $aParams);
|
|
|
- $bDynamicMode = isset($aParams['dynamic_mode']) && $aParams['dynamic_mode'] === true;
|
|
|
-
|
|
|
- $bShowCounterEmpty = isset($aParams['show_counter_empty']) && $aParams['show_counter_empty'] == true;
|
|
|
- $bShowDoVoteAsButtonSmall = $this->_bLike && isset($aParams['show_do_vote_as_button_small']) && $aParams['show_do_vote_as_button_small'] == true;
|
|
|
- $bShowDoVoteAsButton = $this->_bLike && !$bShowDoVoteAsButtonSmall && isset($aParams['show_do_vote_as_button']) && $aParams['show_do_vote_as_button'] == true;
|
|
|
+ $sMethod = '_getTmplContentElement' . bx_gen_method_name(!empty($aParams['usage']) ? $aParams['usage'] : BX_DOL_VOTE_USAGE_DEFAULT);
|
|
|
+ if(!method_exists($this, $sMethod))
|
|
|
+ return '';
|
|
|
|
|
|
- $sMethodDoVote = '_getDoVote' . ucfirst($this->_sType);
|
|
|
- if(!method_exists($this, $sMethodDoVote))
|
|
|
+ $aTmplVars = $this->_getTmplVarsElement($aParams);
|
|
|
+ if(empty($aTmplVars) || !is_array($aTmplVars))
|
|
|
return '';
|
|
|
|
|
|
- $iObjectId = $this->getId();
|
|
|
- $iAuthorId = $this->_getAuthorId();
|
|
|
- $aVote = $this->_oQuery->getVote($iObjectId);
|
|
|
- $bCount = (int)$aVote['count'] != 0;
|
|
|
+ return $this->_oTemplate->parseHtmlByContent($this->$sMethod(), $aTmplVars);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * Internal methods.
|
|
|
+ *
|
|
|
+ * This method should be overwritten by subclass.
|
|
|
+ */
|
|
|
+ protected function _getTmplVarsElement($aParams = array())
|
|
|
+ {
|
|
|
+ $aParams = array_merge($this->_aElementDefaults, $aParams);
|
|
|
+
|
|
|
+ $bDynamicMode = isset($aParams['dynamic_mode']) && $aParams['dynamic_mode'] === true;
|
|
|
+ $bShowCounterEmpty = isset($aParams['show_counter_empty']) && $aParams['show_counter_empty'] == true;
|
|
|
+
|
|
|
+ $iObjectId = $this->getId();
|
|
|
+ $iAuthorId = $this->_getAuthorId();
|
|
|
+
|
|
|
+ $bCount = $this->_isCount();
|
|
|
$isAllowedVote = $this->isAllowedVote();
|
|
|
- $aParams['is_voted'] = $this->isPerformed($iObjectId, $iAuthorId) ? true : false;
|
|
|
+ $aParams['is_voted'] = $this->isPerformed($iObjectId, $iAuthorId);
|
|
|
+ $aParams['track'] = $aParams['is_voted'] ? $this->_getTrack($iObjectId, $iAuthorId) : array();
|
|
|
|
|
|
//--- Do Vote
|
|
|
$bTmplVarsDoVote = $this->_isShowDoVote($aParams, $isAllowedVote, $bCount);
|
|
|
$aTmplVarsDoVote = array();
|
|
|
if($bTmplVarsDoVote)
|
|
|
- $aTmplVarsDoVote = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'do_vote' => $this->$sMethodDoVote($aParams, $isAllowedVote),
|
|
|
- );
|
|
|
+ $aTmplVarsDoVote = array(
|
|
|
+ 'style_prefix' => $this->_sStylePrefix,
|
|
|
+ 'do_vote' => $this->_getDoVote($aParams, $isAllowedVote),
|
|
|
+ );
|
|
|
|
|
|
//--- Counter
|
|
|
$bTmplVarsCounter = $this->_isShowCounter($aParams, $isAllowedVote, $bCount);
|
|
|
$aTmplVarsCounter = array();
|
|
|
if($bTmplVarsCounter)
|
|
|
- $aTmplVarsCounter = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'bx_if:show_hidden' => array(
|
|
|
- 'condition' => !$bCount && !$bShowCounterEmpty,
|
|
|
- 'content' => array()
|
|
|
- ),
|
|
|
- 'counter' => $this->getCounter($aParams)
|
|
|
- );
|
|
|
-
|
|
|
- //--- Legend
|
|
|
- $bTmplVarsLegend = $this->_isShowLegend($aParams, $isAllowedVote, $bCount);
|
|
|
- $aTmplVarsLegend = array();
|
|
|
- if($bTmplVarsLegend)
|
|
|
- $aTmplVarsLegend = array(
|
|
|
- 'legend' => $this->getLegend($aParams)
|
|
|
- );
|
|
|
-
|
|
|
- if(!$bTmplVarsDoVote && !$bTmplVarsCounter && !$bTmplVarsLegend)
|
|
|
- return '';
|
|
|
-
|
|
|
- $sMethod = '_getTmplContentElement' . bx_gen_method_name(!empty($aParams['usage']) ? $aParams['usage'] : BX_DOL_VOTE_USAGE_DEFAULT);
|
|
|
- return $this->_oTemplate->parseHtmlByContent($this->$sMethod(), array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'html_id' => $this->_aHtmlIds['main_' . $this->_sType],
|
|
|
- 'class' => $this->_sStylePrefix . '-' . $this->_sType . ($bShowDoVoteAsButton ? '-button' : '') . ($bShowDoVoteAsButtonSmall ? '-button-small' : ''),
|
|
|
- 'rate' => $aVote['rate'],
|
|
|
- 'count' => $aVote['count'],
|
|
|
- 'bx_if:show_do_vote' => array(
|
|
|
- 'condition' => $bTmplVarsDoVote,
|
|
|
- 'content' => $aTmplVarsDoVote
|
|
|
- ),
|
|
|
- 'bx_if:show_counter' => array(
|
|
|
- 'condition' => $bTmplVarsCounter,
|
|
|
- 'content' => $aTmplVarsCounter
|
|
|
- ),
|
|
|
- 'bx_if:show_legend' => array(
|
|
|
- 'condition' => $bTmplVarsLegend,
|
|
|
- 'content' => $aTmplVarsLegend
|
|
|
- ),
|
|
|
- 'script' => $this->getJsScript($bDynamicMode)
|
|
|
- ));
|
|
|
- }
|
|
|
-
|
|
|
- protected function _getDoVoteStars($aParams = array(), $isAllowedVote = true)
|
|
|
- {
|
|
|
- $sJsObject = $this->getJsObjectName();
|
|
|
- $iMinValue = $this->getMinValue();
|
|
|
- $iMaxValue = $this->getMaxValue();
|
|
|
-
|
|
|
- $aTmplVarsStars = $aTmplVarsLegend = $aTmplVarsSlider = $aTmplVarsButtons = array();
|
|
|
- for($i = $iMinValue; $i <= $iMaxValue; $i++) {
|
|
|
- $aTmplVarsStars[] = array(
|
|
|
+ $aTmplVarsCounter = array(
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'value' => $i
|
|
|
+ 'bx_if:show_hidden' => array(
|
|
|
+ 'condition' => !$bCount && !$bShowCounterEmpty,
|
|
|
+ 'content' => array()
|
|
|
+ ),
|
|
|
+ 'counter' => $this->getCounter($aParams)
|
|
|
);
|
|
|
|
|
|
- $aTmplVarsLegend[] = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'value' => $i
|
|
|
+ //--- Legend
|
|
|
+ $bTmplVarsLegend = $this->_isShowLegend($aParams, $isAllowedVote, $bCount);
|
|
|
+ $aTmplVarsLegend = array();
|
|
|
+ if($bTmplVarsLegend)
|
|
|
+ $aTmplVarsLegend = array(
|
|
|
+ 'legend' => $this->getLegend($aParams)
|
|
|
);
|
|
|
|
|
|
- $aTmplVarsSlider[] = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix
|
|
|
- );
|
|
|
+ if(!$bTmplVarsDoVote && !$bTmplVarsCounter && !$bTmplVarsLegend)
|
|
|
+ return array();
|
|
|
|
|
|
- if($isAllowedVote)
|
|
|
- $aTmplVarsButtons[] = array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'js_object' => $sJsObject,
|
|
|
- 'value' => $i
|
|
|
- );
|
|
|
- }
|
|
|
+ $sClass = $this->_sStylePrefix . '-' . $this->_sType;
|
|
|
+ if(!empty($aParams['class_element']))
|
|
|
+ $sClass .= $aParams['class_element'];
|
|
|
|
|
|
- return $this->_oTemplate->parseHtmlByName($this->_sTmplNameDoVoteStars, array(
|
|
|
+ return array(
|
|
|
'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'bx_repeat:stars' => $aTmplVarsStars,
|
|
|
+ 'html_id' => $this->_aHtmlIds['main'],
|
|
|
+ 'class' => $sClass,
|
|
|
+ 'bx_if:show_vote_data' => array(
|
|
|
+ 'condition' => false,
|
|
|
+ 'content' => array()
|
|
|
+ ),
|
|
|
+ 'bx_if:show_do_vote' => array(
|
|
|
+ 'condition' => $bTmplVarsDoVote,
|
|
|
+ 'content' => $aTmplVarsDoVote
|
|
|
+ ),
|
|
|
+ 'bx_if:show_counter' => array(
|
|
|
+ 'condition' => $bTmplVarsCounter,
|
|
|
+ 'content' => $aTmplVarsCounter
|
|
|
+ ),
|
|
|
'bx_if:show_legend' => array(
|
|
|
- 'condition' => isset($aParams['show_do_vote_legend']) && $aParams['show_do_vote_legend'] === true,
|
|
|
- 'content' => array(
|
|
|
- 'style_prefix' => $this->_sStylePrefix,
|
|
|
- 'bx_repeat:legend' => $aTmplVarsLegend,
|
|
|
- )
|
|
|
+ 'condition' => $bTmplVarsLegend,
|
|
|
+ 'content' => $aTmplVarsLegend
|
|
|
),
|
|
|
- 'bx_repeat:slider' => $aTmplVarsSlider,
|
|
|
- 'bx_repeat:buttons' => $aTmplVarsButtons,
|
|
|
- ));
|
|
|
+ 'script' => $this->getJsScript($bDynamicMode)
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
- protected function _getDoVoteLikes($aParams = array(), $isAllowedVote = true)
|
|
|
+ protected function _getDoVote($aParams = array(), $isAllowedVote = true)
|
|
|
{
|
|
|
- $bVoted = isset($aParams['is_voted']) && $aParams['is_voted'] === true;
|
|
|
- $bShowDoVoteAsButtonSmall = isset($aParams['show_do_vote_as_button_small']) && $aParams['show_do_vote_as_button_small'] == true;
|
|
|
- $bShowDoVoteAsButton = !$bShowDoVoteAsButtonSmall && isset($aParams['show_do_vote_as_button']) && $aParams['show_do_vote_as_button'] == true;
|
|
|
- $bDisabled = !$isAllowedVote || ($bVoted && !$this->isUndo());
|
|
|
-
|
|
|
- $sClass = '';
|
|
|
- if($bShowDoVoteAsButton)
|
|
|
- $sClass = 'bx-btn';
|
|
|
- else if ($bShowDoVoteAsButtonSmall)
|
|
|
- $sClass = 'bx-btn bx-btn-small';
|
|
|
-
|
|
|
- if($bDisabled)
|
|
|
- $sClass .= $bShowDoVoteAsButton || $bShowDoVoteAsButtonSmall ? ' bx-btn-disabled' : 'bx-vote-disabled';
|
|
|
-
|
|
|
- return $this->_oTemplate->parseLink('javascript:void(0)', $this->_getLabelDoLike($aParams), array(
|
|
|
- 'class' => $this->_sStylePrefix . '-do-vote ' . $sClass,
|
|
|
- 'title' => _t($this->_getTitleDoLike($bVoted)),
|
|
|
- 'onclick' => !$bDisabled ? $this->getJsClick() : ''
|
|
|
- ));
|
|
|
+ return '';
|
|
|
}
|
|
|
|
|
|
- protected function _getLabelCounter($iCount)
|
|
|
+ protected function _getLabelCounter($iCount, $aParams = array())
|
|
|
{
|
|
|
return _t('_vote_counter', $iCount);
|
|
|
}
|
|
|
|
|
|
- protected function _getLabelDoLike($aParams = array())
|
|
|
- {
|
|
|
- $bVoted = isset($aParams['is_voted']) && $aParams['is_voted'] === true;
|
|
|
- return $this->_oTemplate->parseHtmlByContent(self::$_sTmplContentDoVoteLikesLabel, array(
|
|
|
- 'bx_if:show_icon' => array(
|
|
|
- 'condition' => isset($aParams['show_do_vote_icon']) && $aParams['show_do_vote_icon'] == true,
|
|
|
- 'content' => array(
|
|
|
- 'name' => $this->_getIconDoLike($bVoted)
|
|
|
- )
|
|
|
- ),
|
|
|
- 'bx_if:show_text' => array(
|
|
|
- 'condition' => isset($aParams['show_do_vote_label']) && $aParams['show_do_vote_label'] == true,
|
|
|
- 'content' => array(
|
|
|
- 'text' => _t($this->_getTitleDoLike($bVoted))
|
|
|
- )
|
|
|
- )
|
|
|
- ));
|
|
|
- }
|
|
|
-
|
|
|
- protected function _getVotedBy()
|
|
|
+ protected function _getVotedBy($aParams = array())
|
|
|
{
|
|
|
$aTmplUsers = array();
|
|
|
|
|
|
@@ -395,21 +269,17 @@ class BxBaseVote extends BxDolVote
|
|
|
|
|
|
protected function _isShowDoVote($aParams, $isAllowedVote, $bCount)
|
|
|
{
|
|
|
- $bShowDoVote = !isset($aParams['show_do_vote']) || $aParams['show_do_vote'] == true;
|
|
|
-
|
|
|
- return $bShowDoVote && (!$this->_bLike || $isAllowedVote || $bCount);
|
|
|
+ return !isset($aParams['show_do_vote']) || $aParams['show_do_vote'] == true;
|
|
|
}
|
|
|
|
|
|
protected function _isShowCounter($aParams, $isAllowedVote, $bCount)
|
|
|
{
|
|
|
- $bShowCounter = isset($aParams['show_counter']) && $aParams['show_counter'] === true;
|
|
|
-
|
|
|
- return $bShowCounter && ($isAllowedVote || $bCount);
|
|
|
+ return isset($aParams['show_counter']) && $aParams['show_counter'] === true && ($isAllowedVote || $bCount);
|
|
|
}
|
|
|
|
|
|
protected function _isShowLegend($aParams, $isAllowedVote, $bCount)
|
|
|
{
|
|
|
- return !$this->_bLike && isset($aParams['show_legend']) && $aParams['show_legend'] === true;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
protected function _getTmplContentElementBlock()
|