BxGroupsTemplate.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. * Groups module representation.
  13. */
  14. class BxGroupsTemplate extends BxBaseModProfileTemplate
  15. {
  16. function __construct(&$oConfig, &$oDb)
  17. {
  18. $this->MODULE = 'bx_groups';
  19. parent::__construct($oConfig, $oDb);
  20. }
  21. function unitVars ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
  22. {
  23. $CNF = &$this->_oConfig->CNF;
  24. $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
  25. $oConn = BxDolConnection::getObjectInstance('bx_groups_fans');
  26. $aVars['cover_url'] = $this->urlCover ($aData, true);
  27. $aVars['members'] = _t('_bx_groups_txt_N_fans', $oConn ? $oConn->getConnectedInitiatorsCount($aData[$CNF['FIELD_ID']], true) : 0);
  28. $aVars['bx_if:btn'] = array (
  29. 'condition' => isLogged() && !$oConn->isConnected(bx_get_logged_profile_id(), $aData[$CNF['FIELD_ID']], true),
  30. 'content' => array (
  31. 'id' => $aData[$CNF['FIELD_ID']],
  32. 'title' => $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $aData[$CNF['FIELD_ID']]) ? _t('_bx_groups_menu_item_title_become_fan_sent') : _t('_bx_groups_menu_item_title_become_fan'),
  33. 'object' => 'bx_groups_fans'
  34. ),
  35. );
  36. return $aVars;
  37. }
  38. }
  39. /** @} */