First commit
This commit is contained in:
		
						commit
						c6e2478c40
					
				
					 13918 changed files with 2303184 additions and 0 deletions
				
			
		
							
								
								
									
										52
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/AJAX.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/AJAX.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,52 @@ | |||
| <?php | ||||
| /* | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | CiviCRM version 4.7                                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | Copyright CiviCRM LLC (c) 2004-2017                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | This file is a part of CiviCRM.                                    | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is free software; you can copy, modify, and distribute it  | | ||||
|  | under the terms of the GNU Affero General Public License           | | ||||
|  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is distributed in the hope that it will be useful, but     | | ||||
|  | WITHOUT ANY WARRANTY; without even the implied warranty of         | | ||||
|  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               | | ||||
|  | See the GNU Affero General Public License for more details.        | | ||||
|  |                                                                    | | ||||
|  | You should have received a copy of the GNU Affero General Public   | | ||||
|  | License and the CiviCRM Licensing Exception along                  | | ||||
|  | with this program; if not, contact CiviCRM LLC                     | | ||||
|  | at info[AT]civicrm[DOT]org. If you have questions about the        | | ||||
|  | GNU Affero General Public License or the licensing of CiviCRM,     | | ||||
|  | see the CiviCRM license FAQ at http://civicrm.org/licensing        | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * @package CRM | ||||
|  * @copyright CiviCRM LLC (c) 2004-2017 | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * This class contains all the function that are called using AJAX | ||||
|  */ | ||||
| class CRM_Pledge_Page_AJAX { | ||||
| 
 | ||||
|   /** | ||||
|    * Function to setDefaults according to Pledge Id | ||||
|    * for batch entry pledges | ||||
|    */ | ||||
|   public function getPledgeDefaults() { | ||||
|     $details = array(); | ||||
|     if (!empty($_POST['pid'])) { | ||||
|       $pledgeID = CRM_Utils_Type::escape($_POST['pid'], 'Integer'); | ||||
|       $details = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeID); | ||||
|     } | ||||
|     CRM_Utils_JSON::output($details); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										116
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/DashBoard.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/DashBoard.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,116 @@ | |||
| <?php | ||||
| /* | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | CiviCRM version 4.7                                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | Copyright CiviCRM LLC (c) 2004-2017                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | This file is a part of CiviCRM.                                    | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is free software; you can copy, modify, and distribute it  | | ||||
|  | under the terms of the GNU Affero General Public License           | | ||||
|  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is distributed in the hope that it will be useful, but     | | ||||
|  | WITHOUT ANY WARRANTY; without even the implied warranty of         | | ||||
|  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               | | ||||
|  | See the GNU Affero General Public License for more details.        | | ||||
|  |                                                                    | | ||||
|  | You should have received a copy of the GNU Affero General Public   | | ||||
|  | License and the CiviCRM Licensing Exception along                  | | ||||
|  | with this program; if not, contact CiviCRM LLC                     | | ||||
|  | at info[AT]civicrm[DOT]org. If you have questions about the        | | ||||
|  | GNU Affero General Public License or the licensing of CiviCRM,     | | ||||
|  | see the CiviCRM license FAQ at http://civicrm.org/licensing        | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * @package CRM | ||||
|  * @copyright CiviCRM LLC (c) 2004-2017 | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * This page is for the Pledge Dashboard. | ||||
|  */ | ||||
| class CRM_Pledge_Page_DashBoard extends CRM_Core_Page { | ||||
| 
 | ||||
|   /** | ||||
|    * Heart of the viewing process. | ||||
|    * | ||||
|    * The runner gets all the meta data for the contact and calls the appropriate type of page to view. | ||||
|    */ | ||||
|   public function preProcess() { | ||||
|     CRM_Utils_System::setTitle(ts('CiviPledge')); | ||||
| 
 | ||||
|     $startToDate = array(); | ||||
|     $yearToDate = array(); | ||||
|     $monthToDate = array(); | ||||
|     $previousToDate = array(); | ||||
| 
 | ||||
|     $prefixes = array('start', 'month', 'year', 'previous'); | ||||
|     $status = array('Completed', 'Cancelled', 'Pending', 'In Progress', 'Overdue'); | ||||
| 
 | ||||
|     // cumulative (since inception) - prefix = 'start'
 | ||||
|     $startDate = NULL; | ||||
|     $startDateEnd = NULL; | ||||
| 
 | ||||
|     // current year - prefix = 'year'
 | ||||
|     $yearDate = \Civi::settings()->get('fiscalYearStart'); | ||||
|     $year = array('Y' => date('Y')); | ||||
|     $this->assign('curYear', $year['Y']); | ||||
|     $yearDate = array_merge($year, $yearDate); | ||||
|     $yearDate = CRM_Utils_Date::format($yearDate); | ||||
|     $yearDate = $yearDate . '000000'; | ||||
|     $yearDateEnd = $year['Y'] . '1231235959'; | ||||
| 
 | ||||
|     // current month - prefix = 'month'
 | ||||
|     $currentMonth = date("F Y", mktime(0, 0, 0, date("m"), 01, date("Y"))); | ||||
|     $this->assign('currentMonthYear', $currentMonth); | ||||
|     $monthDate = date('Ym') . '01000000'; | ||||
|     $monthDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m"), 01, date("Y"))), '%Y%m%d') . '235959'; | ||||
| 
 | ||||
|     // previous month - prefix = 'previous'
 | ||||
|     $previousDate = CRM_Utils_Date::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '000000'; | ||||
|     $previousDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '235959'; | ||||
|     $previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))); | ||||
|     $this->assign('previousMonthYear', $previousMonth); | ||||
| 
 | ||||
|     foreach ($prefixes as $prefix) { | ||||
|       $aName = $prefix . 'ToDate'; | ||||
|       $startName = $prefix . 'Date'; | ||||
|       $endName = $prefix . 'DateEnd'; | ||||
|       foreach ($status as $s) { | ||||
|         ${$aName}[str_replace(" ", "", $s)] = CRM_Pledge_BAO_Pledge::getTotalAmountAndCount($s, $$startName, $$endName); | ||||
|       } | ||||
|       $this->assign($aName, $$aName); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * The main function that is called when the page loads. | ||||
|    * | ||||
|    * it decides which action has to be taken for the page. | ||||
|    * | ||||
|    * @return null | ||||
|    */ | ||||
|   public function run() { | ||||
|     $this->preProcess(); | ||||
| 
 | ||||
|     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', | ||||
|       ts('Pledge'), | ||||
|       NULL | ||||
|     ); | ||||
|     $controller->setEmbedded(TRUE); | ||||
|     $controller->reset(); | ||||
|     $controller->set('limit', 10); | ||||
|     $controller->set('force', 1); | ||||
|     $controller->set('context', 'dashboard'); | ||||
|     $controller->process(); | ||||
|     $controller->run(); | ||||
| 
 | ||||
|     return parent::run(); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										96
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/Payment.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/Payment.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,96 @@ | |||
| <?php | ||||
| /* | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | CiviCRM version 4.7                                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | Copyright CiviCRM LLC (c) 2004-2017                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | This file is a part of CiviCRM.                                    | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is free software; you can copy, modify, and distribute it  | | ||||
|  | under the terms of the GNU Affero General Public License           | | ||||
|  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is distributed in the hope that it will be useful, but     | | ||||
|  | WITHOUT ANY WARRANTY; without even the implied warranty of         | | ||||
|  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               | | ||||
|  | See the GNU Affero General Public License for more details.        | | ||||
|  |                                                                    | | ||||
|  | You should have received a copy of the GNU Affero General Public   | | ||||
|  | License and the CiviCRM Licensing Exception along                  | | ||||
|  | with this program; if not, contact CiviCRM LLC                     | | ||||
|  | at info[AT]civicrm[DOT]org. If you have questions about the        | | ||||
|  | GNU Affero General Public License or the licensing of CiviCRM,     | | ||||
|  | see the CiviCRM license FAQ at http://civicrm.org/licensing        | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * @package CRM | ||||
|  * @copyright CiviCRM LLC (c) 2004-2017 | ||||
|  */ | ||||
| class CRM_Pledge_Page_Payment extends CRM_Core_Page { | ||||
| 
 | ||||
|   /** | ||||
|    * the main function that is called when the page loads, it decides the which action has to be taken for the page. | ||||
|    * | ||||
|    * @return null | ||||
|    */ | ||||
|   public function run() { | ||||
|     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); | ||||
|     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); | ||||
| 
 | ||||
|     $this->assign('action', $this->_action); | ||||
|     $this->assign('context', $this->_context); | ||||
| 
 | ||||
|     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); | ||||
| 
 | ||||
|     CRM_Pledge_Page_Tab::setContext($this); | ||||
| 
 | ||||
|     if ($this->_action & CRM_Core_Action::UPDATE) { | ||||
|       $this->edit(); | ||||
|     } | ||||
|     else { | ||||
|       $pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this); | ||||
| 
 | ||||
|       $paymentDetails = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId); | ||||
| 
 | ||||
|       $this->assign('rows', $paymentDetails); | ||||
|       $this->assign('pledgeId', $pledgeId); | ||||
|       $this->assign('contactId', $this->_contactId); | ||||
| 
 | ||||
|       // check if we can process credit card contributions
 | ||||
|       $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()); | ||||
| 
 | ||||
|       // check is the user has view/edit signer permission
 | ||||
|       $permission = 'view'; | ||||
|       if (CRM_Core_Permission::check('edit pledges')) { | ||||
|         $permission = 'edit'; | ||||
|       } | ||||
|       $this->assign('permission', $permission); | ||||
|     } | ||||
| 
 | ||||
|     return parent::run(); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * called when action is update or new. | ||||
|    * | ||||
|    * @return null | ||||
|    */ | ||||
|   public function edit() { | ||||
|     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Payment', | ||||
|       'Update Pledge Payment', | ||||
|       $this->_action | ||||
|     ); | ||||
| 
 | ||||
|     $pledgePaymentId = CRM_Utils_Request::retrieve('ppId', 'Positive', $this); | ||||
| 
 | ||||
|     $controller->setEmbedded(TRUE); | ||||
|     $controller->set('id', $pledgePaymentId); | ||||
| 
 | ||||
|     return $controller->run(); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										220
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/Tab.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										220
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/Tab.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,220 @@ | |||
| <?php | ||||
| /* | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | CiviCRM version 4.7                                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | Copyright CiviCRM LLC (c) 2004-2017                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | This file is a part of CiviCRM.                                    | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is free software; you can copy, modify, and distribute it  | | ||||
|  | under the terms of the GNU Affero General Public License           | | ||||
|  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is distributed in the hope that it will be useful, but     | | ||||
|  | WITHOUT ANY WARRANTY; without even the implied warranty of         | | ||||
|  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               | | ||||
|  | See the GNU Affero General Public License for more details.        | | ||||
|  |                                                                    | | ||||
|  | You should have received a copy of the GNU Affero General Public   | | ||||
|  | License and the CiviCRM Licensing Exception along                  | | ||||
|  | with this program; if not, contact CiviCRM LLC                     | | ||||
|  | at info[AT]civicrm[DOT]org. If you have questions about the        | | ||||
|  | GNU Affero General Public License or the licensing of CiviCRM,     | | ||||
|  | see the CiviCRM license FAQ at http://civicrm.org/licensing        | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * @package CRM | ||||
|  * @copyright CiviCRM LLC (c) 2004-2017 | ||||
|  */ | ||||
| class CRM_Pledge_Page_Tab extends CRM_Core_Page { | ||||
|   public $_permission = NULL; | ||||
|   public $_contactId = NULL; | ||||
| 
 | ||||
|   /** | ||||
|    * called when action is browse. | ||||
|    */ | ||||
|   public function browse() { | ||||
|     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', ts('Pledges'), $this->_action); | ||||
|     $controller->setEmbedded(TRUE); | ||||
|     $controller->reset(); | ||||
|     $controller->set('cid', $this->_contactId); | ||||
|     $controller->set('context', 'pledge'); | ||||
|     $controller->set('limit', '25'); | ||||
|     $controller->process(); | ||||
|     $controller->run(); | ||||
| 
 | ||||
|     if ($this->_contactId) { | ||||
|       $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); | ||||
|       $this->assign('displayName', $displayName); | ||||
|       $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('pledge', $this->_contactId); | ||||
|       // Refresh other tabs with related data
 | ||||
|       $this->ajaxResponse['updateTabs'] = array( | ||||
|         '#tab_contribute' => CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId), | ||||
|         '#tab_activity' => CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId), | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * called when action is view. | ||||
|    * | ||||
|    * @return null | ||||
|    */ | ||||
|   public function view() { | ||||
|     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_PledgeView', | ||||
|       'View Pledge', | ||||
|       $this->_action | ||||
|     ); | ||||
|     $controller->setEmbedded(TRUE); | ||||
|     $controller->set('id', $this->_id); | ||||
|     $controller->set('cid', $this->_contactId); | ||||
| 
 | ||||
|     return $controller->run(); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * called when action is update or new. | ||||
|    * | ||||
|    * @return null | ||||
|    */ | ||||
|   public function edit() { | ||||
|     $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Pledge', | ||||
|       'Create Pledge', | ||||
|       $this->_action | ||||
|     ); | ||||
|     $controller->setEmbedded(TRUE); | ||||
|     $controller->set('id', $this->_id); | ||||
|     $controller->set('cid', $this->_contactId); | ||||
| 
 | ||||
|     return $controller->run(); | ||||
|   } | ||||
| 
 | ||||
|   public function preProcess() { | ||||
|     $context = CRM_Utils_Request::retrieve('context', 'String', $this); | ||||
|     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); | ||||
|     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); | ||||
| 
 | ||||
|     if ($context == 'standalone') { | ||||
|       $this->_action = CRM_Core_Action::ADD; | ||||
|     } | ||||
|     else { | ||||
|       $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); | ||||
|       $this->assign('contactId', $this->_contactId); | ||||
| 
 | ||||
|       // check logged in url permission
 | ||||
|       CRM_Contact_Page_View::checkUserPermission($this); | ||||
|     } | ||||
| 
 | ||||
|     $this->assign('action', $this->_action); | ||||
| 
 | ||||
|     if ($this->_permission == CRM_Core_Permission::EDIT && !CRM_Core_Permission::check('edit pledges')) { | ||||
|       // demote to view since user does not have edit pledge rights
 | ||||
|       $this->_permission = CRM_Core_Permission::VIEW; | ||||
|       $this->assign('permission', 'view'); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * the main function that is called when the page loads, it decides the which action has to be taken for the page. | ||||
|    * | ||||
|    * @return null | ||||
|    */ | ||||
|   public function run() { | ||||
|     $this->preProcess(); | ||||
| 
 | ||||
|     // check if we can process credit card registration
 | ||||
|     $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()); | ||||
| 
 | ||||
|     self::setContext($this); | ||||
| 
 | ||||
|     if ($this->_action & CRM_Core_Action::VIEW) { | ||||
|       $this->view(); | ||||
|     } | ||||
|     elseif ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE)) { | ||||
|       $this->edit(); | ||||
|     } | ||||
|     elseif ($this->_action & CRM_Core_Action::DETACH) { | ||||
|       CRM_Pledge_BAO_Pledge::cancel($this->_id); | ||||
|       $session = CRM_Core_Session::singleton(); | ||||
|       $session->setStatus(ts('Pledge has been Cancelled and all scheduled (not completed) payments have been cancelled.<br />')); | ||||
|       CRM_Utils_System::redirect($session->popUserContext()); | ||||
|     } | ||||
|     else { | ||||
|       $this->browse(); | ||||
|     } | ||||
| 
 | ||||
|     return parent::run(); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * Get context. | ||||
|    * | ||||
|    * @param $form | ||||
|    */ | ||||
|   public static function setContext(&$form) { | ||||
|     $context = CRM_Utils_Request::retrieve('context', 'String', $form, FALSE, 'search'); | ||||
| 
 | ||||
|     $qfKey = CRM_Utils_Request::retrieve('key', 'String', $form); | ||||
|     // validate the qfKey
 | ||||
|     if (!CRM_Utils_Rule::qfKey($qfKey)) { | ||||
|       $qfKey = NULL; | ||||
|     } | ||||
| 
 | ||||
|     switch ($context) { | ||||
|       case 'dashboard': | ||||
|       case 'pledgeDashboard': | ||||
|         $url = CRM_Utils_System::url('civicrm/pledge', 'reset=1'); | ||||
|         break; | ||||
| 
 | ||||
|       case 'search': | ||||
|         $urlParams = 'force=1'; | ||||
|         if ($qfKey) { | ||||
|           $urlParams .= "&qfKey=$qfKey"; | ||||
|         } | ||||
| 
 | ||||
|         $url = CRM_Utils_System::url('civicrm/pledge/search', $urlParams); | ||||
|         break; | ||||
| 
 | ||||
|       case 'user': | ||||
|         $url = CRM_Utils_System::url('civicrm/user', 'reset=1'); | ||||
|         break; | ||||
| 
 | ||||
|       case 'pledge': | ||||
|         $url = CRM_Utils_System::url('civicrm/contact/view', | ||||
|           "reset=1&force=1&cid={$form->_contactId}&selectedChild=pledge" | ||||
|         ); | ||||
|         break; | ||||
| 
 | ||||
|       case 'home': | ||||
|         $url = CRM_Utils_System::url('civicrm/dashboard', 'force=1'); | ||||
|         break; | ||||
| 
 | ||||
|       case 'activity': | ||||
|         $url = CRM_Utils_System::url('civicrm/contact/view', | ||||
|           "reset=1&force=1&cid={$form->_contactId}&selectedChild=activity" | ||||
|         ); | ||||
|         break; | ||||
| 
 | ||||
|       case 'standalone': | ||||
|         $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1'); | ||||
|         break; | ||||
| 
 | ||||
|       default: | ||||
|         $cid = NULL; | ||||
|         if ($form->_contactId) { | ||||
|           $cid = '&cid=' . $form->_contactId; | ||||
|         } | ||||
|         $url = CRM_Utils_System::url('civicrm/pledge/search', | ||||
|           'force=1' . $cid | ||||
|         ); | ||||
|         break; | ||||
|     } | ||||
|     $session = CRM_Core_Session::singleton(); | ||||
|     $session->pushUserContext($url); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										76
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/UserDashboard.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								sites/all/modules/civicrm/CRM/Pledge/Page/UserDashboard.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,76 @@ | |||
| <?php | ||||
| /* | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | CiviCRM version 4.7                                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | Copyright CiviCRM LLC (c) 2004-2017                                | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  | This file is a part of CiviCRM.                                    | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is free software; you can copy, modify, and distribute it  | | ||||
|  | under the terms of the GNU Affero General Public License           | | ||||
|  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   | | ||||
|  |                                                                    | | ||||
|  | CiviCRM is distributed in the hope that it will be useful, but     | | ||||
|  | WITHOUT ANY WARRANTY; without even the implied warranty of         | | ||||
|  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               | | ||||
|  | See the GNU Affero General Public License for more details.        | | ||||
|  |                                                                    | | ||||
|  | You should have received a copy of the GNU Affero General Public   | | ||||
|  | License and the CiviCRM Licensing Exception along                  | | ||||
|  | with this program; if not, contact CiviCRM LLC                     | | ||||
|  | at info[AT]civicrm[DOT]org. If you have questions about the        | | ||||
|  | GNU Affero General Public License or the licensing of CiviCRM,     | | ||||
|  | see the CiviCRM license FAQ at http://civicrm.org/licensing        | | ||||
|  +--------------------------------------------------------------------+ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * @package CRM | ||||
|  * @copyright CiviCRM LLC (c) 2004-2017 | ||||
|  */ | ||||
| class CRM_Pledge_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard { | ||||
| 
 | ||||
|   /** | ||||
|    * called when action is browse. | ||||
|    */ | ||||
|   public function listPledges() { | ||||
|     $controller = new CRM_Core_Controller_Simple( | ||||
|       'CRM_Pledge_Form_Search', | ||||
|       ts('Pledges'), | ||||
|       NULL, | ||||
|       FALSE, FALSE, TRUE, FALSE | ||||
|     ); | ||||
|     $controller->setEmbedded(TRUE); | ||||
|     $controller->reset(); | ||||
|     $controller->set('limit', 12); | ||||
|     $controller->set('cid', $this->_contactId); | ||||
|     $controller->set('context', 'user'); | ||||
|     $controller->set('force', 1); | ||||
|     $controller->process(); | ||||
|     $controller->run(); | ||||
| 
 | ||||
|     // add honor block.
 | ||||
|     $honorParams = array(); | ||||
|     $honorParams = CRM_Pledge_BAO_Pledge::getHonorContacts($this->_contactId); | ||||
|     if (!empty($honorParams)) { | ||||
|       // assign vars to templates
 | ||||
|       $this->assign('pledgeHonorRows', $honorParams); | ||||
|       $this->assign('pledgeHonor', TRUE); | ||||
|     } | ||||
|     $session = CRM_Core_Session::singleton(); | ||||
|     $loggedUserID = $session->get('userID'); | ||||
|     $this->assign('loggedUserID', $loggedUserID); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * the main function that is called when the page | ||||
|    * loads, it decides the which action has to be taken for the page. | ||||
|    */ | ||||
|   public function run() { | ||||
|     parent::preProcess(); | ||||
|     $this->listPledges(); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue