You are here

function sheetnode_plugin_style::render in Sheetnode 6

Same name and namespace in other branches
  1. 7.2 views/sheetnode_plugin_style.inc \sheetnode_plugin_style::render()
  2. 7 views/sheetnode_plugin_style.inc \sheetnode_plugin_style::render()
2 methods override sheetnode_plugin_style::render()
sheetnode_phpexcel_plugin_style::render in modules/sheetnode_phpexcel/sheetnode_phpexcel_plugin_style.inc
sheetnode_raw_plugin_style::render in views/sheetnode_raw_plugin_style.inc

File

views/sheetnode_plugin_style.inc, line 426

Class

sheetnode_plugin_style

Code

function render() {
  if (!empty($this->view->live_preview)) {
    return $this
      ->render_ajax(socialcalc_save($this
      ->render_sheet()), NULL);
  }
  $path = drupal_get_path('module', 'sheetnode');
  drupal_add_js($path . '/socialcalc/socialcalcconstants.js');
  drupal_add_js($path . '/socialcalc/socialcalc-3.js');
  drupal_add_js($path . '/socialcalc/socialcalctableeditor.js');
  drupal_add_js($path . '/socialcalc/formatnumber2.js');
  drupal_add_js($path . '/socialcalc/formula1.js');
  drupal_add_js($path . '/socialcalc/socialcalcpopup.js');
  drupal_add_js($path . '/socialcalc/socialcalcspreadsheetcontrol.js');
  drupal_add_js($path . '/socialcalc/socialcalcviewer.js');
  drupal_add_js($path . '/sheetnode.js');
  drupal_add_css($path . '/socialcalc/socialcalc.css');
  drupal_add_css($path . '/sheetnode.css');
  $value = socialcalc_save($this
    ->render_sheet());
  $context = array(
    'entity-type' => 'view',
    'oid' => $this->view->name,
  );
  module_invoke_all('sheetnode_plugins', $value, FALSE, $context);
  $sheet_id = 'sheetview-' . str_replace('_', '-', $this->view->name);
  drupal_add_js(array(
    'sheetnode' => array(
      $sheet_id => array(
        'aliases' => array(
          $this->view->name,
        ),
        'value' => $value,
        'imagePrefix' => base_path() . $path . '/socialcalc/images/sc-',
        'containerElement' => $sheet_id,
        'saveElement' => FALSE,
        'viewMode' => variable_get('sheetnode_view_mode', SHEETNODE_VIEW_FIDDLE),
        'showToolbar' => variable_get('sheetnode_view_toolbar', FALSE),
        'permissions' => array(
          'edit sheetnode settings' => user_access('edit sheetnode settings'),
        ),
        'context' => $context,
      ),
    ),
  ), 'setting');
  return '<div class="sheetview" id="' . $sheet_id . '"></div>';
}