BxBaseModGeneralMenuManageTools.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 BaseGeneral Base classes for modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Manage tools submenu
  13. */
  14. class BxBaseModGeneralMenuManageTools extends BxTemplMenu
  15. {
  16. protected $_oModule;
  17. protected $_iContentId;
  18. protected $_aContentInfo;
  19. public function __construct($aObject, $oTemplate = false)
  20. {
  21. parent::__construct($aObject, $oTemplate);
  22. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  23. $this->_iContentId = 0;
  24. $this->_aContentInfo = array();
  25. if(bx_get('content_id') !== false)
  26. $this->setContentId(bx_get('content_id'));
  27. $this->addMarkers(array(
  28. 'js_object' => $this->_oModule->_oConfig->getJsObject('manage_tools')
  29. ));
  30. }
  31. public function setContentId($iContentId)
  32. {
  33. $this->_iContentId = (int)$iContentId;
  34. if(!empty($this->_iContentId)) {
  35. $this->_aContentInfo = $this->_getContentInfo($this->_iContentId);
  36. $this->addMarkers(array(
  37. 'content_id' => $this->_iContentId
  38. ));
  39. }
  40. }
  41. protected function _getContentInfo($iContentId)
  42. {
  43. return !empty($this->_oModule) && method_exists($this->_oModule->_oDb, 'getContentInfoById') ? $this->_oModule->_oDb->getContentInfoById($iContentId) : array();
  44. }
  45. }
  46. /** @} */