home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 90 / PIWD90.iso / pc / contents / ecommerce / software / osCommerce.exe / oscommerce-2.2ms2 / catalog / address_book.php < prev    next >
PHP Script  |  2003-06-09  |  9KB  |  191 lines

  1. <?php
  2. /*
  3.   $Id: address_book.php,v 1.58 2003/06/09 23:03:52 hpdl Exp $
  4.  
  5.   osCommerce, Open Source E-Commerce Solutions
  6.   http://www.oscommerce.com
  7.  
  8.   Copyright (c) 2003 osCommerce
  9.  
  10.   Released under the GNU General Public License
  11. */
  12.  
  13.   require('includes/application_top.php');
  14.  
  15.   if (!tep_session_is_registered('customer_id')) {
  16.     $navigation->set_snapshot();
  17.     tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  18.   }
  19.  
  20.   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADDRESS_BOOK);
  21.  
  22.   $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  23.   $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
  24. ?>
  25. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  26. <html <?php echo HTML_PARAMS; ?>>
  27. <head>
  28. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  29. <title><?php echo TITLE; ?></title>
  30. <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
  31. <link rel="stylesheet" type="text/css" href="stylesheet.css">
  32. <script language="javascript"><!--
  33. function rowOverEffect(object) {
  34.   if (object.className == 'moduleRow') object.className = 'moduleRowOver';
  35. }
  36.  
  37. function rowOutEffect(object) {
  38.   if (object.className == 'moduleRowOver') object.className = 'moduleRow';
  39. }
  40. //--></script>
  41. </head>
  42. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
  43. <!-- header //-->
  44. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  45. <!-- header_eof //-->
  46.  
  47. <!-- body //-->
  48. <table border="0" width="100%" cellspacing="3" cellpadding="3">
  49.   <tr>
  50.     <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  51. <!-- left_navigation //-->
  52. <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  53. <!-- left_navigation_eof //-->
  54.     </table></td>
  55. <!-- body_text //-->
  56.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  57.       <tr>
  58.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  59.           <tr>
  60.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  61.             <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_address_book.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  62.           </tr>
  63.         </table></td>
  64.       </tr>
  65.       <tr>
  66.         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  67.       </tr>
  68. <?php
  69.   if ($messageStack->size('addressbook') > 0) {
  70. ?>
  71.       <tr>
  72.         <td><?php echo $messageStack->output('addressbook'); ?></td>
  73.       </tr>
  74.       <tr>
  75.         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  76.       </tr>
  77. <?php
  78.   }
  79. ?>
  80.       <tr>
  81.         <td class="main"><b><?php echo PRIMARY_ADDRESS_TITLE; ?></b></td>
  82.       </tr>
  83.       <tr>
  84.         <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  85.           <tr class="infoBoxContents">
  86.             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  87.               <tr>
  88.                 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  89.                 <td class="main" width="50%" valign="top"><?php echo PRIMARY_ADDRESS_DESCRIPTION; ?></td>
  90.                 <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
  91.                   <tr>
  92.                     <td class="main" align="center" valign="top"><b><?php echo PRIMARY_ADDRESS_TITLE; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
  93.                     <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  94.                     <td class="main" valign="top"><?php echo tep_address_label($customer_id, $customer_default_address_id, true, ' ', '<br>'); ?></td>
  95.                     <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  96.                   </tr>
  97.                 </table></td>
  98.               </tr>
  99.             </table></td>
  100.           </tr>
  101.         </table></td>
  102.       </tr>
  103.       <tr>
  104.         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  105.       </tr>
  106.       <tr>
  107.         <td class="main"><b><?php echo ADDRESS_BOOK_TITLE; ?></b></td>
  108.       </tr>
  109.       <tr>
  110.         <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  111.           <tr class="infoBoxContents">
  112.             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  113. <?php
  114.   $addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' order by firstname, lastname");
  115.   while ($addresses = tep_db_fetch_array($addresses_query)) {
  116.     $format_id = tep_get_address_format_id($addresses['country_id']);
  117. ?>
  118.               <tr>
  119.                 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  120.                 <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  121.                   <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL'); ?>'">
  122.                     <td class="main"><b><?php echo tep_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']); ?></b><?php if ($addresses['address_book_id'] == $customer_default_address_id) echo ' <small><i>' . PRIMARY_ADDRESS . '</i></small>'; ?></td>
  123.                     <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL') . '">' . tep_image_button('small_edit.gif', SMALL_IMAGE_BUTTON_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $addresses['address_book_id'], 'SSL') . '">' . tep_image_button('small_delete.gif', SMALL_IMAGE_BUTTON_DELETE) . '</a>'; ?></td>
  124.                   </tr>
  125.                   <tr>
  126.                     <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  127.                       <tr>
  128.                         <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  129.                         <td class="main"><?php echo tep_address_format($format_id, $addresses, true, ' ', '<br>'); ?></td>
  130.                         <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  131.                       </tr>
  132.                     </table></td>
  133.                   </tr>
  134.                 </table></td>
  135.                 <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  136.               </tr>
  137. <?php
  138.   }
  139. ?>
  140.             </table></td>
  141.           </tr>
  142.         </table></td>
  143.       </tr>
  144.       <tr>
  145.         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  146.       </tr>
  147.       <tr>
  148.         <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  149.           <tr class="infoBoxContents">
  150.             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  151.               <tr>
  152.                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  153.                 <td class="smallText"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
  154. <?php
  155.   if (tep_count_customer_address_book_entries() < MAX_ADDRESS_BOOK_ENTRIES) {
  156. ?>
  157.                 <td class="smallText" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, '', 'SSL') . '">' . tep_image_button('button_add_address.gif', IMAGE_BUTTON_ADD_ADDRESS) . '</a>'; ?></td>
  158. <?php
  159.   }
  160. ?>
  161.                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  162.               </tr>
  163.             </table></td>
  164.           </tr>
  165.         </table></td>
  166.       </tr>
  167.       <tr>
  168.         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  169.       </tr>
  170.       <tr>
  171.         <td class="smallText"><?php echo sprintf(TEXT_MAXIMUM_ENTRIES, MAX_ADDRESS_BOOK_ENTRIES); ?></td>
  172.       </tr>
  173.     </table></td>
  174. <!-- body_text_eof //-->
  175.     <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  176. <!-- right_navigation //-->
  177. <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
  178. <!-- right_navigation_eof //-->
  179.     </table></td>
  180.   </tr>
  181. </table>
  182. <!-- body_eof //-->
  183.  
  184. <!-- footer //-->
  185. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  186. <!-- footer_eof //-->
  187. <br>
  188. </body>
  189. </html>
  190. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  191.