summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/refresh.php2
-rw-r--r--pages/rules.inc55
2 files changed, 42 insertions, 15 deletions
diff --git a/includes/refresh.php b/includes/refresh.php
index 30107e0..bbf8b01 100644
--- a/includes/refresh.php
+++ b/includes/refresh.php
@@ -243,7 +243,7 @@ foreach (json_decode(file_get_contents("./data/ynmuc/members.json"), true) as $m
echo("Backing up...\n");
-if (date('i') === "00") {
+if (date('i') === "00" || date('i') === "01" || date('i') === "02" || date('i') === "03" || date('i') === "04") {
require_once "./backup.inc";
echo("Backup completed\n");
} else {
diff --git a/pages/rules.inc b/pages/rules.inc
index 2268e75..bf156f2 100644
--- a/pages/rules.inc
+++ b/pages/rules.inc
@@ -50,14 +50,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
$rules = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules/rules.json"), true);
$protectorCloudburst = array_values(array_filter(scoreOrderGlobal(), function ($i) {
- return $i["_system"] === "ynmuc" && $i["_metadata"]["protector"];
- }))[0];
+ return $i["_system"] === "ynmuc" && $i["_metadata"]["leader"];
+ }));
$protectorRaindrops = array_values(array_filter(scoreOrderGlobal(), function ($i) {
- return $i["_system"] === "gdapd" && $i["_metadata"]["protector"];
- }))[0];
-
- $pcName = getMiniName($protectorCloudburst["display_name"] ?? $protectorCloudburst["name"]);
- $prName = getMiniName($protectorRaindrops["display_name"] ?? $protectorRaindrops["name"]);
+ return $i["_system"] === "gdapd" && $i["_metadata"]["leader"];
+ }));
?>
@@ -72,14 +69,34 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
<div style="margin-top:10px;" class="alert alert-warning">
<b>This rule has not yet been approved.</b> All rules need to be approved by the leaders from both systems. This rule is still missing approval from <?php
+ $list = [];
+
if ($rule["approved"][0] === false) {
if ($rule["approved"][1] === false) {
- echo($pcName . " and " . $prName);
+ array_push($list, ...array_map(function ($i) {
+ return $i["display_name"] ?? $i["name"];
+ }, $protectorCloudburst));
+ array_push($list, ...array_map(function ($i) {
+ return $i["display_name"] ?? $i["name"];
+ }, $protectorRaindrops));
} else {
- echo($pcName);
+ array_push($list, ...array_map(function ($i) {
+ return $i["display_name"] ?? $i["name"];
+ }, $protectorCloudburst));
}
} else if ($rule["approved"][1] === false) {
- echo($prName);
+ array_push($list, ...array_map(function ($i) {
+ return $i["display_name"] ?? $i["name"];
+ }, $protectorRaindrops));
+ }
+
+ foreach ($list as $index => $item) {
+ echo($item);
+ if ($index < count($list) - 2) {
+ echo(", ");
+ } else if ($index < count($list) - 1) {
+ echo(" and ");
+ }
}
?>.
@@ -93,6 +110,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
</div>
</div>
+<style>
+ .modal-dialog {
+ margin-bottom: 3.5rem;
+ }
+</style>
+
<div class="modal fade" id="editor">
<div class="modal-dialog">
<div class="modal-content">
@@ -114,12 +137,16 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
<textarea <?= $index === 1 ? 'id="default-rule--content"' : '' ?> name="payload[<?= $index - 1 ?>][content]" rows="5" class="form-control" style="resize: none;color:white;background:#111;border-color:#222;" placeholder="Rule details"><?= strip_tags($rule["content"] ?? "") ?></textarea>
<label style="margin-top:10px;margin-left:5px;">
- <input <?= $index === 1 ? 'id="default-rule--approval-1"' : '' ?> <?= ($rule["approved"][0] ?? false) ? "checked" : "" ?> type="checkbox" name="payload[<?= $index - 1 ?>][approved][0]">
- Approved by <?= $pcName ?>
+ <input <?= $index === 1 ? 'id="default-rule--approval-1"' : '' ?> <?= ($rule["approved"][0] ?? false) ? "checked" : "" ?> type="checkbox" class="form-check-input" name="payload[<?= $index - 1 ?>][approved][0]">
+ Approved by <?= implode("/", array_values(array_map(function ($i) {
+ return $i["display_name"] ?? $i["name"];
+ }, $protectorCloudburst))) ?>
</label><br>
<label style="margin-left:5px;">
- <input <?= $index === 1 ? 'id="default-rule--approval-2"' : '' ?> <?= ($rule["approved"][1] ?? false) ? "checked" : "" ?> type="checkbox" name="payload[<?= $index - 1 ?>][approved][1]">
- Approved by <?= $prName ?>
+ <input <?= $index === 1 ? 'id="default-rule--approval-2"' : '' ?> <?= ($rule["approved"][1] ?? false) ? "checked" : "" ?> type="checkbox" class="form-check-input" name="payload[<?= $index - 1 ?>][approved][1]">
+ Approved by <?= implode("/", array_values(array_map(function ($i) {
+ return $i["display_name"] ?? $i["name"];
+ }, $protectorRaindrops))) ?>
</label><br>
<hr>