You are here

class views_export_xls_plugin_style_xls in Views Excel Export 6

Same name and namespace in other branches
  1. 7 views/views_export_xls_plugin_style_xls.inc \views_export_xls_plugin_style_xls

Generalized style plugin for export plugins.

Hierarchy

Expanded class hierarchy of views_export_xls_plugin_style_xls

1 string reference to 'views_export_xls_plugin_style_xls'
views_export_xls_views_plugins in ./views_export_xls.views.inc
Implementation of hook_views_plugins().

File

./views_export_xls_plugin_style_xls.inc, line 12
Plugin include file for export style plugin.

View source
class views_export_xls_plugin_style_xls extends views_plugin_style {

  /**
   * Initialize plugin.
   *
   * Set feed image for shared rendering later.
   */
  function init(&$view, &$display, $options = NULL) {
    parent::init($view, $display, $options = NULL);
    $this->feed_image = drupal_get_path('module', 'views_export_xls') . '/images/xls-icon.jpg';
  }

  /**
   * Attach this view to another display as a feed.
   *
   * Provide basic functionality for all export style views like attaching a
   * feed image link.
   */
  function attach_to($display_id, $path, $title) {
    $url_options = array(
      'html' => true,
    );
    $input = $this->view
      ->get_exposed_input();
    if ($input) {
      $url_options['query'] = $input;
    }
    $image = theme('image', $this->feed_image);
    $this->view->feed_icon .= l($image, $this->view
      ->get_url(NULL, $path), $url_options);
  }

  /**
   * Set options fields and default values.
   *
   * @return
   * An array of options information.
   */
  function option_definition() {
    $options = parent::option_definition();
    $options['filename'] = array(
      'default' => 'view-%view.xls',
      'translatable' => FALSE,
    );

    /*$options['encoding'] = array(
      'default' => 'utf-8',
      'translatable' => FALSE,
      );*/
    return $options;
  }

  /**
   * Options form mini callback.
   *
   * @param $form
   * Form array to add additional fields to.
   * @param $form_state
   * State of the form.
   * @return
   * None.
   */
  function options_form(&$form, &$form_state) {
    $form['filename'] = array(
      '#type' => 'textfield',
      '#title' => t('XLS filename'),
      '#default_value' => $this->options['filename'],
      '#description' => t('The filename that will be suggested to the browser for downloading purposes. %view will be replaced with the view name.'),
    );

    /*$options = array('utf-8' => t('UTF-8'), 'cp1252' => t('Western (Windows 1252)'), 'cp1251' => t('Cirillic (Windows 1251)'), 'iso-8859-1' => t('Western (ISO-8859-1)'));
      $form['encoding'] = array(
      '#type' => 'radios',
      '#title' => t('File encoding'),
      '#default_value' => $this->options['encoding'],
      '#options' => $options,
      );*/
  }

}

Members

Namesort descending Modifiers Type Description Overrides
views_export_xls_plugin_style_xls::attach_to function * Attach this view to another display as a feed. * * Provide basic functionality for all export style views like attaching a * feed image link.
views_export_xls_plugin_style_xls::init function Initialize plugin.
views_export_xls_plugin_style_xls::options_form function Options form mini callback.
views_export_xls_plugin_style_xls::option_definition function Set options fields and default values.