function displaySelectLevelBlock($aLevels) { $iModuleId = $this->_oConfig->getId(); $iLevelsHalf = (int) ceil(count($aLevels) / 2); $sCurrencyCode = strtoupper($this->_oConfig->getCurrencyCode()); $sCurrencySign = $this->_oConfig->getCurrencySign(); bx_import('BxDolPayments'); $oPayment = BxDolPayments::getInstance(); $aProviders = $oPayment->getProviders(0); if (empty($aProviders)) { return MsgBox(_t('_membership_err_no_payment_options')); } $aTmplVarsLevels = array(); foreach ($aLevels as $aLevel) { $aTmplVarsLevels[] = array('id' => $aLevel['mem_id'], 'descriptor' => $oPayment->getCartItemDescriptor(0, $iModuleId, $aLevel['price_id'], 1), 'checked' => empty($aTmplVarsLevels) ? 'checked="checked"' : '', 'title' => $aLevel['mem_name'], 'icon' => $this->_oConfig->getIconsUrl() . $aLevel['mem_icon'], 'bx_if:show_description' => array('condition' => strlen($aLevel['mem_description']) > 0, 'content' => array('description' => str_replace("\$", "$", $aLevel['mem_description']))), 'days' => $aLevel['price_days'] > 0 ? $aLevel['price_days'] . ' ' . _t('_membership_txt_days') : _t('_membership_txt_expires_never'), 'price' => $aLevel['price_amount'], 'currency_code' => $sCurrencyCode); } $aTmplVarsProviders = array(); if (!empty($aProviders)) { foreach ($aProviders as $aProvider) { if ((int) $aProvider['for_visitor'] != 1) { continue; } $aTmplVarsProviders[] = array('name' => $aProvider['name'], 'caption' => $aProvider['caption_cart'], 'checked' => empty($aTmplVarsProviders) ? 'checked="checked"' : ''); } } $bSelectedProvider = count($aTmplVarsProviders) == 1; $sSelectedProvider = $bSelectedProvider ? $aTmplVarsProviders[0]['name'] : ''; $aTmplParams = array('js_object' => $this->_oConfig->getJsObject('join'), 'js_code' => $this->getJsCode('join', true), 'submit_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'join_submit', 'bx_repeat:levels_left' => array_slice($aTmplVarsLevels, 0, $iLevelsHalf), 'bx_repeat:levels_right' => array_slice($aTmplVarsLevels, $iLevelsHalf), 'bx_if:show_providers_selector' => array('condition' => !$bSelectedProvider, 'content' => array('bx_repeat:providers' => $aTmplVarsProviders)), 'bx_if:show_selected_provider' => array('condition' => $bSelectedProvider, 'content' => array('name' => $sSelectedProvider))); $this->addCss('levels.css'); $this->addJs('join.js'); $this->addJsTranslation(array('_membership_err_need_select_level', '_membership_err_need_select_provider')); return array($this->parseHtmlByName('select_level_block.html', $aTmplParams), array(), array(), false); }
function blockFiles(&$aData) { $iEntryId = $aData['id']; $aReadyMedia = array(); if ($iEntryId) { $aReadyMedia = $GLOBALS['oBxStoreModule']->_oDb->getFiles($iEntryId, true); } if (!$aReadyMedia) { return ''; } $aVars = array('bx_repeat:files' => array()); bx_import('BxDolPayments'); $oPayment = BxDolPayments::getInstance(); $sCurrencySign = getParam('pmt_default_currency_sign'); foreach ($aReadyMedia as $r) { $iMediaId = $r['media_id']; $a = BxDolService::call('files', 'get_file_array', array($iMediaId), 'Search'); if (!$a['date']) { continue; } bx_import('BxTemplFormView'); $oForm = new BxTemplFormView(array()); $aInputBtnDownload = array('type' => 'submit', 'name' => 'bx_store_download', 'value' => _t('_bx_store_download'), 'attrs' => array('onclick' => "window.open ('" . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "download/{$r['id']}','_self');")); $aVars['bx_repeat:files'][] = array('id' => $iMediaId, 'title' => $a['title'], 'icon' => $a['file'], 'price' => $sCurrencySign . ' ' . $r['price'], 'for_group' => sprintf(_t('_bx_store_for_group'), $GLOBALS['oBxStoreModule']->getGroupName($r['allow_purchase_to'])), 'date' => defineTimeInterval($a['date']), 'bx_if:purchase' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedPurchase($r), 'content' => array('btn_purchase' => $oPayment->getAddToCartLink($r['author_id'], $this->_oConfig->getId(), $r['id'], 1))), 'bx_if:download' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedDownload($r), 'content' => array('btn_download' => $oForm->genInputButton($aInputBtnDownload)))); } if (!$aVars['bx_repeat:files']) { return ''; } return $this->parseHtmlByName('block_files', $aVars); }
function init(&$oDb) { $this->_oDb =& $oDb; $this->_bDisableFreeJoin = $this->_oDb->getParam('mbp_disable_free_join') == 'on'; bx_import('BxDolPayments'); $oPayment = BxDolPayments::getInstance(); $this->_sCurrencySign = $oPayment->getOption('default_currency_sign'); $this->_sCurrencyCode = $oPayment->getOption('default_currency_code'); }
function init(&$oDb) { $this->_oDb =& $oDb; $this->_bDisableFreeJoin = $this->_oDb->getParam('mbp_disable_free_join') == 'on'; $this->_bEnableStandardOnPaidJoin = $this->_oDb->getParam('mbp_enable_standard_for_paid_join') == 'on'; $this->_bEnableCaptchaOnPaidJoin = $this->_oDb->getParam('mbp_enable_captcha_for_paid_join') == 'on'; bx_import('BxDolPayments'); $oPayment = BxDolPayments::getInstance(); $this->_sCurrencySign = $oPayment->getOption('default_currency_sign'); $this->_sCurrencyCode = $oPayment->getOption('default_currency_code'); }
function displaySelectLevelBlock($aLevels, $bDynamic = false) { $iModuleId = $this->_oConfig->getId(); $iSelectedLevel = $iSelectedProvider = 0; $sCurrencyCode = strtoupper($this->_oConfig->getCurrencyCode()); $sCurrencySign = $this->_oConfig->getCurrencySign(); bx_import('BxDolPayments'); $oPayment = BxDolPayments::getInstance(); $aProviders = $oPayment->getProviders(0); if (empty($aProviders)) { return array(MsgBox(_t('_membership_err_no_payment_options'))); } //--- Prepare levels $aTmplVarsLevels = array(); foreach ($aLevels as $iIndex => $aLevel) { $bPaid = (int) $aLevel['price_amount'] > 0; $iPriceDays = (int) $aLevel['price_days']; $fPriceAmount = (double) $aLevel['price_amount']; $aTmplVarsLevels[] = array('level' => $this->parseHtmlByName('select_level.html', array('js_object' => $this->_oConfig->getJsObject('join'), 'id' => $aLevel['mem_id'], 'descriptor' => (int) $aLevel['mem_id'] == MEMBERSHIP_ID_STANDARD ? $this->_oConfig->getStandardDescriptor() : $oPayment->getCartItemDescriptor(0, $iModuleId, $aLevel['price_id'], 1), 'checked' => $iIndex == $iSelectedLevel ? 'checked="checked"' : '', 'title' => $aLevel['mem_name'], 'icon' => $this->_oConfig->getIconsUrl() . $aLevel['mem_icon'], 'bx_if:show_description' => array('condition' => strlen($aLevel['mem_description']) > 0, 'content' => array('description' => str_replace("\$", "$", $aLevel['mem_description']))), 'days' => $iPriceDays > 0 ? $iPriceDays . ' ' . _t('_membership_txt_days') : _t('_membership_txt_expires_never'), 'price' => $fPriceAmount, 'bx_if:show_price_paid' => array('condition' => $bPaid, 'content' => array('price' => $fPriceAmount, 'currency_code' => $sCurrencyCode)), 'bx_if:show_price_free' => array('condition' => !$bPaid, 'content' => array())))); } //--- Prepare providers $aTmplVarsProviders = array(); if (!empty($aProviders)) { foreach ($aProviders as $iIndex => $aProvider) { if ((int) $aProvider['for_visitor'] != 1) { continue; } $aTmplVarsProviders[] = array('name' => $aProvider['name'], 'caption' => $aProvider['caption_cart'], 'checked' => $iIndex == $iSelectedProvider ? 'checked="checked"' : ''); } } if (empty($aTmplVarsProviders)) { return array(MsgBox(_t('_membership_err_no_payment_options'))); } $bSelectedLevelPaid = (int) $aLevels[$iSelectedLevel]['price_amount'] > 0; $bSelectedProvider = count($aTmplVarsProviders) == 1; $sSelectedProvider = $bSelectedProvider ? $aTmplVarsProviders[0]['name'] : ''; //--- Prepare captcha $sCaptcha = ''; $bCaptcha = $this->_oConfig->isCaptchaOnPaidJoin(); if ($bCaptcha) { bx_import('BxDolCaptcha'); $oCaptcha = BxDolCaptcha::getObjectInstance(); $sCaptcha = $oCaptcha ? $oCaptcha->display($bDynamic) : _t('_sys_txt_captcha_not_available'); } $aTmplParams = array('js_object' => $this->_oConfig->getJsObject('join'), 'js_code' => $this->getJsCode('join', true), 'submit_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'join_submit', 'bx_repeat:levels' => $aTmplVarsLevels, 'bx_if:show_providers_selector' => array('condition' => !$bSelectedProvider, 'content' => array('bx_if:show_providers_selector_hidden' => array('condition' => !$bSelectedLevelPaid, 'content' => array()), 'bx_repeat:providers' => $aTmplVarsProviders)), 'bx_if:show_captcha' => array('condition' => $bCaptcha, 'content' => array('captcha' => $sCaptcha)), 'bx_if:show_selected_provider' => array('condition' => $bSelectedProvider, 'content' => array('name' => $sSelectedProvider)), 'txt_checkout' => _t($bSelectedLevelPaid ? '_membership_btn_pay' : '_membership_btn_select')); $sCssJs = ''; $sCssJs .= $this->addCss(array('levels.css', 'levels_tablet.css', 'levels_phone.css'), $bDynamic); $sCssJs .= $this->addJs('join.js', $bDynamic); $this->addJsTranslation(array('_membership_err_need_select_level', '_membership_err_need_select_provider')); return array(($bDynamic ? $sCssJs : '') . $this->parseHtmlByName('select_level_block.html', $aTmplParams), array(), array(), false); }
<?php /** * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ * CC-BY License - http://creativecommons.org/licenses/by/3.0/ */ require_once 'inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; check_logged(); bx_import('BxDolPayments'); $sUrl = $oPayment = BxDolPayments::getInstance()->getCartUrl(); if (empty($sUrl)) { $oSysTemplate->displayPageNotFound(); } header('Location: ' . $sUrl); exit;
/** * Check whether prolongation is available for membership levels marked as 'Expiring' */ function serviceProlongSubscriptions() { bx_import('BxDolPayments'); $oPayment = BxDolPayments::getInstance(); $aMemberships = $this->_oDb->getExpiringMemberships(); foreach ($aMemberships as $aMembership) { $aResult = $oPayment->prolongSubscription($aMembership['transaction_id']); if (!isset($aResult['code']) || (int) $aResult['code'] != 0) { continue; } unmarkMembershipAsExpiring($aMembership['member_id'], $aMembership['level_id'], $aMembership['transaction_id']); } }
<?php /** * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ * CC-BY License - http://creativecommons.org/licenses/by/3.0/ */ require_once 'inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; check_logged(); bx_import('BxDolPayments'); $sUrl = $oPayment = BxDolPayments::getInstance()->getOrdersUrl(); if (empty($sUrl)) { $oSysTemplate->displayPageNotFound(); } header('Location: ' . $sUrl); exit;