BxTemplServiceProfiles.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 UnaTemplate UNA Template Classes
  7. * @{
  8. */
  9. /**
  10. * @see BxBaseServiceProfiles
  11. */
  12. class BxTemplServiceProfiles extends BxBaseServiceProfiles
  13. {
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. public function serviceProfileStats ($iProfileId = 0)
  19. {
  20. if (!$iProfileId && !($iProfileId = bx_get_logged_profile_id()))
  21. return '';
  22. $oProfile = BxDolProfile::getInstance($iProfileId);
  23. if(!$oProfile)
  24. return '';
  25. $oAcl = BxDolAcl::getInstance();
  26. $aAcl = $oAcl->getMemberMembershipInfo($iProfileId);
  27. $aAclInfo = $oAcl->getMembershipInfo($aAcl['id']);
  28. list ($sIcon, $sIconUrl, $sIconA, $sIconHtml) = $this->_getIcon($aAclInfo['icon']);
  29. $aVars = array(
  30. 'profile_id' => $oProfile->id(),
  31. 'profile_url' => $oProfile->getUrl(),
  32. 'profile_edit_url' => $oProfile->getEditUrl(),
  33. 'profile_title' => $oProfile->getDisplayName(),
  34. 'profile_title_attr' => bx_html_attribute($oProfile->getDisplayName()),
  35. 'profile_ava_url' => $oProfile->getAvatar(),
  36. 'profile_unit' => $oProfile->getUnit(0, array('template' => array(
  37. 'name' => 'unit_wo_info',
  38. 'size' => 'thumb'
  39. ))),
  40. 'profile_acl_title' => _t($aAclInfo['name']),
  41. 'menu' => BxDolMenu::getObjectInstance('sys_profile_stats')->getCode(),
  42. );
  43. $aVars['bx_if:image'] = array (
  44. 'condition' => (bool)$sIconUrl,
  45. 'content' => array('icon_url' => $sIconUrl),
  46. );
  47. $aVars['bx_if:image_inline'] = array (
  48. 'condition' => false,
  49. 'content' => array('image' => ''),
  50. );
  51. $aVars['bx_if:icon'] = array (
  52. 'condition' => (bool)$sIcon,
  53. 'content' => array('icon' => $sIcon),
  54. );
  55. $aVars['bx_if:icon-html'] = array (
  56. 'condition' => (bool)$sIconHtml,
  57. 'content' => array('icon' => $sIconHtml),
  58. );
  59. $aVars['bx_if:icon-a'] = array (
  60. 'condition' => (bool)$sIconA,
  61. 'content' => array('icon-a' => $sIconA),
  62. );
  63. return BxDolTemplate::getInstance()->parseHtmlByName('profile_stats.html', $aVars);
  64. }
  65. }
  66. /** @} */