| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup Credits Credits
- * @ingroup UnaModules
- *
- * @{
- */
- require_once('BxCreditsGridWithdrawalsAdministration.php');
- class BxCreditsGridWithdrawalsCommon extends BxCreditsGridWithdrawalsAdministration
- {
- public function __construct ($aOptions, $oTemplate = false)
- {
- parent::__construct ($aOptions, $oTemplate);
- }
- public function performActionWithdrawRequest()
- {
- if(!$this->_bWithdraw)
- return $this->_bIsApi ? [] : echoJson([]);
- $sAction = 'withdraw_request';
- return $this->_performActionWithProfileAmount($sAction);
- }
- public function performActionWithdrawCancel()
- {
- if(!$this->_bWithdraw)
- return $this->_bIsApi ? [] : echoJson([]);
- $sAction = 'withdraw_cancel';
- $iId = $this->_getId();
- if(!$iId)
- return $this->_bIsApi ? [] : echoJson([]);
- $aResult = $this->_oModule->processWithdrawCancel($iId);
- $aResult = $this->_onPerformAction($aResult);
- return $this->_bIsApi ? $aResult : echoJson($aResult);
- }
- public function getCode($isDisplayHeader = true)
- {
- $sResult = parent::getCode($isDisplayHeader);
- if(!empty($sResult) && $isDisplayHeader)
- $sResult = $this->_oModule->_oTemplate->getJsCode('withdraw') . $sResult;
- return $sResult;
- }
- protected function _getActionWithdrawRequest($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
- {
- if(!$this->_bWithdraw)
- return $this->_bIsApi ? [] : '';
- return parent::_getActionDefault($sType, $sKey, $a, false, $isDisabled, $aRow);
- }
- protected function _getActionWithdrawCancel($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
- {
- if(!$this->_bWithdraw || $aRow['status'] != BX_CREDITS_WITHDRAWAL_STATUS_REQUESTED)
- return $this->_bIsApi ? [] : '';
- return parent::_getActionDefault($sType, $sKey, $a, false, $isDisabled, $aRow);
- }
- protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
- {
- if(empty($this->_iUserId) || $this->_iUserId != bx_get_logged_profile_id())
- return [];
- $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `profile_id`=?", $this->_iUserId);
- return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
- }
- }
- /** @} */
|