Example #1
0
$paypalEnable = $plugin->get('paypal_enable');
$commissionsEnable = $plugin->get('commissions_enable');
$action = isset($_GET['a']) ? $_GET['a'] : null;
switch ($action) {
    case 'saleInfo':
        //$saleId is only used in getSale() and is always filtered there
        $saleId = isset($_POST['id']) ? $_POST['id'] : '';
        $sale = $plugin->getSale($saleId);
        $productType = $sale['product_type'] == 1 ? get_lang('Course') : get_lang('Session');
        $paymentType = $sale['payment_type'] == 1 ? 'Paypal' : $plugin->get_lang('BankTransfer');
        $productInfo = $sale['product_type'] == 1 ? api_get_course_info_by_id($sale['product_id']) : api_get_session_info($sale['product_id']);
        $currency = $plugin->getSelectedCurrency();
        if ($sale['product_type'] == 1) {
            $productImage = $productInfo['course_image_large'];
        } else {
            $productImage = $productInfo['image'] ? $productInfo['image'] : Template::get_icon_path('session_default.png');
        }
        $userInfo = api_get_user_info($sale['user_id']);
        $html = '<h2>' . $sale['product_name'] . '</h2>';
        $html .= '<div class="row">';
        $html .= '<div class="col-sm-6 col-md-6">';
        $html .= '<ul>';
        $html .= '<li><b>' . $plugin->get_lang('OrderPrice') . ':</b> ' . $sale['price'] . '</li>';
        $html .= '<li><b>' . $plugin->get_lang('CurrencyType') . ':</b> ' . $currency['iso_code'] . '</li>';
        $html .= '<li><b>' . $plugin->get_lang('ProductType') . ':</b> ' . $productType . '</li>';
        $html .= '<li><b>' . $plugin->get_lang('OrderDate') . ':</b> ' . api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H) . '</li>';
        $html .= '<li><b>' . $plugin->get_lang('Buyer') . ':</b> ' . $userInfo['complete_name'] . '</li>';
        $html .= '<li><b>' . $plugin->get_lang('PaymentMethods') . ':</b> ' . $paymentType . '</li>';
        $html .= '</ul>';
        $html .= '</div>';
        $html .= '<div class="col-sm-6 col-md-6">';