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
37 * This is page is for Pledge Dashboard
39 class CRM_Pledge_Page_DashBoard
extends CRM_Core_Page
{
42 * Heart of the viewing process. The runner gets all the meta data for
43 * the contact and calls the appropriate type of page to view.
47 public function preProcess() {
48 CRM_Utils_System
::setTitle(ts('CiviPledge'));
50 $startToDate = array();
51 $yearToDate = array();
52 $monthToDate = array();
53 $previousToDate = array();
55 $prefixes = array('start', 'month', 'year', 'previous');
56 $status = array('Completed', 'Cancelled', 'Pending', 'In Progress', 'Overdue');
58 // cumulative (since inception) - prefix = 'start'
62 // current year - prefix = 'year'
63 $config = CRM_Core_Config
::singleton();
64 $yearDate = $config->fiscalYearStart
;
65 $year = array('Y' => date('Y'));
66 $this->assign('curYear', $year['Y']);
67 $yearDate = array_merge($year, $yearDate);
68 $yearDate = CRM_Utils_Date
::format($yearDate);
69 $yearDate = $yearDate . '000000';
70 $yearDateEnd = $year['Y'] . '1231235959';
72 // current month - prefix = 'month'
73 $currentMonth = date("F Y", mktime(0, 0, 0, date("m"), 01, date("Y")));
74 $this->assign('currentMonthYear', $currentMonth);
75 $monthDate = date('Ym') . '01000000';
76 $monthDateEnd = CRM_Utils_Date
::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m"), 01, date("Y"))), '%Y%m%d') . '235959';
78 // previous month - prefix = 'previous'
79 $previousDate = CRM_Utils_Date
::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '000000';
80 $previousDateEnd = CRM_Utils_Date
::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '235959';
81 $previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
82 $this->assign('previousMonthYear', $previousMonth);
84 foreach ($prefixes as $prefix) {
85 $aName = $prefix . 'ToDate';
86 $startName = $prefix . 'Date';
87 $endName = $prefix . 'DateEnd';
88 foreach ($status as $s) {
89 $
{$aName}[str_replace(" ", "", $s)] = CRM_Pledge_BAO_Pledge
::getTotalAmountAndCount($s, $
$startName, $
$endName);
91 $this->assign($aName, $
$aName);
96 * the main function that is called when the page loads,
97 * it decides the which action has to be taken for the page.
101 public function run() {
104 $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search',
108 $controller->setEmbedded(TRUE);
109 $controller->reset();
110 $controller->set('limit', 10);
111 $controller->set('force', 1);
112 $controller->set('context', 'dashboard');
113 $controller->process();
116 return parent
::run();