| [ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: ups_boxes_used.php,v 1.0 2007/11/12 JanZ Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2007 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 require ('includes/application_top.php'); 14 15 $search_id_array[] = array('id' => 'ubuID', 'text' => TEXT_SHIPMENT_ID); 16 $search_id_array[] = array( 'id' => 'cID', 'text' => TEXT_CUSTOMER_ID); 17 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 18 19 if (tep_not_null($action)) { 20 switch ($action) { 21 case 'deleteconfirm': 22 $ubuID = tep_db_prepare_input($_GET['ubuID']); 23 24 tep_db_query("delete from " . TABLE_UPS_BOXES_USED . " where id = '" . (int)$ubuID . "'"); 25 26 tep_redirect(tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action')))); 27 break; 28 case 'deleteconfirmbatch': 29 if(isset($_POST['batch_id'])) { 30 foreach($_POST['batch_id'] as $key => $id) { 31 if ((int)$id != 0) { 32 $id_array[] = $id; 33 } 34 } 35 if (count($id_array) > 0) { 36 tep_db_query("delete from " . TABLE_UPS_BOXES_USED . " where id in (" . implode(',', $id_array) . ")"); 37 } 38 } 39 tep_redirect(tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action')))); 40 break; 41 } 42 } 43 44 if (($action == 'details') && isset($_GET['ubuID'])) { 45 $ubuID = tep_db_prepare_input($_GET['ubuID']); 46 47 $entry_query = tep_db_query("select id from " . TABLE_UPS_BOXES_USED . " where id = '" . (int)$ubuID . "'"); 48 $entry_exists = true; 49 if (!tep_db_num_rows($entry_query)) { 50 $entry_exists = false; 51 $messageStack->add(sprintf(ERROR_ENTRY_DOES_NOT_EXIST, $ubuID), 'error'); 52 } 53 } 54 // from drop-down menu/input field in top right corner 55 if (($action == 'details') && isset($_GET['chooseID'])) { 56 // default action: shipment id (id in table ups_boxes_used) 57 if ($_GET['chooseID'] == 'ubuID') { 58 $ubuID = tep_db_prepare_input($_GET['inputID']); 59 if ((int)$ubuID == 0) { 60 unset($action); 61 // proceed with default listing 62 } else { 63 $entry_query = tep_db_query("select id from " . TABLE_UPS_BOXES_USED . " where id = '" . (int)$ubuID . "'"); 64 $entry_exists = true; 65 if (!tep_db_num_rows($entry_query)) { 66 $entry_exists = false; 67 $messageStack->add(sprintf(ERROR_ENTRY_DOES_NOT_EXIST, $ubuID), 'error'); 68 } 69 } 70 } elseif ($_GET['chooseID'] == 'cID') { 71 $cID = tep_db_prepare_input($_GET['inputID']); 72 $cID = (int)$cID; 73 // proceed with showing entries from this particular customer in the column listing 74 unset ($action); 75 if ((int)$cID == 0) { 76 unset($cID); 77 // proceed with default listing 78 } 79 } 80 } 81 if (isset($_GET['cID']) && tep_not_null($_GET['cID'])) { 82 $cID = tep_db_prepare_input($_GET['cID']); 83 $cID = (int)$cID; 84 } 85 86 include (DIR_WS_CLASSES . 'ups_boxes_shipped.php'); 87 ?> 88 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 89 <html <?php echo HTML_PARAMS; ?>> 90 <head> 91 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 92 <title><?php echo TITLE; ?></title> 93 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 94 <script language="javascript" src="includes/general.js"></script> 95 <script language="JavaScript" type="text/javascript"> 96 function flagCheckboxes(element) { 97 var elementForm = element.form; 98 var i = 0; 99 100 for (i = 0; i < elementForm.length; i++) { 101 if (elementForm[i].type == 'checkbox') { 102 elementForm[i].checked = element.checked; 103 } 104 } 105 } 106 107 function rowUBUOverEffect(object) { 108 if (object.className == 'dataTableRow') object.className = 'ubuTableRowOver'; 109 } 110 111 function rowUBUOutEffect(object) { 112 if (object.className == 'ubuTableRowOver') object.className = 'dataTableRow'; 113 } 114 </script> 115 <style type="text/css"> 116 .ubuTableRowOver { background-color: #FFFFFF; } 117 </style> 118 </head> 119 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 120 <!-- header //--> 121 <?php 122 require (DIR_WS_INCLUDES . 'header.php'); 123 ?> 124 <!-- header_eof //--> 125 <!-- body //--> 126 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 127 <tr> 128 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 129 <!-- left_navigation //--> 130 <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?> 131 <!-- left_navigation_eof //--> 132 </table></td> 133 <!-- body_text //--> 134 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 135 <?php 136 if (($action == 'details') && ($entry_exists == true)) { 137 $boxes_shipped = new ups_boxes_shipped($ubuID); 138 ?> 139 <tr> 140 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 141 <tr> 142 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 143 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 144 <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('action', 'chooseID', 'inputID', 'cID', 'ubuID')) . (isset($ubuID) ? 'ubuID=' . $ubuID . '': '') . (isset($cID) ? '&cID=' . $cID . '': '')) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 145 </tr> 146 </table></td> 147 </tr> 148 <tr> 149 <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> 150 <tr> 151 <td colspan="2"><?php echo tep_draw_separator(); ?></td> 152 </tr> 153 <tr> 154 <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> 155 <tr> 156 <td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td> 157 <td class="main"><?php echo $boxes_shipped->customer['name']; ?></td> 158 </tr> 159 <tr> 160 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td> 161 </tr> 162 <tr> 163 <td class="main"><b><?php echo ENTRY_TELEPHONE_NUMBER; ?></b></td> 164 <td class="main"><?php echo $boxes_shipped->customer['telephone']; ?></td> 165 </tr> 166 <tr> 167 <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td> 168 <td class="main"><?php echo '<a href="mailto:' . $boxes_shipped->customer['email_address'] . '"><u>' . $boxes_shipped->customer['email_address'] . '</u></a>'; ?></td> 169 </tr> 170 </table></td> 171 <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> 172 <tr> 173 <td class="main" valign="top"><b><?php echo ENTRY_DATE; ?></b></td> 174 <td class="main"><?php echo $boxes_shipped->info['date']; ?></td> 175 </tr> 176 </table></td> 177 </tr> 178 </table></td> 179 </tr> 180 <tr> 181 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 182 </tr> 183 <tr> 184 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 185 </tr> 186 <tr> 187 <td class="main"><br><b><?php echo TABLE_HEADING_BOXES_PACKED; ?></b></td> 188 </tr> 189 <tr> 190 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td> 191 </tr> 192 <tr> 193 <td style="font-size: 10px;"><pre><?php print_r($boxes_shipped->boxes); ?></pre></td> 194 </tr> 195 <tr> 196 <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('action', 'chooseID', 'inputID', 'cID', 'ubuID')) . (isset($ubuID) ? 'ubuID=' . $ubuID . '': '') . (isset($cID) ? '&cID=' . $cID . '': '')) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 197 </tr> 198 <?php 199 } else { 200 ?> 201 <tr> 202 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 203 <tr> 204 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 205 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 206 <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 207 <tr><?php echo tep_draw_form('shipments', FILENAME_UPS_BOXES_USED, '', 'get'); ?> 208 <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_pull_down_menu('chooseID', $search_id_array) . ' ' . tep_draw_input_field('inputID', '', 'size="12"') . tep_draw_hidden_field('action', 'details'); ?></td> 209 </form></tr> 210 </table></td> 211 </tr> 212 </table></td> 213 </tr> 214 <tr> 215 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 216 <tr> 217 <td valign="top"><?php echo tep_draw_form('batch' , FILENAME_UPS_BOXES_USED, 'action=batch_delete' . (isset($_GET['page']) ? '&page=' . (int)$_GET['page'] . '': ''),'post'); ?><table border="0" width="100%" cellspacing="0" cellpadding="2"> 218 <tr class="dataTableHeadingRow"> 219 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td> 220 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_ID; ?></td> 221 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE; ?></td> 222 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SHIPMENT_ID; ?></td> 223 <td class="dataTableHeadingContent" align="center"><input type="checkbox" name="batchFlag" id="batchFlag" onclick="flagCheckboxes(this);" /></td> 224 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 225 </tr> 226 <?php 227 if (isset($cID)) { 228 // from drop down menu in top right corner 229 $shipments_query_raw = "select c.customers_id, customers_firstname, customers_lastname, customers_email_address, customers_telephone, ubu.id, ubu.date from " . TABLE_CUSTOMERS . " c, " . TABLE_UPS_BOXES_USED . " ubu where c.customers_id = ubu.customers_id and c.customers_id = '" . $cID . "'"; 230 // BOF when going back from details after having used input field in top richt corner 231 } elseif (isset($_GET['chooseID']) && isset($_GET['inputID'])) { 232 if ($_GET['chooseID'] == 'ubuID') { 233 $ubuID = (int)$_GET['inputID']; 234 $shipments_query_raw = "select c.customers_id, customers_firstname, customers_lastname, customers_email_address, customers_telephone, ubu.id, ubu.date from " . TABLE_UPS_BOXES_USED . " ubu, " . TABLE_CUSTOMERS . " c where c.customers_id = ubu.customers_id and ubu.id = '" . $ubuID . "'"; 235 } elseif ($_GET['chooseID'] == 'cID'&& isset($_GET['inputID']) && (int)$_GET['inputID'] != 0) { 236 $cID = (int)$_GET['inputID']; 237 $shipments_query_raw = "select c.customers_id, customers_firstname, customers_lastname, customers_email_address, customers_telephone, ubu.id, ubu.date from " . TABLE_CUSTOMERS . " c, " . TABLE_UPS_BOXES_USED . " ubu where c.customers_id = ubu.customers_id and c.customers_id = '" . $cID . "'"; 238 } else { // default query again 239 $shipments_query_raw = "select c.customers_id, customers_firstname, customers_lastname, customers_email_address, customers_telephone, ubu.id, ubu.date from " . TABLE_UPS_BOXES_USED . " ubu, " . TABLE_CUSTOMERS . " c where c.customers_id = ubu.customers_id order by id DESC"; 240 } 241 // EOF when going back from details after having used input field in top right corner 242 } else { 243 $shipments_query_raw = "select c.customers_id, customers_firstname, customers_lastname, customers_email_address, customers_telephone, ubu.id, ubu.date from " . TABLE_UPS_BOXES_USED . " ubu, " . TABLE_CUSTOMERS . " c where c.customers_id = ubu.customers_id order by id DESC"; 244 } 245 $shipments_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $shipments_query_raw, $shipments_query_numrows); 246 $shipments_query = tep_db_query($shipments_query_raw); 247 while ($shipments = tep_db_fetch_array($shipments_query)) { 248 if ((!isset($_GET['ubuID']) || (isset($_GET['ubuID']) && ($_GET['ubuID'] == $shipments['id']))) && !isset($ubuInfo)) { 249 $ubuInfo = new objectInfo($shipments); 250 $shipment_object = new ups_boxes_shipped((int)$_GET['ubuID']); 251 } 252 if (isset($ubuInfo) && is_object($ubuInfo) && ($shipments['id'] == $ubuInfo->id)) { 253 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowUBUOverEffect(this)" onmouseout="rowUBUOutEffect(this)">' . "\n"; 254 } else { 255 echo ' <tr class="dataTableRow" onmouseover="rowUBUOverEffect(this)" onmouseout="rowUBUOutEffect(this)">' . "\n"; 256 } 257 ?> 258 <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID' , 'inputID', 'cID')) . 'ubuID=' . $shipments['id'] . '&action=details' . (isset($cID) ? '&cID=' . $cID . '': '')) . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $shipments['customers_firstname'] . ' ' . $shipments['customers_lastname']; ?></td> 259 <td class="dataTableContent" align="center"><?php echo $shipments['customers_id']; ?></td> 260 <td class="dataTableContent" align="center"><?php echo tep_datetime_short($shipments['date']); ?></td> 261 <td class="dataTableContent" align="center"><?php echo $shipments['id']; ?></td> 262 <td class="dataTableContent" align="center"><input type="checkbox" name="batch[]" value="<?php echo $shipments['id']; ?>" id="batch<?php echo $shipments['id']; ?>" /></td> 263 <td class="dataTableContent" align="right"><?php if (isset($ubuInfo) && is_object($ubuInfo) && ($shipments['id'] == $ubuInfo->id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID', 'inputID', 'cID')) . 'ubuID=' . $shipments['id'] . (isset($cID) ? '&cID=' . $cID . '': '')) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> 264 </tr> 265 <?php 266 } 267 ?> 268 <tr> 269 <td colspan="4" align="right"><?php echo tep_image_submit('trash.png', IMAGE_BATCH_DELETE); ?></td> 270 <td align="center"><input type="checkbox" name="batchFlag" id="batchFlag" onclick="flagCheckboxes(this);" /></td> 271 <td> </td> 272 </tr></form> 273 <tr> 274 <td colspan="6"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 275 <tr> 276 <td class="smallText" valign="top"><?php echo $shipments_split->display_count($shipments_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_SHIPMENTS); ?></td> 277 <td class="smallText" align="right"><?php echo $shipments_split->display_links($shipments_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], tep_get_all_get_params(array('page', 'ubuID', 'action', 'chooseID', 'inputID', 'cID')) . (isset($cID) ? '&cID=' . $cID . '': '')); ?></td> 278 </tr> 279 </table></td> 280 </tr> 281 </table></td> 282 <?php 283 $heading = array(); 284 $contents = array(); 285 286 switch ($action) { 287 case 'delete': 288 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SHIPPING_ENTRY . '</b>'); 289 290 $contents = array('form' => tep_draw_form('shipments', FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID', 'inputID', 'cID')) . 'ubuID=' . $ubuInfo->id . '&action=deleteconfirm'. (isset($cID) ? '&cID=' . $cID . '': ''))); 291 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br><br><b>' . ENTRY_CUSTOMER . ' ' . $shipment_object->customer['name'] . '<br>' . TEXT_SHIPMENT_ID . ' : ' . $ubuInfo->id . '</b>'); 292 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID', 'inputID', 'cID')) . 'ubuID=' . $ubuInfo->id . (isset($cID) ? '&cID=' . $cID . '': '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 293 break; 294 case 'batch_delete': 295 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_SHIPPING_ENTRIES . '</b>'); 296 297 $contents = array('form' => tep_draw_form('shipments', FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID', 'inputID', 'cID')) . 'ubuID=' . $ubuInfo->id . '&action=deleteconfirmbatch'. (isset($cID) ? '&cID=' . $cID . '': ''))); 298 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO_BATCH_DELETE . '<br><br>'); 299 if (isset($_POST['batch'])) { 300 $batch_list = '<table border="0" cellpadding="2">'."\n"; 301 foreach($_POST['batch'] as $key => $batch_id) { 302 $batch_list .= '<tr>'."\n".'<td class="infoBoxContent">'; 303 $batch_list .= '<b>' . $batch_id . '</b></td>'."\n".'<td>'; 304 $batch_list .= '<input type="checkbox" name="batch_id[]" value="' . $batch_id . '" checked="checked" />'; 305 $batch_list .= '</td>'."\n".'</tr>'."\n".''; 306 } 307 $batch_list .= '</table>'."\n"; 308 $contents[] = array('align' => 'center', 'text' => $batch_list); 309 } 310 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID', 'inputID', 'cID')) . 'ubuID=' . $ubuInfo->id . (isset($cID) ? '&cID=' . $cID . '': '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 311 break; 312 default: 313 if (isset($ubuInfo) && is_object($ubuInfo)) { 314 $heading[] = array('text' => '<b>[' . $ubuInfo->id . '] ' . tep_datetime_short($ubuInfo->date) . '</b>'); 315 316 $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID', 'inputID', 'cID')) . 'ubuID=' . $ubuInfo->id . '&action=details' . (isset($cID) ? '&cID=' . $cID . '': '')) . '">' . tep_image_button('button_details.gif', IMAGE_DETAILS) . '</a> <a href="' . tep_href_link(FILENAME_UPS_BOXES_USED, tep_get_all_get_params(array('ubuID', 'action', 'chooseID', 'inputID', 'cID')) . 'ubuID=' . $ubuInfo->id . '&action=delete' . (isset($cID) ? '&cID=' . $cID . '': '')) .'">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 317 $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_OF_BOXES . ' ' . $shipment_object->info['num_of_boxes']); 318 } 319 break; 320 } 321 322 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { 323 echo ' <td width="25%" valign="top">' . "\n"; 324 325 $box = new box; 326 echo $box->infoBox($heading, $contents); 327 328 echo ' </td>' . "\n"; 329 } 330 ?> 331 </tr> 332 </table></td> 333 </tr> 334 <?php 335 } 336 ?> 337 </table></td> 338 <!-- body_text_eof //--> 339 </tr> 340 </table> 341 <!-- body_eof //--> 342 343 <!-- footer //--> 344 <?php require (DIR_WS_INCLUDES . 'footer.php'); ?> 345 <!-- footer_eof //--> 346 <br> 347 </body> 348 </html> 349 <?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 |