BxSitesMenuViewSite.php 1.4 KB

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