| 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 | * This api exposes CiviCRM participant status options. |
| 14 | * |
| 15 | * @package CiviCRM_APIv3 |
| 16 | */ |
| 17 | |
| 18 | /** |
| 19 | * Create/update participant_status. |
| 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 | * |
| 25 | * @param array $params |
| 26 | * name/value pairs to insert in new 'participant_status' |
| 27 | * |
| 28 | * @return array |
| 29 | * participant_status array |
| 30 | */ |
| 31 | function civicrm_api3_participant_status_type_create($params) { |
| 32 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ParticipantStatusType'); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Returns array of participant_statuses matching a set of one or more group properties. |
| 37 | * |
| 38 | * @param array $params |
| 39 | * Array of properties. If empty, all records will be returned. |
| 40 | * |
| 41 | * @return array |
| 42 | * Array of matching participant_statuses |
| 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 | /** |
| 49 | * Delete an existing participant_status. |
| 50 | * |
| 51 | * This method is used to delete any existing participant_status given its id. |
| 52 | * |
| 53 | * @param array $params |
| 54 | * [id] |
| 55 | * @return array api result array |
| 56 | * @throws API_Exception |
| 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 | |
| 63 | throw new API_Exception('Could not delete participant status type id ' . $params['id']); |
| 64 | } |