/[drupal]/contributions/modules/rsvp/rsvp.mailer.inc
ViewVC logotype

Contents of /contributions/modules/rsvp/rsvp.mailer.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu Feb 5 02:25:44 2009 UTC (9 months, 3 weeks ago) by ulf1
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--2
File MIME type: text/x-php
*** empty log message ***
1 <?php
2 // $Id: rsvp.form.inc,v 1.1 2009/01/17 20:29:02 ulf1 Exp $
3
4 /**
5 * @module rsvp_mailer
6 * @package rsvp - A drupal module developed for civicspace - a distribution of drupal.
7 * @description Provides functionality for mail templates.
8 * @author Ulf Schenk (ulf@schenkunlimited.net)
9 *
10 */
11
12 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
13
14
15 global $rsvp_mailer_ops;
16
17 $rsvp_mailer_ops = array('invitation' => 'Invitation', 'message_guest' => 'Guest messages', 'notification_guest' => 'Guest notification', 'notification_moderator' => 'Moderator notification', 'invitation_cancel' => 'Cancel Invitation');
18
19 /**
20 * Replacements for mail messages
21 * @param $rsvp The invitation object for which emails are being sent
22 * @param $invite_target invitation object for which emails are being sent
23 * @param $sender_name String the name of the sender
24 * @param $message_subject String The subject line for the message
25 * @param $message_body String The message that you want to send
26 * */
27 function rsvp_mailer_replacements($rsvp, $invite_target, $sender_name, $message_subject, $message_body) {
28
29 $replacements = array(
30 '@site' => variable_get('site_name', 'Drupal'),
31 '@site_url' => $GLOBALS['base_url'],
32
33 '@invitation_link' => url("rsvp/email/{$invite_target->hash}/view", array('absolute'=>true)),
34 '@event_link' => url("node/{$invite_target->nid}", array('absolute'=>true)),
35
36 '@sender_name' => check_plain($sender_name),
37 '@message_subject' => check_plain($message_subject),
38 '@message_body' => drupal_html_to_text($message_body),
39 );
40
41 if (!is_null($invite_target)) {
42 $replacements['@guest_name'] = rsvp_function_getGuestEmail($invite_target, true);
43 }
44 else {
45 $replacements['@guest_name'] = '';
46 }
47
48 if (!is_null($rsvp)) {
49 $user = user_load($rsvp->uid);
50 $replacements['@owner_name'] = check_plain($user->name);
51 $replacements['@invitation_subject'] = check_plain($rsvp->name);
52 }
53 else {
54 $replacements['@owner_name'] = '';
55 $replacements['@invitation_subject'] = '';
56 }
57
58
59 return $replacements;
60 }
61
62
63
64
65
66 /**
67 * Default invitation message
68 */
69 function rsvp_mailer_invitation_default() {
70 $subject = "[@site] Invitation - @invitation_subject";
71 $message = <<<MESSAGE
72 Dear @guest_name,
73
74 You have been invited by @sender_name at @site.
75
76 You can view the full invitation, reply if you want to join or not,
77 and add a comment by following this link:
78 @invitation_link
79
80 You can view the event by following this link:
81 @event_link
82
83 You also can visit the invitation by going to 'My account|Invitations'
84
85 Please do not reply to this email.
86
87 Regards,
88 @sender_name
89
90 ***************************************************
91 @message_body
92 MESSAGE;
93
94 return array(
95 'subject' => $subject,
96 'message' => $message,
97 );
98 }
99
100
101 /**
102 * Default message_guest message
103 */
104 function rsvp_mailer_message_guest_default() {
105 $subject = "[@site] Invitation - @invitation_subject";
106 $message = <<<MESSAGE
107 Dear @guest_name,
108
109 @sender_name at @site has sent you a message.
110
111 You can view the full invitation, reply if you want to join or not,
112 and add a comment by following this link:
113 @invitation_link
114
115 You can view the event by following this link:
116 @event_link
117
118 You also can visit the invitation by going to 'My account|Invitations'
119
120 Please do not reply to this email.
121
122 Regards,
123 @sender_name
124
125 ***************************************************
126 @message_body
127 MESSAGE;
128
129 return array(
130 'subject' => $subject,
131 'message' => $message,
132 );
133 }
134
135
136 /**
137 * Default notification_guest message
138 */
139 function rsvp_mailer_notification_guest_default() {
140 $subject = "[@site] Invitation - @invitation_subject";
141 $message = <<<MESSAGE
142 Dear @guest_name,
143
144 This email is a confirmation that you have changed your response for this invitation.
145
146 You can view the full invitation, reply if you want to join or not,
147 and add a comment by following this link:
148 @invitation_link
149
150 You can view the event by following this link:
151 @event_link
152
153 You also can visit the invitation by going to 'My account|Invitations'
154
155 Please do not reply to this email.
156
157 Regards,
158 The @site team
159
160 ***************************************************
161 @message_body
162 MESSAGE;
163
164 return array(
165 'subject' => $subject,
166 'message' => $message,
167 );
168 }
169
170
171 /**
172 * Default notification_moderator message
173 */
174 function rsvp_mailer_notification_moderator_default() {
175 $subject = "[@site] Invitation - @invitation_subject";
176 $message = <<<MESSAGE
177 Dear Moderator,
178
179 This email is a confirmation that @guest_name at site @site has changed his response for this invitation.
180
181 You can view the full invitation, reply if you want to join or not,
182 and add a comment by following this link:
183 @invitation_link
184
185 You can view the event by following this link:
186 @event_link
187
188 You also can visit the invitation by going to 'My account|Invitations'
189
190 Please do not reply to this email.
191
192 Regards,
193 The @site team
194
195 ***************************************************
196 @message,_body
197 MESSAGE;
198
199 return array(
200 'subject' => $subject,
201 'message' => $message,
202 );
203 }
204
205 /**
206 * Default cancel request message
207 */
208 function rsvp_mailer_invitation_cancel_default() {
209 $subject = "[@site] Invitation - @invitation_subject";
210 $message = <<<MESSAGE
211 Dear @guest_name,
212
213 @owner_name has canceled his invitation.
214
215 Regards,
216 @sender_name
217
218 MESSAGE;
219
220 return array(
221 'subject' => $subject,
222 'message' => $message,
223 );
224 }
225

  ViewVC Help
Powered by ViewVC 1.1.2