Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 TO |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
95cdcc0f | 19 | * Dummy page for details of Phone. |
6a488035 TO |
20 | */ |
21 | class CRM_Contact_Page_Inline_Phone extends CRM_Core_Page { | |
22 | ||
23 | /** | |
24 | * Run the page. | |
25 | * | |
26 | * This method is called after the page is created. | |
f7ad2038 | 27 | * |
28 | * @throws \CRM_Core_Exception | |
6a488035 | 29 | */ |
00be9182 | 30 | public function run() { |
6a488035 | 31 | // get the emails for this contact |
f7ad2038 | 32 | $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); |
6a488035 | 33 | |
be2fb01f | 34 | $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'display_name']); |
b4f964d9 | 35 | $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); |
6a488035 | 36 | |
be2fb01f | 37 | $entityBlock = ['contact_id' => $contactId]; |
6a488035 TO |
38 | $phones = CRM_Core_BAO_Phone::getValues($entityBlock); |
39 | if (!empty($phones)) { | |
40 | foreach ($phones as $key => & $value) { | |
41 | $value['location_type'] = $locationTypes[$value['location_type_id']]; | |
42 | $value['phone_type'] = $phoneTypes[$value['phone_type_id']]; | |
43 | } | |
44 | } | |
45 | ||
481a74f4 | 46 | $contact = new CRM_Contact_BAO_Contact(); |
6a488035 | 47 | $contact->id = $contactId; |
ce80b209 | 48 | $contact->find(TRUE); |
be2fb01f | 49 | $privacy = []; |
481a74f4 TO |
50 | foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) { |
51 | if (isset($contact->$name)) { | |
6a488035 TO |
52 | $privacy[$name] = $contact->$name; |
53 | } | |
54 | } | |
8ef12e64 | 55 | |
6a488035 TO |
56 | $this->assign('contactId', $contactId); |
57 | $this->assign('phone', $phones); | |
58 | $this->assign('privacy', $privacy); | |
59 | ||
60 | // check logged in user permission | |
61 | CRM_Contact_Page_View::checkUserPermission($this, $contactId); | |
8ef12e64 | 62 | |
63 | // finally call parent | |
6a488035 TO |
64 | parent::run(); |
65 | } | |
96025800 | 66 | |
6a488035 | 67 | } |