Guest User

Untitled

a guest
Jul 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.23 KB | None | 0 0
  1. <?php
  2.  
  3. class ShirtOrder extends Page {
  4. static $db = array(
  5. "Measurements" => "Text"
  6. );
  7.  
  8.  
  9.  
  10. function getCMSFields() {
  11. $fields = parent::getCMSFields();
  12. $fields->addFieldToTab('Root.Content.Main', new
  13. TextField('Measurements'), 'Content');
  14. return $fields;
  15.  
  16. }
  17. }
  18. class ShirtOrder_Controller extends Page_Controller {
  19.  
  20.  
  21. function ShirtOrderForm() {
  22.  
  23. // Create fields
  24. $fields = new FieldSet(
  25. new LiteralField('nav','<div class="nav"><a id="prev2" href="#">Prev</a> <a id="next2" href="#">Next</a></div>'),
  26. new LiteralField('wrapper','<div id="fieldswrapper">'),
  27.  
  28. new LiteralField('info','<div id="info">'),
  29. new FieldGroup(
  30.  
  31. new HeaderField('Personal Information'),
  32.  
  33. new TextField('<h3>Name</h3>'),
  34. new TextAreaField('<h3>Address</h3>'),
  35. new TextField('<h3>Email</h3>'),
  36. new TextField('<h3>Phone</h3>'),
  37. new TextField('<h3>Age</h3>'),
  38. new TextField('Height','<h3>Height (cm)</h3>'),
  39. new TextField('Weight','<h3>Weight (kg)</h3>'),
  40. new TextField('FABRICCODE','<h3>Fabric Code</h3>')
  41.  
  42.  
  43. ),
  44. new LiteralField('close_info','</div>'),
  45. new LiteralField('style','<div id="style">'),
  46. new FieldGroup(
  47.  
  48. new HeaderField ('Style Information'),
  49.  
  50. new OptionsetField('Collar', '<h3>Collar<h3>', array(
  51. 'Classic' => 'Classic',
  52. 'Oriental' => 'Oriental',
  53. 'Cocktail' => 'Cocktail')),
  54.  
  55. new OptionsetField('Pockets', '<h3>Pockets</h3>', array(
  56. 'None' => 'None',
  57. 'One' => 'One',
  58. 'Two' => 'Two')),
  59.  
  60. new OptionsetField('Cuffs', '<h3>Cuffs</h3>', array(
  61. 'Single button square' => 'Single button square',
  62. 'Single button round' => 'Single button round',
  63. 'Double button square' => 'Double button square',
  64. 'Double button round' => 'Double button round',
  65. 'French Cuff (for cufflinks)' => 'French Cuff (for cufflinks)')),
  66.  
  67. new LiteralField('monogram','<div id="monogram">'),
  68. new OptionsetField('Monogram', '<h3>Monogram</h3>', array(
  69. 'No' => 'No','<p>If YES, 3 characters you wish to
  70. appear on cuff (3 characters max):</p>')),
  71. new TextField('MonogramText',''),
  72. new LiteralField('monogram_close','</div>'),
  73. new OptionsetField('WhiteCollarCuffs', '<h3>White Collar/Cuffs:</h3>', array(
  74. 'No (Normal)' => 'No (Normal)',
  75. 'Yes' => 'Yes <p>(your chosen fabric for shirt colour
  76. but with white collar/cuffs)</p>')),
  77.  
  78. new TextAreaField('StylePrefs','<h3>Additional Style Preferences:</h3>')
  79.  
  80. ),
  81. new LiteralField('close_style','</div>'),
  82. new FieldGroup(
  83.  
  84. new LiteralField('formbox','<div class="formbox">'),
  85. new HeaderField('Measurements'),
  86. new LiteralField('Measurements', $this->Measurements),
  87.  
  88. new LiteralField('shouldertitle','<h3>Full Shoulder</h3>'),
  89. new LiteralField('shoulderimg','<img class="measurements"
  90. src="../1.jpg"/>'),
  91. new LiteralField('shoulderdesc','<p>Measure back at its widest
  92. portion. This is the length between your shoulders.</p>'),
  93. new TextField('Shoulder','Size (in CM)'),
  94.  
  95. new LiteralField('formbox_close','</div>'),
  96.  
  97. new LiteralField('formbox','<div class="formbox">'),
  98.  
  99.  
  100. new LiteralField('sleevetitle','<h3>Sleeve Length</h3>'),
  101. new LiteralField('sleeveimg','<img class="measurements" src="../2.jpg"/>'),
  102. new LiteralField('sleevedesc','<p>Measure from shoulder seam to
  103. the beginning of your wrist (base of thumb). Now add 3cm to this
  104. measurement.</p>'),
  105.  
  106. new TextField('Sleeve','Size (in CM)'),
  107.  
  108. new LiteralField('formbox_close','</div>'),
  109. new LiteralField('formbox','<div class="formbox">'),
  110.  
  111. new LiteralField('chesttitle','<h3>Chest</h3>'),
  112. new LiteralField('chestimg','<img class="measurements" src="../3.jpg"/>'),
  113. new LiteralField('chestdesc','<p>Breathe out, take a small breath
  114. in and measure around chest (under armpits) at nipple level. Keep a
  115. finger under the measuring tape </p>'),
  116. new TextField('Chest','Size (in CM)'),
  117. new LiteralField('formbox_close','</div>')
  118. ),
  119. new FieldGroup(
  120.  
  121. new LiteralField('formbox','<div class="formbox">'),
  122. new LiteralField('stomachtitle','<h3>Stomach</h3>'),
  123. new LiteralField('stomachimg','<img class="measurements"
  124. src="../4.jpg"/>'),
  125. new LiteralField('stomachdesc','<p>Breathe out, take a small
  126. breath in and measure around stomach line at its fullest point,
  127. keeping one finger under the measuring tape. </p>'),
  128. new TextField('Stomach','Size (in CM)'),
  129. new LiteralField('formbox_close','</div>'),
  130. new LiteralField('formbox','<div class="formbox">'),
  131. new LiteralField('shirttitle','<h3>Shirt Length</h3>'),
  132. new LiteralField('shirtimg','<img class="measurements"
  133. src="../5.1.jpg"/>'),
  134. new LiteralField('shirtdesc','<p>Measure from the highest point
  135. of the shoulders (next to the collar) straight down to the level of
  136. the tip of your thumb.</p>'),
  137. new TextField('ShirtLength','Size (in CM)'),
  138. new LiteralField('formbox_close','</div>'),
  139.  
  140. new LiteralField('formbox','<div class="formbox">'),
  141. new LiteralField('necktitle','<h3>Neck</h3>'),
  142. new LiteralField('neckimg','<img class="measurements" src="../6.jpg"/>'),
  143. new LiteralField('neckdesc','<p>Measure around neck at the point
  144. where your collar would be, keeping one finger under the measuring
  145. tape. </p>'),
  146. new TextField('Neck','Size (in CM)'),
  147. new LiteralField('formbox_close','</div>')
  148.  
  149. ),
  150. New FieldGroup(
  151. new LiteralField('formbox','<div class="formbox">'),
  152. new LiteralField('fronttitle','<h3>Front</h3>'),
  153. new LiteralField('frontimg','<img class="measurements"
  154. src="../7.1.jpg"/>'),
  155. new LiteralField('frontdesc','<p>Measure from top armpit angle to
  156. other armpit angled across your chest.</p>'),
  157. new TextField('Front','Size (in CM)'),
  158. new LiteralField('formbox_close','</div>'),
  159. new LiteralField('formbox','<div class="formbox">'),
  160. new LiteralField('backtitle','<h3>Back</h3>'),
  161. new LiteralField('backimg','<img class="measurements" src="../8.1.jpg"/>'),
  162. new LiteralField('backdesc','<p>Measure from top armpit angle to
  163. other armpit angle across your back. </p>'),
  164. new TextField('Back','Size (in CM)'),
  165. new LiteralField('formbox_close','</div>'),
  166. new LiteralField('formbox','<div class="formbox">'),
  167.  
  168.  
  169. new OptionsetField('ShoulderStyle', '<h3>Please Select Your
  170. Shoulder Style</h3>', array(
  171. 'Sloping' => 'Sloping',
  172. 'Regular' => 'Regular',
  173. 'Square' => 'Square')),
  174.  
  175.  
  176. new OptionsetField('Posture', '<h3>Posture</h3>', array(
  177. 'Normal' => 'Normal',
  178. 'Erect' => 'Erect',
  179. 'Forward Stoop' => 'Forward Stoop',
  180. 'Forward Stomach' => 'Forward Stomach',
  181. 'Stout' => 'Stout')),
  182. new LiteralField('formbox_close','</div>'),
  183. new LiteralField('wrapper_close','</div>')
  184. )
  185. );
  186.  
  187.  
  188.  
  189. // Create actions
  190.  
  191.  
  192. function doShirtOrder($data, $form) {
  193. $submission = new ShirtOrderSubmission();
  194. $form->saveInto($submission);
  195. $submission->write();
  196.  
  197. Director::redirectBack();
  198.  
  199.  
  200.  
  201. }
  202.  
  203. }
Add Comment
Please, Sign In to add comment