BxBaseCmtsServices.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Dolphin Core
  7. * @{
  8. */
  9. /**
  10. * System services related to Comments.
  11. */
  12. class BxBaseCmtsServices extends BxDol
  13. {
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. public function serviceGetMenuItemAddonVote($sSystem, $iId, $iCmtId)
  19. {
  20. bx_import('BxDolCmts');
  21. $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId);
  22. $oVote = $oCmts->getVoteObject($iCmtId);
  23. if($oVote !== false)
  24. return $oVote->getCounter();
  25. return '';
  26. }
  27. public function serviceGetLiveUpdatesComments($sSystem, $iContentId, $iProfileId)
  28. {
  29. bx_import('BxDolCmts');
  30. $oCmts = BxDolCmts::getObjectInstance($sSystem, $iContentId);
  31. if(!$oCmts || !$oCmts->isEnabled())
  32. return false;
  33. return array(
  34. 'count' => $oCmts->getCommentsCount($iContentId, 0, BX_CMT_FILTER_OTHERS), // required
  35. 'method' => $oCmts->getJsObjectName() . '.showLiveUpdate(oData)', // required
  36. 'data' => array(
  37. 'code' => $oCmts->getNotification()
  38. ), // optional, may have some additional data to be passed in JS method provided using 'method' param above.
  39. );
  40. }
  41. }
  42. /** @} */