You are here

signup.theme in Signup 5

File

signup.theme
View source
<?php

/**
 * Format a user signup for display in a schedule list.
 *
 * @param node
 *   The node which needs theming
 */
function theme_signup_user_schedule($node) {
  $output = '';
  $output .= '<div class="signup-user-schedule"><div class="' . $node->type . 'signup-title"><h4>' . l($node->title, "node/{$node->nid}") . '</h4></div></div>';

  // event-based data, only if it's an event node
  if (isset($node->event_start)) {
    $output .= '<div class="signup-user-schedule"><div class="' . $node->type . 'signup-start"><label>' . t('Start: ') . '</label>' . $node->start_format . '</div></div>';
    if ($node->event_start != $node->event_end) {
      $output .= '<div class="signup-user-schedule"><div class="' . $node->type . 'signup-end"><label>' . t('End: ') . '</label>' . $node->end_format . '</div></div>';
    }
    if (variable_get('configurable_timezones', 1)) {
      $zones = event_zonelist();
      $output .= '<div class="signup-user-schedule"><div class="' . $node->type . 'signup-tz"><label>' . t('Timezone: ') . '</label>' . $zones[$node->timezone] . '</div></div>';
    }
  }
  else {
    $output .= '<div class="signup-user-schedule"><div class="' . $node->type . 'signup-untimed">' . t('[Untimed]') . '</div></div>';
  }
  return $output;
}

/**
 * Return the site-specific custom fields for the signup user form.
 *
 * To customize this for your site, copy this entire function into
 * your theme's template.php file, rename the function to
 * phptemplate_signup_user_form(), and modify to taste.  Feel free to
 * alter any elements in this section, remove them, or add any others.
 *
 * In order for the form to be rendered properly, the name of the form
 * element must be $form['signup_form_data']['NameOfDataField'], where
 * NameOfDataField is replaced with the actual name of the data field.
 * We suggest that the displayed name of the field (the '#title'
 * property) be the same as the name of the data field, but it's not
 * required.  See below for examples.
 *
 * Fieldsets are not currently supported in this form.  Any
 * '#default_value' will be filled in by default when the form is
 * presented to the user.  Any field marked '#required' must be filled
 * in before the user can sign up.
 *
 * If you do not want any additional fields, the function can simply
 * return an empty array: "return array();"
 *
 * @return
 *   Array defining the form to present to the user to signup for a node.
 */
function theme_signup_user_form() {
  global $user;
  $form = array();

  // If this function is providing any extra fields at all, the following
  // line is required for form form to work -- DO NOT EDIT OR REMOVE.
  $form['signup_form_data']['#tree'] = TRUE;
  $form['signup_form_data']['Name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#size' => 40,
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['signup_form_data']['Phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone'),
    '#size' => 40,
    '#maxlength' => 64,
  );

  // If the user is logged in, fill in their name by default.
  if ($user->uid) {
    $form['signup_form_data']['Name']['#default_value'] = $user->name;
  }
  return $form;
}

Functions

Namesort descending Description
theme_signup_user_form Return the site-specific custom fields for the signup user form.
theme_signup_user_schedule Format a user signup for display in a schedule list.