BxForumMenuView.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 Forum Forum
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * View entry menu
  13. */
  14. class BxForumMenuView extends BxBaseModTextMenuView
  15. {
  16. public function __construct($aObject, $oTemplate = false)
  17. {
  18. $this->MODULE = 'bx_forum';
  19. parent::__construct($aObject, $oTemplate);
  20. $this->addMarkers(array(
  21. 'js_object' => $this->_oModule->_oConfig->getJsObject('entry')
  22. ));
  23. }
  24. /**
  25. * Check if menu items is visible.
  26. * @param $a menu item array
  27. * @return boolean
  28. */
  29. protected function _isVisible ($a)
  30. {
  31. if(!parent::_isVisible($a))
  32. return false;
  33. $sCheckFuncName = '';
  34. $aCheckFuncParams = array();
  35. switch ($a['name']) {
  36. case 'more':
  37. $sCheckFuncName = '_isVisibleMore';
  38. break;
  39. }
  40. if(!$sCheckFuncName || !method_exists($this, $sCheckFuncName))
  41. return true;
  42. return call_user_func_array(array($this, $sCheckFuncName), $aCheckFuncParams) === true;
  43. }
  44. protected function _isVisibleMore()
  45. {
  46. $CNF = &$this->_oModule->_oConfig->CNF;
  47. $oMenu = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']);
  48. $oMenu->setContentId($this->_iContentId);
  49. return $oMenu->isVisible();
  50. }
  51. }
  52. /** @} */