You are here

function uc_store_menu in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_store/uc_store.module \uc_store_menu()
  2. 7.3 uc_store/uc_store.module \uc_store_menu()

Implementation of hook_menu().

File

uc_store/uc_store.module, line 65
Contains global Ubercart functions and store administration functionality.

Code

function uc_store_menu($may_cache) {
  $items = array();
  drupal_add_css(drupal_get_path('module', 'uc_store') . '/uc_store.css');
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/store',
      'title' => t('Store administration'),
      'description' => t('Administer store settings, products, orders, and more.'),
      'callback' => 'uc_store_admin',
      'access' => user_access('administer store'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/customers',
      'title' => t('Customers'),
      'description' => t('View and modify customer information and orders.'),
      'callback' => 'uc_store_customers',
      'callback arguments' => array(
        NULL,
        NULL,
        NULL,
        25,
      ),
      'access' => user_access('view customers'),
      'weight' => -6,
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/customers/view',
      'title' => t('View customers'),
      'description' => t('View and modify customer information and orders.'),
      'callback arguments' => array(
        NULL,
        NULL,
        NULL,
        25,
      ),
      'access' => user_access('view customers'),
      'weight' => -10,
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/customers/search',
      'title' => t('Search customers'),
      'description' => t('Search through your customer list.'),
      'callback' => 'uc_store_customer_search',
      'access' => user_access('view customers'),
      'weight' => -5,
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/reports',
      'title' => t('Reports'),
      'description' => t('Browse various store reports.'),
      'callback' => 'uc_store_reports',
      'access' => user_access('view store reports'),
      'weight' => 2,
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/settings',
      'title' => t('Configuration'),
      'description' => t('Adjust configuration settings for Ubercart.'),
      'callback' => 'uc_store_configuration_page',
      'access' => user_access('administer store'),
      'weight' => 6,
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/help',
      'title' => t('Help'),
      'description' => t('Links to get help!'),
      'callback' => 'uc_store_ubercart_help',
      'access' => user_access('administer store'),
      'weight' => 10,
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/help/tokens',
      'title' => t('Using tokens'),
      'description' => t('Understand what tokens are and how to use them.'),
      'callback' => 'uc_store_ubercart_help_tokens',
      'access' => user_access('administer store'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/settings/countries',
      'title' => t('Country settings'),
      'callback' => 'uc_country_settings_overview',
      'access' => user_access('administer store'),
      'description' => t('Configure country specific settings.'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/settings/countries/overview',
      'title' => t('Overview'),
      'access' => user_access('administer store'),
      'description' => t('View the country settings.'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/settings/countries/edit',
      'title' => t('Edit'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_country_import_form',
      ),
      'access' => user_access('administer store'),
      'description' => t('Edit the country settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'admin/store/settings/countries/edit/import',
      'title' => t('Import countries'),
      'access' => user_access('administer store'),
      'description' => t('Import and manage countries.'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/settings/countries/edit/formats',
      'title' => t('Country formats'),
      'access' => user_access('administer store'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_country_formats_form',
      ),
      'description' => t('Edit the country specific format settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store',
      'title' => t('Store settings'),
      'callback' => 'uc_store_store_settings_overview',
      'access' => user_access('administer store'),
      'description' => t('Configure the main store settings.'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store/overview',
      'title' => t('Overview'),
      'access' => user_access('administer store'),
      'description' => t('View the store settings.'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store/edit',
      'title' => t('Edit'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_store_store_settings_form',
      ),
      'access' => user_access('administer store'),
      'description' => t('Edit the store settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store/edit/contact',
      'title' => t('Contact settings'),
      'access' => user_access('administer store'),
      'description' => t('Edit the contact settings.'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store/edit/display',
      'title' => t('Display settings'),
      'access' => user_access('administer store'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_store_display_settings_form',
      ),
      'description' => t('Edit the display settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store/edit/format',
      'title' => t('Format settings'),
      'access' => user_access('administer store'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_store_format_settings_form',
      ),
      'description' => t('Edit the format settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store/edit/report',
      'title' => t('Reporting settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_store_report_settings',
      ),
      'access' => user_access('administer store'),
      'description' => t('Report version information to Ubercart.org.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 10,
    );
    $items[] = array(
      'path' => 'admin/store/settings/store/initials',
      'title' => t('User initials'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_store_initials',
      ),
      'access' => user_access('administer store'),
      'description' => t('Assign initials to user accounts.'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/settings/tables',
      'title' => t('Table display settings'),
      'callback' => 'uc_store_tables',
      'access' => user_access('administer store'),
      'description' => t('Configure the display of tables in your store.'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    uc_add_js(array(
      'base_path' => base_path(),
    ), 'setting');
    $items[] = array(
      'path' => 'uc_js_util/' . arg(1),
      'title' => t('JS utilities'),
      'callback' => 'uc_store_js_util',
      'callback arguments' => array(
        arg(1),
      ),
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    if (arg(2) == 'customers') {
      $items[] = array(
        'path' => 'admin/store/customers/orders/' . arg(4),
        'title' => t('Customer orders'),
        'callback' => 'uc_store_customer_orders',
        'callback arguments' => array(
          intval(arg(4)),
        ),
        'description' => t('View a list of orders placed by this customer.'),
        'access' => user_access('view all orders'),
        'weight' => -5,
        'type' => MENU_CALLBACK,
      );
    }
    if (is_numeric(arg(4))) {
      $items[] = array(
        'path' => 'admin/store/settings/countries/' . arg(4) . '/disable',
        'title' => t('Disable a country'),
        'description' => t('Disable a country from use.'),
        'callback' => 'uc_country_disable',
        'callback arguments' => array(
          arg(4),
        ),
        'access' => user_access('administer store'),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/store/settings/countries/' . arg(4) . '/enable',
        'title' => t('Enable a country'),
        'description' => t('Enable a disabled country.'),
        'callback' => 'uc_country_enable',
        'callback arguments' => array(
          arg(4),
        ),
        'access' => user_access('administer store'),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/store/settings/countries/' . arg(4) . '/remove',
        'title' => t('Remove a country'),
        'description' => t('Remove an installed country.'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'uc_country_remove_form',
          arg(4),
        ),
        'access' => user_access('administer store'),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/store/settings/countries/' . arg(4) . '/update/' . arg(6),
        'title' => t('Update a country'),
        'description' => t('Update an installed country.'),
        'callback' => 'uc_country_update',
        'callback arguments' => array(
          arg(4),
          arg(6),
        ),
        'access' => user_access('administer store'),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}