1
0

BxBaseModProfileMenuView.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 BaseProfile Base classes for profile modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * View profile entry menu
  13. */
  14. class BxBaseModProfileMenuView extends BxBaseModGeneralMenuView
  15. {
  16. protected $_oProfile;
  17. protected $_aContentInfo;
  18. protected $_aProfileInfo;
  19. public function __construct($aObject, $oTemplate = false)
  20. {
  21. parent::__construct($aObject, $oTemplate);
  22. $CNF = $this->_oModule->_oConfig->CNF;
  23. $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
  24. $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
  25. if ($iProfileId)
  26. $this->_oProfile = BxDolProfile::getInstance($iProfileId);
  27. if (!$this->_oProfile && $iContentId)
  28. $this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE);
  29. if ($this->_oProfile) {
  30. $this->_aProfileInfo = $this->_oProfile->getInfo();
  31. $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']);
  32. $this->addMarkers($this->_aProfileInfo);
  33. $this->addMarkers(array('profile_id' => $this->_oProfile->id()));
  34. $aTitles = $this->_oModule->serviceGetConnectionButtonsTitles($this->_oProfile->id());
  35. if ($aTitles) {
  36. $this->addMarkers(array(
  37. 'title_add_friend' => $aTitles['add'],
  38. 'title_remove_friend' => $aTitles['remove'],
  39. ));
  40. }
  41. }
  42. }
  43. }
  44. /** @} */