Guest User

Untitled

a guest
May 23rd, 2018
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. <?php
  2.  
  3. class BoardOrderMultiForm extends MultiForm {
  4.  
  5. protected static $start_step = 'BoardOrderAcceptTermsStep';
  6.  
  7. public function finish($data, $form) {
  8. parent::finish($data, $form);
  9.  
  10. $body = "<h1>Online Order</h1>";
  11.  
  12. $steps = DataObject::get('MultiFormStep', "SessionID = {$this->session->ID}");
  13. if($steps) {
  14. foreach($steps as $step) {
  15.  
  16. $data = $step->loadData();
  17.  
  18. if($step->class == 'BoardOrderAcceptTermsStep') {
  19. $data = $step->loadData();
  20. if($data) {
  21.  
  22. }
  23. }
  24.  
  25. if($step->class == 'BoardOrderShaping1Step') {
  26. $data = $step->loadData();
  27. if($data) {
  28. $basic_type = $data['basic_type'];
  29. $body .= "<h2>Shaping 1</h2>";
  30. $body .= "<table style=\"width:500px;\"><tr>";
  31. $body .= "<th>Basic type</th><td>" . $data['basic_type'] . "</td>";
  32. $body .= "</tr><tr>";
  33. $body .= "<th>Length</th><td>" . $data['length'] . "</td>";
  34. $body .= "</tr><tr>";
  35. $body .= "<th>Width</th><td>" . $data['width'] . "</td>";
  36. $body .= "</tr><tr>";
  37. $body .= "<th>Thickness</th><td>" . $data['thickness'] . "</td>";
  38. $body .= "</tr></table>";
  39. }
  40. }
  41.  
  42. if($step->class == 'BoardOrderShaping2Step') {
  43. $data = $step->loadData();
  44. if($data) {
  45. $body .= "<h2>Shaping 2</h2>";
  46. $body .= "<table><tr>";
  47. $body .= "<th>Rails type</th><td>" . $data['rails_type'] . "</td>";
  48. $body .= "</tr><tr>";
  49. $body .= "<th>Bottom shape</th><td>" . $data['bottom_shape'] . "</td>";
  50. $body .= "</tr><tr>";
  51. $body .= "<th>Bottom shape (other)</th><td>" . $data['bottom_shape_other'] . "</td>";
  52. $body .= "</tr><tr>";
  53. $body .= "<th>Tail shape</th><td>" . $data['tail_shape'] . "</td>";
  54. $body .= "</tr><tr>";
  55. $body .= "<th>Tail shape (other)</th><td>" . $data['tail_shape_other'] . "</td>";
  56. $body .= "</tr><tr>";
  57. $body .= "</dl>";
  58. }
  59. }
  60.  
  61. if($step->class == 'BoardOrderGlassingStep') {
  62. $data = $step->loadData();
  63. if($data) {
  64. $spray = $data['spray'];
  65. $spray_file = $spray['tmp_name'];
  66. Debug::show($spray_file);
  67. }
  68. }
  69.  
  70. if($step->class == 'BoardOrderFinal') {
  71. $data = $step->loadData();
  72. if($data) {
  73.  
  74. }
  75. }
  76.  
  77. Debug::show($step->loadData()); // Shows the step data (unserialized by loadData)
  78. }
  79. }
  80.  
  81. // Get email address from page or send to admin
  82. $sendto = ($this->ContactEmail!='' ? $this->ContactEmail : Email::getAdminEmail());
  83.  
  84. // Send email to Item Contact
  85. $email = new Email('blah@gmail.com', 'blah@gmail.com', "Website Order: " . $basic_type, $body);
  86. $email->attachFile($spray_file);
  87. $email->send();
  88.  
  89. //Director::redirect("orders");
  90.  
  91. //$response = array("Success" => "Success");
  92.  
  93. // Send email to User who enquired
  94. //$email = new Email('blah@gmail.com', $data['email'], 'Receipt of website enquiry from Chapman Surfboards: '.$data['Title'], "Thankyou for your enquiry.\n\n".$body);
  95. //$email->sendPlain();
  96.  
  97. //$this->customise($response)->renderWith(array('Page', 'Page'));
  98.  
  99. }
  100.  
  101. }
  102.  
  103. ?>
Add Comment
Please, Sign In to add comment