[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 geo_zones.php

Zen Cart 源代码 geo_zones.php




下载文件

文件名: geo_zones.php
文件类型: PHP文件
文件大小: 30.33 KiB
MD5: 0ed3ed5ffbe26cd9564e88854ce1fe1a

geo_zones.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: geo_zones.php 19330 2011-08-07 06:32:56Z drbyte $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   $saction = (isset($_GET['saction']) ? $_GET['saction'] : '');
  13.   if (isset($_GET['zID'])) $_GET['zID'] = (int)$_GET['zID'];
  14.   if (isset($_GET['zpage'])) $_GET['zpage'] = (int)$_GET['zpage'];
  15.   if (isset($_GET['spage'])) $_GET['spage'] = (int)$_GET['spage'];
  16.  
  17.   if (zen_not_null($saction)) {
  18.     switch ($saction) {
  19.       case 'insert_sub':
  20.         $zID = zen_db_prepare_input($_GET['zID']);
  21.         $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
  22.         $zone_id = zen_db_prepare_input($_POST['zone_id']);
  23.  
  24.         $db->Execute("insert into " . TABLE_ZONES_TO_GEO_ZONES . "
  25.                    (zone_country_id, zone_id, geo_zone_id, date_added)
  26.                    values ('" . (int)$zone_country_id . "',
  27.                            '" . (int)$zone_id . "',
  28.                            '" . (int)$zID . "',
  29.                            now())");
  30.  
  31.         $new_subzone_id = $db->Insert_ID();
  32.  
  33. //        zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $new_subzone_id));
  34.         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list' . '&sID=' . $new_subzone_id));
  35.         break;
  36.       case 'save_sub':
  37.         $sID = zen_db_prepare_input($_GET['sID']);
  38.         $zID = zen_db_prepare_input($_GET['zID']);
  39.         $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
  40.         $zone_id = zen_db_prepare_input($_POST['zone_id']);
  41.  
  42.         $db->Execute("update " . TABLE_ZONES_TO_GEO_ZONES . "
  43.                      set geo_zone_id = '" . (int)$zID . "',
  44.                          zone_country_id = '" . (int)$zone_country_id . "',
  45.                          zone_id = " . (zen_not_null($zone_id) ? "'" . (int)$zone_id . "'" : 'null') . ",
  46.                          last_modified = now()
  47.                      where association_id = '" . (int)$sID . "'");
  48.  
  49.  
  50.         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $_GET['sID']));
  51.         break;
  52.       case 'deleteconfirm_sub':
  53.         // demo active test
  54.         if (zen_admin_demo()) {
  55.           $_GET['action']= '';
  56.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  57.           zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage']));
  58.         }
  59.         $sID = zen_db_prepare_input($_POST['sID']);
  60.  
  61.         $db->Execute("delete from " . TABLE_ZONES_TO_GEO_ZONES . "
  62.                      where association_id = '" . (int)$sID . "'");
  63.  
  64.         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage']));
  65.         break;
  66.     }
  67.   }
  68.  
  69.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  70.  
  71.   if (zen_not_null($action)) {
  72.     switch ($action) {
  73.       case 'insert_zone':
  74.         $geo_zone_name = zen_db_prepare_input($_POST['geo_zone_name']);
  75.         $geo_zone_description = zen_db_prepare_input($_POST['geo_zone_description']);
  76.  
  77.         $db->Execute("insert into " . TABLE_GEO_ZONES . "
  78.                    (geo_zone_name, geo_zone_description, date_added)
  79.                    values ('" . zen_db_input($geo_zone_name) . "',
  80.                            '" . zen_db_input($geo_zone_description) . "',
  81.                            now())");
  82.  
  83.         $new_zone_id = $db->Insert_ID();
  84.         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zID=' . $new_zone_id));
  85.         break;
  86.       case 'save_zone':
  87.         $zID = zen_db_prepare_input($_GET['zID']);
  88.         $geo_zone_name = zen_db_prepare_input($_POST['geo_zone_name']);
  89.         $geo_zone_description = zen_db_prepare_input($_POST['geo_zone_description']);
  90.  
  91.         $db->Execute("update " . TABLE_GEO_ZONES . "
  92.                      set geo_zone_name = '" . zen_db_input($geo_zone_name) . "',
  93.                          geo_zone_description = '" . zen_db_input($geo_zone_description) . "',
  94.                          last_modified = now() where geo_zone_id = '" . (int)$zID . "'");
  95.  
  96.         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zID=' . $_GET['zID']));
  97.         break;
  98.       case 'deleteconfirm_zone':
  99.         // demo active test
  100.         if (zen_admin_demo()) {
  101.           $_GET['action']= '';
  102.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  103.           zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage']));
  104.         }
  105.         $zID = zen_db_prepare_input($_POST['zID']);
  106.  
  107.         $check_tax_rates = $db->Execute("select tax_zone_id from " . TABLE_TAX_RATES . " where tax_zone_id='" . $zID . "'");
  108.         if ($check_tax_rates->RecordCount() > 0) {
  109.           $_GET['action']= '';
  110.           $messageStack->add_session(ERROR_TAX_RATE_EXISTS, 'caution');
  111.         } else {
  112.           $db->Execute("delete from " . TABLE_GEO_ZONES . "
  113.                        where geo_zone_id = '" . (int)$zID . "'");
  114.  
  115.           $db->Execute("delete from " . TABLE_ZONES_TO_GEO_ZONES . "
  116.                        where geo_zone_id = '" . (int)$zID . "'");
  117.         }
  118.  
  119.         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage']));
  120.         break;
  121.     }
  122.   }
  123. ?>
  124. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  125. <html <?php echo HTML_PARAMS; ?>>
  126. <head>
  127. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  128. <title><?php echo TITLE; ?></title>
  129. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  130. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  131. <script language="javascript" src="includes/menu.js"></script>
  132. <script language="javascript" src="includes/general.js"></script>
  133. <?php
  134.   if (isset($_GET['zID']) && (($saction == 'edit') || ($saction == 'new'))) {
  135. ?>
  136. <script language="javascript"><!--
  137. function resetZoneSelected(theForm) {
  138.   if (theForm.state.value != '') {
  139.     theForm.zone_id.selectedIndex = '0';
  140.     if (theForm.zone_id.options.length > 0) {
  141.       theForm.state.value = '<?php echo JS_STATE_SELECT; ?>';
  142.     }
  143.   }
  144. }
  145.  
  146. function update_zone(theForm) {
  147.   var NumState = theForm.zone_id.options.length;
  148.   var SelectedCountry = "";
  149.  
  150.   while(NumState > 0) {
  151.     NumState--;
  152.     theForm.zone_id.options[NumState] = null;
  153.   }
  154.  
  155.   SelectedCountry = theForm.zone_country_id.options[theForm.zone_country_id.selectedIndex].value;
  156.  
  157. <?php echo zen_js_zone_list('SelectedCountry', 'theForm', 'zone_id'); ?>
  158.  
  159. }
  160. //--></script>
  161. <?php
  162.   }
  163. ?>
  164. <script type="text/javascript">
  165.   <!--
  166.   function init()
  167.   {
  168.     cssjsmenu('navbar');
  169.     if (document.getElementById)
  170.     {
  171.       var kill = document.getElementById('hoverJS');
  172.       kill.disabled = true;
  173.     }
  174.   }
  175.   // -->
  176. </script>
  177. </head>
  178. <body onLoad="init()">
  179. <!-- header //-->
  180. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  181. <!-- header_eof //-->
  182.  
  183. <!-- body //-->
  184. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  185.   <tr>
  186. <!-- body_text //-->
  187.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  188.       <tr>
  189.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  190.           <tr>
  191.             <td class="pageHeading"><?php echo HEADING_TITLE; if (isset($_GET['zone'])) echo '<br><span class="smallText">' . zen_get_geo_zone_name($_GET['zone']) . '</span>'; ?></td>
  192.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  193.           </tr>
  194.         </table></td>
  195.       </tr>
  196.       <tr>
  197.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  198.           <tr>
  199.             <td valign="top">
  200. <?php
  201.   if ($action == 'list') {
  202. ?>
  203.             <table border="0" width="100%" cellspacing="0" cellpadding="2">
  204.               <tr class="dataTableHeadingRow">
  205.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY; ?></td>
  206.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_ZONE; ?></td>
  207.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  208.               </tr>
  209. <?php
  210. // Split Page
  211. // reset page when page is unknown
  212. if ((!isset($_GET['spage']) or $_GET['spage'] == '' or $_GET['spage'] == '1') and $_GET['sID'] != '') {
  213. //  $zones_query_raw = "select a.association_id, a.zone_country_id, c.countries_name, a.zone_id, a.geo_zone_id, a.last_modified, a.date_added, z.zone_name from (" . TABLE_ZONES_TO_GEO_ZONES . " a left join " . TABLE_COUNTRIES . " c on a.zone_country_id = c.countries_id left join " . TABLE_ZONES . " z on a.zone_id = z.zone_id) where a.geo_zone_id = " . $_GET['zID'] . " order by association_id";
  214.   $zones_query_raw = "select a.association_id, a.zone_country_id, c.countries_name, a.zone_id, a.geo_zone_id, a.last_modified, a.date_added, z.zone_name from (" . TABLE_ZONES_TO_GEO_ZONES . " a left join " . TABLE_COUNTRIES . " c on a.zone_country_id = c.countries_id left join " . TABLE_ZONES . " z on a.zone_id = z.zone_id) where a.geo_zone_id = " . $_GET['zID'] . " order by c.countries_name, association_id";
  215.   $check_page = $db->Execute($zones_query_raw);
  216.   $check_count=1;
  217.   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
  218.     while (!$check_page->EOF) {
  219.       if ($check_page->fields['association_id'] == $_GET['sID']) {
  220.         break;
  221.       }
  222.       $check_count++;
  223.       $check_page->MoveNext();
  224.     }
  225.     $_GET['spage'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
  226.   } else {
  227.     $_GET['spage'] = 1;
  228.   }
  229. }
  230.     $rows = 0;
  231. //    $zones_query_raw = "select a.association_id, a.zone_country_id, c.countries_name, a.zone_id, a.geo_zone_id, a.last_modified, a.date_added, z.zone_name from (" . TABLE_ZONES_TO_GEO_ZONES . " a left join " . TABLE_COUNTRIES . " c on a.zone_country_id = c.countries_id left join " . TABLE_ZONES . " z on a.zone_id = z.zone_id) where a.geo_zone_id = " . $_GET['zID'] . " order by association_id";
  232.     $zones_query_raw = "select a.association_id, a.zone_country_id, c.countries_name, a.zone_id, a.geo_zone_id, a.last_modified, a.date_added, z.zone_name from (" . TABLE_ZONES_TO_GEO_ZONES . " a left join " . TABLE_COUNTRIES . " c on a.zone_country_id = c.countries_id left join " . TABLE_ZONES . " z on a.zone_id = z.zone_id) where a.geo_zone_id = " . $_GET['zID'] . " order by c.countries_name, association_id";
  233.     $zones_split = new splitPageResults($_GET['spage'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows);
  234.     $zones = $db->Execute($zones_query_raw);
  235.     while (!$zones->EOF) {
  236.       $rows++;
  237.       if ((!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $zones->fields['association_id']))) && !isset($sInfo) && (substr($action, 0, 3) != 'new')) {
  238.         $sInfo = new objectInfo($zones->fields);
  239.       }
  240.       if (isset($sInfo) && is_object($sInfo) && ($zones->fields['association_id'] == $sInfo->association_id)) {
  241.         echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=edit') . '\'">' . "\n";
  242.       } else {
  243.         echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $zones->fields['association_id']) . '\'">' . "\n";
  244.       }
  245. ?>
  246.                 <td class="dataTableContent"><?php echo (($zones->fields['countries_name']) ? $zones->fields['countries_name'] : TEXT_ALL_COUNTRIES); ?></td>
  247.                 <td class="dataTableContent"><?php echo (($zones->fields['zone_id']) ? $zones->fields['zone_name'] : PLEASE_SELECT); ?></td>
  248.                 <td class="dataTableContent" align="right"><?php if (isset($sInfo) && is_object($sInfo) && ($zones->fields['association_id'] == $sInfo->association_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $zones->fields['association_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  249.               </tr>
  250. <?php
  251.       $zones->MoveNext();
  252.     }
  253. ?>
  254.               <tr>
  255.                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  256.                   <tr>
  257.                     <td class="smallText" valign="top"><?php echo $zones_split->display_count($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['spage'], TEXT_DISPLAY_NUMBER_OF_COUNTRIES); ?></td>
  258.                     <td class="smallText" align="right"><?php echo $zones_split->display_links($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['spage'], 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list', 'spage'); ?></td>
  259.                   </tr>
  260.                 </table></td>
  261.               </tr>
  262.               <tr>
  263.                 <td align="right" colspan="3"><?php if (empty($saction)) echo '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID']) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a> <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($sInfo) ? 'sID=' . $sInfo->association_id . '&' : '') . 'saction=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
  264.               </tr>
  265.             </table>
  266. <?php
  267.   } else {
  268. ?>
  269. <?php echo TEXT_LEGEND; ?>&nbsp;
  270. <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . TEXT_LEGEND_TAX_AND_ZONES; ?>&nbsp;&nbsp;&nbsp;
  271. <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . TEXT_LEGEND_ONLY_ZONES; ?>&nbsp;&nbsp;&nbsp;
  272. <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . TEXT_LEGEND_NOT_CONF; ?>&nbsp;&nbsp;&nbsp;<br />
  273.             <table border="0" width="100%" cellspacing="0" cellpadding="2">
  274.               <tr class="dataTableHeadingRow">
  275.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_ZONES; ?></td>
  276.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_ZONES_DESCRIPTION; ?></td>
  277.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
  278.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  279.               </tr>
  280. <?php
  281. // Split Page
  282. // reset page when page is unknown
  283. if ((!isset($_GET['zpage']) or $_GET['zpage'] == '' or $_GET['zpage'] == '1') and $_GET['zID'] != '') {
  284.   $zones_query_raw = "select geo_zone_id, geo_zone_name, geo_zone_description, last_modified, date_added from " . TABLE_GEO_ZONES . " order by geo_zone_name";
  285.   $check_page = $db->Execute($zones_query_raw);
  286.   $check_count=1;
  287.   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
  288.     while (!$check_page->EOF) {
  289.       if ($check_page->fields['geo_zone_id'] == $_GET['zID']) {
  290.         break;
  291.       }
  292.       $check_count++;
  293.       $check_page->MoveNext();
  294.     }
  295.     $_GET['zpage'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
  296.   } else {
  297.     $_GET['zpage'] = 1;
  298.   }
  299. }
  300.     $zones_query_raw = "select geo_zone_id, geo_zone_name, geo_zone_description, last_modified, date_added from " . TABLE_GEO_ZONES . " order by geo_zone_name";
  301.     $zones_split = new splitPageResults($_GET['zpage'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows);
  302.     $zones = $db->Execute($zones_query_raw);
  303.     while (!$zones->EOF) {
  304.         $num_zones = $db->Execute("select count(*) as num_zones
  305.                                   from " . TABLE_ZONES_TO_GEO_ZONES . "
  306.                                   where geo_zone_id = '" . (int)$zones->fields['geo_zone_id'] . "'
  307.                                   group by geo_zone_id");
  308.  
  309.         if ($num_zones->fields['num_zones'] > 0) {
  310.           $zones->fields['num_zones'] = $num_zones->fields['num_zones'];
  311.         } else {
  312.           $zones->fields['num_zones'] = 0;
  313.         }
  314.  
  315.         $num_tax_rates = $db->Execute("select count(*) as num_tax_rates
  316.                                   from " . TABLE_TAX_RATES . "
  317.                                   where tax_zone_id = '" . (int)$zones->fields['geo_zone_id'] . "'
  318.                                   group by tax_zone_id");
  319.  
  320.         if ($num_tax_rates->fields['num_tax_rates'] > 0) {
  321.           $zones->fields['num_tax_rates'] = $num_tax_rates->fields['num_tax_rates'];
  322.         } else {
  323.           $zones->fields['num_tax_rates'] = 0;
  324.         }
  325.  
  326.       if ((!isset($_GET['zID']) || (isset($_GET['zID']) && ($_GET['zID'] == $zones->fields['geo_zone_id']))) && !isset($zInfo) && (substr($action, 0, 3) != 'new')) {
  327.         $zInfo = new objectInfo($zones->fields);
  328.       }
  329.       if (isset($zInfo) && is_object($zInfo) && ($zones->fields['geo_zone_id'] == $zInfo->geo_zone_id)) {
  330.         echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=list') . '\'">' . "\n";
  331.       } else {
  332.         echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zones->fields['geo_zone_id']) . '\'">' . "\n";
  333.       }
  334. ?>
  335.                 <td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zones->fields['geo_zone_id'] . '&action=list') . '">' . zen_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a>&nbsp;' . $zones->fields['geo_zone_name']; ?></td>
  336.                 <td class="dataTableContent"><?php echo $zones->fields['geo_zone_description']; ?></td>
  337.                 <td class="dataTableContent" align="center"><?php
  338.                     // show current status
  339.                     if ($zones->fields['num_tax_rates'] && $zones->fields['num_zones']) {
  340.                       echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
  341.                     } elseif ($zones->fields['num_zones']) {
  342.                       echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif');
  343.                     } else {
  344.                       echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
  345.                     }
  346.                   ?></td>
  347.                 <td class="dataTableContent" align="right"><?php if (isset($zInfo) && is_object($zInfo) && ($zones->fields['geo_zone_id'] == $zInfo->geo_zone_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zones->fields['geo_zone_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  348.               </tr>
  349. <?php
  350.       $zones->MoveNext();
  351.     }
  352. ?>
  353.               <tr>
  354.                 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  355.                   <tr>
  356.                     <td class="smallText"><?php echo $zones_split->display_count($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['zpage'], TEXT_DISPLAY_NUMBER_OF_TAX_ZONES); ?></td>
  357.                     <td class="smallText" align="right"><?php echo $zones_split->display_links($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['zpage'], '', 'zpage'); ?></td>
  358.                   </tr>
  359.                 </table></td>
  360.               </tr>
  361.               <tr>
  362.                 <td align="right" colspan="4"><?php if (!$action) echo '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=new_zone') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
  363.               </tr>
  364.             </table>
  365. <?php
  366.   }
  367. ?>
  368.             </td>
  369. <?php
  370.   $heading = array();
  371.   $contents = array();
  372.  
  373.   if ($action == 'list') {
  374.     switch ($saction) {
  375.       case 'new':
  376.         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '</b>');
  377.  
  378.         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] . '&' : '') . 'saction=insert_sub'));
  379.         $contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO);
  380.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries(TEXT_ALL_COUNTRIES), '', 'onChange="update_zone(this.form);"'));
  381.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down()));
  382.         $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&' . (isset($_GET['sID']) ? 'sID=' . $_GET['sID'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  383.         break;
  384.       case 'edit':
  385.         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '</b>');
  386.  
  387.         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=save_sub'));
  388.         $contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO);
  389.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries(TEXT_ALL_COUNTRIES), $sInfo->zone_country_id, 'onChange="update_zone(this.form);"'));
  390.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($sInfo->zone_country_id), $sInfo->zone_id));
  391.         $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  392.         break;
  393.       case 'delete':
  394.         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SUB_ZONE . '</b>');
  395.  
  396.         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&saction=deleteconfirm_sub') . zen_draw_hidden_field('sID', $sInfo->association_id));
  397.         $contents[] = array('text' => TEXT_INFO_DELETE_SUB_ZONE_INTRO);
  398.         $contents[] = array('text' => '<br><b>' . $sInfo->countries_name . '</b>');
  399.         $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  400.         break;
  401.       default:
  402.         if (isset($sInfo) && is_object($sInfo)) {
  403.           $heading[] = array('text' => '<b>' . $sInfo->countries_name . '</b>');
  404.  
  405.           $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $sInfo->association_id . '&saction=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  406.           $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->date_added));
  407.           if (zen_not_null($sInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($sInfo->last_modified));
  408.         }
  409.         break;
  410.     }
  411.   } else {
  412.     switch ($action) {
  413.       case 'new_zone':
  414.         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_ZONE . '</b>');
  415.  
  416.         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=insert_zone'));
  417.         $contents[] = array('text' => TEXT_INFO_NEW_ZONE_INTRO);
  418.         $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_NAME . '<br>' . zen_draw_input_field('geo_zone_name', '', zen_set_field_length(TABLE_GEO_ZONES, 'geo_zone_name')));
  419.         $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_DESCRIPTION . '<br>' . zen_draw_input_field('geo_zone_description', '', zen_set_field_length(TABLE_GEO_ZONES, 'geo_zone_description')));
  420.         $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  421.         break;
  422.       case 'edit_zone':
  423.         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ZONE . '</b>');
  424.  
  425.         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=save_zone'));
  426.         $contents[] = array('text' => TEXT_INFO_EDIT_ZONE_INTRO);
  427.         $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_NAME . '<br>' . zen_draw_input_field('geo_zone_name', htmlspecialchars($zInfo->geo_zone_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_GEO_ZONES, 'geo_zone_name')));
  428.         $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_DESCRIPTION . '<br>' . zen_draw_input_field('geo_zone_description', htmlspecialchars($zInfo->geo_zone_description, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_GEO_ZONES, 'geo_zone_description')));
  429.         $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  430.         break;
  431.       case 'delete_zone':
  432.         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ZONE . '</b>');
  433.  
  434.         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&action=deleteconfirm_zone') . zen_draw_hidden_field('zID', $zInfo->geo_zone_id));
  435.         $contents[] = array('text' => TEXT_INFO_DELETE_ZONE_INTRO);
  436.         $contents[] = array('text' => '<br><b>' . $zInfo->geo_zone_name . '</b>');
  437.         $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  438.         break;
  439.       default:
  440.         if (isset($zInfo) && is_object($zInfo)) {
  441.           $heading[] = array('text' => '<b>' . $zInfo->geo_zone_name . '</b>');
  442.  
  443.           $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=edit_zone') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=delete_zone') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>' . ' <a href="' . zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=list') . '">' . zen_image_button('button_details.gif', IMAGE_DETAILS) . '</a>');
  444.           $contents[] = array('align' => 'center', 'text' =>  ($zInfo->num_tax_rates > 0 ? '<a href="' . zen_href_link(FILENAME_TAX_RATES, '', 'NONSSL') . '">' . zen_image_button('button_tax_rates.gif', IMAGE_TAX_RATES) . '</a>' : ''));
  445.           $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_ZONES . ' ' . $zInfo->num_zones);
  446.           $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_TAX_RATES . ' ' . $zInfo->num_tax_rates);
  447.           $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($zInfo->date_added));
  448.           if (zen_not_null($zInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($zInfo->last_modified));
  449.           $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_DESCRIPTION . '<br>' . $zInfo->geo_zone_description);
  450.         }
  451.         break;
  452.     }
  453.   }
  454.  
  455.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  456.     echo '            <td width="25%" valign="top">' . "\n";
  457.  
  458.     $box = new box;
  459.     echo $box->infoBox($heading, $contents);
  460.  
  461.     echo '            </td>' . "\n";
  462.   }
  463. ?>
  464.           </tr>
  465.         </table></td>
  466.       </tr>
  467.     </table></td>
  468. <!-- body_text_eof //-->
  469.   </tr>
  470. </table>
  471. <!-- body_eof //-->
  472.  
  473. <!-- footer //-->
  474. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  475. <!-- footer_eof //-->
  476. <br>
  477. </body>
  478. </html>
  479. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron