BxSitesMenuViewSite.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 Notes Notes
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxTemplMenu');
  12. /**
  13. * 'View Note' menu.
  14. */
  15. class BxSitesMenuViewSite extends BxTemplMenu
  16. {
  17. protected $_oModule;
  18. protected $_aContentInfo;
  19. public function __construct($aObject, $oTemplate = false)
  20. {
  21. parent::__construct($aObject, $oTemplate);
  22. bx_import('BxDolModule');
  23. $this->_oModule = BxDolModule::getInstance('bx_sites');
  24. $this->_aContentInfo = array();
  25. $aParams = $this->_oModule->getSelectParam();
  26. if($aParams === false)
  27. return;
  28. $this->_aContentInfo = $this->_oModule->_oDb->getAccount($aParams);
  29. if ($this->_aContentInfo)
  30. $this->addMarkers(array('content_id' => $this->_aContentInfo['id']));
  31. }
  32. /**
  33. * Check if menu items is visible.
  34. * @param $a menu item array
  35. * @return boolean
  36. */
  37. protected function _isVisible ($a)
  38. {
  39. if(empty($this->_aContentInfo))
  40. return false;
  41. $sMsg = $this->_oModule->isAllowedView($this->_aContentInfo);
  42. if($sMsg !== CHECK_ACTION_RESULT_ALLOWED)
  43. return false;
  44. return true;
  45. }
  46. protected function _addJsCss() {
  47. parent::_addJsCss();
  48. $this->_oModule->_oTemplate->addJs('forms.js');
  49. }
  50. }
  51. /** @} */