Index: modules/signup/signup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.module,v
retrieving revision 1.45.2.41
diff -u -p -r1.45.2.41 signup.module
--- modules/signup/signup.module 26 Mar 2007 16:01:39 -0000 1.45.2.41
+++ modules/signup/signup.module 28 Mar 2007 05:50:57 -0000
@@ -517,9 +517,7 @@ function signup_nodeapi(&$node, $op, $te
$header = array(array('data' => t('Your signup information'), 'colspan' => 2));
$rows = array();
if(is_array($form_data)) {
- foreach ($form_data as $key => $value) {
- $rows[] = array($key . ':', check_plain($value));
- }
+ $rows += signup_build_signup_data($form_data, 'table');
}
$form['nid'] = array('#type' => 'value', '#value' => $node->nid);
$form['uid'] = array('#type' => 'value', '#value' => $user->uid);
@@ -932,10 +930,8 @@ function signup_sign_up_user($signup_for
$starttime = $node->event_start ? _event_date(variable_get('signup_date_string', 'D, M jS, g:i A'), $node->event_start, $offset) : t('[Untimed]');
$signup_data_array = array();
if (isset($signup_form['signup_form_data'])) {
- foreach ($signup_form['signup_form_data'] as $key => $value) {
- $signup_data_array[] = $key . ': ' . $value;
- }
- $signup_data = t('SIGNUP INFORMATION') . "\n\r\n\r" . implode("\n\r", $signup_data_array);
+ $signup_form_data = signup_build_signup_data($signup_form['signup_form_data'], 'email');
+ $signup_data = t('SIGNUP INFORMATION') . "\n\r\n\r" . $signup_form_data;
}
// Determine if this is an anon signup or not, and get the
// appropriate email address to use.
@@ -1038,9 +1034,7 @@ function signup_user_signups_form($node)
$form_data = unserialize($signed_up_user->form_data);
// Compose the user data.
- foreach ($form_data as $key => $value) {
- $table_data[] = $key . ': ' . check_plain($value);
- }
+ $signup_form_data = signup_build_signup_data($form_data);
$form = array();
$form['nid'] = array('#type' => 'value', '#value' => $node->nid);
@@ -1071,7 +1065,7 @@ function signup_user_signups_form($node)
// Build the row for this user.
$rows[] = array(
$username .'
'. gmdate(variable_get('signup_date_string', 'M jS, g:i A'), $signed_up_user->signup_time + $offset),
- implode('
', $table_data),
+ $signup_form_data,
drupal_get_form('signup_user_signups_form_'. $id, $form, 'signup_form_cancel'),
);
}
@@ -1195,3 +1189,57 @@ function _signup_admin_form($node) {
return $form;
}
+
+/**
+ * Builds serialized user signup data into user-readable format.
+ *
+ * @param $data The serialized user signup data.
+ * @param $type The type of formatting -- defaults to 'output'.
+ *
+ * @return For table formatting, an array of table rows, for output formatting, raw user data in divs.
+ */
+function signup_build_signup_data($data, $type = 'output') {
+
+ switch ($type) {
+ case 'table':
+ static $rows = array();
+ // Loop through each first level element.
+ foreach ($data as $key => $value) {
+ // Element is nested, render it recursively.
+ if (is_array($value)) {
+ $rows[] = array('