1
0

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