|
|
@@ -49,23 +49,31 @@ class BxBaseModGroupsPageEntry extends BxBaseModProfilePageEntry
|
|
|
$sRv = '';
|
|
|
if (bx_get('key')){
|
|
|
$sKey = bx_get('key');
|
|
|
- $this->_oTemplate->addJs(array('invite_popup.js'));
|
|
|
$sId = $this->_oModule->getName() . '_popup_invite';
|
|
|
|
|
|
- $sContent = $this->_oModule->_oTemplate->parseHtmlByName('popup_invite.html', array(
|
|
|
- 'PopupId' => $sId
|
|
|
- ));
|
|
|
-
|
|
|
- $sRv = $this->_oModule->_oTemplate->getJsCode('invite_popup', array(
|
|
|
- 'sPopupId' => $sId,
|
|
|
- 'sKey' => $sKey,
|
|
|
- 'sAcceptUrl' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $this->_aProfileInfo['content_id']),
|
|
|
- 'sDeclineUrl' => BX_DOL_URL_ROOT,
|
|
|
- 'iGroupProfileId' => $this->_oProfile->id(),
|
|
|
- )) . BxTemplFunctions::getInstance()->popupBox($sId, _t($CNF['T']['txt_invitation_popup_title']), $sContent, true);
|
|
|
+ $aData = $this->_oModule->_oDb->getInviteByKey($sKey, $this->_oProfile->id());
|
|
|
+ if (!isset($aData['invited_profile_id'])){
|
|
|
+ $sRv = _t('_bx_groups_txt_invite_popup_error_invitation_absent');
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if ($aData['invited_profile_id'] != bx_get_logged_profile_id()){
|
|
|
+ $sRv = _t('_bx_groups_txt_invite_popup_error_invitation_wrong_user');
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ $sRv = $this->_oModule->_oTemplate->parseHtmlByName('popup_invite.html', array(
|
|
|
+ 'PopupId' => $sId
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- return $sRv . parent::getCode();
|
|
|
+ $this->_oTemplate->addJs(array('invite_popup.js'));
|
|
|
+ return ($sRv != '' ? $this->_oModule->_oTemplate->getJsCode('invite_popup', array(
|
|
|
+ 'sPopupId' => $sId,
|
|
|
+ 'sKey' => $sKey,
|
|
|
+ 'sAcceptUrl' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $this->_aProfileInfo['content_id']),
|
|
|
+ 'sDeclineUrl' => BX_DOL_URL_ROOT,
|
|
|
+ 'iGroupProfileId' => $this->_oProfile->id(),
|
|
|
+ )) . BxTemplFunctions::getInstance()->popupBox($sId, _t($CNF['T']['txt_invitation_popup_title']), $sRv, true) : '').parent::getCode();
|
|
|
}
|
|
|
}
|
|
|
|