INFRA-132 - Batch 14 (g)
[civicrm-core.git] / api / v3 / ParticipantStatusType.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 * File for the CiviCRM APIv3 group functions
30 *
31 * @package CiviCRM_APIv3
32 * @subpackage API_Event
33 * @copyright CiviCRM LLC (c) 2004-2014
34 */
35
36 /**
37 * create/update participant_status
38 *
39 * This API is used to create new participant_status or update any of the existing
40 * In case of updating existing participant_status, id of that particular participant_status must
41 * be in $params array.
42 *
43 * @param array $params
44 * Associative array of property.
45 * name/value pairs to insert in new 'participant_status'
46 *
47 * @return array
48 * participant_status array
49 * {@getfields ParticipantStatusType_create}
50 * @example ParticipantStatusTypeCreate.php
51 */
52 function civicrm_api3_participant_status_type_create($params) {
53 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
54 }
55
56 /**
57 * Returns array of participant_statuses matching a set of one or more group properties
58 *
59 * @param array $params
60 * Array of one or more valid.
61 * property_name=>value pairs. If $params is set
62 * as null, all participant_statuses will be returned
63 *
64 * @return array
65 * Array of matching participant_statuses
66 * {@getfields ParticipantStatusType_get}
67 * @example ParticipantStatusTypeGet.php
68 */
69 function civicrm_api3_participant_status_type_get($params) {
70 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
71 }
72
73 /**
74 * delete an existing participant_status
75 *
76 * This method is used to delete any existing participant_status. id of the group
77 * to be deleted is required field in $params array
78 *
79 * @param array $params
80 * (reference) array containing id of the group.
81 * to be deleted
82 *
83 * @return array
84 * api result array
85 * {@getfields ParticipantStatusType_delete}
86 * @example ParticipantStatusTypeDelete.php
87 */
88 function civicrm_api3_participant_status_type_delete($params) {
89 if (CRM_Event_BAO_ParticipantStatusType::deleteParticipantStatusType($params['id'])) {
90 return civicrm_api3_create_success(TRUE);
91 }
92
93 return civicrm_api3_create_error(TRUE);
94 }