/[drupal]/contributions/modules/signup/theme/email.inc
ViewVC logotype

Contents of /contributions/modules/signup/theme/email.inc

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


Revision 1.2 - (show annotations) (download) (as text)
Wed Jan 7 00:55:00 2009 UTC (10 months, 3 weeks ago) by dww
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +25 -2 lines
File MIME type: text/x-php
#181272 by dww: Fixed bug where the labels on the custom signup form
fields were not properly translatable when this data was displayed in
other places (when viewing your own signup info, etc).
1 <?php
2 // $Id: email.inc,v 1.1 2008/11/12 23:22:19 dww Exp $
3
4
5 /**
6 * @file
7 * Theme functions for generating signup email messages.
8 */
9
10 /**
11 * Return the value for the %user_signup_info email token for custom signup data.
12 *
13 * @param $signup_data
14 * Array of custom data for a particular signup.
15 *
16 * @see theme_signup_user_form()
17 * @see theme_signup_custom_data_email()
18 */
19 function theme_signup_email_token_custom_data($signup_data) {
20 return t('SIGNUP INFORMATION') ."\n\r". theme('signup_custom_data_email', $signup_data);
21 }
22
23 /**
24 * Renders custom signup data into unfiltered output for use in email.
25 *
26 * WARNING: This theme function is recursive (it calls itself for
27 * nested data), so if you override it, be sure not to change the part
28 * where it does "call_user_func(__FUNCTION__)".
29 *
30 * @param $data
31 * Array of custom user signup data.
32 *
33 * @return
34 * Plain text output with newlines.
35 *
36 * @see theme_signup_user_form()
37 */
38 function theme_signup_custom_data_email($data) {
39 $output = '';
40 // Loop through each first level element.
41 foreach ($data as $key => $value) {
42 if (is_array($value)) {
43 // Element is nested, render it recursively.
44 // Instead of the overhead of theme(), just call ourself directly.
45 $output .= "\n\r". call_user_func(__FUNCTION__, $value) ."\n\r";
46 }
47 else {
48 $output .= theme('signup_custom_data_field_text', $key, $value) ."\n\r";
49 }
50 }
51 return $output;
52 }
53
54 /**
55 * Renders a single custom signup form field into unfiltered output.
56 *
57 * @param $key
58 * Name of the custom signup field (the array key).
59 * @param $value
60 * Value of the custom signup field (the array value).
61 *
62 * @return
63 * Plain text output to display this key/value pair.
64 *
65 * @see theme_signup_user_form()
66 */
67 function theme_signup_custom_data_field_text($key, $value) {
68 // All of the possible array key values should already be translated as
69 // string literals in theme_signup_user_form() via the #title attributes, so
70 // passing a variable to t() is actually safe here. However, to avoid
71 // warnings when extracting strings, "hide" the call to t() by using a
72 // variable to hold the function name.
73 $tr = 't';
74 return $tr($key) .': '. $value;
75 }
76
77 /**
78 * Controls the body of the copy of the broadcast message sent to the sender.
79 *
80 * @param $raw_message
81 * The raw message typed in by the sender with no tokens replaced.
82 * @param $cooked_message
83 * The message after all the tokens have been replaced.
84 *
85 * @return
86 * The final text to put in the email body sent to the broadcast sender.
87 */
88 function theme_signup_broadcast_sender_copy($raw_message, $cooked_message) {
89 $output = t('This is a copy of the signup broadcast you just sent.') ."\n";
90 $output .= wordwrap(t('Here is the original text you entered, with none of the tokens replaced:'), 72) ."\n";
91 $output .= "----------\n";
92 $output .= $raw_message;
93 $output .= "\n----------\n\n";
94 $output .= wordwrap(t('Here is how the message that was sent to each user looked, with all of the tokens replaced (using your account for the user-related tokens):'), 72) ."\n";
95 $output .= "----------\n";
96 $output .= $cooked_message;
97 $output .= "\n----------\n\n";
98 return $output;
99 }
100

  ViewVC Help
Powered by ViewVC 1.1.2