diff options
Diffstat (limited to 'includes/navigation.inc')
-rw-r--r-- | includes/navigation.inc | 379 |
1 files changed, 379 insertions, 0 deletions
diff --git a/includes/navigation.inc b/includes/navigation.inc new file mode 100644 index 0000000..8ad019c --- /dev/null +++ b/includes/navigation.inc @@ -0,0 +1,379 @@ +<?php + +$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); + +$subsystems1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc.json"), true); +$cloudburst_subsystemsNotMember = array_values(array_filter($subsystems1, function ($i) { + return $i["source_type"] !== "member"; +})); + +$subsystems2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd.json"), true); +$raindrops_subsystemsNotMember = array_values(array_filter($subsystems2, function ($i) { + return $i["source_type"] !== "member"; +})); + +global $navigation; +global $toplevel; + +$navigation_admin = [ + "admin" => true, + "name" => "Administrator", + "icon" => "/assets/icons/admin.svg", + "invert" => true, + "items" => [ + "alerts" => [ + "name" => null, + "minimal" => true, + "items" => [ + [ + "name" => $pages["emergency"]["name"], + "icon" => "/assets/icons/emergency.svg", + "invert" => false, + "link" => "/-/emergency", + "stepped" => "rgb(220,53,69)" + ], + [ + "name" => $pages["wakeup"]["name"], + "icon" => "/assets/icons/wakeup.svg", + "invert" => false, + "link" => "/-/wakeup", + "stepped" => "rgb(13,202,240)" + ], + [ + "name" => $pages["pleasure"]["name"], + "icon" => "/assets/icons/pleasure.svg", + "invert" => false, + "link" => "/-/pleasure", + "stepped" => "rgb(25,135,84)" + ] + ] + ], + "apps" => [ + "name" => "Applications", + "minimal" => false, + "items" => [ + [ + "name" => $pages["dashboard"]["name"], + "icon" => "/assets/icons/dashboard.svg", + "invert" => true, + "link" => "/-/dashboard", + "stepped" => null + ], + [ + "name" => $pages["about"]["name"], + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/-/about", + "stepped" => null + ], + [ + "name" => $pages["fronting"]["name"], + "icon" => "/assets/icons/fronting.svg", + "invert" => true, + "link" => "/-/fronting", + "stepped" => null + ], + [ + "name" => $pages["actions"]["name"], + "icon" => "/assets/icons/actions.svg", + "invert" => true, + "link" => "/-/actions", + "stepped" => null + ], + [ + "name" => $pages["rules"]["name"], + "icon" => "/assets/icons/rules.svg", + "invert" => true, + "link" => "/-/rules", + "stepped" => null + ], + [ + "name" => $pages["docs"]["name"], + "icon" => "/assets/icons/docs.svg", + "invert" => true, + "link" => "/-/docs", + "stepped" => null + ], + [ + "name" => $pages["nicknames"]["name"], + "icon" => "/assets/icons/nicknames.svg", + "invert" => true, + "link" => "/-/nicknames", + "stepped" => null + ], + [ + "name" => $pages["together"]["name"], + "icon" => "/assets/icons/together.svg", + "invert" => true, + "link" => "/-/together", + "stepped" => null + ], + [ + "name" => $pages["splitting"]["name"], + "icon" => "/assets/icons/splitting.svg", + "invert" => true, + "link" => "/-/splitting", + "stepped" => null + ], + [ + "name" => $pages["byfront"]["name"], + "icon" => "/assets/icons/byfront.svg", + "invert" => true, + "link" => "/-/byfront", + "stepped" => null + ], + [ + "name" => $pages["travelling"]["name"], + "icon" => "/assets/icons/travelling.svg", + "invert" => true, + "link" => "/-/travelling", + "stepped" => null + ], + [ + "name" => $pages["stats"]["name"], + "icon" => "/assets/icons/stats.svg", + "invert" => true, + "link" => "/-/stats", + "stepped" => null + ], + [ + "name" => $pages["toys"]["name"], + "icon" => "/assets/icons/toys.svg", + "invert" => true, + "link" => "/-/toys", + "stepped" => null + ] + ] + ], + "debug" => [ + "name" => "Debugging", + "minimal" => false, + "items" => [ + [ + "name" => $pages["debug"]["name"], + "icon" => "/assets/icons/debug.svg", + "invert" => true, + "link" => "/-/debug", + "stepped" => null + ], + [ + "name" => $pages["bitset"]["name"], + "icon" => "/assets/icons/bitset.svg", + "invert" => true, + "link" => "/-/bitset", + "stepped" => null + ], + [ + "name" => $pages["score"]["name"], + "icon" => "/assets/icons/score.svg", + "invert" => true, + "link" => "/-/score", + "stepped" => null + ], + [ + "name" => $pages["logout"]["name"], + "icon" => "/assets/icons/logout.svg", + "invert" => true, + "link" => "/-/logout", + "stepped" => null + ] + ] + ] + ] +]; +$navigation_global = [ + "admin" => false, + "name" => "Global", + "icon" => "/assets/icons/global.svg", + "invert" => true, + "items" => [ + "main" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => $pages["home"]["name"], + "icon" => "/assets/icons/home.svg", + "invert" => true, + "link" => "/", + "stepped" => null + ], + [ + "name" => $pages["disclaimers"]["name"], + "icon" => "/assets/icons/disclaimers.svg", + "invert" => true, + "link" => "/-/disclaimers", + "stepped" => null + ], + [ + "name" => $pages["relations"]["name"], + "icon" => "/assets/icons/relations.svg", + "invert" => true, + "link" => "/-/relations", + "stepped" => null + ], + [ + "name" => $pages["government"]["name"], + "icon" => "/assets/icons/government.svg", + "invert" => true, + "link" => "/-/government", + "stepped" => null + ], + [ + "name" => $pages["terminology"]["name"], + "icon" => "/assets/icons/terminology.svg", + "invert" => true, + "link" => "/-/terminology", + "stepped" => null + ] + ] + ], + "tools" => [ + "name" => "Tools", + "minimal" => false, + "items" => [ + [ + "name" => $pages["parser"]["name"], + "icon" => "/assets/icons/parser.svg", + "invert" => true, + "link" => "/-/parser", + "stepped" => null + ], + [ + "name" => $pages["prefix"]["name"], + "icon" => "/assets/icons/prefix.svg", + "invert" => true, + "link" => "/-/prefix", + "stepped" => null + ] + ] + ] + ] +]; +$navigation_cloudburst = [ + "admin" => false, + "name" => "Cloudburst System", + "icon" => getAsset("ynmuc"), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => "About us", + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/cloudburst", + "stepped" => null + ] + ] + ], + "subsystems" => [ + "name" => "Subsystems", + "minimal" => false, + "items" => array_map(function ($subsystem) { + $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc-" . $subsystem['source'] . ".json"), true); + + return [ + "name" => $ssData['name'] ?? $subsystem['source'], + "icon" => "/assets/uploads/ss-$subsystem[source].png", + "invert" => false, + "link" => "/cloudburst/-/subsystem/$subsystem[source]", + "stepped" => null + ]; + }, $cloudburst_subsystemsNotMember) + ], + "members" => [ + "name" => "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 + ]; + }, 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_raindrops = [ + "admin" => false, + "name" => "Raindrops System", + "icon" => getAsset("gdapd"), + "invert" => false, + "items" => [ + "header" => [ + "name" => null, + "minimal" => false, + "items" => [ + [ + "name" => "About us", + "icon" => "/assets/icons/about.svg", + "invert" => true, + "link" => "/raindrops", + "stepped" => null + ] + ] + ], + "subsystems" => [ + "name" => "Subsystems", + "minimal" => false, + "items" => array_map(function ($subsystem) { + $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd-" . $subsystem['source'] . ".json"), true); + + return [ + "name" => $ssData['name'] ?? $subsystem['source'], + "icon" => "/assets/uploads/ss-$subsystem[source].png", + "invert" => false, + "link" => "/raindrops/-/subsystem/$subsystem[source]", + "stepped" => null + ]; + }, $raindrops_subsystemsNotMember) + ], + "members" => [ + "name" => "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 + ]; + }, 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] === "cloudburst") { + $navigation = [ + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} elseif (isset($parts) && isset($parts[0]) && $parts[0] === "raindrops") { + $navigation = [ + "raindrops" => $navigation_raindrops, + "cloudburst" => $navigation_cloudburst, + "admin" => $navigation_admin, + "global" => $navigation_global + ]; +} else { + $navigation = [ + "admin" => $navigation_admin, + "global" => $navigation_global, + "cloudburst" => $navigation_cloudburst, + "raindrops" => $navigation_raindrops + ]; +}
\ No newline at end of file |