22 parent::__construct( $sSystem,
$iId, $iInit );
30 return $this->
getVoting(
'small', 0, array(
32 'can_rate' => $iCanRate,
33 'override_rate' => $iRateOverride
44 'can_rate' => $iCanRate,
45 'override_rate' => $iRateOverride
51 return $this->
getVoting(
'small', $iObjectId, array(
52 'show_count' =>
false,
53 'can_rate' => $iCanRate,
54 'override_rate' => $iRateOverride
62 $iWidth = $iSizeX * $iMax;
65 $iObjectId = $this->
getId();
67 $sHtmlId = $this->_sSystem .
'_voting_' .
$sType .
'_' . $iObjectId;
70 $sRet =
'<div class="votes_'.$sType.
'" id="' . $sHtmlId .
'">';
72 $iCanRate = !
empty($aParams[
'can_rate']);
75 'sSystem' => $this->_sSystem,
76 'iObjId' => $iObjectId,
77 'sBaseUrl' => CH_WSB_URL_ROOT,
80 'sHtmlId' => $sHtmlId,
82 $sRet .=
$GLOBALS[
'oSysTemplate']->_wrapInTagJsCode(
'var ' . $sJsObject .
' = new ChWsbVoting(' . json_encode($aJsParams) .
');');
85 $sRet .=
'<div class="votes_gray_'.$sType.
'" style="width:' . $iWidth .
'px;">';
89 $sRet .=
'<div class="votes_buttons">';
90 for ($i=1 ; $i<=$iMax ; ++$i)
91 $sRet .=
'<a href="javascript:void(0);" onmouseover="' . $sJsObject .
'.over(' . $i .
');" onmouseout="' . $sJsObject .
'.out();" onclick="' . $sJsObject .
'.vote(' . $i .
')"><i class="votes_button_' .
$sType .
' sys-icon"></i></a>';
96 $sRet .=
'<div class="votes_gray_'.$sType.
'" style="width:' . $iWidth .
'px;">';
97 for ($i=1 ; $i<=$iMax ; ++$i)
98 $sRet .=
'<i class="votes_button_'.
$sType.
' sys-icon star-o"></i>';
102 $iVoteRate = !
empty($aParams[
'override_rate']) ? (int)$aParams[
'override_rate'] : $this->
getVoteRate();
103 $sRet .=
'<div class="votes_slider votes_active_'.$sType.
'" style="width:' . round($iVoteRate * ($iMax ? $iWidth / $iMax : 0)) .
'px;">';
104 for ($i=1 ; $i<=$iMax ; ++$i)
105 $sRet .=
'<i class="votes_button_'.
$sType.
' sys-icon star"></i>';
111 if (!
empty($aParams[
'show_count']))
112 $sRet .=
'<span class="votes_count">' .
_t(
'_n_votes', $this->
getVoteCount()) .
'</span>';
114 $sRet .=
'<div class="clear_both"></div>';
122 $GLOBALS[
'oSysTemplate']->addJs(
'ChWsbVoting.js');
131 $aResult = array($this->_iSizeStarSmallX, $this->_iSizeStarSmallY);
135 $aResult = array($this->_iSizeStarBigX, $this->_iSizeStarBigY);