Guest User

Untitled

a guest
May 24th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. // Runs the functions that saves the form to the database then emails out
  2. function ProcessForm($data, $form) {
  3. $this->SaveForm($data, $form);
  4. $this->EmailForm($submission);
  5. }
  6.  
  7. // Saves form data to database
  8. function SaveForm($data, $form) {
  9. $submission = DataObject::get_by_id('CV', $data['ID']);
  10. $form->saveInto($submission);
  11. $submission->Completed = true;
  12. $submission->write();
  13. return $submission;
  14. }
  15.  
  16. // Emails the form to the site administrator defined in mysite/_config.php
  17. function EmailForm($submission) {
  18. // get the actual value of the submission option from the array not the safe version.
  19. $data['Date'] = date("F j, Y, g:i a");
  20. $email = new Email_Template();
  21. $email->ss_template = 'CVSubmission_Email';
  22. $email->populateTemplate($submission);
  23. $email->subject = 'CVSubmission Form Enquiry';
  24. $email->from = "cvsubmissions@kpsolutions.co.nz";
  25. $email->to = Email::getAdminEmail();
  26. $email->send();
  27. return Director::redirect("thanks");
  28. }
  29. function thanks() {
  30. return array(
  31. 'Title' => "CV Submission Successful",
  32. 'Content' => "<p>Thanks! Your CV has been sent to our team.</p>",
  33. 'Form' => ""
  34. );
  35. }
Add Comment
Please, Sign In to add comment