| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
- * CC-BY License - http://creativecommons.org/licenses/by/3.0/
- *
- * @defgroup Invites Invites
- * @ingroup DolphinModules
- *
- * @{
- */
- bx_import('BxDolModule');
- bx_import('BxDolAlertsResponse');
- class BxInvResponse extends BxDolAlertsResponse
- {
- protected $_sModule;
- protected $_oModule;
- public function __construct()
- {
- parent::__construct();
- $this->_sModule = 'bx_invites';
- $this->_oModule = BxDolModule::getInstance($this->_sModule);
- }
- /**
- * Overwtire the method of parent class.
- *
- * @param BxDolAlerts $oAlert an instance of alert.
- */
- public function response($oAlert)
- {
- if($oAlert->sUnit != 'account' || !in_array($oAlert->sAction, array('add_form', 'added')))
- return;
- $sMethod = '_process' . bx_gen_method_name($oAlert->sUnit . '_' . $oAlert->sAction);
- if(!method_exists($this, $sMethod))
- return;
- return $this->$sMethod($oAlert);
- }
- protected function _processAccountAddForm($oAlert)
- {
- bx_import('BxDolSession');
- $oSession = BxDolSession::getInstance();
- $sKeyCode = $this->_oModule->_oConfig->getKeyCode();
- if(bx_get($sKeyCode) !== false) {
- $sKey = bx_process_input(bx_get($sKeyCode));
- bx_import('BxDolKey');
- $oKeys = BxDolKey::getInstance();
- if($oKeys && $oKeys->isKeyExists($sKey))
- $oSession->setValue($sKeyCode, $sKey);
- }
- $sKey = $oSession->getValue($sKeyCode);
- if($sKey === false)
- $oAlert->aExtras['form_code'] = $this->_oModule->_oTemplate->getBlockRequest();
- return;
- }
- protected function _processAccountAdded($oAlert)
- {
- $sKeyCode = $this->_oModule->_oConfig->getKeyCode();
- bx_import('BxDolSession');
- $sKey = BxDolSession::getInstance()->getUnsetValue($sKeyCode);
- if($sKey === false)
- return;
- bx_import('BxDolKey');
- $oKeys = BxDolKey::getInstance();
- if($oKeys && $oKeys->isKeyExists($sKey))
- $oKeys->removeKey($sKey);
- return;
- }
- }
- /** @} */
|