You are here

function op_admin_comments_view_table in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_order/uc_order_order_pane.inc \op_admin_comments_view_table()

Builds the order admin comments table.

1 string reference to 'op_admin_comments_view_table'
uc_order_pane_admin_comments in uc_order/uc_order.order_pane.inc
Handles the "Admin Comments" order pane.

File

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

Code

function op_admin_comments_view_table($comments) {
  $table = array(
    '#type' => 'tapir_table',
    '#attributes' => array(
      'class' => 'order-pane-table',
    ),
  );
  $table['#columns']['date'] = array(
    'cell' => array(
      'data' => t('Date'),
      'class' => 'text-center',
    ),
    'weight' => 0,
  );
  $table['#columns']['user'] = array(
    'cell' => array(
      'data' => t('User'),
      'class' => 'text-center',
    ),
    'weight' => 1,
  );
  $table['#columns']['comment'] = array(
    'cell' => array(
      'data' => t('Comment'),
      'width' => '80%',
    ),
    'weight' => 2,
  );
  drupal_alter('tapir_table_header', $table['#columns'], 'op_admin_comments_view_table');
  if (is_array($comments)) {
    foreach ($comments as $comment) {
      $data = array();
      $data['date'] = array(
        '#value' => format_date($comment->created, 'custom', variable_get('uc_date_format_default', 'm/d/Y') . '<\\b\\r />g:i:s A'),
        '#cell_attributes' => array(
          'align' => 'center',
          'valign' => 'top',
        ),
      );
      $data['user'] = array(
        '#value' => uc_get_initials($comment->uid),
        '#cell_attributes' => array(
          'align' => 'center',
          'valign' => 'top',
        ),
      );
      $data['comment'] = array(
        '#value' => filter_xss_admin($comment->message),
        '#cell_attributes' => array(
          'valign' => 'top',
        ),
      );
      $table['#rows'][] = $data;
    }
  }
  else {
    $data['comment'] = array(
      '#value' => t('This order has no admin comments associated with it.'),
      '#cell_attributes' => array(
        'colspan' => 'full',
      ),
    );
    $table['#rows'][] = $data;
  }
  return $table;
}