3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2015
35 * Page for displaying list of Payment-Instrument.
37 class CRM_Contribute_Page_DashBoard
extends CRM_Core_Page
{
40 * Heart of the viewing process.
42 * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
44 public function preProcess() {
45 CRM_Utils_System
::setTitle(ts('CiviContribute'));
47 $status = array('Valid', 'Cancelled');
48 $prefixes = array('start', 'month', 'year');
50 $startToDate = $monthToDate = $yearToDate = array();
52 //get contribution dates.
53 $dates = CRM_Contribute_BAO_Contribution
::getContributionDates();
59 $
$date = $dates[$date];
61 // fiscal years end date
62 $yearNow = date('Ymd', strtotime('+1 year -1 day', strtotime($yearDate)));
64 foreach ($prefixes as $prefix) {
65 $aName = $prefix . 'ToDate';
66 $dName = $prefix . 'Date';
68 if ($prefix == 'year') {
72 // appending end date i.e $now with time
73 // to also calculate records of end date till mid-night
74 $nowWithTime = $now . '235959';
76 foreach ($status as $s) {
77 $
{$aName}[$s] = CRM_Contribute_BAO_Contribution
::getTotalAmountAndCount($s, $
$dName, $nowWithTime);
78 $
{$aName}[$s]['url'] = CRM_Utils_System
::url('civicrm/contribute/search',
79 "reset=1&force=1&status=1&start={$$dName}&end=$now&test=0"
83 $this->assign($aName, $
$aName);
86 //for contribution tabular View
87 $buildTabularView = CRM_Utils_Array
::value('showtable', $_GET, FALSE);
88 $this->assign('buildTabularView', $buildTabularView);
89 if ($buildTabularView) {
93 // Check for admin permission to see if we should include the Manage Contribution Pages action link
95 if (CRM_Core_Permission
::check('administer CiviCRM')) {
98 $this->assign('isAdmin', $isAdmin);
102 * the main function that is called when the page loads,
103 * it decides the which action has to be taken for the page.
107 public function run() {
110 $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search',
111 ts('Contributions'), NULL
113 $controller->setEmbedded(TRUE);
115 $controller->set('limit', 10);
116 $controller->set('force', 1);
117 $controller->set('context', 'dashboard');
118 $controller->process();
120 $chartForm = new CRM_Core_Controller_Simple('CRM_Contribute_Form_ContributionCharts',
121 ts('Contributions Charts'), NULL
124 $chartForm->setEmbedded(TRUE);
125 $chartForm->process();
127 CRM_Core_Resources
::singleton()
128 ->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js', 1, 'html-header');
130 return parent
::run();