function uc_order_menu in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.module \uc_order_menu()
- 7.3 uc_order/uc_order.module \uc_order_menu()
Implementation of hook_menu().
File
- uc_order/
uc_order.module, line 24
Code
function uc_order_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/store/settings/orders',
'title' => t('Order settings'),
'description' => t('Configure the order settings.'),
'callback' => 'uc_order_settings_overview',
'access' => user_access('administer store'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'admin/store/settings/orders/overview',
'title' => t('Overview'),
'access' => user_access('administer store'),
'description' => t('View the order settings.'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/store/settings/orders/edit',
'title' => t('Edit'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_order_settings_form',
),
'access' => user_access('administer store'),
'description' => t('Edit the order settings.'),
'type' => MENU_LOCAL_TASK,
'weight' => -5,
);
$items[] = array(
'path' => 'admin/store/settings/orders/edit/basic',
'title' => t('Order settings'),
'access' => user_access('administer store'),
'description' => t('Edit the basic order settings.'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/store/settings/orders/edit/workflow',
'title' => t('Order workflow'),
'access' => user_access('administer order workflow'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_order_workflow_form',
),
'description' => t('Modify and configure order states and statuses.'),
'type' => MENU_LOCAL_TASK,
'weight' => -5,
);
$items[] = array(
'path' => 'admin/store/settings/orders/edit/panes',
'title' => t('Order panes'),
'access' => user_access('administer store'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_order_panes_form',
),
'description' => t('Edit the pane settings for order pages.'),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
$items[] = array(
'path' => 'admin/store/settings/orders/edit/workflow/create',
'title' => t('Create an order status'),
'access' => user_access('administer order workflow'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_order_status_create_form',
),
'description' => t('Create a custom order status for your store.'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/store/orders',
'title' => t('Orders'),
'description' => t('View and process orders.'),
'callback' => 'uc_order_admin',
'callback arguments' => array(
NULL,
NULL,
FALSE,
),
'access' => user_access('view all orders'),
'weight' => -10,
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'admin/store/orders/view',
'title' => t('View orders'),
'description' => t('View and process the orders received through your website.'),
'callback arguments' => array(
NULL,
NULL,
FALSE,
),
'access' => user_access('view all orders'),
'weight' => -10,
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'admin/store/orders/create',
'title' => t('Create order'),
'description' => t('Create an empty new order.'),
'callback' => 'uc_order_create',
'access' => user_access('edit orders'),
'weight' => -5,
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'admin/store/orders/search',
'title' => t('Search orders'),
'description' => t('Search existing orders.'),
'callback' => 'uc_order_usearch',
'access' => user_access('view all orders'),
'weight' => 0,
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'admin/store/orders/address_book',
'title' => t('Select address'),
'callback' => 'uc_order_address_book',
'access' => user_access('edit orders'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/store/orders/customer',
'title' => t('Select customer'),
'callback' => 'uc_order_select_customer',
'callback arguments' => array(
NULL,
),
'access' => user_access('edit orders'),
'type' => MENU_CALLBACK,
);
}
else {
drupal_add_css(drupal_get_path('module', 'uc_order') . '/uc_order.css');
if ($user->uid) {
$items[] = array(
'path' => 'user/' . arg(1) . '/orders',
'title' => t('Orders'),
'description' => t('View your order history.'),
'callback' => 'uc_order_history',
'callback arguments' => array(
arg(1),
),
'access' => user_access('view all orders') || $user->uid == arg(1),
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'user/' . arg(1) . '/order/' . arg(3),
'title' => t('Order @order_id', array(
'@order_id' => arg(3),
)),
'description' => t('View order @order_id.', array(
'@order_id' => arg(3),
)),
'callback' => 'uc_order_view',
'callback arguments' => array(
arg(3),
'customer',
),
'access' => user_access('view all orders') || $user->uid == arg(1),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'user/' . arg(1) . '/order/' . arg(3) . '/invoice',
'title' => t('View invoice'),
'description' => t('View order @order_id invoice.', array(
'@order_id' => arg(3),
)),
'callback' => 'uc_order_view',
'callback arguments' => array(
arg(3),
'invoice',
),
'access' => user_access('view all orders') || $user->uid == arg(1),
'type' => MENU_CALLBACK,
);
}
if (arg(2) == 'orders' && arg(3) == 'create' && is_numeric(arg(4))) {
$items[] = array(
'path' => 'admin/store/orders/create/' . arg(4),
'title' => t('Create order'),
'description' => t('Create an order for a customer.'),
'callback' => 'uc_order_create',
'callback arguments' => array(
arg(4),
),
'access' => user_access('edit orders'),
'type' => MENU_CALLBACK,
);
}
if (arg(0) == 'admin' && arg(1) == 'store' && arg(2) == 'orders' && is_numeric(arg(3))) {
if (arg(4) == 'edit') {
uc_add_js(drupal_get_path('module', 'uc_order') . '/uc_order.js');
}
$items[] = array(
'path' => 'admin/store/orders/' . arg(3),
'title' => t('Order @order_id', array(
'@order_id' => arg(3),
)),
'description' => t('View order') . arg(3),
'callback' => 'uc_order_view',
'callback arguments' => array(
arg(3),
'view',
),
'access' => user_access('view all orders'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/view',
'title' => t('View'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/edit',
'title' => t('Edit'),
'callback' => 'uc_order_edit',
'callback arguments' => array(
arg(3),
),
'access' => user_access('edit orders'),
'weight' => 1,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/add_line_item/' . arg(5),
'title' => t('Add a line item'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_order_add_line_item_form',
arg(3),
arg(5),
),
'access' => user_access('edit orders'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/products',
'title' => t('Products'),
'callback' => 'uc_order_edit_products',
'callback arguments' => array(
arg(3),
),
'access' => user_access('edit orders'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/product_select',
'title' => t('Product select'),
'callback' => 'uc_order_load_product_select',
'callback arguments' => array(
arg(3),
),
'access' => user_access('edit orders'),
'type' => MENU_CALLBACK,
);
if (is_numeric(arg(5))) {
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/add_product/' . arg(5),
'title' => t('Add product'),
'callback' => 'uc_order_add_product',
'callback arguments' => array(
arg(3),
arg(5),
),
'access' => user_access('edit orders'),
'type' => MENU_CALLBACK,
);
}
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/invoice',
'title' => t('Invoice'),
'callback' => 'uc_order_invoice',
'callback arguments' => array(
arg(3),
),
'access' => user_access('view all orders'),
'weight' => 3,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/invoice/view',
'title' => t('View invoice'),
'access' => user_access('view all orders'),
'weight' => -10,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/invoice/print',
'title' => t('Printable invoice'),
'callback arguments' => array(
arg(3),
'print',
),
'access' => user_access('view all orders'),
'weight' => -5,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/invoice/mail',
'title' => t('Mail invoice'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_order_mail_invoice_form',
arg(3),
),
'access' => user_access('view all orders'),
'weight' => 0,
'type' => MENU_LOCAL_TASK,
);
if (variable_get('uc_order_logging', TRUE)) {
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/log',
'title' => t('Log'),
'callback' => 'uc_order_log',
'callback arguments' => array(
arg(3),
),
'access' => user_access('view all orders'),
'weight' => 10,
'type' => MENU_LOCAL_TASK,
);
}
$items[] = array(
'path' => 'admin/store/orders/' . arg(3) . '/delete',
'title' => t('Delete order @order_id?', array(
'@order_id' => arg(3),
)),
'description' => t('Delete order @order_id.', array(
'@order_id' => arg(3),
)),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_order_delete_confirm_form',
arg(3),
),
'access' => user_access('delete orders') || user_access('delete any order'),
'type' => MENU_CALLBACK,
);
}
}
return $items;
}