1
0

BxBaseModGroupsPageEntry.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 BaseGroups Base classes for groups modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Profile create/edit/delete pages.
  13. */
  14. class BxBaseModGroupsPageEntry extends BxBaseModProfilePageEntry
  15. {
  16. public function __construct($aObject, $oTemplate = false)
  17. {
  18. parent::__construct($aObject, $oTemplate);
  19. $this->_sCoverClass = 'bx-base-group-cover-wrapper ' . $this->_oModule->getName() . '_cover';
  20. }
  21. protected function _processPermissionsCheck ()
  22. {
  23. $CNF = &$this->_oModule->_oConfig->CNF;
  24. $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
  25. $mixedAllowView = $this->_oModule->checkAllowedView($this->_aContentInfo);
  26. if (!$oPrivacy->isPartiallyVisible($this->_aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $mixedAllowView)) {
  27. $this->_oTemplate->displayAccessDenied($sMsg);
  28. exit;
  29. }
  30. elseif ($oPrivacy->isPartiallyVisible($this->_aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && $CNF['OBJECT_PAGE_VIEW_ENTRY'] == $this->_sObject && CHECK_ACTION_RESULT_ALLOWED !== $mixedAllowView) {
  31. // replace current page with different set of blocks
  32. $aObject = BxDolPageQuery::getPageObject($CNF['OBJECT_PAGE_VIEW_ENTRY_CLOSED']);
  33. $this->_sObject = $aObject['object'];
  34. $this->_aObject = $aObject;
  35. $this->_oQuery = new BxDolPageQuery($this->_aObject);
  36. }
  37. $this->_oModule->checkAllowedView($this->_aContentInfo, true);
  38. }
  39. public function getCode ()
  40. {
  41. $CNF = &$this->_oModule->_oConfig->CNF;
  42. $sRv = '';
  43. $sKey = '';
  44. if(!empty($CNF['TABLE_INVITES']) && ($sKey = bx_get('key')) !== false) {
  45. $sId = $this->_oModule->getName() . '_popup_invite';
  46. $mixedInvited = $this->_oModule->isInvited($sKey, $this->_oProfile->id());
  47. if ($mixedInvited === true) {
  48. $sRv = $this->_oModule->_oTemplate->parseHtmlByName('popup_invite.html', array(
  49. 'popup_id' => $sId,
  50. 'text' => _t($CNF['T']['txt_invitation_popup_text']),
  51. 'button_accept' => _t($CNF['T']['txt_invitation_popup_accept_button']),
  52. 'button_decline' => _t($CNF['T']['txt_invitation_popup_decline_button']),
  53. ));
  54. }
  55. else
  56. $sRv = $mixedInvited;
  57. }
  58. $this->_oTemplate->addJs(array('invite_popup.js'));
  59. return ($sRv != '' ? $this->_oModule->_oTemplate->getJsCode('invite_popup', array(
  60. 'sPopupId' => $sId,
  61. 'sKey' => $sKey,
  62. 'sAcceptUrl' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $this->_aProfileInfo['content_id']),
  63. 'sDeclineUrl' => BX_DOL_URL_ROOT,
  64. 'iGroupProfileId' => $this->_oProfile->id(),
  65. )) . BxTemplFunctions::getInstance()->popupBox($sId, _t($CNF['T']['txt_invitation_popup_title']), $sRv, true) : '') . parent::getCode();
  66. }
  67. }
  68. /** @} */