Guest User

Untitled

a guest
Jun 15th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. <?php
  2. class Client extends DataObjectDecorator{
  3. /**
  4. * extra data fields for Member
  5. */
  6. function extraDBFields() {
  7. return array(
  8. 'db' => array(
  9. //datos basicos
  10. 'Address' => 'Varchar(255)',
  11. 'City' => 'Varchar(255)',
  12. 'State' => 'Varchar(255)',
  13. 'ZIP' => 'Varchar(50)',
  14. 'Country' => 'Varchar(255)',
  15. 'Phone' => 'Varchar(50)',
  16. //datos en caso de emergencia
  17. 'EmergencyName' => 'Varchar(100)',
  18. 'EmergencyAddress' => 'Varchar(255)',
  19. 'EmergencyCity' => 'Varchar(255)',
  20. 'EmergencyState' => 'Varchar(255)',
  21. 'EmergencyZIP' => 'Varchar(50)',
  22. 'EmergencyCountry' => 'Varchar(255)',
  23. 'EmergencyPhone' => 'Varchar(50)',
  24. 'EmergencyEmail' => 'Varchar(255)',
  25. //datos personales
  26. 'Age' => 'Int(3)',
  27. 'Height' => 'Int(5)',
  28. 'Wheight' => 'Int(5)',
  29. 'Occupation' => 'Varchar(100)',
  30. 'PassportNumber' => 'Varchar(100)',
  31. 'Vegetarian' => 'Boolean',
  32. 'Allergies' => 'Boolean',
  33. 'IHaveAllergies' => 'Text',
  34. 'TakingMedication' => 'Boolean',
  35. 'MedicalHistory' => 'Text',
  36. 'OutDoorExperience' => 'Text',
  37. 'ClimbingExperience' => 'Text',
  38. 'FoundPatagonicasIn' => 'Text',
  39. 'MyOpinionOfPatagonicas' => 'Text'
  40. )
  41. );
  42. }
  43.  
  44. /**
  45. * shows the cms fields
  46. */
  47. public function updateCMSFields(FieldSet &$fields) {
  48. $fields->removeFieldsFromTab('Root.Main',array(
  49. 'FirstName','Surname','Email','Website'
  50. ));
  51.  
  52. //basic fields
  53. $fields->addFieldsToTab('Root.BasicInformation',$this->BasicFields());
  54. //in case of emergency fields
  55. $fields->addFieldsToTab('Root.InCaseOfEmergency',$this->EmergencyFields());
  56. //personal fields
  57. $fields->addFieldsToTab('Root.PersonalInformation',$this->PersonalFields());
  58. }
  59.  
  60. /**
  61. * return fields for different tabs in the cms and for different
  62. * and shorter front forms
  63. */
  64. function SignUpFields() {
  65. $fields = new FieldSet(
  66. new HeaderField('SignUp Information', 3),
  67. new TextField("FirstName", "First name"),
  68. new TextField("Surname"),
  69. new EmailField("Email", "Email address"),
  70. new PasswordField("Password", "Password")
  71. );
  72. return $fields;
  73. }
  74. function BasicFields() {
  75. $fields = new FieldSet(
  76. new HeaderField('Basic Information', 3),
  77. new TextField('Address'),
  78. new TextField('City'),
  79. new TextField('State'),
  80. new TextField('ZIP'),
  81. new DropdownField('Country', 'Country', Geoip::getCountryDropDown(), 'US'),
  82. new TextField('Phone')
  83. );
  84. return $fields;
  85. }
  86.  
  87. function EmergencyFields() {
  88. $fields = new FieldSet(
  89. new HeaderField('Contact this person in case of emergency', 3),
  90. new TextField('EmergencyName', 'Name'),
  91. new TextField('EmergencyAddress', 'Address'),
  92. new TextField('EmergencyCity', 'City'),
  93. new TextField('EmergencyState', 'State'),
  94. new TextField('EmergencyZIP', 'ZIP'),
  95. new DropdownField('EmergencyCountry', 'Country', Geoip::getCountryDropDown(), 'US'),
  96. new TextField('EmergencyPhone', 'Phone'),
  97. new TextField('EmergencyEmail', 'Email')
  98. );
  99. return $fields;
  100. }
  101.  
  102. function PersonalFields() {
  103. $fields = new FieldSet(
  104. new HeaderField('Personal Information', 3),
  105. new TextField('Age'),
  106. new TextField('Height'),
  107. new TextField('Wheight'),
  108. new TextField('Occupation'),
  109. new TextField('PassportNumber','Passport Number'),
  110. new OptionsetField('Vegetarian', 'Are you Vegetarian?',array("0" => "no","1" => "yes"),"0"),
  111. new OptionsetField('Allergies', 'Do you have any allergies?',array("0" => "no","1" => "yes"),"0"),
  112. new TextareaField('IHaveAllergies','I you are allergic, please provide us information about it'),
  113. new OptionsetField('TakingMedication','Are you taking medication?',array("0" => "no","1" => "yes"),"0"),
  114. new TextareaField('MedicalHistory', 'Medical History'),
  115. new TextareaField('OutDoorExperience', 'Outdoor Experience'),
  116. new TextareaField('ClimbingExperience', 'Climbing Experience'),
  117. 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>"),
  118. new TextareaField('FoundPatagonicasIn', 'Where did you find us?')
  119. );
  120. return $fields;
  121. }
  122.  
  123. function TripApplication(){
  124. $sqlQuery = new SQLQuery();
  125. $sqlQuery->select = Array(
  126. "ExpeditionPage.`ID` as ID",
  127. "Concat(SiteTree_Live.`Title`,' - (\$',ExpeditionPage.`Cost`,')') as Title",
  128. );
  129. $sqlQuery->from = Array(
  130. 'ExpeditionPage, SiteTree_Live'
  131. );
  132. $sqlQuery->where = Array(
  133. "ExpeditionPage.`ID` = SiteTree_Live.`ID`
  134. AND SiteTree_Live.`ClassName` Like '%ExpeditionPage'
  135. and SiteTree_Live.`Title` is not null
  136. AND ExpeditionPage.`Cost` is not null
  137. AND SiteTree_Live.`Status` = 'Published'"
  138. );
  139. $sqlQuery->orderby = "SiteTree_Live.`Title` ASC";
  140. $results = $sqlQuery->execute();
  141. $dropdownopts = $results->map();
  142. $fields = new FieldSet(
  143. new HeaderField('Trip Application Form', 3),
  144. new DropdownField('ExpeditionSelected', 'Select your Expedition', $dropdownopts),
  145. new HeaderField('Aconcagua expeditions only',3),
  146. new CheckboxField('singleSupplement','Check to select <strong>single supplement</strong> option'),
  147. 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>')
  148. );
  149. return $fields;
  150. }
  151.  
  152. }
  153. ?>
Add Comment
Please, Sign In to add comment