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 | * This page displays custom data during inline edit. |
6a488035 TO |
20 | */ |
21 | class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page { | |
22 | ||
23 | /** | |
24 | * Run the page. | |
25 | * | |
26 | * This method is called after the page is created. | |
6a488035 | 27 | */ |
00be9182 | 28 | public function run() { |
6a488035 TO |
29 | // get the emails for this contact |
30 | $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); | |
31 | $cgId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); | |
fa6bfe1b | 32 | $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST); |
bd2e25c4 | 33 | $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST); |
fa6bfe1b | 34 | |
6a488035 | 35 | //custom groups Inline |
353ffa53 | 36 | $entityType = CRM_Contact_BAO_Contact::getContactType($contactId); |
6a488035 | 37 | $entitySubType = CRM_Contact_BAO_Contact::getContactSubType($contactId); |
0b330e6d | 38 | $groupTree = CRM_Core_BAO_CustomGroup::getTree($entityType, NULL, $contactId, |
6a488035 | 39 | $cgId, $entitySubType |
353ffa53 | 40 | ); |
080d719e | 41 | $details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $contactId); |
fa6bfe1b | 42 | //get the fields of single custom group record |
bd2e25c4 PJ |
43 | if ($customRecId == 1) { |
44 | $fields = reset($details[$cgId]); | |
45 | } | |
46 | else { | |
47 | $fields = CRM_Utils_Array::value($customRecId, $details[$cgId]); | |
48 | } | |
49 | $this->assign('cgcount', $cgcount); | |
fa6bfe1b | 50 | $this->assign('customRecId', $customRecId); |
6a488035 TO |
51 | $this->assign('contactId', $contactId); |
52 | $this->assign('customGroupId', $cgId); | |
53 | $this->assign_by_ref('cd_edit', $fields); | |
54 | ||
55 | // check logged in user permission | |
56 | CRM_Contact_Page_View::checkUserPermission($this, $contactId); | |
bd2e25c4 | 57 | |
fa6bfe1b | 58 | // finally call parent |
6a488035 TO |
59 | parent::run(); |
60 | } | |
96025800 | 61 | |
6a488035 | 62 | } |