Guest User

Untitled

a guest
Jul 18th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.46 KB | None | 0 0
  1. <?php
  2.  
  3. class SuitOrder extends Page {
  4. static $db = array(
  5. "Measurements" => "Text"
  6. );
  7.  
  8. function getCMSFields() {
  9. $fields = parent::getCMSFields();
  10. $fields->addFieldToTab('Root.Content.Main', new TextField('Measurements'), 'Content');
  11. return $fields;
  12.  
  13. }
  14. }
  15. class SuitOrder_Controller extends Page_Controller {
  16.  
  17.  
  18. function SuitOrderForm() {
  19.  
  20. // Create fields
  21. $fields = new FieldSet(
  22.  
  23.  
  24. new FieldGroup(
  25.  
  26. new HeaderField('Personal Information'),
  27.  
  28. new TextField('Name'),
  29. new TextField('Address'),
  30. new TextField('Email'),
  31. new TextField('Phone'),
  32. new TextField('Age'),
  33. new TextField('Height (cm)'),
  34. new TextField('Weight (kg)'),
  35. new TextField('FABRIC CODE')
  36. ),
  37. new FieldGroup(
  38.  
  39. new HeaderField ('Style Information'),
  40.  
  41. $multiColumnField = new CompositeField(
  42. new CompositeField(
  43.  
  44.  
  45.  
  46. new OptionsetField('Lapel', 'Lapel Style', array(
  47. 'Notch (Most Popular)' => 'Notch (Most Popular)',
  48. 'Peak' => 'Peak')),
  49.  
  50. new OptionsetField('Buttons', 'Buttons', array(
  51. 'One' => 'One',
  52. 'Two (Most Popular)' => 'Two (Most Popular)',
  53. 'Three' => 'Three')),
  54.  
  55. new OptionsetField('Vents', 'Vents', array(
  56. 'None' => 'None',
  57. 'Single' => 'Single',
  58. 'Double (Most Popular)' => 'Double (Most Popular)'))
  59. ),
  60. new CompositeField(
  61.  
  62. new OptionsetField('Cuffs', 'Cuffs', array(
  63. 'Yes' => 'Yes',
  64. 'No (Most Popular)' => 'No (Most Popular)')),
  65.  
  66. new OptionsetField('WaistCoat', 'Add Waist Coat? (Additional $120)', array(
  67. 'Yes' => 'Yes',
  68. 'No (Most Popular)' => 'No (Most Popular)')),
  69.  
  70. new TextAreaField('StylePrefs','Additional Style Preferences:')
  71.  
  72. )
  73. )
  74.  
  75.  
  76. ),
  77.  
  78. new FieldGroup(
  79. new HeaderField('Measurements'),
  80. new LiteralField('Measurements', $this->Measurements),
  81. new FieldGroup(
  82. new LiteralField('shouldertitle','<h3>Full Shoulder</h3>'),
  83. new LiteralField('shoulderimg','<img class="measurements" src="../1.jpg"/>'),
  84. new LiteralField('shoulderdesc','<p>Measure back at its widest portion. This is the length between your shoulders.</p>'),
  85.  
  86. new TextField('shouldertext','Size (in CM)')
  87. ),
  88.  
  89. new FieldGroup(
  90. new LiteralField('sleevetitle','<h3>Sleeve Length</h3>'),
  91. new LiteralField('sleeveimg','<img class="measurements" src="../2.jpg"/>'),
  92.  
  93. new LiteralField('sleevedesc','<p>Measure from shoulder seam to the beginning of your wrist (base of thumb). Now add 3cm to this measurement.</p>'),
  94.  
  95. new TextField('sleevetext','Size (in CM)')
  96. ),
  97.  
  98. new FieldGroup(
  99. new LiteralField('chesttitle','<h3>Chest</h3>'),
  100. new LiteralField('chestimg','<img class="measurements" src="../3.jpg"/>'),
  101.  
  102. new LiteralField('chestdesc','<p>Breathe out, take a small breath in and measure around chest (under armpits) at nipple level. Keep a finger under the measuring tape </p>'),
  103.  
  104. new TextField('chesttext','Size (in CM)')
  105. ),
  106.  
  107.  
  108. new FieldGroup(
  109. new LiteralField('stomachtitle','<h3>Stomach</h3>'),
  110. new LiteralField('stomachimg','<img class="measurements" src="../4.jpg"/>'),
  111.  
  112. new LiteralField('stomachdesc','<p>Breathe out, take a small breath in and measure around stomach line at its fullest point, keeping one finger under the measuring tape.
  113. </p>'),
  114.  
  115. new TextField('stomachtext','Size (in CM)')
  116. ),
  117.  
  118.  
  119. new FieldGroup(
  120. new LiteralField('jackettitle','<h3>Jacket Length</h3>'),
  121. new LiteralField('jacketimg','<img class="measurements" src="../5.1.jpg"/>'),
  122.  
  123. new LiteralField('jacketdesc','<p>Measure from the highest point of the
  124. shoulders (next to the collar) straight down to the level of the tip of your thumb. This is international Jacket Length
  125.  
  126. </p>'),
  127.  
  128. new TextField('jackettext','Size (in CM)')
  129. ),
  130.  
  131. new FieldGroup(
  132. new LiteralField('necktitle','<h3>Neck</h3>'),
  133. new LiteralField('neckimg','<img class="measurements" src="../6.jpg"/>'),
  134.  
  135. new LiteralField('neckdesc','<p>Measure around neck at the point where your collar would be, keeping one finger under the measuring tape. </p>'),
  136.  
  137. new TextField('necktext','Size (in CM)')
  138. ),
  139.  
  140. new FieldGroup(
  141. new LiteralField('fronttitle','<h3>Front</h3>'),
  142. new LiteralField('frontimg','<img class="measurements" src="../7.1.jpg"/>'),
  143.  
  144. new LiteralField('frontdesc','<p>Measure from top armpit angle to other armpit angled across your chest.</p>'),
  145.  
  146. new TextField('fronttext','Size (in CM)')
  147. ),
  148.  
  149. new FieldGroup(
  150. new LiteralField('backtitle','<h3>Back</h3>'),
  151. new LiteralField('backimg','<img class="measurements" src="../8.1.jpg"/>'),
  152.  
  153. new LiteralField('backdesc','<p>Measure from top armpit angle to other armpit angle across your back. </p>'),
  154.  
  155. new TextField('backtext','Size (in CM)')
  156. ),
  157.  
  158. new FieldGroup(
  159.  
  160. new LiteralField('waisttitle','<h3>Waist</h3>'),
  161. new LiteralField('waistimg','<img class="measurements" src="../9.2.jpg"/>'),
  162.  
  163. new LiteralField('waistdesc','<p>Relax your stomach and measure around your Waist Line where you would normally wear your pants. (belt line)</p>'),
  164.  
  165. new TextField('waisttext','Size (in CM)')
  166. ),
  167.  
  168. new FieldGroup(
  169.  
  170. new LiteralField('hipstitle','<h3>Hips</h3>'),
  171. new LiteralField('hipsimg','<img class="measurements" src="../10.jpg"/>'),
  172.  
  173. new LiteralField('hipsdesc','<p>Measure around your hips at widest point of your buttocks. Don’t pull measuring tape too tight. </p>'),
  174.  
  175. new TextField('hipstext','Size (in CM)')
  176. ),
  177.  
  178. new FieldGroup(
  179.  
  180. new LiteralField('crotchtitle','<h3>Crotch</h3>'),
  181. new LiteralField('crotchimg','<img class="measurements" src="../11.jpg"/>'),
  182.  
  183. new LiteralField('crotchdesc','<p> Measure from the top of belt line at the front, under crotch and up to top of belt line at the back. This is where the crotch of your pants will be so make sure the measuring tape is at a comfortable length. </p>'),
  184.  
  185. new TextField('crotchtext','Size (in CM)')
  186. ),
  187.  
  188. new FieldGroup(
  189.  
  190. new LiteralField('trousertitle','<h3>Trouser Length</h3>'),
  191. new LiteralField('trouserimg','<img class="measurements" src="../12.jpg"/>'),
  192.  
  193. new LiteralField('trouserdesc','<p>Measure from top of waistband where you would normally wear your pants to the bottom of your shoe heel. </p>'),
  194.  
  195. new TextField('trousertext','Size (in CM)')
  196. ),
  197.  
  198. new FieldGroup(
  199.  
  200. new LiteralField('thightitle','<h3>Thigh</h3>'),
  201. new LiteralField('thighimg','<img class="measurements" src="../13.1.jpg"/>'),
  202.  
  203. new LiteralField('thighdesc','<p>Measure circumference of thigh at the biggest point. </p>'),
  204.  
  205. new TextField('thightext','Size (in CM)')
  206. ),
  207.  
  208.  
  209. new FieldGroup(
  210.  
  211. new LiteralField('kneetitle','<h3>Knee</h3>'),
  212. new LiteralField('kneeimg','<img class="measurements" src="../14.1.jpg"/>'),
  213.  
  214. new LiteralField('kneedesc','<p>Measure circumference of knee.</p>'),
  215.  
  216. new TextField('kneetext','Size (in CM)')
  217. ),
  218.  
  219. new FieldGroup(
  220.  
  221. new LiteralField('cufftitle','<h3>Cuff</h3>'),
  222. new LiteralField('cuffimg','<img class="measurements" src="../15.jpg"/>'),
  223.  
  224. new LiteralField('cuffdesc','<p>Please enter:</br>
  225. - 44cm for regular cut</br>
  226. - 49cm+ for boot leg cut
  227. </p>'),
  228.  
  229. new TextField('cufftext','Size (in CM)')
  230. )
  231. ) );
  232.  
  233. $multiColumnField->setColumnCount(3);
  234.  
  235. // Create actions
  236. $actions = new FieldSet(
  237. new FormAction('doSuitOrder', 'Submit')
  238. );
  239.  
  240. return new Form($this, 'SuitOrderForm', $fields, $actions);
  241. }
  242.  
  243. function doSuitOrder($data, $form) {
  244. $submission = new SuitOrderSubmission();
  245. $form->saveInto($submission);
  246. $submission->write();
  247.  
  248. Director::redirectBack();
  249.  
  250.  
  251.  
  252. }
  253.  
  254. }
Add Comment
Please, Sign In to add comment