phpdoc params is always an array in api
[civicrm-core.git] / api / v3 / MessageTemplate.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Project60 version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright TTTP (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 */
26
27 /**
28 * File for the CiviCRM APIv3 message_template functions
29 *
30 * @package CiviCRM_SEPA
31 *
32 */
33
34 /**
35 * @access public
36 * @param array $params
37 * @return array
38 * @throws \API_Exception
39 */
40 function civicrm_api3_message_template_create($params) {
41 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
42 }
43
44 /**
45 * Adjust Metadata for Create action
46 *
47 * The metadata is used for setting defaults, documentation & validation
48 * @param array $params
49 * Array or parameters determined by getfields.
50 */
51 function _civicrm_api3_message_template_create_spec(&$params) {
52 $params['msg_title']['api.required'] = 1;
53 $params['is_active']['api.default'] = TRUE;
54 /* $params['entity_id']['api.required'] = 1;
55 $params['entity_table']['api.default'] = "civicrm_contribution_recur";
56 $params['type']['api.default'] = "R";
57 */
58 }
59
60 /**
61 * @param array $params
62 *
63 * @return boolean
64 * | error true if successfull, error otherwise
65 * {@getfields message_template_delete}
66 * @access public
67 */
68 function civicrm_api3_message_template_delete($params) {
69 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
70 }
71
72 /**
73 * @param array $params
74 */
75 function _civicrm_api3_message_template_get_spec(&$params) {
76 }
77
78 /**
79 * Retrieve one or more message_template
80 *
81 * @param array input parameters
82 *
83 *
84 * @example SepaCreditorGet.php Standard Get Example
85 *
86 * @param array $params
87 * An associative array of name/value pairs.
88 *
89 * @return array
90 * api result array
91 * {@getfields message_template_get}
92 * @access public
93 */
94 function civicrm_api3_message_template_get($params) {
95 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
96 }
97
98 /**
99 * Sends a template.
100 * @param array $params
101 */
102 function civicrm_api3_message_template_send($params) {
103 CRM_Core_BAO_MessageTemplates::sendTemplate($params);
104 }
105
106 /**
107 * Adjust Metadata for Create action
108 *
109 * The metadata is used for setting defaults, documentation &
110 * validation.
111 *
112 * @param array $params
113 * Array or parameters determined by getfields.
114 */
115 function _civicrm_api3_message_template_send_spec(&$params) {
116 $params['messageTemplateID']['api.required'] = 1;
117 $params['messageTemplateID']['title'] = 'Message Template ID';
118 $params['contactId']['api.required'] = 1;
119 $params['contactId']['title'] = 'Contact ID';
120 $params['toEmail']['api.required'] = 1;
121 $params['toEmail']['title'] = 'To Email';
122 $params['toName']['api.required'] = 1;
123 $params['toName']['title'] = 'To Name';
124 }