function smarty_function_select_state($params, &$smarty) { extract($params); if (empty($assign)) { $smarty->trigger_error("assign: missing 'assign' parameter"); return; } cw_load('map'); $smarty->assign($assign, cw_map_get_states()); }
<?php cw_load('map'); $name = $_GET['name']; $country = $_GET['country']; $state = $_GET['state']; include_once $app_main_dir . '/include/templater/plugins/modifier.id.php'; $name = str_ends_with($name, '[country]') ? substr($name, 0, strlen($name) - 9) : $name; if (empty($country)) { $country = $config['General']['default_country']; } $countries = cw_call('cw_map_get_countries', array($name)); $smarty->assign('countries', $countries); $smarty->assign('name', $name . '[country]'); $smarty->assign('default', $country); cw_add_ajax_block(array('id' => smarty_modifier_id($name) . 'country', 'action' => 'replace', 'content' => cw_display('main/map/_countries.tpl', $smarty, false))); $states = cw_map_get_states($country); $smarty->assign('states', $states); $smarty->assign('name', $name . '[state]'); $smarty->assign('default', $state); cw_add_ajax_block(array('id' => smarty_modifier_id($name) . 'state', 'action' => 'replace', 'content' => cw_display('main/map/_states.tpl', $smarty, false)));
} if (!empty($addons['image_verification'])) { if ($antibot_err) { $antibot_err =& cw_session_register("antibot_err"); $smarty->assign('reg_antibot_err', $antibot_err); cw_session_unregister("antibot_err"); } $smarty->assign('display_antibot', $display_antibot); } $smarty->assign('user', $user); $smarty->assign('profile_fields', $profile_fields); $smarty->assign('profile_sections', $profile_sections); $smarty->assign('additional_fields', $additional_fields); # assign information for the main address $smarty->assign('countries', cw_map_get_countries()); $smarty->assign('states', cw_map_get_states()); if ($config['General']['use_counties'] == 'Y') { $smarty->assign('titles', cw_map_get_counties()); } $smarty->assign('memberships', cw_get_memberships($userinfo ? $userinfo['usertype'] : $usertype)); $smarty->assign('salesmen', cw_user_get_salesmans_for_register()); cw_load('warehouse'); $possible_warehouses = cw_get_warehouses(); $smarty->assign('possible_warehouses', $possible_warehouses); if ($m_usertype == 'B' && $current_area == 'A') { $parent_profiles = cw_query("select customer_id, firstname, lastname from {$tables['customers']} where {$tables['customers']}.usertype='B' and customer_id!='{$user}'"); $smarty->assign('parent_profiles', $parent_profiles); } $smarty->assign('fill_error', $fill_error); if ($fill_error) { $userinfo = cw_check_user_field_build_profile($userinfo, $filled_profile, $profile_fields);
if ($action == "delete") { // Delete gift certificate if (!empty($gc_ids)) { $gcids = array_keys($gc_ids); // GC can be deleted if it's doc_id == 0 or is not exist db_query("DELETE gc \n FROM {$tables['giftcerts']} gc\n LEFT JOIN {$tables['docs']} d ON gc.doc_id=d.doc_id\n WHERE gc.gc_id IN ('" . implode("' ,'", $gcids) . "')\n AND (gc.doc_id=0 OR d.doc_id IS NULL)"); } cw_add_top_message(cw_get_langvar_by_name("msg_adm_gcs_del")); cw_header_location("index.php?target=giftcerts"); } if (in_array($mode, array('add_gc', 'modify_gc'))) { if (empty($country)) { $country = $config['General']['default_country']; } $smarty->assign('countries', cw_map_get_countries()); $smarty->assign('states', cw_map_get_states($country)); $smarty->assign('gc_templates', cw_gift_get_templates($app_dir . $app_skin_dir)); $gc_readonly = ""; if (!empty($gc_id)) { $giftcert = cw_query_first("SELECT * FROM {$tables['giftcerts']} where gc_id='" . $gc_id . "'"); if ($giftcert['send_via'] != "E") { $giftcert['recipient_statename'] = cw_get_state($giftcert['recipient_state'], $giftcert['recipient_country']); $giftcert['recipient_countryname'] = cw_get_country($giftcert['recipient_country']); } $smarty->assign('giftcert', $giftcert); $smarty->assign('gc_id', $gc_id); $gc_readonly = $mode == "modify_gc" && $giftcert['status'] != "P" ? "Y" : ""; } } elseif ($action == 'print') { $giftcerts = false; $gc_ids = $gc_ids_p;
function cw_map_get_states_smarty($params) { return cw_map_get_states($params['country']); }