diff options
Diffstat (limited to 'includes/components/navigation.inc')
-rw-r--r-- | includes/components/navigation.inc | 424 |
1 files changed, 424 insertions, 0 deletions
diff --git a/includes/components/navigation.inc b/includes/components/navigation.inc new file mode 100644 index 0000000..beb92bb --- /dev/null +++ b/includes/components/navigation.inc @@ -0,0 +1,424 @@ +<?php + +$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); + +global $navigation; +global $toplevel; +global $lang; global $pages; global $app; + +$navigation_admin = [ + "admin" => true, + "name" => "Private utilities", + "icon" => "/assets/icons/admin.svg", + "invert" => true, + "items" => [ + "alerts" => [ + "name" => null, + "minimal" => true, + "items" => [ + [ + "name" => $pages["emergency"]["name"][$lang["_name"]], + "icon" => "/assets/icons/emergency.svg", + "invert" => false, + "link" => "/-/emergency", + "stepped" => "rgb(220,53,69)", + "private" => false + ], + [ + "name" => $pages["wakeup"]["name"][$lang["_name"]], + "icon" => "/assets/icons/wakeup.svg", + "invert" => false, + "link" => "/-/wakeup", + "stepped" => "rgb(13,202,240)", + "private" => false + ] + ] + ], + "apps" => [ + "name" => $lang["navigation"]["apps"], + "minimal" => false, + "items" => [ + [ + "name" => $pages["fronting"]["name"][$lang["_name"]], + "icon" => "/assets/icons/fronting.svg", + "invert" => true, + "link" => "/-/fronting", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["profiles"]["name"][$lang["_name"]], + "icon" => "/assets/icons/profiles.svg", + "invert" => true, + "link" => "/-/profiles", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["money"]["name"][$lang["_name"]], + "icon" => "/assets/icons/money.svg", + "invert" => true, + "link" => "/-/money", + "stepped" => null, + "private" => true + ], + [ + "name" => $pages["rules"]["name"][$lang["_name"]], + "icon" => "/assets/icons/rules.svg", + "invert" => true, + "link" => "/-/rules", + "stepped" => null, + "private" => true + ], + [ + "name" => $pages["docs"]["name"][$lang["_name"]], + "icon" => "/assets/icons/docs.svg", + "invert" => true, + "link" => "/-/docs", + "stepped" => null, + "private" => true + ], + [ + "name" => $pages["computers"]["name"][$lang["_name"]], + "icon" => "/assets/icons/computers.svg", + "invert" => true, + "link" => "/-/computers", + "stepped" => null, + "private" => true + ], + [ + "name" => $pages["travelling"]["name"][$lang["_name"]], + "icon" => "/assets/icons/travelling.svg", + "invert" => true, + "link" => "/-/travelling", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["stats"]["name"][$lang["_name"]], + "icon" => "/assets/icons/stats.svg", + "invert" => true, + "link" => "/-/stats", + "stepped" => null, + "private" => true + ], + [ + "name" => $pages["logout"]["name"][$lang["_name"]], + "icon" => "/assets/icons/logout.svg", + "invert" => true, + "link" => "/-/logout", + "stepped" => null, + "private" => false + ] + ] + ], + "sort" => [ + "name" => "Sorted members lists", + "minimal" => false, + "items" => [ + [ + "name" => $pages["splitting"]["name"][$lang["_name"]], + "icon" => "/assets/icons/splitting.svg", + "invert" => true, + "link" => "/-/splitting", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["byfront"]["name"][$lang["_name"]], + "icon" => "/assets/icons/byfront.svg", + "invert" => true, + "link" => "/-/byfront", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["alphabet"]["name"][$lang["_name"]], + "icon" => "/assets/icons/alphabet.svg", + "invert" => true, + "link" => "/-/alphabet", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:species"]["name"][$lang["_name"]], + "icon" => "/assets/icons/species.svg", + "invert" => true, + "link" => "/-/byspecies", + "stepped" => null, + "private" => false + ], + ] + ], + /*"debug" => [ + "name" => $lang["navigation"]["debug"], + "minimal" => false, + "items" => [ + [ + "name" => $pages["debug"]["name"][$lang["_name"]], + "icon" => "/assets/icons/debug.svg", + "invert" => true, + "link" => "/-/debug", + "stepped" => null + ], + [ + "name" => $pages["bitset"]["name"][$lang["_name"]], + "icon" => "/assets/icons/bitset.svg", + "invert" => true, + "link" => "/-/bitset", + "stepped" => null + ], + [ + "name" => $pages["score"]["name"][$lang["_name"]], + "icon" => "/assets/icons/score.svg", + "invert" => true, + "link" => "/-/score", + "stepped" => null + ], + [ + "name" => $pages["logout"]["name"][$lang["_name"]], + "icon" => "/assets/icons/logout.svg", + "invert" => true, + "link" => "/-/logout", + "stepped" => null + ] + ] + ]*/ + ] +]; +$navigation_global = [ + "admin" => false, + "name" => $lang["navigation"]["general"], + "icon" => "/assets/icons/global.svg", + "invert" => true, + "items" => [ + "main" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => $pages["home"]["name"][$lang["_name"]], + "icon" => "/assets/icons/home.svg", + "invert" => true, + "link" => "/", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["relations"]["name"][$lang["_name"]], + "icon" => "/assets/icons/relations.svg", + "invert" => true, + "link" => "/-/relations", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["terminology"]["name"][$lang["_name"]], + "icon" => "/assets/icons/terminology.svg", + "invert" => true, + "link" => "/-/terminology", + "stepped" => null, + "private" => false + ] + ] + ] + ] +]; +$navigation_cloudburst = [ + "admin" => false, + "name" => "Cloudburst System", + "icon" => getAsset("ynmuc"), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => $lang["navigation"]["about"], + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/cloudburst", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:history"]["name"][$lang["_name"]], + "icon" => "/assets/icons/history.svg", + "invert" => true, + "link" => "/cloudburst/-/history", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:compare"]["name"][$lang["_name"]], + "icon" => "/assets/icons/compare.svg", + "invert" => true, + "link" => "/cloudburst/-/compare", + "stepped" => null, + "private" => false + ] + ] + ], + "members" => [ + "name" => $lang["navigation"]["members"], + "minimal" => false, + "items" => array_map(function ($member) { + return [ + "name" => $member['display_name'] ?? $member['name'], + "icon" => getAsset($member["system"], $member["id"], "heads"), + "invert" => false, + "link" => "/$member[name]", + "stepped" => null, + "private" => false + ]; + }, array_filter(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true), "ynmuc"), "ynmuc"), function ($member) { + return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; + })) + ] + ] +]; +$navigation_other = [ + "admin" => true, + "name" => $app["other"]["name"], + "icon" => getAsset($app["other"]["id"]), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => $lang["navigation"]["about"], + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/" . $app["other"]["slug"], + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:history"]["name"][$lang["_name"]], + "icon" => "/assets/icons/history.svg", + "invert" => true, + "link" => "/" . $app["other"]["slug"] . "/-/history", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:compare"]["name"][$lang["_name"]], + "icon" => "/assets/icons/compare.svg", + "invert" => true, + "link" => "/" . $app["other"]["slug"] . "/-/compare", + "stepped" => null, + "private" => false + ] + ] + ], + "members" => [ + "name" => $lang["navigation"]["members"], + "minimal" => false, + "items" => array_map(function ($member) { + return [ + "name" => $member['display_name'] ?? $member['name'], + "icon" => getAsset($member["system"], $member["id"], "heads"), + "invert" => false, + "link" => "/$member[name]", + "stepped" => null, + "private" => false + ]; + }, array_filter(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true), $app["other"]["id"]), function ($member) { + return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; + })) + ] + ] +]; +$navigation_raindrops = [ + "admin" => false, + "name" => "Raindrops System", + "icon" => getAsset("gdapd"), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => $lang["navigation"]["about"], + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/raindrops", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:history"]["name"][$lang["_name"]], + "icon" => "/assets/icons/history.svg", + "invert" => true, + "link" => "/raindrops/-/history", + "stepped" => null, + "private" => false + ], + [ + "name" => $pages["s:compare"]["name"][$lang["_name"]], + "icon" => "/assets/icons/compare.svg", + "invert" => true, + "link" => "/raindrops/-/compare", + "stepped" => null, + "private" => false + ] + ] + ], + "members" => [ + "name" => $lang["navigation"]["members"], + "minimal" => false, + "items" => array_map(function ($member) { + return [ + "name" => $member['display_name'] ?? $member['name'], + "icon" => getAsset($member["system"], $member["id"], "heads"), + "invert" => false, + "link" => "/$member[name]", + "stepped" => null, + "private" => false + ]; + }, array_filter(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd"), "gdapd"), function ($member) { + return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; + })) + ] + ] +]; + +global $parts; + +if (isset($parts) && isset($parts[0]) && $parts[0] === $app["other"]["slug"]) { + $navigation = [ + "other" => $navigation_other, + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} elseif (isset($parts) && isset($parts[0]) && $parts[0] === "cloudburst") { + $navigation = [ + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops, + "other" => $navigation_other, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} elseif (isset($parts) && isset($parts[0]) && $parts[0] === "raindrops") { + $navigation = [ + "raindrops" => $navigation_raindrops, + "cloudburst" => $navigation_cloudburst, + "other" => $navigation_other, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} else { + $navigation = [ + "admin" => $navigation_admin, + "global" => $navigation_global, + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops, + "other" => $navigation_other, + ]; +}
\ No newline at end of file |