You are here

class sheetnode_phpexcel_plugin_style in Sheetnode 5

Same name and namespace in other branches
  1. 6 modules/sheetnode_phpexcel/sheetnode_phpexcel_plugin_style.inc \sheetnode_phpexcel_plugin_style
  2. 7.2 modules/sheetnode_phpexcel/sheetnode_phpexcel_plugin_style.inc \sheetnode_phpexcel_plugin_style
  3. 7 modules/sheetnode_phpexcel/sheetnode_phpexcel_plugin_style.inc \sheetnode_phpexcel_plugin_style

Hierarchy

Expanded class hierarchy of sheetnode_phpexcel_plugin_style

1 string reference to 'sheetnode_phpexcel_plugin_style'
sheetnode_phpexcel_views_plugins in modules/sheetnode_phpexcel/sheetnode_phpexcel.views.inc
Implementation of hook_views_plugins().

File

modules/sheetnode_phpexcel/sheetnode_phpexcel_plugin_style.inc, line 3

View source
class sheetnode_phpexcel_plugin_style extends sheetnode_feed_plugin_style {
  function init(&$view, &$display, $options = NULL) {
    parent::init($view, $display, $options = NULL);
  }
  function option_definition() {
    $options = parent::option_definition();
    $options['format'] = '';
    return $options;
  }
  function options_form(&$form, &$form_values) {
    parent::options_form($form, $form_values);
    foreach (sheetnode_phpexcel_get_plugins('output') as $format => $plugin) {
      $options[$format] = $plugin['short-name'];
    }
    $form['format'] = array(
      '#type' => 'radios',
      '#title' => t('Export as'),
      '#options' => $options,
      '#default_value' => $this->options['format'],
    );
  }
  function attach_to($display_id, $path, $title) {
    $plugins = sheetnode_phpexcel_get_plugins();
    $this->feed_image = drupal_get_path('module', 'sheetnode_phpexcel') . "/images/{$this->options['format']}.png";
    if (!is_file($this->feed_image)) {
      $this->feed_image = drupal_get_path('module', 'sheetnode_phpexcel') . "/images/spreadsheet.png";
    }
    parent::attach_to($display_id, $path, $title);
  }
  function render() {
    if (strpos($_REQUEST['q'], 'admin/build/views/ajax') === 0) {
      drupal_set_message(t('Spreadsheet file preview is not supported.'), 'warning');
      return;
    }
    require_once drupal_get_path('module', 'sheetnode_phpexcel') . '/sheetnode_phpexcel.export.inc';
    $title = $this->display->handler
      ->get_option('title');
    if (empty($title)) {
      $title = $this->view->name;
    }
    $this
      ->inherit_options();
    _sheetnode_phpexcel_export_do($this->options['format'], $title, parent::render_sheet());
  }

}

Members