BxBaseModGroupsTemplate.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. * Groups module representation.
  13. */
  14. class BxBaseModGroupsTemplate extends BxBaseModProfileTemplate
  15. {
  16. function __construct(&$oConfig, &$oDb)
  17. {
  18. parent::__construct($oConfig, $oDb);
  19. $this->_sUnitClassWithCover .= ' bx-base-groups-unit-with-cover';
  20. $this->_sUnitClass = $this->_sUnitClassWithCover;
  21. $this->_sUnitClassWoInfo .= ' bx-base-groups-unit-wo-info';
  22. }
  23. function unitVars ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
  24. {
  25. $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
  26. $CNF = &$this->_oConfig->CNF;
  27. $oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']]);
  28. if (!$oProfile)
  29. $oProfile = BxDolProfileUndefined::getInstance();
  30. $aVars['title'] = (boolean)$aVars['public'] ? bx_process_output($aData[$CNF['FIELD_NAME']]) : _t($CNF['T']['txt_private_group']);
  31. $aVars['author'] = $oProfile->getDisplayName();
  32. $aVars['author_url'] = $oProfile->getUrl();
  33. $aVars['author_icon'] = $oProfile->getIcon();
  34. $aVars['author_thumb'] = $oProfile->getThumb();
  35. $aVars['author_avatar'] = $oProfile->getAvatar();
  36. return $aVars;
  37. }
  38. }
  39. /** @} */