You are here

function webform_report_menu in Webform Report 6

Same name and namespace in other branches
  1. 5 webform_report.module \webform_report_menu()
  2. 6.2 webform_report.module \webform_report_menu()
  3. 7 webform_report.module \webform_report_menu()

Implementation of hook_menu()

File

./webform_report.module, line 97

Code

function webform_report_menu() {
  global $user;
  $items = array();
  $items['admin/content/webform_report'] = array(
    'title' => t('Webform Reports'),
    'description' => t('View and edit Webform reports.'),
    'page callback' => '_webform_report_page',
    'access callback' => 'user_access',
    'access arguments' => array(
      'access webform reports',
    ),
    'file' => 'webform_report.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['node/%webform_report_menu/edit/webform_report/configuration'] = array(
    'title' => t('Configuration'),
    'page callback' => 'node_page_edit',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'webform_report_access',
    'access arguments' => array(
      'update',
      1,
      $user,
    ),
    'weight' => 1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['node/%webform_report_menu/edit/webform_report/criteria'] = array(
    'title' => t('Report Criteria'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'webform_report_criteria_form',
      1,
    ),
    'access callback' => 'webform_report_access',
    'access arguments' => array(
      'update',
      1,
      $user,
    ),
    'weight' => 2,
    'type' => MENU_LOCAL_TASK,
  );

  // Without this, users with Create, and not Edit, would not be able to complete the Criteria form
  $items['node/%webform_report_menu/add/webform_report/criteria'] = array(
    'title' => t('Report Criteria'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'webform_report_criteria_form',
      1,
    ),
    'access callback' => 'webform_report_access',
    'access arguments' => array(
      'create',
      1,
      $user,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['node/%webform_report_menu/csv'] = array(
    'title' => t('Report CSV Export'),
    'page callback' => 'webform_report_csv',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'webform_report_access',
    'access arguments' => array(
      'view',
      1,
      $user,
    ),
    'file' => 'webform_report.inc',
    'type' => MENU_CALLBACK,
  );
  return $items;
}