Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Runs the functions that saves the form to the database then emails out
- function ProcessForm($data, $form) {
- $this->SaveForm($data, $form);
- $this->EmailForm($submission);
- }
- // Saves form data to database
- function SaveForm($data, $form) {
- $submission = DataObject::get_by_id('CV', $data['ID']);
- $form->saveInto($submission);
- $submission->Completed = true;
- $submission->write();
- return $submission;
- }
- // Emails the form to the site administrator defined in mysite/_config.php
- function EmailForm($submission) {
- // get the actual value of the submission option from the array not the safe version.
- $data['Date'] = date("F j, Y, g:i a");
- $email = new Email_Template();
- $email->ss_template = 'CVSubmission_Email';
- $email->populateTemplate($submission);
- $email->subject = 'CVSubmission Form Enquiry';
- $email->from = "cvsubmissions@kpsolutions.co.nz";
- $email->to = Email::getAdminEmail();
- $email->send();
- return Director::redirect("thanks");
- }
- function thanks() {
- return array(
- 'Title' => "CV Submission Successful",
- 'Content' => "<p>Thanks! Your CV has been sent to our team.</p>",
- 'Form' => ""
- );
- }
Add Comment
Please, Sign In to add comment