You are here

function uc_order_admin_sort_form in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_order/uc_order.admin.inc \uc_order_admin_sort_form()

Create the order status select box on the order overview screen.

1 string reference to 'uc_order_admin_sort_form'
uc_order_admin in uc_order/uc_order.module
Display the main order admin screen, an overview of all received orders.

File

uc_order/uc_order.module, line 1181

Code

function uc_order_admin_sort_form() {
  $options = array(
    '-1' => t('Active orders'),
  );
  foreach (uc_order_status_list() as $status) {
    $options[$status['id']] = $status['title'];
  }
  $options['all'] = t('All orders');
  if (!isset($_SESSION['sort_status']) || is_null($_SESSION['sort_status'])) {
    $default_status = -1;
  }
  else {
    $default_status = $_SESSION['sort_status'];
  }
  $form['status'] = array(
    '#type' => 'select',
    '#title' => t('View by status'),
    '#options' => $options,
    '#default_value' => $default_status,
    '#attributes' => array(
      'onchange' => 'this.form.submit();',
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'View',
    '#attributes' => array(
      'style' => 'display: none;',
    ),
  );
  return $form;
}