Merge branch 4.5 into master
[civicrm-core.git] / api / v3 / ParticipantStatusType.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
731a0992 6 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
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
731a0992 33 * @copyright CiviCRM LLC (c) 2004-2014
6a488035
TO
34 */
35
6a488035 36/**
d1b0d05e 37 * Create/update participant_status.
6a488035
TO
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 *
cf470720 43 * @param array $params
d1b0d05e 44 * Array of property.
6a488035
TO
45 * name/value pairs to insert in new 'participant_status'
46 *
a6c01b45 47 * @return array
72b3a70c 48 * participant_status array
6a488035
TO
49 */
50function civicrm_api3_participant_status_type_create($params) {
51 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
52}
53
54/**
d1b0d05e 55 * Returns array of participant_statuses matching a set of one or more group properties.
6a488035 56 *
cf470720
TO
57 * @param array $params
58 * Array of one or more valid.
6a488035 59 * property_name=>value pairs. If $params is set
c206647d 60 * as null, all participant_statuses will be returned
6a488035 61 *
a6c01b45 62 * @return array
72b3a70c 63 * Array of matching participant_statuses
6a488035
TO
64 */
65function civicrm_api3_participant_status_type_get($params) {
66 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
67}
68
69/**
d1b0d05e 70 * Delete an existing participant_status.
6a488035
TO
71 *
72 * This method is used to delete any existing participant_status. id of the group
73 * to be deleted is required field in $params array
74 *
cf470720 75 * @param array $params
d1b0d05e 76 * Array containing id of the group.
6a488035
TO
77 * to be deleted
78 *
a6c01b45 79 * @return array
72b3a70c 80 * api result array
6a488035
TO
81 */
82function civicrm_api3_participant_status_type_delete($params) {
83 if (CRM_Event_BAO_ParticipantStatusType::deleteParticipantStatusType($params['id'])) {
84 return civicrm_api3_create_success(TRUE);
85 }
86
87 return civicrm_api3_create_error(TRUE);
88}