BxBaseModNotificationsInstaller.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 BaseNotifications Base classes for Notifications like modules
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxBaseModGeneralInstaller');
  12. class BxBaseModNotificationsInstaller extends BxBaseModGeneralInstaller
  13. {
  14. function __construct($aConfig)
  15. {
  16. parent::__construct($aConfig);
  17. }
  18. public function enable($aParams)
  19. {
  20. $aResult = parent::enable($aParams);
  21. if($aResult['result'])
  22. $this->_processHandlers('add_handlers');
  23. return $aResult;
  24. }
  25. public function disable($aParams)
  26. {
  27. $this->_processHandlers('delete_handlers');
  28. return parent::disable($aParams);
  29. }
  30. protected function _processHandlers($sAction)
  31. {
  32. $aModules = $this->oDb->getModules();
  33. foreach($aModules as $aModule) {
  34. $aConfig = self::getModuleConfig($aModule);
  35. if(!empty($aConfig['connections']) && is_array($aConfig['connections']) && in_array($this->_aConfig['name'], $aConfig['connections']))
  36. BxDolService::call($this->_aConfig['name'], $sAction, array($aModule['uri']));
  37. }
  38. }
  39. }
  40. /** @} */