You are here

function sheetnode_phpexcel_menu in Sheetnode 5

Same name and namespace in other branches
  1. 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \sheetnode_phpexcel_menu()
  2. 7.2 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \sheetnode_phpexcel_menu()
  3. 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \sheetnode_phpexcel_menu()

Implementation of hook_menu().

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.module, line 90

Code

function sheetnode_phpexcel_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    foreach (sheetnode_phpexcel_get_plugins('output') as $format => $plugin) {
      $items[] = array(
        'path' => "sheetnode/{$format}",
        'title' => t('Save as !format', array(
          '!format' => $plugin['short-name'],
        )),
        'access' => user_access('access content'),
        'callback' => '_sheetnode_phpexcel_export',
        'callback arguments' => array(
          $format,
        ),
        'type' => MENU_CALLBACK,
      );
    }
    foreach (sheetnode_phpexcel_get_plugins('input') as $format => $plugin) {
      $items[] = array(
        'path' => "node/add/{$format}",
        'title' => t('Sheetnode import from !format', array(
          '!format' => $plugin['short-name'],
        )),
        'access' => user_access('create sheetnode'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          '_sheetnode_phpexcel_import_form',
          $format,
        ),
        'description' => t('Create a new sheetnode with content from an existing spreadsheet.'),
      );
    }
    $items[] = array(
      'path' => 'admin/settings/sheetnode/phpexcel',
      'title' => t('PHPExcel'),
      'access' => user_access('administer site configuration'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        '_sheetnode_phpexcel_settings',
      ),
      'description' => t('Administer settings for Sheetnode PHPExcel.'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  return $items;
}