projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #6363 from civicrm/CRM-16944
[civicrm-core.git]
/
api
/
v3
/
Participant.php
diff --git
a/api/v3/Participant.php
b/api/v3/Participant.php
index 3620497fd51fa9673643d38ce543829c18fbac1d..7bca68fd963c794449c9b14f04b24a226ce5b249 100644
(file)
--- a/
api/v3/Participant.php
+++ b/
api/v3/Participant.php
@@
-1,10
+1,9
@@
<?php
<?php
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-201
4
|
+ | Copyright CiviCRM LLC (c) 2004-201
5
|
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@
-27,33
+26,22
@@
*/
/**
*/
/**
- *
File for the CiviCRM APIv3 participant functions
+ *
This api exposes CiviCRM participant.
*
* @package CiviCRM_APIv3
*
* @package CiviCRM_APIv3
- * @subpackage API_Participant
- *
- * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: Participant.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
/**
*/
/**
- * Create an Event Participant
- *
- * This API is used for creating a participants in an event.
- * Required parameters : event_id AND contact_id for new creation
- * : participant as name/value with participantid for edit
+ * Create an Event Participant.
*
* @param array $params
* An associative array of name/value property values of civicrm_participant.
*
* @return array
*
* @param array $params
* An associative array of name/value property values of civicrm_participant.
*
* @return array
- * apiresult
- * {@getfields participant_create}
- * @access public
+ * API result array
*/
function civicrm_api3_participant_create($params) {
*/
function civicrm_api3_participant_create($params) {
- //
check that event id is not an template - should be done @ BAO layer
+ //
Check that event id is not an template - should be done @ BAO layer.
if (!empty($params['event_id'])) {
$isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template');
if (!empty($isTemplate)) {
if (!empty($params['event_id'])) {
$isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template');
if (!empty($isTemplate)) {
@@
-72,12
+60,18
@@
function civicrm_api3_participant_create($params) {
}
_civicrm_api3_object_to_array($participantBAO, $participant[$participantBAO->id]);
}
_civicrm_api3_object_to_array($participantBAO, $participant[$participantBAO->id]);
- return civicrm_api3_create_success($participant, $params, '
p
articipant', 'create', $participantBAO);
+ return civicrm_api3_create_success($participant, $params, '
P
articipant', 'create', $participantBAO);
}
/**
}
/**
+ * Create a default participant line item.
+ *
* @todo this should be done in the BAO not the api
* @todo this should be done in the BAO not the api
- * Create a default participant line item
+ *
+ * @param array $params
+ * @param $participant
+ *
+ * @throws \CiviCRM_API3_Exception
*/
function _civicrm_api3_participant_createlineitem(&$params, $participant) {
// it is possible that a fee level contains information about multiple
*/
function _civicrm_api3_participant_createlineitem(&$params, $participant) {
// it is possible that a fee level contains information about multiple
@@
-136,11
+130,12
@@
function _civicrm_api3_participant_createlineitem(&$params, $participant) {
/**
/**
- * Adjust Metadata for Create action
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
*
*
- * The metadata is used for setting defaults, documentation & validation
* @param array $params
* @param array $params
- * Array o
r
parameters determined by getfields.
+ * Array o
f
parameters determined by getfields.
*/
function _civicrm_api3_participant_create_spec(&$params) {
$params['status_id']['api.default'] = "1";
*/
function _civicrm_api3_participant_create_spec(&$params) {
$params['status_id']['api.default'] = "1";
@@
-153,23
+148,18
@@
function _civicrm_api3_participant_create_spec(&$params) {
}
/**
}
/**
- * Retrieve a specific participant, given a set of input params
- * If more than one matching participant exists, return an error, unless
- * the client has requested to return the first found contact
+ * Retrieve a specific participant, given a set of input params.
*
* @param array $params
*
* @param array $params
- *
(reference )
input parameters.
+ * input parameters.
*
* @return array
*
* @return array
- * (reference ) array of properties, if error an array with an error id and error message
- * {@getfields participant_get}
- * @access public
+ * array of properties, if error an array with an error id and error message
*/
function civicrm_api3_participant_get($params) {
$mode = CRM_Contact_BAO_Query::MODE_EVENT;
*/
function civicrm_api3_participant_get($params) {
$mode = CRM_Contact_BAO_Query::MODE_EVENT;
- $entity = 'participant';
- list($dao, $query) = _civicrm_api3_get_query_object($params, $mode,
$entity
);
+ list($dao, $query) = _civicrm_api3_get_query_object($params, $mode,
'Participant'
);
$participant = array();
while ($dao->fetch()) {
$participant = array();
while ($dao->fetch()) {
@@
-178,33
+168,35
@@
function civicrm_api3_participant_get($params) {
_civicrm_api3_custom_data_get($participant[$dao->participant_id], 'Participant', $dao->participant_id, NULL);
}
_civicrm_api3_custom_data_get($participant[$dao->participant_id], 'Participant', $dao->participant_id, NULL);
}
- return civicrm_api3_create_success($participant, $params, '
p
articipant', 'get', $dao);
+ return civicrm_api3_create_success($participant, $params, '
P
articipant', 'get', $dao);
}
/**
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
*
*
- * The metadata is used for setting defaults, documentation & validation
* @param array $params
* @param array $params
- * Array o
r
parameters determined by getfields.
+ * Array o
f
parameters determined by getfields.
*/
function _civicrm_api3_participant_get_spec(&$params) {
*/
function _civicrm_api3_participant_get_spec(&$params) {
- $params['participant_test']['api.default'] = 0;
- $params['participant_test']['title'] = 'Get Test Participants';
+ $params['participant_test'] = array(
+ 'api.default' => 0,
+ 'title' => 'Get Test Participants',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ );
}
/**
}
/**
- * Deletes an existing contact participant
+ * Deletes an existing contact participant
.
*
* This API is used for deleting a contact participant
*
* @param array $params
* Array containing Id of the contact participant to be deleted.
*
*
* This API is used for deleting a contact participant
*
* @param array $params
* Array containing Id of the contact participant to be deleted.
*
- * {@getfields participant_delete}
* @throws Exception
* @return array
* @throws Exception
* @return array
- * @access public
*/
function civicrm_api3_participant_delete($params) {
*/
function civicrm_api3_participant_delete($params) {