views_field_calc_table.inc

  1. cis7 sites/all/modules/local_sandboxes/views_field_calc/views_field_calc_table.inc
  2. cis7 profiles/cis/modules/sandbox/views_field_calc/views_field_calc_table.inc

Copied from the table style plugin and from views_calc module.

Classes

Namesort descending Description
views_field_calc_table Style plugin to render each item as a row in a table.

File

sites/all/modules/local_sandboxes/views_field_calc/views_field_calc_table.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Copied from the table style plugin and from views_calc module.
  5. */
  6. /**
  7. * Style plugin to render each item as a row in a table.
  8. *
  9. * @ingroup views_style_plugins
  10. */
  11. class views_field_calc_table extends views_plugin_style_table {
  12. function option_definition() {
  13. $options = parent::option_definition();
  14. $options['detailed_values'] = array('default' => 0);
  15. return $options;
  16. }
  17. /**
  18. * Render the given style.
  19. */
  20. function options_form(&$form, &$form_state) {
  21. parent::options_form($form, $form_state);
  22. $form['#theme'] = 'views_field_calc_ui_table';
  23. $form['detailed_values'] = array(
  24. '#title' => t('Show details'),
  25. '#type' => 'select',
  26. '#options' => array(
  27. 0 => t('Yes'),
  28. 1 => t('No'),
  29. ),
  30. '#default_value' => $this->options['detailed_values'],
  31. '#description' => t("Select 'Yes' to show detailed values followed by column calculations, 'No' to surpress details and show only calculated column totals."),
  32. );
  33. $handlers = $this->display->handler->get_handlers('field');
  34. $columns = $this->sanitize_columns($this->options['columns']);
  35. foreach ($columns as $field => $column) {
  36. $safe = str_replace(array('][', '_', ' '), '-', $field);
  37. $id = 'edit-style-options-columns-' . $safe;
  38. $form['info'][$field]['has_calc'] = array(
  39. '#type' => 'checkbox',
  40. '#title' => t('Display calculation'),
  41. '#default_value' => isset($this->options['info'][$field]['has_calc']) ? $this->options['info'][$field]['has_calc'] : 0,
  42. );
  43. $options = _views_field_calc_calc_options();
  44. $form['info'][$field]['calc'] = array(
  45. '#type' => 'select',
  46. '#options' => $options,
  47. '#default_value' => isset($this->options['info'][$field]['calc']) ? $this->options['info'][$field]['calc'] : array(),
  48. '#states' => array(
  49. 'visible' => array(':checkbox[name="style_options[info][' . $field . '][has_calc]"]' => array('checked' => TRUE),), // condition
  50. ),
  51. '#multiple' => TRUE,
  52. );
  53. }
  54. }
  55. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.