BxBaseModTextPageAuthor.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 BaseText Base classes for text modules
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxTemplPage');
  12. bx_import('BxDolMenu');
  13. bx_import('BxDolProfile');
  14. /**
  15. * Profile's entries page.
  16. */
  17. class BxBaseModTextPageAuthor extends BxTemplPage
  18. {
  19. protected $_aProfileInfo;
  20. protected $_oProfile;
  21. public function __construct($aObject, $oTemplate = false)
  22. {
  23. parent::__construct($aObject, $oTemplate);
  24. // get profile info
  25. $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
  26. if ($iProfileId) {
  27. $this->_oProfile = BxDolProfile::getInstance($iProfileId);
  28. $this->_aProfileInfo = $this->_oProfile ? $this->_oProfile->getInfo() : false;
  29. }
  30. if (!$this->_aProfileInfo || !$this->_oProfile)
  31. return;
  32. // select view profile submenu
  33. $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
  34. if ($oMenuSubmenu) {
  35. $oMenuSubmenu->setObjectSubmenu('bx_persons_view_submenu', array (
  36. 'title' => $this->_oProfile->getDisplayName(),
  37. 'link' => $this->_oProfile->getUrl(),
  38. 'icon' => $this->_oProfile->getIcon(),
  39. ));
  40. }
  41. // add replaceable markers
  42. $this->addMarkers($this->_aProfileInfo); // every profile field can be used as marker
  43. $this->addMarkers(array('profile_id' => $this->_oProfile->id())); // profile id field is also suported
  44. $this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName())); // profile display name is also suported
  45. }
  46. }
  47. /** @} */