You are here

function uc_reports_menu in Ubercart 5

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

Implementation of hook_menu().

File

uc_reports/uc_reports.module, line 55
Displays reports on sales, customers, and products to store admin

Code

function uc_reports_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/store/settings/reports',
      'title' => t('Report settings'),
      'description' => t('View the report settings.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_reports_settings_overview',
      ),
      'access' => user_access('administer store'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/reports/customers',
      'title' => t('Customer reports'),
      'description' => t('View reports for store customers'),
      'callback' => 'uc_reports_customers',
      'access' => user_access('view reports'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/reports/products',
      'title' => t('Product reports'),
      'description' => t('View product reports'),
      'callback' => 'uc_reports_products',
      'access' => user_access('view reports'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/reports/products/summary',
      'title' => t('Product report'),
      'description' => t('View reports for store products'),
      'access' => user_access('view reports'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/reports/products/custom',
      'title' => t('Custom product report'),
      'description' => t('View a customized product report'),
      'callback' => 'uc_reports_products_custom',
      'access' => user_access('view reports'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'admin/store/reports/sales',
      'title' => t('Sales reports'),
      'description' => t('View reports for store sales'),
      'callback' => 'uc_reports_sales_summary',
      'access' => user_access('view reports'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/reports/sales/summary',
      'title' => t('Sales summary'),
      'description' => t('View summary of all store sales'),
      'access' => user_access('view reports'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/reports/sales/year',
      'title' => t('Sales per year'),
      'description' => t('View store sales for a particular year'),
      'callback' => 'uc_reports_sales_year',
      'access' => user_access('view reports'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -7,
    );
    $items[] = array(
      'path' => 'admin/store/reports/sales/custom',
      'title' => t('Custom sales summary'),
      'description' => t('View a customized sales summary'),
      'callback' => 'uc_reports_sales_custom',
      'access' => user_access('view reports'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -1,
    );
  }
  else {
    $items[] = array(
      'path' => 'admin/store/reports/getcsv/' . arg(4) . '/' . arg(5),
      'callback' => '_uc_reports_get_csv',
      'callback arguments' => array(
        arg(4),
        arg(5),
      ),
      'access' => user_access('view reports'),
      'type' => MENU_CALLBACK,
    );
    drupal_add_css(drupal_get_path('module', 'uc_reports') . '/uc_reports.css');
  }
  return $items;
}