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