option for page breaks before report section headers
[civicrm-core.git] / templates / CRM / Report / Form / Layout / Table.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
232624b1 3 | CiviCRM version 4.4 |
6a488035
TO
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25*}
26{if (!$chartEnabled || !$chartSupported )&& $rows}
27 {if $pager and $pager->_response and $pager->_response.numPages > 1}
28 <div class="report-pager">
29 {include file="CRM/common/pager.tpl" location="top" noForm=0}
30 </div>
31 {/if}
32 <table class="report-layout display">
33 {capture assign="tableHeader"}
34 {foreach from=$columnHeaders item=header key=field}
35 {assign var=class value=""}
36 {if $header.type eq 1024 OR $header.type eq 1}
37 {assign var=class value="class='reports-header-right'"}
38 {else}
39 {assign var=class value="class='reports-header'"}
40 {/if}
41 {if !$skip}
42 {if $header.colspan}
43 <th colspan={$header.colspan}>{$header.title}</th>
44 {assign var=skip value=true}
45 {assign var=skipCount value=`$header.colspan`}
46 {assign var=skipMade value=1}
47 {else}
48 <th {$class}>{$header.title}</th>
49 {assign var=skip value=false}
50 {/if}
51 {else} {* for skip case *}
52 {assign var=skipMade value=`$skipMade+1`}
53 {if $skipMade >= $skipCount}{assign var=skip value=false}{/if}
54 {/if}
55 {/foreach}
56 {/capture}
57
58 {if !$sections} {* section headers and sticky headers aren't playing nice yet *}
59 <thead class="sticky">
60 <tr>
61 {$tableHeader}
62 </tr>
63 </thead>
64 {/if}
65
66 {* pre-compile section header here, rather than doing it every time under foreach *}
67 {capture assign=sectionHeaderTemplate}
68 {assign var=columnCount value=$columnHeaders|@count}
69 {assign var=l value=$smarty.ldelim}
70 {assign var=r value=$smarty.rdelim}
71 {foreach from=$sections item=section key=column name=sections}
72 {counter assign="h"}
73 {$l}isValueChange value=$row.{$column} key="{$column}" assign=isValueChanged{$r}
74 {$l}if $isValueChanged{$r}
75
76 {$l}if $sections.{$column}.type & 4{$r}
77 {$l}assign var=printValue value=$row.{$column}|crmDate{$r}
78 {$l}elseif $sections.{$column}.type eq 1024{$r}
79 {$l}assign var=printValue value=$row.{$column}|crmMoney{$r}
80 {$l}else{$r}
81 {$l}assign var=printValue value=$row.{$column}{$r}
82 {$l}/if{$r}
83
b5801e1d 84 <tr class="crm-report-sectionHeader crm-report-sectionHeader-{$h}{if $section.pageBreak} page-break{/if}"><th colspan="{$columnCount}">
6a488035
TO
85 <h{$h}>{$section.title}: {$l}$printValue|default:"<em>none</em>"{$r}
86 ({$l}sectionTotal key=$row.{$column} depth={$smarty.foreach.sections.index}{$r})
87 </h{$h}>
88 </th></tr>
89 {if $smarty.foreach.sections.last}
b5801e1d 90 <tr class="crm-report-sectionCols">{$l}$tableHeader{$r}</tr>
6a488035
TO
91 {/if}
92 {$l}/if{$r}
93 {/foreach}
94 {/capture}
95
96 {foreach from=$rows item=row key=rowid}
97 {eval var=$sectionHeaderTemplate}
98 <tr class="{cycle values="odd-row,even-row"} {$row.class} crm-report" id="crm-report_{$rowid}">
99 {foreach from=$columnHeaders item=header key=field}
100 {assign var=fieldLink value=$field|cat:"_link"}
101 {assign var=fieldHover value=$field|cat:"_hover"}
102 <td class="crm-report-{$field}{if $header.type eq 1024 OR $header.type eq 1} report-contents-right{elseif $row.$field eq 'Subtotal'} report-label{/if}">
103 {if $row.$fieldLink}
104 <a title="{$row.$fieldHover}" href="{$row.$fieldLink}">
105 {/if}
106
107 {if $row.$field eq 'Subtotal'}
108 {$row.$field}
109 {elseif $header.type & 4 OR $header.type & 256}
110 {if $header.group_by eq 'MONTH' or $header.group_by eq 'QUARTER'}
111 {$row.$field|crmDate:$config->dateformatPartial}
112 {elseif $header.group_by eq 'YEAR'}
113 {$row.$field|crmDate:$config->dateformatYear}
114 {else}
115 {if $header.type & 4}
116 {$row.$field|truncate:10:''|crmDate}
117 {else}
118 {$row.$field|crmDate}
119 {/if}
120 {/if}
121 {elseif $header.type eq 1024}
7a961f19 122 {if $currencyColumn}
123 <span class="nowrap">{$row.$field|crmMoney:$row.$currencyColumn}</span>
124 {else}
125 <span class="nowrap">{$row.$field|crmMoney}</span>
e4c95fd7 126 {/if}
6a488035
TO
127 {else}
128 {$row.$field}
129 {/if}
130
131 {if $row.$fieldLink}</a>{/if}
132 </td>
133 {/foreach}
134 </tr>
135 {/foreach}
136
137 {if $grandStat}
138 {* foreach from=$grandStat item=row*}
139 <tr class="total-row">
140 {foreach from=$columnHeaders item=header key=field}
141 <td class="report-label">
142 {if $header.type eq 1024}
143 {$grandStat.$field|crmMoney}
144 {else}
145 {$grandStat.$field}
146 {/if}
147 </td>
148 {/foreach}
149 </tr>
150 {* /foreach*}
151 {/if}
152 </table>
153 {if $pager and $pager->_response and $pager->_response.numPages > 1}
154 <div class="report-pager">
155 {include file="CRM/common/pager.tpl" noForm=0}
156 </div>
157 {/if}
158{/if}