Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-07-14-22-39-05
[civicrm-core.git] / api / v3 / MailingGroup.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.3 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /**
30 *
31 * APIv3 functions for registering/processing mailing group events.
32 *
33 * @package CiviCRM_APIv3
34 * @subpackage API_MailerGroup
35 * @copyright CiviCRM LLC (c) 2004-2013
36 * $Id$
37 *
38 */
39
40 /**
41 * Handle an unsubscribe event
42 * @deprecated
43 *
44 * @param array $params
45 *
46 * @return array
47 */
48 function civicrm_api3_mailing_group_event_unsubscribe($params) {
49 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
50 }
51
52 /**
53 * Handle a site-level unsubscribe event
54 *
55 * @param array $params
56 *
57 * @return array
58 */
59 function civicrm_api3_mailing_group_event_domain_unsubscribe($params) {
60 $params['org_unsubscribe'] = 1;
61 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
62 }
63
64 /**
65 * Handle a resubscription event
66 * @deprecated
67 *
68 * @param array $params
69 *
70 * @return array
71 */
72 function civicrm_api3_mailing_group_event_resubscribe($params) {
73 return civicrm_api('mailing_event_resubscribe', 'create', $params);
74 }
75
76 /**
77 * Handle a subscription event
78 * @deprecated
79 *
80 * @param array $params
81 *
82 * @return array
83 */
84 function civicrm_api3_mailing_group_event_subscribe($params) {
85 return civicrm_api('mailing_event_subscribe', 'create', $params);
86 }
87
88 function civicrm_api3_mailing_group_getfields($params) {
89 $dao = _civicrm_api3_get_DAO('Subscribe');
90 $d = new $dao();
91 $fields = $d->fields();
92 $d->free();
93
94 $dao = _civicrm_api3_get_DAO('Unsubscribe');
95 $d = new $dao();
96 $fields = $fields + $d->fields();
97 $d->free();
98
99 return civicrm_api3_create_success($fields);
100 }
101