1
0

BxBaseModGroupsMenuViewActions.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 BaseGroups Base classes for groups modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * 'View group' actions menu.
  13. */
  14. class BxBaseModGroupsMenuViewActions extends BxBaseModProfileMenuViewActions
  15. {
  16. public function __construct($aObject, $oTemplate = false)
  17. {
  18. parent::__construct($aObject, $oTemplate);
  19. }
  20. public function setContentId($iContentId)
  21. {
  22. parent::setContentId($iContentId);
  23. if(!$this->_oProfile || !isLogged())
  24. return;
  25. $CNF = &$this->_oModule->_oConfig->CNF;
  26. if(isset($CNF['OBJECT_CONNECTIONS']) && ($oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])) !== false) {
  27. $iProfileId = bx_get_logged_profile_id();
  28. $iGroupProfileId = $this->_oProfile->id();
  29. $aTitles = $this->_oModule->getMenuItemTitleByConnection($CNF['OBJECT_CONNECTIONS'], '', $iGroupProfileId, $iProfileId);
  30. $aMarkers = [
  31. 'title_add_fan' => $aTitles['add'],
  32. 'onclick_add_fan' => "bx_conn_action(this, 'bx_events_fans', 'add', '" . $iGroupProfileId . "')",
  33. 'title_remove_fan' => $aTitles['remove'],
  34. ];
  35. if(!$oConn->isConnectedNotMutual($iProfileId, $iGroupProfileId) && $oConn->hasQuestionnaire($iGroupProfileId))
  36. $aMarkers['onclick_add_fan'] = $this->_oModule->_oConfig->getJsObject('entry') . ".connAction(this, 'bx_events_fans', 'add', '" . $iGroupProfileId . "')";
  37. if ($this->_oModule->isFan($this->_aContentInfo[$CNF['FIELD_ID']])) {
  38. $a = $oConn->getConnectedInitiators($iGroupProfileId);
  39. $aMarkers['recipients'] = implode(',', $a);
  40. }
  41. $this->addMarkers($aMarkers);
  42. }
  43. }
  44. }
  45. /** @} */