BxGroupsFormsEntryHelper.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Groups Groups
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Group profile forms functions
  13. */
  14. class BxGroupsFormsEntryHelper extends BxBaseModProfileFormsEntryHelper
  15. {
  16. public function __construct($oModule)
  17. {
  18. parent::__construct($oModule);
  19. }
  20. protected function _processPermissionsCheckForViewDataForm ($aContentInfo, $oProfile)
  21. {
  22. $sMsg = parent::_processPermissionsCheckForViewDataForm ($aContentInfo, $oProfile);
  23. if ($sMsg && 'c' == $aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ALLOW_VIEW_TO']])
  24. return '';
  25. return $sMsg;
  26. }
  27. public function onDataAddAfter ($iAccountId, $iContentId)
  28. {
  29. if ($s = parent::onDataAddAfter($iAccountId, $iContentId))
  30. return $s;
  31. // insert invited members, so they will join without confirmation
  32. $aInitialProfiles = bx_get('initial_members');
  33. foreach ($aInitialProfiles as $iProfileId) {
  34. if (!($oProfile = BxDolProfile::getInstance($iProfileId)))
  35. continue;
  36. $this->_oModule->serviceAddMutualConnection ($iContentId, $oProfile->id(), true);
  37. }
  38. return '';
  39. }
  40. }
  41. /** @} */