BxMailchimpAlerts.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 Mailchimp Mailchimp integration module
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. class BxMailchimpAlerts extends BxDolAlertsResponse
  12. {
  13. protected $_oModule;
  14. function __construct()
  15. {
  16. parent::__construct();
  17. $this->_oModule = BxDolModule::getInstance('bx_mailchimp');
  18. }
  19. public function response($o)
  20. {
  21. if ('system' == $o->sUnit && 'save_setting' == $o->sAction && 'bx_mailchimp_option_list_id' == $o->aExtras['option']) {
  22. $this->_oModule->serviceUpdateMergeFields();
  23. }
  24. if ('account' == $o->sUnit && 'delete' == $o->sAction) {
  25. $this->_oModule->serviceRemoveAccount($o->iObject);
  26. }
  27. if ('account' == $o->sUnit && ('edited' == $o->sAction || 'switch_context' == $o->sAction || 'confirm' == $o->sAction || 'unconfirm' == $o->sAction)) {
  28. $this->_oModule->serviceUpdateAccount($o->iObject);
  29. }
  30. if ('profile' == $o->sUnit && ('delete' == $o->sAction || 'edit' == $o->sAction || 'add' == $o->sAction)) {
  31. $oProfile = BxDolProfile::getInstanc($o->iObject);
  32. $oAccount = $oProfile ? $oProfile->getAccountObject() : null;
  33. if ($oAccount)
  34. $this->_oModule->serviceUpdateAccount($oAccount->id());
  35. }
  36. }
  37. }
  38. /** @} */