[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/admin/ -> geo_zones.php (source)

   1  <?php
   2  /**

   3   * @package admin

   4   * @copyright Copyright 2003-2006 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 4838 2006-10-26 02:13:50Z ajeh $

   8   */
   9  
  10    require ('includes/application_top.php');
  11  
  12    $saction = (isset($_GET['saction']) ? $_GET['saction'] : '');
  13  
  14    if (zen_not_null($saction)) {
  15      switch ($saction) {
  16        case 'insert_sub':
  17          $zID = zen_db_prepare_input($_GET['zID']);
  18          $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
  19          $zone_id = zen_db_prepare_input($_POST['zone_id']);
  20  
  21          $db->Execute("insert into " . TABLE_ZONES_TO_GEO_ZONES . "
  22                      (zone_country_id, zone_id, geo_zone_id, date_added)
  23                      values ('" . (int)$zone_country_id . "',
  24                              '" . (int)$zone_id . "',
  25                              '" . (int)$zID . "',
  26                              now())");
  27  
  28          $new_subzone_id = $db->Insert_ID();
  29  
  30  //        zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $new_subzone_id));

  31          zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list' . '&sID=' . $new_subzone_id));
  32          break;
  33        case 'save_sub':
  34          $sID = zen_db_prepare_input($_GET['sID']);
  35          $zID = zen_db_prepare_input($_GET['zID']);
  36          $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
  37          $zone_id = zen_db_prepare_input($_POST['zone_id']);
  38  
  39          $db->Execute("update " . TABLE_ZONES_TO_GEO_ZONES . "
  40                        set geo_zone_id = '" . (int)$zID . "',
  41                            zone_country_id = '" . (int)$zone_country_id . "',
  42                            zone_id = " . (zen_not_null($zone_id) ? "'" . (int)$zone_id . "'" : 'null') . ",
  43                            last_modified = now()
  44                        where association_id = '" . (int)$sID . "'");
  45  
  46  
  47          zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $_GET['sID']));
  48          break;
  49        case 'deleteconfirm_sub':
  50          // demo active test

  51          if (zen_admin_demo()) {
  52            $_GET['action']= '';
  53            $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  54            zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage']));
  55          }
  56          $sID = zen_db_prepare_input($_GET['sID']);
  57  
  58          $db->Execute("delete from " . TABLE_ZONES_TO_GEO_ZONES . "
  59                        where association_id = '" . (int)$sID . "'");
  60  
  61          zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage']));
  62          break;
  63      }
  64    }
  65  
  66    $action = (isset($_GET['action']) ? $_GET['action'] : '');
  67  
  68    if (zen_not_null($action)) {
  69      switch ($action) {
  70        case 'insert_zone':
  71          $geo_zone_name = zen_db_prepare_input($_POST['geo_zone_name']);
  72          $geo_zone_description = zen_db_prepare_input($_POST['geo_zone_description']);
  73  
  74          $db->Execute("insert into " . TABLE_GEO_ZONES . "
  75                      (geo_zone_name, geo_zone_description, date_added)
  76                      values ('" . zen_db_input($geo_zone_name) . "',
  77                              '" . zen_db_input($geo_zone_description) . "',
  78                              now())");
  79  
  80          $new_zone_id = $db->Insert_ID();
  81          zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zID=' . $new_zone_id));
  82          break;
  83        case 'save_zone':
  84          $zID = zen_db_prepare_input($_GET['zID']);
  85          $geo_zone_name = zen_db_prepare_input($_POST['geo_zone_name']);
  86          $geo_zone_description = zen_db_prepare_input($_POST['geo_zone_description']);
  87  
  88          $db->Execute("update " . TABLE_GEO_ZONES . "
  89                        set geo_zone_name = '" . zen_db_input($geo_zone_name) . "',
  90                            geo_zone_description = '" . zen_db_input($geo_zone_description) . "',
  91                            last_modified = now() where geo_zone_id = '" . (int)$zID . "'");
  92  
  93          zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zID=' . $_GET['zID']));
  94          break;
  95        case 'deleteconfirm_zone':
  96          // demo active test

  97          if (zen_admin_demo()) {
  98            $_GET['action']= '';
  99            $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
 100            zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage']));
 101          }
 102          $zID = zen_db_prepare_input($_GET['zID']);
 103  
 104          $check_tax_rates = $db->Execute("select tax_zone_id from " . TABLE_TAX_RATES . " where tax_zone_id='" . $zID . "'");
 105          if ($check_tax_rates->RecordCount() > 0) {
 106            $_GET['action']= '';
 107            $messageStack->add_session(ERROR_TAX_RATE_EXISTS, 'caution');
 108          } else {
 109            $db->Execute("delete from " . TABLE_GEO_ZONES . "
 110                          where geo_zone_id = '" . (int)$zID . "'");
 111  
 112            $db->Execute("delete from " . TABLE_ZONES_TO_GEO_ZONES . "
 113                          where geo_zone_id = '" . (int)$zID . "'");
 114          }
 115  
 116          zen_redirect(zen_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage']));
 117          break;
 118      }
 119    }
 120  ?>
 121  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 122  <html <?php echo HTML_PARAMS; ?>>
 123  <head>
 124  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 125  <title><?php echo TITLE; ?></title>
 126  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 127  <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
 128  <script language="javascript" src="includes/menu.js"></script>
 129  <script language="javascript" src="includes/general.js"></script>
 130  <?php
 131    if (isset($_GET['zID']) && (($saction == 'edit') || ($saction == 'new'))) {
 132  ?>
 133  <script language="javascript"><!--
 134  function resetZoneSelected(theForm) {
 135    if (theForm.state.value != '') {
 136      theForm.zone_id.selectedIndex = '0';
 137      if (theForm.zone_id.options.length > 0) {
 138        theForm.state.value = '<?php echo JS_STATE_SELECT; ?>';
 139      }
 140    }
 141  }
 142  
 143  function update_zone(theForm) {
 144    var NumState = theForm.zone_id.options.length;
 145    var SelectedCountry = "";
 146  
 147    while(NumState > 0) {
 148      NumState--;
 149      theForm.zone_id.options[NumState] = null;
 150    }
 151  
 152    SelectedCountry = theForm.zone_country_id.options[theForm.zone_country_id.selectedIndex].value;
 153  
 154  <?php echo zen_js_zone_list('SelectedCountry', 'theForm', 'zone_id'); ?>
 155  
 156  }
 157  //--></script>

 158  <?php
 159    }
 160  ?>
 161  <script type="text/javascript">
 162    <!--
 163    function init()
 164    {
 165      cssjsmenu('navbar');
 166      if (document.getElementById)
 167      {
 168        var kill = document.getElementById('hoverJS');
 169        kill.disabled = true;
 170      }
 171    }
 172    // -->

 173  </script>
 174  </head>
 175  <body onLoad="init()">
 176  <!-- header //-->
 177  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
 178  <!-- header_eof //-->
 179  
 180  <!-- body //-->
 181  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 182    <tr>
 183  <!-- body_text //-->
 184      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 185        <tr>
 186          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 187            <tr>
 188              <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>
 189              <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 190            </tr>
 191          </table></td>
 192        </tr>
 193        <tr>
 194          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 195            <tr>
 196              <td valign="top">
 197  <?php
 198    if ($action == 'list') {
 199  ?>
 200              <table border="0" width="100%" cellspacing="0" cellpadding="2">
 201                <tr class="dataTableHeadingRow">
 202                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY; ?></td>
 203                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_ZONE; ?></td>
 204                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 205                </tr>
 206  <?php
 207  // Split Page

 208  // reset page when page is unknown

 209  if ((!isset($_GET['spage']) or $_GET['spage'] == '' or $_GET['spage'] == '1') and $_GET['sID'] != '') {
 210  //  $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";

 211    $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";
 212    $check_page = $db->Execute($zones_query_raw);
 213    $check_count=1;
 214    if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
 215      while (!$check_page->EOF) {
 216        if ($check_page->fields['association_id'] == $_GET['sID']) {
 217          break;
 218        }
 219        $check_count++;
 220        $check_page->MoveNext();
 221      }
 222      $_GET['spage'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
 223    } else {
 224      $_GET['spage'] = 1;
 225    }
 226  }
 227      $rows = 0;
 228  //    $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";

 229      $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";
 230      $zones_split = new splitPageResults($_GET['spage'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows);
 231      $zones = $db->Execute($zones_query_raw);
 232      while (!$zones->EOF) {
 233        $rows++;
 234        if ((!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $zones->fields['association_id']))) && !isset($sInfo) && (substr($action, 0, 3) != 'new')) {
 235          $sInfo = new objectInfo($zones->fields);
 236        }
 237        if (isset($sInfo) && is_object($sInfo) && ($zones->fields['association_id'] == $sInfo->association_id)) {
 238          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";
 239        } else {
 240          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";
 241        }
 242  ?>
 243                  <td class="dataTableContent"><?php echo (($zones->fields['countries_name']) ? $zones->fields['countries_name'] : TEXT_ALL_COUNTRIES); ?></td>
 244                  <td class="dataTableContent"><?php echo (($zones->fields['zone_id']) ? $zones->fields['zone_name'] : PLEASE_SELECT); ?></td>
 245                  <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>
 246                </tr>
 247  <?php
 248        $zones->MoveNext();
 249      }
 250  ?>
 251                <tr>
 252                  <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 253                    <tr>
 254                      <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>
 255                      <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>
 256                    </tr>
 257                  </table></td>
 258                </tr>
 259                <tr>
 260                  <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>
 261                </tr>
 262              </table>
 263  <?php
 264    } else {
 265  ?>
 266  <?php echo TEXT_LEGEND; ?>&nbsp;
 267  <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . TEXT_LEGEND_TAX_AND_ZONES; ?>&nbsp;&nbsp;&nbsp;
 268  <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . TEXT_LEGEND_ONLY_ZONES; ?>&nbsp;&nbsp;&nbsp;
 269  <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . TEXT_LEGEND_NOT_CONF; ?>&nbsp;&nbsp;&nbsp;<br />
 270              <table border="0" width="100%" cellspacing="0" cellpadding="2">
 271                <tr class="dataTableHeadingRow">
 272                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_ZONES; ?></td>
 273                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_ZONES_DESCRIPTION; ?></td>
 274                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
 275                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 276                </tr>
 277  <?php
 278  // Split Page

 279  // reset page when page is unknown

 280  if ((!isset($_GET['zpage']) or $_GET['zpage'] == '' or $_GET['zpage'] == '1') and $_GET['zID'] != '') {
 281    $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";
 282    $check_page = $db->Execute($zones_query_raw);
 283    $check_count=1;
 284    if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
 285      while (!$check_page->EOF) {
 286        if ($check_page->fields['geo_zone_id'] == $_GET['zID']) {
 287          break;
 288        }
 289        $check_count++;
 290        $check_page->MoveNext();
 291      }
 292      $_GET['zpage'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
 293    } else {
 294      $_GET['zpage'] = 1;
 295    }
 296  }
 297      $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";
 298      $zones_split = new splitPageResults($_GET['zpage'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows);
 299      $zones = $db->Execute($zones_query_raw);
 300      while (!$zones->EOF) {
 301          $num_zones = $db->Execute("select count(*) as num_zones
 302                                     from " . TABLE_ZONES_TO_GEO_ZONES . "
 303                                     where geo_zone_id = '" . (int)$zones->fields['geo_zone_id'] . "'
 304                                     group by geo_zone_id");
 305  
 306          if ($num_zones->fields['num_zones'] > 0) {
 307            $zones->fields['num_zones'] = $num_zones->fields['num_zones'];
 308          } else {
 309            $zones->fields['num_zones'] = 0;
 310          }
 311  
 312          $num_tax_rates = $db->Execute("select count(*) as num_tax_rates
 313                                     from " . TABLE_TAX_RATES . "
 314                                     where tax_zone_id = '" . (int)$zones->fields['geo_zone_id'] . "'
 315                                     group by tax_zone_id");
 316  
 317          if ($num_tax_rates->fields['num_tax_rates'] > 0) {
 318            $zones->fields['num_tax_rates'] = $num_tax_rates->fields['num_tax_rates'];
 319          } else {
 320            $zones->fields['num_tax_rates'] = 0;
 321          }
 322  
 323        if ((!isset($_GET['zID']) || (isset($_GET['zID']) && ($_GET['zID'] == $zones->fields['geo_zone_id']))) && !isset($zInfo) && (substr($action, 0, 3) != 'new')) {
 324          $zInfo = new objectInfo($zones->fields);
 325        }
 326        if (isset($zInfo) && is_object($zInfo) && ($zones->fields['geo_zone_id'] == $zInfo->geo_zone_id)) {
 327          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";
 328        } else {
 329          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";
 330        }
 331  ?>
 332                  <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>
 333                  <td class="dataTableContent"><?php echo $zones->fields['geo_zone_description']; ?></td>
 334                  <td class="dataTableContent" align="center"><?php
 335                      // show current status

 336                      if ($zones->fields['num_tax_rates'] && $zones->fields['num_zones']) {
 337                        echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
 338                      } elseif ($zones->fields['num_zones']) {
 339                        echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif');
 340                      } else {
 341                        echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
 342                      }
 343                    ?></td>
 344                  <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>
 345                </tr>
 346  <?php
 347        $zones->MoveNext();
 348      }
 349  ?>
 350                <tr>
 351                  <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 352                    <tr>
 353                      <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>
 354                      <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>
 355                    </tr>
 356                  </table></td>
 357                </tr>
 358                <tr>
 359                  <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>
 360                </tr>
 361              </table>
 362  <?php
 363    }
 364  ?>
 365              </td>
 366  <?php
 367    $heading = array();
 368    $contents = array();
 369  
 370    if ($action == 'list') {
 371      switch ($saction) {
 372        case 'new':
 373          $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '</b>');
 374  
 375          $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'));
 376          $contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO);
 377          $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);"'));
 378          $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_ZONE . '<br>' . zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down()));
 379          $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>');
 380          break;
 381        case 'edit':
 382          $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '</b>');
 383  
 384          $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'));
 385          $contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO);
 386          $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);"'));
 387          $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));
 388          $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>');
 389          break;
 390        case 'delete':
 391          $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SUB_ZONE . '</b>');
 392  
 393          $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=deleteconfirm_sub'));
 394          $contents[] = array('text' => TEXT_INFO_DELETE_SUB_ZONE_INTRO);
 395          $contents[] = array('text' => '<br><b>' . $sInfo->countries_name . '</b>');
 396          $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>');
 397          break;
 398        default:
 399          if (isset($sInfo) && is_object($sInfo)) {
 400            $heading[] = array('text' => '<b>' . $sInfo->countries_name . '</b>');
 401  
 402            $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>');
 403            $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($sInfo->date_added));
 404            if (zen_not_null($sInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($sInfo->last_modified));
 405          }
 406          break;
 407      }
 408    } else {
 409      switch ($action) {
 410        case 'new_zone':
 411          $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_ZONE . '</b>');
 412  
 413          $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=insert_zone'));
 414          $contents[] = array('text' => TEXT_INFO_NEW_ZONE_INTRO);
 415          $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')));
 416          $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')));
 417          $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>');
 418          break;
 419        case 'edit_zone':
 420          $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ZONE . '</b>');
 421  
 422          $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=save_zone'));
 423          $contents[] = array('text' => TEXT_INFO_EDIT_ZONE_INTRO);
 424          $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_NAME . '<br>' . zen_draw_input_field('geo_zone_name', $zInfo->geo_zone_name, zen_set_field_length(TABLE_GEO_ZONES, 'geo_zone_name')));
 425          $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_DESCRIPTION . '<br>' . zen_draw_input_field('geo_zone_description', $zInfo->geo_zone_description, zen_set_field_length(TABLE_GEO_ZONES, 'geo_zone_description')));
 426          $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>');
 427          break;
 428        case 'delete_zone':
 429          $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ZONE . '</b>');
 430  
 431          $contents = array('form' => zen_draw_form('zones', FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=deleteconfirm_zone'));
 432          $contents[] = array('text' => TEXT_INFO_DELETE_ZONE_INTRO);
 433          $contents[] = array('text' => '<br><b>' . $zInfo->geo_zone_name . '</b>');
 434          $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>');
 435          break;
 436        default:
 437          if (isset($zInfo) && is_object($zInfo)) {
 438            $heading[] = array('text' => '<b>' . $zInfo->geo_zone_name . '</b>');
 439  
 440            $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>');
 441            $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>' : ''));
 442            $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_ZONES . ' ' . $zInfo->num_zones);
 443            $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_TAX_RATES . ' ' . $zInfo->num_tax_rates);
 444            $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($zInfo->date_added));
 445            if (zen_not_null($zInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($zInfo->last_modified));
 446            $contents[] = array('text' => '<br>' . TEXT_INFO_ZONE_DESCRIPTION . '<br>' . $zInfo->geo_zone_description);
 447          }
 448          break;
 449      }
 450    }
 451  
 452    if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
 453      echo '            <td width="25%" valign="top">' . "\n";
 454  
 455      $box = new box;
 456      echo $box->infoBox($heading, $contents);
 457  
 458      echo '            </td>' . "\n";
 459    }
 460  ?>
 461            </tr>
 462          </table></td>
 463        </tr>
 464      </table></td>
 465  <!-- body_text_eof //-->
 466    </tr>
 467  </table>
 468  <!-- body_eof //-->
 469  
 470  <!-- footer //-->
 471  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 472  <!-- footer_eof //-->
 473  <br>
 474  </body>
 475  </html>
 476  <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics