You are here

function prod_monitor_menu in Production check & Production monitor 7

Same name and namespace in other branches
  1. 6 prod_monitor/prod_monitor.module \prod_monitor_menu()

Implementation of hook_menu(). Note: do not use t() in this hook! Translation is handled by core!

File

prod_monitor/prod_monitor.module, line 86

Code

function prod_monitor_menu() {
  $items = array();
  $items['admin/reports/prod-monitor'] = array(
    'title' => 'Production monitor',
    'description' => 'Setup the Production monitor.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'prod_monitor_overview_form',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'includes/prod_monitor.admin.inc',
  );

  // Default primary tab (callback for this is it's parent path).
  $items['admin/reports/prod-monitor/overview'] = array(
    'title' => 'Overview',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items['admin/reports/prod-monitor/module-lookup'] = array(
    'title' => 'Module lookup',
    'description' => 'Searches monitored applications for module versions.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'prod_monitor_module_lookup_form',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 1,
  );

  // This hook_menu() thing, still can't fully see the logic in it. However,
  // this here is what I want to achieve. It would be nice to see the /view/ bit
  // in the path dissapear, that would finish it entirely. I'll settle for this
  // now, caused me enough headache already ;-)
  // The actual callback used by the default primary & secondary tabs,
  // they trickle upwards seeking for a callback to end up here.
  $items['admin/reports/prod-monitor/site/%'] = array(
    'title' => 'View',
    'description' => 'View the Production monitor report page.',
    'page callback' => 'prod_monitor_status',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 10,
  );

  // Default primary tab (callback for this is it's parent path).
  $items['admin/reports/prod-monitor/site/%/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );

  // Default secondary (sub) tab (callback for this is it's parent path).
  $items['admin/reports/prod-monitor/site/%/view/status'] = array(
    'title' => 'Status',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );

  // Performance secondary (sub) tab.
  $items['admin/reports/prod-monitor/site/%prod_monitor_perf/view/performance'] = array(
    'title' => 'Performance',
    'description' => t('View the performance data for this site.'),
    'page callback' => 'prod_monitor_performance',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 12,
  );

  // Updates secondary (sub) tab.
  $items['admin/reports/prod-monitor/site/%prod_monitor/view/updates'] = array(
    'title' => 'Updates',
    'description' => 'View the Production monitor modules update page.',
    'page callback' => 'prod_monitor_updates',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 15,
  );
  $items['admin/reports/prod-monitor/site/%/update-check'] = array(
    'title' => 'Updates',
    'description' => 'Refresh Production monitor modules update page.',
    'page callback' => 'prod_monitor_updates_check',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/prod_monitor.admin.inc',
  );
  $items['admin/reports/prod-monitor/site/%/edit'] = array(
    'title' => 'Edit',
    'description' => 'Edit website',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'prod_monitor_overview_form',
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 20,
  );
  $items['admin/reports/prod-monitor/site/%/flush'] = array(
    'title' => 'Flush',
    'description' => "Flush website's data.",
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'prod_monitor_flush_form',
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 30,
  );
  $items['admin/reports/prod-monitor/site/%/fetch'] = array(
    'title' => 'Fetch',
    'description' => "Fetch website's data.",
    'page callback' => 'prod_monitor_fetch_data',
    'page arguments' => array(
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 35,
  );
  $items['admin/reports/prod-monitor/site/%/delete'] = array(
    'title' => 'Delete',
    'description' => 'Delete website',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'prod_monitor_delete_form',
      4,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access production monitor',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/prod_monitor.admin.inc',
    'weight' => 40,
  );
  return $items;
}