public static function mail($id)
 {
     $tpl = new PSUTemplate();
     $f = PSU::db('myplymouth')->GetRow("SELECT * FROM woodwindday WHERE id_ = ?", array($id));
     $form = new WoodwindApply($f, true);
     $form->readonly(true);
     $tpl->assign('form', $form);
     $message = $tpl->fetch('email.tpl');
     $to = array('*****@*****.**');
     $subject = sprintf("[PSU Woodwind Day 2011] Registration for %s %s", $form->first_name->value(), $form->last_name->value());
     PSU::mail($to, $subject, $message, 'Content-Type: text/html');
 }
 public function _submit()
 {
     $f = $_POST;
     $app = new WoodwindApply($f);
     list($required, $filled, $percent) = $app->progress();
     $_SESSION['woodwind-day']['f'] = $app->form();
     if ($percent < 1) {
         $_SESSION['errors'][] = 'Please fill in all required fields.';
         PSU::redirect($GLOBALS['BASE_URL'] . '/register');
     }
     if ($id = $app->save()) {
         WoodwindAPI::mail($id);
     } else {
         $_SESSION['errors'][] = 'There was an error saving your submission data.';
         PSU::redirect($GLOBALS['BASE_URL'] . '/register');
     }
     PSU::redirect($GLOBALS['BASE_URL'] . '/thank-you');
 }