12 return empty(
$s) || substr(CH_WSB_URL_ROOT, 0, 5) ==
'https';
29 $this->_oConfig = &$oConfig;
31 $this->_aForm = array(
32 'form_attrs' => array(
33 'id' =>
'pmt_details',
34 'name' =>
'pmt_details',
35 'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'details/',
37 'enctype' =>
'multipart/form-data'
45 'submit_name' =>
'submit'
47 'checker_helper' =>
'ChPmtDetailsFormCheckerHelper'
53 $this->_bCollapseFirst =
true;
58 $aInputs = $this->_oDb->getForm();
62 $sLangsPrefix = $this->_oConfig->getLangsPrefix();
65 $this->_aForm[
'form_attrs'][
'action'] = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'admin/';
70 $aUserValues = $this->_oDb->getFormData($iUserId);
71 foreach($aInputs
as $aInput) {
72 $sReturnDataUrl = $this->_oConfig->getDataReturnUrl() . $sProviderName .
'/' . $iUserId;
74 if($iProviderId != $aInput[
'provider_id']) {
75 if(!
empty($iProviderId))
76 $this->_aForm[
'inputs'][
'provider_' . $iProviderId .
'_end'] = array(
80 $this->_aForm[
'inputs'][
'provider_' . $aInput[
'provider_id'] .
'_begin'] = array(
81 'type' =>
'block_header',
82 'caption' =>
_t($aInput[
'provider_caption']),
83 'collapsable' =>
true,
84 'collapsed' => $bCollapsed
87 $iProviderId = $aInput[
'provider_id'];
88 $sProviderName = $aInput[
'provider_name'];
92 $this->_aForm[
'inputs'][$aInput[
'name']] = array(
93 'type' => $aInput[
'type'],
94 'name' => $aInput[
'name'],
95 'caption' =>
_t($aInput[
'caption']),
96 'value' => $aUserValues[$aInput[
'id']][
'value'],
97 'info' =>
_t($aInput[
'description']),
99 'ch-data-provider' => $iProviderId
102 'func' => $aInput[
'check_type'],
103 'params' => $aInput[
'check_params'],
104 'error' =>
_t($aInput[
'check_error']),
109 switch($aInput[
'type']) {
111 if(
empty($aInput[
'extra']))
114 $aAddon = array(
'values' => array());
116 $aPairs = explode(
',', $aInput[
'extra']);
117 foreach($aPairs
as $sPair) {
118 $aPair = explode(
'|', $sPair);
119 $aAddon[
'values'][] = array(
'key' => $aPair[0],
'value' =>
_t($aPair[1]));
124 $this->_aForm[
'inputs'][$aInput[
'name']][
'value'] =
'on';
125 $aAddon = array(
'checked' => $aUserValues[$aInput[
'id']][
'value'] ==
'on' ?
true :
false);
129 if(str_replace($aInput[
'provider_option_prefix'],
'', $aInput[
'name']) ==
'return_url')
130 $this->_aForm[
'inputs'][$aInput[
'name']][
'value'] = $sReturnDataUrl;
134 if(!
empty($aAddon) && is_array($aAddon))
135 $this->_aForm[
'inputs'][$aInput[
'name']] = array_merge($this->_aForm[
'inputs'][$aInput[
'name']], $aAddon);
138 $this->_aForm[
'inputs'][
'provider_' . $iProviderId .
'_end'] = array(
139 'type' =>
'block_end'
141 $this->_aForm[
'inputs'][
'submit'] = array(
144 'value' =>
_t($sLangsPrefix .
'details_submit'),
151 if(
$oForm->isSubmittedAndValid()) {
152 $aOptions = $this->_oDb->getOptions();
153 foreach($aOptions
as $aOption)
154 $this->_oDb->updateOption($iUserId, $aOption[
'id'],
process_db_input(isset($_POST[$aOption[
'name']]) ? $_POST[$aOption[
'name']] :
"",
CH_TAGS_STRIP));
160 if(!
empty($aInput[
'error'])) {
161 $iProviderId = (int)$aInput[
'attrs'][
'ch-data-provider'];
162 $oForm->aInputs[
'provider_' . $iProviderId .
'_begin'][
'collapsed'] =
false;
171 $sLangsPrefix = $this->_oConfig->getLangsPrefix();
172 $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri();
175 return MsgBox(
_t($sLangsPrefix .
'err_required_login'));
178 'pmt-orders-processed-lnk' => array(
'href' => $sBaseUrl .
'orders/processed/',
'title' =>
_t($sLangsPrefix .
'btn_orders_processed')),
179 'pmt-orders-pending-lnk' => array(
'href' => $sBaseUrl .
'orders/pending/',
'title' =>
_t($sLangsPrefix .
'btn_orders_pending')),
180 'pmt-payment-settings-lnk' => array(
'href' => $sBaseUrl .
'details/',
'title' =>
_t($sLangsPrefix .
'btn_settings'),
'active' => 1)
184 return array((!
empty(
$sResult) ?
$sResult :
MsgBox(
_t($sLangsPrefix .
'msg_no_results'))), $aTopMenu, array(),
false,
'getBlockCaptionMenu');