WIP checkin
[civicrm-core.git] / templates / CRM / Report / Form / Layout / Graph.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2019 |
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 {assign var=uploadURL value=$config->imageUploadURL|replace:'/persist/contribute/':'/persist/'}
27 {* Display weekly,Quarterly,monthly and yearly contributions using pChart (Bar and Pie) *}
28 {if $chartEnabled and $chartSupported}
29 <div class='crm-chart'>
30 {if $outputMode eq 'print' OR $outputMode eq 'pdf'}
31 <img src="{$uploadURL|cat:$chartId}.png" />
32 {else}
33 <div id="chart_{$uniqueId}"></div>
34 {/if}
35 </div>
36 {/if}
37
38 {if !$printOnly} {* NO print section starts *}
39 {if !$section}
40 {include file="CRM/common/chart.tpl" divId="chart_$uniqueId"}
41 {/if}
42
43 {literal}
44 <script type="text/javascript">
45 CRM.$(function($) {
46 var allData = {/literal}{$chartData}{literal};
47 buildChart( );
48
49 $("input[id$='submit_print'],input[id$='submit_pdf']").bind('click', function(e){
50 // image creator php file path and append image name
51 var url = CRM.url('civicrm/report/chart', 'name=' + '{/literal}{$chartId}{literal}' + '.png');
52
53 //fetch object and 'POST' image
54 swfobject.getObjectById("chart_{/literal}{$uniqueId}{literal}").post_image(url, true, false);
55 });
56
57 function buildChart( ) {
58 $.each( allData, function( chartID, chartValues ) {
59 var divName = {/literal}"chart_{$uniqueId}"{literal};
60 createChart( chartID, divName, chartValues.size.xSize, chartValues.size.ySize, allData[chartID].object );
61 });
62 }
63 });
64
65 </script>
66 {/literal}
67 {/if}