You are here

function uc_order_condition_delivery_zone_form in Ubercart 6.2

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

See also

uc_order_condition_delivery_zone_form()

File

uc_order/uc_order.ca.inc, line 514
This file contains the Conditional Actions hooks and functions necessary to make the order related entity, conditions, events, and actions work.

Code

function uc_order_condition_delivery_zone_form($form_state, $settings = array()) {
  $options = array();
  $result = db_query("SELECT z.*, c.country_name FROM {uc_zones} AS z LEFT JOIN {uc_countries} AS c ON z.zone_country_id = c.country_id ORDER BY c.country_name, z.zone_name");
  while ($zone = db_fetch_object($result)) {
    $options[t($zone->country_name)][$zone->zone_id] = $zone->zone_name;
  }
  uksort($options, 'strnatcasecmp');
  $form['zones'] = array(
    '#type' => 'select',
    '#title' => uc_get_field_name('zone'),
    '#options' => $options,
    '#default_value' => isset($settings['zones']) ? $settings['zones'] : NULL,
    '#multiple' => TRUE,
  );
  return $form;
}