|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 require('includes/application_top.php'); 00011 00012 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 00013 00014 if (zen_not_null($action)) { 00015 switch ($action) { 00016 case 'insert': 00017 $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']); 00018 $zone_code = zen_db_prepare_input($_POST['zone_code']); 00019 $zone_name = zen_db_prepare_input($_POST['zone_name']); 00020 00021 $db->Execute("insert into " . TABLE_ZONES . " 00022 (zone_country_id, zone_code, zone_name) 00023 values ('" . (int)$zone_country_id . "', 00024 '" . zen_db_input($zone_code) . "', 00025 '" . zen_db_input($zone_name) . "')"); 00026 00027 zen_redirect(zen_href_link(FILENAME_ZONES)); 00028 break; 00029 case 'save': 00030 $zone_id = zen_db_prepare_input($_GET['cID']); 00031 $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']); 00032 $zone_code = zen_db_prepare_input($_POST['zone_code']); 00033 $zone_name = zen_db_prepare_input($_POST['zone_name']); 00034 00035 $db->Execute("update " . TABLE_ZONES . " 00036 set zone_country_id = '" . (int)$zone_country_id . "', 00037 zone_code = '" . zen_db_input($zone_code) . "', 00038 zone_name = '" . zen_db_input($zone_name) . "' 00039 where zone_id = '" . (int)$zone_id . "'"); 00040 00041 zen_redirect(zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $zone_id)); 00042 break; 00043 case 'deleteconfirm': 00044 // demo active test 00045 if (zen_admin_demo()) { 00046 $_GET['action']= ''; 00047 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 00048 zen_redirect(zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'])); 00049 } 00050 $zone_id = zen_db_prepare_input($_POST['cID']); 00051 00052 $db->Execute("delete from " . TABLE_ZONES . " where zone_id = '" . (int)$zone_id . "'"); 00053 00054 zen_redirect(zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'])); 00055 break; 00056 } 00057 } 00058 ?> 00059 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00060 <html <?php echo HTML_PARAMS; ?>> 00061 <head> 00062 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00063 <title><?php echo TITLE; ?></title> 00064 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00065 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00066 <script language="javascript" src="includes/menu.js"></script> 00067 <script language="javascript" src="includes/general.js"></script> 00068 <script type="text/javascript"> 00069 <!-- 00070 function init() 00071 { 00072 cssjsmenu('navbar'); 00073 if (document.getElementById) 00074 { 00075 var kill = document.getElementById('hoverJS'); 00076 kill.disabled = true; 00077 } 00078 } 00079 // --> 00080 </script> 00081 </head> 00082 <body onload="init()"> 00083 <!-- header //--> 00084 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 00085 <!-- header_eof //--> 00086 <!-- body //--> 00087 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00088 <tr> 00089 <!-- body_text //--> 00090 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00091 <tr> 00092 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00093 <tr> 00094 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00095 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 00096 </tr> 00097 </table></td> 00098 </tr> 00099 <tr> 00100 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00101 <tr> 00102 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00103 <tr class="dataTableHeadingRow"> 00104 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_NAME; ?></td> 00105 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ZONE_NAME; ?></td> 00106 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ZONE_CODE; ?></td> 00107 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 00108 </tr> 00109 <?php 00110 $zones_query_raw = "select z.zone_id, c.countries_id, c.countries_name, z.zone_name, z.zone_code, z.zone_country_id from " . TABLE_ZONES . " z, " . TABLE_COUNTRIES . " c where z.zone_country_id = c.countries_id order by c.countries_name, z.zone_name"; 00111 $zones_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows); 00112 $zones = $db->Execute($zones_query_raw); 00113 while (!$zones->EOF) { 00114 if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $zones->fields['zone_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) { 00115 $cInfo = new objectInfo($zones->fields); 00116 } 00117 00118 if (isset($cInfo) && is_object($cInfo) && ($zones->fields['zone_id'] == $cInfo->zone_id)) { 00119 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=edit') . '\'">' . "\n"; 00120 } else { 00121 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $zones->fields['zone_id']) . '\'">' . "\n"; 00122 } 00123 ?> 00124 <td class="dataTableContent"><?php echo $zones->fields['countries_name']; ?></td> 00125 <td class="dataTableContent"><?php echo $zones->fields['zone_name']; ?></td> 00126 <td class="dataTableContent" align="center"><?php echo $zones->fields['zone_code']; ?></td> 00127 <td class="dataTableContent" align="right"> 00128 <?php if (isset($cInfo) && is_object($cInfo) && ($zones->fields['zone_id'] == $cInfo->zone_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $zones->fields['zone_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> 00129 </td> 00130 </tr> 00131 <?php 00132 $zones->MoveNext(); 00133 } 00134 ?> 00135 <tr> 00136 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00137 <tr> 00138 <td class="smallText" valign="top"><?php echo $zones_split->display_count($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ZONES); ?></td> 00139 <td class="smallText" align="right"><?php echo $zones_split->display_links($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> 00140 </tr> 00141 <?php 00142 if (empty($action)) { 00143 ?> 00144 <tr> 00145 <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_zone.gif', IMAGE_NEW_ZONE) . '</a>'; ?></td> 00146 </tr> 00147 <?php 00148 } 00149 ?> 00150 </table></td> 00151 </tr> 00152 </table></td> 00153 <?php 00154 $heading = array(); 00155 $contents = array(); 00156 00157 switch ($action) { 00158 case 'new': 00159 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_ZONE . '</b>'); 00160 00161 $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&action=insert')); 00162 $contents[] = array('text' => TEXT_INFO_INSERT_INTRO); 00163 $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . zen_draw_input_field('zone_name')); 00164 $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . zen_draw_input_field('zone_code')); 00165 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries())); 00166 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00167 break; 00168 case 'edit': 00169 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ZONE . '</b>'); 00170 00171 $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=save')); 00172 $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); 00173 $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . zen_draw_input_field('zone_name', htmlspecialchars($cInfo->zone_name, ENT_COMPAT, CHARSET, TRUE))); 00174 $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . zen_draw_input_field('zone_code', $cInfo->zone_code)); 00175 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries(), $cInfo->countries_id)); 00176 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00177 break; 00178 case 'delete': 00179 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ZONE . '</b>'); 00180 00181 $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('cID', $cInfo->zone_id)); 00182 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); 00183 $contents[] = array('text' => '<br><b>' . $cInfo->zone_name . '</b>'); 00184 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00185 break; 00186 default: 00187 if (isset($cInfo) && is_object($cInfo)) { 00188 $heading[] = array('text' => '<b>' . $cInfo->zone_name . '</b>'); 00189 00190 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 00191 $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . $cInfo->zone_name . ' (' . $cInfo->zone_code . ')'); 00192 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . ' ' . $cInfo->countries_name); 00193 } 00194 break; 00195 } 00196 00197 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 00198 echo ' <td width="25%" valign="top">' . "\n"; 00199 00200 $box = new box; 00201 echo $box->infoBox($heading, $contents); 00202 00203 echo ' </td>' . "\n"; 00204 } 00205 ?> 00206 </tr> 00207 </table></td> 00208 </tr> 00209 </table></td> 00210 <!-- body_text_eof //--> 00211 </tr> 00212 </table> 00213 <!-- body_eof //--> 00214 <!-- footer //--> 00215 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 00216 <!-- footer_eof //--> 00217 <br> 00218 </body> 00219 </html> 00220 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>