BxTasksAlertsResponse.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. * @defgroup Tasks Tasks
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. class BxTasksAlertsResponse extends BxBaseModTextAlertsResponse
  11. {
  12. public function __construct()
  13. {
  14. $this->MODULE = 'bx_tasks';
  15. parent::__construct();
  16. }
  17. public function response($oAlert)
  18. {
  19. parent::response($oAlert);
  20. if(($sMethod = '_process' . bx_gen_method_name($oAlert->sUnit . '_' . $oAlert->sAction)) && method_exists($this, $sMethod))
  21. $this->$sMethod($oAlert);
  22. }
  23. protected function _processProfileSearchByTerm($oAlert)
  24. {
  25. $sName = $oAlert->aExtras['params']['name'] ?? '';
  26. if($sName == $this->MODULE . '_initial_members' && ($oContext = BxDolProfile::getInstance((int)$oAlert->aExtras['params']['context_pid'])) !== false) {
  27. $aIds = bx_srv($oContext->getModule(), 'fans', [$oContext->getContentId(), true]);
  28. $oAlert->aExtras['where'] .= " AND `p`.`id` IN (" . $this->_oModule->_oDb->implode_escape($aIds) . ")";
  29. }
  30. }
  31. }
  32. /** @} */