BxBaseModTextPageAuthor.php 1.9 KB

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