BxTimelineMenuPost.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 Persons Persons
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxTemplMenuInteractive');
  12. /**
  13. * 'Item' menu.
  14. */
  15. class BxTimelineMenuPost extends BxTemplMenuInteractive {
  16. protected $_oModule;
  17. public function __construct($aObject, $oTemplate = false) {
  18. parent::__construct($aObject, $oTemplate);
  19. $this->_oModule = BxDolModule::getInstance('bx_timeline');
  20. $this->addMarkers(array(
  21. 'js_object_post' => $this->_oModule->_oConfig->getJsObject('post'),
  22. ));
  23. }
  24. public function setMenuId($sMenuId)
  25. {
  26. $this->_aObject['menu_id'] = $sMenuId;
  27. }
  28. /**
  29. * Check if menu items is visible.
  30. * @param $a menu item array
  31. * @return boolean
  32. */
  33. protected function _isVisible ($a) {
  34. if(!parent::_isVisible($a))
  35. return false;
  36. $sCheckFuncName = '';
  37. $aCheckFuncParams = array();
  38. switch ($a['name']) {
  39. case 'post-text':
  40. case 'post-link':
  41. case 'post-photo':
  42. $sCheckFuncName = 'isAllowedPost';
  43. break;
  44. }
  45. if(!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName))
  46. return true;
  47. return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams);
  48. }
  49. }
  50. /** @} */