[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: countries.php 3 2006-05-27 04:59:07Z user $ 4 5 osCMax Power E-Commerce 6 http://oscdox.com 7 8 Copyright 2006 osCMax 9 10 Released under the GNU General Public License 11 */ 12 13 require ('includes/application_top.php'); 14 15 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); 16 17 if (tep_not_null($action)) { 18 switch ($action) { 19 case 'insert': 20 $countries_name = tep_db_prepare_input($HTTP_POST_VARS['countries_name']); 21 $countries_iso_code_2 = tep_db_prepare_input($HTTP_POST_VARS['countries_iso_code_2']); 22 $countries_iso_code_3 = tep_db_prepare_input($HTTP_POST_VARS['countries_iso_code_3']); 23 $address_format_id = tep_db_prepare_input($HTTP_POST_VARS['address_format_id']); 24 25 tep_db_query("insert into " . TABLE_COUNTRIES . " (countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id) values ('" . tep_db_input($countries_name) . "', '" . tep_db_input($countries_iso_code_2) . "', '" . tep_db_input($countries_iso_code_3) . "', '" . (int)$address_format_id . "')"); 26 27 tep_redirect(tep_href_link(FILENAME_COUNTRIES)); 28 break; 29 case 'save': 30 $countries_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); 31 $countries_name = tep_db_prepare_input($HTTP_POST_VARS['countries_name']); 32 $countries_iso_code_2 = tep_db_prepare_input($HTTP_POST_VARS['countries_iso_code_2']); 33 $countries_iso_code_3 = tep_db_prepare_input($HTTP_POST_VARS['countries_iso_code_3']); 34 $address_format_id = tep_db_prepare_input($HTTP_POST_VARS['address_format_id']); 35 36 tep_db_query("update " . TABLE_COUNTRIES . " set countries_name = '" . tep_db_input($countries_name) . "', countries_iso_code_2 = '" . tep_db_input($countries_iso_code_2) . "', countries_iso_code_3 = '" . tep_db_input($countries_iso_code_3) . "', address_format_id = '" . (int)$address_format_id . "' where countries_id = '" . (int)$countries_id . "'"); 37 38 tep_redirect(tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $countries_id)); 39 break; 40 case 'deleteconfirm': 41 $countries_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); 42 43 tep_db_query("delete from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'"); 44 45 tep_redirect(tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'])); 46 break; 47 } 48 } 49 ?> 50 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 51 <html <?php echo HTML_PARAMS; ?>> 52 <head> 53 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 54 <title><?php echo TITLE; ?></title> 55 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 56 <script language="javascript" src="includes/general.js"></script> 57 </head> 58 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> 59 <!-- header //--> 60 <?php require (DIR_WS_INCLUDES . 'header.php'); ?> 61 <!-- header_eof //--> 62 63 <!-- body //--> 64 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 65 <tr> 66 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 67 <!-- left_navigation //--> 68 <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?> 69 <!-- left_navigation_eof //--> 70 </table></td> 71 <!-- body_text //--> 72 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 73 <tr> 74 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 75 <tr> 76 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 77 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 78 </tr> 79 </table></td> 80 </tr> 81 <tr> 82 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 83 <tr> 84 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 85 <tr class="dataTableHeadingRow"> 86 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_NAME; ?></td> 87 <td class="dataTableHeadingContent" align="center" colspan="2"><?php echo TABLE_HEADING_COUNTRY_CODES; ?></td> 88 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 89 </tr> 90 <?php 91 $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"; 92 $countries_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $countries_query_raw, $countries_query_numrows); 93 $countries_query = tep_db_query($countries_query_raw); 94 while ($countries = tep_db_fetch_array($countries_query)) { 95 if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $countries['countries_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) { 96 $cInfo = new objectInfo($countries); 97 } 98 99 if (isset($cInfo) && is_object($cInfo) && ($countries['countries_id'] == $cInfo->countries_id)) { 100 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->countries_id . '&action=edit') . '\'">' . "\n"; 101 } else { 102 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $countries['countries_id']) . '\'">' . "\n"; 103 } 104 ?> 105 <td class="dataTableContent"><?php echo $countries['countries_name']; ?></td> 106 <td class="dataTableContent" align="center" width="40"><?php echo $countries['countries_iso_code_2']; ?></td> 107 <td class="dataTableContent" align="center" width="40"><?php echo $countries['countries_iso_code_3']; ?></td> 108 <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($countries['countries_id'] == $cInfo->countries_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $countries['countries_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> 109 </tr> 110 <?php 111 } 112 ?> 113 <tr> 114 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 115 <tr> 116 <td class="smallText" valign="top"><?php echo $countries_split->display_count($countries_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_COUNTRIES); ?></td> 117 <td class="smallText" align="right"><?php echo $countries_split->display_links($countries_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td> 118 </tr> 119 <?php 120 if (empty($action)) { 121 ?> 122 <tr> 123 <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_new_country.gif', IMAGE_NEW_COUNTRY) . '</a>'; ?></td> 124 </tr> 125 <?php 126 } 127 ?> 128 </table></td> 129 </tr> 130 </table></td> 131 <?php 132 $heading = array(); 133 $contents = array(); 134 135 switch ($action) { 136 case 'new': 137 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_COUNTRY . '</b>'); 138 139 $contents = array('form' => tep_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&action=insert')); 140 $contents[] = array('text' => TEXT_INFO_INSERT_INTRO); 141 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . tep_draw_input_field('countries_name')); 142 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . tep_draw_input_field('countries_iso_code_2')); 143 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . tep_draw_input_field('countries_iso_code_3')); 144 $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . '<br>' . tep_draw_pull_down_menu('address_format_id', tep_get_address_formats())); 145 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 146 break; 147 case 'edit': 148 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_COUNTRY . '</b>'); 149 150 $contents = array('form' => tep_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->countries_id . '&action=save')); 151 $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); 152 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . tep_draw_input_field('countries_name', $cInfo->countries_name)); 153 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . tep_draw_input_field('countries_iso_code_2', $cInfo->countries_iso_code_2)); 154 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . tep_draw_input_field('countries_iso_code_3', $cInfo->countries_iso_code_3)); 155 $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . '<br>' . tep_draw_pull_down_menu('address_format_id', tep_get_address_formats(), $cInfo->address_format_id)); 156 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->countries_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 157 break; 158 case 'delete': 159 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_COUNTRY . '</b>'); 160 161 $contents = array('form' => tep_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->countries_id . '&action=deleteconfirm')); 162 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); 163 $contents[] = array('text' => '<br><b>' . $cInfo->countries_name . '</b>'); 164 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->countries_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 165 break; 166 default: 167 if (is_object($cInfo)) { 168 $heading[] = array('text' => '<b>' . $cInfo->countries_name . '</b>'); 169 170 $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->countries_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_COUNTRIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $cInfo->countries_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 171 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . $cInfo->countries_name); 172 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . ' ' . $cInfo->countries_iso_code_2); 173 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . ' ' . $cInfo->countries_iso_code_3); 174 $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . ' ' . $cInfo->address_format_id); 175 } 176 break; 177 } 178 179 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { 180 echo ' <td width="25%" valign="top">' . "\n"; 181 182 $box = new box; 183 echo $box->infoBox($heading, $contents); 184 185 echo ' </td>' . "\n"; 186 } 187 ?> 188 </tr> 189 </table></td> 190 </tr> 191 </table></td> 192 <!-- body_text_eof //--> 193 </tr> 194 </table> 195 <!-- body_eof //--> 196 197 <!-- footer //--> 198 <?php require (DIR_WS_INCLUDES . 'footer.php'); ?> 199 <!-- footer_eof //--> 200 <br> 201 </body> 202 </html> 203 <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |