<?php
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* APIv3 functions for registering/processing mailing ab testing events.
*
* @package CiviCRM_APIv3
- * @subpackage API_MailingAB
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
*/
/**
- * Files required for this package
+ * @param array $spec
*/
+function _civicrm_api3_mailing_a_b_create_spec(&$spec) {
+ $spec['created_date']['api.default'] = 'now';
+ $spec['created_id']['api.required'] = 1;
+ $spec['created_id']['api.default'] = 'user_contact_id';
+}
/**
- * Handle a create mailing ab testing
+ * Handle a create mailing ab testing.
*
* @param array $params
- * @param array $ids
*
* @return array
- * API Success Array
+ * API Success Array
*/
function civicrm_api3_mailing_a_b_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* Handle a delete event.
*
* @param array $params
- * @param array $ids
*
* @return array
- * API Success Array
+ * API Success Array
*/
function civicrm_api3_mailing_a_b_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* Handle a get event.
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_a_b_get($params) {
}
/**
- * Adjust Metadata for submit action
+ * Adjust Metadata for submit action.
*
- * The metadata is used for setting defaults, documentation & validation
- * @param array $params
- * Array or parameters determined by getfields.
+ * The metadata is used for setting defaults, documentation & validation.
+ *
+ * @param array $spec
+ * Array of parameters determined by getfields.
*/
-function _civicrm_api3_mailing_a_b_submit_spec(&$params) {
+function _civicrm_api3_mailing_a_b_submit_spec(&$spec) {
$mailingFields = CRM_Mailing_DAO_Mailing::fields();
$mailingAbFields = CRM_Mailing_DAO_MailingAB::fields();
$spec['id'] = $mailingAbFields['id'];
}
/**
- * Send A/B mail to A/B recipients respectively
+ * Send A/B mail to A/B recipients respectively.
*
* @param array $params
+ *
* @return array
* @throws API_Exception
*/
}
/**
- * Adjust Metadata for graph_stats action
+ * Adjust Metadata for graph_stats action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
*
- * The metadata is used for setting defaults, documentation & validation
* @param array $params
- * Array or parameters determined by getfields.
+ * Array of parameters determined by getfields.
*/
function _civicrm_api3_mailing_a_b_graph_stats_spec(&$params) {
- $params['criteria']['title'] = 'Criteria';
- $params['criteria']['default'] = 'Open';
+ $params['criteria'] = array(
+ 'title' => 'Criteria',
+ 'default' => 'Open',
+ 'type' => CRM_Utils_Type::T_STRING,
+ );
+
// mailing_ab_winner_criteria
$params['target_date']['title'] = 'Target Date';
$params['target_date']['type'] = CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME;
- $params['split_count']['title'] = 'Split Count';
- $params['split_count']['api.default'] = 6;
+ $params['split_count'] = array(
+ 'title' => 'Split Count',
+ 'api.default' => 6,
+ 'type' => CRM_Utils_Type::T_INT,
+ );
$params['split_count_select']['title'] = 'Split Count Select';
$params['split_count_select']['api.required'] = 1;
$params['target_url']['title'] = 'Target URL';
}
/**
- * Send graph detail for A/B tests mail
+ * Send graph detail for A/B tests mail.
*
* @param array $params
+ *
* @return array
* @throws API_Exception
*/