Commit | Line | Data |
---|---|---|
4a092902 XD |
1 | <?php |
2 | // $Id$ | |
3 | /* | |
4 | +--------------------------------------------------------------------+ | |
5 | | Project60 version 4.3 | | |
6 | +--------------------------------------------------------------------+ | |
7 | | Copyright TTTP (c) 2004-2013 | | |
8 | +--------------------------------------------------------------------+ | |
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 | /** | |
63c9befe | 29 | * File for the CiviCRM APIv3 message_template functions |
4a092902 XD |
30 | * |
31 | * @package CiviCRM_SEPA | |
32 | * | |
33 | */ | |
34 | ||
4a092902 XD |
35 | /** |
36 | * @access public | |
37 | */ | |
63c9befe | 38 | function civicrm_api3_message_template_create($params) { |
4a092902 XD |
39 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); |
40 | } | |
41 | ||
42 | /** | |
43 | * Adjust Metadata for Create action | |
8ef12e64 | 44 | * |
4a092902 | 45 | * The metadata is used for setting defaults, documentation & validation |
cf470720 TO |
46 | * @param array $params |
47 | * Array or parameters determined by getfields. | |
4a092902 | 48 | */ |
63c9befe | 49 | function _civicrm_api3_message_template_create_spec(&$params) { |
4a092902 XD |
50 | $params['msg_title']['api.required'] = 1; |
51 | $params['is_active']['api.default'] = true; | |
52 | /* $params['entity_id']['api.required'] = 1; | |
53 | $params['entity_table']['api.default'] = "civicrm_contribution_recur"; | |
54 | $params['type']['api.default'] = "R"; | |
55 | */ | |
56 | } | |
57 | ||
58 | /** | |
cf470720 | 59 | * @param array $params |
4a092902 XD |
60 | * |
61 | * @return boolean | error true if successfull, error otherwise | |
63c9befe | 62 | * {@getfields message_template_delete} |
4a092902 XD |
63 | * @access public |
64 | */ | |
63c9befe | 65 | function civicrm_api3_message_template_delete($params) { |
4a092902 XD |
66 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); |
67 | } | |
68 | ||
aa1b1481 | 69 | /** |
c490a46a | 70 | * @param array $params |
aa1b1481 | 71 | */ |
63c9befe | 72 | function _civicrm_api3_message_template_get_spec(&$params) { |
4a092902 | 73 | } |
f471d149 | 74 | |
4a092902 | 75 | /** |
63c9befe | 76 | * Retrieve one or more message_template |
4a092902 | 77 | * |
cf470720 | 78 | * @param array input parameters |
4a092902 XD |
79 | * |
80 | * | |
81 | * @example SepaCreditorGet.php Standard Get Example | |
82 | * | |
cf470720 TO |
83 | * @param array $params |
84 | * An associative array of name/value pairs. | |
4a092902 XD |
85 | * |
86 | * @return array api result array | |
63c9befe | 87 | * {@getfields message_template_get} |
4a092902 XD |
88 | * @access public |
89 | */ | |
63c9befe | 90 | function civicrm_api3_message_template_get($params) { |
4a092902 XD |
91 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); |
92 | } | |
93 | ||
f471d149 CB |
94 | /** |
95 | * Sends a template. | |
96 | */ | |
97 | function civicrm_api3_message_template_send($params) { | |
f471d149 CB |
98 | CRM_Core_BAO_MessageTemplates::sendTemplate($params); |
99 | } | |
100 | ||
101 | /** | |
102 | * Adjust Metadata for Create action | |
103 | * | |
104 | * The metadata is used for setting defaults, documentation & | |
105 | * validation. | |
106 | * | |
cf470720 TO |
107 | * @param array $params |
108 | * Array or parameters determined by getfields. | |
f471d149 CB |
109 | */ |
110 | function _civicrm_api3_message_template_send_spec(&$params) { | |
7385c761 EM |
111 | $params['messageTemplateID']['api.required'] = 1; |
112 | $params['messageTemplateID']['title'] = 'Message Template ID'; | |
113 | $params['contactId']['api.required'] = 1; | |
114 | $params['contactId']['title'] = 'Contact ID'; | |
115 | $params['toEmail']['api.required'] = 1; | |
116 | $params['toEmail']['title'] = 'To Email'; | |
117 | $params['toName']['api.required'] = 1; | |
118 | $params['toName']['title'] = 'To Name'; | |
f471d149 | 119 | } |