Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class V8ApplicationFormPage extends Page {
- static $db = array(
- );
- static $has_one = array(
- );
- }
- class V8ApplicationFormPage_Controller extends Page_Controller {
- function V8ApplicationForm() {
- // Create cities
- $cities = array(
- 'Auckland' => 'Auckland - Venue TBC',
- 'Tauranga' => 'Tauranga - Venue TBC',
- 'Hamilton' => 'Hamilton - Venue TBC',
- 'Taupo' => 'Taupo - Venue TBC',
- 'Palmerston North' => 'Palmerston North - Venue TBC',
- 'Wellington' => 'Wellington - The Establishment',
- 'Nelson' => 'Nelson - Venue TBC',
- 'Christchurch' => 'Christchurch - Venue TBC',
- 'Dunedin' => 'Dunedin - Venue TBC'
- );
- $wellington = array(
- 'HeatOne' => 'Heat One - Wed 15th July 2009',
- 'HeatTwo' => 'Heat Two - Fri 17th July 2009'
- );
- // Create fields
- $fields = new FieldSet(
- new HeaderField ($title = "Personal Details",$headingLevel = "2"),
- new DropdownField('City','City you are entering in',$cities),
- new DropdownField('Wellington','Wellington Heat Dates',$wellington),
- new TextField('FirstName', 'First Name'),
- new TextField('LastName', 'Last Name'),
- new TextField('Address', 'Address'),
- new TextField('TownCity', 'Town/City'),
- new PhoneNumberField('HomePhoneNumber', 'Home Number'),
- new PhoneNumberField('WorkPhoneNumber', 'Work Number'),
- new PhoneNumberField('CellPhoneNumber', 'Cell Number'),
- new TextField('EmailField', 'Email Address'),
- new TextField('Occupation', 'Occupation'),
- new TextField('Nationality', 'Nationality'),
- new NumericField ('Age', 'Age'),
- new DateField('Birthday','Birthday date'),
- new TextField('StarSign', 'Star Sign'),
- new HeaderField ('Measurements','2'),
- new TextField('Height', 'Height'),
- new TextField('TopSize', 'Top Size'),
- new TextField('PantsSize', 'Pants Size'),
- new TextField('ShoesSize', 'Shoes Size'),
- new TextField('EyeColour', 'Eye Colour'),
- new TextField('Hair', 'Hair'),
- new HeaderField ('Questions','2'),
- new TextareaField(
- $name = "TwoInterestingThings",
- $title = "List the 2 most interesting things about yourself, or things you've done",
- $rows = 4,
- $cols = 3
- ),
- new TextareaField(
- $name = "JoborStudy",
- $title = "Tell us more about your job, or what you are studying",
- $rows = 4,
- $cols = 3
- ),
- new TextareaField(
- $name = "Sports",
- $title = "Tell us your favorite sports",
- $rows = 4,
- $cols = 3
- ),
- new TextareaField(
- $name = "Admire",
- $title = "Who do you admire, and why?",
- $rows = 4,
- $cols = 3
- ),
- new TextareaField(
- $name = "WhyEnter",
- $title = "Why are you entering the Miss V8 Supermodel Search?",
- $rows = 4,
- $cols = 3
- ),
- new TextareaField(
- $name = "PreviousExperience",
- $title = "If you have any previous modeling/promotional experience please list them below",
- $rows = 4,
- $cols = 3
- ),
- new TextareaField(
- $name = "HowHear",
- $title = "How did you hear about the Miss V8 Supermodel Search?",
- $rows = 4,
- $cols = 3
- ),
- new HeaderField ('Photos','2'),
- new SimpleImageField ('ImageOne', 'Please upload a headshot photo',null,null,null, "MissV8"),
- new SimpleImageField ('ImageTwo', 'Please upload a full body photo'),
- new SimpleImageField ('ImageThree', 'Please upload a third image if you want'),
- 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')
- );
- // Create actions
- $actions = new FieldSet(
- new FormAction('doV8ApplicationForm', 'Submit')
- );
- $validator = new RequiredFields('FirstName', 'EmailField', 'City', 'ImageOne');
- return new Form($this, 'V8ApplicationForm', $fields, $actions, $validator);
- }
- function doV8ApplicationForm($data, $form) {
- $submission = new V8ApplicationFormPage_Submission();
- $form->saveInto($submission);
- $submission->write();
- $City = $data['City'];
- $Wellington = $data['Wellington'];
- $FirstName = $data['FirstName'];
- $LastName = $data['LastName'];
- $Address = $data['Address'];
- $TownCity = $data['TownCity'];
- $HomePhoneNumber = $data['HomePhoneNumber'];
- $WorkPhoneNumber = $data['WorkPhoneNumber'];
- $CellPhoneNumber = $data['CellPhoneNumber'];
- $EmailField = $data['EmailField'];
- $Occupation = $data['Occupation'];
- $Nationality = $data['Nationality'];
- $Age = $data['Age'];
- $Birthday = $data['Birthday'];
- $StarSign = $data['StarSign'];
- $Height = $data['Height'];
- $TopSize = $data['TopSize'];
- $PantsSize = $data['PantsSize'];
- $ShoesSize = $data['ShoesSize'];
- $EyeColour = $data['EyeColour'];
- $Hair = $data['Hair'];
- $TwoInterestingThings = $data['TwoInterestingThings'];
- $JoborStudy = $data['JoborStudy'];
- $Sports = $data['Sports'];
- $Admire = $data['Admire'];
- $WhyEnter = $data['WhyEnter'];
- $PreviousExperience = $data['PreviousExperience'];
- $HowHear = $data['HowHear'];
- $ImageOne = $data['ImageOne'];
- $ImageTwo = $data['ImageTwo'];
- $ImageThree = $data['ImageThree'];
- $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>
- How did you hear about the Miss V8 Supermodel Search?</b>: $HowHear<br /><br />";
- $email = new Email($data['EmailField'], 'missv8@bradydyer.com', "New Miss V8 Application", $body);
- $email->attachFile($ImageOne->URL());
- $email->ss_template = 'BradyDyerEmail';
- $email->send();
- Director::redirect('miss-v8-application-form-successfully-submitted/');
- }
- }
- class V8ApplicationFormPage_Submission extends DataObject {
- static $has_one = array(
- 'ImageOne' => 'Image',
- 'ImageTwo' => 'Image',
- 'ImageThree' => 'Image'
- );
- static $db = array(
- 'City' => 'Varchar',
- 'Wellington' => 'Varchar',
- 'FirstName' => 'Varchar',
- 'LastName' => 'Varchar',
- 'Address' => 'Varchar',
- 'TownCity' => 'Varchar',
- 'HomePhoneNumber' => 'Varchar',
- 'WorkPhoneNumber' => 'Varchar',
- 'CellPhoneNumber' => 'Varchar',
- 'EmailField' => 'Varchar',
- 'Occupation' => 'Varchar',
- 'Nationality' => 'Varchar',
- 'Age' => 'Int',
- 'Birthday' => 'Date',
- 'StarSign' => 'Varchar',
- 'Height' => 'Varchar',
- 'TopSize' => 'Varchar',
- 'PantsSize' => 'Varchar',
- 'ShoesSize' => 'Varchar',
- 'EyeColour' => 'Varchar',
- 'Hair' => 'Varchar',
- 'TwoInterestingThings' => 'Varchar',
- 'JoborStudy' => 'Varchar',
- 'Sports' => 'Varchar',
- 'Admire' => 'Varchar',
- 'WhyEnter' => 'Varchar',
- 'PreviousExperience' => 'Varchar',
- 'HowHear' => 'Varchar'
- );
- }
- ?>
Add Comment
Please, Sign In to add comment