BxMassMailerFormEntry.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Mass mailer
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxMassMailerFormCheckerHelper extends BxDolFormCheckerHelper
  12. {
  13. static public function checkEmailOrEmpty($s)
  14. {
  15. if (trim($s) == '')
  16. return true;
  17. if (!$this->checkEmail($s))
  18. return false;
  19. return true;
  20. }
  21. }
  22. /**
  23. * Create/Edit entry form
  24. */
  25. class BxMassMailerFormEntry extends BxTemplFormView
  26. {
  27. public function __construct($aInfo, $oTemplate = false)
  28. {
  29. $this->MODULE = 'bx_massmailer';
  30. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  31. parent::__construct($aInfo, $oTemplate);
  32. $CNF = &$this->_oModule->_oConfig->CNF;
  33. if (isset( $this->aInputs[$CNF['FIELD_SEGMENTS']]))
  34. $this->aInputs[$CNF['FIELD_SEGMENTS']]['values'] = $this->_oModule->getSegments();
  35. }
  36. public function insert ($aValsToAdd = array(), $isIgnore = false)
  37. {
  38. $CNF = &$this->_oModule->_oConfig->CNF;
  39. $aValsToAdd[$CNF['FIELD_DATE_CREATED']] = time();
  40. $aValsToAdd[$CNF['FIELD_AUTHOR']] = bx_get_logged_profile_id();
  41. return parent::insert ($aValsToAdd, $isIgnore);
  42. }
  43. }
  44. /** @} */