BxBaseModNotificationsInstaller.php 1.2 KB

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