You are here

function uc_order_pane_order_comments in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_order/uc_order_order_pane.inc \uc_order_pane_order_comments()
  2. 7.3 uc_order/uc_order.order_pane.inc \uc_order_pane_order_comments()

Handles the "Order Comments" order pane.

1 string reference to 'uc_order_pane_order_comments'
uc_order_order_pane in uc_order/uc_order.module
Implements hook_order_pane().

File

uc_order/uc_order.order_pane.inc, line 513
This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.

Code

function uc_order_pane_order_comments($op, $order) {
  switch ($op) {
    case 'view':
      $comments = uc_order_comments_load($order->order_id);
      return tapir_get_table('op_order_comments_view_table', $comments);
    case 'customer':
      $comments = uc_order_comments_load($order->order_id);
      $header = array(
        t('Date'),
        t('Status'),
        t('Message'),
      );
      $rows[] = array(
        array(
          'data' => format_date($order->created, 'custom', variable_get('uc_date_format_default', 'm/d/Y')),
          'class' => 'date',
        ),
        array(
          'data' => '-',
          'class' => 'status',
        ),
        array(
          'data' => t('Order created.'),
          'class' => 'message',
        ),
      );
      if (count($comments) > 0) {
        foreach ($comments as $comment) {
          $rows[] = array(
            array(
              'data' => format_date($comment->created, 'custom', variable_get('uc_date_format_default', 'm/d/Y')),
              'class' => 'date',
            ),
            array(
              'data' => $comment->title,
              'class' => 'status',
            ),
            array(
              'data' => check_plain($comment->message),
              'class' => 'message',
            ),
          );
        }
      }
      $output = theme('table', $header, $rows, array(
        'class' => 'uc-order-comments',
      ));
      return $output;
  }
}