3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Page for displaying list of Payment-Instrument.
21 class CRM_Contribute_Page_DashBoard
extends CRM_Core_Page
{
24 * Heart of the viewing process.
26 * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
28 public function preProcess() {
29 CRM_Utils_System
::setTitle(ts('CiviContribute'));
31 $status = ['Valid', 'Cancelled'];
32 $prefixes = ['start', 'month', 'year'];
34 $startToDate = $monthToDate = $yearToDate = [];
36 //get contribution dates.
37 $dates = CRM_Contribute_BAO_Contribution
::getContributionDates();
43 $
$date = $dates[$date];
45 // fiscal years end date
46 $yearNow = date('Ymd', strtotime('+1 year -1 day', strtotime($yearDate)));
48 foreach ($prefixes as $prefix) {
49 $aName = $prefix . 'ToDate';
50 $dName = $prefix . 'Date';
52 if ($prefix == 'year') {
56 // appending end date i.e $now with time
57 // to also calculate records of end date till mid-night
58 $nowWithTime = $now . '235959';
60 foreach ($status as $s) {
61 $
{$aName}[$s] = CRM_Contribute_BAO_Contribution
::getTotalAmountAndCount($s, $
$dName, $nowWithTime);
62 $
{$aName}[$s]['url'] = CRM_Utils_System
::url('civicrm/contribute/search',
63 "reset=1&force=1&status=1&receive_date_low={$$dName}&receive_date_high=$now&test=0"
67 $this->assign($aName, $
$aName);
70 //for contribution tabular View
71 $buildTabularView = CRM_Utils_Array
::value('showtable', $_GET, FALSE);
72 $this->assign('buildTabularView', $buildTabularView);
73 if ($buildTabularView) {
77 // Check for admin permission to see if we should include the Manage Contribution Pages action link
78 $this->assign('isAdmin', CRM_Core_Permission
::check('administer CiviCRM'));
82 * the main function that is called when the page loads,
83 * it decides the which action has to be taken for the page.
87 public function run() {
90 $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search',
91 ts('Contributions'), NULL
93 $controller->setEmbedded(TRUE);
95 $controller->set('limit', 10);
96 $controller->set('force', 1);
97 $controller->set('context', 'dashboard');
98 $controller->process();
100 $chartForm = new CRM_Core_Controller_Simple('CRM_Contribute_Form_ContributionCharts',
101 ts('Contributions Charts'), NULL
104 $chartForm->setEmbedded(TRUE);
105 $chartForm->process();
107 CRM_Core_Resources
::singleton()
108 ->addScriptFile('civicrm', 'templates/CRM/Contribute/Page/DashBoard.js', 1, 'html-header');
110 return parent
::run();