[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> track_fedex.php (source)

   1  <?php
   2  
   3  // track_fedex.php
   4  
   5    require ('includes/application_top.php');
   6  
   7  // debugging? 
   8      
   9      $debug = 0; // 1 for yes, 0 for no
  10      
  11      $action = $HTTP_GET_VARS['action'];
  12      $order = $HTTP_GET_VARS['oID'];
  13      $tracking_number = $HTTP_GET_VARS['num'];
  14  
  15      include (DIR_WS_INCLUDES . 'fedexdc.php');
  16  
  17  // create new FedExDC object
  18  // For tracking results you do not need an account# or meter#
  19      $fed = new FedExDC();
  20      
  21  //tracking example
  22      $track_Ret = $fed->ref_track(array(1537 => $tracking_number,));
  23  
  24  // debug (prints array of all data returned)
  25  
  26  if ($debug) {
  27  
  28      echo '<pre>';
  29  
  30      if ($error = $fed->getError()) {
  31        echo "ERROR :". $error;
  32          } else {
  33        echo $fed->debug_str. "\n<BR>";
  34        print_r($track_Ret);
  35        echo "\n\n";
  36        for ($i=1; $i<=$track_Ret[1584]; $i++) {
  37            echo PACKAGE_DELIVERED_ON . $track_Ret['1720-'.$i];
  38          echo '\n' . PACKAGE_SIGNED_BY . $track_Ret['1706-'.$i];
  39            }
  40          }
  41  
  42      echo '</pre>';
  43      }
  44  
  45  ?>
  46  
  47  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  48  <html <?php echo HTML_PARAMS; ?>>
  49  <head>
  50  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  51  <title><?php echo TITLE; ?></title>
  52  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  53  <script language="javascript" src="includes/general.js"></script>
  54  </head>
  55  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  56  <!-- header //-->
  57  <?php
  58    require (DIR_WS_INCLUDES . 'header.php');
  59  ?>
  60  <!-- header_eof //-->
  61  
  62  <!-- body //-->
  63  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  64    <tr>
  65      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  66  <!-- left_navigation //-->
  67  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  68  <!-- left_navigation_eof //-->
  69      </table></td>
  70  <!-- body_text //-->
  71      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  72        <tr>
  73          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  74            <tr>
  75              <td class="pageHeading"><?php 
  76                          echo HEADING_TITLE;
  77                          if ($order) {
  78                              echo ', ' . ORDER_NUMBER . $order;
  79                              }
  80                          ?></td>
  81              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  82              <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . 'oID=' . $order . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  83            </tr>
  84          </table></td>
  85        </tr>
  86        <tr>
  87          <td><table width="80%" border="0" cellspacing="0" cellpadding="2">
  88            <tr>
  89              <td><?php echo tep_draw_separator('pixel_trans.gif', 1, 15); ?></td>
  90            </tr>
  91            <tr>
  92              <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
  93                <tr>
  94  <?php
  95  
  96      if ($error = $fed->getError()) {
  97        if (strstr($error, '500139')) {
  98              echo PACKAGE_NOT_IN_SYSTEM . '<br/>';
  99              }
 100        if (strstr($error, '6070')) {
 101              echo INVALID_TRACKING_NUM . '<br/>';
 102              }
 103          else {
 104              echo PACKAGE_ERROR . $error;
 105              }
 106          } 
 107      else {
 108        for ($i=1; $i<=$track_Ret[1584]; $i++) {
 109  // list destination
 110              $dest_city = $track_Ret['15-'.$i];
 111              $dest_state = $track_Ret['16-'.$i];
 112              $dest_zip = $track_Ret['17-'.$i];
 113              $signed_by = $track_Ret['1706-'.$i];
 114              $delivery_date = $track_Ret['1720-'.$i];
 115              $delivery_time = $track_Ret['1707-'.$i];
 116              
 117  // format date
 118              $delivery_date = strtotime($delivery_date);
 119              $delivery_date = date("F j, Y", $delivery_date);
 120              
 121  // format time, determine am or pm
 122              $hour = substr($delivery_time,0,2);
 123              $minute = substr($delivery_time,2,2);
 124              if ($hour >= 12) {
 125                  $time_mod = 'pm';
 126  // make pm hours non-military time
 127                  if ($hour > 12) {
 128                      $hour = ($hour - 12);
 129                      }
 130                  }
 131              else {
 132                  $time_mod = 'am';
 133                  }
 134  
 135  // everyone (other than error messages) gets a status report
 136              if (!$error) {
 137                  echo '<td class="main"><b>' . PACKAGE_DESTINATION . '</b></td></tr><tr><td class="main"> ' . $dest_city . ', ' . $dest_state . ' ' . $dest_zip . '</td></tr>';
 138  ?>
 139            <tr>
 140              <td><?php echo tep_draw_separator('pixel_trans.gif', 1, 15); ?></td>
 141            </tr>
 142  <?php
 143                  echo '<tr><td class="main"><b>' . PACKAGE_STATUS . '</b></td></tr>';
 144              
 145  // for delivered packages
 146                  if ($signed_by) {
 147                          
 148  // if left without signature, let them know
 149  // (add more as they appear)
 150                      if (strstr($signed_by,'F.RONTDOOR')) {
 151                          $signed_by = '<tr><td class="main">' . DELIVERED_FRONTDOOR . '</td></tr>';
 152                          }
 153                      if (strstr($signed_by,'S.IDEDOOR')) {
 154                          $signed_by = '<tr><td class="main">' . DELIVERED_SIDEDOOR . '</td></tr>';
 155                          }
 156                      if (strstr($signed_by,'G.ARAGE')) {
 157                          $signed_by = '<tr><td class="main">' . DELIVERED_GARAGE . '</td></tr>';
 158                          }
 159                      if (strstr($signed_by,'B.ACKDOOR')) {
 160                          $signed_by = '<tr><td class="main">' . DELIVERED_BACKDOOR . '</td></tr>';
 161                          }
 162                      echo '<tr><td class="main">' . PACKAGE_DELIVERED_ON . $delivery_date . PACKAGE_DELIVERED_AT . $hour . ':' . $minute . ' ' . $time_mod . '</td></tr>';
 163  
 164  ?>
 165            <tr>
 166              <td><?php echo tep_draw_separator('pixel_trans.gif', 1, 15); ?></td>
 167            </tr>
 168  <?php
 169  
 170                echo '<tr><td class="main"><b>' . PACKAGE_SIGNED_BY . '</b></td></tr><tr><td class="main">' . $signed_by . '</td></tr>';                    
 171                      }
 172                  else {
 173                      $status_note = $track_Ret['1159-'.$i.'-1'];
 174                      $status_city = $track_Ret['1160-'.$i.'-1'];
 175                      $status_state = $track_Ret['1161-'.$i.'-1'];
 176                      echo '<tr><td class="main"><b>' . PACKAGE_IN_TRANSIT . '</td></tr>';
 177                      echo '<tr><td class="main">' . $status_note . ': ' . $status_city . ', ' . $status_state . '</td></tr>';
 178                      }
 179                  }
 180              else {
 181                  echo '&nbsp;';
 182                  }
 183              }
 184          }
 185  ?>
 186                      </table>
 187            </tr>
 188          </table></td>
 189        </tr>
 190      </table></td>
 191  <!-- body_text_eof //-->
 192    </tr>
 193  </table>
 194  <!-- body_eof //-->
 195  
 196  <!-- footer //-->
 197  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 198  <!-- footer_eof //-->
 199  <br>
 200  </body>
 201  </html>
 202  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); 
 203  ?>    


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7