BxBaseModGeneralMenuManageTools.php 1.5 KB

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