diff --git a/theme.inc b/theme.inc index 57d61ed..7db435b 100644 --- a/theme.inc +++ b/theme.inc @@ -220,11 +220,16 @@ function template_preprocess_views_calc_table(&$vars) { // Add totals. $vars['totals'] = array(); $vars['sub_totals'] = array(); - if ($view->query->pager->get_total_items() > $view->get_items_per_page() - && isset($view->sub_totals)) { + $vars['group_totals'] = array(); + if (isset($view->group_total)) { + views_calc_table_total($vars, 'group_totals', $view->group_total); + } + if ($view->get_items_per_page() && $view->query->pager->plugin_name != 'none' && + $view->query->pager->get_total_items() > $view->get_items_per_page() + && isset($view->sub_totals) && $view->last_group) { views_calc_table_total($vars, 'sub_totals', $view->sub_totals); } - if (isset($view->totals)) { + if (isset($view->totals) && $view->last_group) { views_calc_table_total($vars, 'totals', $view->totals); } @@ -342,10 +347,18 @@ function views_calc_table_total(&$vars, $key, $totals) { // when both are provided. if (empty($added_label[$calc])) { if ($key == 'sub_totals') { - $label = t("Page !Calculation", array("!Calculation" => $calc)); + $Total_and_Calc = "Page Total" . ' ' . $calc; + $label = t($Total_and_Calc, array("!Calculation" => $calc)); } else { - $label = t("Total !Calculation", array("!Calculation" => $calc)); + if ($view->group_total && $key != 'totals') { + $Total_and_Calc = "Subtotal" . ' ' . $calc; + $label = t($Total_and_Calc, array("!Calculation" => $calc)); + } + else { + $Total_and_Calc = "Total" . ' ' . $calc; + $label = t($Total_and_Calc, array("!Calculation" => $calc)); + } } $vars[$key][$calc][$column] = $label; $added_label[$calc] = TRUE; diff --git a/views-calc-table.tpl.php b/views-calc-table.tpl.php index 6d3618e..657e3f7 100644 --- a/views-calc-table.tpl.php +++ b/views-calc-table.tpl.php @@ -41,6 +41,16 @@ if (empty($rows) && empty($totals)) {
+ $row): ?> +