You are here

phpexcel.module in PHPExcel 7.2

The module file.

Defines the settings callback and form for phpexcel.

To use PHPExcel, include phpexcel.api.inc in your module for exporting to excel:

module_load_include('inc', 'phpexcel', 'phpexcel');

File

phpexcel.module
View source
<?php

/**
 * @file
 * The module file.
 *
 * Defines the settings callback and form for phpexcel.
 *
 * To use PHPExcel, include phpexcel.api.inc in your module for exporting to
 * excel:
 * @code
 *   module_load_include('inc', 'phpexcel', 'phpexcel');
 * @endcode
 */

/**
 * Implements hook_menu()
 */
function phpexcel_menu() {
  return array(
    'admin/config/system/phpexcel' => array(
      'title' => 'PHPExcel settings',
      'description' => 'Manage PHPExcel settings.',
      'access arguments' => array(
        'administer phpexcel',
      ),
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'phpexcel_settings_form',
      ),
    ),
  );
}

/**
 * Implements hook_permission()
 */
function phpexcel_permission() {
  return array(
    'administer phpexcel' => array(
      'title' => t('Administer the PHPExcel module settings'),
    ),
  );
}

/**
 * Settings form
 */
function phpexcel_settings_form() {
  $form = array(
    'phpexcel_memcache' => array(
      '#title' => t("Memcache server"),
      '#description' => t("The PHPExcel library can use Memcache for better performance. If you plan on exporting very large Excel files, PHP could run out of memory. By default, phpexcel will gzip all data in memory to increase performance, but if you have Memcache, specify it's location here (usually 'localhost')."),
      '#type' => 'textfield',
      '#default_value' => variable_get('phpexcel_memcache', ''),
    ),
  );
  return system_settings_form($form);
}

Functions

Namesort descending Description
phpexcel_menu Implements hook_menu()
phpexcel_permission Implements hook_permission()
phpexcel_settings_form Settings form