[ 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/ -> countries.php (source)

   1  <?php
   2  //

   3  // +----------------------------------------------------------------------+

   4  // |zen-cart Open Source E-commerce                                       |

   5  // +----------------------------------------------------------------------+

   6  // | Copyright (c) 2003 The zen-cart developers                           |

   7  // |                                                                      |

   8  // | http://www.zen-cart.com/index.php                                    |

   9  // |                                                                      |

  10  // | Portions Copyright (c) 2003 osCommerce                               |

  11  // +----------------------------------------------------------------------+

  12  // | This source file is subject to version 2.0 of the GPL license,       |

  13  // | that is bundled with this package in the file LICENSE, and is        |

  14  // | available through the world-wide-web at the following url:           |

  15  // | http://www.zen-cart.com/license/2_0.txt.                             |

  16  // | If you did not receive a copy of the zen-cart license and are unable |

  17  // | to obtain it through the world-wide-web, please send a note to       |

  18  // | license@zen-cart.com so we can mail you a copy immediately.          |

  19  // +----------------------------------------------------------------------+

  20  //  $Id: countries.php 1969 2005-09-13 06:57:21Z drbyte $

  21  //

  22  
  23    require ('includes/application_top.php');
  24  
  25    $action = (isset($_GET['action']) ? $_GET['action'] : '');
  26  
  27    if (zen_not_null($action)) {
  28      switch ($action) {
  29        case 'insert':
  30          $countries_name = zen_db_prepare_input($_POST['countries_name']);
  31          $countries_iso_code_2 = zen_db_prepare_input($_POST['countries_iso_code_2']);
  32          $countries_iso_code_3 = zen_db_prepare_input($_POST['countries_iso_code_3']);
  33          $address_format_id = zen_db_prepare_input($_POST['address_format_id']);
  34  
  35          $db->Execute("insert into " . TABLE_COUNTRIES . "
  36                      (countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id)
  37                      values ('" . zen_db_input($countries_name) . "',
  38                              '" . zen_db_input($countries_iso_code_2) . "',
  39                              '" . zen_db_input($countries_iso_code_3) . "',
  40                              '" . (int)$address_format_id . "')");
  41  
  42          zen_redirect(zen_href_link(FILENAME_COUNTRIES));
  43          break;
  44        case 'save':
  45          $countries_id = zen_db_prepare_input($_GET['cID']);
  46          $countries_name = zen_db_prepare_input($_POST['countries_name']);
  47          $countries_iso_code_2 = zen_db_prepare_input($_POST['countries_iso_code_2']);
  48          $countries_iso_code_3 = zen_db_prepare_input($_POST['countries_iso_code_3']);
  49          $address_format_id = zen_db_prepare_input($_POST['address_format_id']);
  50  
  51          $db->Execute("update " . TABLE_COUNTRIES . "
  52                        set countries_name = '" . zen_db_input($countries_name) . "',
  53                            countries_iso_code_2 = '" . zen_db_input($countries_iso_code_2) . "',
  54                            countries_iso_code_3 = '" . zen_db_input($countries_iso_code_3) . "',
  55                            address_format_id = '" . (int)$address_format_id . "'
  56                        where countries_id = '" . (int)$countries_id . "'");
  57  
  58          zen_redirect(zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries_id));
  59          break;
  60        case 'deleteconfirm':
  61          // demo active test

  62          if (zen_admin_demo()) {
  63            $_GET['action']= '';
  64            $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  65            zen_redirect(zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page']));
  66          }
  67          $countries_id = zen_db_prepare_input($_GET['cID']);
  68  
  69          $db->Execute("delete from " . TABLE_COUNTRIES . "
  70                        where countries_id = '" . (int)$countries_id . "'");
  71  
  72          zen_redirect(zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page']));
  73          break;
  74      }
  75    }
  76  ?>
  77  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  78  <html <?php echo HTML_PARAMS; ?>>
  79  <head>
  80  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  81  <title><?php echo TITLE; ?></title>
  82  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  83  <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  84  <script language="javascript" src="includes/menu.js"></script>
  85  <script language="javascript" src="includes/general.js"></script>
  86  <script type="text/javascript">
  87    <!--
  88    function init()
  89    {
  90      cssjsmenu('navbar');
  91      if (document.getElementById)
  92      {
  93        var kill = document.getElementById('hoverJS');
  94        kill.disabled = true;
  95      }
  96    }
  97    // -->

  98  </script>
  99  </head>
 100  <body onload="init()">
 101  <!-- header //-->
 102  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
 103  <!-- header_eof //-->
 104  
 105  <!-- body //-->
 106  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 107    <tr>
 108  <!-- body_text //-->
 109      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 110        <tr>
 111          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 112            <tr>
 113              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 114              <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 115            </tr>
 116          </table></td>
 117        </tr>
 118        <tr>
 119          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 120            <tr>
 121              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 122                <tr class="dataTableHeadingRow">
 123                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_NAME; ?></td>
 124                  <td class="dataTableHeadingContent" align="center" colspan="2"><?php echo TABLE_HEADING_COUNTRY_CODES; ?></td>
 125                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 126                </tr>
 127  <?php
 128    $countries_query_raw = "select countries_id, countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id from " . TABLE_COUNTRIES . " order by countries_name";
 129    $countries_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $countries_query_raw, $countries_query_numrows);
 130    $countries = $db->Execute($countries_query_raw);
 131    while (!$countries->EOF) {
 132      if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $countries->fields['countries_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
 133        $cInfo = new objectInfo($countries->fields);
 134      }
 135  
 136      if (isset($cInfo) && is_object($cInfo) && ($countries->fields['countries_id'] == $cInfo->countries_id)) {
 137        echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=edit') . '\'">' . "\n";
 138      } else {
 139        echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries->fields['countries_id']) . '\'">' . "\n";
 140      }
 141  ?>
 142                  <td class="dataTableContent"><?php echo $countries->fields['countries_name']; ?></td>
 143                  <td class="dataTableContent" align="center" width="40"><?php echo $countries->fields['countries_iso_code_2']; ?></td>
 144                  <td class="dataTableContent" align="center" width="40"><?php echo $countries->fields['countries_iso_code_3']; ?></td>
 145                  <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($countries->fields['countries_id'] == $cInfo->countries_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries->fields['countries_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 146                </tr>
 147  <?php
 148      $countries->MoveNext();
 149    }
 150  ?>
 151                <tr>
 152                  <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 153                    <tr>
 154                      <td class="smallText" valign="top"><?php echo $countries_split->display_count($countries_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_COUNTRIES); ?></td>
 155                      <td class="smallText" align="right"><?php echo $countries_split->display_links($countries_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
 156                    </tr>
 157  <?php
 158    if (empty($action)) {
 159  ?>
 160                    <tr>
 161                      <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_country.gif', IMAGE_NEW_COUNTRY) . '</a>'; ?></td>
 162                    </tr>
 163  <?php
 164    }
 165  ?>
 166                  </table></td>
 167                </tr>
 168              </table></td>
 169  <?php
 170    $heading = array();
 171    $contents = array();
 172  
 173    switch ($action) {
 174      case 'new':
 175        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_COUNTRY . '</b>');
 176  
 177        $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&action=insert'));
 178        $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
 179        $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_input_field('countries_name'));
 180        $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . zen_draw_input_field('countries_iso_code_2'));
 181        $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . zen_draw_input_field('countries_iso_code_3'));
 182        $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . '<br>' . zen_draw_pull_down_menu('address_format_id', zen_get_address_formats()));
 183        $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 184        break;
 185      case 'edit':
 186        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_COUNTRY . '</b>');
 187  
 188        $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=save'));
 189        $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
 190        $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_input_field('countries_name', $cInfo->countries_name));
 191        $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . zen_draw_input_field('countries_iso_code_2', $cInfo->countries_iso_code_2));
 192        $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . zen_draw_input_field('countries_iso_code_3', $cInfo->countries_iso_code_3));
 193        $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . '<br>' . zen_draw_pull_down_menu('address_format_id', zen_get_address_formats(), $cInfo->address_format_id));
 194        $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 195        break;
 196      case 'delete':
 197        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_COUNTRY . '</b>');
 198  
 199        $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=deleteconfirm'));
 200        $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
 201        $contents[] = array('text' => '<br><b>' . $cInfo->countries_name . '</b>');
 202        $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 203        break;
 204      default:
 205        if (is_object($cInfo)) {
 206          $heading[] = array('text' => '<b>' . $cInfo->countries_name . '</b>');
 207  
 208          $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 209          $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . $cInfo->countries_name);
 210          $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . ' ' . $cInfo->countries_iso_code_2);
 211          $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . ' ' . $cInfo->countries_iso_code_3);
 212          $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . ' ' . $cInfo->address_format_id);
 213        }
 214        break;
 215    }
 216  
 217    if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
 218      echo '            <td width="25%" valign="top">' . "\n";
 219  
 220      $box = new box;
 221      echo $box->infoBox($heading, $contents);
 222  
 223      echo '            </td>' . "\n";
 224    }
 225  ?>
 226            </tr>
 227          </table></td>
 228        </tr>
 229      </table></td>
 230  <!-- body_text_eof //-->
 231    </tr>
 232  </table>
 233  <!-- body_eof //-->
 234  
 235  <!-- footer //-->
 236  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 237  <!-- footer_eof //-->
 238  <br>
 239  </body>
 240  </html>
 241  <?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