You are here

function views_calc_menu in Views Calc 5

Same name and namespace in other branches
  1. 6.3 views_calc.module \views_calc_menu()
  2. 6 views_calc.module \views_calc_menu()
  3. 7 views_calc.module \views_calc_menu()

File

./views_calc.module, line 78
This module will allow you to add calculated fields to views tables and compute (SUM, COUNT, AVG, etc) columns of numeric data in a views table.

Code

function views_calc_menu($may_cache) {
  include_once drupal_get_path('module', 'views') . '/views.module';
  include_once drupal_get_path('module', 'views') . '/views_cache.inc';
  $items = array();
  if (!$may_cache) {

    // make sure the table gets proper spreadsheet-like themeing
    drupal_add_css(drupal_get_path('module', 'views_calc') . '/views_calc.css');
  }
  else {
    $items[] = array(
      'title' => t('Views Calc'),
      'path' => 'admin/settings/views_calc',
      'description' => t('Set Views Calc fields and columns.'),
      'type' => MENU_NORMAL_ITEM,
      'weight' => 10,
      'priority' => 1,
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'views_calc_fields_form',
      ),
      'access' => user_access('create views calc') && user_access('administer views'),
    );
    $items[] = array(
      'path' => 'admin/settings/views_calc/fields',
      'title' => t('Fields'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 5,
      'priority' => 1,
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'views_calc_fields_form',
      ),
      'access' => user_access('create views calc') && user_access('administer views'),
    );
    $items[] = array(
      'path' => 'admin/settings/views_calc/columns',
      'title' => t('Columns'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 10,
      'priority' => 1,
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'views_calc_cols_form',
      ),
      'access' => user_access('create views calc') && user_access('administer views'),
    );
    $items[] = array(
      'path' => 'admin/settings/views_calc/settings',
      'title' => t('Settings'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 10,
      'priority' => 1,
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'views_calc_settings_form',
      ),
      'access' => user_access('administer views calc'),
    );
  }
  return $items;
}