function uc_order_view in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_view()
- 7.3 uc_order/uc_order.module \uc_order_view()
Displays the order view screen, constructed via hook_order_pane().
1 string reference to 'uc_order_view'
- uc_order_menu in uc_order/
uc_order.module - Implements hook_menu().
File
- uc_order/
uc_order.admin.inc, line 1098 - Order administration menu items.
Code
function uc_order_view($order, $view = 'view') {
if ($view == 'customer') {
$breadcrumb = drupal_get_breadcrumb();
$breadcrumb[2] = l(t('Order history'), 'user/' . arg(1) . '/orders');
drupal_set_breadcrumb($breadcrumb);
}
if ($view == 'invoice') {
$output = theme('uc_order', $order, 'print', variable_get('uc_cust_order_invoice_template', 'customer'));
$output .= '<div align="right" style="margin-top: 1em; margin-right: 1em;"><input type="button" value="' . t('Print invoice') . '" onclick="window.print();" /> ' . '<input type="button" value="' . t('Close window') . '" onclick="window.close();" /></div>';
print $output;
exit;
}
$output = '';
$panes = _order_pane_list($view);
foreach ($panes as $pane) {
if (in_array($view, $pane['show']) && variable_get('uc_order_pane_' . $pane['id'] . '_show_' . $view, $pane['enabled'])) {
$func = $pane['callback'];
if (function_exists($func) && ($contents = $func($view, $order)) != NULL) {
$output .= '<div class="order-pane ' . $pane['class'] . '" id="order-pane-' . $pane['id'] . '">';
if ($func('show-title', NULL) !== FALSE) {
$output .= '<div class="order-pane-title">' . $pane['title'] . ': ' . $func('view-title', $order) . '</div>';
}
$output .= is_array($contents) ? drupal_render($contents) : $contents;
$output .= '</div>';
}
}
}
if ($view == 'customer' && variable_get('uc_cust_view_order_invoices', TRUE)) {
$url = url('user/' . arg(1) . '/order/' . arg(3) . '/invoice/print');
drupal_add_js("function open_invoice() { window.open('{$url}', '" . t('Invoice') . "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=480,left=50,top=50'); }", 'inline');
$contents = '<a href="#" onclick="open_invoice();">' . uc_store_get_icon('file:print') . ' ' . t('Click to open a window with a printable invoice.') . '</a>';
$output .= '<div class="order-pane">' . $contents . '</div>';
}
return $output;
}