$chartForm->setEmbedded(TRUE);
$chartForm->process();
$chartForm->run();
+ CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js');
return parent::run();
}
--- /dev/null
+// http://civicrm.org/licensing
+cj(document).ready( function( ) {
+ getChart( );
+ cj('#chart_view').click(function( ) {
+ if ( cj('#chart_view').hasClass('ui-state-default') ) {
+ cj('#chart_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
+ cj('#table_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
+ getChart( );
+ cj('#tableData').children().html('');
+ }
+ });
+ cj('#table_view').click(function( ) {
+ if ( cj('#table_view').hasClass('ui-state-default') ) {
+ cj('#table_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
+ cj('#chart_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
+ buildTabularView();
+ cj('#chartData').children().html('');
+ }
+ });
+});
+
+function getChart( ) {
+ var year = cj('#select_year').val( );
+ var charttype = cj('#chart_type').val( );
+ var date = new Date()
+ var currentYear = date.getFullYear( );
+ if ( !charttype ) charttype = 'bvg';
+ if ( !year ) year = currentYear;
+
+ var chartUrl = CRM.url("civicrm/ajax/chart", {snippet : 4});
+ chartUrl += "&year=" + year + "&type=" + charttype;
+ cj.ajax({
+ url : chartUrl,
+ success : function(html){
+ cj( "#chartData" ).html( html );
+ }
+ });
+
+}
+
+function buildTabularView( ) {
+ var tableUrl = CRM.url("civicrm/contribute/ajax/tableview", {showtable:1, snippet:4});
+ cj.ajax({
+ url : tableUrl,
+ success : function(html){
+ cj( "#tableData" ).html( html );
+ }
+ });
+}
\ No newline at end of file
<div>
{include file="CRM/Contribute/Form/Selector.tpl" context="dashboard"}
</div>
-{/if}{literal}
-<script type="text/javascript">
-
-cj(document).ready( function( ) {
- getChart( );
- cj('#chart_view').click(function( ) {
- if ( cj('#chart_view').hasClass('ui-state-default') ) {
- cj('#chart_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
- cj('#table_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
- getChart( );
- cj('#tableData').children().html('');
- }
- });
- cj('#table_view').click(function( ) {
- if ( cj('#table_view').hasClass('ui-state-default') ) {
- cj('#table_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
- cj('#chart_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
- buildTabularView();
- cj('#chartData').children().html('');
- }
- });
-});
-
-function getChart( ) {
- var year = cj('#select_year').val( );
- var charttype = cj('#chart_type').val( );
- var date = new Date()
- var currentYear = date.getFullYear( );
- if ( !charttype ) charttype = 'bvg';
- if ( !year ) year = currentYear;
-
- var chartUrl = {/literal}"{crmURL p='civicrm/ajax/chart' q='snippet=4' h=0}"{literal};
- chartUrl += "&year=" + year + "&type=" + charttype;
- cj.ajax({
- url : chartUrl,
- async : false,
- success : function(html){
- cj( "#chartData" ).html( html );
- }
- });
-
-}
-
-function buildTabularView( ) {
- var tableUrl = {/literal}"{crmURL p='civicrm/contribute/ajax/tableview' q='showtable=1&snippet=4' h=0}"{literal};
- cj.ajax({
- url : tableUrl,
- async : false,
- success : function(html){
- cj( "#tableData" ).html( html );
- }
- });
-}
-
-</script>
-{/literal}
-
+{/if}
{/if}
\ No newline at end of file