/** * Gets html for slip page * * @param cbpaidPaymentBasket $paymentBasket * @return string */ private function _outputSlip($paymentBasket) { global $_CB_framework; $slip_html_title = CBPTXT::Th($this->getAccountParam('slip_html_title', "Payment Slip No. ")); $slip_html_for_site = CBPTXT::Th($this->getAccountParam('slip_html_for_site', "For website:")); $slip_html_for_url = $this->getAccountParam('slip_site_url', 1); $slip_html_for_item = CBPTXT::Th($this->getAccountParam('slip_html_for_item', "For item:")); $slip_html_for_member = CBPTXT::Th($this->getAccountParam('slip_html_for_member', "For member:")); $slip_html_reference = CBPTXT::Th($this->getAccountParam('slip_html_reference', "Important: include our reference with your payment:")); $slip_reference_site = $this->getAccountParam('slip_reference_site', 1); $slip_html_conclusion = CBPTXT::Th($this->getAccountParam('slip_html_conclusion', "If you pay by check, please print and enclose this page with your check.")); $slip_html_pure = $this->getAccountParam('slip_html_pure', 0); $slip_popup_window = $this->getAccountParam('slip_popup_window', 1); $slip_print_button = $this->getAccountParam('slip_print_button', 1); outputCbTemplate(); $this->_outputRegTemplate(); $ret = '<div class="cbpaidPaymentSlip">'; if ($slip_html_pure) { $vars = array('[order_id]' => $paymentBasket->id, '[item_number]' => $paymentBasket->item_number, '[item_description]' => $paymentBasket->item_name, '[user_id]' => $paymentBasket->user_id, '[username]' => $paymentBasket->username, '[address_name]' => $paymentBasket->address_name, '[address_street]' => $paymentBasket->address_street, '[address_city]' => $paymentBasket->address_city, '[address_state]' => $paymentBasket->address_state, '[address_zip]' => $paymentBasket->address_zip, '[address_country]' => $paymentBasket->address_country, '[address_country_code]' => $paymentBasket->address_country_code, '[first_name]' => $paymentBasket->first_name, '[last_name]' => $paymentBasket->last_name, '[order_table]' => $paymentBasket->displayBasket(), '[sitename]' => $_CB_framework->getCfg('sitename'), '[live_site]' => preg_replace("/^(https?:\\/\\/)/i", '', $_CB_framework->getCfg('live_site'))); $default_html = '<h2>Payment Slip No. [order_id]</h2>' . '<h3 id="cbpaidWebsite">For website: [sitename]</h3>' . '<p id="cbpaidAddress"><address>[live_site]</address></p>' . '<h3 id="cbpaidItem">For item: [item_number]</h3>' . '<h3 id="cbpaidUser">For member: [first_name] [last_name]</h3>' . '<div>[order_table]</div>' . '<p id="cbpaidReference"><strong>Important: include our reference with your payment: <u style=\\"font-size:125%\\">Number [order_id] / [live_site]</u></strong></p>' . '<p id=\\"cbpaidCheck\\">If you pay by check, please print and enclose this page with your check.</p>'; $slip_html_custom = CBPTXT::Th($this->getAccountParam('slip_html_custom', $default_html)); $ret .= strtr($slip_html_custom, $vars); } else { if ($slip_html_title) { $ret .= '<h2>' . $slip_html_title . ' ' . $paymentBasket->id . "</h2>\n"; } if ($slip_html_for_site) { $ret .= "<h3 id=\"cbpaidWebsite\">" . $slip_html_for_site . ' ' . $_CB_framework->getCfg('sitename') . "</h3>\n"; } if ($slip_html_for_url) { $ret .= "<p id=\"cbpaidAddress\"><address>" . $_CB_framework->getCfg('live_site') . "</address></p>\n"; } if ($slip_html_for_item) { $ret .= "<h3 id=\"cbpaidItem\">" . $slip_html_for_item . ' ' . $paymentBasket->item_number . "</h3>\n"; } if ($slip_html_for_member) { $ret .= "<h3 id=\"cbpaidUser\">" . $slip_html_for_member . ' ' . $paymentBasket->first_name . ' ' . $paymentBasket->last_name . "</h3>\n"; } $ret .= $paymentBasket->displayBasket(); if ($slip_html_reference) { $ret .= "<p id=\"cbpaidReference\"><strong>" . $slip_html_reference . " <u style=\"font-size:125%\">" . CBPTXT::T("Number") . ' ' . $paymentBasket->id; if ($slip_reference_site) { $ret .= " / " . preg_replace("/^(https?:\\/\\/)/i", '', $_CB_framework->getCfg('live_site')); } $ret .= "</u></strong></p>\n"; } if ($slip_html_conclusion) { $ret .= "<p id=\"cbpaidCheck\">" . $slip_html_conclusion . "</p>\n"; } } if ($slip_popup_window) { $ret .= "<div id=\"cbpaidPrint\" style=\"width:100%;text-align:center;\"><p><a href=\"javascript:void(window.print())\">" . CBPTXT::Th("PRINT") . "</a></p></div>\n"; $ret .= "<div id=\"cbpaidClose\" style=\"width:100%;text-align:center;\"><p><a href=\"javascript:void(window.close())\">" . CBPTXT::Th("CLOSE") . "</a></p></div>\n"; } else { if ($slip_print_button) { $slip_urlHtmlSpecialchared = $this->_getSlipUrlHtmlSpecialchared($paymentBasket, true); $ret .= "<div id=\"cbpaidPrint\" style=\"width:100%;text-align:center;\"><p><a href=\"" . $slip_urlHtmlSpecialchared . "\" " . 'onclick="window.open(\'' . $slip_urlHtmlSpecialchared . '\', \'payslip\', \'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no\'); return false;" ' . 'target="_blank" ' . '>' . CBPTXT::Th("PRINT") . "</a></p></div>\n"; } } $recordPaymentUrl = cbpaidApp::getBaseClass()->getRecordPaymentUrl($paymentBasket); if ($recordPaymentUrl) { $ret .= '<div id="cbpaidRecordPayment"><a href="' . $recordPaymentUrl . '" title="' . htmlspecialchars(CBPTXT::T("Record the offline payment now")) . '">' . CBPTXT::Th("RECORD OFFLINE PAYMENT") . '</a></div>'; } $ret .= "</div>"; return $ret; }