account.php 8.2 KB

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