Guest User

Untitled

a guest
Jun 22nd, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.41 KB | None | 0 0
  1. <?php
  2.  
  3. class V8ApplicationFormPage extends Page {
  4. static $db = array(
  5. );
  6. static $has_one = array(
  7. );
  8.  
  9.  
  10.  
  11. }
  12.  
  13. class V8ApplicationFormPage_Controller extends Page_Controller {
  14. function V8ApplicationForm() {
  15. // Create cities
  16.  
  17. $cities = array(
  18. 'Auckland' => 'Auckland - Venue TBC',
  19. 'Tauranga' => 'Tauranga - Venue TBC',
  20. 'Hamilton' => 'Hamilton - Venue TBC',
  21. 'Taupo' => 'Taupo - Venue TBC',
  22. 'Palmerston North' => 'Palmerston North - Venue TBC',
  23. 'Wellington' => 'Wellington - The Establishment',
  24. 'Nelson' => 'Nelson - Venue TBC',
  25. 'Christchurch' => 'Christchurch - Venue TBC',
  26. 'Dunedin' => 'Dunedin - Venue TBC'
  27. );
  28. $wellington = array(
  29. 'HeatOne' => 'Heat One - Wed 15th July 2009',
  30. 'HeatTwo' => 'Heat Two - Fri 17th July 2009'
  31. );
  32.  
  33. // Create fields
  34.  
  35.  
  36. $fields = new FieldSet(
  37. new HeaderField ($title = "Personal Details",$headingLevel = "2"),
  38. new DropdownField('City','City you are entering in',$cities),
  39. new DropdownField('Wellington','Wellington Heat Dates',$wellington),
  40. new TextField('FirstName', 'First Name'),
  41. new TextField('LastName', 'Last Name'),
  42. new TextField('Address', 'Address'),
  43. new TextField('TownCity', 'Town/City'),
  44. new PhoneNumberField('HomePhoneNumber', 'Home Number'),
  45. new PhoneNumberField('WorkPhoneNumber', 'Work Number'),
  46. new PhoneNumberField('CellPhoneNumber', 'Cell Number'),
  47. new TextField('EmailField', 'Email Address'),
  48. new TextField('Occupation', 'Occupation'),
  49. new TextField('Nationality', 'Nationality'),
  50. new NumericField ('Age', 'Age'),
  51. new DateField('Birthday','Birthday date'),
  52. new TextField('StarSign', 'Star Sign'),
  53.  
  54. new HeaderField ('Measurements','2'),
  55. new TextField('Height', 'Height'),
  56. new TextField('TopSize', 'Top Size'),
  57. new TextField('PantsSize', 'Pants Size'),
  58. new TextField('ShoesSize', 'Shoes Size'),
  59. new TextField('EyeColour', 'Eye Colour'),
  60. new TextField('Hair', 'Hair'),
  61.  
  62. new HeaderField ('Questions','2'),
  63. new TextareaField(
  64. $name = "TwoInterestingThings",
  65. $title = "List the 2 most interesting things about yourself, or things you've done",
  66. $rows = 4,
  67. $cols = 3
  68. ),
  69. new TextareaField(
  70. $name = "JoborStudy",
  71. $title = "Tell us more about your job, or what you are studying",
  72. $rows = 4,
  73. $cols = 3
  74. ),
  75. new TextareaField(
  76. $name = "Sports",
  77. $title = "Tell us your favorite sports",
  78. $rows = 4,
  79. $cols = 3
  80. ),
  81. new TextareaField(
  82. $name = "Admire",
  83. $title = "Who do you admire, and why?",
  84. $rows = 4,
  85. $cols = 3
  86. ),
  87. new TextareaField(
  88. $name = "WhyEnter",
  89. $title = "Why are you entering the Miss V8 Supermodel Search?",
  90. $rows = 4,
  91. $cols = 3
  92. ),
  93. new TextareaField(
  94. $name = "PreviousExperience",
  95. $title = "If you have any previous modeling/promotional experience please list them below",
  96. $rows = 4,
  97. $cols = 3
  98. ),
  99. new TextareaField(
  100. $name = "HowHear",
  101. $title = "How did you hear about the Miss V8 Supermodel Search?",
  102. $rows = 4,
  103. $cols = 3
  104. ),
  105. new HeaderField ('Photos','2'),
  106. new SimpleImageField ('ImageOne', 'Please upload a headshot photo',null,null,null, "MissV8"),
  107. new SimpleImageField ('ImageTwo', 'Please upload a full body photo'),
  108. new SimpleImageField ('ImageThree', 'Please upload a third image if you want'),
  109. new HeaderField ('Please click submit once and wait 1-2 minutes for your photos to upload. There will be a confirmation message if this form is successfully submitted','2')
  110.  
  111.  
  112. );
  113.  
  114. // Create actions
  115. $actions = new FieldSet(
  116. new FormAction('doV8ApplicationForm', 'Submit')
  117. );
  118. $validator = new RequiredFields('FirstName', 'EmailField', 'City', 'ImageOne');
  119. return new Form($this, 'V8ApplicationForm', $fields, $actions, $validator);
  120. }
  121.  
  122. function doV8ApplicationForm($data, $form) {
  123.  
  124.  
  125. $submission = new V8ApplicationFormPage_Submission();
  126. $form->saveInto($submission);
  127. $submission->write();
  128.  
  129. $City = $data['City'];
  130. $Wellington = $data['Wellington'];
  131. $FirstName = $data['FirstName'];
  132. $LastName = $data['LastName'];
  133. $Address = $data['Address'];
  134. $TownCity = $data['TownCity'];
  135. $HomePhoneNumber = $data['HomePhoneNumber'];
  136. $WorkPhoneNumber = $data['WorkPhoneNumber'];
  137. $CellPhoneNumber = $data['CellPhoneNumber'];
  138. $EmailField = $data['EmailField'];
  139. $Occupation = $data['Occupation'];
  140. $Nationality = $data['Nationality'];
  141. $Age = $data['Age'];
  142. $Birthday = $data['Birthday'];
  143. $StarSign = $data['StarSign'];
  144. $Height = $data['Height'];
  145. $TopSize = $data['TopSize'];
  146. $PantsSize = $data['PantsSize'];
  147. $ShoesSize = $data['ShoesSize'];
  148. $EyeColour = $data['EyeColour'];
  149. $Hair = $data['Hair'];
  150. $TwoInterestingThings = $data['TwoInterestingThings'];
  151. $JoborStudy = $data['JoborStudy'];
  152. $Sports = $data['Sports'];
  153. $Admire = $data['Admire'];
  154. $WhyEnter = $data['WhyEnter'];
  155. $PreviousExperience = $data['PreviousExperience'];
  156. $HowHear = $data['HowHear'];
  157. $ImageOne = $data['ImageOne'];
  158. $ImageTwo = $data['ImageTwo'];
  159. $ImageThree = $data['ImageThree'];
  160.  
  161. $body = "Hi,<br />We have received a new application for the Miss V8 Supermodel Search for <b>$City $Wellington $Auckland</b>. Please look at the entrants details below, and contact them directly.<br /><br /><b>Name</b>: $FirstName $LastName<br /><b>Address</b>: $Address $TownCity<br /><b>Phone Numbers</b>: (H) $HomePhoneNumber (W) $WorkPhoneNumber (M) $CellPhoneNumber<br /><b>Email Address</b>: $EmailField<br /><b>Occupation</b>: $Occupation<br /><b>Nationality</b>: $Nationality<br /><b>D.O.B.</b>: $Birthday (Age: $Age)<br /><b>Starsign</b>: $StarSign<br /><br /><b>Measurements</b><br /><b>Height</b>: $Height<br /><b>Top Size</b>: $TopSize<br /><b>Pants Size</b>: $PantsSize<br /><b>Shoe Size</b>: $ShoesSize<br /><b>Eye Colour</b>: $EyeColour<br /><b>Hair</b>: $Hair<br /><br /><b>Questions</b><br /><b>List the 2 most interesting things about yourself, or things you've done</b>: $TwoInterestingThings<br /><b>Tell us more about your job, or what you are studying</b>: $JoborStudy<br /><b>Tell us your favorite sports</b>: $Sports<br /><b>Who do you admire, and why?</b>: $Admire<br /><b>Why are you entering the Miss V8 Supermodel Search?</b>: $WhyEnter<br /><b>If you have any previous modeling/promotional experience please list them below</b>: $PreviousExperience<br /><b>
  162. How did you hear about the Miss V8 Supermodel Search?</b>: $HowHear<br /><br />";
  163. $email = new Email($data['EmailField'], 'missv8@bradydyer.com', "New Miss V8 Application", $body);
  164. $email->attachFile($ImageOne->URL());
  165. $email->ss_template = 'BradyDyerEmail';
  166. $email->send();
  167.  
  168. Director::redirect('miss-v8-application-form-successfully-submitted/');
  169. }
  170.  
  171.  
  172. }
  173.  
  174. class V8ApplicationFormPage_Submission extends DataObject {
  175. static $has_one = array(
  176. 'ImageOne' => 'Image',
  177. 'ImageTwo' => 'Image',
  178. 'ImageThree' => 'Image'
  179. );
  180. static $db = array(
  181. 'City' => 'Varchar',
  182. 'Wellington' => 'Varchar',
  183. 'FirstName' => 'Varchar',
  184. 'LastName' => 'Varchar',
  185. 'Address' => 'Varchar',
  186. 'TownCity' => 'Varchar',
  187. 'HomePhoneNumber' => 'Varchar',
  188. 'WorkPhoneNumber' => 'Varchar',
  189. 'CellPhoneNumber' => 'Varchar',
  190. 'EmailField' => 'Varchar',
  191. 'Occupation' => 'Varchar',
  192. 'Nationality' => 'Varchar',
  193. 'Age' => 'Int',
  194. 'Birthday' => 'Date',
  195. 'StarSign' => 'Varchar',
  196. 'Height' => 'Varchar',
  197. 'TopSize' => 'Varchar',
  198. 'PantsSize' => 'Varchar',
  199. 'ShoesSize' => 'Varchar',
  200. 'EyeColour' => 'Varchar',
  201. 'Hair' => 'Varchar',
  202. 'TwoInterestingThings' => 'Varchar',
  203. 'JoborStudy' => 'Varchar',
  204. 'Sports' => 'Varchar',
  205. 'Admire' => 'Varchar',
  206. 'WhyEnter' => 'Varchar',
  207. 'PreviousExperience' => 'Varchar',
  208. 'HowHear' => 'Varchar'
  209. );
  210. }
  211.  
  212.  
  213. ?>
Add Comment
Please, Sign In to add comment