Alan Lam 7 лет назад
Родитель
Сommit
3188d5194b
100 измененных файлов с 1210 добавлено и 546 удалено
  1. 9 0
      config.template.php
  2. 1 1
      controllers/404.php
  3. 1 1
      controllers/503.php
  4. 21 20
      controllers/account.php
  5. 4 4
      controllers/account_deactivate.php
  6. 4 4
      controllers/account_delete.php
  7. 2 2
      controllers/account_reactivate.php
  8. 8 8
      controllers/address_add.php
  9. 14 14
      controllers/address_edit.php
  10. 4 4
      controllers/addresses.php
  11. 1 1
      controllers/become_a_tester.php
  12. 7 7
      controllers/contact.php
  13. 1 0
      controllers/customer_edit.php
  14. 1 1
      controllers/home.php
  15. 1 1
      controllers/jobs.php
  16. 5 0
      controllers/location_add.php
  17. 6 1
      controllers/location_edit.php
  18. 7 7
      controllers/log_in.php
  19. 1 1
      controllers/log_out.php
  20. 14 15
      controllers/practice.php
  21. 3 3
      controllers/practice_file.php
  22. 2 2
      controllers/practice_template_select.php
  23. 1 1
      controllers/privacy_policy.php
  24. 1 1
      controllers/project_csv.php
  25. 1 1
      controllers/project_customer_csv.php
  26. 2 2
      controllers/project_edit.php
  27. 290 0
      controllers/project_invoice.php
  28. 26 0
      controllers/project_mark_finished.php
  29. 18 18
      controllers/register.php
  30. 2 2
      controllers/reports_presentation.php
  31. 8 8
      controllers/reset_password.php
  32. 1 1
      controllers/services.php
  33. 13 13
      controllers/settings.php
  34. 8 8
      controllers/submit_id.php
  35. 12 7
      controllers/template_add.php
  36. 12 6
      controllers/template_edit.php
  37. 2 2
      controllers/terms_accept.php
  38. 1 1
      controllers/terms_and_conditions.php
  39. 3 3
      controllers/terms_decline.php
  40. 24 18
      controllers/test.php
  41. 6 6
      controllers/test_confirm.php
  42. 2 2
      controllers/test_file.php
  43. 23 18
      controllers/test_invoice.php
  44. 5 5
      controllers/test_pdf.php
  45. 1 1
      controllers/test_result.php
  46. 2 2
      controllers/tests.php
  47. 4 4
      controllers/tests_available.php
  48. 9 9
      controllers/tests_available_ajax.php
  49. 3 3
      controllers/tests_completed.php
  50. 2 2
      controllers/tests_tester_kml.php
  51. 3 3
      controllers/user_activation.php
  52. 60 0
      controllers/venue_type_form.php
  53. 12 0
      controllers/venue_types.php
  54. 1 2
      engine/customer.php
  55. 20 6
      engine/email_builder.php
  56. 23 0
      engine/location.php
  57. 9 0
      engine/location_venue_type.php
  58. 32 3
      engine/project.php
  59. 28 4
      engine/template.php
  60. 36 29
      engine/test.php
  61. 41 39
      engine/user.php
  62. 4 0
      engine/util.php
  63. 14 0
      engine/venue_type.php
  64. 9 12
      initialise.php
  65. 8 2
      json/age_verification.json
  66. 8 1
      json/age_verification_mitchells_and_butlers.json
  67. 7 1
      json/mystery_shop.json
  68. 8 3
      routes.php
  69. 3 3
      views/404.php
  70. 3 3
      views/503.php
  71. 22 22
      views/account.php
  72. 9 9
      views/account_deactivate.php
  73. 12 12
      views/account_delete.php
  74. 8 8
      views/address_add_form.php
  75. 17 17
      views/address_edit_form.php
  76. 6 6
      views/addresses.php
  77. 7 7
      views/become_a_tester.php
  78. 9 9
      views/contact.php
  79. 8 2
      views/customer_form.php
  80. 1 1
      views/error.php
  81. 12 12
      views/footer.php
  82. 14 14
      views/header.php
  83. 13 13
      views/home.php
  84. 8 8
      views/jobs.php
  85. 6 0
      views/location.php
  86. 35 0
      views/location_form.php
  87. 7 7
      views/log_in.php
  88. 1 1
      views/map_overview.php
  89. 7 7
      views/modal_services_1.php
  90. 6 6
      views/modal_services_2.php
  91. 4 4
      views/modal_services_3.php
  92. 9 9
      views/modal_test_claim.php
  93. 6 6
      views/modal_test_invoice.php
  94. 3 3
      views/pagination.php
  95. 7 7
      views/practice_form.php
  96. 3 3
      views/practice_template_select.php
  97. 1 1
      views/privacy_policy.php
  98. 25 0
      views/project.php
  99. 11 0
      views/project_form.php
  100. 5 0
      views/project_list.php

+ 9 - 0
config.template.php

@@ -2,13 +2,22 @@
 
 
 define("SESSION_NAME", "name");
 define("SESSION_NAME", "name");
 define("APP_NAME", "name");
 define("APP_NAME", "name");
+define("COMPANY_NAME", "Check Policy Limited");
+define("COMPANY_NUMBER", "09506865");
 
 
 define("LOCALE", "en_GB");
 define("LOCALE", "en_GB");
 
 
 define("ADDRESS", "Check Policy Limited\n8 Market Street, Liskeard\nCornwall, PL14 3JJ");
 define("ADDRESS", "Check Policy Limited\n8 Market Street, Liskeard\nCornwall, PL14 3JJ");
 define("PHONE", "07841 353775");
 define("PHONE", "07841 353775");
+define("FACEBOOK", "https://www.facebook.com/checkpolicy");
 define("WHATSAPP", "447841353775");
 define("WHATSAPP", "447841353775");
 
 
+define("INVOICE_BANK_NAME", "Bank");
+define("INVOICE_ACCOUNT_NUMBER", "12345678");
+define("INVOICE_SORT_CODE", "12-34-56");
+define("INVOICE_VAT_NUMBER", "12345678");
+define("INVOICE_CONTACT_EMAIL", "noreply@check-policy.com");
+
 define("DB_HOST", "");
 define("DB_HOST", "");
 define("DB_USERNAME", "");
 define("DB_USERNAME", "");
 define("DB_PASSWORD", "");
 define("DB_PASSWORD", "");

+ 1 - 1
controllers/404.php

@@ -2,7 +2,7 @@
 
 
 header("HTTP/1.0 404 Not Found");
 header("HTTP/1.0 404 Not Found");
 
 
-$page_title = _("Page Not Found");
+$page_title = __("Page Not Found");
 
 
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));
 View::include("404");
 View::include("404");

+ 1 - 1
controllers/503.php

@@ -2,7 +2,7 @@
 
 
 header("HTTP/1.0 503 Not Found");
 header("HTTP/1.0 503 Not Found");
 
 
-$page_title = _("Internal Server Error");
+$page_title = __("Internal Server Error");
 
 
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));
 View::include("503");
 View::include("503");

+ 21 - 20
controllers/account.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Account");
+$page_title = __("Account");
 
 
 $user = Core::$user;
 $user = Core::$user;
 
 
@@ -14,9 +14,9 @@ $icons = [];
 
 
 if($user->level >= User::LEVEL_ADMIN) {
 if($user->level >= User::LEVEL_ADMIN) {
 
 
-	$icons[] = new AccountIcon(_("Customers"), "/account/customers", "warehouse");
-	$icons[] = new AccountIcon(_("Map Overview"), "/account/map-overview", "map-marked");
-	$icons[] = new AccountIcon(($user->level == User::LEVEL_SUPERADMIN ? _("Users") : _("Testers")), "/account/users", "users");
+	$icons[] = new AccountIcon(__("Customers"), "/account/customers", "warehouse");
+	$icons[] = new AccountIcon(__("Map Overview"), "/account/map-overview", "map-marked");
+	$icons[] = new AccountIcon(($user->level == User::LEVEL_SUPERADMIN ? __("Users") : __("Testers")), "/account/users", "users");
 
 
 	$users = User::query(["level" => User::LEVEL_UNVERIFIED]);
 	$users = User::query(["level" => User::LEVEL_UNVERIFIED]);
 	$tests = Test::query(["status" => Test::STATUS_PENDING_VERIFICATION]);
 	$tests = Test::query(["status" => Test::STATUS_PENDING_VERIFICATION]);
@@ -24,13 +24,14 @@ if($user->level >= User::LEVEL_ADMIN) {
 	$users_pending_verification = count($users);
 	$users_pending_verification = count($users);
 	$tests_pending_verification = count($tests);
 	$tests_pending_verification = count($tests);
 
 
-	$icons[] = new AccountIcon(_("Projects"), "/account/projects", "list");
-	$icons[] = new AccountIcon(_("Locations"), "/account/locations", "map-marker");
-	$icons[] = new AccountIcon(_("Templates"), "/account/templates", "file-alt");
+	$icons[] = new AccountIcon(__("Projects"), "/account/projects", "list");
+	$icons[] = new AccountIcon(__("Locations"), "/account/locations", "map-marker");
+	$icons[] = new AccountIcon(__("Templates"), "/account/templates", "file-alt");
+	$icons[] = new AccountIcon(__("Venue Types"), "/account/venue-types", "list-alt");
 
 
 	$pending_tester_invoice_test_count = count(Test::query(["status_tester_invoice" => Test::STATUS_TESTER_INVOICE_PENDING]));
 	$pending_tester_invoice_test_count = count(Test::query(["status_tester_invoice" => Test::STATUS_TESTER_INVOICE_PENDING]));
 
 
-	$invoice_icon = new AccountIcon(_("Invoices"), "/account/tests?status_tester_invoice=100", "file-invoice");
+	$invoice_icon = new AccountIcon(__("Invoices"), "/account/tests?status_tester_invoice=100", "file-invoice");
 	$invoice_icon->setCounter($pending_tester_invoice_test_count);
 	$invoice_icon->setCounter($pending_tester_invoice_test_count);
 
 
 	$icons[] = $invoice_icon;
 	$icons[] = $invoice_icon;
@@ -38,7 +39,7 @@ if($user->level >= User::LEVEL_ADMIN) {
 }
 }
 
 
 if($user->level >= User::LEVEL_CUSTOMER) {
 if($user->level >= User::LEVEL_CUSTOMER) {
-	$icons[] = new AccountIcon(_("Reports"), "/account/reports", "chart-pie");
+	$icons[] = new AccountIcon(__("Reports"), "/account/reports", "chart-pie");
 }
 }
 
 
 if($user->isTester() || $user->isAdmin()) {
 if($user->isTester() || $user->isAdmin()) {
@@ -46,27 +47,27 @@ if($user->isTester() || $user->isAdmin()) {
 	$tests_remaining = count($tests);
 	$tests_remaining = count($tests);
 
 
 	$tests_url = $user->isAdmin() ? "/account/tests?custom=overdue_test" : "/account/tests";
 	$tests_url = $user->isAdmin() ? "/account/tests?custom=overdue_test" : "/account/tests";
-	$tests_icon = new AccountIcon(_("Tests"), $tests_url, "clipboard-check");
+	$tests_icon = new AccountIcon(__("Tests"), $tests_url, "clipboard-check");
 	$tests_icon->setCounter($tests_remaining);
 	$tests_icon->setCounter($tests_remaining);
 
 
 	$icons[] = $tests_icon;
 	$icons[] = $tests_icon;
-	$icons[] = new AccountIcon(_("Practice"), "/account/practice", "chalkboard-teacher");
+	$icons[] = new AccountIcon(__("Practice"), "/account/practice", "chalkboard-teacher");
 }
 }
 
 
 if($user->level == User::LEVEL_TESTER) {
 if($user->level == User::LEVEL_TESTER) {
-	$icons[] = new AccountIcon(_("Addresses"), "/account/addresses", "address-book");
-	$icons[] = new AccountIcon(_("Tests (Completed)"), "/account/tests/completed", "check");
+	$icons[] = new AccountIcon(__("Addresses"), "/account/addresses", "address-book");
+	$icons[] = new AccountIcon(__("Tests (Completed)"), "/account/tests/completed", "check");
 }
 }
 
 
 if($user->level == User::LEVEL_REGISTERED) {
 if($user->level == User::LEVEL_REGISTERED) {
-	$icons[] = new AccountIcon(_("Submit ID"), "/account/submit-id", "id-card");
+	$icons[] = new AccountIcon(__("Submit ID"), "/account/submit-id", "id-card");
 }
 }
 
 
 if(!$user->terms_accepted) {
 if(!$user->terms_accepted) {
 	$icons = [];
 	$icons = [];
 }
 }
 
 
-$icons[] = new AccountIcon(_("Settings"), "/account/settings", "cog");
+$icons[] = new AccountIcon(__("Settings"), "/account/settings", "cog");
 
 
 usort($icons, function($a, $b) {
 usort($icons, function($a, $b) {
 	return $a->name <=> $b->name;
 	return $a->name <=> $b->name;
@@ -75,24 +76,24 @@ usort($icons, function($a, $b) {
 // Actions
 // Actions
 $actions = [];
 $actions = [];
 if($user->level == User::LEVEL_DEACTIVATED) {
 if($user->level == User::LEVEL_DEACTIVATED) {
-	$actions[] = new AccountIcon(_("Reactivate Account"), "/account/reactivate", "user-check");
+	$actions[] = new AccountIcon(__("Reactivate Account"), "/account/reactivate", "user-check");
 }
 }
 else if($user->level == User::LEVEL_TESTER) {
 else if($user->level == User::LEVEL_TESTER) {
-	$actions[] = new AccountIcon(_("Deactivate Account..."), "/account/deactivate", "user-times");
+	$actions[] = new AccountIcon(__("Deactivate Account..."), "/account/deactivate", "user-times");
 }
 }
 
 
-$actions[] = new AccountIcon(_("Delete Account..."), "/account/delete", "user-slash");
+$actions[] = new AccountIcon(__("Delete Account..."), "/account/delete", "user-slash");
 
 
 // To-do
 // To-do
 $to_do = [];
 $to_do = [];
 if($users_pending_verification) {
 if($users_pending_verification) {
-	$icon = new AccountIcon(_("Verify Users"), "/account/users?level=" . User::LEVEL_UNVERIFIED, "user-check");
+	$icon = new AccountIcon(__("Verify Users"), "/account/users?level=" . User::LEVEL_UNVERIFIED, "user-check");
 	$icon->setCounter($users_pending_verification);
 	$icon->setCounter($users_pending_verification);
 	$to_do[] = $icon;
 	$to_do[] = $icon;
 }
 }
 
 
 if($tests_pending_verification) {
 if($tests_pending_verification) {
-	$icon = new AccountIcon(_("Verify Tests"), "/account/tests?status=" . Test::STATUS_PENDING_VERIFICATION, "clipboard-check");
+	$icon = new AccountIcon(__("Verify Tests"), "/account/tests?status=" . Test::STATUS_PENDING_VERIFICATION, "clipboard-check");
 	$icon->setCounter($tests_pending_verification);
 	$icon->setCounter($tests_pending_verification);
 	$to_do[] = $icon;
 	$to_do[] = $icon;
 }
 }

+ 4 - 4
controllers/account_deactivate.php

@@ -1,8 +1,8 @@
 <?php
 <?php
 
 
-$page_title = _("Deactivate Account");
+$page_title = __("Deactivate Account");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/deactivate", $page_title);
 Core::addBreadcrumb("/account/deactivate", $page_title);
 
 
 $submit = http::value("submit");
 $submit = http::value("submit");
@@ -11,9 +11,9 @@ if($submit) {
 		Core::validateCSRFToken($submit);
 		Core::validateCSRFToken($submit);
 
 
 		$success = Core::$user->deactivate();
 		$success = Core::$user->deactivate();
-		if(!$success) throw new Exception(_("Failed to deactivate account. Please try again later."));
+		if(!$success) throw new Exception(__("Failed to deactivate account. Please try again later."));
 
 
-		Core::addAlert("success", _("Deactivated account successfully."));
+		Core::addAlert("success", __("Deactivated account successfully."));
 		HTTP::redirect("/account");
 		HTTP::redirect("/account");
 	}
 	}
 	catch(Exception $e) {
 	catch(Exception $e) {

+ 4 - 4
controllers/account_delete.php

@@ -1,8 +1,8 @@
 <?php
 <?php
 
 
-$page_title = _("Delete Account");
+$page_title = __("Delete Account");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/delete", $page_title);
 Core::addBreadcrumb("/account/delete", $page_title);
 
 
 $submit = http::value("submit");
 $submit = http::value("submit");
@@ -12,9 +12,9 @@ if($submit) {
 
 
 		$user = Core::$user;
 		$user = Core::$user;
 		$success = $user->softDelete();
 		$success = $user->softDelete();
-		if(!$success) throw new Exception(_("Failed to delete account. Please try again later."));
+		if(!$success) throw new Exception(__("Failed to delete account. Please try again later."));
 
 
-		Core::addAlert("success", _("Account deleted successfully."));
+		Core::addAlert("success", __("Account deleted successfully."));
 
 
 		unset($_SESSION["user_id"]);
 		unset($_SESSION["user_id"]);
 
 

+ 2 - 2
controllers/account_reactivate.php

@@ -3,9 +3,9 @@
 $user = Core::$user;
 $user = Core::$user;
 $user->level = User::LEVEL_TESTER;
 $user->level = User::LEVEL_TESTER;
 $success = $user->commit();
 $success = $user->commit();
-if(!$success) throw new Exception(_("Failed to update our records. Please try again later."));
+if(!$success) throw new Exception(__("Failed to update our records. Please try again later."));
 
 
-Core::addAlert("success", _("Account reactivated successfully."));
+Core::addAlert("success", __("Account reactivated successfully."));
 
 
 HTTP::redirect("/account");
 HTTP::redirect("/account");
 
 

+ 8 - 8
controllers/address_add.php

@@ -1,9 +1,9 @@
 <?php
 <?php
 
 
-$page_title = _("Add Address");
+$page_title = __("Add Address");
 
 
-Core::addBreadcrumb("/account", _("Account"));
-Core::addBreadcrumb("/account/addresses", _("Addresses"));
+Core::addBreadcrumb("/account", __("Account"));
+Core::addBreadcrumb("/account/addresses", __("Addresses"));
 Core::addBreadcrumb("/account/addresses/add", $page_title);
 Core::addBreadcrumb("/account/addresses/add", $page_title);
 
 
 $user_address = new UserAddress;
 $user_address = new UserAddress;
@@ -21,9 +21,9 @@ if($submit) {
 		$user_address->postal_code = http::value("postal_code", "trim");
 		$user_address->postal_code = http::value("postal_code", "trim");
 		$user_address->country = http::value("country", "trim");
 		$user_address->country = http::value("country", "trim");
 
 
-		if(empty($user_address->name)) $form_exception->addError(_("Name is required."));
-		if(empty($user_address->postal_code)) $form_exception->addError(_("Postal code is required."));
-		else if(empty($user_address->country)) $form_exception->addError(_("Country is required."));
+		if(empty($user_address->name)) $form_exception->addError(__("Name is required."));
+		if(empty($user_address->postal_code)) $form_exception->addError(__("Postal code is required."));
+		else if(empty($user_address->country)) $form_exception->addError(__("Country is required."));
 		else {
 		else {
 			// Geocode the postal code and country
 			// Geocode the postal code and country
 			try {
 			try {
@@ -43,7 +43,7 @@ if($submit) {
 				$user_address->longitude = $result->geometry->location->lng;
 				$user_address->longitude = $result->geometry->location->lng;
 			}
 			}
 			catch(Exception $e) {
 			catch(Exception $e) {
-				$form_exception->addError(_("Failed to get location from postal code."));
+				$form_exception->addError(__("Failed to get location from postal code."));
 			}
 			}
 		}
 		}
 
 
@@ -51,7 +51,7 @@ if($submit) {
 
 
 		$success = $user_address->commit();
 		$success = $user_address->commit();
 
 
-		Core::addAlert("success", _("Address added successfully."));
+		Core::addAlert("success", __("Address added successfully."));
 		HTTP::redirect("/account/addresses");
 		HTTP::redirect("/account/addresses");
 	}
 	}
 	catch(FormException $e) {
 	catch(FormException $e) {

+ 14 - 14
controllers/address_edit.php

@@ -1,9 +1,9 @@
 <?php
 <?php
 
 
-$page_title = _("Edit Address");
+$page_title = __("Edit Address");
 
 
 $user_address = UserAddress::get($id);
 $user_address = UserAddress::get($id);
-if(!$user_address) throw new Exception(_("Address not found."));
+if(!$user_address) throw new Exception(__("Address not found."));
 
 
 $submit = http::value("submit");
 $submit = http::value("submit");
 if($submit) {
 if($submit) {
@@ -24,22 +24,22 @@ if($submit) {
 		$user_address->latitude = http::value("latitude", "float");
 		$user_address->latitude = http::value("latitude", "float");
 		$user_address->longitude = http::value("longitude", "float");
 		$user_address->longitude = http::value("longitude", "float");
 
 
-		if(empty($user_address->name)) $form_exception->addError(_("Name is required."));
-		if(empty($user_address->address_1)) $form_exception->addError(_("Address line 1 is required."));
-		if(empty($user_address->city)) $form_exception->addError(_("City is required."));
-		if(empty($user_address->postal_code)) $form_exception->addError(_("Postal code is required."));
-		if(empty($user_address->country)) $form_exception->addError(_("Country is required."));
-		if(empty($user_address->max_radius_miles)) $form_exception->addError(_("Max distance is required."));
-		if(!in_array($user_address->max_radius_miles, UserAddress::RADIUSES)) $form_exception->addError(_("Max distance is invalid."));
+		if(empty($user_address->name)) $form_exception->addError(__("Name is required."));
+		if(empty($user_address->address_1)) $form_exception->addError(__("Address line 1 is required."));
+		if(empty($user_address->city)) $form_exception->addError(__("City is required."));
+		if(empty($user_address->postal_code)) $form_exception->addError(__("Postal code is required."));
+		if(empty($user_address->country)) $form_exception->addError(__("Country is required."));
+		if(empty($user_address->max_radius_miles)) $form_exception->addError(__("Max distance is required."));
+		if(!in_array($user_address->max_radius_miles, UserAddress::RADIUSES)) $form_exception->addError(__("Max distance is invalid."));
 
 
-		if(empty($user_address->latitude)) $form_exception->addError(_("Map location is required."));
-		else if(empty($user_address->longitude)) $form_exception->addError(_("Map location is required."));
+		if(empty($user_address->latitude)) $form_exception->addError(__("Map location is required."));
+		else if(empty($user_address->longitude)) $form_exception->addError(__("Map location is required."));
 
 
 		if($form_exception->hasErrors()) throw $form_exception;
 		if($form_exception->hasErrors()) throw $form_exception;
 
 
 		$success = $user_address->commit();
 		$success = $user_address->commit();
 
 
-		Core::addAlert("success", _("Address updated successfully."));
+		Core::addAlert("success", __("Address updated successfully."));
 		HTTP::redirect("/account/addresses");
 		HTTP::redirect("/account/addresses");
 	}
 	}
 	catch(FormException $e) {
 	catch(FormException $e) {
@@ -51,8 +51,8 @@ if($submit) {
 }
 }
 
 
 
 
-Core::addBreadcrumb("/account", _("Account"));
-Core::addBreadcrumb("/account/addresses", _("Addresses"));
+Core::addBreadcrumb("/account", __("Account"));
+Core::addBreadcrumb("/account/addresses", __("Addresses"));
 Core::addBreadcrumb("/account/addresses/edit/$id", $page_title);
 Core::addBreadcrumb("/account/addresses/edit/$id", $page_title);
 
 
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));

+ 4 - 4
controllers/addresses.php

@@ -1,8 +1,8 @@
 <?php
 <?php
 
 
-$page_title = _("Addresses");
+$page_title = __("Addresses");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/addresses", $page_title);
 Core::addBreadcrumb("/account/addresses", $page_title);
 
 
 $submit = http::value("submit");
 $submit = http::value("submit");
@@ -27,12 +27,12 @@ if($submit) {
 			"user_id" => Core::$user->id,
 			"user_id" => Core::$user->id,
 		]);
 		]);
 
 
-		if(!$address) throw new Exception(_("Address not found."));
+		if(!$address) throw new Exception(__("Address not found."));
 
 
 		$address->invoice = 1;
 		$address->invoice = 1;
 		$success = $address->commit();
 		$success = $address->commit();
 
 
-		Core::addAlert("success", _("Address set as invoice address successfully."));
+		Core::addAlert("success", __("Address set as invoice address successfully."));
 		HTTP::redirect("/account/addresses");
 		HTTP::redirect("/account/addresses");
 	}
 	}
 	catch(Exception $e) {
 	catch(Exception $e) {

+ 1 - 1
controllers/become_a_tester.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Become a Tester");
+$page_title = __("Become a Tester");
 
 
 Core::addBreadcrumb("/become-a-tester", $page_title);
 Core::addBreadcrumb("/become-a-tester", $page_title);
 
 

+ 7 - 7
controllers/contact.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Contact");
+$page_title = __("Contact");
 
 
 Core::addBreadcrumb("/contact", $page_title);
 Core::addBreadcrumb("/contact", $page_title);
 
 
@@ -16,11 +16,11 @@ if($submit) {
 
 
 		$form_exception = new FormException;
 		$form_exception = new FormException;
 
 
-		if(!Form::checkRecaptcha()) $form_exception->addError(_("reCAPTCHA check failed."));
-		if(empty($name)) $form_exception->addError(_("Name is required."));
-		if(empty($email)) $form_exception->addError(_("Email address is invalid."));
-		if(empty($phone)) $form_exception->addError(_("Contact number is required."));
-		if(empty($message)) $form_exception->addError(_("Message is required."));
+		if(!Form::checkRecaptcha()) $form_exception->addError(__("reCAPTCHA check failed."));
+		if(empty($name)) $form_exception->addError(__("Name is required."));
+		if(empty($email)) $form_exception->addError(__("Email address is invalid."));
+		if(empty($phone)) $form_exception->addError(__("Contact number is required."));
+		if(empty($message)) $form_exception->addError(__("Message is required."));
 
 
 		if($form_exception->hasErrors()) throw $form_exception;
 		if($form_exception->hasErrors()) throw $form_exception;
 
 
@@ -50,7 +50,7 @@ if($submit) {
 
 
 		$mail->send();
 		$mail->send();
 
 
-		Core::addAlert("success", _("Message sent successfully. We will get back to you shortly."));
+		Core::addAlert("success", __("Message sent successfully. We will get back to you shortly."));
 		HTTP::redirect("/contact");
 		HTTP::redirect("/contact");
 	}
 	}
 	catch(FormException $e) {
 	catch(FormException $e) {

+ 1 - 0
controllers/customer_edit.php

@@ -26,6 +26,7 @@ if($submit) {
 		$customer->country = http::value("country", "trim");
 		$customer->country = http::value("country", "trim");
 		$customer->email = http::value("email", "email");
 		$customer->email = http::value("email", "email");
 		$customer->phone = http::value("phone", "trim");
 		$customer->phone = http::value("phone", "trim");
+		$customer->invoice_contact_name = http::value("invoice_contact_name", "trim");
 		$customer->email_after_test = http::value("email_after_test", "int");
 		$customer->email_after_test = http::value("email_after_test", "int");
 		$customer->email_locations_after_test = http::value("email_locations_after_test", "int");
 		$customer->email_locations_after_test = http::value("email_locations_after_test", "int");
 
 

+ 1 - 1
controllers/home.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Home");
+$page_title = __("Home");
 
 
 Core::$show_alerts = false;
 Core::$show_alerts = false;
 
 

+ 1 - 1
controllers/jobs.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Jobs");
+$page_title = __("Jobs");
 
 
 Core::addBreadcrumb("/jobs", $page_title);
 Core::addBreadcrumb("/jobs", $page_title);
 
 

+ 5 - 0
controllers/location_add.php

@@ -71,6 +71,11 @@ if($submit) {
 		$success = $location->commit();
 		$success = $location->commit();
 		if(!$success) throw new Exception("Failed to add location at this time. Please try again later.");
 		if(!$success) throw new Exception("Failed to add location at this time. Please try again later.");
 
 
+		// Venue types
+		$venue_type_ids = http::value("venue_type_ids", "int");
+		$venue_types = VenueType::query(["id" => $venue_type_ids]);
+		$location->assignVenueTypes($venue_types);
+
 		Core::addAlert("success", "Location added successfully.");
 		Core::addAlert("success", "Location added successfully.");
 		HTTP::redirect("/account/locations/$location->id/edit");
 		HTTP::redirect("/account/locations/$location->id/edit");
 	}
 	}

+ 6 - 1
controllers/location_edit.php

@@ -98,8 +98,13 @@ if($submit) {
 
 
 
 
 		if($form_exception->hasErrors()) throw $form_exception;
 		if($form_exception->hasErrors()) throw $form_exception;
-
 		$success = $location->commit();
 		$success = $location->commit();
+		if(!$success) throw new Exception("Failed to edit location at this time. Please try again later.");
+
+		// Venue types
+		$venue_type_ids = http::value("venue_type_ids", "int");
+		$venue_types = VenueType::query(["id" => $venue_type_ids]);
+		$location->assignVenueTypes($venue_types);
 
 
 		Core::addAlert("success", "Location updated successfully.");
 		Core::addAlert("success", "Location updated successfully.");
 		HTTP::redirect("/account/locations/$location->id/edit");
 		HTTP::redirect("/account/locations/$location->id/edit");

+ 7 - 7
controllers/log_in.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Log In");
+$page_title = __("Log In");
 
 
 Core::addBreadcrumb("/log-in", $page_title);
 Core::addBreadcrumb("/log-in", $page_title);
 
 
@@ -14,25 +14,25 @@ if($submit) {
 		$email = http::value("email", "email");
 		$email = http::value("email", "email");
 		$password = http::value("password");
 		$password = http::value("password");
 
 
-		if(empty($email)) throw new Exception(_("Email address is invalid."));
-		if(empty($password)) throw new Exception(_("Password must be given."));
+		if(empty($email)) throw new Exception(__("Email address is invalid."));
+		if(empty($password)) throw new Exception(__("Password must be given."));
 
 
 		$user = User::queryOne([
 		$user = User::queryOne([
 			"email" => db::escape($email)
 			"email" => db::escape($email)
 		]);
 		]);
 
 
-		if(!$user) throw new Exception(_("Account not found."));
-		if(!password_verify($password, $user->password)) throw new Exception(_("Password is incorrect."));
+		if(!$user) throw new Exception(__("Account not found."));
+		if(!password_verify($password, $user->password)) throw new Exception(__("Password is incorrect."));
 		if(!$user->activated) {
 		if(!$user->activated) {
 			$user->sendActivationEmail();
 			$user->sendActivationEmail();
-			throw new Exception(_("Your email address is not verified. An activation email has been sent to your email address."));
+			throw new Exception(__("Your email address is not verified. An activation email has been sent to your email address."));
 		}
 		}
 
 
 		$_SESSION["user_id"] = $user->id;
 		$_SESSION["user_id"] = $user->id;
 
 
 		$redirect = $_SESSION["log_in_redirect_uri"] ?? "/account";
 		$redirect = $_SESSION["log_in_redirect_uri"] ?? "/account";
 
 
-		Core::addAlert("success", _("Log in successful."));
+		Core::addAlert("success", __("Log in successful."));
 		HTTP::redirect($redirect);
 		HTTP::redirect($redirect);
 
 
 	}
 	}

+ 1 - 1
controllers/log_out.php

@@ -2,7 +2,7 @@
 
 
 unset($_SESSION["user_id"]);
 unset($_SESSION["user_id"]);
 
 
-Core::addAlert("success", _("Log out successful."));
+Core::addAlert("success", __("Log out successful."));
 
 
 HTTP::redirect("/log-in");
 HTTP::redirect("/log-in");
 
 

+ 14 - 15
controllers/practice.php

@@ -3,16 +3,16 @@
 Core::addScript("public/js/app-practice-test.js");
 Core::addScript("public/js/app-practice-test.js");
 
 
 $template = Template::get($id);
 $template = Template::get($id);
-if(!$template) throw new Exception(_("Practice form not found."));
-if(!$template->practice) throw new Exception(_("This practice form is no longer available."));
+if(!$template) throw new Exception(__("Practice form not found."));
+if(!$template->practice) throw new Exception(__("This practice form is no longer available."));
 
 
-$page_title = _("Practice");
+$page_title = __("Practice");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/practice", $page_title);
 Core::addBreadcrumb("/account/practice", $page_title);
-Core::addBreadcrumb("/account/practice/$id", _("Form"));
+Core::addBreadcrumb("/account/practice/$id", __("Form"));
 
 
-$json = json_decode($template->json);
+$json = json_decode($template->getJSON());
 
 
 // Reset
 // Reset
 $reset = http::value("reset");
 $reset = http::value("reset");
@@ -69,14 +69,14 @@ if($submit) {
 					$start_unix = strtotime($start_override);
 					$start_unix = strtotime($start_override);
 					$end_unix = strtotime($end_override);
 					$end_unix = strtotime($end_override);
 
 
-					if($start_unix > $end_unix) $form_exception->addError(_("Entry Time must not be after Exit Time."));
+					if($start_unix > $end_unix) $form_exception->addError(__("Entry Time must not be after Exit Time."));
 					if(!$start_unix && $end_unix && $test->dts_start) {
 					if(!$start_unix && $end_unix && $test->dts_start) {
 						$recorded_start_unix = Util::getUnixTimeFromUTC($test->dts_start);
 						$recorded_start_unix = Util::getUnixTimeFromUTC($test->dts_start);
-						if($end_unix < $recorded_start_unix) $form_exception->addError(_("Exit Time cannot be later than the recorded Entry Time."));
+						if($end_unix < $recorded_start_unix) $form_exception->addError(__("Exit Time cannot be later than the recorded Entry Time."));
 					}
 					}
 				}
 				}
 				else {
 				else {
-					$form_exception->addError(_("Entry Time and Exit Time must be filled in."));
+					$form_exception->addError(__("Entry Time and Exit Time must be filled in."));
 				}
 				}
 
 
 			}
 			}
@@ -98,7 +98,7 @@ if($submit) {
 				try {
 				try {
 					if(!$required && $file->error == UPLOAD_ERR_NO_FILE) continue;
 					if(!$required && $file->error == UPLOAD_ERR_NO_FILE) continue;
 					if($required && $file->error == UPLOAD_ERR_NO_FILE) {
 					if($required && $file->error == UPLOAD_ERR_NO_FILE) {
-						throw new Exception(sprintf(_("%s is required."), $label));
+						throw new Exception(sprintf(__("%s is required."), $label));
 					}
 					}
 
 
 					// Detect upload error
 					// Detect upload error
@@ -106,9 +106,9 @@ if($submit) {
 
 
 					// Get image details
 					// Get image details
 					$size = @getimagesize($file->tmp_name);
 					$size = @getimagesize($file->tmp_name);
-					if(!$size) throw new Exception(sprintf(_("The uploaded file for %s is not an image.")), $label);
+					if(!$size) throw new Exception(sprintf(__("The uploaded file for %s is not an image.")), $label);
 					list($width, $height, $type) = $size;
 					list($width, $height, $type) = $size;
-					if($type != IMAGETYPE_JPEG) throw new Exception(sprintf(_("The uploaded file for %s is not a JPEG."), $label));
+					if($type != IMAGETYPE_JPEG) throw new Exception(sprintf(__("The uploaded file for %s is not a JPEG."), $label));
 
 
 					// Resize image
 					// Resize image
 					$output_image = Image::normalise($file->tmp_name);
 					$output_image = Image::normalise($file->tmp_name);
@@ -126,8 +126,8 @@ if($submit) {
 			else {
 			else {
 				$value = http::value($name, "trim");
 				$value = http::value($name, "trim");
 
 
-				if($required && empty($value)) $form_exception->addError(sprintf(_("%s is required."), $label));
-				if($values && !in_array($value, $values)) $form_exception->addError(sprintf(_("Value for %s is invalid."), $label));
+				if($required && empty($value)) $form_exception->addError(sprintf(__("%s is required."), $label));
+				if($values && !in_array($value, $values)) $form_exception->addError(sprintf(__("Value for %s is invalid."), $label));
 
 
 				if(in_array($name, Test::TEST_FIELDS)) {
 				if(in_array($name, Test::TEST_FIELDS)) {
 					$test->$name = $value;
 					$test->$name = $value;
@@ -191,7 +191,6 @@ if($submit) {
 }
 }
 
 
 if($is_unverified) {
 if($is_unverified) {
-	$json = json_decode($template->json);
 	$fields = array_merge($json->beforeTest, $json->duringTest);
 	$fields = array_merge($json->beforeTest, $json->duringTest);
 }
 }
 
 

+ 3 - 3
controllers/practice_file.php

@@ -1,15 +1,15 @@
 <?php
 <?php
 
 
 $template = Template::get($id);
 $template = Template::get($id);
-if(!$template) throw new Exception(_("Practice form not found."));
+if(!$template) throw new Exception(__("Practice form not found."));
 
 
 $tests = $_SESSION["practice_tests"];
 $tests = $_SESSION["practice_tests"];
 $test = $tests[$id] ?? false;
 $test = $tests[$id] ?? false;
-if(!$test) throw new Exception(_("Practice test not found."));
+if(!$test) throw new Exception(__("Practice test not found."));
 
 
 
 
 if(Core::$user->level < User::LEVEL_ADMIN) {
 if(Core::$user->level < User::LEVEL_ADMIN) {
-	if(Core::$user->id != $test->tester_id) throw new Exception(_("You do not have permission to access this resource."));
+	if(Core::$user->id != $test->tester_id) throw new Exception(__("You do not have permission to access this resource."));
 }
 }
 
 
 $directory = $test->getDirectory();
 $directory = $test->getDirectory();

+ 2 - 2
controllers/practice_template_select.php

@@ -1,8 +1,8 @@
 <?php
 <?php
 
 
-$page_title = _("Select Practice Form");
+$page_title = __("Select Practice Form");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/practice", $page_title);
 Core::addBreadcrumb("/account/practice", $page_title);
 
 
 $templates = Template::query([
 $templates = Template::query([

+ 1 - 1
controllers/privacy_policy.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Privacy Policy");
+$page_title = __("Privacy Policy");
 
 
 Core::addBreadcrumb("/privacy-policy", $page_title);
 Core::addBreadcrumb("/privacy-policy", $page_title);
 
 

+ 1 - 1
controllers/project_csv.php

@@ -12,7 +12,7 @@ header("Pragma: public");
 $template = $project->getTemplate();
 $template = $project->getTemplate();
 $processing_file_path = $template->getProcessingFilePath("project_csv.php");
 $processing_file_path = $template->getProcessingFilePath("project_csv.php");
 
 
-$object = json_decode($template->json);
+$object = json_decode($template->getJSON());
 
 
 $fields_1 = $object->beforeTest;
 $fields_1 = $object->beforeTest;
 $fields_2 = $object->duringTest;
 $fields_2 = $object->duringTest;

+ 1 - 1
controllers/project_customer_csv.php

@@ -12,7 +12,7 @@ header("Pragma: public");
 $template = $project->getTemplate();
 $template = $project->getTemplate();
 $processing_file_path = $template->getProcessingFilePath("project_customer_csv.php");
 $processing_file_path = $template->getProcessingFilePath("project_customer_csv.php");
 
 
-$object = json_decode($template->json);
+$object = json_decode($template->getJSON());
 
 
 $fields_1 = $object->beforeTest;
 $fields_1 = $object->beforeTest;
 $fields_2 = $object->duringTest;
 $fields_2 = $object->duringTest;

+ 2 - 2
controllers/project_edit.php

@@ -38,6 +38,7 @@ if($submit) {
 		$project->test_count = http::value("test_count", "int");
 		$project->test_count = http::value("test_count", "int");
 		$project->min_age = http::value("min_age", "int");
 		$project->min_age = http::value("min_age", "int");
 		$project->max_age = http::value("max_age", "int");
 		$project->max_age = http::value("max_age", "int");
+		$project->default_customer_fee = http::value("default_customer_fee", "float");
 		$project->default_tester_fee = http::value("default_tester_fee", "float");
 		$project->default_tester_fee = http::value("default_tester_fee", "float");
 		$project->time_of_day = http::value("time_of_day", "trim");
 		$project->time_of_day = http::value("time_of_day", "trim");
 		$project->tester_can_claim = http::value("tester_can_claim", "trim");
 		$project->tester_can_claim = http::value("tester_can_claim", "trim");
@@ -57,6 +58,7 @@ if($submit) {
 		if(empty($project->test_count)) $form_exception->addError("Test count is required.");
 		if(empty($project->test_count)) $form_exception->addError("Test count is required.");
 		if(empty($project->min_age)) $form_exception->addError("Minimum age is required.");
 		if(empty($project->min_age)) $form_exception->addError("Minimum age is required.");
 		if(empty($project->max_age)) $form_exception->addError("Maximum age is required.");
 		if(empty($project->max_age)) $form_exception->addError("Maximum age is required.");
+		if(empty($project->default_customer_fee)) $form_exception->addError("Default customer fee is required.");
 		if(empty($project->default_tester_fee)) $form_exception->addError("Default tester fee is required.");
 		if(empty($project->default_tester_fee)) $form_exception->addError("Default tester fee is required.");
 		if(empty($project->time_of_day)) $form_exception->addError("Time of day is required.");
 		if(empty($project->time_of_day)) $form_exception->addError("Time of day is required.");
 		else if(!in_array($project->time_of_day, ["A", "D", "N"])) $form_exception->addError("Invalid time of day selected.");
 		else if(!in_array($project->time_of_day, ["A", "D", "N"])) $form_exception->addError("Invalid time of day selected.");
@@ -131,5 +133,3 @@ $locations = $customer->getLocations();
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));
 View::include("project_form", compact("project", "templates", "locations", "location_ids"));
 View::include("project_form", compact("project", "templates", "locations", "location_ids"));
 View::includeOnce("footer");
 View::includeOnce("footer");
-
-?>

+ 290 - 0
controllers/project_invoice.php

@@ -0,0 +1,290 @@
+<?php
+
+use \Mpdf\Mpdf;
+
+$project = Project::get($id);
+if(!$project) throw new Exception(__("Project not found."));
+if(!$project->dts_finished) throw new Exception(__("An invoice cannot be generated for this project as it has not been marked as finished."));
+if(!Core::$user->canAdmin()) throw new Exception(__("You do not have permission to access this resource."));
+
+$customer = $project->getCustomer();
+$template = $project->getTemplate();
+$invoice_fields = $template->getCustomerInvoiceFields();
+
+// Calculation
+$default_customer_fee = $project->default_customer_fee;
+$tests = $project->getTests();
+
+$invoice_field_totals = [];
+$test_fee_invoice_counts = [];
+
+$test_costs = 0;
+foreach($tests as $test) {
+
+	$values = $test->getValues(true);
+
+	$fee = $test->customer_fee ?? $default_customer_fee;
+	$test_costs += $fee;
+
+	$count = $test_fee_invoice_counts[$fee] ?? 0;
+	++$count;
+	$test_fee_invoice_counts[$fee] = $count;
+
+	foreach($invoice_fields as $field) {
+		if(!isset($invoice_field_totals[$field->name])) {
+			$invoice_field_totals[$field->name] = 0;
+		}
+
+		$invoice_field_totals[$field->name] += (float) ($values[$field->name] ?? 0);
+	}
+}
+
+$total_ex_vat = $test_costs + array_sum($invoice_field_totals);
+$vat = round($total_ex_vat * 0.20, 2);
+
+$total_inc_vat = $total_ex_vat + $vat;
+
+// Processing
+usort($tests, function($a, $b) {
+	return $a->dts_start <=> $b->dts_start;
+});
+
+Location::load(array_column($tests, "location_id"));
+Template::load(array_column($tests, "template_id"));
+
+// Filename
+$reference =
+	"P" . str_pad($project->id, 3, "0", STR_PAD_LEFT) .
+	"/C" . str_pad($customer->id, 3, "0", STR_PAD_LEFT);
+
+$download_filename = str_replace("/", "_", $reference) . " - " . $project->name . " - Invoice.pdf";
+
+// Initialise for PDF generation
+$bill_to_address_parts = array_filter([
+	$customer->address_1,
+	$customer->address_2,
+	$customer->city,
+	implode(", ", array_filter([$customer->county, $customer->postal_code])),
+]);
+
+$bill_from_address_parts = explode("\n", ADDRESS);
+
+// A4 size: 210x297mm
+$mpdf = new Mpdf();
+
+$mpdf->SetSubject("Project Invoice");
+$mpdf->SetCreator(APP_NAME);
+$mpdf->SetAuthor(APP_NAME);
+$mpdf->SetTitle("Invoice ({$reference})");
+
+$mpdf->useSubstitutions = true;
+
+ob_start();
+?>
+<!DOCTYPE html>
+<html>
+	<head>
+		<style>
+			body {
+				font-family: sans-serif;
+			}
+
+			.title {
+				font-size: 3rem;
+			}
+
+			table {
+				border-collapse: collapse;
+			}
+
+			td {
+				padding: 8px;
+				font-size: 0.875rem;
+			}
+
+			.text-center {
+				text-align: center;
+			}
+
+			.text-brand {
+				color: #269926;
+			}
+		</style>
+	</head>
+	<body>
+
+		<div>
+			<div style="float: left; width: 49.5%; font-size: 0.875rem;">
+				<img src="./public/img/logo.png" alt="<?=htmlspecialchars(COMPANY_NAME)?>" /><br />
+				<br />
+			</div>
+			<div style="float: right; width: 49.5%; text-align: right;">
+				<div class="title">
+					INVOICE
+				</div>
+			</div>
+		</div>
+
+		<div>
+			<div style="float: left; width: 49.5%; font-size: 0.875rem;">
+
+				<strong><?=htmlspecialchars(COMPANY_NAME)?></strong><br />
+				<?=nl2br(htmlspecialchars(implode("\n", $bill_from_address_parts)))?><br />
+				Tel: <?=htmlspecialchars(PHONE)?>
+
+				<br />
+				<br />
+
+				<span color="gray">Bill To:</span><br />
+
+				<strong><?=htmlspecialchars($customer->name)?></strong><br />
+				<?=htmlspecialchars($customer->invoice_contact_name)?><br />
+				<?=nl2br(htmlspecialchars(implode("\n", $bill_to_address_parts)))?><br />
+
+				<?php
+				if($customer->phone) {
+					?>
+					Tel: <?=htmlspecialchars($customer->phone)?><br />
+					<?php
+				}
+				if($customer->email) {
+					?>
+					Email: <?=htmlspecialchars($customer->email)?><br />
+					<?php
+				}
+				?>
+
+
+
+			</div>
+			<div style="float: right; width: 49.5%; text-align: right;">
+				Ref: <?=$reference?><br />
+				Name: <?=htmlspecialchars($project->name)?><br />
+
+				<br />
+
+				<table width="100%" cellspacing="0">
+					<tr>
+						<td width="50%" align="right" color="gray">Date:</td>
+						<td width="50%" align="right"><?=date("d/m/Y")?></td>
+					</tr>
+					<tr>
+						<td align="right" color="gray">Due Date:</td>
+						<td align="right"><?=date("d/m/Y", time() + (30 * 86400))?></td>
+					</tr>
+					<tr bgcolor="#eee">
+						<td align="right">Balance Due:</td>
+						<td align="right">£<?=number_format($total_inc_vat, 2)?></td>
+					</tr>
+				</table>
+
+			</div>
+			<div style="clear: both;"></div>
+			<br />
+			<table width="100%" cellspacing="0" border="1">
+				<tr bgcolor="#444">
+					<td color="white" width="55%">Item</td>
+					<td color="white">Quantity</td>
+					<td color="white">Rate</td>
+					<td color="white">Amount</td>
+				</tr>
+
+				<?php
+				/*
+				foreach($tests as $test) {
+					$location = $test->getLocation();
+					$location_address = $location->getDisplayAddress(["address_1", "address_2", "city", "county", "postal_code"]);
+					?>
+
+					<tr>
+						<td>
+							<strong><?=htmlspecialchars($location->name)?></strong><br />
+							<?=nl2br(htmlspecialchars("{$location_address}\n" . date("d/m/Y H:i", strtotime($test->dts_start . " UTC"))))?>
+						</td>
+						<td align="right" valign="top">1</td>
+						<td align="right" valign="top">£<?=number_format($default_customer_fee, 2)?></td>
+						<td align="right" valign="top">£<?=number_format($default_customer_fee, 2)?></td>
+					</tr>
+					<?php
+				}
+				*/
+
+				foreach($test_fee_invoice_counts as $fee => $count) {
+					?>
+					<tr>
+						<td>
+							<strong><?=htmlspecialchars($template->name)?> Testing</strong>
+						</td>
+						<td align="right" valign="top"><?=number_format($count)?></td>
+						<td align="right" valign="top">£<?=number_format($fee, 2)?></td>
+						<td align="right" valign="top">£<?=number_format($fee * $count, 2)?></td>
+					</tr>
+					<?php
+				}
+
+				foreach($invoice_fields as $field) {
+					$total = $invoice_field_totals[$field->name] ?? 0;
+					if(!$total) continue;
+					?>
+					<tr>
+						<td>
+							<strong><?=htmlspecialchars($field->label)?></strong>
+						</td>
+						<td align="center" valign="top">-</td>
+						<td align="center" valign="top">-</td>
+						<td align="right" valign="top">£<?=number_format($total, 2)?></td>
+					</tr>
+					<?php
+				}
+
+				?>
+
+				<tr>
+					<td colspan="3" align="right" valign="top" color="gray">Total</td>
+					<td align="right" valign="top">£<?=number_format($total_ex_vat, 2)?></td>
+				</tr>
+
+				<tr>
+					<td colspan="3" align="right" valign="top" color="gray">VAT @ 20%</td>
+					<td align="right" valign="top">£<?=number_format($vat, 2)?></td>
+				</tr>
+
+				<tr>
+					<td colspan="3" align="right" valign="top" color="gray">Total (inc. VAT)</td>
+					<td align="right" valign="top">£<?=number_format($total_inc_vat, 2)?></td>
+				</tr>
+
+			</table>
+
+			<br />
+
+			<span color="gray">Pay To:</span><br />
+
+			<?=htmlspecialchars(COMPANY_NAME)?><br />
+			<?=htmlspecialchars(INVOICE_BANK_NAME)?><br />
+			Account Number: <?=htmlspecialchars(INVOICE_ACCOUNT_NUMBER)?><br />
+			Sort Code: <?=htmlspecialchars(INVOICE_SORT_CODE)?><br />
+
+			<p class="text-center">Payment is due within 30 days.</p>
+			<p class="text-center">If you have any questions concerning this invoice, contact: <?=htmlspecialchars(INVOICE_CONTACT_EMAIL)?>
+
+			<p class="text-brand text-center">
+				<strong>THANK YOU FOR YOUR BUSINESS!</strong>
+			</p>
+
+			<p class="text-brand text-center">
+				VAT Number: <?=htmlspecialchars(INVOICE_VAT_NUMBER)?>
+			</p>
+
+
+		</div>
+	</body>
+</html>
+<?php
+
+$html = ob_get_clean();
+
+$mpdf->WriteHTML($html);
+
+// Output to browser
+$mpdf->Output($download_filename, "D");

+ 26 - 0
controllers/project_mark_finished.php

@@ -0,0 +1,26 @@
+<?php
+
+$project = Project::get($id);
+if(!$project) throw new Exception("Project cannot be found.");
+if(!Core::$user->hasPermission($project)) throw new Exception("You do not have permission to access this resource.");
+
+try {
+
+	switch($action) {
+		case "mark-finished":
+			$project->markFinished();
+			$message = "The project has been marked as finished.";
+			break;
+		case "mark-unfinished":
+			$project->markUnfinished();
+			$message = "The project has been marked as unfinished.";
+			break;
+	}
+
+	Core::addAlert("success", $message);
+}
+catch(Exception $e) {
+	Core::addAlert("danger", $e->getMessage());
+}
+
+HTTP::redirect($project->getURL());

+ 18 - 18
controllers/register.php

@@ -2,13 +2,13 @@
 
 
 if(Core::$user) HTTP::redirect("/account");
 if(Core::$user) HTTP::redirect("/account");
 
 
-$page_title = _("Register");
+$page_title = __("Register");
 
 
 Core::addBreadcrumb("/register", $page_title);
 Core::addBreadcrumb("/register", $page_title);
 
 
 $user = new User;
 $user = new User;
 $user_address = new UserAddress();
 $user_address = new UserAddress();
-$user_address->name = _("Current Residence");
+$user_address->name = __("Current Residence");
 $user_address->country = DEFAULT_COUNTRY;
 $user_address->country = DEFAULT_COUNTRY;
 
 
 try {
 try {
@@ -22,7 +22,7 @@ try {
 		$password = http::value("password");
 		$password = http::value("password");
 		$password_confirm = http::value("password_confirm");
 		$password_confirm = http::value("password_confirm");
 
 
-		if($password != $password_confirm) $form_exception->addError(_("Passwords do not match."));
+		if($password != $password_confirm) $form_exception->addError(__("Passwords do not match."));
 
 
 		$user->email = http::value("email", "email");
 		$user->email = http::value("email", "email");
 		$user->password = password_hash($password, PASSWORD_DEFAULT, ["cost" => 14]);
 		$user->password = password_hash($password, PASSWORD_DEFAULT, ["cost" => 14]);
@@ -44,21 +44,21 @@ try {
 		$referrer = User::get($referrer_id);
 		$referrer = User::get($referrer_id);
 		if($referrer) $user->referrer_id = $referrer_id;
 		if($referrer) $user->referrer_id = $referrer_id;
 
 
-		if(!Form::checkRecaptcha()) $form_exception->addError(_("reCAPTCHA check failed."));
-		if(!User::validatePassword($password)) $form_exception->addError(_("Password must be at least 6 characters in length and contain at least one lowercase, uppercase, number and special character."));
-		if(empty($user->email)) $form_exception->addError(_("Email address is invalid."));
-		if(empty($user->title)) $form_exception->addError(_("Title is required."));
-		if(empty($user->first_name)) $form_exception->addError(_("First name is required."));
-		if(empty($user->last_name)) $form_exception->addError(_("Last name is required."));
-		if(empty($user->date_of_birth)) $form_exception->addError(_("Date of birth is required."));
-		if(empty($user->phone)) $form_exception->addError(_("Mobile number is required."));
-		if(empty($user->terms_accepted)) $form_exception->addError(_("Acceptance of Terms and Conditions is required."));
+		if(!Form::checkRecaptcha()) $form_exception->addError(__("reCAPTCHA check failed."));
+		if(!User::validatePassword($password)) $form_exception->addError(__("Password must be at least 6 characters in length and contain at least one lowercase, uppercase, number and special character."));
+		if(empty($user->email)) $form_exception->addError(__("Email address is invalid."));
+		if(empty($user->title)) $form_exception->addError(__("Title is required."));
+		if(empty($user->first_name)) $form_exception->addError(__("First name is required."));
+		if(empty($user->last_name)) $form_exception->addError(__("Last name is required."));
+		if(empty($user->date_of_birth)) $form_exception->addError(__("Date of birth is required."));
+		if(empty($user->phone)) $form_exception->addError(__("Mobile number is required."));
+		if(empty($user->terms_accepted)) $form_exception->addError(__("Acceptance of Terms and Conditions is required."));
 
 
-		if(empty($user_address->postal_code)) $form_exception->addError(_("Postal code is required."));
-		if(empty($user_address->country)) $form_exception->addError(_("Country is required."));
+		if(empty($user_address->postal_code)) $form_exception->addError(__("Postal code is required."));
+		if(empty($user_address->country)) $form_exception->addError(__("Country is required."));
 
 
 		$email_exists = User::query(["email" => $user->email]);
 		$email_exists = User::query(["email" => $user->email]);
-		if($email_exists) $form_exception->addError(_("Email address is already registered."));
+		if($email_exists) $form_exception->addError(__("Email address is already registered."));
 
 
 		// Geocode the postal code
 		// Geocode the postal code
 		try {
 		try {
@@ -79,7 +79,7 @@ try {
 			$user_address->longitude = $result->geometry->location->lng;
 			$user_address->longitude = $result->geometry->location->lng;
 		}
 		}
 		catch(Exception $e) {
 		catch(Exception $e) {
-			$form_exception->addError(_("Failed to get location from postal code and country."));
+			$form_exception->addError(__("Failed to get location from postal code and country."));
 		}
 		}
 
 
 		if($form_exception->hasErrors()) {
 		if($form_exception->hasErrors()) {
@@ -88,14 +88,14 @@ try {
 
 
 		// OK
 		// OK
 		$success = $user->commit();
 		$success = $user->commit();
-		if(!$success) throw new Exception(_("Registration failed. Please try again later."));
+		if(!$success) throw new Exception(__("Registration failed. Please try again later."));
 
 
 		$user_address->user_id = $user->id;
 		$user_address->user_id = $user->id;
 		$success = $user_address->commit();
 		$success = $user_address->commit();
 
 
 		$user->sendActivationEmail();
 		$user->sendActivationEmail();
 
 
-		Core::addAlert("success", _("Registration successful. An email has been sent to verify your email address. Please follow the instructions in the email before logging in."));
+		Core::addAlert("success", __("Registration successful. An email has been sent to verify your email address. Please follow the instructions in the email before logging in."));
 		HTTP::redirect("/log-in");
 		HTTP::redirect("/log-in");
 	}
 	}
 }
 }

+ 2 - 2
controllers/reports_presentation.php

@@ -13,8 +13,8 @@ $presentation = new PhpPresentation(); // 960x720
 $slide = $presentation->getActiveSlide();
 $slide = $presentation->getActiveSlide();
 
 
 $shape = $slide->createDrawingShape();
 $shape = $slide->createDrawingShape();
-$shape->setName("Check Policy logo")
-	  ->setDescription("Check Policy logo")
+$shape->setName(APP_NAME . " logo")
+	  ->setDescription(APP_NAME . " logo")
 	  ->setPath("./public/img/logo.png")
 	  ->setPath("./public/img/logo.png")
 	  ->setWidth(200)
 	  ->setWidth(200)
 	  ->setOffsetX(380)
 	  ->setOffsetX(380)

+ 8 - 8
controllers/reset_password.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Reset Password");
+$page_title = __("Reset Password");
 
 
 Core::addBreadcrumb("/reset-password", $page_title);
 Core::addBreadcrumb("/reset-password", $page_title);
 
 
@@ -11,7 +11,7 @@ if($token) {
 		"reset_token" => $token
 		"reset_token" => $token
 	]);
 	]);
 
 
-	if(!$user) throw new Exception(_("Invalid reset token."));
+	if(!$user) throw new Exception(__("Invalid reset token."));
 
 
 	$submit = http::value("submit");
 	$submit = http::value("submit");
 	if($submit) {
 	if($submit) {
@@ -23,8 +23,8 @@ if($token) {
 			$password = http::value("password");
 			$password = http::value("password");
 			$password_confirm = http::value("password_confirm");
 			$password_confirm = http::value("password_confirm");
 
 
-			if($password != $password_confirm) $form_exception->addError(_("Passwords do not match."));
-			if(!User::validatePassword($password)) $form_exception->addError(_("Password must be at least 6 characters in length and contain at least one lowercase, uppercase, number and special character."));
+			if($password != $password_confirm) $form_exception->addError(__("Passwords do not match."));
+			if(!User::validatePassword($password)) $form_exception->addError(__("Password must be at least 6 characters in length and contain at least one lowercase, uppercase, number and special character."));
 
 
 			if($form_exception->hasErrors()) throw $form_exception;
 			if($form_exception->hasErrors()) throw $form_exception;
 
 
@@ -32,7 +32,7 @@ if($token) {
 
 
 			$success = $user->commit();
 			$success = $user->commit();
 
 
-			Core::addAlert("success", _("Password reset successfully. You can now log in."));
+			Core::addAlert("success", __("Password reset successfully. You can now log in."));
 			HTTP::redirect("/log-in");
 			HTTP::redirect("/log-in");
 		}
 		}
 		catch(FormException $e) {
 		catch(FormException $e) {
@@ -53,8 +53,8 @@ else {
 			$form_exception = new FormException;
 			$form_exception = new FormException;
 
 
 			$email = http::value("email", "email");
 			$email = http::value("email", "email");
-			if(!Form::checkRecaptcha()) $form_exception->addError(_("reCAPTCHA check failed."));
-			if(empty($email)) $form_exception->addError(_("Invalid email address."));
+			if(!Form::checkRecaptcha()) $form_exception->addError(__("reCAPTCHA check failed."));
+			if(empty($email)) $form_exception->addError(__("Invalid email address."));
 			if($form_exception->hasErrors()) throw $form_exception;
 			if($form_exception->hasErrors()) throw $form_exception;
 
 
 			$user = User::queryOne(["email" => db::escape($email)]);
 			$user = User::queryOne(["email" => db::escape($email)]);
@@ -65,7 +65,7 @@ else {
 				sleep(2);
 				sleep(2);
 			}
 			}
 
 
-			Core::addAlert("success", _("A password reset email has been sent to the address provided if an account exists. Follow the instructions in the email to reset your password."));
+			Core::addAlert("success", __("A password reset email has been sent to the address provided if an account exists. Follow the instructions in the email to reset your password."));
 			HTTP::redirect("/log-in");
 			HTTP::redirect("/log-in");
 		}
 		}
 		catch(FormException $e) {
 		catch(FormException $e) {

+ 1 - 1
controllers/services.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Services");
+$page_title = __("Services");
 
 
 Core::addBreadcrumb("/services", $page_title);
 Core::addBreadcrumb("/services", $page_title);
 
 

+ 13 - 13
controllers/settings.php

@@ -1,8 +1,8 @@
 <?php
 <?php
 
 
-$page_title = _("Settings");
+$page_title = __("Settings");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/settings", $page_title);
 Core::addBreadcrumb("/account/settings", $page_title);
 
 
 $user = Core::$user;
 $user = Core::$user;
@@ -18,7 +18,7 @@ if($submit) {
 		$password = http::value("password");
 		$password = http::value("password");
 		$password_confirm = http::value("password_confirm");
 		$password_confirm = http::value("password_confirm");
 
 
-		if($password != $password_confirm) $form_exception->addError(_("Passwords do not match."));
+		if($password != $password_confirm) $form_exception->addError(__("Passwords do not match."));
 		if($password) {
 		if($password) {
 			$user->password = password_hash($password, PASSWORD_DEFAULT, ["cost" => 14]);
 			$user->password = password_hash($password, PASSWORD_DEFAULT, ["cost" => 14]);
 		}
 		}
@@ -40,15 +40,15 @@ if($submit) {
 
 
 		$locales = Core::locales();
 		$locales = Core::locales();
 
 
-		if($password && !User::validatePassword($password)) $form_exception->addError(_("Password must be at least 6 characters in length and contain at least one lowercase, uppercase, number and special character."));
-		if(empty($user->email)) $form_exception->addError(_("Email address is invalid."));
-		if(empty($user->title)) $form_exception->addError(_("Title is required."));
-		if(empty($user->first_name)) $form_exception->addError(_("First name is required."));
-		if(empty($user->last_name)) $form_exception->addError(_("Last name is required."));
-		if(empty($user->date_of_birth)) $form_exception->addError(_("Date of birth is required."));
-		if(empty($user->phone)) $form_exception->addError(_("Mobile number is required."));
-		if(!isset(User::PAYMENT_METHODS[$user->preferred_payment_method])) $form_exception->addError(_("Invalid payment method selected."));
-		if(!isset($locales[$user->locale])) $form_exception->addError(_("Invalid language selected."));
+		if($password && !User::validatePassword($password)) $form_exception->addError(__("Password must be at least 6 characters in length and contain at least one lowercase, uppercase, number and special character."));
+		if(empty($user->email)) $form_exception->addError(__("Email address is invalid."));
+		if(empty($user->title)) $form_exception->addError(__("Title is required."));
+		if(empty($user->first_name)) $form_exception->addError(__("First name is required."));
+		if(empty($user->last_name)) $form_exception->addError(__("Last name is required."));
+		if(empty($user->date_of_birth)) $form_exception->addError(__("Date of birth is required."));
+		if(empty($user->phone)) $form_exception->addError(__("Mobile number is required."));
+		if(!isset(User::PAYMENT_METHODS[$user->preferred_payment_method])) $form_exception->addError(__("Invalid payment method selected."));
+		if(!isset($locales[$user->locale])) $form_exception->addError(__("Invalid language selected."));
 
 
 		// Activation
 		// Activation
 		$deactivate = http::value("deactivate");
 		$deactivate = http::value("deactivate");
@@ -65,7 +65,7 @@ if($submit) {
 
 
 		$success = $user->commit();
 		$success = $user->commit();
 
 
-		Core::addAlert("success", _("Settings saved successfully."));
+		Core::addAlert("success", __("Settings saved successfully."));
 		HTTP::redirect("/account/settings");
 		HTTP::redirect("/account/settings");
 	}
 	}
 	catch(FormException $e) {
 	catch(FormException $e) {

+ 8 - 8
controllers/submit_id.php

@@ -1,8 +1,8 @@
 <?php
 <?php
 
 
-$page_title = _("Submit ID");
+$page_title = __("Submit ID");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/submit-id", $page_title);
 Core::addBreadcrumb("/account/submit-id", $page_title);
 
 
 $submit = http::value("submit");
 $submit = http::value("submit");
@@ -22,14 +22,14 @@ if($submit) {
 		if($photo->error != UPLOAD_ERR_OK) $form_exception->addError(HTTP::getUploadErrorString($photo->error));
 		if($photo->error != UPLOAD_ERR_OK) $form_exception->addError(HTTP::getUploadErrorString($photo->error));
 
 
 		$size = @getimagesize($id_document->tmp_name);
 		$size = @getimagesize($id_document->tmp_name);
-		if(!$size) $form_exception->addError(_("The uploaded ID document is not an image."));
+		if(!$size) $form_exception->addError(__("The uploaded ID document is not an image."));
 		list($width, $height, $type) = $size;
 		list($width, $height, $type) = $size;
-		if($type != IMAGETYPE_JPEG) $form_exception->addError(_("The uploaded ID document is not a JPEG."));
+		if($type != IMAGETYPE_JPEG) $form_exception->addError(__("The uploaded ID document is not a JPEG."));
 
 
 		$size = @getimagesize($photo->tmp_name);
 		$size = @getimagesize($photo->tmp_name);
-		if(!$size) $form_exception->addError(_("The uploaded photo is not an image."));
+		if(!$size) $form_exception->addError(__("The uploaded photo is not an image."));
 		list($width, $height, $type) = $size;
 		list($width, $height, $type) = $size;
-		if($type != IMAGETYPE_JPEG) $form_exception->addError(_("The uploaded photo is not a JPEG."));
+		if($type != IMAGETYPE_JPEG) $form_exception->addError(__("The uploaded photo is not a JPEG."));
 
 
 		if($form_exception->hasErrors()) throw $form_exception;
 		if($form_exception->hasErrors()) throw $form_exception;
 
 
@@ -53,7 +53,7 @@ if($submit) {
 			$user_file->dts_uploaded = Util::getDateTime();
 			$user_file->dts_uploaded = Util::getDateTime();
 
 
 			$success = $user_file->commit();
 			$success = $user_file->commit();
-			if(!$success) throw new Exception(sprintf(_("Failed to save the %s. Please try again later."), $name));
+			if(!$success) throw new Exception(sprintf(__("Failed to save the %s. Please try again later."), $name));
 
 
 			$output_path = $user->getDirectory() . "/" . $user_file->id . ".jpg";
 			$output_path = $user->getDirectory() . "/" . $user_file->id . ".jpg";
 
 
@@ -67,7 +67,7 @@ if($submit) {
 
 
 		// TODO: Send out pending verification email
 		// TODO: Send out pending verification email
 
 
-		Core::addAlert("success", _("ID submitted successfully."));
+		Core::addAlert("success", __("ID submitted successfully."));
 		HTTP::redirect("/account");
 		HTTP::redirect("/account");
 	}
 	}
 	catch(FormException $e) {
 	catch(FormException $e) {

+ 12 - 7
controllers/template_add.php

@@ -11,7 +11,6 @@ Core::addBreadcrumb("/account/templates?customer_id=$customer->id", "$customer->
 
 
 Core::addBreadcrumb($_SERVER["REQUEST_URI"], $page_title);
 Core::addBreadcrumb($_SERVER["REQUEST_URI"], $page_title);
 
 
-
 $template = new Template;
 $template = new Template;
 $template->customer_id = $customer->id;
 $template->customer_id = $customer->id;
 $template->json = "";
 $template->json = "";
@@ -25,14 +24,22 @@ if($submit) {
 
 
 		$template->name = http::value("name", "trim");
 		$template->name = http::value("name", "trim");
 		$template->json = http::value("json", "trim");
 		$template->json = http::value("json", "trim");
+		$template->json_file = http::value("json_file", "trim");
 		$template->practice = http::value("practice", "int");
 		$template->practice = http::value("practice", "int");
 
 
 		if(empty($template->name)) $form_exception->addError("Name is required.");
 		if(empty($template->name)) $form_exception->addError("Name is required.");
-		if(empty($template->json)) $form_exception->addError("JSON is required.");
+		if(empty($template->json) && empty($template->json_file)) $form_exception->addError("JSON or JSON File is required.");
+
+		if($template->json) {
+			$json = json_decode($template->json);
+			if(!$json) {
+				$form_exception->addError("JSON error: " . json_last_error_msg());
+			}
+		}
 
 
-		$json = json_decode($template->json);
-		if(!$json) {
-			$form_exception->addError("JSON error: " . json_last_error_msg());
+		if($template->json_file) {
+			$path = ROOT_DIR . "/json/" . $template->json_file;
+			if(!file_exists($path)) $form_exception->addError("JSON file does not exist.");
 		}
 		}
 
 
 		if($form_exception->hasErrors()) throw $form_exception;
 		if($form_exception->hasErrors()) throw $form_exception;
@@ -53,5 +60,3 @@ if($submit) {
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));
 View::include("template_form", compact("page_title", "template"));
 View::include("template_form", compact("page_title", "template"));
 View::includeOnce("footer");
 View::includeOnce("footer");
-
-?>

+ 12 - 6
controllers/template_edit.php

@@ -22,14 +22,22 @@ if($submit) {
 
 
 		$template->name = http::value("name", "trim");
 		$template->name = http::value("name", "trim");
 		$template->json = http::value("json", "trim");
 		$template->json = http::value("json", "trim");
+		$template->json_file = http::value("json_file", "trim");
 		$template->practice = http::value("practice", "int");
 		$template->practice = http::value("practice", "int");
 
 
 		if(empty($template->name)) $form_exception->addError("Name is required.");
 		if(empty($template->name)) $form_exception->addError("Name is required.");
-		if(empty($template->json)) $form_exception->addError("JSON is required.");
+		if(empty($template->json) && empty($template->json_file)) $form_exception->addError("JSON or JSON File is required.");
 
 
-		$json = json_decode($template->json);
-		if(!$json) {
-			$form_exception->addError("JSON error: " . json_last_error_msg());
+		if($template->json) {
+			$json = json_decode($template->json);
+			if(!$json) {
+				$form_exception->addError("JSON error: " . json_last_error_msg());
+			}
+		}
+
+		if($template->json_file) {
+			$path = ROOT_DIR . "/json/" . $template->json_file;
+			if(!file_exists($path)) $form_exception->addError("JSON file does not exist.");
 		}
 		}
 
 
 		if($form_exception->hasErrors()) throw $form_exception;
 		if($form_exception->hasErrors()) throw $form_exception;
@@ -50,5 +58,3 @@ if($submit) {
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));
 View::include("template_form", compact("page_title", "template"));
 View::include("template_form", compact("page_title", "template"));
 View::includeOnce("footer");
 View::includeOnce("footer");
-
-?>

+ 2 - 2
controllers/terms_accept.php

@@ -3,9 +3,9 @@
 $user = Core::$user;
 $user = Core::$user;
 $user->terms_accepted = 1;
 $user->terms_accepted = 1;
 $success = $user->commit();
 $success = $user->commit();
-if(!$success) throw new Exception(_("Failed to update our records. Please try again later."));
+if(!$success) throw new Exception(__("Failed to update our records. Please try again later."));
 
 
-Core::addAlert("success", _("Terms & Conditions accepted successfully."));
+Core::addAlert("success", __("Terms & Conditions accepted successfully."));
 
 
 HTTP::redirect("/account");
 HTTP::redirect("/account");
 
 

+ 1 - 1
controllers/terms_and_conditions.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-$page_title = _("Terms & Conditions");
+$page_title = __("Terms & Conditions");
 
 
 Core::addBreadcrumb("/terms-and-conditions", $page_title);
 Core::addBreadcrumb("/terms-and-conditions", $page_title);
 
 

+ 3 - 3
controllers/terms_decline.php

@@ -1,14 +1,14 @@
 <?php
 <?php
 
 
-$page_title = _("Decline Terms & Conditions");
+$page_title = __("Decline Terms & Conditions");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/decline-terms", $page_title);
 Core::addBreadcrumb("/account/decline-terms", $page_title);
 
 
 $user = Core::$user;
 $user = Core::$user;
 $user->terms_accepted = 0;
 $user->terms_accepted = 0;
 $success = $user->commit();
 $success = $user->commit();
-if(!$success) throw new Exception(_("Failed to update our records. Please try again later."));
+if(!$success) throw new Exception(__("Failed to update our records. Please try again later."));
 
 
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));
 View::include("terms_decline");
 View::include("terms_decline");

+ 24 - 18
controllers/test.php

@@ -3,7 +3,7 @@
 Core::addScript("public/js/app-test.js");
 Core::addScript("public/js/app-test.js");
 
 
 $test = Test::get($id);
 $test = Test::get($id);
-if(!$test) throw new Exception(_("Test cannot be found."));
+if(!$test) throw new Exception(__("Test cannot be found."));
 
 
 $is_confirmed = $test->status == Test::STATUS_CONFIRMED;
 $is_confirmed = $test->status == Test::STATUS_CONFIRMED;
 $is_started = $test->status == Test::STATUS_STARTED;
 $is_started = $test->status == Test::STATUS_STARTED;
@@ -31,8 +31,8 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 
 
 	Core::$show_footer_content = false;
 	Core::$show_footer_content = false;
 
 
-	if(Core::$user->id != $test->tester_id) throw new Exception(_("You do not have permission to view this page."));
-	if($test->status == Test::STATUS_ASSIGNED) throw new Exception(_("You do not have permission to view this page as you have not accepted the test yet."));
+	if(Core::$user->id != $test->tester_id) throw new Exception(__("You do not have permission to view this page."));
+	if($test->status == Test::STATUS_ASSIGNED) throw new Exception(__("You do not have permission to view this page as you have not accepted the test yet."));
 
 
 	// Show completed message
 	// Show completed message
 	if($test->status > Test::STATUS_PENDING_VERIFICATION) {
 	if($test->status > Test::STATUS_PENDING_VERIFICATION) {
@@ -42,7 +42,7 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 		return;
 		return;
 	}
 	}
 
 
-	$json = json_decode($template->json);
+	$json = json_decode($template->getJSON());
 
 
 	$submit = http::value("submit");
 	$submit = http::value("submit");
 	if($submit) {
 	if($submit) {
@@ -76,14 +76,14 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 						$start_unix = strtotime($start_override);
 						$start_unix = strtotime($start_override);
 						$end_unix = strtotime($end_override);
 						$end_unix = strtotime($end_override);
 
 
-						if($start_unix > $end_unix) $form_exception->addError(_("Entry Time must not be after Exit Time."));
+						if($start_unix > $end_unix) $form_exception->addError(__("Entry Time must not be after Exit Time."));
 						if(!$start_unix && $end_unix && $test->dts_start) {
 						if(!$start_unix && $end_unix && $test->dts_start) {
 							$recorded_start_unix = Util::getUnixTimeFromUTC($test->dts_start);
 							$recorded_start_unix = Util::getUnixTimeFromUTC($test->dts_start);
-							if($end_unix < $recorded_start_unix) $form_exception->addError(_("Exit Time cannot be later than the recorded Entry Time."));
+							if($end_unix < $recorded_start_unix) $form_exception->addError(__("Exit Time cannot be later than the recorded Entry Time."));
 						}
 						}
 					}
 					}
 					else {
 					else {
-						$form_exception->addError(_("Entry Time and Exit Time must be filled in."));
+						$form_exception->addError(__("Entry Time and Exit Time must be filled in."));
 					}
 					}
 
 
 				}
 				}
@@ -114,9 +114,9 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 
 
 						// Get image details
 						// Get image details
 						$size = @getimagesize($file->tmp_name);
 						$size = @getimagesize($file->tmp_name);
-						if(!$size) throw new Exception(sprintf(_("The uploaded file for %s is not an image."), $label));
+						if(!$size) throw new Exception(sprintf(__("The uploaded file for %s is not an image."), $label));
 						list($width, $height, $type) = $size;
 						list($width, $height, $type) = $size;
-						if($type != IMAGETYPE_JPEG) throw new Exception(sprintf(_("The uploaded file for %s is not a JPEG."), $label));
+						if($type != IMAGETYPE_JPEG) throw new Exception(sprintf(__("The uploaded file for %s is not a JPEG."), $label));
 
 
 						// Resize image
 						// Resize image
 						$output_image = Image::normalise($file->tmp_name);
 						$output_image = Image::normalise($file->tmp_name);
@@ -134,8 +134,8 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 				else {
 				else {
 					$value = http::value($name, "trim");
 					$value = http::value($name, "trim");
 
 
-					if($required && empty($value)) $form_exception->addError(sprintf(_("%s is required."), $label));
-					if($values && !in_array($value, $values)) $form_exception->addError(sprintf(_("Value for %s is invalid."), $label));
+					if($required && empty($value)) $form_exception->addError(sprintf(__("%s is required."), $label));
+					if($values && !in_array($value, $values)) $form_exception->addError(sprintf(__("Value for %s is invalid."), $label));
 
 
 					if(in_array($name, Test::TEST_FIELDS)) {
 					if(in_array($name, Test::TEST_FIELDS)) {
 						$test->$name = $value;
 						$test->$name = $value;
@@ -149,7 +149,7 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 						}
 						}
 						$test_value->value = $value;
 						$test_value->value = $value;
 						$success = $test_value->commit();
 						$success = $test_value->commit();
-						if(!$success) $form_exception->addError(sprintf(_("Failed to save value for %s."), $label));
+						if(!$success) $form_exception->addError(sprintf(__("Failed to save value for %s."), $label));
 					}
 					}
 				}
 				}
 
 
@@ -165,9 +165,9 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 				$test->dts_start = Util::getDateTime();
 				$test->dts_start = Util::getDateTime();
 				$test->dts_updated = Util::getDateTime();
 				$test->dts_updated = Util::getDateTime();
 				$success = $test->commit();
 				$success = $test->commit();
-				if(!$success) throw new Exception(_("Failed to save test. Please try again later."));
+				if(!$success) throw new Exception(__("Failed to save test. Please try again later."));
 
 
-				Core::addAlert("success", _("Photos uploaded successfully."));
+				Core::addAlert("success", __("Photos uploaded successfully."));
 
 
 				HTTP::redirect("/account/tests/$id");
 				HTTP::redirect("/account/tests/$id");
 
 
@@ -191,7 +191,7 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 				$test->dts_updated = Util::getDateTime();
 				$test->dts_updated = Util::getDateTime();
 
 
 				$success = $test->commit();
 				$success = $test->commit();
-				if(!$success) throw new Exception(_("Failed to save test. Please try again later."));
+				if(!$success) throw new Exception(__("Failed to save test. Please try again later."));
 
 
 				JSON::success();
 				JSON::success();
 			}
 			}
@@ -228,7 +228,7 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 // Verify test
 // Verify test
 else if(Core::$user->level >= User::LEVEL_ADMIN) {
 else if(Core::$user->level >= User::LEVEL_ADMIN) {
 
 
-	$json = json_decode($template->json);
+	$json = json_decode($template->getJSON());
 	$fields = array_merge($json->beforeTest, $json->duringTest);
 	$fields = array_merge($json->beforeTest, $json->duringTest);
 	$values = $test->getValues();
 	$values = $test->getValues();
 
 
@@ -305,9 +305,15 @@ else if(Core::$user->level >= User::LEVEL_ADMIN) {
 				$test->dts_end = Util::getDateTime($unix_end);
 				$test->dts_end = Util::getDateTime($unix_end);
 			}
 			}
 
 
+			$test->customer_fee = null;
+			$customer_fee = http::value("customer_fee", "float");
+			if($customer_fee !== false && $customer_fee != $project->default_customer_fee) {
+				$test->customer_fee = $customer_fee;
+			}
+
 			$test->test_fee = null;
 			$test->test_fee = null;
 			$tester_fee = http::value("tester_fee", "float");
 			$tester_fee = http::value("tester_fee", "float");
-			if($tester_fee != $project->default_tester_fee) {
+			if($tester_fee !== false && $tester_fee != $project->default_tester_fee) {
 				$test->test_fee = $tester_fee;
 				$test->test_fee = $tester_fee;
 			}
 			}
 
 
@@ -451,7 +457,7 @@ else if(Core::$user->level >= User::LEVEL_VENUE) {
 	HTTP::redirect("/account/tests/$id/result");
 	HTTP::redirect("/account/tests/$id/result");
 }
 }
 else {
 else {
-	throw new Exception(_("Invalid request."));
+	throw new Exception(__("Invalid request."));
 }
 }
 
 
 ?>
 ?>

+ 6 - 6
controllers/test_confirm.php

@@ -1,9 +1,9 @@
 <?php
 <?php
 
 
 $test = Test::get($id);
 $test = Test::get($id);
-if(!$test) throw new Exception(_("Test not found."));
-if($test->tester_id != Core::$user->id) throw new Exception(_("You do not have permission to view this page."));
-if($test->status > Test::STATUS_ASSIGNED) throw new Exception(_("The test has already been accepted or declined."));
+if(!$test) throw new Exception(__("Test not found."));
+if($test->tester_id != Core::$user->id) throw new Exception(__("You do not have permission to view this page."));
+if($test->status > Test::STATUS_ASSIGNED) throw new Exception(__("The test has already been accepted or declined."));
 
 
 switch($action) {
 switch($action) {
 	case "accept":
 	case "accept":
@@ -12,7 +12,7 @@ switch($action) {
 		$test->dts_updated = Util::getDateTime();
 		$test->dts_updated = Util::getDateTime();
 		$test->commit();
 		$test->commit();
 
 
-		Core::addAlert("success", _("Test accepted successfully."));
+		Core::addAlert("success", __("Test accepted successfully."));
 		HTTP::redirect("/account/tests");
 		HTTP::redirect("/account/tests");
 
 
 		break;
 		break;
@@ -21,12 +21,12 @@ switch($action) {
 
 
 		$test->decline();
 		$test->decline();
 
 
-		Core::addAlert("success", _("Test declined successfully."));
+		Core::addAlert("success", __("Test declined successfully."));
 		HTTP::redirect("/account/tests");
 		HTTP::redirect("/account/tests");
 
 
 		break;
 		break;
 	default:
 	default:
-		throw new Exception(_("Invalid action."));
+		throw new Exception(__("Invalid action."));
 }
 }
 
 
 
 

+ 2 - 2
controllers/test_file.php

@@ -1,10 +1,10 @@
 <?php
 <?php
 
 
 $test = Test::get($id);
 $test = Test::get($id);
-if(!$test) throw new Exception(_("Test not found."));
+if(!$test) throw new Exception(__("Test not found."));
 
 
 if(Core::$user->level < User::LEVEL_ADMIN) {
 if(Core::$user->level < User::LEVEL_ADMIN) {
-	if(Core::$user->id != $test->tester_id) throw new Exception(_("You do not have permission to access this resource."));
+	if(Core::$user->id != $test->tester_id) throw new Exception(__("You do not have permission to access this resource."));
 }
 }
 
 
 $directory = $test->getDirectory();
 $directory = $test->getDirectory();

+ 23 - 18
controllers/test_invoice.php

@@ -3,9 +3,9 @@
 use \Mpdf\Mpdf;
 use \Mpdf\Mpdf;
 
 
 $test = Test::get($id);
 $test = Test::get($id);
-if(!$test) throw new Exception(_("Test not found."));
-if($test->status != Test::STATUS_COMPLETED) throw new Exception(_("An invoice cannot be generated for this test yet."));
-if(Core::$user->id != $test->tester_id && !Core::$user->canAdmin()) throw new Exception(_("You do not have permission to access this resource."));
+if(!$test) throw new Exception(__("Test not found."));
+if($test->status != Test::STATUS_COMPLETED) throw new Exception(__("An invoice cannot be generated for this test yet."));
+if(Core::$user->id != $test->tester_id && !Core::$user->canAdmin()) throw new Exception(__("You do not have permission to access this resource."));
 
 
 $project = $test->getProject();
 $project = $test->getProject();
 $template = $project->getTemplate();
 $template = $project->getTemplate();
@@ -15,19 +15,25 @@ $values = $test->getValues(true);
 
 
 $location_address = $location->name . ", " . $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]);
 $location_address = $location->name . ", " . $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]);
 
 
+// Base cost
 $fee = floatval($test->test_fee) > 0 ? $test->test_fee : $project->default_tester_fee;
 $fee = floatval($test->test_fee) > 0 ? $test->test_fee : $project->default_tester_fee;
 $fee = (float) $fee;
 $fee = (float) $fee;
 
 
-$play_spent = (float) ($values["play_spent"] ?? 0);
 $travel_cost = (float) http::value("travel_cost", "float");
 $travel_cost = (float) http::value("travel_cost", "float");
+$test->test_travel_cost = $travel_cost;
 
 
-$invoice_total = $fee + $play_spent + $travel_cost;
+$invoice_total = $fee + $travel_cost;
 
 
-$test->test_travel_cost = $travel_cost;
+// Additional tester invoice fields
+$tester_invoice_fields = $template->getTesterInvoiceFields();
+foreach($tester_invoice_fields as $field) {
+	$invoice_total += (float) $values[$field->name] ?? 0;
+}
 
 
+// Get invoice address
 $address = $tester->getInvoiceAddress();
 $address = $tester->getInvoiceAddress();
-if(!$address) throw new Exception(_("Invoice address not found. Please set an address as the invoice address then try again."));
-if(!$tester->hasValidPaymentMethod()) throw new Exception(_("No valid payment method found. Please go to the Settings page and make sure all respective fields are filled in and then try again."));
+if(!$address) throw new Exception(__("Invoice address not found. Please set an address as the invoice address then try again."));
+if(!$tester->hasValidPaymentMethod()) throw new Exception(__("No valid payment method found. Please go to the Settings page and make sure all respective fields are filled in and then try again."));
 
 
 // Filename
 // Filename
 $reference =
 $reference =
@@ -56,12 +62,7 @@ $address_parts = array_filter([
 	$address->postal_code,
 	$address->postal_code,
 ]);
 ]);
 
 
-$bill_to_address_parts = [
-	"8 Market Street",
-	"Liskeard",
-	"Cornwall",
-	"PL14 3JJ",
-];
+$bill_to_address_parts = explode("\n", ADDRESS);
 
 
 list($date_start, $time_start) = explode(" ", $test->dts_start);
 list($date_start, $time_start) = explode(" ", $test->dts_start);
 list($date_end, $time_end) = explode(" ", $test->dts_end);
 list($date_end, $time_end) = explode(" ", $test->dts_end);
@@ -175,18 +176,22 @@ ob_start();
 					<td align="right" valign="top">£<?=number_format($fee, 2)?></td>
 					<td align="right" valign="top">£<?=number_format($fee, 2)?></td>
 				</tr>
 				</tr>
 				<?php
 				<?php
-				if($play_spent) {
+
+				foreach($tester_invoice_fields as $field) {
+					$value = $values[$field->name] ?? 0;
+					if(!$value) continue;
 					?>
 					?>
 					<tr>
 					<tr>
 						<td>
 						<td>
-							<strong>Play Costs</strong>
+							<strong><?=htmlspecialchars($field->label)?></strong>
 						</td>
 						</td>
 						<td align="right" valign="top">1</td>
 						<td align="right" valign="top">1</td>
-						<td align="right" valign="top">£<?=number_format($play_spent, 2)?></td>
-						<td align="right" valign="top">£<?=number_format($play_spent, 2)?></td>
+						<td align="right" valign="top">£<?=number_format($value, 2)?></td>
+						<td align="right" valign="top">£<?=number_format($value, 2)?></td>
 					</tr>
 					</tr>
 					<?php
 					<?php
 				}
 				}
+
 				if($travel_cost) {
 				if($travel_cost) {
 					?>
 					?>
 					<tr>
 					<tr>

+ 5 - 5
controllers/test_pdf.php

@@ -5,7 +5,7 @@ use \Mpdf\Mpdf;
 // Controller may be included directly and $pdf can be accessed.
 // Controller may be included directly and $pdf can be accessed.
 
 
 $test = Test::get($id);
 $test = Test::get($id);
-if(!$test) throw new Exception(_("Test not found."));
+if(!$test) throw new Exception(__("Test not found."));
 
 
 $project = $test->getProject();
 $project = $test->getProject();
 $customer = $project->getCustomer();
 $customer = $project->getCustomer();
@@ -13,7 +13,7 @@ $customer = $project->getCustomer();
 $template = $project->getTemplate();
 $template = $project->getTemplate();
 $template->setOverrides($project->getTemplateOverrides());
 $template->setOverrides($project->getTemplateOverrides());
 
 
-$template_parts = json_decode($template->json);
+$template_parts = json_decode($template->getJSON());
 $fields = array_merge($template_parts->beforeTest, $template_parts->duringTest);
 $fields = array_merge($template_parts->beforeTest, $template_parts->duringTest);
 
 
 $field_name_label_map = [];
 $field_name_label_map = [];
@@ -179,9 +179,9 @@ ob_start()
 			<br />
 			<br />
 			<table width="100%">
 			<table width="100%">
 				<tr>
 				<tr>
-					<td width="33%"><strong>Check Policy Limited</strong></td>
-					<td width="33%" align="middle">8 Market Street, Liskeard, Cornwall, PL14 3JJ</td>
-					<td width="33%" align="right">Company Number: 09506865</td>
+					<td width="33%"><strong><?=htmlspecialchars(COMPANY_NAME)?></strong></td>
+					<td width="33%" align="middle"><?=htmlspecialchars(ADDRESS)?></td>
+					<td width="33%" align="right">Company Number: <?=htmlspecialchars(COMPANY_NUMBER)?></td>
 				</tr>
 				</tr>
 			</table>
 			</table>
 		</htmlpagefooter>
 		</htmlpagefooter>

+ 1 - 1
controllers/test_result.php

@@ -8,7 +8,7 @@ $project = $test->getProject();
 $tester = $test->getTester();
 $tester = $test->getTester();
 $template = $project->getTemplate();
 $template = $project->getTemplate();
 
 
-$json = json_decode($template->json);
+$json = json_decode($template->getJSON());
 $fields = array_merge($json->beforeTest, $json->duringTest);
 $fields = array_merge($json->beforeTest, $json->duringTest);
 $values = $test->getValues();
 $values = $test->getValues();
 
 

+ 2 - 2
controllers/tests.php

@@ -1,8 +1,8 @@
 <?php
 <?php
 
 
-$page_title = _("Tests");
+$page_title = __("Tests");
 
 
-Core::addBreadcrumb("/account", _("Account"));
+Core::addBreadcrumb("/account", __("Account"));
 Core::addBreadcrumb("/account/tests", $page_title);
 Core::addBreadcrumb("/account/tests", $page_title);
 
 
 $user = Core::$user;
 $user = Core::$user;

+ 4 - 4
controllers/tests_available.php

@@ -2,14 +2,14 @@
 
 
 Core::addScript("public/js/app-tests-available.js");
 Core::addScript("public/js/app-tests-available.js");
 
 
-$page_title = _("Find Tests");
+$page_title = __("Find Tests");
 
 
-Core::addBreadcrumb("/account", _("Account"));
-Core::addBreadcrumb("/account/tests", _("Tests"));
+Core::addBreadcrumb("/account", __("Account"));
+Core::addBreadcrumb("/account/tests", __("Tests"));
 Core::addBreadcrumb("/account/tests/available", $page_title);
 Core::addBreadcrumb("/account/tests/available", $page_title);
 
 
 $user = Core::$user;
 $user = Core::$user;
-if(!$user->can_claim) throw new Exception(_("You do not have permission to perform this action."));
+if(!$user->can_claim) throw new Exception(__("You do not have permission to perform this action."));
 
 
 $dts = date("Y-m-d H:i:s");
 $dts = date("Y-m-d H:i:s");
 
 

+ 9 - 9
controllers/tests_available_ajax.php

@@ -17,7 +17,7 @@ switch($action) {
 		]);
 		]);
 
 
 		try {
 		try {
-			if(!$test) throw new Exception(_("Test no longer available."));
+			if(!$test) throw new Exception(__("Test no longer available."));
 
 
 			$project = $test->getProject();
 			$project = $test->getProject();
 
 
@@ -26,11 +26,11 @@ switch($action) {
 			$unix_due = strtotime("$date_due 23:59:59");
 			$unix_due = strtotime("$date_due 23:59:59");
 
 
 			$user = Core::$user;
 			$user = Core::$user;
-			if($user->level == User::LEVEL_BANNED) throw new Exception(_("You are a banned tester."));
-			if($user->level == User::LEVEL_REGISTERED) throw new Exception(_("Your account is not verified."));
-			if($user->level == User::LEVEL_UNVERIFIED) throw new Exception(_("Your account is not verified."));
-			if($user->level == User::LEVEL_DEACTIVATED) throw new Exception(_("Your account is deactivated."));
-			if($user->level != User::LEVEL_TESTER) throw new Exception(_("You are not a tester."));
+			if($user->level == User::LEVEL_BANNED) throw new Exception(__("You are a banned tester."));
+			if($user->level == User::LEVEL_REGISTERED) throw new Exception(__("Your account is not verified."));
+			if($user->level == User::LEVEL_UNVERIFIED) throw new Exception(__("Your account is not verified."));
+			if($user->level == User::LEVEL_DEACTIVATED) throw new Exception(__("Your account is deactivated."));
+			if($user->level != User::LEVEL_TESTER) throw new Exception(__("You are not a tester."));
 
 
 			$test->status = Test::STATUS_CONFIRMED;
 			$test->status = Test::STATUS_CONFIRMED;
 			$test->tester_id = $user->id;
 			$test->tester_id = $user->id;
@@ -39,11 +39,11 @@ switch($action) {
 
 
 			if($unix_due) {
 			if($unix_due) {
 				$test->dts_due = "$date_due 23:59:59";
 				$test->dts_due = "$date_due 23:59:59";
-				if(strcmp($test->dts_due, $project->dts_start) < 0) throw new Exception(_("Too early."));
+				if(strcmp($test->dts_due, $project->dts_start) < 0) throw new Exception(__("Too early."));
 			}
 			}
 
 
 			$success = $test->commit();
 			$success = $test->commit();
-			if(!$success) throw new Exception(_("Test cannot be claimed, please try again later."));
+			if(!$success) throw new Exception(__("Test cannot be claimed, please try again later."));
 
 
 			$test->sendClaimedEmail();
 			$test->sendClaimedEmail();
 		}
 		}
@@ -79,7 +79,7 @@ switch($action) {
 
 
 		break;
 		break;
 	default:
 	default:
-		throw new Exception(_("Invalid action."));
+		throw new Exception(__("Invalid action."));
 }
 }
 
 
 JSON::success($response);
 JSON::success($response);

+ 3 - 3
controllers/tests_completed.php

@@ -2,10 +2,10 @@
 
 
 Core::addScript("public/js/app-completed-tests.js");
 Core::addScript("public/js/app-completed-tests.js");
 
 
-$page_title = _("Completed Tests");
+$page_title = __("Completed Tests");
 
 
-Core::addBreadcrumb("/account", _("Account"));
-Core::addBreadcrumb("/account/tests", _("Tests"));
+Core::addBreadcrumb("/account", __("Account"));
+Core::addBreadcrumb("/account/tests", __("Tests"));
 Core::addBreadcrumb("/account/tests/completed", $page_title);
 Core::addBreadcrumb("/account/tests/completed", $page_title);
 
 
 $tests = Core::$user->getCompletedTests();
 $tests = Core::$user->getCompletedTests();

+ 2 - 2
controllers/tests_tester_kml.php

@@ -13,9 +13,9 @@ header("Content-Disposition: attachment; filename=tests-$dts_slug.kml");
 $xml = simplexml_load_file(ROOT_DIR . "/files/empty.kml");
 $xml = simplexml_load_file(ROOT_DIR . "/files/empty.kml");
 
 
 $folder_node = $xml->addChild("Folder");
 $folder_node = $xml->addChild("Folder");
-$folder_node->addChild("name", _("Tests"));
+$folder_node->addChild("name", __("Tests"));
 $folder_node->addChild("open", 1);
 $folder_node->addChild("open", 1);
-$folder_node->addChild("description", sprintf(_("Test locations as of %s"), $dts));
+$folder_node->addChild("description", sprintf(__("Test locations as of %s"), $dts));
 
 
 foreach($locations as $location) {
 foreach($locations as $location) {
 	$placemark_node = $folder_node->addChild("Placemark");
 	$placemark_node = $folder_node->addChild("Placemark");

+ 3 - 3
controllers/user_activation.php

@@ -8,14 +8,14 @@ if($user && $user->activated == 0) {
 	$user->activated = 1;
 	$user->activated = 1;
 	$user->verify_token = null;
 	$user->verify_token = null;
 	$success = $user->commit();
 	$success = $user->commit();
-	if(!$success) throw new Exception(_("Email verification failed. Please try again later."));
+	if(!$success) throw new Exception(__("Email verification failed. Please try again later."));
 
 
 	$user->sendWelcomeEmail();
 	$user->sendWelcomeEmail();
 
 
-	Core::addAlert("success", _("Email address verified. You can now log in to your account."));
+	Core::addAlert("success", __("Email address verified. You can now log in to your account."));
 }
 }
 else {
 else {
-	Core::addAlert("danger", _("Invalid verification token. The user account may have already been activated or the token has expired. Please try again."));
+	Core::addAlert("danger", __("Invalid verification token. The user account may have already been activated or the token has expired. Please try again."));
 }
 }
 
 
 HTTP::redirect("/log-in");
 HTTP::redirect("/log-in");

+ 60 - 0
controllers/venue_type_form.php

@@ -0,0 +1,60 @@
+<?php
+
+Core::addBreadcrumb("/account", "Account");
+Core::addBreadcrumb("/account/venue-types", "Venue Types");
+
+if($action == "add") {
+	$venue_type = new VenueType;
+	$page_title = "New Venue Type";
+}
+
+if($action == "edit") {
+	$venue_type = VenueType::get($id);
+	if(!$venue_type) throw new Exception("Venue Type not found.");
+	$page_title = "Edit Venue Type";
+
+	Core::addBreadcrumb("/account/venue-types/$id/edit", $venue_type->name);
+
+}
+
+Core::addBreadcrumb($_SERVER["REQUEST_URI"], $page_title);
+
+$submit = http::value("submit");
+if($submit) {
+	try {
+		Core::validateCSRFToken($submit);
+
+		$form_exception = new FormException;
+
+		$venue_type->name = http::value("name", "trim");
+
+		if(empty($venue_type->name)) $form_exception->addError("Name is required.");
+
+		if($form_exception->hasErrors()) throw $form_exception;
+
+		$success = $venue_type->commit();
+
+		switch($action) {
+			case "add":
+				Core::addAlert("success", "Venue Type added successfully.");
+				HTTP::redirect("/account/venue-types");
+				break;
+			case "edit":
+				Core::addAlert("success", "Venue Type updated successfully.");
+				HTTP::redirect("/account/venue-types/{$venue_type->id}/edit");
+				break;
+		}
+
+
+	}
+	catch(FormException $e) {
+		$e->generateAlerts();
+	}
+	catch(Exception $e) {
+		Core::addAlert("danger", $e->getMessage());
+	}
+}
+
+View::includeOnce("header", compact("page_title"));
+View::include("venue_type_form", compact("page_title", "venue_type"));
+View::includeOnce("footer");

+ 12 - 0
controllers/venue_types.php

@@ -0,0 +1,12 @@
+<?php
+
+$page_title = "Venue Types";
+
+Core::addBreadcrumb("/account", "Account");
+Core::addBreadcrumb("/account/venue-types", $page_title);
+
+$venue_types = VenueType::getAll();
+
+View::includeOnce("header", compact("page_title"));
+View::include("venue_types", compact("venue_types"));
+View::includeOnce("footer");

+ 1 - 2
engine/customer.php

@@ -6,6 +6,7 @@ class Customer extends Model {
 	protected static $id_field = "id";
 	protected static $id_field = "id";
 	protected static $fillable_fields = ["name", "address_1", "address_2",
 	protected static $fillable_fields = ["name", "address_1", "address_2",
 		"city", "county", "postal_code", "country", "email", "phone",
 		"city", "county", "postal_code", "country", "email", "phone",
+		"invoice_contact_name",
 		"email_after_test", "email_locations_after_test",
 		"email_after_test", "email_locations_after_test",
 		"internal_id_field_name", "region_field_name", "area_manager_field_name",
 		"internal_id_field_name", "region_field_name", "area_manager_field_name",
 	];
 	];
@@ -56,5 +57,3 @@ class Customer extends Model {
 	}
 	}
 
 
 }
 }
-
-?>

+ 20 - 6
engine/email_builder.php

@@ -6,6 +6,7 @@ class EmailBuilder {
 
 
 	public function __construct() {
 	public function __construct() {
 
 
+		$app_name = APP_NAME;
 		$protocol = PROTOCOL;
 		$protocol = PROTOCOL;
 		$domain = DOMAIN;
 		$domain = DOMAIN;
 
 
@@ -14,7 +15,7 @@ class EmailBuilder {
 <html xmlns="http://www.w3.org/1999/xhtml">
 <html xmlns="http://www.w3.org/1999/xhtml">
 	<head>
 	<head>
 		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-		<title>Check Policy</title>
+		<title>{$app_name}</title>
 		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
 		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
 	</head>
 	</head>
 	<body>
 	<body>
@@ -25,7 +26,7 @@ class EmailBuilder {
 						<tr>
 						<tr>
 							<td align="center" style="padding: 40px 0 40px 0; border-bottom: 1px solid #cccccc;">
 							<td align="center" style="padding: 40px 0 40px 0; border-bottom: 1px solid #cccccc;">
 								<a href="{$protocol}://{$domain}">
 								<a href="{$protocol}://{$domain}">
-									<img src="../public/img/logo.png" width="386" height="80" style="display: block;" alt="Check Policy logo" />
+									<img src="../public/img/logo.png" width="386" height="80" style="display: block;" alt="{$app_name} logo" />
 								</a>
 								</a>
 							</td>
 							</td>
 						</tr>
 						</tr>
@@ -85,10 +86,23 @@ EOD;
 
 
 	public function build() {
 	public function build() {
 
 
+		$facebook = "";
+		if(FACEBOOK) {
+			$facebook = '<a href="' . FACEBOOK . '" style="color: #ffffff;"><font color="#ffffff">Facebook</font></a><br />';
+		}
+
+		$whatsapp = "";
+		if(WHATSAPP) {
+			$whatsapp = '<a href="https://api.whatsapp.com/send?phone=' . WHATSAPP . '" style="color: #ffffff;"><font color="#ffffff">WhatsApp</font></a><br />';
+		}
+
+		$app_name = APP_NAME;
+		$year = date("Y");
+
 		$this->parts[] = <<<EOD
 		$this->parts[] = <<<EOD
 									<tr>
 									<tr>
 										<td style="font-family: Arial, sans-serif;">
 										<td style="font-family: Arial, sans-serif;">
-											Check Policy Team
+										{$app_name} Team
 										</td>
 										</td>
 									</tr>
 									</tr>
 								</table>
 								</table>
@@ -99,11 +113,11 @@ EOD;
 								<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
 								<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
 									<tr>
 									<tr>
 										<td style="font-family: Arial, sans-serif;">
 										<td style="font-family: Arial, sans-serif;">
-											<b><font color="#ffffff">&copy; Check Policy 2018</font></b>
+											<b><font color="#ffffff">&copy; {$app_name} {$year}</font></b>
 										</td>
 										</td>
 										<td align="right" style="font-family: Arial, sans-serif;">
 										<td align="right" style="font-family: Arial, sans-serif;">
-											<a href="https://www.facebook.com/checkpolicy" style="color: #ffffff;"><font color="#ffffff">Facebook</font></a><br />
-											<a href="https://api.whatsapp.com/send?phone=447841353775" style="color: #ffffff;"><font color="#ffffff">WhatsApp</font></a>
+											{$facebook}
+											{$whatsapp}
 										</td>
 										</td>
 									</tr>
 									</tr>
 								</table>
 								</table>

+ 23 - 0
engine/location.php

@@ -7,6 +7,29 @@ class Location extends Model {
 	protected static $fillable_fields = ["customer_id", "name", "legal_entity_name", "address_1", "address_2", "city", "county", "postal_code", "state", "country", "email", "phone", "opening_hours", "shop_left", "shop_right", "brand", "region", "region_name", "internal_id", "area_manager", "area_manager_name", "area_manager_email", "operations_manager_name", "closed", "latitude", "longitude", "dts_verified"];
 	protected static $fillable_fields = ["customer_id", "name", "legal_entity_name", "address_1", "address_2", "city", "county", "postal_code", "state", "country", "email", "phone", "opening_hours", "shop_left", "shop_right", "brand", "region", "region_name", "internal_id", "area_manager", "area_manager_name", "area_manager_email", "operations_manager_name", "closed", "latitude", "longitude", "dts_verified"];
 
 
 	// Object methods
 	// Object methods
+	public function assignVenueTypes($types) {
+		$links = LocationVenueType::query(["location_id" => $this->id]);
+		foreach($links as $link) {
+			$link->delete();
+		}
+
+		foreach($types as $type) {
+			$link = new LocationVenueType;
+			$link->location_id = $this->id;
+			$link->venue_type_id = $type->id;
+			$link->commit();
+		}
+
+		return true;
+	}
+
+	public function getVenueTypes() {
+		$links = LocationVenueType::query(["location_id" => $this->id]);
+		$ids = array_column($links, "venue_type_id");
+
+		return VenueType::query(["id" => $ids]);
+	}
+
 	public function getCustomer() {
 	public function getCustomer() {
 		return Customer::get($this->customer_id);
 		return Customer::get($this->customer_id);
 	}
 	}

+ 9 - 0
engine/location_venue_type.php

@@ -0,0 +1,9 @@
+<?php
+
+class LocationVenueType extends Model {
+
+	protected static $table = "location_venue_type";
+	protected static $id_field = ["location_id", "venue_type_id"];
+	protected static $fillable_fields = ["location_id", "venue_type_id"];
+
+}

+ 32 - 3
engine/project.php

@@ -4,7 +4,7 @@ class Project extends Model {
 
 
 	protected static $table = "project";
 	protected static $table = "project";
 	protected static $id_field = "id";
 	protected static $id_field = "id";
-	protected static $fillable_fields = ["customer_id", "template_id", "name", "test_count", "min_age", "max_age", "default_tester_fee", "time_of_day", "tester_can_claim", "template_overrides_json", "dts_start", "dts_deadline", "dts_created", "dts_updated", "dts_report"];
+	protected static $fillable_fields = ["customer_id", "template_id", "name", "test_count", "min_age", "max_age", "default_customer_fee", "default_tester_fee", "time_of_day", "tester_can_claim", "template_overrides_json", "dts_start", "dts_deadline", "dts_created", "dts_updated", "dts_report", "dts_finished", "user_id_finished"];
 
 
 	protected static $field_map = [
 	protected static $field_map = [
 	];
 	];
@@ -83,6 +83,21 @@ class Project extends Model {
 		}
 		}
 	}
 	}
 
 
+	public function getURL() {
+		return "/account/projects/{$this->id}";
+	}
+
+	public function getDirectory() {
+		$directory = ROOT_DIR . "/files/projects/" . $this->id;
+		if(!file_exists($directory)) mkdir($directory, 0777, true);
+		return $directory;
+	}
+
+	public function hasInvoicePDF() {
+		$directory = $this->getDirectory();
+		return file_exists($directory . "/invoice.pdf");
+	}
+
 	public function isAnytime() {
 	public function isAnytime() {
 		return $this->time_of_day == "A";
 		return $this->time_of_day == "A";
 	}
 	}
@@ -100,6 +115,20 @@ class Project extends Model {
 		return time() > $deadline_unix;
 		return time() > $deadline_unix;
 	}
 	}
 
 
-}
+	public function markFinished() {
 
 
-?>
+		if(!Core::$user) throw new Exception("Trying to mark project as finished while not logged in.");
+		if(!Core::$user->isAdmin()) throw new Exception("Trying to mark project as finished with non-admin account.");
+
+		$this->dts_finished = Util::getUTCDateTime();
+		$this->user_id_finished = Core::$user->id;
+		return $this->commit();
+	}
+
+	public function markUnfinished() {
+		$this->dts_finished = null;
+		$this->user_id_finished = null;
+		return $this->commit();
+	}
+
+}

+ 28 - 4
engine/template.php

@@ -4,11 +4,21 @@ class Template extends Model {
 
 
 	protected static $table = "template";
 	protected static $table = "template";
 	protected static $id_field = "id";
 	protected static $id_field = "id";
-	protected static $fillable_fields = ["customer_id", "name", "json", "practice", "pass_stage"];
+	protected static $fillable_fields = ["customer_id", "name", "json", "json_file", "practice", "pass_stage"];
 
 
 	private $overrides = [];
 	private $overrides = [];
 
 
 	// Object methods
 	// Object methods
+	public function getJSON() {
+		$json_path = ROOT_DIR . "/json/" . $this->json_file;
+
+		if(!empty($this->json_file) && file_exists($json_path)) {
+			return file_get_contents($json_path);
+		}
+
+		return $this->json;
+	}
+
 	public function getCustomer() {
 	public function getCustomer() {
 		return Customer::get($this->customer_id);
 		return Customer::get($this->customer_id);
 	}
 	}
@@ -32,7 +42,7 @@ class Template extends Model {
 	public function getFields() {
 	public function getFields() {
 		$fields = [];
 		$fields = [];
 
 
-		$json = json_decode($this->json);
+		$json = json_decode($this->getJSON());
 		$before_fields = $json->beforeTest;
 		$before_fields = $json->beforeTest;
 		$during_fields = $json->duringTest;
 		$during_fields = $json->duringTest;
 		$all_fields = array_merge($before_fields, $during_fields);
 		$all_fields = array_merge($before_fields, $during_fields);
@@ -45,6 +55,20 @@ class Template extends Model {
 		return $fields;
 		return $fields;
 	}
 	}
 
 
+	public function getTesterInvoiceFields() {
+		$json = json_decode($this->getJSON());
+		if(!$json) throw new Exception("Failed to decode template JSON.");
+
+		return $json->testerInvoiceFields ?? [];
+	}
+
+	public function getCustomerInvoiceFields() {
+		$json = json_decode($this->getJSON());
+		if(!$json) throw new Exception("Failed to decode template JSON.");
+
+		return $json->customerInvoiceFields ?? [];
+	}
+
 	public function setOverrides($overrides) {
 	public function setOverrides($overrides) {
 		$this->overrides = $overrides;
 		$this->overrides = $overrides;
 	}
 	}
@@ -65,7 +89,7 @@ class Template extends Model {
 
 
 	public function renderBeforeTestForm() {
 	public function renderBeforeTestForm() {
 
 
-		$json = json_decode($this->json);
+		$json = json_decode($this->getJSON());
 		$fields = $json->beforeTest;
 		$fields = $json->beforeTest;
 
 
 		?>
 		?>
@@ -97,7 +121,7 @@ class Template extends Model {
 
 
 	public function renderDuringTestForm() {
 	public function renderDuringTestForm() {
 
 
-		$json = json_decode($this->json);
+		$json = json_decode($this->getJSON());
 		$fields = $json->duringTest;
 		$fields = $json->duringTest;
 
 
 		?>
 		?>

+ 36 - 29
engine/test.php

@@ -4,7 +4,7 @@ class Test extends Model {
 
 
 	protected static $table = "test";
 	protected static $table = "test";
 	protected static $id_field = "id";
 	protected static $id_field = "id";
-	protected static $fillable_fields = ["project_id", "location_id", "tester_id", "status", "status_tester_invoice", "test_fee", "test_time", "test_travel_cost", "shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes", "dts_due", "dts_start", "dts_end", "dts_tester_invoice_generated", "dts_tester_invoice_paid", "verifier_id", "verifier_notes", "pass", "retest", "dts_created", "dts_updated", "dts_assigned", "dts_verified"];
+	protected static $fillable_fields = ["project_id", "location_id", "tester_id", "status", "status_tester_invoice", "customer_fee", "test_fee", "test_time", "test_travel_cost", "shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes", "dts_due", "dts_start", "dts_end", "dts_tester_invoice_generated", "dts_tester_invoice_paid", "verifier_id", "verifier_notes", "pass", "retest", "dts_created", "dts_updated", "dts_assigned", "dts_verified"];
 
 
 	const TEST_FIELDS = ["shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes"];
 	const TEST_FIELDS = ["shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes"];
 
 
@@ -55,13 +55,13 @@ class Test extends Model {
 	public static function getStatusTesterInvoiceText($status) {
 	public static function getStatusTesterInvoiceText($status) {
 		switch($status) {
 		switch($status) {
 			case Test::STATUS_TESTER_INVOICE_NONE:
 			case Test::STATUS_TESTER_INVOICE_NONE:
-				return _("No Invoice Generated");
+				return __("No Invoice Generated");
 			case Test::STATUS_TESTER_INVOICE_PENDING:
 			case Test::STATUS_TESTER_INVOICE_PENDING:
-				return _("Pending Payment");
+				return __("Pending Payment");
 			case Test::STATUS_TESTER_INVOICE_PAID:
 			case Test::STATUS_TESTER_INVOICE_PAID:
-				return _("Paid");
+				return __("Paid");
 		}
 		}
-		return _("Unknown");
+		return __("Unknown");
 	}
 	}
 
 
 	public static function getStatusTesterInvoiceClass($status) {
 	public static function getStatusTesterInvoiceClass($status) {
@@ -94,39 +94,39 @@ class Test extends Model {
 
 
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
-		$builder->addLeadParagraph(_("Congrats, you have been allocated a test!"));
+		$builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
+		$builder->addLeadParagraph(__("Congrats, you have been allocated a test!"));
 
 
 		if($project->isNighttime()) {
 		if($project->isNighttime()) {
-			$builder->addParagraph("<b><font color=\"red\">" . _("Evening Test to be done between 7PM and midnight.") . "</font></b>");
+			$builder->addParagraph("<b><font color=\"red\">" . __("Evening Test to be done between 7PM and midnight.") . "</font></b>");
 		}
 		}
 
 
 		if($message) {
 		if($message) {
 			$builder->addParagraph($message);
 			$builder->addParagraph($message);
 		}
 		}
 
 
-		$builder->addParagraph(sprintf(_("We need you to confirm if you are able to do the test. Please check the details below and then confirm by pressing the %sAccept%s or %sDecline%s buttons and once you tap %sAccept%s, the test will be allocated to you."),
+		$builder->addParagraph(sprintf(__("We need you to confirm if you are able to do the test. Please check the details below and then confirm by pressing the %sAccept%s or %sDecline%s buttons and once you tap %sAccept%s, the test will be allocated to you."),
 			'<b>', '</b>',
 			'<b>', '</b>',
 			'<b>', '</b>',
 			'<b>', '</b>',
 			'<b>', '</b>'
 			'<b>', '</b>'
 		));
 		));
 		$builder->addAcceptDeclineButtons($base_url);
 		$builder->addAcceptDeclineButtons($base_url);
-		$builder->addParagraph(sprintf(_("The site address is: %s"), "<b>{$address}</b>"));
-		$builder->addParagraph(sprintf(_("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
-		$builder->addParagraph(sprintf(_("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
+		$builder->addParagraph(sprintf(__("The site address is: %s"), "<b>{$address}</b>"));
+		$builder->addParagraph(sprintf(__("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
+		$builder->addParagraph(sprintf(__("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
 			'<b>', '</b>',
 			'<b>', '</b>',
 			'<b>', '</b>'
 			'<b>', '</b>'
 		));
 		));
-		$builder->addParagraph(sprintf(_("If you agree to conduct the test, log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
+		$builder->addParagraph(sprintf(__("If you agree to conduct the test, log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
 			'<b>', '</b>',
 			'<b>', '</b>',
 			'<b>', '</b>'
 			'<b>', '</b>'
 		));
 		));
-		$builder->addParagraph(sprintf(_("If you have any questions please send them to %s or call %s on %s."),
+		$builder->addParagraph(sprintf(__("If you have any questions please send them to %s or call %s on %s."),
 			"<a href=\"mailto:tests@check-policy.com\">tests@check-policy.com</a>",
 			"<a href=\"mailto:tests@check-policy.com\">tests@check-policy.com</a>",
 			"<b>$admin_first_name</b>",
 			"<b>$admin_first_name</b>",
 			"<b>$admin_phone</b>"
 			"<b>$admin_phone</b>"
 		));
 		));
-		$builder->addParagraph(sprintf(_("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete. Please accept the test by tapping the %sAccept%s button and email us back saying you would like an offline form."),
+		$builder->addParagraph(sprintf(__("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete. Please accept the test by tapping the %sAccept%s button and email us back saying you would like an offline form."),
 			'<b>', '</b>'
 			'<b>', '</b>'
 		));
 		));
 		$content = $builder->build();
 		$content = $builder->build();
@@ -136,7 +136,7 @@ class Test extends Model {
 		$mail->setHtmlContent($content);
 		$mail->setHtmlContent($content);
 		$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
 		$mail->addAddress($tester->email, $tester->getDisplayName());
 		$mail->addAddress($tester->email, $tester->getDisplayName());
-		$mail->setSubject(_("You have been allocated a test"));
+		$mail->setSubject(__("You have been allocated a test"));
 		$mail->send();
 		$mail->send();
 	}
 	}
 
 
@@ -153,29 +153,29 @@ class Test extends Model {
 
 
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
-		$builder->addLeadParagraph(_("Congrats, you have claimed a test!"));
+		$builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
+		$builder->addLeadParagraph(__("Congrats, you have claimed a test!"));
 
 
 		if($project->isNighttime()) {
 		if($project->isNighttime()) {
-			$builder->addParagraph("<b><font color=\"red\">" . _("Evening Test to be done between 7PM and midnight.") . "</font></b>");
+			$builder->addParagraph("<b><font color=\"red\">" . __("Evening Test to be done between 7PM and midnight.") . "</font></b>");
 		}
 		}
 
 
-		$builder->addParagraph(sprintf(_("The site address is: %s"), "<b>$address</b>"));
-		$builder->addParagraph(sprintf(_("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
-		$builder->addParagraph(sprintf(_("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
+		$builder->addParagraph(sprintf(__("The site address is: %s"), "<b>$address</b>"));
+		$builder->addParagraph(sprintf(__("The date that need to complete and submit the results by is: %s"), "<font color=\"red\"><b>$date_due</b></font>"));
+		$builder->addParagraph(sprintf(__("For methodology and further notes please check the %sUseful Documents%s section on the %sAccount%s page."),
 			'<b>', '</b>',
 			'<b>', '</b>',
 			'<b>', '</b>'
 			'<b>', '</b>'
 		));
 		));
-		$builder->addParagraph(sprintf(_("Log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
+		$builder->addParagraph(sprintf(__("Log in and then go to %sTests%s where you will be able to see the tests available to you. Please tap the %sBegin%s button and follow the instructions that is shown."),
 			'<b>', '</b>',
 			'<b>', '</b>',
 			'<b>', '</b>'
 			'<b>', '</b>'
 		));
 		));
-		$builder->addParagraph(sprintf(_("If you have any questions please send them to %s or call %s on %s."),
+		$builder->addParagraph(sprintf(__("If you have any questions please send them to %s or call %s on %s."),
 			"<a href=\"mailto:tests@check-policy.com\">tests@check-policy.com</a>",
 			"<a href=\"mailto:tests@check-policy.com\">tests@check-policy.com</a>",
 			"<b>$admin_first_name</b>",
 			"<b>$admin_first_name</b>",
 			"<b>$admin_phone</b>"
 			"<b>$admin_phone</b>"
 		));
 		));
-		$builder->addParagraph(_("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete."));
+		$builder->addParagraph(__("If you are unable to submit the results via the web-based app please contact us and we can send you an offline form to complete."));
 		$content = $builder->build();
 		$content = $builder->build();
 
 
 		// Send
 		// Send
@@ -183,7 +183,7 @@ class Test extends Model {
 		$mail->setHtmlContent($content);
 		$mail->setHtmlContent($content);
 		$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_CONTACT, EMAIL_FROM_NAME);
 		$mail->addAddress($tester->email, $tester->getDisplayName());
 		$mail->addAddress($tester->email, $tester->getDisplayName());
-		$mail->setSubject(_("You have claimed a test"));
+		$mail->setSubject(__("You have claimed a test"));
 		$mail->send();
 		$mail->send();
 	}
 	}
 
 
@@ -216,7 +216,7 @@ class Test extends Model {
 		$mail = new Email;
 		$mail = new Email;
 		$mail->setHtmlContent($content);
 		$mail->setHtmlContent($content);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
-		$mail->addAddress(EMAIL_CONTACT, "Check Policy Contact");
+		$mail->addAddress(EMAIL_CONTACT, APP_NAME . " Contact");
 		$mail->setSubject("Test declined: $project->name / $location->name");
 		$mail->setSubject("Test declined: $project->name / $location->name");
 		$mail->send();
 		$mail->send();
 	}
 	}
@@ -258,9 +258,16 @@ class Test extends Model {
 		$pdf_path = $this->getDirectory() . "/pdf.pdf";
 		$pdf_path = $this->getDirectory() . "/pdf.pdf";
 		$pdf_name = implode(" - ", array_filter([$location->internal_id, date("jS M Y")])) . ".pdf";
 		$pdf_name = implode(" - ", array_filter([$location->internal_id, date("jS M Y")])) . ".pdf";
 
 
+		// Lead paragraph
+		$lead_paragraph = "";
+		if($this->pass) {
+			$lead_paragraph .= "Congratulations!<br />";
+		}
+		$lead_paragraph .= "A test has been completed at your location.";
+
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addLeadParagraph("Congratulations!<br />A test has been completed at your location.");
+		$builder->addLeadParagraph($lead_paragraph);
 		$builder->addParagraph("Please see attached PDF and do not hesitate to contact us if you have any questions.");
 		$builder->addParagraph("Please see attached PDF and do not hesitate to contact us if you have any questions.");
 		$content = $builder->build();
 		$content = $builder->build();
 
 
@@ -379,7 +386,7 @@ class Test extends Model {
 
 
 	public function getPassText() {
 	public function getPassText() {
 		if(is_null($this->pass)) return "Pending";
 		if(is_null($this->pass)) return "Pending";
-		return $this->pass ? _("Pass") : _("Fail");
+		return $this->pass ? __("Pass") : __("Fail");
 	}
 	}
 
 
 	public function getMPDF() {
 	public function getMPDF() {

+ 41 - 39
engine/user.php

@@ -95,9 +95,9 @@ class User extends Model {
 
 
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
-		$builder->addLeadParagraph(_("Thanks for registering!"));
-		$builder->addParagraph(sprintf(_("Welcome to %s! Before you can log in, you will need to verify your email address. You can do so by tapping the following link:"), APP_NAME));
+		$builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
+		$builder->addLeadParagraph(__("Thanks for registering!"));
+		$builder->addParagraph(sprintf(__("Welcome to %s! Before you can log in, you will need to verify your email address. You can do so by tapping the following link:"), APP_NAME));
 		$builder->addParagraph("<a href=\"$link\">$link</a>");
 		$builder->addParagraph("<a href=\"$link\">$link</a>");
 		$content = $builder->build();
 		$content = $builder->build();
 
 
@@ -107,7 +107,7 @@ class User extends Model {
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->addAddress($this->email, $this->getDisplayName());
 		$mail->addAddress($this->email, $this->getDisplayName());
 
 
-		$mail->setSubject(_("Verify your email address"));
+		$mail->setSubject(__("Verify your email address"));
 
 
 		$mail->send();
 		$mail->send();
 
 
@@ -122,9 +122,9 @@ class User extends Model {
 
 
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
-		$builder->addLeadParagraph(_("Thanks for verifying your email address!"));
-		$builder->addParagraph(sprintf(_("Welcome to %s! Before you can take part in tests, you will need to provide us with some ID. You can do so by tapping the following link:"), APP_NAME));
+		$builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
+		$builder->addLeadParagraph(__("Thanks for verifying your email address!"));
+		$builder->addParagraph(sprintf(__("Welcome to %s! Before you can take part in tests, you will need to provide us with some ID. You can do so by tapping the following link:"), APP_NAME));
 		$builder->addParagraph("<a href=\"$link\">$link</a>");
 		$builder->addParagraph("<a href=\"$link\">$link</a>");
 		$content = $builder->build();
 		$content = $builder->build();
 
 
@@ -133,7 +133,7 @@ class User extends Model {
 		$mail->setHtmlContent($content);
 		$mail->setHtmlContent($content);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->addAddress($this->email, $this->getDisplayName());
 		$mail->addAddress($this->email, $this->getDisplayName());
-		$mail->setSubject(sprintf(_("Welcome to %s"), APP_NAME));
+		$mail->setSubject(sprintf(__("Welcome to %s"), APP_NAME));
 		$mail->send();
 		$mail->send();
 
 
 		return true;
 		return true;
@@ -147,20 +147,20 @@ class User extends Model {
 
 
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
-		$builder->addLeadParagraph(_("Your application has been successful!"));
-		$builder->addParagraph(sprintf(_("Welcome to %s! In order to get you a test as soon as possible, we need one final confirmation. Please log in to your account and have a quick read of the documents that explain what we need you to do during a test."), APP_NAME));
-		$builder->addParagraph(_("When you're ready to try a Practice test, in your account and select the \"Practice\" option."));
-		$builder->addParagraph(_("1. As it is a Practice test, you can reset and start over as many times as you like because it doesn't count but lets you see what the real thing is like."));
-		$builder->addParagraph(sprintf(_("2. Email us at %s and let us know that you're ready."), "contact@" . DOMAIN));
-		$builder->addParagraph(_("3. We will allocate a test to you as soon as possible."));
-
-		$builder->addParagraph(_("Remember to check your online account for when tests become available."));
-		$builder->addParagraph(_("Keep an eye out for emails inviting you to accept a test via the email or log in to your account where you can see your available tests."));
-		$builder->addParagraph(_("If you accept to do a test within the agreed period (usually 7 days) please click Accept to confirm that you would like to do the test within the agreed period."));
-		$builder->addParagraph(_("If you can't make it (it's too far or you'll be away), please Reject the test or email us with other suitable dates."));
-		$builder->addParagraph(_("After you click Accept, you will be given the option to Begin the test whenever you want. Just log in to your account and click Begin on the test."));
-		$builder->addParagraph(sprintf(_("Once again welcome to %s - Accept, Begin, Complete and get paid for up to 8 minutes work!"), APP_NAME));
+		$builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
+		$builder->addLeadParagraph(__("Your application has been successful!"));
+		$builder->addParagraph(sprintf(__("Welcome to %s! In order to get you a test as soon as possible, we need one final confirmation. Please log in to your account and have a quick read of the documents that explain what we need you to do during a test."), APP_NAME));
+		$builder->addParagraph(__("When you're ready to try a Practice test, in your account and select the \"Practice\" option."));
+		$builder->addParagraph(__("1. As it is a Practice test, you can reset and start over as many times as you like because it doesn't count but lets you see what the real thing is like."));
+		$builder->addParagraph(sprintf(__("2. Email us at %s and let us know that you're ready."), "contact@" . DOMAIN));
+		$builder->addParagraph(__("3. We will allocate a test to you as soon as possible."));
+
+		$builder->addParagraph(__("Remember to check your online account for when tests become available."));
+		$builder->addParagraph(__("Keep an eye out for emails inviting you to accept a test via the email or log in to your account where you can see your available tests."));
+		$builder->addParagraph(__("If you accept to do a test within the agreed period (usually 7 days) please click Accept to confirm that you would like to do the test within the agreed period."));
+		$builder->addParagraph(__("If you can't make it (it's too far or you'll be away), please Reject the test or email us with other suitable dates."));
+		$builder->addParagraph(__("After you click Accept, you will be given the option to Begin the test whenever you want. Just log in to your account and click Begin on the test."));
+		$builder->addParagraph(sprintf(__("Once again welcome to %s - Accept, Begin, Complete and get paid for up to 8 minutes work!"), APP_NAME));
 		$content = $builder->build();
 		$content = $builder->build();
 
 
 		// Send
 		// Send
@@ -168,7 +168,7 @@ class User extends Model {
 		$mail->setHtmlContent($content);
 		$mail->setHtmlContent($content);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->addAddress($this->email, $this->getDisplayName());
 		$mail->addAddress($this->email, $this->getDisplayName());
-		$mail->setSubject(_("ID accepted and verified"));
+		$mail->setSubject(__("ID accepted and verified"));
 		$mail->send();
 		$mail->send();
 
 
 		return true;
 		return true;
@@ -183,12 +183,12 @@ class User extends Model {
 
 
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
-		$builder->addLeadParagraph(_("Thank you for submitting your ID details."));
-		$builder->addParagraph(_("Unfortunately we could not verify and accept your documents and/or image."));
-		$builder->addParagraph(sprintf(_("The reason for this is: %s"), $reason));
-		$builder->addParagraph(_("Please log in again, resubmit and we will try again."));
-		$builder->addParagraph(_("We look forward to welcoming you onboard soon!"));
+		$builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
+		$builder->addLeadParagraph(__("Thank you for submitting your ID details."));
+		$builder->addParagraph(__("Unfortunately we could not verify and accept your documents and/or image."));
+		$builder->addParagraph(sprintf(__("The reason for this is: %s"), $reason));
+		$builder->addParagraph(__("Please log in again, resubmit and we will try again."));
+		$builder->addParagraph(__("We look forward to welcoming you onboard soon!"));
 		$content = $builder->build();
 		$content = $builder->build();
 
 
 		// Send
 		// Send
@@ -196,7 +196,7 @@ class User extends Model {
 		$mail->setHtmlContent($content);
 		$mail->setHtmlContent($content);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->addAddress($this->email, $this->getDisplayName());
 		$mail->addAddress($this->email, $this->getDisplayName());
-		$mail->setSubject(_("We could not verify your ID details"));
+		$mail->setSubject(__("We could not verify your ID details"));
 		$mail->send();
 		$mail->send();
 
 
 		return true;
 		return true;
@@ -213,11 +213,11 @@ class User extends Model {
 
 
 		// Build
 		// Build
 		$builder = new EmailBuilder;
 		$builder = new EmailBuilder;
-		$builder->addParagraph("<b>" . sprintf(_("Hi %s"), $name) . "</b>");
-		$builder->addLeadParagraph(_("A reset password request has been received."));
-		$builder->addParagraph(_("To reset your password, please tap on the following link:"));
+		$builder->addParagraph("<b>" . sprintf(__("Hi %s"), $name) . "</b>");
+		$builder->addLeadParagraph(__("A reset password request has been received."));
+		$builder->addParagraph(__("To reset your password, please tap on the following link:"));
 		$builder->addParagraph("<a href=\"$link\">$link</a>");
 		$builder->addParagraph("<a href=\"$link\">$link</a>");
-		$builder->addParagraph(sprintf(_("If you %sdid not%s request for your password to be reset, please ignore this email."), '<strong>', '</strong>'));
+		$builder->addParagraph(sprintf(__("If you %sdid not%s request for your password to be reset, please ignore this email."), '<strong>', '</strong>'));
 		$content = $builder->build();
 		$content = $builder->build();
 
 
 		// Send
 		// Send
@@ -227,7 +227,7 @@ class User extends Model {
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
 		$mail->addAddress($this->email, $this->getDisplayName());
 		$mail->addAddress($this->email, $this->getDisplayName());
 
 
-		$mail->setSubject(_("Password reset instructions"));
+		$mail->setSubject(__("Password reset instructions"));
 
 
 		$mail->send();
 		$mail->send();
 
 
@@ -297,7 +297,7 @@ class User extends Model {
 
 
 	public function getAge() {
 	public function getAge() {
 
 
-		if(is_null($this->date_of_birth)) return _("N/A");
+		if(is_null($this->date_of_birth)) return __("N/A");
 
 
 		$now = new DateTime("now");
 		$now = new DateTime("now");
 		$dob = new DateTime($this->date_of_birth);
 		$dob = new DateTime($this->date_of_birth);
@@ -306,7 +306,7 @@ class User extends Model {
 
 
 	public function getDisplayName() {
 	public function getDisplayName() {
 
 
-		if(empty($this->email)) return _("Deleted User");
+		if(empty($this->email)) return __("Deleted User");
 
 
 		$parts = array_filter([$this->first_name, $this->last_name]);
 		$parts = array_filter([$this->first_name, $this->last_name]);
 		return implode(" ", $parts);
 		return implode(" ", $parts);
@@ -483,6 +483,8 @@ class User extends Model {
 		return User::PAYMENT_METHODS[$this->preferred_payment_method];
 		return User::PAYMENT_METHODS[$this->preferred_payment_method];
 	}
 	}
 
 
-}
+	public function getURL() {
+		return "/account/users/{$this->id}";
+	}
 
 
-?>
+}

+ 4 - 0
engine/util.php

@@ -207,6 +207,10 @@ class Util {
 		return gmdate("Y-m-d", $time);
 		return gmdate("Y-m-d", $time);
 	}
 	}
 
 
+	public static function getUTCDateTime($time = false) {
+		return Util::getDateTime($time);
+	}
+
 	public static function getDateTime($time = false) {
 	public static function getDateTime($time = false) {
 		if(!$time) $time = time();
 		if(!$time) $time = time();
 		return gmdate("Y-m-d H:i:s", $time);
 		return gmdate("Y-m-d H:i:s", $time);

+ 14 - 0
engine/venue_type.php

@@ -0,0 +1,14 @@
+<?php
+
+class VenueType extends Model {
+
+	protected static $table = "venue_type";
+	protected static $id_field = "id";
+	protected static $fillable_fields = ["name"];
+
+	// Static methods
+	public static function getAll() {
+		return self::query([], ["sort" => "name"]);
+	}
+
+}

+ 9 - 12
initialise.php

@@ -68,22 +68,19 @@ if(file_exists($mo_path)) {
 }
 }
 
 
 $translator->register();
 $translator->register();
-function _() {
-	return call_user_func_array("__", func_get_args());
-}
 
 
 // Strings
 // Strings
-define("YES", _("Yes"));
-define("NO", _("No"));
+define("YES", __("Yes"));
+define("NO", __("No"));
 
 
-define("MALE", _("Male"));
-define("FEMALE", _("Female"));
-define("UNSPECIFIED", _("Unspecified"));
+define("MALE", __("Male"));
+define("FEMALE", __("Female"));
+define("UNSPECIFIED", __("Unspecified"));
 
 
-define("MISS", _("Miss"));
-define("MR", _("Mr"));
-define("MS", _("Ms"));
-define("DR", _("Dr"));
+define("MISS", __("Miss"));
+define("MR", __("Mr"));
+define("MS", __("Ms"));
+define("DR", __("Dr"));
 
 
 // Extend session cookie if it exists
 // Extend session cookie if it exists
 if(!empty($_COOKIE[SESSION_NAME])) {
 if(!empty($_COOKIE[SESSION_NAME])) {

+ 8 - 2
json/age_verification.json

@@ -1,4 +1,10 @@
 {
 {
+	"customerInvoiceFields": [
+		{"name": "play_spent", "label": "Money Spent by Testers"}
+	],
+	"testerInvoiceFields": [
+		{"name": "play_spent", "label": "Play Costs"}
+	],
 	"beforeTest": [
 	"beforeTest": [
 		{
 		{
 			"type": "header",
 			"type": "header",
@@ -192,7 +198,7 @@
 			"type": "textarea",
 			"type": "textarea",
 			"name": "additional_notes",
 			"name": "additional_notes",
 			"label": "Additional Notes",
 			"label": "Additional Notes",
-			"maxLength": 200
+			"maxLength": 600
 		}
 		}
 	]
 	]
-}
+}

+ 8 - 1
json/age_verification_mitchells_and_butlers.json

@@ -1,4 +1,11 @@
 {
 {
+	"customerInvoiceFields": [
+		{"name": "play_spent", "label": "Money Spent by Testers"}
+	],
+	"testerInvoiceFields": [
+		{"name": "play_spent", "label": "Play Costs"},
+		{"name": "bar_expenditure", "label": "Bar Expenditure"}
+	],
 	"beforeTest": [
 	"beforeTest": [
 		{
 		{
 			"type": "header",
 			"type": "header",
@@ -249,4 +256,4 @@
 			"maxLength": 600
 			"maxLength": 600
 		}
 		}
 	]
 	]
-}
+}

+ 7 - 1
json/mystery_shop.json

@@ -1,4 +1,10 @@
 {
 {
+	"customerInvoiceFields": [
+		{"name": "play_spent", "label": "Money Spent by Testers"}
+	],
+	"testerInvoiceFields": [
+		{"name": "play_spent", "label": "Play Costs"}
+	],
 	"beforeTest": [
 	"beforeTest": [
 		{
 		{
 			"type": "header",
 			"type": "header",
@@ -170,4 +176,4 @@
 			"maxLength": 600
 			"maxLength": 600
 		}
 		}
 	]
 	]
-}
+}

+ 8 - 3
routes.php

@@ -67,6 +67,8 @@ $routes = [
 	"/^account\/projects\/$id_pattern\/export-csv$/" => ["controller" => "project_csv", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/projects\/$id_pattern\/export-csv$/" => ["controller" => "project_csv", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/projects\/$id_pattern\/export-customer-csv$/" => ["controller" => "project_customer_csv", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/projects\/$id_pattern\/export-customer-csv$/" => ["controller" => "project_customer_csv", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/projects\/$id_pattern\/export-kml$/" => ["controller" => "project_kml", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/projects\/$id_pattern\/export-kml$/" => ["controller" => "project_kml", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
+	"/^account\/projects\/$id_pattern\/invoice$/" => ["controller" => "project_invoice", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
+	"/^account\/projects\/$id_pattern\/(mark-finished|mark-unfinished)$/" => ["controller" => "project_mark_finished", "params" => ["id", "action"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/projects\/$id_pattern\/(get-locations|get-testers|create-test|assign-tester)$/" => ["controller" => "project_ajax", "params" => ["id", "action"], "type" => "json", "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/projects\/$id_pattern\/(get-locations|get-testers|create-test|assign-tester)$/" => ["controller" => "project_ajax", "params" => ["id", "action"], "type" => "json", "require_user_level" => User::LEVEL_ADMIN],
 
 
 	// Tests
 	// Tests
@@ -89,6 +91,11 @@ $routes = [
 	"/^account\/templates\/$id_pattern\/edit$/" => ["controller" => "template_edit", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/templates\/$id_pattern\/edit$/" => ["controller" => "template_edit", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/templates\/$id_pattern$/" => ["controller" => "template", "params" => ["id"], "require_user_level" => User::LEVEL_CUSTOMER],
 	"/^account\/templates\/$id_pattern$/" => ["controller" => "template", "params" => ["id"], "require_user_level" => User::LEVEL_CUSTOMER],
 
 
+	// Venue Types
+	"/^account\/venue-types$/" => ["controller" => "venue_types", "require_user_level" => User::LEVEL_ADMIN],
+	"/^account\/venue-types\/(add)$/" => ["controller" => "venue_type_form", "params" => ["action"], "require_user_level" => User::LEVEL_ADMIN],
+	"/^account\/venue-types\/$id_pattern\/(edit)$/" => ["controller" => "venue_type_form", "params" => ["id", "action"], "require_user_level" => User::LEVEL_ADMIN],
+
 	// Users
 	// Users
 	"/^account\/users$/" => ["controller" => "users", "require_admin" => true],
 	"/^account\/users$/" => ["controller" => "users", "require_admin" => true],
 	"/^account\/users\/export\/(email)$/" => ["controller" => "users_export", "params" => ["type"], "require_admin" => true],
 	"/^account\/users\/export\/(email)$/" => ["controller" => "users_export", "params" => ["type"], "require_admin" => true],
@@ -108,6 +115,7 @@ $routes = [
 	"/^account\/locations\/$id_pattern\/photo$/" => ["controller" => "location_photo", "params" => ["location_id"]],
 	"/^account\/locations\/$id_pattern\/photo$/" => ["controller" => "location_photo", "params" => ["location_id"]],
 	"/^account\/locations\/$id_pattern\/photos\/$id_pattern$/" => ["controller" => "location_photo", "params" => ["location_id", "id"]],
 	"/^account\/locations\/$id_pattern\/photos\/$id_pattern$/" => ["controller" => "location_photo", "params" => ["location_id", "id"]],
 
 
+	// Customers
 	"/^account\/customers$/" => ["controller" => "customers", "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/customers$/" => ["controller" => "customers", "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/customers\/add$/" => ["controller" => "customer_add", "require_user_level" => User::LEVEL_SUPERADMIN],
 	"/^account\/customers\/add$/" => ["controller" => "customer_add", "require_user_level" => User::LEVEL_SUPERADMIN],
 	"/^account\/customers\/$id_pattern$/" => ["controller" => "customer_view", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
 	"/^account\/customers\/$id_pattern$/" => ["controller" => "customer_view", "params" => ["id"], "require_user_level" => User::LEVEL_ADMIN],
@@ -127,7 +135,4 @@ $routes = [
 	"/^account\/reports$/" => ["controller" => "reports", "require_user_level" => User::LEVEL_VENUE],
 	"/^account\/reports$/" => ["controller" => "reports", "require_user_level" => User::LEVEL_VENUE],
 	"/^account\/reports\/(export-odp|export-pptx)$/" => ["controller" => "reports", "params" => ["action"], "require_user_level" => User::LEVEL_VENUE],
 	"/^account\/reports\/(export-odp|export-pptx)$/" => ["controller" => "reports", "params" => ["action"], "require_user_level" => User::LEVEL_VENUE],
 
 
-
 ];
 ];
-
-?>

+ 3 - 3
views/404.php

@@ -1,10 +1,10 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 
 
-	<h2><?=htmlspecialchars(_("Page Not Found"))?></h2>
+	<h2><?=htmlspecialchars(__("Page Not Found"))?></h2>
 
 
 	<div class="alert alert-info">
 	<div class="alert alert-info">
 		<i class="fal fa-fw fa-info-circle"></i>
 		<i class="fal fa-fw fa-info-circle"></i>
-		<?=htmlspecialchars(_("The requested page could not be found."))?>
-		<?=sprintf(_("%sClick here%s to return to the home page."), "<a href=\"/\">", "</a>")?>
+		<?=htmlspecialchars(__("The requested page could not be found."))?>
+		<?=sprintf(__("%sClick here%s to return to the home page."), "<a href=\"/\">", "</a>")?>
 	</div>
 	</div>
 </div>
 </div>

+ 3 - 3
views/503.php

@@ -1,11 +1,11 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 
 
-	<h2><?=htmlspecialchars(_("Internal Server Error"))?></h2>
+	<h2><?=htmlspecialchars(__("Internal Server Error"))?></h2>
 
 
 	<div class="alert alert-danger">
 	<div class="alert alert-danger">
 		<i class="fal fa-fw fa-exclamation-circle"></i>
 		<i class="fal fa-fw fa-exclamation-circle"></i>
-		<?=htmlspecialchars(_("The requested page could not be served due to an internal server error."))?>
-		<?=htmlspecialchars(_("Please try again later."))?>
+		<?=htmlspecialchars(__("The requested page could not be served due to an internal server error."))?>
+		<?=htmlspecialchars(__("Please try again later."))?>
 	</div>
 	</div>
 
 
 </div>
 </div>

+ 22 - 22
views/account.php

@@ -8,7 +8,7 @@
 			?>
 			?>
 			<div class="alert alert-danger">
 			<div class="alert alert-danger">
 				<i class="fal fa-fw fa-exclamation-circle"></i>
 				<i class="fal fa-fw fa-exclamation-circle"></i>
-				<?=htmlspecialchars(_("Your account has been banned. You will not be able to participate in any tests."))?>
+				<?=htmlspecialchars(__("Your account has been banned. You will not be able to participate in any tests."))?>
 			</div>
 			</div>
 			<?php
 			<?php
 			break;
 			break;
@@ -16,7 +16,7 @@
 			?>
 			?>
 			<div class="alert alert-warning">
 			<div class="alert alert-warning">
 				<i class="fal fa-fw fa-clock"></i>
 				<i class="fal fa-fw fa-clock"></i>
-				<?=htmlspecialchars(_("Your account is not verified. You need to submit proof of ID and get your account verified before you can participate in tests."))?>
+				<?=htmlspecialchars(__("Your account is not verified. You need to submit proof of ID and get your account verified before you can participate in tests."))?>
 			</div>
 			</div>
 			<?php
 			<?php
 			break;
 			break;
@@ -24,7 +24,7 @@
 			?>
 			?>
 			<div class="alert alert-warning">
 			<div class="alert alert-warning">
 				<i class="fal fa-fw fa-clock"></i>
 				<i class="fal fa-fw fa-clock"></i>
-				<?=htmlspecialchars(_("Your account is pending verification. You will be able to participate in tests once verified."))?>
+				<?=htmlspecialchars(__("Your account is pending verification. You will be able to participate in tests once verified."))?>
 			</div>
 			</div>
 			<?php
 			<?php
 			break;
 			break;
@@ -32,7 +32,7 @@
 			?>
 			?>
 			<div class="alert alert-info">
 			<div class="alert alert-info">
 				<i class="fal fa-fw fa-info-circle"></i>
 				<i class="fal fa-fw fa-info-circle"></i>
-				<?=htmlspecialchars(_("Your account is deactivated. You will not be able to participate in any tests until you reactivate your account."))?>
+				<?=htmlspecialchars(__("Your account is deactivated. You will not be able to participate in any tests until you reactivate your account."))?>
 			</div>
 			</div>
 			<?php
 			<?php
 			break;
 			break;
@@ -43,7 +43,7 @@
 	<div class="row">
 	<div class="row">
 		<div class="col-xl mb-3 mb-lg-0">
 		<div class="col-xl mb-3 mb-lg-0">
 			<h3>
 			<h3>
-				<?=htmlspecialchars(_("Main Menu"))?>
+				<?=htmlspecialchars(__("Main Menu"))?>
 			</h3>
 			</h3>
 			<div class="row">
 			<div class="row">
 			<?php
 			<?php
@@ -80,7 +80,7 @@
 			<?php
 			<?php
 			if($to_do) {
 			if($to_do) {
 				?>
 				?>
-				<h3><?=htmlspecialchars(_("To-Do"))?></h3>
+				<h3><?=htmlspecialchars(__("To-Do"))?></h3>
 
 
 				<div class="row">
 				<div class="row">
 				<?php
 				<?php
@@ -117,31 +117,31 @@
 			if(Core::$user->level != User::LEVEL_DEACTIVATED && !Core::$user->terms_accepted) {
 			if(Core::$user->level != User::LEVEL_DEACTIVATED && !Core::$user->terms_accepted) {
 				?>
 				?>
 				<div class="alert alert-danger">
 				<div class="alert alert-danger">
-					<p><i class="fas fa-info-circle"></i> <strong><?=htmlspecialchars(_("Important"))?></strong></p>
+					<p><i class="fas fa-info-circle"></i> <strong><?=htmlspecialchars(__("Important"))?></strong></p>
 
 
 					<?php
 					<?php
 					if(is_null(Core::$user->terms_accepted)) {
 					if(is_null(Core::$user->terms_accepted)) {
 						?>
 						?>
 						<p>
 						<p>
 							<a href="/terms-and-conditions">Terms and Conditions</a> have been published.
 							<a href="/terms-and-conditions">Terms and Conditions</a> have been published.
-							<?=sprintf(htmlspecialchars(_("%sTerms and Conditions%s have been published.")), "<a href=\"/terms-and-conditions\">", "</a>")?>
+							<?=sprintf(htmlspecialchars(__("%sTerms and Conditions%s have been published.")), "<a href=\"/terms-and-conditions\">", "</a>")?>
 						</p>
 						</p>
 						<p>
 						<p>
-							<?=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>')?>
+							<?=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>')?>
 						</p>
 						</p>
 						<?php
 						<?php
 					}
 					}
 					else {
 					else {
 						?>
 						?>
 						<p>
 						<p>
-							<?=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>')?>
+							<?=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>')?>
 						</p>
 						</p>
 						<?php
 						<?php
 					}
 					}
 					?>
 					?>
 
 
-					<a class="btn btn-success" href="/account/accept-terms"><?=htmlspecialchars(_("Accept"))?></a>
-					<a class="btn btn-danger" href="/account/decline-terms"><?=htmlspecialchars(_("Decline"))?></a>
+					<a class="btn btn-success" href="/account/accept-terms"><?=htmlspecialchars(__("Accept"))?></a>
+					<a class="btn btn-danger" href="/account/decline-terms"><?=htmlspecialchars(__("Decline"))?></a>
 				</div>
 				</div>
 				<?php
 				<?php
 			}
 			}
@@ -151,50 +151,50 @@
 			<?php
 			<?php
 			if(Core::$user->isCustomer() == false) {
 			if(Core::$user->isCustomer() == false) {
 				?>
 				?>
-				<h3><?=htmlspecialchars(_("Useful Documents"))?></h3>
+				<h3><?=htmlspecialchars(__("Useful Documents"))?></h3>
 
 
 				<div class="list-group mb-3">
 				<div class="list-group mb-3">
 					<a class="list-group-item list-group-item-action" href="/files/id_response.pdf">
 					<a class="list-group-item list-group-item-action" href="/files/id_response.pdf">
 						<i class="fal fa-fw fa-file-pdf"></i>
 						<i class="fal fa-fw fa-file-pdf"></i>
-						<?=htmlspecialchars(_("ID Response for Testers"))?>
+						<?=htmlspecialchars(__("ID Response for Testers"))?>
 					</a>
 					</a>
 					<a class="list-group-item list-group-item-action" href="/files/testing_methodology.pdf">
 					<a class="list-group-item list-group-item-action" href="/files/testing_methodology.pdf">
 						<i class="fal fa-fw fa-file-pdf"></i>
 						<i class="fal fa-fw fa-file-pdf"></i>
-						<?=htmlspecialchars(_("Age Verification Testing Methodology"))?>
+						<?=htmlspecialchars(__("Age Verification Testing Methodology"))?>
 					</a>
 					</a>
 					<a class="list-group-item list-group-item-action" href="/files/machine_categories.pdf">
 					<a class="list-group-item list-group-item-action" href="/files/machine_categories.pdf">
 						<i class="fal fa-fw fa-file-pdf"></i>
 						<i class="fal fa-fw fa-file-pdf"></i>
-						<?=htmlspecialchars(_("Machine Categories"))?>
+						<?=htmlspecialchars(__("Machine Categories"))?>
 					</a>
 					</a>
 					<a class="list-group-item list-group-item-action" href="/files/testing_procedure.pdf">
 					<a class="list-group-item list-group-item-action" href="/files/testing_procedure.pdf">
 						<i class="fal fa-fw fa-file-pdf"></i>
 						<i class="fal fa-fw fa-file-pdf"></i>
-						<?=htmlspecialchars(_("Testing Procedure"))?>
+						<?=htmlspecialchars(__("Testing Procedure"))?>
 					</a>
 					</a>
 				</div>
 				</div>
 				<?php
 				<?php
 			}
 			}
 			?>
 			?>
 
 
-			<h3><?=htmlspecialchars(_("Referrals"))?></h3>
+			<h3><?=htmlspecialchars(__("Referrals"))?></h3>
 
 
 			<div class="list-group mb-3">
 			<div class="list-group mb-3">
 				<div class="list-group-item d-flex justify-content-between">
 				<div class="list-group-item d-flex justify-content-between">
 					<span>
 					<span>
 						<i class="fal fa-fw fa-users"></i>
 						<i class="fal fa-fw fa-users"></i>
-						<?=htmlspecialchars(_("Users Referred"))?>:
+						<?=htmlspecialchars(__("Users Referred"))?>:
 					</span>
 					</span>
 					<span><?=number_format(count($referrals))?></span>
 					<span><?=number_format(count($referrals))?></span>
 				</div>
 				</div>
 				<div class="list-group-item d-flex justify-content-between">
 				<div class="list-group-item d-flex justify-content-between">
 					<span>
 					<span>
 						<i class="fal fa-fw fa-external-link"></i>
 						<i class="fal fa-fw fa-external-link"></i>
-						<?=htmlspecialchars(_("Referral Link"))?>:
+						<?=htmlspecialchars(__("Referral Link"))?>:
 					</span>
 					</span>
 
 
 					<span>
 					<span>
-						<a href="#" data-clipboard-text="<?=PROTOCOL?>://<?=DOMAIN?>/register?r=<?=Core::$user->id?>" data-toggle="tooltip" data-title="<?=htmlspecialchars(_("Copy to clipboard"))?>">
+						<a href="#" data-clipboard-text="<?=PROTOCOL?>://<?=DOMAIN?>/register?r=<?=Core::$user->id?>" data-toggle="tooltip" data-title="<?=htmlspecialchars(__("Copy to clipboard"))?>">
 							<i class="fal fa-fw fa-clipboard"></i>
 							<i class="fal fa-fw fa-clipboard"></i>
-							<?=htmlspecialchars(_("Copy to clipboard"))?>
+							<?=htmlspecialchars(__("Copy to clipboard"))?>
 						</a>
 						</a>
 					</span>
 					</span>
 
 

+ 9 - 9
views/account_deactivate.php

@@ -1,24 +1,24 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 
 
-	<h2><?=htmlspecialchars(_("Deactivate Account"))?></h2>
+	<h2><?=htmlspecialchars(__("Deactivate Account"))?></h2>
 
 
-	<p><?=htmlspecialchars(_("By deactivating your account, you will:"))?></p>
+	<p><?=htmlspecialchars(__("By deactivating your account, you will:"))?></p>
 
 
 	<ul>
 	<ul>
-		<li><?=htmlspecialchars(_("No longer be assigned tests."))?></li>
-		<li><?=htmlspecialchars(_("No longer be able to participate in tests."))?></li>
-		<li><?=htmlspecialchars(_("Unassign yourself from all currently assigned tests."))?></li>
+		<li><?=htmlspecialchars(__("No longer be assigned tests."))?></li>
+		<li><?=htmlspecialchars(__("No longer be able to participate in tests."))?></li>
+		<li><?=htmlspecialchars(__("Unassign yourself from all currently assigned tests."))?></li>
 	</ul>
 	</ul>
 
 
-	<p><?=htmlspecialchars(_("You can always log into your account and reactivate the account should you wish to continue to use our services, however you will lose your currently assigned tests."))?></p>
+	<p><?=htmlspecialchars(__("You can always log into your account and reactivate the account should you wish to continue to use our services, however you will lose your currently assigned tests."))?></p>
 
 
 	<p class="text-danger">
 	<p class="text-danger">
-		<?=htmlspecialchars(_("This action cannot be undone."))?>
+		<?=htmlspecialchars(__("This action cannot be undone."))?>
 	</p>
 	</p>
 
 
 	<form method="post">
 	<form method="post">
-		<button class="btn btn-danger" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(_("Deactivate Account"))?></button>
-		<a class="btn btn-secondary" href="/account"><?=htmlspecialchars(_("Cancel"))?></a>
+		<button class="btn btn-danger" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(__("Deactivate Account"))?></button>
+		<a class="btn btn-secondary" href="/account"><?=htmlspecialchars(__("Cancel"))?></a>
 	</form>
 	</form>
 
 
 </div>
 </div>

+ 12 - 12
views/account_delete.php

@@ -1,28 +1,28 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 
 
-	<h2><?=htmlspecialchars(_("Delete Account"))?></h2>
+	<h2><?=htmlspecialchars(__("Delete Account"))?></h2>
 
 
-	<p><?=htmlspecialchars(_("By deleting your account, you will:"))?></p>
+	<p><?=htmlspecialchars(__("By deleting your account, you will:"))?></p>
 
 
 	<ul>
 	<ul>
-		<li><?=htmlspecialchars(_("No longer be assigned tests."))?></li>
-		<li><?=htmlspecialchars(_("No longer be able to participate in tests."))?></li>
-		<li><?=htmlspecialchars(_("No longer be able to generate invoices for completed tests."))?></li>
-		<li><?=htmlspecialchars(_("Unassign yourself from all currently assigned tests."))?></li>
-		<li><?=htmlspecialchars(_("Delete all personal identifiable information associated with your account."))?></li>
+		<li><?=htmlspecialchars(__("No longer be assigned tests."))?></li>
+		<li><?=htmlspecialchars(__("No longer be able to participate in tests."))?></li>
+		<li><?=htmlspecialchars(__("No longer be able to generate invoices for completed tests."))?></li>
+		<li><?=htmlspecialchars(__("Unassign yourself from all currently assigned tests."))?></li>
+		<li><?=htmlspecialchars(__("Delete all personal identifiable information associated with your account."))?></li>
 	</ul>
 	</ul>
 
 
-	<p><?=htmlspecialchars(_("If you have participated in tests, we will need to keep only your age and gender for test reporting purposes. This information will not and cannot be used to identify you."))?></p>
+	<p><?=htmlspecialchars(__("If you have participated in tests, we will need to keep only your age and gender for test reporting purposes. This information will not and cannot be used to identify you."))?></p>
 
 
-	<p><?=htmlspecialchars(_("You will need to register again should you wish to continue to use our services."))?></p>
+	<p><?=htmlspecialchars(__("You will need to register again should you wish to continue to use our services."))?></p>
 
 
 	<p class="text-danger">
 	<p class="text-danger">
-		<?=htmlspecialchars(_("This action cannot be undone."))?>
+		<?=htmlspecialchars(__("This action cannot be undone."))?>
 	</p>
 	</p>
 
 
 	<form method="post">
 	<form method="post">
-		<button class="btn btn-lg btn-danger" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(_("Delete Account"))?></button>
-		<a class="btn btn-lg btn-secondary" href="/account"><?=htmlspecialchars(_("Cancel"))?></a>
+		<button class="btn btn-lg btn-danger" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(__("Delete Account"))?></button>
+		<a class="btn btn-lg btn-secondary" href="/account"><?=htmlspecialchars(__("Cancel"))?></a>
 	</form>
 	</form>
 
 
 </div>
 </div>

+ 8 - 8
views/address_add_form.php

@@ -1,22 +1,22 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
-	<h2><?=htmlspecialchars(_("Add Address"))?></h2>
+	<h2><?=htmlspecialchars(__("Add Address"))?></h2>
 
 
 	<form method="post">
 	<form method="post">
 		<div class="form-group">
 		<div class="form-group">
-			<label for="name"><?=htmlspecialchars(_("Name"))?></label>
-			<input class="form-control" type="text" name="name" id="name" placeholder="<?=htmlspecialchars(_("Enter name"))?>" value="<?=htmlspecialchars($user_address->name)?>" required />
-			<small class="text-muted form-text"><?=htmlspecialchars(_("A friendly name for this address. For example: Home, Uni, Workplace, etc..."))?></small>
+			<label for="name"><?=htmlspecialchars(__("Name"))?></label>
+			<input class="form-control" type="text" name="name" id="name" placeholder="<?=htmlspecialchars(__("Enter name"))?>" value="<?=htmlspecialchars($user_address->name)?>" required />
+			<small class="text-muted form-text"><?=htmlspecialchars(__("A friendly name for this address. For example: Home, Uni, Workplace, etc..."))?></small>
 		</div>
 		</div>
 		<div class="form-group">
 		<div class="form-group">
-			<label for="postal-code"><?=htmlspecialchars(_("Postal Code"))?></label>
-			<input class="form-control" type="text" name="postal_code" id="postal-code" placeholder="<?=htmlspecialchars(_("Enter postal code"))?>" value="<?=htmlspecialchars($user_address->postal_code)?>" required />
+			<label for="postal-code"><?=htmlspecialchars(__("Postal Code"))?></label>
+			<input class="form-control" type="text" name="postal_code" id="postal-code" placeholder="<?=htmlspecialchars(__("Enter postal code"))?>" value="<?=htmlspecialchars($user_address->postal_code)?>" required />
 		</div>
 		</div>
 		<div class="form-group">
 		<div class="form-group">
-			<label  for="country"><?=htmlspecialchars(_("Country"))?></label>
+			<label  for="country"><?=htmlspecialchars(__("Country"))?></label>
 			<select class="form-control" name="country" id="country" required>
 			<select class="form-control" name="country" id="country" required>
 			<?=Form::renderCountryOptions($user_address->country)?>
 			<?=Form::renderCountryOptions($user_address->country)?>
 			</select>
 			</select>
 		</div>
 		</div>
-		<button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(_("Add"))?></button>
+		<button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(__("Add"))?></button>
 	</form>
 	</form>
 </div>
 </div>

+ 17 - 17
views/address_edit_form.php

@@ -1,43 +1,43 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
-	<h2><?=htmlspecialchars(_("Edit Address"))?></h2>
+	<h2><?=htmlspecialchars(__("Edit Address"))?></h2>
 
 
 	<form method="post">
 	<form method="post">
 		<div class="row">
 		<div class="row">
 			<div class="col-lg">
 			<div class="col-lg">
 
 
 				<div class="form-group">
 				<div class="form-group">
-					<label for="name"><?=htmlspecialchars(_("Name"))?></label>
-					<input class="form-control" type="text" name="name" id="name" placeholder="<?=htmlspecialchars(_("Enter name"))?>" value="<?=htmlspecialchars($user_address->name)?>" required />
+					<label for="name"><?=htmlspecialchars(__("Name"))?></label>
+					<input class="form-control" type="text" name="name" id="name" placeholder="<?=htmlspecialchars(__("Enter name"))?>" value="<?=htmlspecialchars($user_address->name)?>" required />
 				</div>
 				</div>
 				<div class="form-group">
 				<div class="form-group">
-					<label for="address-1"><?=htmlspecialchars(_("Address Line 1"))?></label>
-					<input class="form-control" type="text" name="address_1" id="address-1" placeholder="<?=htmlspecialchars(_("Enter address line 1"))?>" value="<?=htmlspecialchars($user_address->address_1)?>" required />
+					<label for="address-1"><?=htmlspecialchars(__("Address Line 1"))?></label>
+					<input class="form-control" type="text" name="address_1" id="address-1" placeholder="<?=htmlspecialchars(__("Enter address line 1"))?>" value="<?=htmlspecialchars($user_address->address_1)?>" required />
 				</div>
 				</div>
 				<div class="form-group">
 				<div class="form-group">
-					<label for="address-2"><?=htmlspecialchars(_("Address Line 2"))?></label>
-					<input class="form-control" type="text" name="address_2" id="address-2" placeholder="<?=htmlspecialchars(_("Enter address line 2"))?>" value="<?=htmlspecialchars($user_address->address_2)?>" />
+					<label for="address-2"><?=htmlspecialchars(__("Address Line 2"))?></label>
+					<input class="form-control" type="text" name="address_2" id="address-2" placeholder="<?=htmlspecialchars(__("Enter address line 2"))?>" value="<?=htmlspecialchars($user_address->address_2)?>" />
 				</div>
 				</div>
 				<div class="form-group">
 				<div class="form-group">
-					<label for="city"><?=htmlspecialchars(_("City"))?></label>
-					<input class="form-control" type="text" name="city" id="city" placeholder="<?=htmlspecialchars(_("Enter city"))?>" value="<?=htmlspecialchars($user_address->city)?>" required />
+					<label for="city"><?=htmlspecialchars(__("City"))?></label>
+					<input class="form-control" type="text" name="city" id="city" placeholder="<?=htmlspecialchars(__("Enter city"))?>" value="<?=htmlspecialchars($user_address->city)?>" required />
 				</div>
 				</div>
 				<div class="form-group">
 				<div class="form-group">
-					<label for="county"><?=htmlspecialchars(_("County"))?></label>
-					<input class="form-control" type="text" name="county" id="county" placeholder="<?=htmlspecialchars(_("Enter county"))?>" value="<?=htmlspecialchars($user_address->county)?>" />
+					<label for="county"><?=htmlspecialchars(__("County"))?></label>
+					<input class="form-control" type="text" name="county" id="county" placeholder="<?=htmlspecialchars(__("Enter county"))?>" value="<?=htmlspecialchars($user_address->county)?>" />
 				</div>
 				</div>
 				<div class="form-group">
 				<div class="form-group">
-					<label for="postal-code"><?=htmlspecialchars(_("Postal Code"))?></label>
-					<input class="form-control" type="text" name="postal_code" id="postal-code" placeholder="<?=htmlspecialchars(_("Enter postal code"))?>" value="<?=htmlspecialchars($user_address->postal_code)?>" required />
+					<label for="postal-code"><?=htmlspecialchars(__("Postal Code"))?></label>
+					<input class="form-control" type="text" name="postal_code" id="postal-code" placeholder="<?=htmlspecialchars(__("Enter postal code"))?>" value="<?=htmlspecialchars($user_address->postal_code)?>" required />
 				</div>
 				</div>
 				<div class="form-group">
 				<div class="form-group">
-					<label  for="country"><?=htmlspecialchars(_("Country"))?></label>
+					<label  for="country"><?=htmlspecialchars(__("Country"))?></label>
 					<select class="form-control" name="country" id="country" required>
 					<select class="form-control" name="country" id="country" required>
 					<?=Form::renderCountryOptions($user_address->country)?>
 					<?=Form::renderCountryOptions($user_address->country)?>
 					</select>
 					</select>
 				</div>
 				</div>
 			</div>
 			</div>
 			<div class="col-lg">
 			<div class="col-lg">
-				<label><?=htmlspecialchars(_("Map"))?></label>
+				<label><?=htmlspecialchars(__("Map"))?></label>
 				<div class="mb-3" id="map" style="height: 382px;" data-maps data-lat="<?=$user_address->latitude?>" data-lng="<?=$user_address->longitude?>" data-zoom="14" data-marker="true" data-marker-draggable="true" data-marker-dragend-target="#map-data"></div>
 				<div class="mb-3" id="map" style="height: 382px;" data-maps data-lat="<?=$user_address->latitude?>" data-lng="<?=$user_address->longitude?>" data-zoom="14" data-marker="true" data-marker-draggable="true" data-marker-dragend-target="#map-data"></div>
 
 
 				<div id="map-data">
 				<div id="map-data">
@@ -46,7 +46,7 @@
 				</div>
 				</div>
 
 
 				<div class="form-group">
 				<div class="form-group">
-					<label for="max-radius-miles"><?=htmlspecialchars(_("Max Distance"))?></label>
+					<label for="max-radius-miles"><?=htmlspecialchars(__("Max Distance"))?></label>
 					<select class="form-control" name="max_radius_miles" id="max-radius-miles" required>
 					<select class="form-control" name="max_radius_miles" id="max-radius-miles" required>
 					<?php
 					<?php
 					foreach(UserAddress::RADIUSES as $radius) {
 					foreach(UserAddress::RADIUSES as $radius) {
@@ -63,6 +63,6 @@
 			</div>
 			</div>
 		</div>
 		</div>
 
 
-		<button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(_("Save"))?></button>
+		<button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(__("Save"))?></button>
 	</form>
 	</form>
 </div>
 </div>

+ 6 - 6
views/addresses.php

@@ -1,11 +1,11 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
-	<h2><?=htmlspecialchars(_("Addresses"))?></h2>
+	<h2><?=htmlspecialchars(__("Addresses"))?></h2>
 
 
 	<?php
 	<?php
 	if(empty($addresses)) {
 	if(empty($addresses)) {
 		?>
 		?>
 		<div class="alert alert-info">
 		<div class="alert alert-info">
-			<?=htmlspecialchars(_("There are no addresses associated with your account."))?>
+			<?=htmlspecialchars(__("There are no addresses associated with your account."))?>
 		</div>
 		</div>
 		<?php
 		<?php
 	}
 	}
@@ -24,7 +24,7 @@
 						<?php
 						<?php
 						if($address->invoice) {
 						if($address->invoice) {
 							?>
 							?>
-							<span class="badge badge-primary"><?=htmlspecialchars(_("Invoice"))?></span>
+							<span class="badge badge-primary"><?=htmlspecialchars(__("Invoice"))?></span>
 							<?php
 							<?php
 						}
 						}
 						?>
 						?>
@@ -35,12 +35,12 @@
 						<?php
 						<?php
 						if(!$address->invoice) {
 						if(!$address->invoice) {
 							?>
 							?>
-							<button type="submit" class="btn btn-outline-info" name="invoice" value="<?=$address->id?>"><?=htmlspecialchars(_("Set as Invoice Address"))?></button>
+							<button type="submit" class="btn btn-outline-info" name="invoice" value="<?=$address->id?>"><?=htmlspecialchars(__("Set as Invoice Address"))?></button>
 							<?php
 							<?php
 						}
 						}
 						?>
 						?>
 
 
-						<a class="btn btn-outline-primary" href="/account/addresses/edit/<?=$address->id?>"><?=htmlspecialchars(_("Edit"))?></a>
+						<a class="btn btn-outline-primary" href="/account/addresses/edit/<?=$address->id?>"><?=htmlspecialchars(__("Edit"))?></a>
 					</div>
 					</div>
 				</div>
 				</div>
 			</div>
 			</div>
@@ -50,6 +50,6 @@
 	?>
 	?>
 	</form>
 	</form>
 
 
-	<a class="btn btn-primary" href="/account/addresses/add"><?=htmlspecialchars(_("Add"))?></a>
+	<a class="btn btn-primary" href="/account/addresses/add"><?=htmlspecialchars(__("Add"))?></a>
 
 
 </div>
 </div>

+ 7 - 7
views/become_a_tester.php

@@ -1,16 +1,16 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
-	<h2><?=htmlspecialchars(_("Join our Team"))?></h2>
+	<h2><?=htmlspecialchars(__("Join our Team"))?></h2>
 
 
-	<p><?=htmlspecialchars(_("We are always actively recruiting testers!"))?></p>
+	<p><?=htmlspecialchars(__("We are always actively recruiting testers!"))?></p>
 
 
-	<p><?=htmlspecialchars(_("We pay a fee per test, straight into your chosen bank account on a fortnightly/monthly basis. Ideal for students who want to earn some extra money for very little effort."))?></p>
+	<p><?=htmlspecialchars(__("We pay a fee per test, straight into your chosen bank account on a fortnightly/monthly basis. Ideal for students who want to earn some extra money for very little effort."))?></p>
 
 
-	<p><?=htmlspecialchars(_("If you are aged 18-20 and look younger than your years - we want to hear from you."))?></p>
+	<p><?=htmlspecialchars(__("If you are aged 18-20 and look younger than your years - we want to hear from you."))?></p>
 
 
-	<p><?=htmlspecialchars(_("There is no commitment to undertake - simply be available when called upon to visit a site and complete a test. Full training is given and you can earn as you test."))?></p>
+	<p><?=htmlspecialchars(__("There is no commitment to undertake - simply be available when called upon to visit a site and complete a test. Full training is given and you can earn as you test."))?></p>
 
 
-	<p><a class="btn btn-lg btn-primary" href="/register"><?=htmlspecialchars(_("Join our team now!"))?></a></p>
+	<p><a class="btn btn-lg btn-primary" href="/register"><?=htmlspecialchars(__("Join our team now!"))?></a></p>
 
 
-	<em><?=htmlspecialchars(_("Your details will NOT be shared with any third party."))?></em>
+	<em><?=htmlspecialchars(__("Your details will NOT be shared with any third party."))?></em>
 
 
 </div>
 </div>

+ 9 - 9
views/contact.php

@@ -1,9 +1,9 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 	<div class="row">
 	<div class="row">
 		<div class="col-lg-4">
 		<div class="col-lg-4">
-			<h2><?=htmlspecialchars(_("Contact Info"))?></h2>
+			<h2><?=htmlspecialchars(__("Contact Info"))?></h2>
 
 
-			<p><?=htmlspecialchars(_("We are always happy to receive correspondence. We try to answer all emails within an hour during working hours."))?></p>
+			<p><?=htmlspecialchars(__("We are always happy to receive correspondence. We try to answer all emails within an hour during working hours."))?></p>
 
 
 			<strong><address><?=htmlspecialchars(COMPANY_NAME)?><br /><?=nl2br(ADDRESS)?></address></strong>
 			<strong><address><?=htmlspecialchars(COMPANY_NAME)?><br /><?=nl2br(ADDRESS)?></address></strong>
 
 
@@ -13,28 +13,28 @@
 			</ul>
 			</ul>
 		</div>
 		</div>
 		<div class="col-lg-8">
 		<div class="col-lg-8">
-			<h2><?=htmlspecialchars(_("Contact Form"))?></h2>
+			<h2><?=htmlspecialchars(__("Contact Form"))?></h2>
 			<form method="post" data-recaptcha-form>
 			<form method="post" data-recaptcha-form>
 				<div class="row">
 				<div class="row">
 					<div class="col-md">
 					<div class="col-md">
 						<div class="form-group">
 						<div class="form-group">
-							<input class="form-control" type="text" name="name" placeholder="<?=htmlspecialchars(_("Enter name"))?>" required />
+							<input class="form-control" type="text" name="name" placeholder="<?=htmlspecialchars(__("Enter name"))?>" required />
 						</div>
 						</div>
 					</div>
 					</div>
 					<div class="col-md">
 					<div class="col-md">
 						<div class="form-group">
 						<div class="form-group">
-							<input class="form-control" type="text" name="email" placeholder="<?=htmlspecialchars(_("Enter email address"))?>" required />
+							<input class="form-control" type="text" name="email" placeholder="<?=htmlspecialchars(__("Enter email address"))?>" required />
 						</div>
 						</div>
 					</div>
 					</div>
 					<div class="col-md">
 					<div class="col-md">
 						<div class="form-group">
 						<div class="form-group">
-							<input class="form-control" type="text" name="phone" placeholder="<?=htmlspecialchars(_("Enter contact number"))?>" required />
+							<input class="form-control" type="text" name="phone" placeholder="<?=htmlspecialchars(__("Enter contact number"))?>" required />
 						</div>
 						</div>
 					</div>
 					</div>
 				</div>
 				</div>
 
 
 				<div class="form-group">
 				<div class="form-group">
-					<textarea class="form-control mb-3" name="message" placeholder="<?=htmlspecialchars(_("Enter message"))?>" rows="8" required></textarea>
+					<textarea class="form-control mb-3" name="message" placeholder="<?=htmlspecialchars(__("Enter message"))?>" rows="8" required></textarea>
 				</div>
 				</div>
 
 
 				<?php
 				<?php
@@ -48,7 +48,7 @@
 						?>
 						?>
 						<div class="mb-3 text-muted">
 						<div class="mb-3 text-muted">
 							<small>
 							<small>
-								<?=sprintf(htmlspecialchars(_("This site is protected by reCAPTCHA and the Google %sPrivacy Policy%s and %sTerms of Service%s apply.")),
+								<?=sprintf(htmlspecialchars(__("This site is protected by reCAPTCHA and the Google %sPrivacy Policy%s and %sTerms of Service%s apply.")),
 								'<a href="https://policies.google.com/privacy">', '</a>',
 								'<a href="https://policies.google.com/privacy">', '</a>',
 								'<a href="https://policies.google.com/terms">', '</a>'
 								'<a href="https://policies.google.com/terms">', '</a>'
 								)?>
 								)?>
@@ -61,7 +61,7 @@
 				}
 				}
 				?>
 				?>
 
 
-				<button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(_("Send Message"))?></button>
+				<button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>"><?=htmlspecialchars(__("Send Message"))?></button>
 			</form>
 			</form>
 		</div>
 		</div>
 	</div>
 	</div>

+ 8 - 2
views/customer_form.php

@@ -47,17 +47,23 @@
 			</div>
 			</div>
 		</div>
 		</div>
 		<div class="row mb-1">
 		<div class="row mb-1">
-			<label class="col-sm-4 col-form-label"for="email">Email Address</label>
+			<label class="col-sm-4 col-form-label" for="email">Email Address</label>
 			<div class="col-sm">
 			<div class="col-sm">
 				<input class="form-control" type="email" name="email" id="email" placeholder="Enter email address" value="<?=htmlspecialchars($customer->email)?>" />
 				<input class="form-control" type="email" name="email" id="email" placeholder="Enter email address" value="<?=htmlspecialchars($customer->email)?>" />
 			</div>
 			</div>
 		</div>
 		</div>
 		<div class="row mb-1">
 		<div class="row mb-1">
-			<label class="col-sm-4 col-form-label"for="phone">Contact Number</label>
+			<label class="col-sm-4 col-form-label" for="phone">Contact Number</label>
 			<div class="col-sm">
 			<div class="col-sm">
 				<input class="form-control" type="text" name="phone" id="phone" placeholder="Enter contact number" value="<?=htmlspecialchars($customer->phone)?>" />
 				<input class="form-control" type="text" name="phone" id="phone" placeholder="Enter contact number" value="<?=htmlspecialchars($customer->phone)?>" />
 			</div>
 			</div>
 		</div>
 		</div>
+		<div class="row mb-1">
+			<label class="col-sm-4 col-form-label" for="invoice-contact-name">Invoice Contact Name</label>
+			<div class="col-sm">
+				<input class="form-control" type="text" name="invoice_contact_name" id="invoice-contact-name" placeholder="Enter invoice contact name" value="<?=htmlspecialchars($customer->invoice_contact_name)?>" />
+			</div>
+		</div>
 		<div class="row my-3">
 		<div class="row my-3">
 			<div class="col-sm offset-sm-4">
 			<div class="col-sm offset-sm-4">
 				<div class="form-check">
 				<div class="form-check">

+ 1 - 1
views/error.php

@@ -1,6 +1,6 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 
 
-	<h2><?=htmlspecialchars(_("Error"))?></h2>
+	<h2><?=htmlspecialchars(__("Error"))?></h2>
 
 
 	<div class="alert alert-danger">
 	<div class="alert alert-danger">
 		<i class="fal fa-fw fa-exclamation-circle"></i>
 		<i class="fal fa-fw fa-exclamation-circle"></i>

+ 12 - 12
views/footer.php

@@ -9,30 +9,30 @@
 
 
 				<div class="row">
 				<div class="row">
 					<div class="col-md mb-3">
 					<div class="col-md mb-3">
-						<h5><?=htmlspecialchars(_("Navigation"))?></h5>
+						<h5><?=htmlspecialchars(__("Navigation"))?></h5>
 						<ul class="nav flex-column">
 						<ul class="nav flex-column">
-							<li><a href="/home"><?=htmlspecialchars(_("Home"))?></a></li>
+							<li><a href="/home"><?=htmlspecialchars(__("Home"))?></a></li>
 
 
 							<?php
 							<?php
 							if(!Core::$user) {
 							if(!Core::$user) {
 								?>
 								?>
-								<li><a href="/services"><?=htmlspecialchars(_("Services"))?></a></li>
-								<li><a href="/become-a-tester"><?=htmlspecialchars(_("Become a Tester"))?></a></li>
-								<li><a href="/contact"><?=htmlspecialchars(_("Contact"))?></a></li>
-								<li><a href="/jobs"><?=htmlspecialchars(_("Jobs"))?></a></li>
+								<li><a href="/services"><?=htmlspecialchars(__("Services"))?></a></li>
+								<li><a href="/become-a-tester"><?=htmlspecialchars(__("Become a Tester"))?></a></li>
+								<li><a href="/contact"><?=htmlspecialchars(__("Contact"))?></a></li>
+								<li><a href="/jobs"><?=htmlspecialchars(__("Jobs"))?></a></li>
 								<?php
 								<?php
 							}
 							}
 							else {
 							else {
 								?>
 								?>
-								<li><a href="/contact"><?=htmlspecialchars(_("Contact"))?></a></li>
-								<li><a href="/account"><?=htmlspecialchars(_("Account"))?></a></li>
+								<li><a href="/contact"><?=htmlspecialchars(__("Contact"))?></a></li>
+								<li><a href="/account"><?=htmlspecialchars(__("Account"))?></a></li>
 								<?php
 								<?php
 							}
 							}
 							?>
 							?>
 						</ul>
 						</ul>
 					</div>
 					</div>
 					<div class="col-md mb-3">
 					<div class="col-md mb-3">
-						<h5><?=htmlspecialchars(_("Follow Us"))?></h5>
+						<h5><?=htmlspecialchars(__("Follow Us"))?></h5>
 						<ul class="nav flex-column">
 						<ul class="nav flex-column">
 							<li><i class="fab fa-fw fa-facebook"></i> <a href="https://www.facebook.com/checkpolicy" target="_blank">Facebook</a></li>
 							<li><i class="fab fa-fw fa-facebook"></i> <a href="https://www.facebook.com/checkpolicy" target="_blank">Facebook</a></li>
 							<?php
 							<?php
@@ -45,7 +45,7 @@
 						</ul>
 						</ul>
 					</div>
 					</div>
 					<div class="col-md mb-3">
 					<div class="col-md mb-3">
-						<h5><?=htmlspecialchars(_("Our Location"))?></h5>
+						<h5><?=htmlspecialchars(__("Our Location"))?></h5>
 						<ul class="nav flex-column">
 						<ul class="nav flex-column">
 							<li><i class="fal fa-fw fa-map-marker"></i> <?=htmlspecialchars(str_replace("\n", ", ", ADDRESS))?></li>
 							<li><i class="fal fa-fw fa-map-marker"></i> <?=htmlspecialchars(str_replace("\n", ", ", ADDRESS))?></li>
 							<li><i class="fal fa-fw fa-phone"></i> <a href="tel:<?=urlencode(PHONE)?>"><?=htmlspecialchars(PHONE)?></a></li>
 							<li><i class="fal fa-fw fa-phone"></i> <a href="tel:<?=urlencode(PHONE)?>"><?=htmlspecialchars(PHONE)?></a></li>
@@ -58,8 +58,8 @@
 				<div class="text-center">
 				<div class="text-center">
 					&copy; <?=date("Y")?> <?=APP_NAME?><br />
 					&copy; <?=date("Y")?> <?=APP_NAME?><br />
 					<small>
 					<small>
-						<a class="mx-1" href="/terms-and-conditions"><?=htmlspecialchars(_("Terms & Conditions"))?></a>
-						<a class="mx-1" href="/privacy-policy"><?=htmlspecialchars(_("Privacy Policy"))?></a>
+						<a class="mx-1" href="/terms-and-conditions"><?=htmlspecialchars(__("Terms & Conditions"))?></a>
+						<a class="mx-1" href="/privacy-policy"><?=htmlspecialchars(__("Privacy Policy"))?></a>
 					</small>
 					</small>
 				</div>
 				</div>
 			</div>
 			</div>

+ 14 - 14
views/header.php

@@ -25,10 +25,10 @@ if($print) $body_class = "print";
 
 
 		<meta property="og:site_name" content="<?=htmlspecialchars(APP_NAME)?>" />
 		<meta property="og:site_name" content="<?=htmlspecialchars(APP_NAME)?>" />
 		<meta property="og:title" content="<?=htmlspecialchars($page_title)?>" />
 		<meta property="og:title" content="<?=htmlspecialchars($page_title)?>" />
-		<meta property="og:description" content="<?=htmlspecialchars(_("Age Verification Testing and Training across the UK"))?>" />
+		<meta property="og:description" content="<?=htmlspecialchars(__("Age Verification Testing and Training across the UK"))?>" />
 		<meta property="og:type" content="website" />
 		<meta property="og:type" content="website" />
 		<meta property="og:image" content="<?=PROTOCOL?>://<?=DOMAIN?>/img/logo.png" />
 		<meta property="og:image" content="<?=PROTOCOL?>://<?=DOMAIN?>/img/logo.png" />
-		<meta property="og:image:alt" content="Check Policy logo" />
+		<meta property="og:image:alt" content="<?=htmlspecialchars(APP_NAME)?> logo" />
 		<meta property="og:url" content="<?=PROTOCOL?>://<?=DOMAIN?><?=htmlspecialchars($_SERVER["REQUEST_URI"])?>" />
 		<meta property="og:url" content="<?=PROTOCOL?>://<?=DOMAIN?><?=htmlspecialchars($_SERVER["REQUEST_URI"])?>" />
 
 
 		<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet" />
 		<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet" />
@@ -71,38 +71,38 @@ if($print) $body_class = "print";
 						if(!Core::isLoggedIn()) {
 						if(!Core::isLoggedIn()) {
 							?>
 							?>
 							<li class="nav-item">
 							<li class="nav-item">
-								<a class="nav-link" href="/services"><?=htmlspecialchars(_("Services"))?></a>
+								<a class="nav-link" href="/services"><?=htmlspecialchars(__("Services"))?></a>
 							</li>
 							</li>
 							<li class="nav-item">
 							<li class="nav-item">
-								<a class="nav-link" href="/become-a-tester"><?=htmlspecialchars(_("Become a Tester"))?></a>
+								<a class="nav-link" href="/become-a-tester"><?=htmlspecialchars(__("Become a Tester"))?></a>
 							</li>
 							</li>
 							<?php
 							<?php
 						}
 						}
 						?>
 						?>
 						<li class="nav-item">
 						<li class="nav-item">
-							<a class="nav-link" href="/contact"><?=htmlspecialchars(_("Contact"))?></a>
+							<a class="nav-link" href="/contact"><?=htmlspecialchars(__("Contact"))?></a>
 						</li>
 						</li>
 						<?php
 						<?php
 						if(Core::isLoggedIn()) {
 						if(Core::isLoggedIn()) {
 							?>
 							?>
 							<li class="nav-item">
 							<li class="nav-item">
-								<a class="nav-link" href="/account"><?=htmlspecialchars(_("Account"))?></a>
+								<a class="nav-link" href="/account"><?=htmlspecialchars(__("Account"))?></a>
 							</li>
 							</li>
 							<li class="nav-item">
 							<li class="nav-item">
-								<a class="nav-link" href="/log-out"><?=htmlspecialchars(_("Log Out"))?></a>
+								<a class="nav-link" href="/log-out"><?=htmlspecialchars(__("Log Out"))?></a>
 							</li>
 							</li>
 							<?php
 							<?php
 						}
 						}
 						else {
 						else {
 							?>
 							?>
 							<li class="nav-item">
 							<li class="nav-item">
-								<a class="nav-link" href="/jobs"><?=htmlspecialchars(_("Jobs"))?></a>
+								<a class="nav-link" href="/jobs"><?=htmlspecialchars(__("Jobs"))?></a>
 							</li>
 							</li>
 							<li class="nav-item">
 							<li class="nav-item">
-								<a class="nav-link" href="/register"><?=htmlspecialchars(_("Register"))?></a>
+								<a class="nav-link" href="/register"><?=htmlspecialchars(__("Register"))?></a>
 							</li>
 							</li>
 							<li class="nav-item">
 							<li class="nav-item">
-								<a class="nav-link" href="/log-in"><?=htmlspecialchars(_("Log In"))?></a>
+								<a class="nav-link" href="/log-in"><?=htmlspecialchars(__("Log In"))?></a>
 							</li>
 							</li>
 							<?php
 							<?php
 						}
 						}
@@ -121,8 +121,8 @@ if($print) $body_class = "print";
 		if(!PRODUCTION) {
 		if(!PRODUCTION) {
 			$style = (count(Core::$breadcrumbs) > 1) ? "margin-top: -1rem;" : "";
 			$style = (count(Core::$breadcrumbs) > 1) ? "margin-top: -1rem;" : "";
 			?>
 			?>
-			<div class="p-2 mb-3 bg-danger text-white text-center d-print-none" style="<?=$style?>">
-				<strong><?=htmlspecialchars(_("PLEASE NOTE:"))?></strong> <?=htmlspecialchars(_("This is a development version of the site."))?>
+			<div class="p-2 bg-danger text-white text-center d-print-none" style="<?=$style?>">
+				<strong><?=htmlspecialchars(__("PLEASE NOTE:"))?></strong> <?=htmlspecialchars(__("This is a development version of the site."))?>
 			</div>
 			</div>
 			<?php
 			<?php
 		}
 		}
@@ -168,8 +168,8 @@ if($print) $body_class = "print";
 							<i class="fal fa-fw fa-info-circle"></i>
 							<i class="fal fa-fw fa-info-circle"></i>
 						</div>
 						</div>
 						<div class="col">
 						<div class="col">
-							<strong><?=htmlspecialchars(_("This site uses cookies to improve functionality and personalisation."))?></strong><br />
-							<?=htmlspecialchars(_("By continuing to use the site, you consent to our use of cookies and our privacy policy."))?>
+							<strong><?=htmlspecialchars(__("This site uses cookies to improve functionality and personalisation."))?></strong><br />
+							<?=htmlspecialchars(__("By continuing to use the site, you consent to our use of cookies and our privacy policy."))?>
 						</div>
 						</div>
 					</div>
 					</div>
 				</div>
 				</div>

+ 13 - 13
views/home.php

@@ -8,7 +8,7 @@
 		    <img class="d-block w-100" src="/img/blank_carousel.png" alt="Gaming Machine" style="background-image: url(/img/gaming_machine.jpg);" />
 		    <img class="d-block w-100" src="/img/blank_carousel.png" alt="Gaming Machine" style="background-image: url(/img/gaming_machine.jpg);" />
 			<div class="carousel-caption d-none d-md-block">
 			<div class="carousel-caption d-none d-md-block">
 				<div class="carousel-caption-inner">
 				<div class="carousel-caption-inner">
-					<h5><?=htmlspecialchars(_("Age Verification Testing and Training across the UK"))?></h5>
+					<h5><?=htmlspecialchars(__("Age Verification Testing and Training across the UK"))?></h5>
 				</div>
 				</div>
 			</div>
 			</div>
 		</div>
 		</div>
@@ -16,18 +16,18 @@
 		    <img class="d-block w-100" src="/img/blank_carousel.png" alt="Wine Aisle" style="background-image: url(/img/wine.jpg);" />
 		    <img class="d-block w-100" src="/img/blank_carousel.png" alt="Wine Aisle" style="background-image: url(/img/wine.jpg);" />
 			<div class="carousel-caption d-none d-md-block">
 			<div class="carousel-caption d-none d-md-block">
 				<div class="carousel-caption-inner">
 				<div class="carousel-caption-inner">
-					<h5><?=htmlspecialchars(_("Do you know how old your clients are? Do you ask for proof of ID if not sure?"))?></h5>
+					<h5><?=htmlspecialchars(__("Do you know how old your clients are? Do you ask for proof of ID if not sure?"))?></h5>
 				</div>
 				</div>
 			</div>
 			</div>
 		</div>
 		</div>
 	</div>
 	</div>
 	<a class="carousel-control-prev" href="#home-carousel" role="button" data-slide="prev">
 	<a class="carousel-control-prev" href="#home-carousel" role="button" data-slide="prev">
 		<span class="carousel-control-prev-icon" aria-hidden="true"></span>
 		<span class="carousel-control-prev-icon" aria-hidden="true"></span>
-		<span class="sr-only"><?=htmlspecialchars(_("Previous"))?></span>
+		<span class="sr-only"><?=htmlspecialchars(__("Previous"))?></span>
 	</a>
 	</a>
 	<a class="carousel-control-next" href="#home-carousel" role="button" data-slide="next">
 	<a class="carousel-control-next" href="#home-carousel" role="button" data-slide="next">
 		<span class="carousel-control-next-icon" aria-hidden="true"></span>
 		<span class="carousel-control-next-icon" aria-hidden="true"></span>
-		<span class="sr-only"><?=htmlspecialchars(_("Next"))?></span>
+		<span class="sr-only"><?=htmlspecialchars(__("Next"))?></span>
 	</a>
 	</a>
 </div>
 </div>
 
 
@@ -42,21 +42,21 @@
 	<div class="py-4">
 	<div class="py-4">
 
 
 		<div class="text-lg-center">
 		<div class="text-lg-center">
-			<h2><?=htmlspecialchars(_("What else can Check Policy do for you?"))?></h2>
+			<h2><?=htmlspecialchars(__("What else can %s do for you?", APP_NAME))?></h2>
 		</div>
 		</div>
 
 
 		<div class="row">
 		<div class="row">
 			<div class="col-xl">
 			<div class="col-xl">
-				<h3><?=htmlspecialchars(_("Immediate Test Results"))?></h3>
-				<p><?=htmlspecialchars(_("All our testers provide live test results or at least as live as a data connection will allow. Once the test has been completed, you will get the result emailed to you immediately with total transparency. We believe you need the results, whether good or bad, to satisfy guidelines and regulations."))?></p>
+				<h3><?=htmlspecialchars(__("Immediate Test Results"))?></h3>
+				<p><?=htmlspecialchars(__("All our testers provide live test results or at least as live as a data connection will allow. Once the test has been completed, you will get the result emailed to you immediately with total transparency. We believe you need the results, whether good or bad, to satisfy guidelines and regulations."))?></p>
 			</div>
 			</div>
 			<div class="col-xl">
 			<div class="col-xl">
-				<h3><?=htmlspecialchars(_("Test Certificates Awarded"))?></h3>
-				<p><?=htmlspecialchars(_("If you pass the test, then you will be awarded a certificate of evidence to prove you and your team (if applicable) are following guidelines and regulations. You can decide whether to frame it to show clients or file it to show any future testing authority. It's up to you."))?></p>
+				<h3><?=htmlspecialchars(__("Test Certificates Awarded"))?></h3>
+				<p><?=htmlspecialchars(__("If you pass the test, then you will be awarded a certificate of evidence to prove you and your team (if applicable) are following guidelines and regulations. You can decide whether to frame it to show clients or file it to show any future testing authority. It's up to you."))?></p>
 			</div>
 			</div>
 			<div class="col-xl">
 			<div class="col-xl">
-				<h3><?=htmlspecialchars(_("Ongoing Training & Testing"))?></h3>
-				<p><?=htmlspecialchars(_("Should you fail the test, we would obviously like to provide you with support and ongoing training to improve your results for the next time. With our training we will highlight your weaknesses and strengths so your business is following the required regulations."))?></p>
+				<h3><?=htmlspecialchars(__("Ongoing Training & Testing"))?></h3>
+				<p><?=htmlspecialchars(__("Should you fail the test, we would obviously like to provide you with support and ongoing training to improve your results for the next time. With our training we will highlight your weaknesses and strengths so your business is following the required regulations."))?></p>
 			</div>
 			</div>
 		</div>
 		</div>
 	</div>
 	</div>
@@ -65,8 +65,8 @@
 		<div class="col-sm align-self-center mb-3 text-center">
 		<div class="col-sm align-self-center mb-3 text-center">
 			<i class="fab fa-whatsapp fa-4x mb-3"></i>
 			<i class="fab fa-whatsapp fa-4x mb-3"></i>
 			<div class="lead">
 			<div class="lead">
-				<?=sprintf(htmlspecialchars(_("Call or WhatsApp us on %s")), PHONE)?><br />
-				<small><?=htmlspecialchars(_("Calls are charged at mobile call rates"))?></small>
+				<?=sprintf(htmlspecialchars(__("Call or WhatsApp us on %s")), PHONE)?><br />
+				<small><?=htmlspecialchars(__("Calls are charged at mobile call rates"))?></small>
 			</div>
 			</div>
 		</div>
 		</div>
 	</div>
 	</div>

+ 8 - 8
views/jobs.php

@@ -1,19 +1,19 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
-	<h2><?=htmlspecialchars(_("We are recruiting!"))?></h2>
+	<h2><?=htmlspecialchars(__("We are recruiting!"))?></h2>
 
 
-	<p><?=htmlspecialchars(_("We are looking for testers nationwide!"))?></p>
+	<p><?=htmlspecialchars(__("We are looking for testers nationwide!"))?></p>
 
 
-	<p><?=htmlspecialchars(_("The job entails visiting Gaming Arcades with a view to perform Age Verification Checking - getting challenged for ID."))?></p>
+	<p><?=htmlspecialchars(__("The job entails visiting Gaming Arcades with a view to perform Age Verification Checking - getting challenged for ID."))?></p>
 
 
-	<p><?=htmlspecialchars(_("Full training will be given by webinar, videos and telephone."))?></p>
+	<p><?=htmlspecialchars(__("Full training will be given by webinar, videos and telephone."))?></p>
 
 
-	<p><?=htmlspecialchars(_("We pay £10 per visit which will last a maximum of 5 minutes!"))?></p>
+	<p><?=htmlspecialchars(__("We pay £10 per visit which will last a maximum of 5 minutes!"))?></p>
 
 
-	<p><?=htmlspecialchars(_("Register to get your pack now!"))?></p>
+	<p><?=htmlspecialchars(__("Register to get your pack now!"))?></p>
 
 
-	<p><?=htmlspecialchars(_("Our new testing campaign begins in January - so be quick and register."))?></p>
+	<p><?=htmlspecialchars(__("Our new testing campaign begins in January - so be quick and register."))?></p>
 
 
-	<p><em><?=htmlspecialchars(_("Please note that NONE of your details will be shared with any third party apart from your photo which may have to be provided to our clients should they have a need to confirm CCTV identity."))?></em></p>
+	<p><em><?=htmlspecialchars(__("Please note that NONE of your details will be shared with any third party apart from your photo which may have to be provided to our clients should they have a need to confirm CCTV identity."))?></em></p>
 
 
 
 
 </div>
 </div>

+ 6 - 0
views/location.php

@@ -19,6 +19,12 @@ if($location->internal_id) $details["Internal ID"] = $location->internal_id;
 if($location->area_manager) $details["Area Manager"] = $location->area_manager;
 if($location->area_manager) $details["Area Manager"] = $location->area_manager;
 
 
 $photos = $location->getPhotos();
 $photos = $location->getPhotos();
+$venue_types = $location->getVenueTypes();
+$type_names = array_column($venue_types, "name");
+$type_names_csv = implode(", ", $type_names);
+
+
+if($venue_types) $details["Types"] = $type_names_csv;
 
 
 ?>
 ?>
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">

+ 35 - 0
views/location_form.php

@@ -3,6 +3,17 @@ $tabs = [
 	["details", "Details"],
 	["details", "Details"],
 	["photos", "Photos"],
 	["photos", "Photos"],
 ];
 ];
+
+$venue_types = VenueType::getAll();
+$venue_type_count = count($venue_types);
+$venue_type_columns = array_chunk($venue_types, ceil($venue_type_count / 2));
+
+$selected_venue_type_ids = [];
+if($location->id) {
+	$location_venue_types = $location->getVenueTypes();
+	$selected_venue_type_ids = array_column($location_venue_types, "id");
+}
+
 ?>
 ?>
 
 
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
@@ -173,6 +184,30 @@ $tabs = [
 							</div>
 							</div>
 						</div>
 						</div>
 
 
+						<h3>Venue Types</h3>
+
+						<div class="row">
+						<?php
+						foreach($venue_type_columns as $types) {
+							?>
+							<div class="col-lg-6">
+							<?php
+							foreach($types as $type) {
+								$checked = in_array($type->id, $selected_venue_type_ids) ? "checked" : "";
+								?>
+								<div class="form-check">
+									<input class="form-check-input" id="venue-type-id-<?=$type->id?>" name="venue_type_ids[]" type="checkbox" value="<?=$type->id?>" <?=$checked?> />
+									<label class="form-check-label" for="venue-type-id-<?=$type->id?>"><?=htmlspecialchars($type->name)?></label>
+								</div>
+								<?php
+							}
+							?>
+							</div>
+							<?php
+						}
+						?>
+						</div>
+
 					</div>
 					</div>
 				</div>
 				</div>
 			</div>
 			</div>

+ 7 - 7
views/log_in.php

@@ -1,29 +1,29 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 
 
-	<h2><?=htmlspecialchars(_("Log In"))?></h2>
+	<h2><?=htmlspecialchars(__("Log In"))?></h2>
 
 
 	<form method="post">
 	<form method="post">
 
 
 		<div class="row">
 		<div class="row">
 			<div class="col-lg-8 offset-lg-2">
 			<div class="col-lg-8 offset-lg-2">
 				<div class="row mb-1">
 				<div class="row mb-1">
-					<label class="col-sm-4 col-form-label" for="email"><?=htmlspecialchars(_("Email Address"))?></label>
+					<label class="col-sm-4 col-form-label" for="email"><?=htmlspecialchars(__("Email Address"))?></label>
 					<div class="col-sm">
 					<div class="col-sm">
-						<input class="form-control" type="email" name="email" placeholder="<?=htmlspecialchars(_("Enter email address"))?>" required />
+						<input class="form-control" type="email" name="email" placeholder="<?=htmlspecialchars(__("Enter email address"))?>" required />
 					</div>
 					</div>
 				</div>
 				</div>
 
 
 				<div class="row mb-1">
 				<div class="row mb-1">
-					<label class="col-sm-4 col-form-label" for="password"><?=htmlspecialchars(_("Password"))?></label>
+					<label class="col-sm-4 col-form-label" for="password"><?=htmlspecialchars(__("Password"))?></label>
 					<div class="col-sm">
 					<div class="col-sm">
-						<input class="form-control" type="password" name="password" placeholder="<?=htmlspecialchars(_("Enter password"))?>" required />
+						<input class="form-control" type="password" name="password" placeholder="<?=htmlspecialchars(__("Enter password"))?>" required />
 					</div>
 					</div>
 				</div>
 				</div>
 
 
 				<div class="row">
 				<div class="row">
 					<div class="col-sm offset-sm-4">
 					<div class="col-sm offset-sm-4">
-						<button class="btn btn-primary" type="submit" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>"><?=htmlspecialchars(_("Log In"))?></button>
-						<a class="btn btn-secondary" href="/reset-password"><?=htmlspecialchars(_("Forgot Password"))?></a>
+						<button class="btn btn-primary" type="submit" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>"><?=htmlspecialchars(__("Log In"))?></button>
+						<a class="btn btn-secondary" href="/reset-password"><?=htmlspecialchars(__("Forgot Password"))?></a>
 					</div>
 					</div>
 				</div>
 				</div>
 
 

+ 1 - 1
views/map_overview.php

@@ -1,4 +1,4 @@
-<div class="container">
+<div class="container mt-3 py-4">
 
 
 	<input type="hidden" id="submit" value="<?=$_SESSION["csrf_token"]?>" />
 	<input type="hidden" id="submit" value="<?=$_SESSION["csrf_token"]?>" />
 
 

+ 7 - 7
views/modal_services_1.php

@@ -3,23 +3,23 @@
 		<div class="modal-content">
 		<div class="modal-content">
 			<form>
 			<form>
 				<div class="modal-header">
 				<div class="modal-header">
-					<h5 class="modal-title"><strong><?=htmlspecialchars(_("Age-Related Products"))?></strong></h5>
+					<h5 class="modal-title"><strong><?=htmlspecialchars(__("Age-Related Products"))?></strong></h5>
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 						<span aria-hidden="true">&times;</span>
 						<span aria-hidden="true">&times;</span>
 					</button>
 					</button>
 				</div>
 				</div>
 				<div class="modal-body">
 				<div class="modal-body">
 
 
-					<p><img class="img-fluid" src="/img/cigarettes.jpg" alt="<?=htmlspecialchars(_("Cigarettes"))?>" /></p>
+					<p><img class="img-fluid" src="/img/cigarettes.jpg" alt="<?=htmlspecialchars(__("Cigarettes"))?>" /></p>
 
 
-					<p><?=htmlspecialchars(_("If you are selling age-related products or services such as cigarettes, alcohol and gambling. Then it is advisable to be tested independently to ensure you are able to identify and refuse persons wishing to purchase your services. Again this sounds very easy, to ask someones age and verify it, but in reality it's quite an issue."))?></p>
+					<p><?=htmlspecialchars(__("If you are selling age-related products or services such as cigarettes, alcohol and gambling. Then it is advisable to be tested independently to ensure you are able to identify and refuse persons wishing to purchase your services. Again this sounds very easy, to ask someones age and verify it, but in reality it's quite an issue."))?></p>
 
 
-					<p><?=htmlspecialchars(_("A simple check by one of Check Policy's mystery shoppers will determine whether you and your staff are adhering to guidelines when serving age-related products."))?></p>
+					<p><?=htmlspecialchars(__("A simple check by one of %s's mystery shoppers will determine whether you and your staff are adhering to guidelines when serving age-related products.", APP_NAME))?></p>
 
 
-					<p><?=htmlspecialchars(_("How it works:"))?><br />
-					<?=htmlspecialchars(_("One of our Shoppers will visit your site and try to purchase an age-related product or service. If they are successful and not asked any questions to verify their age you will fail. The test report will be sent to you immediately upon completing the test by our automated system; designed to show the full procedure of the test and after you can make a decision to opt for further training if needed."))?></p>
+					<p><?=htmlspecialchars(__("How it works:"))?><br />
+					<?=htmlspecialchars(__("One of our Shoppers will visit your site and try to purchase an age-related product or service. If they are successful and not asked any questions to verify their age you will fail. The test report will be sent to you immediately upon completing the test by our automated system; designed to show the full procedure of the test and after you can make a decision to opt for further training if needed."))?></p>
 
 
-					<p><?=htmlspecialchars(_("Check Policy is here to help and guide you along the way."))?></p>
+					<p><?=htmlspecialchars(__("%s is here to help and guide you along the way.", APP_NAME))?></p>
 				</div>
 				</div>
 			</form>
 			</form>
 		</div>
 		</div>

+ 6 - 6
views/modal_services_2.php

@@ -3,21 +3,21 @@
 		<div class="modal-content">
 		<div class="modal-content">
 			<form>
 			<form>
 				<div class="modal-header">
 				<div class="modal-header">
-					<h5 class="modal-title"><strong><?=htmlspecialchars(_("Age Verification Testing"))?></strong></h5>
+					<h5 class="modal-title"><strong><?=htmlspecialchars(__("Age Verification Testing"))?></strong></h5>
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 						<span aria-hidden="true">&times;</span>
 						<span aria-hidden="true">&times;</span>
 					</button>
 					</button>
 				</div>
 				</div>
 				<div class="modal-body">
 				<div class="modal-body">
 
 
-					<p><img class="img-fluid" src="/img/driving_licence.jpg" alt="<?=htmlspecialchars(_("Driving Licence"))?>" /></p>
+					<p><img class="img-fluid" src="/img/driving_licence.jpg" alt="<?=htmlspecialchars(__("Driving Licence"))?>" /></p>
 
 
-					<p><?=htmlspecialchars(_("It sounds simple doesn't it, to verify someones age?!"))?><br />
-					<?=htmlspecialchars(_("However our tests have revealed that it's quite a challenge for some people to actually ask for ID when selling age-related products or services. It is against the law to sell age-related products or services to minors so it does become quite an issue."))?></p>
+					<p><?=htmlspecialchars(__("It sounds simple doesn't it, to verify someones age?!"))?><br />
+					<?=htmlspecialchars(__("However our tests have revealed that it's quite a challenge for some people to actually ask for ID when selling age-related products or services. It is against the law to sell age-related products or services to minors so it does become quite an issue."))?></p>
 
 
-					<p><?=htmlspecialchars(_("Our tests are designed to show if you or your team are asking the right questions and getting the honest answer in return."))?></p>
+					<p><?=htmlspecialchars(__("Our tests are designed to show if you or your team are asking the right questions and getting the honest answer in return."))?></p>
 
 
-					<p><?=htmlspecialchars(_("Training courses are designed to help you and your team meet the demanding requirements, by law, to verify age; and how to ask is very important without offending – keep safe and get training."))?></p>
+					<p><?=htmlspecialchars(__("Training courses are designed to help you and your team meet the demanding requirements, by law, to verify age; and how to ask is very important without offending – keep safe and get training."))?></p>
 				</div>
 				</div>
 			</form>
 			</form>
 		</div>
 		</div>

+ 4 - 4
views/modal_services_3.php

@@ -3,18 +3,18 @@
 		<div class="modal-content">
 		<div class="modal-content">
 			<form>
 			<form>
 				<div class="modal-header">
 				<div class="modal-header">
-					<h5 class="modal-title"><strong><?=htmlspecialchars(_("Bespoke Policy Checks"))?></strong></h5>
+					<h5 class="modal-title"><strong><?=htmlspecialchars(__("Bespoke Policy Checks"))?></strong></h5>
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 						<span aria-hidden="true">&times;</span>
 						<span aria-hidden="true">&times;</span>
 					</button>
 					</button>
 				</div>
 				</div>
 				<div class="modal-body">
 				<div class="modal-body">
 
 
-					<p><img class="img-fluid" src="/img/office.jpg" alt="<?=htmlspecialchars(_("Office"))?>" /></p>
+					<p><img class="img-fluid" src="/img/office.jpg" alt="<?=htmlspecialchars(__("Office"))?>" /></p>
 
 
-					<p><?=htmlspecialchars(_("Unlike our other tests which are quite specific, this service is tailored to suit your business. We were approached by several clients to test their premises for various company policy related issues such as attire, attitude and so on."))?></p>
+					<p><?=htmlspecialchars(__("Unlike our other tests which are quite specific, this service is tailored to suit your business. We were approached by several clients to test their premises for various company policy related issues such as attire, attitude and so on."))?></p>
 
 
-					<p><?=htmlspecialchars(_("First impressions count, so if your staff aren't presenting the \"Face of the Company\" correctly, you may lose that client and all the possible benefits with it. A simple test by Check Policy will help you train your staff accordingly and keep them sharp with company policy."))?></p>
+					<p><?=htmlspecialchars(__("First impressions count, so if your staff aren't presenting the \"Face of the Company\" correctly, you may lose that client and all the possible benefits with it. A simple test by %s will help you train your staff accordingly and keep them sharp with company policy.", APP_NAME))?></p>
 				</div>
 				</div>
 			</form>
 			</form>
 		</div>
 		</div>

+ 9 - 9
views/modal_test_claim.php

@@ -11,33 +11,33 @@ $selected_day = date("j", $unix_default);
 		<div class="modal-content">
 		<div class="modal-content">
 			<form>
 			<form>
 				<div class="modal-header">
 				<div class="modal-header">
-					<h5 class="modal-title"><strong><?=htmlspecialchars(_("Confirm Selected Tests"))?></strong></h5>
+					<h5 class="modal-title"><strong><?=htmlspecialchars(__("Confirm Selected Tests"))?></strong></h5>
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="modal-close-button">
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="modal-close-button">
 						<span aria-hidden="true">&times;</span>
 						<span aria-hidden="true">&times;</span>
 					</button>
 					</button>
 				</div>
 				</div>
 				<div class="modal-body">
 				<div class="modal-body">
 
 
-					<p><?=htmlspecialchars(_("You have selected the following tests:"))?></p>
+					<p><?=htmlspecialchars(__("You have selected the following tests:"))?></p>
 
 
 					<div class="list-group limit-height-2 mb-3">
 					<div class="list-group limit-height-2 mb-3">
 					</div>
 					</div>
 
 
-					<p><?=htmlspecialchars(_("The due date is:"))?> <strong class="text-danger"><?=date("l jS F", $unix_default)?></strong></p>
+					<p><?=htmlspecialchars(__("The due date is:"))?> <strong class="text-danger"><?=date("l jS F", $unix_default)?></strong></p>
 
 
-					<p><?=htmlspecialchars(_("By confirming, you agree that:"))?></p>
+					<p><?=htmlspecialchars(__("By confirming, you agree that:"))?></p>
 
 
 					<ul>
 					<ul>
-						<li><?=htmlspecialchars(_("You will execute these tests by the due date displayed above."))?></li>
-						<li><?=htmlspecialchars(_("Failure to complete tests by the due date without good reason may result in the tests being unassigned from yourself and limit your ability to claim tests in the future."))?></li>
+						<li><?=htmlspecialchars(__("You will execute these tests by the due date displayed above."))?></li>
+						<li><?=htmlspecialchars(__("Failure to complete tests by the due date without good reason may result in the tests being unassigned from yourself and limit your ability to claim tests in the future."))?></li>
 					</ul>
 					</ul>
 
 
 
 
 				</div>
 				</div>
 				<div class="modal-footer">
 				<div class="modal-footer">
-					<button type="button" class="btn btn-secondary" id="claim-cancel-button" data-dismiss="modal"><?=htmlspecialchars(_("Cancel"))?></button>
-					<button type="button" class="btn btn-primary" id="claim-confirm-button"><?=htmlspecialchars(_("Confirm"))?></button>
-					<a class="btn btn-primary" id="claim-finish-button" style="display: none;" href="/account/tests/available"><?=htmlspecialchars(_("Finish"))?></a>
+					<button type="button" class="btn btn-secondary" id="claim-cancel-button" data-dismiss="modal"><?=htmlspecialchars(__("Cancel"))?></button>
+					<button type="button" class="btn btn-primary" id="claim-confirm-button"><?=htmlspecialchars(__("Confirm"))?></button>
+					<a class="btn btn-primary" id="claim-finish-button" style="display: none;" href="/account/tests/available"><?=htmlspecialchars(__("Finish"))?></a>
 				</div>
 				</div>
 			</form>
 			</form>
 		</div>
 		</div>

+ 6 - 6
views/modal_test_invoice.php

@@ -4,7 +4,7 @@
 			<form method="get" action="" target="_blank">
 			<form method="get" action="" target="_blank">
 
 
 				<div class="modal-header">
 				<div class="modal-header">
-					<h5 class="modal-title"><strong><?=htmlspecialchars(_("Download Invoice"))?></strong></h5>
+					<h5 class="modal-title"><strong><?=htmlspecialchars(__("Download Invoice"))?></strong></h5>
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
 						<span aria-hidden="true">&times;</span>
 						<span aria-hidden="true">&times;</span>
 					</button>
 					</button>
@@ -12,22 +12,22 @@
 				<div class="modal-body">
 				<div class="modal-body">
 					<div class="row mb-3">
 					<div class="row mb-3">
 						<div class="col-sm-4 col-form-label">
 						<div class="col-sm-4 col-form-label">
-							<label for="travel-cost"><?=htmlspecialchars(_("Travel Costs"))?></label>
+							<label for="travel-cost"><?=htmlspecialchars(__("Travel Costs"))?></label>
 						</div>
 						</div>
 						<div class="col-sm">
 						<div class="col-sm">
 							<div class="input-group">
 							<div class="input-group">
 								<div class="input-group-prepend">
 								<div class="input-group-prepend">
-									<span class="input-group-text"><?=htmlspecialchars(_("£"))?></span>
+									<span class="input-group-text"><?=htmlspecialchars(__("£"))?></span>
 								</div>
 								</div>
 								<input class="form-control" type="number" step="0.01" min="0" name="travel_cost" id="travel-cost" value="0.00" />
 								<input class="form-control" type="number" step="0.01" min="0" name="travel_cost" id="travel-cost" value="0.00" />
 							</div>
 							</div>
-							<small class="form-text text-muted"><?=htmlspecialchars(_("You may be contacted for verification purposes."))?></small>
+							<small class="form-text text-muted"><?=htmlspecialchars(__("You may be contacted for verification purposes."))?></small>
 						</div>
 						</div>
 					</div>
 					</div>
 					<div class="row">
 					<div class="row">
 						<div class="col-sm offset-sm-4">
 						<div class="col-sm offset-sm-4">
-							<button class="btn btn-primary" type="submit"><?=htmlspecialchars(_("Download Invoice"))?></button>
-							<small class="form-text text-danger"><?=htmlspecialchars(_("Travel costs are locked after downloading for the first time, please ensure it is correct!"))?></small>
+							<button class="btn btn-primary" type="submit"><?=htmlspecialchars(__("Download Invoice"))?></button>
+							<small class="form-text text-danger"><?=htmlspecialchars(__("Travel costs are locked after downloading for the first time, please ensure it is correct!"))?></small>
 						</div>
 						</div>
 					</div>
 					</div>
 				</div>
 				</div>

+ 3 - 3
views/pagination.php

@@ -29,18 +29,18 @@ $next_url = $path . "?" . http_build_query(array_merge($nvp, ["page" => $page +
 				<li class="page-item <?=$previous_disabled?>">
 				<li class="page-item <?=$previous_disabled?>">
 					<a class="page-link" href="<?=htmlspecialchars($previous_url)?>">
 					<a class="page-link" href="<?=htmlspecialchars($previous_url)?>">
 						<span aria-hidden="true">&laquo;</span>
 						<span aria-hidden="true">&laquo;</span>
-						<span class="sr-only"><?=htmlspecialchars(_("Previous"))?></span>
+						<span class="sr-only"><?=htmlspecialchars(__("Previous"))?></span>
 					</a>
 					</a>
 				</li>
 				</li>
 				<li class="page-item">
 				<li class="page-item">
 					<a class="page-link" href="#" data-toggle="modal" data-target="#modal-page-jump">
 					<a class="page-link" href="#" data-toggle="modal" data-target="#modal-page-jump">
-						<?=sprintf(_("Page %s of %s"), number_format($page), number_format($page_count))?>
+						<?=sprintf(__("Page %s of %s"), number_format($page), number_format($page_count))?>
 					</a>
 					</a>
 				</li>
 				</li>
 				<li class="page-item <?=$next_disabled?>">
 				<li class="page-item <?=$next_disabled?>">
 					<a class="page-link" href="<?=htmlspecialchars($next_url)?>">
 					<a class="page-link" href="<?=htmlspecialchars($next_url)?>">
 						<span aria-hidden="true">&raquo;</span>
 						<span aria-hidden="true">&raquo;</span>
-						<span class="sr-only"><?=htmlspecialchars(_("Next"))?></span>
+						<span class="sr-only"><?=htmlspecialchars(__("Next"))?></span>
 					</a>
 					</a>
 				</li>
 				</li>
 			</ul>
 			</ul>

+ 7 - 7
views/practice_form.php

@@ -8,11 +8,11 @@ else if($test->status == Test::STATUS_STARTED) {
 }
 }
 else {
 else {
 	?>
 	?>
-	<h2><?=htmlspecialchars(_("Test Completed"))?></h2>
+	<h2><?=htmlspecialchars(__("Test Completed"))?></h2>
 
 
-	<p class="text-lead"><?=htmlspecialchars(_("Thanks for taking a practice test. You can find your submitted results below."))?></p>
+	<p class="text-lead"><?=htmlspecialchars(__("Thanks for taking a practice test. You can find your submitted results below."))?></p>
 
 
-	<p><a class="btn btn-lg btn-primary" href="/account/practice/<?=$template->id?>?reset=1"><?=htmlspecialchars(_("Start Over"))?></a></p>
+	<p><a class="btn btn-lg btn-primary" href="/account/practice/<?=$template->id?>?reset=1"><?=htmlspecialchars(__("Start Over"))?></a></p>
 	<?php
 	<?php
 
 
 	$values = $test->getValues();
 	$values = $test->getValues();
@@ -38,7 +38,7 @@ else {
 					<?=htmlspecialchars($field->label)?>
 					<?=htmlspecialchars($field->label)?>
 				</div>
 				</div>
 				<div class="col-sm">
 				<div class="col-sm">
-					<a class="btn btn-primary" href="/account/practice/<?=$template->id?>/files/<?=htmlspecialchars($name)?>" target="_blank"><?=htmlspecialchars(_("View Image"))?></a>
+					<a class="btn btn-primary" href="/account/practice/<?=$template->id?>/files/<?=htmlspecialchars($name)?>" target="_blank"><?=htmlspecialchars(__("View Image"))?></a>
 				</div>
 				</div>
 			</div>
 			</div>
 			<?php
 			<?php
@@ -53,17 +53,17 @@ else {
 
 
 	<hr />
 	<hr />
 
 
-	<h3><?=htmlspecialchars(_("Test Date/Time"))?></h3>
+	<h3><?=htmlspecialchars(__("Test Date/Time"))?></h3>
 
 
 	<div class="row mb-1">
 	<div class="row mb-1">
-		<label class="col-sm-4 col-form-label"><?=htmlspecialchars(_("Test Start"))?></label>
+		<label class="col-sm-4 col-form-label"><?=htmlspecialchars(__("Test Start"))?></label>
 		<div class="col-sm">
 		<div class="col-sm">
 			<?=htmlspecialchars($test->dts_start)?>
 			<?=htmlspecialchars($test->dts_start)?>
 		</div>
 		</div>
 	</div>
 	</div>
 
 
 	<div class="row mb-1">
 	<div class="row mb-1">
-		<label class="col-sm-4 col-form-label"><?=htmlspecialchars(_("Test End"))?></label>
+		<label class="col-sm-4 col-form-label"><?=htmlspecialchars(__("Test End"))?></label>
 		<div class="col-sm">
 		<div class="col-sm">
 			<?=htmlspecialchars($test->dts_end)?>
 			<?=htmlspecialchars($test->dts_end)?>
 		</div>
 		</div>

+ 3 - 3
views/practice_template_select.php

@@ -1,12 +1,12 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 
 
-	<h2><?=htmlspecialchars(_("Select Practice Form"))?></h2>
+	<h2><?=htmlspecialchars(__("Select Practice Form"))?></h2>
 
 
 	<?php
 	<?php
 	if(empty($templates)) {
 	if(empty($templates)) {
 		?>
 		?>
 		<div class="alert alert-info">
 		<div class="alert alert-info">
-			<?=htmlspecialchars(_("There are no practice forms available at the moment. Please try again later."))?>
+			<?=htmlspecialchars(__("There are no practice forms available at the moment. Please try again later."))?>
 		</div>
 		</div>
 		<?php
 		<?php
 	}
 	}
@@ -17,7 +17,7 @@
 		foreach($templates as $template) {
 		foreach($templates as $template) {
 			?>
 			?>
 			<a class="list-group-item list-group-item-action" href="/account/practice/<?=$template->id?>">
 			<a class="list-group-item list-group-item-action" href="/account/practice/<?=$template->id?>">
-				<?=sprintf(htmlspecialchars(_("Practice Form #%d")), $template->id)?>
+				<?=sprintf(htmlspecialchars(__("Practice Form #%d")), $template->id)?>
 			</a>
 			</a>
 			<?php
 			<?php
 		}
 		}

+ 1 - 1
views/privacy_policy.php

@@ -1,7 +1,7 @@
 <div class="container mt-3 py-4">
 <div class="container mt-3 py-4">
 	<h2>What is this Privacy Policy for?</h2>
 	<h2>What is this Privacy Policy for?</h2>
 
 
-	<p>This privacy policy is for this website and served by Check Policy Limited and governs the privacy of its users who choose to use it.</p>
+	<p>This privacy policy is for this website and served by <?=htmlspecialchars(COMPANY_NAME)?> and governs the privacy of its users who choose to use it.</p>
 
 
 	<p>The policy sets out the different areas where user privacy is concerned and outlines the obligations & requirements of the users, the website and website owners. Furthermore the way this website processes, stores and protects user data and information will also be detailed within this policy.</p>
 	<p>The policy sets out the different areas where user privacy is concerned and outlines the obligations & requirements of the users, the website and website owners. Furthermore the way this website processes, stores and protects user data and information will also be detailed within this policy.</p>
 
 

+ 25 - 0
views/project.php

@@ -32,6 +32,19 @@ var projectID = <?=$project->id?>;
 					<a class="dropdown-item" href="/account/projects/<?=$project->id?>/export-csv">Export CSV</a>
 					<a class="dropdown-item" href="/account/projects/<?=$project->id?>/export-csv">Export CSV</a>
 					<a class="dropdown-item" href="/account/projects/<?=$project->id?>/export-customer-csv">Export Customer CSV</a>
 					<a class="dropdown-item" href="/account/projects/<?=$project->id?>/export-customer-csv">Export Customer CSV</a>
 					<a class="dropdown-item" href="/account/projects/<?=$project->id?>/export-kml">Export KML</a>
 					<a class="dropdown-item" href="/account/projects/<?=$project->id?>/export-kml">Export KML</a>
+					<?php
+					if($project->dts_finished) {
+						?>
+						<a class="dropdown-item" href="/account/projects/<?=$project->id?>/invoice">Generate Invoice</a>
+						<a class="dropdown-item" href="/account/projects/<?=$project->id?>/mark-unfinished">Mark Unfinished</a>
+						<?php
+					}
+					else {
+						?>
+						<a class="dropdown-item" href="/account/projects/<?=$project->id?>/mark-finished">Mark Finished</a>
+						<?php
+					}
+					?>
 				</div>
 				</div>
 			</div>
 			</div>
 			<?php
 			<?php
@@ -40,6 +53,18 @@ var projectID = <?=$project->id?>;
 		</div>
 		</div>
 	</div>
 	</div>
 
 
+	<?php
+	if($project->dts_finished) {
+		$user = User::queryOne(["id" => $project->user_id_finished]);
+		?>
+		<div class="alert alert-success">
+			<i class="fa fa-fw fa-check"></i>
+			This project was marked as finished by <a href="<?=htmlspecialchars($user->getURL())?>"><?=htmlspecialchars($user->getDisplayName())?></a> on <?=Util::getDisplayDateTimeFromUTC($project->dts_finished)?>.
+		</div>
+		<?php
+	}
+	?>
+
 	<div class="row">
 	<div class="row">
 		<div class="col-md-6">
 		<div class="col-md-6">
 			<div class="card mb-3">
 			<div class="card mb-3">

+ 11 - 0
views/project_form.php

@@ -60,6 +60,17 @@ $time_of_day_options = [
 						<input class="form-control" type="number" name="test_count" id="test-count" placeholder="Enter test count" value="<?=htmlspecialchars($project->test_count)?>" required />
 						<input class="form-control" type="number" name="test_count" id="test-count" placeholder="Enter test count" value="<?=htmlspecialchars($project->test_count)?>" required />
 					</div>
 					</div>
 				</div>
 				</div>
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="default-customer-fee">Default Customer Fee</label>
+					<div class="col-sm">
+						<div class="input-group">
+							<div class="input-group-prepend">
+								<span class="input-group-text">£</span>
+							</div>
+							<input class="form-control" type="number" name="default_customer_fee" min=0" step="0.01" id="default-customer-fee" placeholder="Enter default customer fee" value="<?=htmlspecialchars($project->default_customer_fee)?>" required />
+						</div>
+					</div>
+				</div>
 				<div class="row mb-1">
 				<div class="row mb-1">
 					<label class="col-sm-4 col-form-label" for="default-tester-fee">Default Tester Fee</label>
 					<label class="col-sm-4 col-form-label" for="default-tester-fee">Default Tester Fee</label>
 					<div class="col-sm">
 					<div class="col-sm">

+ 5 - 0
views/project_list.php

@@ -51,6 +51,11 @@
 					<i class="fal fa-<?=$time_of_day_icon?>" data-toggle="tooltip" data-title="<?=$time_of_day_text?> Tests"></i>
 					<i class="fal fa-<?=$time_of_day_icon?>" data-toggle="tooltip" data-title="<?=$time_of_day_text?> Tests"></i>
 					<?php
 					<?php
 				}
 				}
+				if($project->dts_finished) {
+					?>
+					<i class="fa fa-fw fa-check text-success" title="Finished" data-toggle="tooltip"></i>
+					<?php
+				}
 				?>
 				?>
 			</td>
 			</td>
 			<td class="align-middle">
 			<td class="align-middle">

Некоторые файлы не были показаны из-за большого количества измененных файлов