Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Client extends DataObjectDecorator{
- /**
- * extra data fields for Member
- */
- function extraDBFields() {
- return array(
- 'db' => array(
- //datos basicos
- 'Address' => 'Varchar(255)',
- 'City' => 'Varchar(255)',
- 'State' => 'Varchar(255)',
- 'ZIP' => 'Varchar(50)',
- 'Country' => 'Varchar(255)',
- 'Phone' => 'Varchar(50)',
- //datos en caso de emergencia
- 'EmergencyName' => 'Varchar(100)',
- 'EmergencyAddress' => 'Varchar(255)',
- 'EmergencyCity' => 'Varchar(255)',
- 'EmergencyState' => 'Varchar(255)',
- 'EmergencyZIP' => 'Varchar(50)',
- 'EmergencyCountry' => 'Varchar(255)',
- 'EmergencyPhone' => 'Varchar(50)',
- 'EmergencyEmail' => 'Varchar(255)',
- //datos personales
- 'Age' => 'Int(3)',
- 'Height' => 'Int(5)',
- 'Wheight' => 'Int(5)',
- 'Occupation' => 'Varchar(100)',
- 'PassportNumber' => 'Varchar(100)',
- 'Vegetarian' => 'Boolean',
- 'Allergies' => 'Boolean',
- 'IHaveAllergies' => 'Text',
- 'TakingMedication' => 'Boolean',
- 'MedicalHistory' => 'Text',
- 'OutDoorExperience' => 'Text',
- 'ClimbingExperience' => 'Text',
- 'FoundPatagonicasIn' => 'Text',
- 'MyOpinionOfPatagonicas' => 'Text'
- )
- );
- }
- /**
- * shows the cms fields
- */
- public function updateCMSFields(FieldSet &$fields) {
- $fields->removeFieldsFromTab('Root.Main',array(
- 'FirstName','Surname','Email','Website'
- ));
- //basic fields
- $fields->addFieldsToTab('Root.BasicInformation',$this->BasicFields());
- //in case of emergency fields
- $fields->addFieldsToTab('Root.InCaseOfEmergency',$this->EmergencyFields());
- //personal fields
- $fields->addFieldsToTab('Root.PersonalInformation',$this->PersonalFields());
- }
- /**
- * return fields for different tabs in the cms and for different
- * and shorter front forms
- */
- function SignUpFields() {
- $fields = new FieldSet(
- new HeaderField('SignUp Information', 3),
- new TextField("FirstName", "First name"),
- new TextField("Surname"),
- new EmailField("Email", "Email address"),
- new PasswordField("Password", "Password")
- );
- return $fields;
- }
- function BasicFields() {
- $fields = new FieldSet(
- new HeaderField('Basic Information', 3),
- new TextField('Address'),
- new TextField('City'),
- new TextField('State'),
- new TextField('ZIP'),
- new DropdownField('Country', 'Country', Geoip::getCountryDropDown(), 'US'),
- new TextField('Phone')
- );
- return $fields;
- }
- function EmergencyFields() {
- $fields = new FieldSet(
- new HeaderField('Contact this person in case of emergency', 3),
- new TextField('EmergencyName', 'Name'),
- new TextField('EmergencyAddress', 'Address'),
- new TextField('EmergencyCity', 'City'),
- new TextField('EmergencyState', 'State'),
- new TextField('EmergencyZIP', 'ZIP'),
- new DropdownField('EmergencyCountry', 'Country', Geoip::getCountryDropDown(), 'US'),
- new TextField('EmergencyPhone', 'Phone'),
- new TextField('EmergencyEmail', 'Email')
- );
- return $fields;
- }
- function PersonalFields() {
- $fields = new FieldSet(
- new HeaderField('Personal Information', 3),
- new TextField('Age'),
- new TextField('Height'),
- new TextField('Wheight'),
- new TextField('Occupation'),
- new TextField('PassportNumber','Passport Number'),
- new OptionsetField('Vegetarian', 'Are you Vegetarian?',array("0" => "no","1" => "yes"),"0"),
- new OptionsetField('Allergies', 'Do you have any allergies?',array("0" => "no","1" => "yes"),"0"),
- new TextareaField('IHaveAllergies','I you are allergic, please provide us information about it'),
- new OptionsetField('TakingMedication','Are you taking medication?',array("0" => "no","1" => "yes"),"0"),
- new TextareaField('MedicalHistory', 'Medical History'),
- new TextareaField('OutDoorExperience', 'Outdoor Experience'),
- new TextareaField('ClimbingExperience', 'Climbing Experience'),
- new LiteralField("ClimbingExperienceTip","<p class='tip'> (Peak, Route, Date) - Please complete this if you are signing up for a mountaineering or skiing expedition. Send a separate email if necessary.</p>"),
- new TextareaField('FoundPatagonicasIn', 'Where did you find us?')
- );
- return $fields;
- }
- function TripApplication(){
- $sqlQuery = new SQLQuery();
- $sqlQuery->select = Array(
- "ExpeditionPage.`ID` as ID",
- "Concat(SiteTree_Live.`Title`,' - (\$',ExpeditionPage.`Cost`,')') as Title",
- );
- $sqlQuery->from = Array(
- 'ExpeditionPage, SiteTree_Live'
- );
- $sqlQuery->where = Array(
- "ExpeditionPage.`ID` = SiteTree_Live.`ID`
- AND SiteTree_Live.`ClassName` Like '%ExpeditionPage'
- and SiteTree_Live.`Title` is not null
- AND ExpeditionPage.`Cost` is not null
- AND SiteTree_Live.`Status` = 'Published'"
- );
- $sqlQuery->orderby = "SiteTree_Live.`Title` ASC";
- $results = $sqlQuery->execute();
- $dropdownopts = $results->map();
- $fields = new FieldSet(
- new HeaderField('Trip Application Form', 3),
- new DropdownField('ExpeditionSelected', 'Select your Expedition', $dropdownopts),
- new HeaderField('Aconcagua expeditions only',3),
- new CheckboxField('singleSupplement','Check to select <strong>single supplement</strong> option'),
- new LiteralField('singleSupplementInfo','<p><strong>4 nights of single hotel occupancy:</strong><br />2 nights at the Mendoza Park Hyatt,<br />2 in Penitentes <br />and *single tent to Base Camp.<br />($500 added to cost of expedition due with final payment).</p><p> <strong>NOTE</strong>: *Single supplement does NOT mean you will have single tent occupancy as it is non practical for our Guanacos/Ameghino Valley Expeditions since weight is a primarily issue from base camp up.<br />(for single supplement option for other expeditions please contact us)</p>')
- );
- return $fields;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment