BxIntercomAlerts.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 Intercom Intercom integration module
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. class BxIntercomAlerts extends BxDolAlertsResponse
  12. {
  13. protected $_oModule;
  14. function __construct()
  15. {
  16. parent::__construct();
  17. $this->_oModule = BxDolModule::getInstance('bx_intercom');
  18. }
  19. public function response($o)
  20. {
  21. if ('account' == $o->sUnit && 'delete' == $o->sAction) {
  22. $this->_oModule->serviceRemoveAccount($o->iObject);
  23. }
  24. if ('account' != $o->sUnit && ('deleted' == $o->sAction || 'edited' == $o->sAction || 'added' == $o->sAction)) {
  25. $oProfile = BxDolProfile::getInstanceByContentAndType($o->iObject, $o->sUnit);
  26. $oAccount = $oProfile ? $oProfile->getAccountObject() : null;
  27. if ($oAccount)
  28. $this->_oModule->serviceUpdateAccount($oAccount->id());
  29. }
  30. }
  31. }
  32. /** @} */