test_pdf.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <?php
  2. // Values
  3. $cleanliness = $values["cleanliness"];
  4. switch($cleanliness) {
  5. case 1: $cleanliness = "Very dirty"; break;
  6. case 2: $cleanliness = "Dirty"; break;
  7. case 3: $cleanliness = "Adequate"; break;
  8. case 4: $cleanliness = "Clean"; break;
  9. case 5: $cleanliness = "Very clean"; break;
  10. }
  11. $staff_badge_worn = $values["staff_badge_worn"] ?? "";
  12. if(strlen($staff_badge_worn) == 0) $staff_badge_worn = "Don't know/Not approached";
  13. else $staff_badge_worn = ($staff_badge_worn == 0) ? "No" : "Yes";
  14. $staff_offered_drink = $values["staff_offered_drink"] ?? "";
  15. $staff_offered_drink = $staff_offered_drink ? "Yes" : "No";
  16. $staff_offered_promotion = $values["staff_offered_promotion"] ?? "";
  17. $staff_offered_promotion = $staff_offered_promotion ? "Yes" : "No";
  18. $staff_help = $values["staff_help"] ?? "";
  19. $staff_help = $staff_help ? "Yes" : "No";
  20. $staff_behaviour = $values["staff_behaviour"] ?? 0;
  21. switch($staff_behaviour) {
  22. case 1: $staff_behaviour = "Rude"; break;
  23. case 2: $staff_behaviour = "Slightly rude"; break;
  24. case 3: $staff_behaviour = "Neither rude or polite"; break;
  25. case 4: $staff_behaviour = "Polite and friendly"; break;
  26. case 5: $staff_behaviour = "Very polite and friendly"; break;
  27. default: $staff_behaviour = ""; break;
  28. }
  29. $staff_uniform = $values["staff_uniform"] ?? "";
  30. $staff_uniform = $staff_uniform ? "Yes" : "No";
  31. // Location Photo
  32. $location_photo_path = $test->getDirectory() . "/location_photo.jpg";
  33. if(!file_exists($location_photo_path)) {
  34. $location_photo_path = "public/img/no_image_4_3.png";
  35. }
  36. $size = getimagesize($location_photo_path);
  37. list($image_width, $image_height) = $size;
  38. $width = "";
  39. $height = "";
  40. if($image_height > $image_width) {
  41. $height = "8cm";
  42. }
  43. else {
  44. $width = "100%";
  45. }
  46. $mpdf->imageVars["location_photo"] = file_get_contents($location_photo_path);
  47. ?>
  48. <div style="float: left; width: 70%; position: relative;">
  49. <h3 class="section"><?=htmlspecialchars($location_text)?></h3>
  50. <div class="bl">
  51. <div class="field"><?=htmlspecialchars($customer->region_field_name)?> / <?=htmlspecialchars($customer->area_manager_field_name)?>:</div>
  52. <div class="value">
  53. <?=TestPDF::getValueHtml($location->region)?> / <?=TestPDF::getValueHtml($location->area_manager)?>
  54. </div>
  55. </div>
  56. <div class="bl">
  57. <div class="field">Address:</div>
  58. <div class="value">
  59. <?=htmlspecialchars($location->address_1)?><br />
  60. <?php
  61. if($location->address_2) {
  62. ?>
  63. <?=htmlspecialchars($location->address_2)?><br />
  64. <?php
  65. }
  66. ?>
  67. <?=htmlspecialchars($location->city)?>
  68. </div>
  69. </div>
  70. <div class="bl">
  71. <div class="field">Postcode:</div>
  72. <div class="value"><?=htmlspecialchars($location->postal_code)?></div>
  73. </div>
  74. <div class="bl">
  75. <div class="field">Shop Name - Left:</div>
  76. <div class="value"><?=htmlspecialchars($test->shop_left)?></div>
  77. </div>
  78. <div>
  79. <div class="field">Shop Name - Right:</div>
  80. <div class="value"><?=htmlspecialchars($test->shop_right)?></div>
  81. </div>
  82. </div>
  83. <div style="float: right; width: 29%">
  84. <h3 class="section">Tester</h3>
  85. <div class="bl">
  86. <div class="field">Gender:</div>
  87. <div class="value"><?=htmlspecialchars($tester->getGenderText())?></div>
  88. </div>
  89. <div>
  90. <strong>Attire:</strong><br />
  91. <?=htmlspecialchars($test->attire)?>
  92. </div>
  93. </div>
  94. <div style="clear: both;"></div>
  95. <h3 class="section">Test Details</h3>
  96. <div style="float: left; width: 49.5%">
  97. <div class="subheader">
  98. <strong>Date &amp; Time</strong>
  99. </div>
  100. <div style="float: left; width: 24%">
  101. <strong>Date:</strong><br />
  102. <?=htmlspecialchars($date_start)?>
  103. </div>
  104. <div style="float: left; width: 24%">
  105. <strong>Entry:</strong><br />
  106. <?=htmlspecialchars($time_start)?>
  107. </div>
  108. <div style="float: left; width: 24%">
  109. <strong>Exit:</strong><br />
  110. <?=htmlspecialchars($time_end)?>
  111. </div>
  112. <div style="float: left; width: 24%">
  113. <strong>Duration:</strong><br />
  114. <?=htmlspecialchars($duration_text)?>
  115. </div>
  116. <div style="clear: both;"></div><br />
  117. <div class="subheader">
  118. <strong>Venue</strong>
  119. </div>
  120. <div>
  121. <div class="field">Cleanliness:</div>
  122. <div class="value"><?=TestPDF::getValueHtml($cleanliness)?></div>
  123. </div>
  124. <br />
  125. <div class="subheader">
  126. <strong>Tester's Notes</strong>
  127. </div>
  128. <?=TestPDF::getValueHtml($test->additional_notes)?><br />
  129. <br />
  130. <div class="subheader">
  131. <strong>Location Photo</strong>
  132. </div>
  133. <img src="var:location_photo" width="<?=$width?>" height="<?=$height?>" />
  134. </div>
  135. <div style="float: right; width: 49.5%">
  136. <div class="wide-field-names">
  137. <div class="subheader">
  138. <strong>Staff Details</strong>
  139. </div>
  140. <div>
  141. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_badge_worn"])?>:</div>
  142. <div class="value"><?=TestPDF::getValueHtml($staff_badge_worn)?></div>
  143. </div>
  144. <div>
  145. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_name"])?>:</div>
  146. <div class="value"><?=TestPDF::getValueHtml($values["staff_name"] ?? "")?></div>
  147. </div>
  148. <br />
  149. <div>
  150. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_offered_drink"])?>:</div>
  151. <div class="value"><?=TestPDF::getValueHtml($staff_offered_drink)?></div>
  152. </div>
  153. <div>
  154. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_offered_drink_name"])?>:</div>
  155. <div class="value"><?=TestPDF::getValueHtml($values["staff_offered_drink_name"] ?? "")?></div>
  156. </div>
  157. <br />
  158. <div>
  159. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_offered_promotion"])?>:</div>
  160. <div class="value"><?=TestPDF::getValueHtml($staff_offered_promotion)?></div>
  161. </div>
  162. <div>
  163. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_offered_promotion_name"])?>:</div>
  164. <div class="value"><?=TestPDF::getValueHtml($values["staff_offered_promotion_name"] ?? "")?></div>
  165. </div>
  166. <br />
  167. <div>
  168. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_help"])?>:</div>
  169. <div class="value"><?=TestPDF::getValueHtml($staff_help)?></div>
  170. </div>
  171. <div>
  172. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_behaviour"])?>:</div>
  173. <div class="value"><?=TestPDF::getValueHtml($staff_behaviour)?></div>
  174. </div>
  175. <br />
  176. <div>
  177. <div class="field"><?=htmlspecialchars($field_name_label_map["staff_uniform"])?>:</div>
  178. <div class="value"><?=TestPDF::getValueHtml($staff_uniform)?></div>
  179. </div>
  180. </div>
  181. <strong><?=htmlspecialchars($field_name_label_map["staff_uniform_description"])?>:</strong><br />
  182. <?=TestPDF::getValueHtml($values["staff_uniform_description"] ?? "")?>
  183. </div>