BxTimelineMenuItemCounters.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 Timeline Timeline
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. require_once('BxTimelineMenuItemActions.php');
  12. /**
  13. * 'Item' menu.
  14. */
  15. class BxTimelineMenuItemCounters extends BxTimelineMenuItemActions
  16. {
  17. public function __construct($aObject, $oTemplate = false)
  18. {
  19. parent::__construct($aObject, $oTemplate);
  20. $this->_sMode = self::$_sModeCounters;
  21. }
  22. protected function _getMenuItemItemComment($aItem)
  23. {
  24. if(!isset($this->_aEvent['comments']) || !is_array($this->_aEvent['comments']) || !isset($this->_aEvent['comments']['system']))
  25. return false;
  26. $sCommentsSystem = $this->_aEvent['comments']['system'];
  27. $iCommentsObject = $this->_aEvent['comments']['object_id'];
  28. $aCommentsParams = array('dynamic_mode' => $this->_bDynamicMode);
  29. switch($this->_sMode) {
  30. case self::$_sModeActions:
  31. $sCommentsMethod = 'getElementInline';
  32. $aCommentsParams['show_do_comment_label'] = $this->_bShowTitles;
  33. $aCommentsParams['show_counter'] = $this->_bShowCounters;
  34. break;
  35. case self::$_sModeCounters:
  36. $sCommentsMethod = 'getCounter';
  37. $aCommentsParams['show_counter'] = true;
  38. break;
  39. }
  40. return $this->_oModule->getCmtsObject($sCommentsSystem, $iCommentsObject)->$sCommentsMethod($aCommentsParams);
  41. }
  42. }
  43. /** @} */