BxAdsFormsEntryHelper.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 Ads Ads
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Entry forms helper functions
  13. */
  14. class BxAdsFormsEntryHelper extends BxBaseModTextFormsEntryHelper
  15. {
  16. public function __construct($oModule)
  17. {
  18. parent::__construct($oModule);
  19. }
  20. public function getObjectFormAdd($sDisplay = false)
  21. {
  22. if(($sCategoryDisplay = $this->_oModule->getCategoryDisplay('add')) !== false)
  23. $sDisplay = $sCategoryDisplay;
  24. return parent::getObjectFormAdd($sDisplay);
  25. }
  26. public function onDataAddAfter($iAccountId, $iContentId)
  27. {
  28. $s = parent::onDataAddAfter($iAccountId, $iContentId);
  29. if(!empty($s))
  30. return $s;
  31. $this->_oModule->serviceUpdateCategoriesStats();
  32. return '';
  33. }
  34. public function onDataEditAfter($iContentId, $aContentInfo, $aTrackTextFieldsChanges, $oProfile, $oForm)
  35. {
  36. $s = parent::onDataEditAfter($iContentId, $aContentInfo, $aTrackTextFieldsChanges, $oProfile, $oForm);
  37. if(!empty($s))
  38. return $s;
  39. $this->_oModule->serviceUpdateCategoriesStats();
  40. return '';
  41. }
  42. public function onDataDeleteAfter ($iContentId, $aContentInfo, $oProfile)
  43. {
  44. $s = parent::onDataDeleteAfter ($iContentId, $aContentInfo, $oProfile);
  45. if(!empty($s))
  46. return $s;
  47. $this->_oModule->serviceUpdateCategoriesStats();
  48. return '';
  49. }
  50. }
  51. /** @} */