summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/handlers/views_handler_relationship_groupwise_max.inc
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/handlers/views_handler_relationship_groupwise_max.inc')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/handlers/views_handler_relationship_groupwise_max.inc39
1 files changed, 20 insertions, 19 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/handlers/views_handler_relationship_groupwise_max.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/handlers/views_handler_relationship_groupwise_max.inc
index b027357..23198c6 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/handlers/views_handler_relationship_groupwise_max.inc
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/handlers/views_handler_relationship_groupwise_max.inc
@@ -1,6 +1,6 @@
<?php
-// $Id$
-/*
+
+/**
* @file
* Relationship for groupwise maximum handler.
*/
@@ -64,7 +64,7 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
$options['subquery_sort'] = array('default' => NULL);
// Descending more useful.
$options['subquery_order'] = array('default' => 'DESC');
- $options['subquery_regenerate'] = array('default' => FALSE);
+ $options['subquery_regenerate'] = array('default' => FALSE, 'bool' => TRUE);
$options['subquery_view'] = array('default' => FALSE);
$options['subquery_namespace'] = array('default' => FALSE);
@@ -148,21 +148,6 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
}
/**
- * Perform any necessary changes to the form values prior to storage.
- * There is no need for this function to actually store the data.
- *
- * Generate the subquery string when the user submits the options, and store
- * it. This saves the expense of generating it when the view is run.
- */
- function options_submit(&$form, &$form_state) {
- // Get the new user options from the form values.
- $new_options = $form_state['values']['options'];
- $subquery = $this->left_query($new_options);
- // Add the subquery string to the options we're about to store.
- $this->options['subquery_string'] = $subquery;
- }
-
- /**
* Helper function to create a pseudo view.
*
* We use this to obtain our subquery SQL.
@@ -177,6 +162,14 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
}
/**
+ * When the form is submitted, take sure to clear the subquery string cache.
+ */
+ function options_form_submit(&$form, &$form_state) {
+ $cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
+ cache_clear_all($cid, 'cache_views_data');
+ }
+
+ /**
* Generate a subquery given the user options, as set in the options.
* These are passed in rather than picked up from the object because we
* generate the subquery when the options are saved, rather than when the view
@@ -359,7 +352,15 @@ class views_handler_relationship_groupwise_max extends views_handler_relationshi
}
else {
// Get the stored subquery SQL string.
- $def['left_query'] = $this->options['subquery_string'];
+ $cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
+ $cache = cache_get($cid, 'cache_views_data');
+ if (isset($cache->data)) {
+ $def['left_query'] = $cache->data;
+ }
+ else {
+ $def['left_query'] = $this->left_query($this->options);
+ cache_set($cid, $def['left_query'], 'cache_views_data');
+ }
}
if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {