account.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <?php
  2. /**
  3. * @var string $page_title
  4. * @var Customer $customer
  5. * @var string $logo_path
  6. * @var AccountIcon[] $icons
  7. * @var int $test_count
  8. * @var int $pass_fail_test_count
  9. * @var int $pass_rate
  10. * @var int $pass_count
  11. * @var int $year_cycle_start_text
  12. * @var array $to_do
  13. * @var array $referrals
  14. * @var Chart $stage_chart
  15. */
  16. $user = Core::$user;
  17. ?>
  18. <div class="container mt-3 py-4">
  19. <?php
  20. if($logo_path) {
  21. $path = str_replace("public/", "", $logo_path);
  22. ?>
  23. <img class="float-right" src="<?=htmlspecialchars($path)?>" alt="<?=htmlspecialchars($customer->name)?>" style="height: 88px;">
  24. <?php
  25. }
  26. ?>
  27. <h2><?=htmlspecialchars($page_title)?></h2>
  28. <?php
  29. switch($user->level) {
  30. case User::LEVEL_BANNED:
  31. ?>
  32. <div class="alert alert-danger">
  33. <i class="fal fa-fw fa-exclamation-circle"></i>
  34. <?=htmlspecialchars(__("Your account has been banned. You will not be able to participate in any tests."))?>
  35. </div>
  36. <?php
  37. break;
  38. case User::LEVEL_REGISTERED:
  39. ?>
  40. <div class="alert alert-warning">
  41. <i class="fal fa-fw fa-clock"></i>
  42. <?=htmlspecialchars(__("Your account is not verified. You need to submit proof of ID and get your account verified before you can participate in tests."))?>
  43. </div>
  44. <?php
  45. break;
  46. case User::LEVEL_UNVERIFIED:
  47. ?>
  48. <div class="alert alert-warning">
  49. <i class="fal fa-fw fa-clock"></i>
  50. <?=htmlspecialchars(__("Your account is pending verification. You will be able to participate in tests once verified."))?>
  51. </div>
  52. <?php
  53. break;
  54. case User::LEVEL_DEACTIVATED:
  55. ?>
  56. <div class="alert alert-info">
  57. <i class="fal fa-fw fa-info-circle"></i>
  58. <?=htmlspecialchars(__("Your account is deactivated. You will not be able to participate in any tests until you reactivate your account."))?>
  59. </div>
  60. <?php
  61. break;
  62. }
  63. if(!empty($customer)) {
  64. ?>
  65. <h3>
  66. <?=htmlspecialchars("Quick Stats")?>
  67. </h3>
  68. <section class="row">
  69. <div class="col-xl-3 col-md-6">
  70. <div class="card card-body mb-3">
  71. <?=htmlspecialchars(__("Tests Completed"))?>
  72. <div class="stat">
  73. <?=$test_count?>
  74. </div>
  75. </div>
  76. </div>
  77. <?php
  78. if($pass_fail_test_count) {
  79. ?>
  80. <div class="col-xl-3 col-md-6">
  81. <div class="card card-body mb-3">
  82. <?=htmlspecialchars(__("Pass Rate"))?>
  83. <div class="stat">
  84. <?=round($pass_rate * 100, 2)?>%
  85. </div>
  86. </div>
  87. </div>
  88. <div class="col-xl-3 col-md-6">
  89. <div class="card card-body mb-3">
  90. <?=htmlspecialchars(__("Pass Count"))?>
  91. <div class="stat">
  92. <?=htmlspecialchars(number_format($pass_count))?> /
  93. <?=htmlspecialchars(number_format($pass_fail_test_count))?>
  94. </div>
  95. </div>
  96. </div>
  97. <?php
  98. }
  99. ?>
  100. <div class="col-xl-3 col-md-6">
  101. <div class="card card-body mb-3">
  102. <?=htmlspecialchars(__("Year Cycle Start"))?>
  103. <div class="stat">
  104. <?=htmlspecialchars($year_cycle_start_text)?>
  105. </div>
  106. </div>
  107. </div>
  108. </section>
  109. <?php
  110. }
  111. ?>
  112. <div class="row">
  113. <div class="col-xl mb-3 mb-lg-0">
  114. <h3>
  115. <?=htmlspecialchars(__("Main Menu"))?>
  116. </h3>
  117. <div class="row">
  118. <?php
  119. foreach($icons as $icon) {
  120. ?>
  121. <div class="col-6 col-sm-4 text-center">
  122. <a class="btn <?=$icon->buttonClass?> btn-block mb-3 p-2" href="<?=htmlspecialchars($icon->url)?>">
  123. <?php
  124. if($icon->counter) {
  125. ?>
  126. <span class="fa-layers fa-fw fa-3x mb-2">
  127. <i class="fal fa-<?=htmlspecialchars($icon->icon)?>"></i>
  128. <span class="fa-layers-counter fa-layers-bottom-right"><?=number_format($icon->counter)?></span>
  129. </span>
  130. <?php
  131. }
  132. else {
  133. ?>
  134. <i class="fal fa-3x fa-<?=htmlspecialchars($icon->icon)?> mb-2"></i>
  135. <?php
  136. }
  137. ?>
  138. <br />
  139. <?=htmlspecialchars($icon->name)?>
  140. </a>
  141. </div>
  142. <?php
  143. }
  144. ?>
  145. </div>
  146. </div>
  147. <div class="col-xl mb-3 mb-lg-0">
  148. <?php
  149. if($to_do) {
  150. ?>
  151. <h3><?=htmlspecialchars(__("To-Do"))?></h3>
  152. <div class="row">
  153. <?php
  154. foreach($to_do as $icon) {
  155. ?>
  156. <div class="col-6 col-sm-4 text-center">
  157. <a class="btn btn-primary btn-block mb-3 p-2" href="<?=htmlspecialchars($icon->url)?>">
  158. <?php
  159. if($icon->counter) {
  160. ?>
  161. <span class="fa-layers fa-fw fa-3x mb-2">
  162. <i class="fal fa-<?=htmlspecialchars($icon->icon)?>"></i>
  163. <span class="fa-layers-counter fa-layers-bottom-right"><?=number_format($icon->counter)?></span>
  164. </span>
  165. <?php
  166. }
  167. else {
  168. ?>
  169. <i class="fal fa-3x fa-<?=htmlspecialchars($icon->icon)?> mb-2"></i>
  170. <?php
  171. }
  172. ?>
  173. <br />
  174. <?=htmlspecialchars($icon->name)?>
  175. </a>
  176. </div>
  177. <?php
  178. }
  179. ?>
  180. </div>
  181. <?php
  182. }
  183. if(!$user->terms_accepted && !$user->isDeactivated()) {
  184. ?>
  185. <div class="alert alert-danger">
  186. <p><i class="fas fa-info-circle"></i> <strong><?=htmlspecialchars(__("Important"))?></strong></p>
  187. <?php
  188. if(is_null($user->terms_accepted)) {
  189. ?>
  190. <p>
  191. <a href="/terms-and-conditions">Terms and Conditions</a> have been published.
  192. <?=sprintf(htmlspecialchars(__("%sTerms and Conditions%s have been published.")), "<a href=\"/terms-and-conditions\">", "</a>")?>
  193. </p>
  194. <p>
  195. <?=sprintf(htmlspecialchars(__("Our records show that you have not accepted the %sTerms and Conditions%s on registration. Please take time to read our Terms and Conditions and then click Accept or Decline to continue.")), '<a href="/terms-and-conditions">', '</a>')?>
  196. </p>
  197. <?php
  198. }
  199. else {
  200. ?>
  201. <p>
  202. <?=sprintf(htmlspecialchars(__("Our records show that you have declined the %sTerms and Conditions. If you have changed your mind, please click Accept to continue or Decline for other actions.")), '<a href="/terms-and-conditions">', '</a>')?>
  203. </p>
  204. <?php
  205. }
  206. ?>
  207. <a class="btn btn-success" href="/account/accept-terms"><?=htmlspecialchars(__("Accept"))?></a>
  208. <a class="btn btn-danger" href="/account/decline-terms"><?=htmlspecialchars(__("Decline"))?></a>
  209. </div>
  210. <?php
  211. }
  212. ?>
  213. <?php
  214. if($user->isCustomer()) {
  215. if($stage_chart !== null) {
  216. $stage_chart->renderCanvasHtml();
  217. }
  218. }
  219. else {
  220. ?>
  221. <h3><?=htmlspecialchars(__("Useful Documents"))?></h3>
  222. <div class="list-group mb-3">
  223. <a class="list-group-item list-group-item-action" href="/files/id_response.pdf">
  224. <i class="fal fa-fw fa-file-pdf"></i>
  225. <?=htmlspecialchars(__("ID Response for Testers"))?>
  226. </a>
  227. <a class="list-group-item list-group-item-action" href="/files/testing_methodology.pdf">
  228. <i class="fal fa-fw fa-file-pdf"></i>
  229. <?=htmlspecialchars(__("Age Verification Testing Methodology"))?>
  230. </a>
  231. <a class="list-group-item list-group-item-action" href="/files/machine_categories.pdf">
  232. <i class="fal fa-fw fa-file-pdf"></i>
  233. <?=htmlspecialchars(__("Machine Categories"))?>
  234. </a>
  235. <a class="list-group-item list-group-item-action" href="/files/testing_procedure_arcades.pdf">
  236. <i class="fal fa-fw fa-file-pdf"></i>
  237. <?=htmlspecialchars(__("Testing Procedure for Arcades"))?>
  238. </a>
  239. <a class="list-group-item list-group-item-action" href="/files/testing_procedure_pubs.pdf">
  240. <i class="fal fa-fw fa-file-pdf"></i>
  241. <?=htmlspecialchars(__("Testing Procedure for Pubs"))?>
  242. </a>
  243. </div>
  244. <?php
  245. }
  246. if($user->isTester()) {
  247. ?>
  248. <h3><?=htmlspecialchars(__("Referrals"))?></h3>
  249. <div class="list-group mb-3">
  250. <div class="list-group-item d-flex justify-content-between">
  251. <span>
  252. <i class="fal fa-fw fa-users"></i>
  253. <?=htmlspecialchars(__("Users Referred"))?>:
  254. </span>
  255. <span><?=number_format(count($referrals))?></span>
  256. </div>
  257. <div class="list-group-item d-flex justify-content-between">
  258. <span>
  259. <i class="fal fa-fw fa-external-link"></i>
  260. <?=htmlspecialchars(__("Referral Link"))?>:
  261. </span>
  262. <span>
  263. <a href="#" data-clipboard-text="<?=PROTOCOL?>://<?=DOMAIN?>/register?r=<?=$user->id?>" data-toggle="tooltip" data-title="<?=htmlspecialchars(__("Copy to clipboard"))?>">
  264. <i class="fal fa-fw fa-clipboard"></i>
  265. <?=htmlspecialchars(__("Copy to clipboard"))?>
  266. </a>
  267. </span>
  268. </div>
  269. </div>
  270. <?php
  271. }
  272. ?>
  273. </div>
  274. </div>
  275. </div>