ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/geo_zones.php
Go to the documentation of this file.
00001 <?php
00010   require('includes/application_top.php');
00011 
00012   $saction = (isset($_GET['saction']) ? $_GET['saction'] : '');
00013   if (isset($_GET['zID'])) $_GET['zID'] = (int)$_GET['zID'];
00014   if (isset($_GET['zpage'])) $_GET['zpage'] = (int)$_GET['zpage'];
00015   if (isset($_GET['spage'])) $_GET['spage'] = (int)$_GET['spage'];
00016 
00017   if (zen_not_null($saction)) {
00018     switch ($saction) {
00019       case 'insert_sub':
00020         $zID = zen_db_prepare_input($_GET['zID']);
00021         $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
00022         $zone_id = zen_db_prepare_input($_POST['zone_id']);
00023 
00024         $db->Execute("insert into " . TABLE_ZONES_TO_GEO_ZONES . "
00025                     (zone_country_id, zone_id, geo_zone_id, date_added)
00026                     values ('" . (int)$zone_country_id . "',
00027                             '" . (int)$zone_id . "',
00028                             '" . (int)$zID . "',
00029                             now())");
00030 
00031         $new_subzone_id = $db->Insert_ID();
00032 
00033 //        zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $new_subzone_id));
00034         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list' . '&sID=' . $new_subzone_id));
00035         break;
00036       case 'save_sub':
00037         $sID = zen_db_prepare_input($_GET['sID']);
00038         $zID = zen_db_prepare_input($_GET['zID']);
00039         $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
00040         $zone_id = zen_db_prepare_input($_POST['zone_id']);
00041 
00042         $db->Execute("update " . TABLE_ZONES_TO_GEO_ZONES . "
00043                       set geo_zone_id = '" . (int)$zID . "',
00044                           zone_country_id = '" . (int)$zone_country_id . "',
00045                           zone_id = " . (zen_not_null($zone_id) ? "'" . (int)$zone_id . "'" : 'null') . ",
00046                           last_modified = now()
00047                       where association_id = '" . (int)$sID . "'");
00048 
00049 
00050         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $_GET['sID']));
00051         break;
00052       case 'deleteconfirm_sub':
00053         // demo active test
00054         if (zen_admin_demo()) {
00055           $_GET['action']= '';
00056           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
00057           zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage']));
00058         }
00059         $sID = zen_db_prepare_input($_POST['sID']);
00060 
00061         $db->Execute("delete from " . TABLE_ZONES_TO_GEO_ZONES . "
00062                       where association_id = '" . (int)$sID . "'");
00063 
00064         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage']));
00065         break;
00066     }
00067   }
00068 
00069   $action = (isset($_GET['action']) ? $_GET['action'] : '');
00070 
00071   if (zen_not_null($action)) {
00072     switch ($action) {
00073       case 'insert_zone':
00074         $geo_zone_name = zen_db_prepare_input($_POST['geo_zone_name']);
00075         $geo_zone_description = zen_db_prepare_input($_POST['geo_zone_description']);
00076 
00077         $db->Execute("insert into " . TABLE_GEO_ZONES . "
00078                     (geo_zone_name, geo_zone_description, date_added)
00079                     values ('" . zen_db_input($geo_zone_name) . "',
00080                             '" . zen_db_input($geo_zone_description) . "',
00081                             now())");
00082 
00083         $new_zone_id = $db->Insert_ID();
00084         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zID=' . $new_zone_id));
00085         break;
00086       case 'save_zone':
00087         $zID = zen_db_prepare_input($_GET['zID']);
00088         $geo_zone_name = zen_db_prepare_input($_POST['geo_zone_name']);
00089         $geo_zone_description = zen_db_prepare_input($_POST['geo_zone_description']);
00090 
00091         $db->Execute("update " . TABLE_GEO_ZONES . "
00092                       set geo_zone_name = '" . zen_db_input($geo_zone_name) . "',
00093                           geo_zone_description = '" . zen_db_input($geo_zone_description) . "',
00094                           last_modified = now() where geo_zone_id = '" . (int)$zID . "'");
00095 
00096         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zID=' . $_GET['zID']));
00097         break;
00098       case 'deleteconfirm_zone':
00099         // demo active test
00100         if (zen_admin_demo()) {
00101           $_GET['action']= '';
00102           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
00103           zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage']));
00104         }
00105         $zID = zen_db_prepare_input($_POST['zID']);
00106 
00107         $check_tax_rates = $db->Execute("select tax_zone_id from " . TABLE_TAX_RATES . " where tax_zone_id='" . $zID . "'");
00108         if ($check_tax_rates->RecordCount() > 0) {
00109           $_GET['action']= '';
00110           $messageStack->add_session(ERROR_TAX_RATE_EXISTS, 'caution');
00111         } else {
00112           $db->Execute("delete from " . TABLE_GEO_ZONES . "
00113                         where geo_zone_id = '" . (int)$zID . "'");
00114 
00115           $db->Execute("delete from " . TABLE_ZONES_TO_GEO_ZONES . "
00116                         where geo_zone_id = '" . (int)$zID . "'");
00117         }
00118 
00119         zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage']));
00120         break;
00121     }
00122   }
00123 ?>
00124 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00125 <html <?php echo HTML_PARAMS; ?>>
00126 <head>
00127 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00128 <title><?php echo TITLE; ?></title>
00129 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00130 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00131 <script language="javascript" src="includes/menu.js"></script>
00132 <script language="javascript" src="includes/general.js"></script>
00133 <?php
00134   if (isset($_GET['zID']) && (($saction == 'edit') || ($saction == 'new'))) {
00135 ?>
00136 <script language="javascript"><!--
00137 function resetZoneSelected(theForm) {
00138   if (theForm.state.value != '') {
00139     theForm.zone_id.selectedIndex = '0';
00140     if (theForm.zone_id.options.length > 0) {
00141       theForm.state.value = '<?php echo JS_STATE_SELECT; ?>';
00142     }
00143   }
00144 }
00145 
00146 function update_zone(theForm) {
00147   var NumState = theForm.zone_id.options.length;
00148   var SelectedCountry = "";
00149 
00150   while(NumState > 0) {
00151     NumState--;
00152     theForm.zone_id.options[NumState] = null;
00153   }
00154 
00155   SelectedCountry = theForm.zone_country_id.options[theForm.zone_country_id.selectedIndex].value;
00156 
00157 <?php echo zen_js_zone_list('SelectedCountry', 'theForm', 'zone_id'); ?>
00158 
00159 }
00160 //--></script>
00161 <?php
00162   }
00163 ?>
00164 <script type="text/javascript">
00165   <!--
00166   function init()
00167   {
00168     cssjsmenu('navbar');
00169     if (document.getElementById)
00170     {
00171       var kill = document.getElementById('hoverJS');
00172       kill.disabled = true;
00173     }
00174   }
00175   // -->
00176 </script>
00177 </head>
00178 <body onLoad="init()">
00179 <!-- header //-->
00180 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00181 <!-- header_eof //-->
00182 
00183 <!-- body //-->
00184 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00185   <tr>
00186 <!-- body_text //-->
00187     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00188       <tr>
00189         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
00190           <tr>
00191             <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>
00192             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
00193           </tr>
00194         </table></td>
00195       </tr>
00196       <tr>
00197         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00198           <tr>
00199             <td valign="top">
00200 <?php
00201   if ($action == 'list') {
00202 ?>
00203             <table border="0" width="100%" cellspacing="0" cellpadding="2">
00204               <tr class="dataTableHeadingRow">
00205                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY; ?></td>
00206                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_ZONE; ?></td>
00207                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
00208               </tr>
00209 <?php
00210 // Split Page
00211 // reset page when page is unknown
00212 if ((!isset($_GET['spage']) or $_GET['spage'] == '' or $_GET['spage'] == '1') and $_GET['sID'] != '') {
00213 //  $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";
00214   $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";
00215   $check_page = $db->Execute($zones_query_raw);
00216   $check_count=1;
00217   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
00218     while (!$check_page->EOF) {
00219       if ($check_page->fields['association_id'] == $_GET['sID']) {
00220         break;
00221       }
00222       $check_count++;
00223       $check_page->MoveNext();
00224     }
00225     $_GET['spage'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
00226   } else {
00227     $_GET['spage'] = 1;
00228   }
00229 }
00230     $rows = 0;
00231 //    $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";
00232     $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";
00233     $zones_split = new splitPageResults($_GET['spage'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows);
00234     $zones = $db->Execute($zones_query_raw);
00235     while (!$zones->EOF) {
00236       $rows++;
00237       if ((!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $zones->fields['association_id']))) && !isset($sInfo) && (substr($action, 0, 3) != 'new')) {
00238         $sInfo = new objectInfo($zones->fields);
00239       }
00240       if (isset($sInfo) && is_object($sInfo) && ($zones->fields['association_id'] == $sInfo->association_id)) {
00241         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";
00242       } else {
00243         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";
00244       }
00245 ?>
00246                 <td class="dataTableContent"><?php echo (($zones->fields['countries_name']) ? $zones->fields['countries_name'] : TEXT_ALL_COUNTRIES); ?></td>
00247                 <td class="dataTableContent"><?php echo (($zones->fields['zone_id']) ? $zones->fields['zone_name'] : PLEASE_SELECT); ?></td>
00248                 <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>
00249               </tr>
00250 <?php
00251       $zones->MoveNext();
00252     }
00253 ?>
00254               <tr>
00255                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00256                   <tr>
00257                     <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>
00258                     <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>
00259                   </tr>
00260                 </table></td>
00261               </tr>
00262               <tr>
00263                 <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>
00264               </tr>
00265             </table>
00266 <?php
00267   } else {
00268 ?>
00269 <?php echo TEXT_LEGEND; ?>&nbsp;
00270 <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . TEXT_LEGEND_TAX_AND_ZONES; ?>&nbsp;&nbsp;&nbsp;
00271 <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . TEXT_LEGEND_ONLY_ZONES; ?>&nbsp;&nbsp;&nbsp;
00272 <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . TEXT_LEGEND_NOT_CONF; ?>&nbsp;&nbsp;&nbsp;<br />
00273             <table border="0" width="100%" cellspacing="0" cellpadding="2">
00274               <tr class="dataTableHeadingRow">
00275                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_ZONES; ?></td>
00276                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_ZONES_DESCRIPTION; ?></td>
00277                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
00278                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
00279               </tr>
00280 <?php
00281 // Split Page
00282 // reset page when page is unknown
00283 if ((!isset($_GET['zpage']) or $_GET['zpage'] == '' or $_GET['zpage'] == '1') and $_GET['zID'] != '') {
00284   $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";
00285   $check_page = $db->Execute($zones_query_raw);
00286   $check_count=1;
00287   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
00288     while (!$check_page->EOF) {
00289       if ($check_page->fields['geo_zone_id'] == $_GET['zID']) {
00290         break;
00291       }
00292       $check_count++;
00293       $check_page->MoveNext();
00294     }
00295     $_GET['zpage'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
00296   } else {
00297     $_GET['zpage'] = 1;
00298   }
00299 }
00300     $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";
00301     $zones_split = new splitPageResults($_GET['zpage'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows);
00302     $zones = $db->Execute($zones_query_raw);
00303     while (!$zones->EOF) {
00304         $num_zones = $db->Execute("select count(*) as num_zones
00305                                    from " . TABLE_ZONES_TO_GEO_ZONES . "
00306                                    where geo_zone_id = '" . (int)$zones->fields['geo_zone_id'] . "'
00307                                    group by geo_zone_id");
00308 
00309         if ($num_zones->fields['num_zones'] > 0) {
00310           $zones->fields['num_zones'] = $num_zones->fields['num_zones'];
00311         } else {
00312           $zones->fields['num_zones'] = 0;
00313         }
00314 
00315         $num_tax_rates = $db->Execute("select count(*) as num_tax_rates
00316                                    from " . TABLE_TAX_RATES . "
00317                                    where tax_zone_id = '" . (int)$zones->fields['geo_zone_id'] . "'
00318                                    group by tax_zone_id");
00319 
00320         if ($num_tax_rates->fields['num_tax_rates'] > 0) {
00321           $zones->fields['num_tax_rates'] = $num_tax_rates->fields['num_tax_rates'];
00322         } else {
00323           $zones->fields['num_tax_rates'] = 0;
00324         }
00325 
00326       if ((!isset($_GET['zID']) || (isset($_GET['zID']) && ($_GET['zID'] == $zones->fields['geo_zone_id']))) && !isset($zInfo) && (substr($action, 0, 3) != 'new')) {
00327         $zInfo = new objectInfo($zones->fields);
00328       }
00329       if (isset($zInfo) && is_object($zInfo) && ($zones->fields['geo_zone_id'] == $zInfo->geo_zone_id)) {
00330         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";
00331       } else {
00332         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";
00333       }
00334 ?>
00335                 <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>
00336                 <td class="dataTableContent"><?php echo $zones->fields['geo_zone_description']; ?></td>
00337                 <td class="dataTableContent" align="center"><?php
00338                     // show current status
00339                     if ($zones->fields['num_tax_rates'] && $zones->fields['num_zones']) {
00340                       echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
00341                     } elseif ($zones->fields['num_zones']) {
00342                       echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif');
00343                     } else {
00344                       echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
00345                     }
00346                   ?></td>
00347                 <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>
00348               </tr>
00349 <?php
00350       $zones->MoveNext();
00351     }
00352 ?>
00353               <tr>
00354                 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00355                   <tr>
00356                     <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>
00357                     <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>
00358                   </tr>
00359                 </table></td>
00360               </tr>
00361               <tr>
00362                 <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>
00363               </tr>
00364             </table>
00365 <?php
00366   }
00367 ?>
00368             </td>
00369 <?php
00370   $heading = array();
00371   $contents = array();
00372 
00373   if ($action == 'list') {
00374     switch ($saction) {
00375       case 'new':
00376         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '</b>');
00377 
00378         $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'));
00379         $contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO);
00380         $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);"'));
00381         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down()));
00382         $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>');
00383         break;
00384       case 'edit':
00385         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '</b>');
00386 
00387         $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'));
00388         $contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO);
00389         $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);"'));
00390         $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));
00391         $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>');
00392         break;
00393       case 'delete':
00394         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SUB_ZONE . '</b>');
00395 
00396         $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));
00397         $contents[] = array('text' => TEXT_INFO_DELETE_SUB_ZONE_INTRO);
00398         $contents[] = array('text' => '<br><b>' . $sInfo->countries_name . '</b>');
00399         $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>');
00400         break;
00401       default:
00402         if (isset($sInfo) && is_object($sInfo)) {
00403           $heading[] = array('text' => '<b>' . $sInfo->countries_name . '</b>');
00404 
00405           $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>');
00406           $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->date_added));
00407           if (zen_not_null($sInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($sInfo->last_modified));
00408         }
00409         break;
00410     }
00411   } else {
00412     switch ($action) {
00413       case 'new_zone':
00414         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_ZONE . '</b>');
00415 
00416         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=insert_zone'));
00417         $contents[] = array('text' => TEXT_INFO_NEW_ZONE_INTRO);
00418         $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')));
00419         $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')));
00420         $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>');
00421         break;
00422       case 'edit_zone':
00423         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ZONE . '</b>');
00424 
00425         $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=save_zone'));
00426         $contents[] = array('text' => TEXT_INFO_EDIT_ZONE_INTRO);
00427         $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')));
00428         $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')));
00429         $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>');
00430         break;
00431       case 'delete_zone':
00432         $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ZONE . '</b>');
00433 
00434         $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));
00435         $contents[] = array('text' => TEXT_INFO_DELETE_ZONE_INTRO);
00436         $contents[] = array('text' => '<br><b>' . $zInfo->geo_zone_name . '</b>');
00437         $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>');
00438         break;
00439       default:
00440         if (isset($zInfo) && is_object($zInfo)) {
00441           $heading[] = array('text' => '<b>' . $zInfo->geo_zone_name . '</b>');
00442 
00443           $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>');
00444           $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>' : ''));
00445           $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_ZONES . ' ' . $zInfo->num_zones);
00446           $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_TAX_RATES . ' ' . $zInfo->num_tax_rates);
00447           $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($zInfo->date_added));
00448           if (zen_not_null($zInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($zInfo->last_modified));
00449           $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_DESCRIPTION . '<br>' . $zInfo->geo_zone_description);
00450         }
00451         break;
00452     }
00453   }
00454 
00455   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
00456     echo '            <td width="25%" valign="top">' . "\n";
00457 
00458     $box = new box;
00459     echo $box->infoBox($heading, $contents);
00460 
00461     echo '            </td>' . "\n";
00462   }
00463 ?>
00464           </tr>
00465         </table></td>
00466       </tr>
00467     </table></td>
00468 <!-- body_text_eof //-->
00469   </tr>
00470 </table>
00471 <!-- body_eof //-->
00472 
00473 <!-- footer //-->
00474 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
00475 <!-- footer_eof //-->
00476 <br>
00477 </body>
00478 </html>
00479 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations