You are here

function theme_uc_shipping_shipment_print in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 shipping/uc_shipping/uc_shipping.admin.inc \theme_uc_shipping_shipment_print()

Displays the packing slip and shipping labels for printing.

File

shipping/uc_shipping/uc_shipping.admin.inc, line 994
Shipping administration menu items.

Code

function theme_uc_shipping_shipment_print($order, $shipment, $labels = TRUE) {
  $language = $GLOBALS['language'];
  $output = <<<EOHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{<span class="php-variable">$language</span>-&gt;<span class="php-function-or-constant property member-of-variable">language</span>}" lang="{<span class="php-variable">$language</span>-&gt;<span class="php-function-or-constant property member-of-variable">language</span>}" dir="{<span class="php-variable">$language</span>-&gt;<span class="php-function-or-constant property member-of-variable">direction</span>}">
<head>
  <title>Packing slip and labels</title>
  <style>
    .page-break {
      page-break-before: always;
    }
  </style>
</head>
<body>
EOHTML;
  $output .= theme('uc_packing_slip', $order, $shipment);
  if ($labels) {
    foreach ($shipment->packages as $id => $package) {
      if (isset($package->label_image) && ($path = file_create_path($package->label_image)) && file_exists($path)) {

        // TODO: Find a way to store these magic numbers specifically for UPS.
        list($width, $height) = array(
          672,
          392,
        );
        $output .= '<br class="page-break" />' . "\n";
        $output .= theme('image', file_create_url($package->label_image), '', '', array(
          'width' => $width,
          'height' => $height,
        ), FALSE) . "\n";
      }
    }
  }

  //$output .= dpr($order, TRUE, 'order');

  //$output .= dpr($shipment, TRUE, 'shipment');
  $output .= '</body></html>';
  print $output;
  exit;
}