BxBaseModGroupsTemplate.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. protected $_iUnitCharsSummary;
  17. function __construct(&$oConfig, &$oDb)
  18. {
  19. parent::__construct($oConfig, $oDb);
  20. $this->_iUnitCharsSummary = 50;
  21. $this->_sUnitClassWithCover .= ' bx-base-groups-unit-with-cover';
  22. $this->_sUnitClass = $this->_sUnitClassWithCover;
  23. $this->_sUnitClassWoInfo .= ' bx-base-groups-unit-wo-info';
  24. $this->_sUnitClassWoInfoShowCase .= ' bx-base-groups-unit-wo-info bx-base-groups-unit-wo-info-showcase';
  25. $this->_sUnitClassShowCase .= ' bx-base-groups-unit-with-cover bx-base-groups-unit-showcase';
  26. }
  27. function unitVars ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
  28. {
  29. $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
  30. $CNF = &$this->_oConfig->CNF;
  31. $oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']]);
  32. if (!$oProfile)
  33. $oProfile = BxDolProfileUndefined::getInstance();
  34. $aVars['title'] = (boolean)$aVars['public'] ? bx_process_output($aData[$CNF['FIELD_NAME']]) : _t($CNF['T']['txt_private_group']);
  35. $aVars['description'] = '';
  36. if(!empty($CNF['FIELD_TEXT']) && !empty($aData[$CNF['FIELD_TEXT']]) && (boolean)$aVars['public'])
  37. $aVars['description'] = strmaxtextlen(strip_tags($aData[$CNF['FIELD_TEXT']]), $this->_iUnitCharsSummary);
  38. $aVars['author'] = $oProfile->getDisplayName();
  39. $aVars['author_url'] = $oProfile->getUrl();
  40. $aVars['author_icon'] = $oProfile->getIcon();
  41. $aVars['author_thumb'] = $oProfile->getThumb();
  42. $aVars['author_avatar'] = $oProfile->getAvatar();
  43. return $aVars;
  44. }
  45. }
  46. /** @} */