Merge pull request #20239 from eileenmcnaughton/act
[civicrm-core.git] / CRM / Contact / Page / Inline / Demographics.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
18 /**
19 * Dummy page for details of demographics.
20 */
21 class CRM_Contact_Page_Inline_Demographics extends CRM_Core_Page {
22
23 /**
24 * Run the page.
25 *
26 * This method is called after the page is created.
27 */
28 public function run() {
29 // get the emails for this contact
30 $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
31
32 $params = ['id' => $contactId];
33
34 $defaults = [];
35 CRM_Contact_BAO_Contact::getValues($params, $defaults);
36
37 if (!empty($defaults['gender_id'])) {
38 $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
39 $defaults['gender_display'] = $gender[$defaults['gender_id']];
40 }
41 $this->assignFieldMetadataToTemplate('Contact');
42
43 $this->assign('contactId', $contactId);
44 $this->assign($defaults);
45
46 // check logged in user permission
47 CRM_Contact_Page_View::checkUserPermission($this, $contactId);
48
49 // finally call parent
50 parent::run();
51 }
52
53 }