Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
a30c801b 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 | /** | |
c28e1768 | 13 | * This api exposes CiviCRM participant status options. |
6a488035 TO |
14 | * |
15 | * @package CiviCRM_APIv3 | |
6a488035 TO |
16 | */ |
17 | ||
6a488035 | 18 | /** |
d1b0d05e | 19 | * Create/update participant_status. |
6a488035 TO |
20 | * |
21 | * This API is used to create new participant_status or update any of the existing | |
22 | * In case of updating existing participant_status, id of that particular participant_status must | |
23 | * be in $params array. | |
24 | * | |
cf470720 | 25 | * @param array $params |
c28e1768 | 26 | * name/value pairs to insert in new 'participant_status' |
6a488035 | 27 | * |
a6c01b45 | 28 | * @return array |
72b3a70c | 29 | * participant_status array |
6a488035 TO |
30 | */ |
31 | function civicrm_api3_participant_status_type_create($params) { | |
a25b46e9 | 32 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ParticipantStatusType'); |
6a488035 TO |
33 | } |
34 | ||
35 | /** | |
d1b0d05e | 36 | * Returns array of participant_statuses matching a set of one or more group properties. |
6a488035 | 37 | * |
cf470720 | 38 | * @param array $params |
b081365f | 39 | * Array of properties. If empty, all records will be returned. |
6a488035 | 40 | * |
a6c01b45 | 41 | * @return array |
72b3a70c | 42 | * Array of matching participant_statuses |
6a488035 TO |
43 | */ |
44 | function civicrm_api3_participant_status_type_get($params) { | |
45 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
46 | } | |
47 | ||
48 | /** | |
d1b0d05e | 49 | * Delete an existing participant_status. |
6a488035 | 50 | * |
244bbdd8 | 51 | * This method is used to delete any existing participant_status given its id. |
6a488035 | 52 | * |
cf470720 | 53 | * @param array $params |
c28e1768 | 54 | * [id] |
8089541a | 55 | * @return array api result array |
8089541a | 56 | * @throws API_Exception |
6a488035 TO |
57 | */ |
58 | function civicrm_api3_participant_status_type_delete($params) { | |
59 | if (CRM_Event_BAO_ParticipantStatusType::deleteParticipantStatusType($params['id'])) { | |
60 | return civicrm_api3_create_success(TRUE); | |
61 | } | |
62 | ||
a60c0bc8 | 63 | throw new API_Exception('Could not delete participant status type id ' . $params['id']); |
6a488035 | 64 | } |