BxDolVoteLikes.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. /**
  10. * Like based votes for any content
  11. */
  12. class BxDolVoteLikes extends BxTemplVote
  13. {
  14. public function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
  15. {
  16. parent::__construct($sSystem, $iId, $iInit, $oTemplate);
  17. $this->_oQuery = new BxDolVoteLikesQuery($this);
  18. $this->_sType = BX_DOL_VOTE_TYPE_LIKES;
  19. }
  20. /**
  21. * Interface functions for outer usage
  22. */
  23. public function getValue()
  24. {
  25. return (int)$this->_aSystem['min_value'];
  26. }
  27. /**
  28. * Internal functions
  29. */
  30. protected function _isDuplicate($iObjectId, $iAuthorId, $iAuthorIp, $bVoted)
  31. {
  32. return $bVoted && !$this->isUndo();
  33. }
  34. protected function _getIconDo($bVoted)
  35. {
  36. return $bVoted && $this->isUndo() ? 'thumbs-up' : 'thumbs-up';
  37. }
  38. protected function _getTitleDo($bVoted)
  39. {
  40. return $bVoted && $this->isUndo() ? '_vote_do_unlike' : '_vote_do_like';
  41. }
  42. }
  43. /** @} */