You are here

function mostpopular_menu in Drupal Most Popular 6

Same name and namespace in other branches
  1. 7 mostpopular.module \mostpopular_menu()

Implements hook_menu().

File

./mostpopular.module, line 81

Code

function mostpopular_menu() {
  $items = array();
  $items['admin/settings/mostpopular'] = array(
    'title' => 'Most Popular settings',
    'description' => 'Configure the Most Popular functionality',
    'page callback' => 'drupal_get_form',
    'file' => 'mostpopular.admin.inc',
    'page arguments' => array(
      'mostpopular_settings_form',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer mostpopular',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/settings/mostpopular/main'] = array(
    'title' => 'Settings',
    'description' => 'Configure the Most Popular functionality',
    'file' => 'mostpopular.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'mostpopular_settings_form',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer mostpopular',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/settings/mostpopular/intervals'] = array(
    'title' => 'Intervals',
    'description' => 'Configure the intervals of time used by the Most Popular feature',
    'file' => 'mostpopular.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'mostpopular_intervals_form',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer mostpopular',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );
  $items['admin/settings/mostpopular/services'] = array(
    'title' => 'Services',
    'description' => 'Configure the services available to the Most Popular feature',
    'file' => 'mostpopular.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'mostpopular_services_form',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer mostpopular',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
  $i = 0;
  $services = MostPopularService::fetchSorted();
  foreach ($services as $service) {
    $items["admin/settings/mostpopular/services/{$service->sid}"] = array(
      'title' => $service->name,
      'description' => "Configure the {$service->title} service",
      'file' => 'mostpopular.admin.inc',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'mostpopular_service_config_form',
        4,
      ),
      'access callback' => 'user_access',
      'access arguments' => array(
        'administer mostpopular',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => $i++,
    );
  }

  /*
  $items['admin/settings/mostpopular/services/%'] = array(
    'title' => 'Configure %service',
    'title arguments' => array( '%service' => mostpopular_get_service_title( arg(4) )),
    'description' => 'Configure the service with the given ID',
    'file' => 'mostpopular.admin.inc',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('mostpopular_service_config_form', 4),
    'access callback' => 'user_access',
    'access arguments' => array('administer mostpopular'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
  */
  $items['admin/settings/mostpopular/refresh'] = array(
    'title' => 'Refresh Stats',
    'description' => 'Refresh the Most Popular stats',
    'file' => 'mostpopular.admin.inc',
    'page callback' => 'mostpopular_refresh',
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer mostpopular',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 3,
  );
  $items['mostpopular/items/%/%'] = array(
    'title' => 'Most Popular Pages',
    'file' => 'mostpopular.block.inc',
    'page callback' => 'mostpopular_items_page',
    'page arguments' => array(
      2,
      3,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['mostpopular/ajax/%/%'] = array(
    'title' => 'Get the most popular stats via AJAX',
    'file' => 'mostpopular.block.inc',
    'page callback' => 'mostpopular_items_ajax',
    'page arguments' => array(
      2,
      3,
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}