Commit | Line | Data |
---|---|---|
b025fef8 | 1 | <?php |
2 | ||
3 | /* | |
a30c801b TO |
4 | +--------------------------------------------------------------------+ |
5 | | Copyright CiviCRM LLC. All rights reserved. | | |
6 | | | | |
7 | | This work is published under the GNU AGPLv3 license with some | | |
8 | | permitted exceptions and without any warranty. For full license | | |
9 | | and copyright information, see https://civicrm.org/licensing | | |
10 | +--------------------------------------------------------------------+ | |
b025fef8 | 11 | */ |
12 | ||
13 | /** | |
14 | * This api exposes CiviCRM PCP records. | |
15 | * | |
16 | * | |
17 | * @package CiviCRM_APIv3 | |
18 | */ | |
7c31ae57 | 19 | |
b025fef8 | 20 | /** |
21 | * Create or update a survey. | |
22 | * | |
23 | * @param array $params | |
24 | * Array per getfields metadata. | |
efc37755 | 25 | * |
b025fef8 | 26 | * @return array api result array |
27 | */ | |
28 | function civicrm_api3_pcp_create($params) { | |
efc37755 | 29 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Pcp'); |
b025fef8 | 30 | } |
31 | ||
32 | /** | |
33 | * Adjust Metadata for Create action. | |
34 | * | |
35 | * The metadata is used for setting defaults, documentation & validation. | |
36 | * | |
37 | * @param array $params | |
38 | * Array of parameters determined by getfields. | |
39 | */ | |
40 | function _civicrm_api3_pcp_create_spec(&$params) { | |
41 | $params['title']['api.required'] = 1; | |
42 | $params['contact_id']['api.required'] = 1; | |
43 | $params['page_id']['api.required'] = 1; | |
44 | $params['pcp_block_id']['api.required'] = 1; | |
45 | } | |
46 | ||
47 | /** | |
48 | * Returns array of pcps matching a set of one or more properties. | |
49 | * | |
50 | * @param array $params | |
51 | * Array per getfields | |
efc37755 | 52 | * |
b025fef8 | 53 | * @return array Array of matching pcps |
54 | */ | |
55 | function civicrm_api3_pcp_get($params) { | |
efc37755 | 56 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Pcp'); |
b025fef8 | 57 | } |
58 | ||
59 | /** | |
60 | * Delete an existing PCP. | |
61 | * | |
62 | * This method is used to delete any existing PCP given its id. | |
63 | * | |
64 | * @param array $params | |
65 | * [id] | |
efc37755 | 66 | * |
b025fef8 | 67 | * @return array api result array |
68 | */ | |
69 | function civicrm_api3_pcp_delete($params) { | |
efc37755 | 70 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); |
71 | } |