First, much thanks for this module and maintaining it.
In one place I'm using Webform Reports in a panel page, so I wanted to display only 5 results (eg top 5). I also wanted to be able to disable the number of rows returned, "(N results)" text at top left, as needed. Here are the changes I made to accomplish this, in case anyone is interested. Note I was working with 6.x-2.x-dev downloaded Oct 28, 2011, as I've not updated to the November 17, 2011 6.x-2.x-dev yet.
$ diff -u webform_report.install.orig webform_report.install
--- webform_report.install.orig 2011-12-16 14:05:21.000000000 -0500
+++ webform_report.install 2011-12-16 14:07:01.000000000 -0500
@@ -65,6 +65,7 @@
}
$options = array(
'results_per_page' => $rpp,
+ 'hide_result_count' => FALSE,
'hide_csv' => FALSE
);
if (!db_query("UPDATE {webform_report}
If the item below is accepted into the code, I don't expect the no results message to be displayed with the wording as shown in the change below. An option to define the message would be a better addition, I just didn't have time to add that ability in yet.
$ diff -u webform_report.inc.orig webform_report.inc
--- webform_report.inc.orig 2011-12-16 13:57:03.000000000 -0500
+++ webform_report.inc 2011-12-16 14:01:53.000000000 -0500
@@ -293,8 +293,10 @@
}
// Display number of rows after description.
- $output .= filter_xss_admin($node->description) .
- ' (' . count($report['rows']) . ' ' . t('results') . ') ';
+ if (!$node->options['hide_result_count']) {
+ $output .= filter_xss_admin($node->description) .
+ ' (' . count($report['rows']) . ' ' . t('results') . ') ';
+ }
if (!$node->options['hide_csv']) {
$output .= l(t('Download as CSV'), 'node/' . arg(1) . '/csv') . '</p>';
}
@@ -304,7 +306,10 @@
// no submissions met criteria
if (count($report['rows']) == 0) {
- $output .= t('There are no submissions that match the criteria for the selected webform.');
+ // Original message
+ //$output .= t('There are no submissions that match the criteria for the selected webform.');
+ // Our message
+ $output .= t('No data meets requested criteria');
}
}
$ diff -u webform_report_criteria.inc.orig webform_report_criteria.inc
--- webform_report_criteria.inc.orig 2011-12-16 13:52:50.000000000 -0500
+++ webform_report_criteria.inc 2011-12-16 14:04:45.000000000 -0500
@@ -281,6 +281,8 @@
$results_per_page_options = array(
0 => 'All',
+ 5 => '5',
+ 10 => '10',
20 => '20',
40 => '40',
60 => '60',
@@ -303,6 +305,14 @@
);
$default = FALSE;
+ if (is_array($node->options) && array_key_exists('hide_result_count', $node->options)) {
+ $default = $node->options['hide_result_count'];
+ }
+ $form['options']['hide_result_count'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide results count information'),
+ '#default_value' => $default,
+ );
if (is_array($node->options) && array_key_exists('hide_csv', $node->options)) {
$default = $node->options['hide_csv'];
}
@@ -936,6 +946,7 @@
// update options
$node->options['results_per_page'] = $form_state['values']['results_per_page'];
+ $node->options['hide_result_count'] = $form_state['values']['hide_result_count'];
$node->options['hide_csv'] = $form_state['values']['hide_csv'];
$node->options['search_form'] = $form_state['values']['search_form'];
$node->options['layout'] = $form_state['values']['layout'];