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