Merge pull request #21945 from masetto/profile-data-attribute
[civicrm-core.git] / CRM / Pledge / Page / UserDashboard.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 class CRM_Pledge_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard {
18
19 /**
20 * called when action is browse.
21 */
22 public function listPledges() {
23 $controller = new CRM_Core_Controller_Simple(
24 'CRM_Pledge_Form_Search',
25 ts('Pledges'),
26 NULL,
27 FALSE, FALSE, TRUE, FALSE
28 );
29 $controller->setEmbedded(TRUE);
30 $controller->reset();
31 $controller->set('limit', 12);
32 $controller->set('cid', $this->_contactId);
33 $controller->set('context', 'user');
34 $controller->set('force', 1);
35 $controller->process();
36 $controller->run();
37
38 // add honor block.
39 $honorParams = [];
40 $honorParams = CRM_Pledge_BAO_Pledge::getHonorContacts($this->_contactId);
41 if (!empty($honorParams)) {
42 // assign vars to templates
43 $this->assign('pledgeHonorRows', $honorParams);
44 $this->assign('pledgeHonor', TRUE);
45 }
46 $session = CRM_Core_Session::singleton();
47 $loggedUserID = $session->get('userID');
48 $this->assign('loggedUserID', $loggedUserID);
49 }
50
51 /**
52 * the main function that is called when the page
53 * loads, it decides the which action has to be taken for the page.
54 */
55 public function run() {
56 parent::preProcess();
57 $this->listPledges();
58 }
59
60 }