1
0

BxBaseModGroupsMenuViewMeta.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 entry meta menu
  13. */
  14. class BxBaseModGroupsMenuViewMeta extends BxBaseModProfileMenuViewMeta
  15. {
  16. public function __construct($aObject, $oTemplate = false)
  17. {
  18. parent::__construct($aObject, $oTemplate);
  19. }
  20. protected function _getMenuItemMembers($aItem)
  21. {
  22. $CNF = &$this->_oModule->_oConfig->CNF;
  23. if(!$this->_bContentPublic || !$this->_oContentProfile || empty($CNF['OBJECT_CONNECTIONS']))
  24. return false;
  25. $oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
  26. if(!$oConnection)
  27. return false;
  28. $iContentProfileId = $this->_oContentProfile->id();
  29. if($this->_bIsApi) {
  30. $aCounter = $oConnection->getCounterAPI($iContentProfileId, false, ['caption' => $aItem['title']], BX_CONNECTIONS_CONTENT_TYPE_INITIATORS);
  31. return $this->_getMenuItemAPI($aItem, ['display' => 'button'], [
  32. 'title' => $aCounter['countf'],
  33. ]);
  34. }
  35. $sIcon = BxTemplFunctions::getInstanceWithTemplate($this->_oTemplate)->getIconAsHtml(!empty($aItem['icon']) ? $aItem['icon'] : '');
  36. return $oConnection->getCounter($iContentProfileId, true, ['caption' => $aItem['title'], 'custom_icon' => $sIcon], BX_CONNECTIONS_CONTENT_TYPE_INITIATORS);
  37. }
  38. }
  39. /** @} */