/** * Draws all active plans * @param $draw */ public static function DrawPlans($draw = true) { $output = ''; $arr_durations = self::PrepareDurationsArray(); $default_payment_system = isset($_GET['payment_type']) ? $_GET['payment_type'] : ModulesSettings::Get('payments', 'default_payment_system'); $payment_type_online = ModulesSettings::Get('payments', 'payment_method_online'); $payment_type_paypal = ModulesSettings::Get('payments', 'payment_method_paypal'); $payment_type_2co = ModulesSettings::Get('payments', 'payment_method_2co'); $payment_type_authorize = ModulesSettings::Get('payments', 'payment_method_authorize'); $payment_type_cnt = ($payment_type_online === 'yes') + ($payment_type_paypal === 'yes') + ($payment_type_2co === 'yes') + ($payment_type_authorize === 'yes'); $exclude_free_plans = true; //($default_payment_system != 'online') ? true : false; $inquiry_field_visible = Modules::IsModuleInstalled('inquiries') == 'yes' ? true : false; $ratings_field_visible = Modules::IsModuleInstalled('ratings') == 'yes' ? true : false; $sql = 'SELECT ap.*, apd.name, apd.description FROM ' . TABLE_ADVERTISE_PLANS . ' ap LEFT OUTER JOIN ' . TABLE_ADVERTISE_PLANS_DESCRIPTION . ' apd ON ap.id = apd.advertise_plan_id AND apd.language_id = \'' . Application::Get('lang') . '\' WHERE 1=1 ORDER BY ap.id ASC'; //'.(($exclude_free_plans) ? ' AND ap.price != 0' : '' ).' $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS); if ($result[1] > 0) { $output .= '<form name="frmAdvertiseForm" id="frmAdvertiseForm" action="index.php?customer=advertise_prepayment" method="post">'; $output .= draw_hidden_field('task', 'do_order', false); $output .= draw_token_field(false); $output .= '<div class="advertise_plans_container">'; $output .= '<table style="margin:7px 16px 0px 16px">'; $output .= '<tr><td>' . _CURRENCY . ':</td><td>' . Currencies::GetCurrenciesDDL(false) . '</td></tr>'; if ($payment_type_cnt >= 1) { ///onchange="appGoToPage(\'index.php?customer=advertise\',\'&payment_type=\'+this.value)" $output .= '<tr><td>' . _PAYMENT_TYPE . ': </td><td> <select name="payment_type" id="payment_type">'; if ($payment_type_online == 'yes') { $output .= '<option value="online" ' . ($default_payment_system == 'online' ? 'selected="selected"' : '') . '>' . _ONLINE_ORDER . '</option>'; } if ($payment_type_paypal == 'yes') { $output .= '<option value="paypal" ' . ($default_payment_system == 'paypal' ? 'selected="selected"' : '') . '>' . _PAYPAL . '</option>'; } if ($payment_type_2co == 'yes') { $output .= '<option value="2co" ' . ($default_payment_system == '2co' ? 'selected="selected"' : '') . '>2CO</option>'; } if ($payment_type_authorize == 'yes') { $output .= '<option value="authorize" ' . ($default_payment_system == 'authorize' ? 'selected="selected"' : '') . '>Authorize.Net</option>'; } $output .= '</select></td></tr>'; } else { $output .= '<tr><td colspan="2">'; $output .= draw_important_message(_NO_PAYMENT_METHODS_ALERT, false); $output .= '</td></tr>'; } $output .= '</table>'; $active_ind = '-1'; $output .= '<div class="plans_wrapper">'; $output .= '<h2>' . _SELECT_PLAN . '</h2>'; for ($i = 0; $i < $result[1]; $i++) { if ($result[0][$i]['price'] != 0 && $active_ind == '-1') { $active_ind = $i; } $duration = isset($arr_durations[$result[0][$i]['duration']]) ? $arr_durations[$result[0][$i]['duration']] : ''; $no_text = '<span class=no>' . _NO . '</span>'; $yes_text = '<span class=yes>' . _YES . '</span>'; $output .= ' <div class="item ' . ($i == $active_ind ? 'active' : ($result[0][$i]['price'] == 0 ? 'free' : '')) . '" id="item_' . $i . '"> <h3>' . $result[0][$i]['name'] . '</h3> <div class="item_text" title="' . _CLICK_TO_SELECT . '"> <label for="plan_' . $result[0][$i]['id'] . '"> ' . _DURATION . ': <b>' . $duration . '</b><br /> ' . _LISTINGS . ': <b>' . $result[0][$i]['listings_count'] . '</b><br /> ' . _CATEGORIES . ': <b>' . $result[0][$i]['categories_count'] . '</b><br /> ' . _KEYWORDS . ': <b>' . $result[0][$i]['keywords_count'] . '</b><br /> ' . _NAME . ': <b>' . ($result[0][$i]['business_name'] ? $yes_text : $no_text) . '</b><br /> ' . _DESCRIPTION . ': <b>' . ($result[0][$i]['business_description'] ? $yes_text : $no_text) . '</b><br /> ' . _LOGO . ': <b>' . ($result[0][$i]['logo'] ? $yes_text : $no_text) . '</b><br /> ' . _IMAGES . ': <b>' . $result[0][$i]['images_count'] . '</b><br /> ' . _VIDEO . ': <b>' . ($result[0][$i]['video_link'] ? $yes_text : $no_text) . '</b><br /> ' . _PHONE . ': <b>' . ($result[0][$i]['phone'] ? $yes_text : $no_text) . '</b><br /> ' . _ADDRESS . ': <b>' . ($result[0][$i]['address'] ? $yes_text : $no_text) . '</b><br /> ' . _MAP . ': <b>' . ($result[0][$i]['map'] ? $yes_text : $no_text) . '</b><br /> ' . ($inquiry_field_visible ? _INQUIRY_BUTTON . ': <b>' . ($result[0][$i]['inquiry_button'] ? $yes_text : $no_text) . '</b><br />' : '') . ' ' . ($inquiry_field_visible ? _INQUIRIES . '/' . _MONTH . ': <b>' . ($result[0][$i]['inquiries_count'] == '-1' ? '<span title="' . _UNLIMITED . '">∞</span>' : $result[0][$i]['inquiries_count']) . '</b><br />' : '') . ' ' . ($ratings_field_visible ? _RATING . ': <b>' . ($result[0][$i]['rating_button'] ? $yes_text : $no_text) . '</b><br />' : '') . ' ' . _PRICE . ': <b>' . Currencies::PriceFormat($result[0][$i]['price'] * Application::Get('currency_rate')) . '</b><br /> <div class="item_description">' . $result[0][$i]['description'] . '</div> </label> </div> <div class="item_radio">'; if ($result[0][$i]['price'] != 0) { $output .= '<input ' . ($i == $active_ind ? 'checked="checked"' : '') . ' type="radio" name="plan_id" id="plan_' . $result[0][$i]['id'] . '" value="' . $result[0][$i]['id'] . '" onclick="appSelectBlock(\'' . $i . '\');">'; } $output .= '</div> </div>'; } $output .= '</div>'; if ($payment_type_cnt >= 1) { $output .= '<div class="plan_button"><input type="submit" class="form_button" name="btnSubmit" value="' . _SUBMIT . '" /></div>'; } $output .= '</div>'; $output .= '</form><br /><br />'; } else { $output .= _NO_RECORDS_FOUND; } if ($draw) { echo $output; } else { $output; } }