|
|
@@ -8,12 +8,13 @@ $users_pending_verification = 0;
|
|
|
$tests_pending_verification = 0;
|
|
|
$tests_remaining = 0;
|
|
|
|
|
|
-$links = [];
|
|
|
+$icons = [];
|
|
|
|
|
|
if(Core::$user->level >= User::LEVEL_ADMIN) {
|
|
|
- $links["/account/customers"] = "Customers";
|
|
|
- $links["/account/map-overview"] = "Map Overview";
|
|
|
- $links["/account/users"] = (Core::$user->level == User::LEVEL_SUPERADMIN ? "Users" : "Testers");
|
|
|
+
|
|
|
+ $icons[] = new AccountIcon("Customers", "/account/customers", "warehouse");
|
|
|
+ $icons[] = new AccountIcon("Map Overview", "/account/map-overview", "map-marked");
|
|
|
+ $icons[] = new AccountIcon((Core::$user->level == User::LEVEL_SUPERADMIN ? "Users" : "Testers"), "/account/users", "users");
|
|
|
|
|
|
$users = User::query(["level" => User::LEVEL_UNVERIFIED]);
|
|
|
$tests = Test::query(["status" => Test::STATUS_PENDING_VERIFICATION]);
|
|
|
@@ -23,52 +24,71 @@ if(Core::$user->level >= User::LEVEL_ADMIN) {
|
|
|
}
|
|
|
|
|
|
if(Core::$user->level >= User::LEVEL_CUSTOMER) {
|
|
|
- $links["/account/reports"] = "Reports";
|
|
|
- $links["/account/projects"] = "Projects";
|
|
|
- $links["/account/locations"] = "Locations";
|
|
|
- $links["/account/templates"] = "Templates";
|
|
|
+ $icons[] = new AccountIcon("Reports", "/account/reports", "chart-pie");
|
|
|
+ $icons[] = new AccountIcon("Projects", "/account/projects", "list");
|
|
|
+ $icons[] = new AccountIcon("Locations", "/account/locations", "map-marker");
|
|
|
+ $icons[] = new AccountIcon("Templates", "/account/templates", "file-alt");
|
|
|
}
|
|
|
|
|
|
if(Core::$user->level >= User::LEVEL_TESTER) {
|
|
|
- $links["/account/tests"] = "Tests";
|
|
|
- $links["/account/practice"] = "Practice";
|
|
|
-
|
|
|
$tests = Core::$user->getPendingTests();
|
|
|
$tests_remaining = count($tests);
|
|
|
|
|
|
+ $tests_icon = new AccountIcon("Tests", "/account/tests", "clipboard-check");
|
|
|
+ $tests_icon->setCounter($tests_remaining);
|
|
|
+
|
|
|
+ $icons[] = $tests_icon;
|
|
|
+ $icons[] = new AccountIcon("Practice", "/account/practice", "chalkboard-teacher");
|
|
|
}
|
|
|
|
|
|
if(Core::$user->level == User::LEVEL_TESTER) {
|
|
|
- $links["/account/addresses"] = "Addresses";
|
|
|
- $links["/account/tests/completed"] = "Tests (Completed)";
|
|
|
+ $icons[] = new AccountIcon("Addresses", "/account/addresses", "address-book");
|
|
|
+ $icons[] = new AccountIcon("Tests (Completed)", "/account/tests/completed", "check");
|
|
|
}
|
|
|
|
|
|
if(Core::$user->level == User::LEVEL_REGISTERED) {
|
|
|
- $links["/account/submit-id"] = "Submit ID";
|
|
|
+ $icons[] = new AccountIcon("Submit ID", "/account/submit-id", "id-card");
|
|
|
}
|
|
|
|
|
|
if(!Core::$user->terms_accepted) {
|
|
|
- $links = [];
|
|
|
+ $icons = [];
|
|
|
}
|
|
|
|
|
|
-$links["/account/settings"] = "Settings";
|
|
|
+$icons[] = new AccountIcon("Settings", "/account/settings", "cog");
|
|
|
|
|
|
-asort($links);
|
|
|
+usort($icons, function($a, $b) {
|
|
|
+ return $a->name <=> $b->name;
|
|
|
+});
|
|
|
|
|
|
// Actions
|
|
|
$actions = [];
|
|
|
if(Core::$user->level == User::LEVEL_DEACTIVATED) {
|
|
|
- $actions["/account/reactivate"] = "Reactivate Account";
|
|
|
+ $actions[] = new AccountIcon("Reactivate Account", "/account/reactivate", "user-check");
|
|
|
}
|
|
|
else if(Core::$user->level == User::LEVEL_TESTER) {
|
|
|
- $actions["/account/deactivate"] = "Deactivate Account...";
|
|
|
+ $actions[] = new AccountIcon("Deactivate Account...", "/account/deactivate", "user-times");
|
|
|
+}
|
|
|
+
|
|
|
+$actions[] = new AccountIcon("Delete Account...", "/account/delete", "user-slash");
|
|
|
+
|
|
|
+// To-do
|
|
|
+$to_do = [];
|
|
|
+if($users_pending_verification) {
|
|
|
+ $icon = new AccountIcon("Verify Users", "/account/users?level=" . User::LEVEL_UNVERIFIED, "user-check");
|
|
|
+ $icon->setCounter($users_pending_verification);
|
|
|
+ $to_do[] = $icon;
|
|
|
+}
|
|
|
+
|
|
|
+if($tests_pending_verification) {
|
|
|
+ $icon = new AccountIcon("Verify Tests", "/account/tests?status=" . Test::STATUS_PENDING_VERIFICATION, "clipboard-check");
|
|
|
+ $icon->setCounter($tests_pending_verification);
|
|
|
+ $to_do[] = $icon;
|
|
|
}
|
|
|
-$actions["/account/delete"] = "Delete Account...";
|
|
|
|
|
|
$referrals = Core::$user->getReferrals();
|
|
|
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
-View::include("account", compact("links", "actions", "referrals", "users_pending_verification", "tests_pending_verification", "tests_remaining"));
|
|
|
+View::include("account", compact("icons", "actions", "to_do", "referrals"));
|
|
|
View::includeOnce("footer");
|
|
|
|
|
|
?>
|