Update debugging page text
[civicrm-core.git] / api / v3 / MessageTemplate.php
CommitLineData
4a092902 1<?php
4a092902
XD
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 +--------------------------------------------------------------------+
d25dd0ee 25 */
4a092902
XD
26
27/**
c28e1768 28 * This api exposes CiviCRM message_template.
4a092902 29 *
b081365f 30 * @package CiviCRM_APIv3
4a092902
XD
31 */
32
4a092902 33/**
61fe4988
EM
34 * Create message template.
35 *
d0997921 36 * @param array $params
61fe4988 37 *
645ee340
EM
38 * @return array
39 * @throws \API_Exception
4a092902 40 */
63c9befe 41function civicrm_api3_message_template_create($params) {
4a092902
XD
42 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
43}
44
45/**
0aa0303c
EM
46 * Adjust Metadata for Create action.
47 *
48 * The metadata is used for setting defaults, documentation & validation.
8ef12e64 49 *
cf470720 50 * @param array $params
b081365f 51 * Array of parameters determined by getfields.
4a092902 52 */
63c9befe 53function _civicrm_api3_message_template_create_spec(&$params) {
4a092902 54 $params['msg_title']['api.required'] = 1;
35671d00
TO
55 $params['is_active']['api.default'] = TRUE;
56 /* $params['entity_id']['api.required'] = 1;
4a092902
XD
57 $params['entity_table']['api.default'] = "civicrm_contribution_recur";
58 $params['type']['api.default'] = "R";
e70a7fc0 59 */
4a092902
XD
60}
61
62/**
dc64d047
EM
63 * Delete message template.
64 *
cf470720 65 * @param array $params
4a092902 66 *
ae5ffbb7
TO
67 * @return bool
68 * API result array
4a092902 69 */
63c9befe 70function civicrm_api3_message_template_delete($params) {
4a092902
XD
71 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
72}
73
aa1b1481 74/**
1747ab99
EM
75 * Adjust metadata for message_template get action.
76 *
c490a46a 77 * @param array $params
aa1b1481 78 */
63c9befe 79function _civicrm_api3_message_template_get_spec(&$params) {
4a092902 80}
f471d149 81
4a092902 82/**
1747ab99 83 * Retrieve one or more message_template.
4a092902 84 *
cf470720 85 * @param array $params
1747ab99 86 * Array of name/value pairs.
4a092902 87 *
a6c01b45 88 * @return array
1747ab99 89 * API result array.
4a092902 90 */
63c9befe 91function civicrm_api3_message_template_get($params) {
4a092902
XD
92 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
93}
94
f471d149
CB
95/**
96 * Sends a template.
1747ab99 97 *
d0997921 98 * @param array $params
f471d149
CB
99 */
100function civicrm_api3_message_template_send($params) {
f471d149
CB
101 CRM_Core_BAO_MessageTemplates::sendTemplate($params);
102}
103
104/**
0aa0303c 105 * Adjust Metadata for Create action.
f471d149
CB
106 *
107 * The metadata is used for setting defaults, documentation &
108 * validation.
109 *
cf470720 110 * @param array $params
b081365f 111 * Array of parameters determined by getfields.
f471d149
CB
112 */
113function _civicrm_api3_message_template_send_spec(&$params) {
7385c761
EM
114 $params['messageTemplateID']['api.required'] = 1;
115 $params['messageTemplateID']['title'] = 'Message Template ID';
116 $params['contactId']['api.required'] = 1;
117 $params['contactId']['title'] = 'Contact ID';
118 $params['toEmail']['api.required'] = 1;
119 $params['toEmail']['title'] = 'To Email';
120 $params['toName']['api.required'] = 1;
121 $params['toName']['title'] = 'To Name';
f471d149 122}