You are here

function uc_shipping_menu in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_shipping/uc_shipping.module \uc_shipping_menu()
  2. 7.3 shipping/uc_shipping/uc_shipping.module \uc_shipping_menu()

Implementation of hook_shipping_menu().

File

shipping/uc_shipping/uc_shipping.module, line 19
Organizes ordered products into packages and sets them up for shipment. Shipping method modules may add functionality to generate shipping labels and tracking numbers.

Code

function uc_shipping_menu($may_cache) {
  $items = array();
  if (!$may_cache) {
    if (is_numeric(arg(3))) {
      $items[] = array(
        'path' => 'admin/store/orders/' . arg(3) . '/packages',
        'access' => user_access('fulfill orders'),
        'title' => t('Packages'),
        'callback' => 'uc_shipping_order_packages',
        'callback arguments' => array(
          arg(3),
        ),
        'weight' => 6,
        'type' => MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => 'admin/store/orders/' . arg(3) . '/packages/new',
        'access' => user_access('fulfill orders'),
        'title' => t('New packages'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'uc_shipping_new_package',
          arg(3),
        ),
        'type' => MENU_CALLBACK,
      );
      if (is_numeric(arg(5))) {
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/packages/' . arg(5) . '/edit',
          'access' => user_access('fulfill orders'),
          'title' => t('Edit package'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_shipping_package_edit',
            arg(3),
            arg(5),
          ),
          'type' => MENU_CALLBACK,
        );
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/packages/' . arg(5) . '/cancel',
          'access' => user_access('fulfill orders'),
          'title' => t('Cancel package shipment'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_shipping_package_cancel_confirm',
            arg(3),
            arg(5),
          ),
          'type' => MENU_CALLBACK,
        );
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/packages/' . arg(5) . '/delete',
          'access' => user_access('fulfill orders'),
          'title' => t('Delete package'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_shipping_package_delete_confirm',
            arg(3),
            arg(5),
          ),
          'type' => MENU_CALLBACK,
        );
      }
      $items[] = array(
        'path' => 'admin/store/orders/' . arg(3) . '/shipments',
        'access' => user_access('fulfill orders'),
        'title' => t('Shipments'),
        'callback' => 'uc_shipping_order_shipments',
        'callback arguments' => array(
          arg(3),
        ),
        'weight' => 7,
        'type' => MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => 'admin/store/orders/' . arg(3) . '/shipments/new',
        'access' => user_access('fulfill orders'),
        'title' => t('New shipment'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'uc_shipping_new_shipment',
          arg(3),
        ),
        'type' => MENU_CALLBACK,
      );
      if (is_numeric(arg(5))) {
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/shipments/' . arg(5),
          'title' => t('Shipment !id', array(
            '!id' => arg(5),
          )),
          'callback' => 'uc_shipping_shipment_view',
          'callback arguments' => array(
            arg(3),
            arg(5),
          ),
          'type' => MENU_CALLBACK,
        );
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/shipments/' . arg(5) . '/view',
          'title' => t('View'),
          'weight' => -5,
          'type' => MENU_DEFAULT_LOCAL_TASK,
        );
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/shipments/' . arg(5) . '/edit',
          'access' => user_access('fulfill orders'),
          'title' => t('Edit'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_shipping_shipment_edit',
            arg(3),
            arg(5),
          ),
          'type' => MENU_LOCAL_TASK,
        );
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/shipments/' . arg(5) . '/cancel',
          'access' => user_access('fulfill orders'),
          'title' => t('Cancel shipment'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_shipping_shipment_cancel_confirm',
            arg(3),
            arg(5),
          ),
          'type' => MENU_CALLBACK,
        );
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/shipments/' . arg(5) . '/delete',
          'access' => user_access('fulfill orders'),
          'title' => t('Delete shipment'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_shipping_shipment_delete_confirm',
            arg(3),
            arg(5),
          ),
          'type' => MENU_CALLBACK,
        );
      }
      $items[] = array(
        'path' => 'admin/store/orders/' . arg(3) . '/ship',
        'access' => user_access('fulfill orders'),
        'title' => t('Ship packages'),
        'callback' => 'uc_shipping_make_shipment',
        'callback arguments' => array(
          arg(3),
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}