BxBaseModGeneralMenuManageTools.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 $MODULE;
  17. protected $_oModule;
  18. protected $_iContentId;
  19. protected $_aContentInfo;
  20. public function __construct($aObject, $oTemplate = false)
  21. {
  22. parent::__construct($aObject, $oTemplate);
  23. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  24. $this->_iContentId = 0;
  25. $this->_aContentInfo = array();
  26. if(bx_get('content_id') !== false)
  27. $this->setContentId(bx_get('content_id'));
  28. $this->addMarkers(array(
  29. 'js_object' => $this->_oModule->_oConfig->getJsObject('manage_tools')
  30. ));
  31. }
  32. public function setContentId($iContentId)
  33. {
  34. $this->_iContentId = (int)$iContentId;
  35. if(!empty($this->_iContentId)) {
  36. $this->_aContentInfo = $this->_getContentInfo($this->_iContentId);
  37. $this->addMarkers(array(
  38. 'content_id' => $this->_iContentId
  39. ));
  40. }
  41. }
  42. protected function _getContentInfo($iContentId)
  43. {
  44. return !empty($this->_oModule) && method_exists($this->_oModule->_oDb, 'getContentInfoById') ? $this->_oModule->_oDb->getContentInfoById($iContentId) : array();
  45. }
  46. }
  47. /** @} */