summaryrefslogtreecommitdiff
path: root/pages/profiles.inc
diff options
context:
space:
mode:
Diffstat (limited to 'pages/profiles.inc')
-rw-r--r--pages/profiles.inc104
1 files changed, 104 insertions, 0 deletions
diff --git a/pages/profiles.inc b/pages/profiles.inc
new file mode 100644
index 0000000..f24d5d9
--- /dev/null
+++ b/pages/profiles.inc
@@ -0,0 +1,104 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE;
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/profiles.inc';
+
+?>
+
+<br>
+<div class="container">
+ <div id="page-content">
+ <h2>Profile scores</h2>
+ <?php
+
+ $ordered = scoreOrderGlobal();
+
+ $ordered = array_map(function ($i) {
+ $i["_score"] = calculateProfileScore($i);
+ return $i;
+ }, $ordered);
+
+ usort($ordered, function ($a, $b) {
+ return $b["_score"]["sortable"] - $a["_score"]["sortable"];
+ });
+
+ $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE['login'] === "raindrops" ? "gdapd" : "ynmuc") . "/fronters.json"), true)["members"];
+
+ ?>
+
+ <?php if (count($fronters) > 0): $me = $fronters[0]; $me = array_values(array_filter($ordered, function ($i) use ($me) { return $i["id"] === $me["id"]; }))[0]; ?>
+ <p>Hi <b><?= $me["display_name"] ?></b>,
+ <?php if ($me["_score"]["progress"] === 1): ?>
+ your profile is complete, congratulations!
+ <?php else: ?>
+ <?php if (count($me["_score"]["actions"]) > 2): ?>
+ your profile is not complete, here is all you need to do:
+ <?php else: ?>
+ your profile is almost complete, all there's left to do is
+ <?php endif; ?>
+ <?php endif; ?>
+
+ <?php if (count($me["_score"]["actions"]) > 2 || count($me["_score"]["actions"]) === 0): ?></p><?php endif; ?>
+
+ <?php if ($me["_score"]["progress"] === 1): ?>
+ <p>You will be getting a Complete Profile badge pretty soon, so watch out for it.</p>
+ <?php elseif (count($me["_score"]["actions"]) > 2): ?>
+ <ul>
+ <?php $index = -1; foreach ($me["_score"]["actions"] as $action): $index++; ?>
+ <li>add <?= $action ?><?= $index !== count($me["_score"]["actions"]) - 1 ? ($index !== count($me["_score"]["actions"]) - 2 ? ";" : "; and") : "" ?></li>
+ <?php endforeach; ?>
+ </ul>
+ <?php else: ?>
+ add <?= implode(" and ", $me["_score"]["actions"]) ?>.
+ <p>Once you are done, you will get a Complete Profile badge.</p>
+ <?php endif; ?>
+
+ <hr>
+ <?php endif; ?>
+
+ <?php foreach ($ordered as $member): ?>
+ <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1.5fr 6fr;">
+ <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;" href="/<?= $member["name"] ?>">
+ <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+
+ <div style="margin: -10px -10px -10px 10px;background: linear-gradient(90deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, .1) <?= round($member["_score"]["progress"] * 100) ?>%, transparent <?= round($member["_score"]["progress"] * 100) ?>.000001%);border-top-right-radius: 10px;border-bottom-right-radius: 10px;display: flex;align-items: center;">
+ <div style="margin-left: 10px; width: 100%;">
+ <?php if (count($member["_score"]["actions"]) < 3): ?>
+ Add <?= implode(" and ", $member["_score"]["actions"]) ?> to get to 100%
+ <?php else: ?>
+ <?= round($member["_score"]["progress"] * 100) ?>% complete
+ <?php endif; ?>
+
+ <div id="icons" style="float:right; margin-right: 10px;">
+ <span title="<?= $member["_score"]["values"][5] ? "This member has a Pony Town character" : "This member does not have a Pony Town character" ?>" data-bs-toggle="tooltip">
+ <img alt="" src="/assets/icons/ponytown.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][5] ? "1" : ".25" ?>;">
+ </span>
+ <span title="<?= $member["_score"]["values"][6] ? "This member has a color" : "This member does not have a color" ?>" data-bs-toggle="tooltip">
+ <img alt="" src="/assets/icons/color.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][6] ? "1" : ".25" ?>;">
+ </span>
+ <span title="<?= $member["_score"]["values"][2] ? "This member has a public page that is over 200 letters long" : ($member["_score"]["pages"][0] ? "This member has a public page but it is only " . $member["_score"]["characters"][0] . " characters long" : "This member does not have a public page") ?>" data-bs-toggle="tooltip">
+ <img alt="" src="/assets/icons/global.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][2] ? "1" : ($member["_score"]["pages"][0] ? ".5" : ".25") ?>;">
+ </span>
+ <span title="<?= $member["_score"]["values"][3] ? "This member has a public page that is over 200 letters long" : ($member["_score"]["pages"][1] ? "This member has a public page but it is only " . $member["_score"]["characters"][1] . " characters long" : "This member does not have a public page") ?>" data-bs-toggle="tooltip">
+ <img alt="" src="/assets/icons/logout.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][3] ? "1" : ($member["_score"]["pages"][1] ? ".5" : ".25") ?>;">
+ </span>
+ <span title="<?= $member["_score"]["values"][0] ? "This member has their age entered" : (in_array("alicorn", $member["_metadata"]["species"]) ? "This member does not have their age entered, but this might be because they are an alicorn" : "This member does not have their age entered") ?>" data-bs-toggle="tooltip">
+ <img alt="" src="/assets/icons/age.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][0] ? "1" : (in_array("alicorn", $member["_metadata"]["species"]) ? ".5" : ".25") ?>;">
+ </span>
+ <span title="<?= $member["_score"]["values"][4] ? "This member has a banner" : "This member does not have a banner" ?>" data-bs-toggle="tooltip">
+ <img alt="" src="/assets/icons/banner.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][4] ? "1" : ".25" ?>;">
+ </span>
+ <span title="<?= $member["_score"]["values"][1] ? "This member has their birth date entered" : "This member does not have their birth date entered" ?>" data-bs-toggle="tooltip">
+ <img alt="" src="/assets/icons/splitting.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][1] ? "1" : ".25" ?>;">
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
+ <?php endforeach; ?>
+ </div>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>