BxInvTemplate.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 Invites Invites
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolModuleTemplate');
  12. class BxInvTemplate extends BxDolModuleTemplate
  13. {
  14. function __construct(&$oConfig, &$oDb)
  15. {
  16. parent::__construct($oConfig, $oDb);
  17. }
  18. public function getBlockRequestText($aRequest)
  19. {
  20. return $this->parseHtmlByName('request_text.html', array(
  21. 'style_prefix' => $this->_oConfig->getPrefix('style'),
  22. 'text' => bx_process_output(nl2br($aRequest['text']), BX_DATA_TEXT_MULTILINE),
  23. ));
  24. }
  25. public function getBlockInvite($iAccountId, $iProfileId)
  26. {
  27. $iInvites = $this->_oConfig->getCountPerUser();
  28. $iInvited = $this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
  29. bx_import('BxDolPermalinks');
  30. $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oConfig->CNF['URL_INVITE']);
  31. $this->addCss(array('main.css'));
  32. return $this->parseHtmlByName('block_invite.html', array(
  33. 'style_prefix' => $this->_oConfig->getPrefix('style'),
  34. 'text' => _t('_bx_invites_txt_invite_block_text', $iInvites - $iInvited),
  35. 'url' => $sUrl
  36. ));
  37. }
  38. public function getBlockRequest()
  39. {
  40. bx_import('BxDolPermalinks');
  41. $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oConfig->CNF['URL_REQUEST']);
  42. $this->addCss(array('main.css'));
  43. return $this->parseHtmlByName('block_request.html', array(
  44. 'style_prefix' => $this->_oConfig->getPrefix('style'),
  45. 'text' => _t('_bx_invites_txt_request_block_text'),
  46. 'bx_if:show_button_request' => array(
  47. 'condition' => $this->_oConfig->isRequestInvite(),
  48. 'content' => array(
  49. 'url' => $sUrl
  50. )
  51. )
  52. ));
  53. }
  54. }
  55. /** @} */